developers
Threads by month
- ----- 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
- 6811 discussions
[Maria-developers] New (by Bothorsen): Fix table_cache negative scalability (73)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Fix table_cache negative scalability
CREATION DATE..: Fri, 18 Dec 2009, 16:31
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 73 (http://askmonty.org/worklog/?tid=73)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
DESCRIPTION:
Fix the problem described in this blog entry:
http://www.mysqlperformanceblog.com/2009/11/16/table_cache-negative-scalabi…
You can read the blog, or the text below.
--- quoted text ---
November 16, 2009
table_cache negative scalability
Posted by peter | Vote on Planet MySQL
Couple of months ago there was a post by FreshBooks on getting great performance
improvements by lowering table_cache variable. So I decided to investigate what
is really happening here.
The common sense approach to tuning caches is to get them as large as you can
if you have enough resources (such as memory). With MySQL common sense however
does not always works weve seen performance issues with large
query_cache_size also sort_buffer_size and read_buffer_size may not give you
better performance if you increase them. I found this also applies to some other
buffers.
Even though having previous experience of surprised behavior I did not expect
such a table_cache issue the LRU for cache management is classics and there
are scalable algorithms to deal with it. I would expect Monty to implement one
of them.
To do the test I have created 100.000 empty tables containing single integer
column and no indexes and when ran SELECT * FROM tableN in the loop. Each table
in such case is accessed only once and on any but first run each access would
require table replacement in table cache based on LRU logic.
MySQL Sandbox helped me to test this with different servers easily.
I did test on CentOS 5.3, Xeon E5405, 16GB RAM and EXT3 file system on the SATA
hard drive.
MySQL 5.0.85 Created 100.000 tables in around 3min 40 sec which is about 450
tables/sec This indicates the fsync is lying on this test system as default
sync_frm option is used.
With default table_cache=64 accessing all tables take 12 sec which is almost
8500 tables/sec which is a great speed. We can note significant writes to the
disk during this read-only benchmark. Why ? Because for MyISAM tables table
header has to be modified each time the table is opened. In this case the
performance was so great because all 100.000 tables data (first block of index)
was placed close by on disk as well as fully cached which made updates to
headers very slow. In the production systems with table headers not in OS cache
you often will see significantly low numbers 100 or less.
With significantly larger table_cache=16384 (and appropriately adjusted number
of open files) the same operation takes 660 seconds which is 151 tables/sec
which is around 50 times slower. Wow. This is the slow down. We can see the load
becomes very CPU bound in this case and it looks like some of the table_cache
algorithms do not scale well.
The absolute numbers are also very interesting 151 tables/sec is not that bad
if you look at it as an absolute number. So if you tune table cache is normal
case and is able to bring down your miss rate (opened_tables) to 10/sec or less
by using large table_cache you should do so. However if you have so many tables
you still see 100+ misses/sec while your data (at least table headers) is well
cached so the cost of table cache miss is not very high, you may be better of
with significantly reduced table cache size.
The next step for me was to see if the problem was fixed in MySQL 5.1 in this
version table_cache was significantly redone and split in table_open_cache and
table_definition_cache and I assumed the behavior may be different as well.
MySQL 5.1.40
I started testing with default table_open_cache=64 and
table_definition_cache=256 the read took about 12 seconds very close to MySQL
5.0.85.
As I increased table_definition_cache to 16384 result remained the same so this
variable is not causing the bottleneck. However increasing table_open_cache to
16384 causes scan to take about 780 sec which is a bit worse than MySQL 5.0.85.
So the problem is not fixed in MySQL 5.1, lets see how MySQL 5.4 behaves.
MySQL 5.4.2
MySQL 5.4.2 has higher default table_open_cache so I took it down to 64 so we
can compare apples to apples. It performs same as MySQL 5.0 and MySQL 5.1 with
small table cache.
With table_open_cache increased to 16384 the test took 750 seconds so the
problem exists in MySQL 5.4 as well.
So the problem is real and it is not fixed even in Performance focused MySQL
5.4. As we can see large table_cache (or table_open_cache_ values indeed can
cause significant performance problems. Interesting enough Innodb has a very
similar task of managing its own cache of file descriptors (set by
innodb_open_files) As the time allows I should test if Heikki knows how to
implement LRU properly so it does not have problem with large number. Well see.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 20
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:22)=-=-
Add estimation time.
Worked 5 hours and estimate 35 hours remain (original estimate increased by 5 hours).
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
------------------------------------------------------------
-=-=(View All Progress Notes, 12 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 20
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:22)=-=-
Add estimation time.
Worked 5 hours and estimate 35 hours remain (original estimate increased by 5 hours).
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
------------------------------------------------------------
-=-=(View All Progress Notes, 12 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 20
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:22)=-=-
Add estimation time.
Worked 5 hours and estimate 35 hours remain (original estimate increased by 5 hours).
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
------------------------------------------------------------
-=-=(View All Progress Notes, 12 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Provide an " ORDER BY FIRST_JOIN.column" feature (59)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Provide an "ORDER BY FIRST_JOIN.column" feature
CREATION DATE..: Thu, 22 Oct 2009, 12:33
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 59 (http://askmonty.org/worklog/?tid=59)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 5
ESTIMATE.......: 20 (hours remain)
ORIG. ESTIMATE.: 20
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:21)=-=-
Last hours added to the wrong worklog item, sorry.
Reported zero hours worked. Estimate unchanged.
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:21)=-=-
Added the estimation time.
Worked 5 hours and estimate 20 hours remain (original estimate increased by 25 hours).
DESCRIPTION:
Question:
How much effort would be required to provide an "ORDER BY
FIRST_JOIN.column" feature? We often do self-join queries and want to
order them by index, i.e.:
create table t1 (a int, b int, unique key 'by_a_b' (a, b)));
select * from t1 x inner join t1 y on (x.b = y.b) where x.a=1 and
y.a=2 order by (x|y).b desc limit 10;
but it is only ordered by index if you order by the first table in the
optimized join order, which could be either x or y depending on which
is more selective. we don't want to force the join order because
often one is far more selective than the other, but the only way to
know what table to order by then is to explain the query first. if
there was some way to tell mysql to just order by the first join in
the optimized order, that would help us. sometimes we do this across
tables too. both of these can be solved by rewriting the query to say
"using" instead of "on" in which case we don't have to specify the
table name of the column, just "order by b desc". but, we also want
to be able to do exclusions, in which case an "on" is required and
therefore we run into ambiguous column names:
Monty answered:
MySQL has an optimization where it knows that if x.b = y.b is used
then it can replace x.b with y.b and y.b with x.b in the WHERE
part
MySQL however doesn't do it for the ORDER BY part and I don't think
that should be very hard to do.
Question continues:
create table t2 (c int, b int, unique key 'by_c_b' (c, b)));
select * from t1 x inner join t1 y using (b) left join t2 on (t2.c =
3 and t1.b = t2.b) where x.a=1 and y.a=2 and t2.c is null order by (x|
y).b desc limit 10;
if we were ordering ascending, i think we could just leave off the
order by entirely in this case and it would happen to work since it's
reading in index order. but the combination of requiring an "on" and
descending sort leaves us unable to use these tricks. if we had
either an "ORDER BY FIRST_JOIN.column" or some way to tell the server
that 'b' is in fact joined as being equivalent across tables (except
where it may be null from left joining) and that we shouldn't have to
specify the table name at all, that would save us having to figure out
the table from the explain.
Monty answers:
It may be that the eq-replacment we have would solve this.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Provide an " ORDER BY FIRST_JOIN.column" feature (59)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Provide an "ORDER BY FIRST_JOIN.column" feature
CREATION DATE..: Thu, 22 Oct 2009, 12:33
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 59 (http://askmonty.org/worklog/?tid=59)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 5
ESTIMATE.......: 20 (hours remain)
ORIG. ESTIMATE.: 20
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:21)=-=-
Added the estimation time.
Worked 5 hours and estimate 20 hours remain (original estimate increased by 25 hours).
DESCRIPTION:
Question:
How much effort would be required to provide an "ORDER BY
FIRST_JOIN.column" feature? We often do self-join queries and want to
order them by index, i.e.:
create table t1 (a int, b int, unique key 'by_a_b' (a, b)));
select * from t1 x inner join t1 y on (x.b = y.b) where x.a=1 and
y.a=2 order by (x|y).b desc limit 10;
but it is only ordered by index if you order by the first table in the
optimized join order, which could be either x or y depending on which
is more selective. we don't want to force the join order because
often one is far more selective than the other, but the only way to
know what table to order by then is to explain the query first. if
there was some way to tell mysql to just order by the first join in
the optimized order, that would help us. sometimes we do this across
tables too. both of these can be solved by rewriting the query to say
"using" instead of "on" in which case we don't have to specify the
table name of the column, just "order by b desc". but, we also want
to be able to do exclusions, in which case an "on" is required and
therefore we run into ambiguous column names:
Monty answered:
MySQL has an optimization where it knows that if x.b = y.b is used
then it can replace x.b with y.b and y.b with x.b in the WHERE
part
MySQL however doesn't do it for the ORDER BY part and I don't think
that should be very hard to do.
Question continues:
create table t2 (c int, b int, unique key 'by_c_b' (c, b)));
select * from t1 x inner join t1 y using (b) left join t2 on (t2.c =
3 and t1.b = t2.b) where x.a=1 and y.a=2 and t2.c is null order by (x|
y).b desc limit 10;
if we were ordering ascending, i think we could just leave off the
order by entirely in this case and it would happen to work since it's
reading in index order. but the combination of requiring an "on" and
descending sort leaves us unable to use these tricks. if we had
either an "ORDER BY FIRST_JOIN.column" or some way to tell the server
that 'b' is in fact joined as being equivalent across tables (except
where it may be null from left joining) and that we shouldn't have to
specify the table name at all, that would save us having to figure out
the table from the explain.
Monty answers:
It may be that the eq-replacment we have would solve this.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 15
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
------------------------------------------------------------
-=-=(View All Progress Notes, 11 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 15
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
------------------------------------------------------------
-=-=(View All Progress Notes, 11 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 15
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
------------------------------------------------------------
-=-=(View All Progress Notes, 11 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
Hakan Kuecuekyilmaz <hakan(a)askmonty.org> writes:
> I would like to put the scripts to a bzr repository. I guess launchpad
> is a good place. A separate repository makes sense to me, or maybe add
> them to the MariaDB sources?
Yes. I have for some time known we need a public repository with the tools we
use for MariaDB development. So now I have created a project for this on
Launchpad.
Branch to push to:
lp:mariadb-tools
Project page:
https://launchpad.net/mariadb-tools
Wiki page:
http://askmonty.org/wiki/index.php/Tools_for_MariaDB
Everybody, please help by moving things from our internal bzr repo
hasky:/usr/local/bzr into this project where relevant. And also please help by
updating the wiki page with appropriate documentation.
> I have a first working version of the wrapper scripts to automatically
> run sql-bench with a set of different configurations.
>From this description, it sounds like something that would make sense to
include in the MariaDB source tree? If so, I guess just commit them and get a
review.
Generally, it is an advantage to keep tools that work on a specific version of
MariaDB inside the source tree, especially for automation (like
Buildbot). Eg. if different variants of the scripts are needed for different
MariaDB versions (maybe using a feature that is not present in older
versions); keeping the scripts inside the tree trivially ensures that the
versions of scripts and of MariaDB matches. It also removes any issues wiht
making sure the scripts are available on a given host.
On the other hand, if the script needs to work with different versions of
MariaDB it probably makes sense to keep it outside of the main source
tree. Maybe the script needs to check out the MariaDB source tree (like
package scripts); it cannot easily checkout itself... Or maybe it needs to
compare two different versions of MariaDB against each other (benchmarks,
upgrade testing).
For some tools the correct approach would be that part is inside the source
tree and part outside.
- Kristian.
1
0
[Maria-developers] Rev 2738: DS-MRR backport: in file:///home/psergey/dev/maria-5.2-dsmrr/
by Sergey Petrunya 16 Dec '09
by Sergey Petrunya 16 Dec '09
16 Dec '09
At file:///home/psergey/dev/maria-5.2-dsmrr/
------------------------------------------------------------
revno: 2738
revision-id: psergey(a)askmonty.org-20091216092851-9ehou85ydmgziniy
parent: psergey(a)askmonty.org-20091215223739-f6xymmvanylqlrg9
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.2-dsmrr
timestamp: Wed 2009-12-16 12:28:51 +0300
message:
DS-MRR backport:
- Fix PBXT test results (PBXT doesn't support MRR or ICP, but we get result
diffs because we've also backported a fix that
- prints out "Using where" when the table has part of WHERE that it has
got from LEFT JOIN's ON expression
- Does a better job at removing equalities that are guaranteed to be true
by use of ref acccess.
=== modified file 'mysql-test/suite/pbxt/r/join_outer.result'
--- a/mysql-test/suite/pbxt/r/join_outer.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/join_outer.result 2009-12-16 09:28:51 +0000
@@ -630,7 +630,7 @@
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index
-1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using index
+1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using where; Using index
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
fooID barID fooID
10 1 NULL
@@ -688,8 +688,8 @@
explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
drop table t1, t2, t3;
create table t1 (
a int(11),
@@ -859,14 +859,14 @@
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON a1=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
a1 a2 a3
1 NULL NULL
EXPLAIN SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1;
a0 a1 a2 a3
@@ -875,7 +875,7 @@
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 index PRIMARY PRIMARY 4 NULL 1 Using index
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a0 1 Using index
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
INSERT INTO t0 VALUES (0);
INSERT INTO t1 VALUES (0);
=== modified file 'mysql-test/suite/pbxt/r/order_by.result'
--- a/mysql-test/suite/pbxt/r/order_by.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/order_by.result 2009-12-16 09:28:51 +0000
@@ -514,7 +514,7 @@
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using where
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using index condition
drop table t1,t2,t3;
CREATE TABLE t1 (
`titre` char(80) NOT NULL default '',
@@ -638,7 +638,7 @@
insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
explain select * from t1 where b=1 or b is null order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null b b 5 const 2 Using where; Using filesort
+1 SIMPLE t1 ref_or_null b b 5 const 2 Using filesort
select * from t1 where b=1 or b is null order by a;
a b
1 1
@@ -647,7 +647,7 @@
4 NULL
explain select * from t1 where b=2 or b is null order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null b b 5 const 2 Using where; Using filesort
+1 SIMPLE t1 ref_or_null b b 5 const 2 Using filesort
select * from t1 where b=2 or b is null order by a;
a b
3 NULL
@@ -897,7 +897,7 @@
ORDER BY c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
-1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
+1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where
SELECT t2.b as c FROM
t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2)
ORDER BY c;
=== modified file 'mysql-test/suite/pbxt/r/partition_pruning.result'
--- a/mysql-test/suite/pbxt/r/partition_pruning.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/partition_pruning.result 2009-12-16 09:28:51 +0000
@@ -533,15 +533,15 @@
test.t2 analyze status OK
explain partitions select * from t2 where b = 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 5 Using where
+1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 5
explain extended select * from t2 where b = 6;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ref b b 5 const 5 100.00 Using where
+1 SIMPLE t2 ref b b 5 const 5 100.00
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = 6)
explain partitions select * from t2 where b = 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 5 Using where
+1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 5
explain extended select * from t2 where b in (1,3,5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range b b 5 NULL 15 100.00 Using where
=== modified file 'mysql-test/suite/pbxt/r/ps_1general.result'
--- a/mysql-test/suite/pbxt/r/ps_1general.result 2009-08-31 11:07:44 +0000
+++ b/mysql-test/suite/pbxt/r/ps_1general.result 2009-12-16 09:28:51 +0000
@@ -465,9 +465,9 @@
def key_len 253 4096 1 Y 0 31 8
def ref 253 2048 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 27 N 1 31 8
+def Extra 253 255 48 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition; Using MRR; Using filesort
drop table if exists t2;
create table t2 (id smallint, name varchar(20)) ;
prepare stmt1 from ' insert into t2 values(?, ?) ' ;
=== modified file 'mysql-test/suite/pbxt/r/range.result'
--- a/mysql-test/suite/pbxt/r/range.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/range.result 2009-12-16 09:28:51 +0000
@@ -221,31 +221,31 @@
update t1 set y=x;
explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select count(*) from t1 where x in (1);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref x x 5 const 1 Using where; Using index
+1 SIMPLE t1 ref x x 5 const 1 Using index
explain select count(*) from t1 where x in (1,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index x x 5 NULL 9 Using where; Using index
@@ -277,7 +277,7 @@
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a,b a 5 NULL 2 Using where
+1 SIMPLE t1 range a,b a 5 NULL 2 Using index condition; Using where; Using MRR
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
a b
DROP TABLE t1;
@@ -920,7 +920,7 @@
('A2','2005-12-01 08:00:00',1000);
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using where
+1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using index condition
Warnings:
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
=== modified file 'mysql-test/suite/pbxt/r/select.result'
--- a/mysql-test/suite/pbxt/r/select.result 2009-10-07 16:56:11 +0000
+++ b/mysql-test/suite/pbxt/r/select.result 2009-12-16 09:28:51 +0000
@@ -1397,15 +1397,15 @@
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
@@ -1421,15 +1421,15 @@
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
@@ -2368,16 +2368,16 @@
insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref c,d d 5 const 1 Using where
-1 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
+1 SIMPLE t2 ref c,d d 5 const 1
+1 SIMPLE t1 ref a a 5 test.t2.c 1
select * from t1 left join t2 on a=c where d in (4);
a b c d
3 2 3 4
4 2 4 4
explain select * from t1 left join t2 on a=c where d = 4;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref c,d d 5 const 1 Using where
-1 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
+1 SIMPLE t2 ref c,d d 5 const 1
+1 SIMPLE t1 ref a a 5 test.t2.c 1
select * from t1 left join t2 on a=c where d = 4;
a b c d
3 2 3 4
@@ -2403,11 +2403,11 @@
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
-1 SIMPLE t2 ref a a 23 test.t1.a 1
+1 SIMPLE t2 ref a a 23 test.t1.a 1 Using where
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
-1 SIMPLE t2 ref a a 23 test.t1.a 1
+1 SIMPLE t2 ref a a 23 test.t1.a 1 Using where
DROP TABLE t1, t2;
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
@@ -2722,7 +2722,7 @@
where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and
t2.b like '%%' order by t2.b limit 0,1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref b,c b 5 const 1 Using where; Using temporary; Using filesort
+1 SIMPLE t1 ref b,c b 5 const 1 Using temporary; Using filesort
1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index; Using join buffer
1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1)
DROP TABLE t1,t2,t3;
@@ -3468,12 +3468,12 @@
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 5 NULL 1 Using where
-1 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
+1 SIMPLE t2 ref c c 5 test.t1.a 1
EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b PRIMARY 4 NULL 1 Using where
-1 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
+1 SIMPLE t2 ref c c 5 test.t1.a 1
DROP TABLE t1, t2;
create table t1 (
a int unsigned not null auto_increment primary key,
@@ -3533,7 +3533,7 @@
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 const idx1 NULL NULL NULL 1
-1 SIMPLE t3 ref idx1 idx1 5 const 1 Using where
+1 SIMPLE t3 ref idx1 idx1 5 const 1
SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
WHERE t1.id=2;
id a b c d e
=== modified file 'mysql-test/suite/pbxt/r/select_safe.result'
--- a/mysql-test/suite/pbxt/r/select_safe.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/select_safe.result 2009-12-16 09:28:51 +0000
@@ -70,12 +70,12 @@
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
-1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
+1 SIMPLE t2 ref b b 21 test.t1.b 1
set MAX_SEEKS_FOR_KEY=1;
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
-1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
+1 SIMPLE t2 ref b b 21 test.t1.b 1
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
create table t1 (a int);
=== modified file 'mysql-test/suite/pbxt/r/subselect.result'
--- a/mysql-test/suite/pbxt/r/subselect.result 2009-10-16 12:45:42 +0000
+++ b/mysql-test/suite/pbxt/r/subselect.result 2009-12-16 09:28:51 +0000
@@ -719,7 +719,7 @@
1
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
@@ -731,7 +731,7 @@
2
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
@@ -903,7 +903,7 @@
explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
-2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
@@ -1333,9 +1333,9 @@
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a)))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1353,8 +1353,8 @@
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
-2 DEPENDENT SUBQUERY t1 ref a a 5 func 1 100.00 Using where; Using index
-2 DEPENDENT SUBQUERY t3 ref a a 5 test.t1.b 1 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 ref a a 5 func 1 100.00 Using index
+2 DEPENDENT SUBQUERY t3 ref a a 5 test.t1.b 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
insert into t1 values (3,31);
=== modified file 'mysql-test/suite/pbxt/r/union.result'
--- a/mysql-test/suite/pbxt/r/union.result 2009-10-07 16:56:11 +0000
+++ b/mysql-test/suite/pbxt/r/union.result 2009-12-16 09:28:51 +0000
@@ -505,7 +505,7 @@
explain (select * from t1 where a=1) union (select * from t1 where b=1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
-2 UNION t1 ref b b 5 const 1 Using where
+2 UNION t1 ref b b 5 const 1
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
drop table t1,t2;
create table t1 ( id int not null auto_increment, primary key (id) ,user_name text );
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2777)
by knielsen@knielsen-hq.org 16 Dec '09
by knielsen@knielsen-hq.org 16 Dec '09
16 Dec '09
#At lp:maria
2777 knielsen(a)knielsen-hq.org 2009-12-16 [merge]
Automatic merge with MariaDB trunk.
modified:
BUILD/FINISH.sh
BUILD/SETUP.sh
client/mysql.cc
client/mysqlcheck.c
client/mysqlslap.c
client/mysqltest.cc
dbug/dbug.c
extra/yassl/taocrypt/include/block.hpp
mysql-test/lib/mtr_cases.pm
mysql-test/lib/mtr_report.pm
mysql-test/lib/v1/mysql-test-run.pl
mysql-test/mysql-test-run.pl
mysql-test/r/ctype_ucs.result
mysql-test/r/warnings.result
mysql-test/suite/federated/disabled.def
mysql-test/suite/federated/federated_server.result
mysql-test/suite/federated/federated_server.test
mysql-test/suite/funcs_1/r/innodb_func_view.result
mysql-test/suite/funcs_1/r/memory_func_view.result
mysql-test/suite/funcs_1/r/myisam_func_view.result
mysql-test/t/ctype_ucs.test
mysql-test/t/warnings.test
plugin/fulltext/plugin_example.c
sql-common/client.c
sql/my_decimal.cc
sql/mysqld.cc
sql/share/errmsg.txt
sql/slave.cc
sql/sql_base.cc
sql/sql_class.cc
sql/sql_insert.cc
storage/federatedx/ha_federatedx.cc
strings/ctype-ucs2.c
unittest/mysys/Makefile.am
vio/viosslfactories.c
=== modified file 'BUILD/FINISH.sh'
--- a/BUILD/FINISH.sh 2009-10-27 13:20:34 +0000
+++ b/BUILD/FINISH.sh 2009-12-06 17:34:54 +0000
@@ -1,6 +1,6 @@
-cflags="$c_warnings $extra_flags"
-cxxflags="$cxx_warnings $base_cxxflags $extra_flags"
-extra_configs="$extra_configs $local_infile_configs"
+cflags="$c_warnings $extra_flags $EXTRA_FLAGS $EXTRA_CFLAGS"
+cxxflags="$cxx_warnings $base_cxxflags $extra_flags $EXTRA_FLAGS $EXTRA_CXXFLAGS"
+extra_configs="$extra_configs $local_infile_configs $EXTRA_CONFIGS"
configure="./configure $base_configs $extra_configs"
commands="\
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh 2009-10-29 00:04:56 +0000
+++ b/BUILD/SETUP.sh 2009-12-06 17:34:54 +0000
@@ -34,6 +34,14 @@ parse_options()
full_debug="=full";;
--warning-mode=*)
warning_mode=`get_key_value "$1"`;;
+ --extra-flags=*)
+ EXTRA_FLAGS=`get_key_value "$1"`;;
+ --extra-cflags=*)
+ EXTRA_CFLAGS=`get_key_value "$1"`;;
+ --extra-cxxflags=*)
+ EXTRA_CXXFLAGS=`get_key_value "$1"`;;
+ --extra-configs=*)
+ EXTRA_CONFIGS=`get_key_value "$1"`;;
-c | --just-configure)
just_configure=1;;
-n | --just-print | --print)
=== 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 'dbug/dbug.c'
--- a/dbug/dbug.c 2009-09-07 20:50:10 +0000
+++ b/dbug/dbug.c 2009-12-07 00:52:40 +0000
@@ -497,12 +497,18 @@ int DbugParse(CODE_STATE *cs, const char
const char *end;
int rel, f_used=0;
struct settings *stack;
+ int org_cs_locked;
stack= cs->stack;
+ if (!(org_cs_locked= cs->locked))
+ {
+ cs->locked= 1;
+ pthread_mutex_lock(&THR_LOCK_dbug);
+ }
+
if (control[0] == '-' && control[1] == '#')
control+=2;
-
rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next)))
{
@@ -550,9 +556,11 @@ int DbugParse(CODE_STATE *cs, const char
while (control < end)
{
int c, sign= (*control == '+') ? 1 : (*control == '-') ? -1 : 0;
- if (sign) control++;
+ if (sign)
+ control++;
c= *control++;
- if (*control == ',') control++;
+ if (*control == ',')
+ control++;
/* XXX when adding new cases here, don't forget _db_explain_ ! */
switch (c) {
case 'd':
@@ -570,7 +578,7 @@ int DbugParse(CODE_STATE *cs, const char
{
if (DEBUGGING)
stack->keywords= ListDel(stack->keywords, control, end);
- break;
+ break;
}
stack->keywords= ListAdd(stack->keywords, control, end);
stack->flags |= DEBUG_ON;
@@ -718,8 +726,13 @@ int DbugParse(CODE_STATE *cs, const char
control=end+1;
end= DbugStrTok(control);
}
- return !rel || f_used;
-}
+ if (!org_cs_locked)
+ {
+ pthread_mutex_unlock(&THR_LOCK_dbug);
+ cs->locked= 0;
+ }
+ return !rel || f_used;}
+
#define framep_trace_flag(cs, frp) (frp ? \
frp->level & TRACE_ON : \
@@ -1340,11 +1353,11 @@ void _db_doprnt_(const char *format,...)
va_start(args,format);
+ if (!cs->locked)
+ pthread_mutex_lock(&THR_LOCK_dbug);
if (_db_keyword_(cs, cs->u_keyword, 0))
{
int save_errno=errno;
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
DoPrefix(cs, cs->u_line);
if (TRACING)
Indent(cs, cs->level + 1);
@@ -1356,6 +1369,9 @@ void _db_doprnt_(const char *format,...)
DbugFlush(cs);
errno=save_errno;
}
+ else if (!cs->locked)
+ pthread_mutex_unlock(&THR_LOCK_dbug);
+
va_end(args);
}
@@ -1386,10 +1402,10 @@ void _db_dump_(uint _line_, const char *
CODE_STATE *cs;
get_code_state_or_return;
+ if (!cs->locked)
+ pthread_mutex_lock(&THR_LOCK_dbug);
if (_db_keyword_(cs, keyword, 0))
{
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
DoPrefix(cs, _line_);
if (TRACING)
{
@@ -1420,6 +1436,8 @@ void _db_dump_(uint _line_, const char *
(void) fputc('\n',cs->stack->out_file);
DbugFlush(cs);
}
+ else if (!cs->locked)
+ pthread_mutex_unlock(&THR_LOCK_dbug);
}
@@ -2105,7 +2123,8 @@ static void DBUGCloseFile(CODE_STATE *cs
{
if (fp != stderr && fp != stdout && fclose(fp) == EOF)
{
- pthread_mutex_lock(&THR_LOCK_dbug);
+ if (!cs->locked)
+ pthread_mutex_lock(&THR_LOCK_dbug);
(void) fprintf(cs->stack->out_file, ERR_CLOSE, cs->process);
perror("");
DbugFlush(cs);
=== modified file 'extra/yassl/taocrypt/include/block.hpp'
--- a/extra/yassl/taocrypt/include/block.hpp 2009-02-10 22:47:54 +0000
+++ b/extra/yassl/taocrypt/include/block.hpp 2009-12-06 17:34:54 +0000
@@ -167,7 +167,8 @@ public:
void CleanNew(word32 newSize)
{
New(newSize);
- memset(buffer_, 0, sz_ * sizeof(T));
+ if (sz_ > 0)
+ memset(buffer_, 0, sz_ * sizeof(T));
}
void New(word32 newSize)
=== modified file 'mysql-test/lib/mtr_cases.pm'
--- a/mysql-test/lib/mtr_cases.pm 2009-11-16 20:49:51 +0000
+++ b/mysql-test/lib/mtr_cases.pm 2009-12-06 17:34:54 +0000
@@ -101,7 +101,6 @@ sub init_pattern {
sub collect_test_cases ($$) {
my $suites= shift; # Semicolon separated list of test suites
- my %found_suites;
my $opt_cases= shift;
my $cases= []; # Array of hash(one hash for each testcase)
@@ -115,7 +114,6 @@ sub collect_test_cases ($$) {
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
"ha_innodb_plugin.sl"],
NOT_REQUIRED);
-
$do_innodb_plugin= ($::mysql_version_id >= 50100 &&
!(IS_WINDOWS && $::opt_embedded_server) &&
$lib_innodb_plugin);
@@ -123,7 +121,6 @@ sub collect_test_cases ($$) {
foreach my $suite (split(",", $suites))
{
push(@$cases, collect_one_suite($suite, $opt_cases));
- $found_suites{$suite}= 1;
last if $some_test_found;
}
@@ -136,12 +133,6 @@ sub collect_test_cases ($$) {
{
my $found= 0;
my ($sname, $tname, $extension)= split_testname($test_name_spec);
- if (defined($sname) && !defined($found_suites{$sname}))
- {
- $found_suites{$sname}= 1;
- push(@$cases, collect_one_suite($sname));
- }
-
foreach my $test ( @$cases )
{
# test->{name} is always in suite.name format
@@ -247,7 +238,7 @@ sub split_testname {
}
-sub collect_one_suite($)
+sub collect_one_suite
{
my $suite= shift; # Test suite name
my $opt_cases= shift;
@@ -767,7 +758,6 @@ sub process_opts_file {
}
}
-
##############################################################################
#
# Collect information about a single test case
=== 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/lib/v1/mysql-test-run.pl'
--- a/mysql-test/lib/v1/mysql-test-run.pl 2009-02-15 10:58:34 +0000
+++ b/mysql-test/lib/v1/mysql-test-run.pl 2009-12-09 16:43:00 +0000
@@ -178,6 +178,7 @@ our @opt_extra_mysqltest_opt;
our $opt_compress;
our $opt_ssl;
+our $opt_skip_ssl;
our $opt_ssl_supported;
our $opt_ps_protocol;
our $opt_sp_protocol;
=== 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-06 17:34:54 +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: $!");
@@ -5682,12 +5683,15 @@ Misc options
servers to exit before finishing the process
fast Run as fast as possible, dont't wait for servers
to shutdown etc.
- parallel=N Run tests in N parallel threads (default=1)
+ parallel=N Run tests in N parallel threads (default 1)
Use parallel=auto for auto-setting of N
repeat=N Run each test N number of times
- retry=N Retry tests that fail N times, limit number of failures
- to $opt_retry_failure
- retry-failure=N Limit number of retries for a failed test
+ retry=N Retry tests that fail up to N times (default $opt_retry).
+ Retries are also limited by the maximum number of
+ failures before stopping, set with the --retry-failure
+ option
+ retry-failure=N When using the --retry option to retry failed tests,
+ stop when N failures have occured (default $opt_retry_failure)
reorder Reorder tests to get fewer server restarts
help Get this help text
=== 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/r/warnings.result'
--- a/mysql-test/r/warnings.result 2009-09-10 08:49:49 +0000
+++ b/mysql-test/r/warnings.result 2009-12-06 17:26:12 +0000
@@ -319,3 +319,17 @@ SHOW ERRORS;
Level Code Message
Error 1051 Unknown table 't1'
End of 5.0 tests
+set sql_mode = default;
+select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t;
+CAST(a AS DECIMAL(13,5))
+0.00000
+Warnings:
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Warning 1292 Truncated incorrect DECIMAL value: ''
+create table t1 (a integer unsigned);
+insert into t1 values (1),(-1),(0),(-2);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 4
+drop table t1;
+End of 5.1 tests
=== 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 'mysql-test/suite/funcs_1/r/innodb_func_view.result'
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result 2009-05-15 12:57:51 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result 2009-12-06 17:26:12 +0000
@@ -3372,9 +3372,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3389,9 +3389,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3408,11 +3408,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3430,11 +3430,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3454,9 +3454,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3471,9 +3471,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3490,11 +3490,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3510,11 +3510,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
DROP VIEW v1;
=== modified file 'mysql-test/suite/funcs_1/r/memory_func_view.result'
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result 2009-02-14 16:00:11 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result 2009-12-06 17:26:12 +0000
@@ -3373,9 +3373,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3390,9 +3390,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3409,11 +3409,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3431,11 +3431,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3455,9 +3455,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3472,9 +3472,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3491,11 +3491,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3511,11 +3511,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
DROP VIEW v1;
=== modified file 'mysql-test/suite/funcs_1/r/myisam_func_view.result'
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result 2009-02-14 16:00:11 +0000
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result 2009-12-06 17:26:12 +0000
@@ -3373,9 +3373,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3390,9 +3390,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3409,11 +3409,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3431,11 +3431,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3455,9 +3455,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3472,9 +3472,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3491,11 +3491,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3511,11 +3511,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---���*$-- '
DROP VIEW v1;
=== 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 'mysql-test/t/warnings.test'
--- a/mysql-test/t/warnings.test 2009-11-16 20:49:51 +0000
+++ b/mysql-test/t/warnings.test 2009-12-06 17:26:12 +0000
@@ -194,7 +194,6 @@ DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
DROP PROCEDURE sp3;
-
#
# Bug#30059: End-space truncation warnings are inconsistent or incorrect
#
@@ -235,3 +234,15 @@ DROP TABLE t1;
SHOW ERRORS;
--echo End of 5.0 tests
+
+#
+# Test warning with row numbers
+#
+
+set sql_mode = default;
+select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t;
+create table t1 (a integer unsigned);
+insert into t1 values (1),(-1),(0),(-2);
+drop table t1;
+
+--echo End of 5.1 tests
=== modified file 'plugin/fulltext/plugin_example.c'
--- a/plugin/fulltext/plugin_example.c 2007-04-26 19:26:04 +0000
+++ b/plugin/fulltext/plugin_example.c 2009-12-06 17:34:54 +0000
@@ -145,7 +145,7 @@ static int simple_parser_deinit(MYSQL_FT
the list of search terms when parsing a search string.
*/
-static void add_word(MYSQL_FTPARSER_PARAM *param, char *word, size_t len)
+static void add_word(MYSQL_FTPARSER_PARAM *param, const unsigned char *word, size_t len)
{
MYSQL_FTPARSER_BOOLEAN_INFO bool_info=
{ FT_TOKEN_WORD, 0, 0, 0, 0, ' ', 0 };
@@ -169,7 +169,7 @@ static void add_word(MYSQL_FTPARSER_PARA
static int simple_parser_parse(MYSQL_FTPARSER_PARAM *param)
{
- char *end, *start, *docend= param->doc + param->length;
+ const unsigned char *end, *start, *docend= param->doc + param->length;
number_of_calls++;
=== modified file 'sql-common/client.c'
--- a/sql-common/client.c 2009-11-16 20:49:51 +0000
+++ b/sql-common/client.c 2009-12-03 15:26:54 +0000
@@ -3208,7 +3208,7 @@ const char * STDCALL mysql_error(MYSQL *
mysql Connection
EXAMPLE
- 4.1.0-alfa -> 40100
+ MariaDB-4.1.0-alfa -> 40100
NOTES
We will ensure that a newer server always has a bigger number.
@@ -3221,7 +3221,11 @@ ulong STDCALL
mysql_get_server_version(MYSQL *mysql)
{
uint major, minor, version;
- char *pos= mysql->server_version, *end_pos;
+ const char *pos= mysql->server_version;
+ char *end_pos;
+ /* Skip possible prefix */
+ while (*pos && !my_isdigit(&my_charset_latin1, *pos))
+ pos++;
major= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
minor= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
version= (uint) strtoul(pos, &end_pos, 10);
=== modified file 'sql/my_decimal.cc'
--- a/sql/my_decimal.cc 2008-11-27 11:33:04 +0000
+++ b/sql/my_decimal.cc 2009-12-06 17:26:12 +0000
@@ -38,7 +38,7 @@ int decimal_operation_results(int result
case E_DEC_TRUNCATED:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
- "", (long)-1);
+ "", (ulong) 0);
break;
case E_DEC_OVERFLOW:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
@@ -54,7 +54,7 @@ int decimal_operation_results(int result
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "decimal", "", "", (long)-1);
+ "decimal", "", "", (ulong) 0);
break;
case E_DEC_OOM:
my_error(ER_OUT_OF_RESOURCES, MYF(0));
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-11-30 21:37:27 +0000
+++ b/sql/mysqld.cc 2009-12-04 15:12:22 +0000
@@ -4169,8 +4169,10 @@ server.");
Need to unlock as global_system_variables.table_plugin
was acquired during plugin_init()
*/
+ pthread_mutex_lock(&LOCK_global_system_variables);
plugin_unlock(0, global_system_variables.table_plugin);
global_system_variables.table_plugin= plugin;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
}
}
#if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)
=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt 2009-11-16 20:49:51 +0000
+++ b/sql/share/errmsg.txt 2009-12-06 17:26:12 +0000
@@ -3173,22 +3173,22 @@ ER_CANT_CREATE_THREAD
swe "Kan inte skapa en ny tr�(errno %d)"
ukr "��� ���� �� Ǧ��(����%d). � � � ������������ � ����� �������� ��� �- ����� �����
ER_WRONG_VALUE_COUNT_ON_ROW 21S01
- cze "Po-B� sloupc�dpov� po� hodnot na � %ld"
- dan "Kolonne antallet stemmer ikke overens med antallet af v�ier i post %ld"
- nla "Kolom aantal komt niet overeen met waarde aantal in rij %ld"
- eng "Column count doesn't match value count at row %ld"
- est "Tulpade hulk erineb v�tuste hulgast real %ld"
- ger "Anzahl der Felder stimmt nicht mit der Anzahl der Werte in Zeile %ld �n"
- hun "Az oszlopban talalhato ertek nem egyezik meg a %ld sorban szamitott ertekkel"
- ita "Il numero delle colonne non corrisponde al conteggio alla riga %ld"
- kor "Row %ld���� Į�� ī����value ī�����ġ�� �ʽ�ϴ�"
- por "Contagem de colunas n�confere com a contagem de valores na linha %ld"
- rum "Numarul de coloane nu corespunde cu numarul de valori la linia %ld"
- rus "��������� � ���������������� ���� %ld"
- serbian "Broj kolona ne odgovara broju vrednosti u slogu %ld"
- spa "El n� de columnas no corresponde al n� en la l�a %ld"
- swe "Antalet kolumner motsvarar inte antalet v�en p�ad: %ld"
- ukr "����������� ����� �˦�˦���������æ %ld"
+ cze "Po-B� sloupc�dpov� po� hodnot na � %lu"
+ dan "Kolonne antallet stemmer ikke overens med antallet af v�ier i post %lu"
+ nla "Kolom aantal komt niet overeen met waarde aantal in rij %lu"
+ eng "Column count doesn't match value count at row %lu"
+ est "Tulpade hulk erineb v�tuste hulgast real %lu"
+ ger "Anzahl der Felder stimmt nicht mit der Anzahl der Werte in Zeile %lu �n"
+ hun "Az oszlopban talalhato ertek nem egyezik meg a %lu sorban szamitott ertekkel"
+ ita "Il numero delle colonne non corrisponde al conteggio alla riga %lu"
+ kor "Row %lu���� Į�� ī����value ī�����ġ�� �ʽ�ϴ�"
+ por "Contagem de colunas n�confere com a contagem de valores na linha %lu"
+ rum "Numarul de coloane nu corespunde cu numarul de valori la linia %lu"
+ rus "��������� � ���������������� ���� %lu"
+ serbian "Broj kolona ne odgovara broju vrednosti u slogu %lu"
+ spa "El n� de columnas no corresponde al n� en la l�a %lu"
+ swe "Antalet kolumner motsvarar inte antalet v�en p�ad: %lu"
+ ukr "����������� ����� �˦�˦���������æ %lu"
ER_CANT_REOPEN_TABLE
cze "Nemohu znovuotev-B�abulku: '%-.192s"
dan "Kan ikke gen�e tabel '%-.192s"
@@ -4887,29 +4887,29 @@ ER_CUT_VALUE_GROUP_CONCAT
swe "%d rad(er) kapades av group_concat()"
ukr "%d line(s) was(were) cut by group_concat()"
ER_WARN_TOO_FEW_RECORDS 01000
- eng "Row %ld doesn't contain data for all columns"
- ger "Zeile %ld enth� nicht f�e Felder Daten"
- nla "Rij %ld bevat niet de data voor alle kolommen"
- por "Conta de registro �enor que a conta de coluna na linha %ld"
- spa "L�a %ld no contiene datos para todas las columnas"
+ eng "Row %lu doesn't contain data for all columns"
+ ger "Zeile %lu enth� nicht f�e Felder Daten"
+ nla "Rij %lu bevat niet de data voor alle kolommen"
+ por "Conta de registro �enor que a conta de coluna na linha %lu"
+ spa "L�a %lu no contiene datos para todas las columnas"
ER_WARN_TOO_MANY_RECORDS 01000
- eng "Row %ld was truncated; it contained more data than there were input columns"
- ger "Zeile %ld gek�die Zeile enthielt mehr Daten, als es Eingabefelder gibt"
- nla "Regel %ld ingekort, bevatte meer data dan invoer kolommen"
- por "Conta de registro �aior que a conta de coluna na linha %ld"
- spa "L�a %ld fu�runcada; La misma contine mas datos que las que existen en las columnas de entrada"
+ eng "Row %lu was truncated; it contained more data than there were input columns"
+ ger "Zeile %lu gek�die Zeile enthielt mehr Daten, als es Eingabefelder gibt"
+ nla "Regel %lu ingekort, bevatte meer data dan invoer kolommen"
+ por "Conta de registro �aior que a conta de coluna na linha %lu"
+ spa "L�a %lu fu�runcada; La misma contine mas datos que las que existen en las columnas de entrada"
ER_WARN_NULL_TO_NOTNULL 22004
- eng "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld"
- ger "Feld auf Vorgabewert gesetzt, da NULL f�-NULL-Feld '%s' in Zeile %ld angegeben"
- por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %ld"
- spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la l�a %ld"
+ eng "Column set to default value; NULL supplied to NOT NULL column '%s' at row %lu"
+ ger "Feld auf Vorgabewert gesetzt, da NULL f�-NULL-Feld '%s' in Zeile %lu angegeben"
+ por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %lu"
+ spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la l�a %lu"
ER_WARN_DATA_OUT_OF_RANGE 22003
- eng "Out of range value for column '%s' at row %ld"
+ eng "Out of range value for column '%s' at row %lu"
WARN_DATA_TRUNCATED 01000
- eng "Data truncated for column '%s' at row %ld"
- ger "Daten abgeschnitten f�d '%s' in Zeile %ld"
- por "Dado truncado para coluna '%s' na linha %ld"
- spa "Datos truncados para columna '%s' en la l�a %ld"
+ eng "Data truncated for column '%s' at row %lu"
+ ger "Daten abgeschnitten f�d '%s' in Zeile %lu"
+ por "Dado truncado para coluna '%s' na linha %lu"
+ spa "Datos truncados para columna '%s' en la l�a %lu"
ER_WARN_USING_OTHER_HANDLER
eng "Using storage engine %s for table '%s'"
ger "F�elle '%s' wird Speicher-Engine %s benutzt"
@@ -5090,8 +5090,8 @@ ER_UNKNOWN_TIME_ZONE
eng "Unknown or incorrect time zone: '%-.64s'"
ger "Unbekannte oder falsche Zeitzone: '%-.64s'"
ER_WARN_INVALID_TIMESTAMP
- eng "Invalid TIMESTAMP value in column '%s' at row %ld"
- ger "Ung�r TIMESTAMP-Wert in Feld '%s', Zeile %ld"
+ eng "Invalid TIMESTAMP value in column '%s' at row %lu"
+ ger "Ung�r TIMESTAMP-Wert in Feld '%s', Zeile %lu"
ER_INVALID_CHARACTER_STRING
eng "Invalid %s character string: '%.64s'"
ger "Ung�r %s-Zeichen-String: '%.64s'"
@@ -5322,8 +5322,8 @@ ER_DIVISION_BY_ZERO 22012
eng "Division by 0"
ger "Division durch 0"
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
- eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %ld"
- ger "Falscher %-.32s-Wert: '%-.128s' f�d '%.192s' in Zeile %ld"
+ eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %lu"
+ ger "Falscher %-.32s-Wert: '%-.128s' f�d '%.192s' in Zeile %lu"
ER_ILLEGAL_VALUE_FOR_TYPE 22007
eng "Illegal %s '%-.192s' value found during parsing"
ger "Nicht zul�iger %s-Wert '%-.192s' beim Parsen gefunden"
@@ -5456,8 +5456,8 @@ ER_PROC_AUTO_REVOKE_FAIL
eng "Failed to revoke all privileges to dropped routine"
ger "R�me aller Rechte f� gel�te Routine fehlgeschlagen"
ER_DATA_TOO_LONG 22001
- eng "Data too long for column '%s' at row %ld"
- ger "Daten zu lang f�d '%s' in Zeile %ld"
+ eng "Data too long for column '%s' at row %lu"
+ ger "Daten zu lang f�d '%s' in Zeile %lu"
ER_SP_BAD_SQLSTATE 42000
eng "Bad SQLSTATE: '%s'"
ger "Ung�r SQLSTATE: '%s'"
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc 2009-11-16 20:49:51 +0000
+++ b/sql/slave.cc 2009-12-06 17:51:48 +0000
@@ -1117,18 +1117,27 @@ be equal for the Statement-format replic
goto err;
}
}
- else if (is_network_error(mysql_errno(mysql)))
+ else if (is_network_error(err_code= mysql_errno(mysql)))
{
- mi->report(WARNING_LEVEL, mysql_errno(mysql),
- "Get master TIME_ZONE failed with error: %s", mysql_error(mysql));
+ mi->report(ERROR_LEVEL, err_code,
+ "Get master TIME_ZONE failed with error: %s",
+ mysql_error(mysql));
goto network_err;
- }
+ }
+ else if (err_code == ER_UNKNOWN_SYSTEM_VARIABLE)
+ {
+ /* We use ERROR_LEVEL to get the error logged to file */
+ mi->report(ERROR_LEVEL, err_code,
+
+ "MySQL master doesn't have a TIME_ZONE variable. Note that"
+ "if your timezone is not same between master and slave, your "
+ "slave may get wrong data into timestamp columns");
+ }
else
{
/* Fatal error */
errmsg= "The slave I/O thread stops because a fatal error is encountered \
when it try to get the value of TIME_ZONE global variable from master.";
- err_code= mysql_errno(mysql);
sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
goto err;
}
=== 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-04 15:12:22 +0000
@@ -8488,19 +8488,26 @@ bool remove_table_from_cache(THD *thd, c
result=1;
}
/* Kill delayed insert threads */
- if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
- ! in_use->killed)
+ if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT))
{
- in_use->killed= THD::KILL_CONNECTION;
- pthread_mutex_lock(&in_use->mysys_var->mutex);
- if (in_use->mysys_var->current_cond)
- {
- pthread_mutex_lock(in_use->mysys_var->current_mutex);
- signalled= 1;
- pthread_cond_broadcast(in_use->mysys_var->current_cond);
- pthread_mutex_unlock(in_use->mysys_var->current_mutex);
- }
- pthread_mutex_unlock(&in_use->mysys_var->mutex);
+ if (!in_use->killed)
+ {
+ in_use->killed= THD::KILL_CONNECTION;
+ pthread_mutex_lock(&in_use->mysys_var->mutex);
+ if (in_use->mysys_var->current_cond)
+ {
+ pthread_mutex_lock(in_use->mysys_var->current_mutex);
+ signalled= 1;
+ pthread_cond_broadcast(in_use->mysys_var->current_cond);
+ pthread_mutex_unlock(in_use->mysys_var->current_mutex);
+ }
+ pthread_mutex_unlock(&in_use->mysys_var->mutex);
+ }
+ /*
+ Don't abort locks. Instead give the delayed insert thread
+ time to finish it's inserts and die gracefully.
+ */
+ continue;
}
/*
Now we must abort all tables locks used by this thread
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2009-11-30 21:37:27 +0000
+++ b/sql/sql_class.cc 2009-12-04 15:12:22 +0000
@@ -2046,7 +2046,7 @@ bool select_export::send_data(List<Item>
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"string", printable_buff,
- item->name, row_count);
+ item->name, (ulong) row_count);
}
cvt_str.length(bytes);
res= &cvt_str;
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2009-11-30 21:37:27 +0000
+++ b/sql/sql_insert.cc 2009-12-04 15:12:22 +0000
@@ -2618,7 +2618,7 @@ bool Delayed_insert::handle_inserts(void
or if another thread is removing the current table definition
from the table cache.
*/
- my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR),
+ my_error(ER_DELAYED_CANT_CHANGE_LOCK, MYF(ME_FATALERROR | ME_NOREFRESH),
table->s->table_name.str);
goto err;
}
@@ -2791,10 +2791,11 @@ bool Delayed_insert::handle_inserts(void
query_cache_invalidate3(&thd, table, 1);
if (thr_reschedule_write_lock(*thd.lock->locks))
{
- /* This is not known to happen. */
- my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR),
- table->s->table_name.str);
- goto err;
+ /* This is not known to happen. */
+ my_error(ER_DELAYED_CANT_CHANGE_LOCK,
+ MYF(ME_FATALERROR | ME_NOREFRESH),
+ table->s->table_name.str);
+ goto err;
}
if (!using_bin_log)
table->file->extra(HA_EXTRA_WRITE_CACHE);
=== 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 '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)
=== 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
=== modified file 'vio/viosslfactories.c'
--- a/vio/viosslfactories.c 2009-10-27 13:20:34 +0000
+++ b/vio/viosslfactories.c 2009-12-06 17:34:54 +0000
@@ -19,7 +19,6 @@
static my_bool ssl_algorithms_added = FALSE;
static my_bool ssl_error_strings_loaded= FALSE;
-static int verify_depth = 0;
static unsigned char dh512_p[]=
{
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2775)
by knielsen@knielsen-hq.org 16 Dec '09
by knielsen@knielsen-hq.org 16 Dec '09
16 Dec '09
#At lp:maria
2775 knielsen(a)knielsen-hq.org 2009-12-16 [merge]
Automatic merge of PBXT rc3 into MariaDB trunk.
modified:
client/mysql.cc
client/mysqlcheck.c
client/mysqlslap.c
client/mysqltest.cc
cmd-line-utils/readline/config_readline.h
mysql-test/lib/mtr_report.pm
mysql-test/mysql-test-run.pl
mysql-test/r/ctype_ucs.result
mysql-test/suite/federated/disabled.def
mysql-test/suite/federated/federated_server.result
mysql-test/suite/federated/federated_server.test
mysql-test/t/ctype_ucs.test
sql-common/client.c
sql/mysqld.cc
sql/share/errmsg.txt
sql/sql_base.cc
sql/sql_class.cc
sql/sql_insert.cc
storage/federatedx/ha_federatedx.cc
strings/ctype-uca.c
strings/ctype-ucs2.c
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 'cmd-line-utils/readline/config_readline.h'
--- a/cmd-line-utils/readline/config_readline.h 2009-11-30 21:37:27 +0000
+++ b/cmd-line-utils/readline/config_readline.h 2009-12-01 16:09:02 +0000
@@ -7,6 +7,13 @@
# include <config.h>
#endif
+#ifdef NOT_YET /* causes problem on MacOSX */
+/* to get wcwidth() defined */
+#define _XOPEN_SOURCE 600
+#define _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_
+#endif
+
/*
Ultrix botches type-ahead when switching from canonical to
non-canonical mode, at least through version 4.3
=== 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/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/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 '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 'sql-common/client.c'
--- a/sql-common/client.c 2009-11-16 20:49:51 +0000
+++ b/sql-common/client.c 2009-12-03 15:26:54 +0000
@@ -3208,7 +3208,7 @@ const char * STDCALL mysql_error(MYSQL *
mysql Connection
EXAMPLE
- 4.1.0-alfa -> 40100
+ MariaDB-4.1.0-alfa -> 40100
NOTES
We will ensure that a newer server always has a bigger number.
@@ -3221,7 +3221,11 @@ ulong STDCALL
mysql_get_server_version(MYSQL *mysql)
{
uint major, minor, version;
- char *pos= mysql->server_version, *end_pos;
+ const char *pos= mysql->server_version;
+ char *end_pos;
+ /* Skip possible prefix */
+ while (*pos && !my_isdigit(&my_charset_latin1, *pos))
+ pos++;
major= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
minor= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
version= (uint) strtoul(pos, &end_pos, 10);
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-11-30 21:37:27 +0000
+++ b/sql/mysqld.cc 2009-12-04 15:12:22 +0000
@@ -4169,8 +4169,10 @@ server.");
Need to unlock as global_system_variables.table_plugin
was acquired during plugin_init()
*/
+ pthread_mutex_lock(&LOCK_global_system_variables);
plugin_unlock(0, global_system_variables.table_plugin);
global_system_variables.table_plugin= plugin;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
}
}
#if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)
=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt 2009-11-16 20:49:51 +0000
+++ b/sql/share/errmsg.txt 2009-12-04 15:12:22 +0000
@@ -5322,8 +5322,8 @@ ER_DIVISION_BY_ZERO 22012
eng "Division by 0"
ger "Division durch 0"
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
- eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %ld"
- ger "Falscher %-.32s-Wert: '%-.128s' f�d '%.192s' in Zeile %ld"
+ eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %lu"
+ ger "Falscher %-.32s-Wert: '%-.128s' f�d '%.192s' in Zeile %lu"
ER_ILLEGAL_VALUE_FOR_TYPE 22007
eng "Illegal %s '%-.192s' value found during parsing"
ger "Nicht zul�iger %s-Wert '%-.192s' beim Parsen gefunden"
=== 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-04 15:12:22 +0000
@@ -8488,19 +8488,26 @@ bool remove_table_from_cache(THD *thd, c
result=1;
}
/* Kill delayed insert threads */
- if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
- ! in_use->killed)
+ if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT))
{
- in_use->killed= THD::KILL_CONNECTION;
- pthread_mutex_lock(&in_use->mysys_var->mutex);
- if (in_use->mysys_var->current_cond)
- {
- pthread_mutex_lock(in_use->mysys_var->current_mutex);
- signalled= 1;
- pthread_cond_broadcast(in_use->mysys_var->current_cond);
- pthread_mutex_unlock(in_use->mysys_var->current_mutex);
- }
- pthread_mutex_unlock(&in_use->mysys_var->mutex);
+ if (!in_use->killed)
+ {
+ in_use->killed= THD::KILL_CONNECTION;
+ pthread_mutex_lock(&in_use->mysys_var->mutex);
+ if (in_use->mysys_var->current_cond)
+ {
+ pthread_mutex_lock(in_use->mysys_var->current_mutex);
+ signalled= 1;
+ pthread_cond_broadcast(in_use->mysys_var->current_cond);
+ pthread_mutex_unlock(in_use->mysys_var->current_mutex);
+ }
+ pthread_mutex_unlock(&in_use->mysys_var->mutex);
+ }
+ /*
+ Don't abort locks. Instead give the delayed insert thread
+ time to finish it's inserts and die gracefully.
+ */
+ continue;
}
/*
Now we must abort all tables locks used by this thread
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2009-11-30 21:37:27 +0000
+++ b/sql/sql_class.cc 2009-12-04 15:12:22 +0000
@@ -2046,7 +2046,7 @@ bool select_export::send_data(List<Item>
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"string", printable_buff,
- item->name, row_count);
+ item->name, (ulong) row_count);
}
cvt_str.length(bytes);
res= &cvt_str;
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2009-11-30 21:37:27 +0000
+++ b/sql/sql_insert.cc 2009-12-04 15:12:22 +0000
@@ -2618,7 +2618,7 @@ bool Delayed_insert::handle_inserts(void
or if another thread is removing the current table definition
from the table cache.
*/
- my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR),
+ my_error(ER_DELAYED_CANT_CHANGE_LOCK, MYF(ME_FATALERROR | ME_NOREFRESH),
table->s->table_name.str);
goto err;
}
@@ -2791,10 +2791,11 @@ bool Delayed_insert::handle_inserts(void
query_cache_invalidate3(&thd, table, 1);
if (thr_reschedule_write_lock(*thd.lock->locks))
{
- /* This is not known to happen. */
- my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR),
- table->s->table_name.str);
- goto err;
+ /* This is not known to happen. */
+ my_error(ER_DELAYED_CANT_CHANGE_LOCK,
+ MYF(ME_FATALERROR | ME_NOREFRESH),
+ table->s->table_name.str);
+ goto err;
}
if (!using_bin_log)
table->file->extra(HA_EXTRA_WRITE_CACHE);
=== 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 'strings/ctype-uca.c'
--- a/strings/ctype-uca.c 2009-11-30 12:42:24 +0000
+++ b/strings/ctype-uca.c 2009-12-03 11:34:11 +0000
@@ -36,6 +36,12 @@
#include "m_string.h"
#include "m_ctype.h"
+
+#define MY_UCA_CNT_FLAG_SIZE 4096
+#define MY_UCA_CNT_FLAG_MASK 4095
+#define MY_UCA_CNT_HEAD 1
+#define MY_UCA_CNT_TAIL 2
+
#ifdef HAVE_UCA_COLLATIONS
#define MY_UCA_NPAGES 256
@@ -6756,16 +6762,6 @@ typedef struct my_uca_scanner_handler_st
static uint16 nochar[]= {0,0};
-
-#define MY_UCA_CNT_FLAG_SIZE 4096
-#define MY_UCA_CNT_FLAG_MASK 4095
-
-#define MY_UCA_CNT_HEAD 1
-#define MY_UCA_CNT_TAIL 2
-
-
-
-
/********** Helper functions to handle contraction ************/
@@ -6836,85 +6832,6 @@ my_uca_alloc_contractions(CHARSET_INFO *
return 0;
}
-
-/**
- Check if UCA data has contractions (public version)
-
- @cs Pointer to CHARSET_INFO data
- @retval 0 - no contraction, 1 - have contractions.
-*/
-
-my_bool
-my_uca_have_contractions(CHARSET_INFO *cs)
-{
- return cs->contractions != NULL;
-}
-
-
-/**
- Check if a character can be contraction head
-
- @cs Pointer to CHARSET_INFO data
- @wc Code point
-
- @retval 0 - cannot be contraction head
- @retval 1 - can be contraction head
-*/
-
-my_bool
-my_uca_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc)
-{
- return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_HEAD;
-}
-
-
-/**
- Check if a character can be contraction tail
-
- @cs Pointer to CHARSET_INFO data
- @wc Code point
-
- @retval 0 - cannot be contraction tail
- @retval 1 - can be contraction tail
-*/
-
-my_bool
-my_uca_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc)
-{
- return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_TAIL;
-}
-
-
-/**
- Find a contraction and return its weight array
-
- @cs Pointer to CHARSET data
- @wc1 First character
- @wc2 Second character
-
- @return Weight array
- @retval NULL - no contraction found
- @retval ptr - contraction weight array
-*/
-
-uint16 *
-my_uca_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
-{
- MY_CONTRACTIONS *list= cs->contractions;
- MY_CONTRACTION *c, *last;
- for (c= list->item, last= &list->item[list->nitems]; c < last; c++)
- {
- if (c->ch[0] == wc1 && c->ch[1] == wc2)
- {
- return c->weight;
- }
- }
- return NULL;
-}
-
-
-
-
#ifdef HAVE_CHARSET_ucs2
/*
Initialize collation weight scanner
@@ -9607,3 +9524,78 @@ CHARSET_INFO my_charset_utf8_croatian_uc
#endif /* HAVE_CHARSET_utf8 */
#endif /* HAVE_UCA_COLLATIONS */
+
+/**
+ Check if UCA data has contractions (public version)
+
+ @cs Pointer to CHARSET_INFO data
+ @retval 0 - no contraction, 1 - have contractions.
+*/
+
+my_bool
+my_uca_have_contractions(CHARSET_INFO *cs)
+{
+ return cs->contractions != NULL;
+}
+
+/**
+ Check if a character can be contraction head
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Code point
+
+ @retval 0 - cannot be contraction head
+ @retval 1 - can be contraction head
+*/
+
+my_bool
+my_uca_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_HEAD;
+}
+
+
+/**
+ Check if a character can be contraction tail
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Code point
+
+ @retval 0 - cannot be contraction tail
+ @retval 1 - can be contraction tail
+*/
+
+my_bool
+my_uca_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_TAIL;
+}
+
+
+/**
+ Find a contraction and return its weight array
+
+ @cs Pointer to CHARSET data
+ @wc1 First character
+ @wc2 Second character
+
+ @return Weight array
+ @retval NULL - no contraction found
+ @retval ptr - contraction weight array
+*/
+
+uint16 *
+my_uca_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
+{
+ MY_CONTRACTIONS *list= cs->contractions;
+ MY_CONTRACTION *c, *last;
+ for (c= list->item, last= &list->item[list->nitems]; c < last; c++)
+ {
+ if (c->ch[0] == wc1 && c->ch[1] == wc2)
+ {
+ return c->weight;
+ }
+ }
+ return NULL;
+}
+
=== 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)
=== 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] Rev 2737: Add ds_mrr.cc to CMakeLists.txt in file:///home/psergey/dev/maria-5.2-dsmrr/
by Sergey Petrunya 15 Dec '09
by Sergey Petrunya 15 Dec '09
15 Dec '09
At file:///home/psergey/dev/maria-5.2-dsmrr/
------------------------------------------------------------
revno: 2737
revision-id: psergey(a)askmonty.org-20091215223739-f6xymmvanylqlrg9
parent: psergey(a)askmonty.org-20091215213555-h15367vp2hjei1da
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.2-dsmrr
timestamp: Wed 2009-12-16 01:37:39 +0300
message:
Add ds_mrr.cc to CMakeLists.txt
=== modified file 'libmysqld/CMakeLists.txt'
--- a/libmysqld/CMakeLists.txt 2009-10-03 19:24:13 +0000
+++ b/libmysqld/CMakeLists.txt 2009-12-15 22:37:39 +0000
@@ -137,6 +137,7 @@
../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
../sql/partition_info.cc ../sql/sql_connect.cc
../sql/scheduler.cc ../sql/event_parse_data.cc
+ ../sql/ds_mrr.cc
${GEN_SOURCES}
${LIB_SOURCES})
=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt 2009-09-15 10:46:35 +0000
+++ b/sql/CMakeLists.txt 2009-12-15 22:37:39 +0000
@@ -76,6 +76,7 @@
rpl_rli.cc rpl_mi.cc sql_servers.cc
sql_connect.cc scheduler.cc
sql_profile.cc event_parse_data.cc opt_table_elimination.cc
+ ds_mrr.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
${PROJECT_SOURCE_DIR}/include/mysqld_error.h
1
0
[Maria-developers] Rev 2736: Fix compile failure in file:///home/psergey/dev/maria-5.2-dsmrr/
by Sergey Petrunya 15 Dec '09
by Sergey Petrunya 15 Dec '09
15 Dec '09
At file:///home/psergey/dev/maria-5.2-dsmrr/
------------------------------------------------------------
revno: 2736
revision-id: psergey(a)askmonty.org-20091215213555-h15367vp2hjei1da
parent: psergey(a)askmonty.org-20091215172355-m8gr6zzr3r8m399y
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.2-dsmrr
timestamp: Wed 2009-12-16 00:35:55 +0300
message:
Fix compile failure
=== modified file 'sql/ds_mrr.h'
--- a/sql/ds_mrr.h 2009-12-15 17:23:55 +0000
+++ b/sql/ds_mrr.h 2009-12-15 21:35:55 +0000
@@ -69,5 +69,3 @@
uint *buffer_size, COST_VECT *cost);
};
-void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok);
-
=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h 2009-12-15 17:23:55 +0000
+++ b/sql/sql_select.h 2009-12-15 21:35:55 +0000
@@ -780,4 +780,5 @@
void eliminate_tables(JOIN *join);
+void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok);
1
0
[Maria-developers] Rev 2735: Backport into MariaDB-5.2 the following: in file:///home/psergey/dev/maria-5.2-dsmrr/
by Sergey Petrunya 15 Dec '09
by Sergey Petrunya 15 Dec '09
15 Dec '09
At file:///home/psergey/dev/maria-5.2-dsmrr/
------------------------------------------------------------
revno: 2735
revision-id: psergey(a)askmonty.org-20091215172355-m8gr6zzr3r8m399y
parent: psergey(a)askmonty.org-20091215145330-oqv8jlxh36sl863m
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.2-dsmrr
timestamp: Tue 2009-12-15 20:23:55 +0300
message:
Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
WL#2475 "Batched range read functions for MyISAM/InnoDb"
"Index condition pushdown for MyISAM/InnoDB"
- Adjust test results (checked)
- Code cleanup.
=== modified file 'mysql-test/r/myisam_mrr.result'
--- a/mysql-test/r/myisam_mrr.result 2009-12-15 07:16:46 +0000
+++ b/mysql-test/r/myisam_mrr.result 2009-12-15 17:23:55 +0000
@@ -3,9 +3,6 @@
set read_rnd_buffer_size=79;
Warnings:
Warning 1292 Truncated incorrect read_rnd_buffer_size value: '79'
-select @@read_rnd_buffer_size;
-@@read_rnd_buffer_size
-8228
create table t1(a int);
show create table t1;
Table Create Table
=== modified file 'mysql-test/suite/maria/r/maria.result'
--- a/mysql-test/suite/maria/r/maria.result 2009-06-29 21:03:30 +0000
+++ b/mysql-test/suite/maria/r/maria.result 2009-12-15 17:23:55 +0000
@@ -382,20 +382,20 @@
explain select * from t1,t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL b NULL NULL NULL 2
-1 SIMPLE t1 ref b b 5 test.t2.b 1 Using where
+1 SIMPLE t1 ref b b 5 test.t2.b 1
explain select * from t1,t2 force index(c) where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t1 ref a a 4 test.t2.a 3
explain select * from t1 where a=0 or a=2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 4 NULL 4 Using where
+1 SIMPLE t1 range a a 4 NULL 4 Using index condition; Using MRR
explain select * from t1 force index (a) where a=0 or a=2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 4 NULL 4 Using where
+1 SIMPLE t1 range a a 4 NULL 4 Using index condition; Using MRR
explain select * from t1 where c=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c,c_2 c 5 const 1 Using where
+1 SIMPLE t1 ref c,c_2 c 5 const 1
explain select * from t1 use index() where c=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
@@ -1131,7 +1131,7 @@
*a *a*a *
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v,v_2 # 13 const # Using where
+1 SIMPLE t1 ref v,v_2 # 13 const # Using index condition
select v,count(*) from t1 group by v limit 10;
v count(*)
a 1
@@ -1307,7 +1307,7 @@
1 SIMPLE t1 ref v v 303 const # Using where; Using index
explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 303 const # Using where
+1 SIMPLE t1 ref v v 303 const # Using index condition
select v,count(*) from t1 group by v limit 10;
v count(*)
a 1
=== modified file 'mysql-test/suite/parts/r/partition_special_innodb.result'
--- a/mysql-test/suite/parts/r/partition_special_innodb.result 2009-10-06 11:39:57 +0000
+++ b/mysql-test/suite/parts/r/partition_special_innodb.result 2009-12-15 17:23:55 +0000
@@ -31,9 +31,9 @@
2000-06-15 jukg zikhuk m
select * from t1 where a<19851231;
a b c d
+1975-01-01 abcde abcde m
+1980-10-14 fgbbd dtzndtz w
1983-12-31 cdef srtbvsr w
-1980-10-14 fgbbd dtzndtz w
-1975-01-01 abcde abcde m
drop table t1;
create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h)) engine='InnoDB'
partition by key(a,b,c,d,e,f,g,h) (
@@ -73,9 +73,9 @@
2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m
select * from t1 where a<19851231;
a b c d e f g h i
+1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi
-1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
drop table t1;
create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='InnoDB'
partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (
@@ -123,9 +123,9 @@
2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m
select * from t1 where a<19851231;
a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 i
+1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
+1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi
-1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
-1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
drop table t1;
create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3,a4)) engine='InnoDB'
partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3,a4) (
@@ -203,9 +203,9 @@
2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m
select * from t1 where a<19851231;
a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f3 g3 h3 i
+1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi
-1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
drop table t1;
# Bug#34604 - Assertion 'inited==RND' failed in handler::ha_rnd_end
CREATE TABLE t1 (
=== modified file 'mysql-test/suite/parts/r/partition_special_myisam.result'
--- a/mysql-test/suite/parts/r/partition_special_myisam.result 2009-10-06 11:39:57 +0000
+++ b/mysql-test/suite/parts/r/partition_special_myisam.result 2009-12-15 17:23:55 +0000
@@ -73,9 +73,9 @@
2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m
select * from t1 where a<19851231;
a b c d e f g h i
+1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi
-1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
drop table t1;
create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='MyISAM'
partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (
@@ -123,9 +123,9 @@
2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m
select * from t1 where a<19851231;
a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 i
+1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
+1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi
-1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
-1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
drop table t1;
create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3,a4)) engine='MyISAM'
partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3,a4) (
@@ -203,7 +203,7 @@
2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 2000-06-15 jukg zikhuk m 45675 6465754.13 435242623462 18 pib mdotkbm.m
select * from t1 where a<19851231;
a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f3 g3 h3 i
+1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 1980-10-14 fgbbd dtzndtz w 67856 5463354.67 3567845333 124 d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 1983-12-31 cdef srtbvsr w 45634 13452.56 3452346456 127 liuugbzvdmrlti b itiortudirtfgtibm dfi
-1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 1975-01-01 abcde abcde m 1234 123.45 32412341234 113 tbhth nrzh ztfghgfh fzh ftzhj fztjh
drop table t1;
=== modified file 'mysql-test/suite/pbxt/r/distinct.result'
--- a/mysql-test/suite/pbxt/r/distinct.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/distinct.result 2009-12-15 17:23:55 +0000
@@ -175,7 +175,7 @@
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary
1 SIMPLE t2 ref a a 4 test.t1.a 1 Using index
-1 SIMPLE t3 ref a a 5 test.t1.b 1 Using where; Using index
+1 SIMPLE t3 ref a a 5 test.t1.b 1 Using index
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
@@ -190,7 +190,7 @@
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
-1 SIMPLE t3 ref a a 5 test.t1.a 1 Using where; Using index; Distinct
+1 SIMPLE t3 ref a a 5 test.t1.a 1 Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
1
=== modified file 'mysql-test/suite/pbxt/r/explain.result'
--- a/mysql-test/suite/pbxt/r/explain.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/explain.result 2009-12-15 17:23:55 +0000
@@ -50,7 +50,7 @@
insert into ÔÁÂ (ËÏÌ0) values (2);
explain select ËÏÌ0 from ÔÁÂ where ËÏÌ0=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE ÔÁÂ ref ÉÎÄ0,ÉÎÄ01 ÉÎÄ0 5 const 1 Using where; Using index
+1 SIMPLE ÔÁÂ ref ÉÎÄ0,ÉÎÄ01 ÉÎÄ0 5 const 1 Using index
drop table ÔÁÂ;
set names latin1;
select 3 into @v1;
=== modified file 'mysql-test/suite/pbxt/r/heap.result'
--- a/mysql-test/suite/pbxt/r/heap.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/heap.result 2009-12-15 17:23:55 +0000
@@ -204,7 +204,7 @@
INSERT INTO t1 VALUES (10), (10), (10);
EXPLAIN SELECT * FROM t1 WHERE a=10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 5 const 3 Using where
+1 SIMPLE t1 ref a a 5 const 3
SELECT * FROM t1 WHERE a=10;
a
10
=== modified file 'mysql-test/suite/pbxt/r/join.result'
--- a/mysql-test/suite/pbxt/r/join.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/join.result 2009-12-15 17:23:55 +0000
@@ -774,7 +774,7 @@
explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a,b a 5 NULL 1 Using where
-1 SIMPLE t3 ref b b 5 test.t2.b 1 Using where
+1 SIMPLE t3 ref b b 5 test.t2.b 1
drop table t1, t2, t3;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
=== modified file 'mysql-test/suite/pbxt/r/join_nested.result'
--- a/mysql-test/suite/pbxt/r/join_nested.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/join_nested.result 2009-12-15 17:23:55 +0000
@@ -74,7 +74,7 @@
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` = 1) or isnull(`test`.`t3`.`c`))
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
@@ -150,7 +150,7 @@
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`))
@@ -180,7 +180,7 @@
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where (((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) and ((`test`.`t5`.`a` < 3) or isnull(`test`.`t5`.`c`)))
@@ -230,7 +230,7 @@
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer
-1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t7`.`b` = `test`.`t8`.`b`) and (`test`.`t6`.`b` < 10))) where 1
SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
@@ -546,12 +546,12 @@
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00
-1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00
-1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.
`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)))
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
@@ -837,8 +837,8 @@
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) where (`test`.`t1`.`a` <= 2)
CREATE INDEX idx_b ON t2(b);
@@ -851,7 +851,7 @@
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
-1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 1 100.00
+1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 1 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` = `test`.`t4`.`b`))) where 1
@@ -1054,8 +1054,8 @@
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 Using where
-1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00 Using where
+1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00
+1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
@@ -1202,13 +1202,13 @@
EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON c < 3 and b = c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
-1 SIMPLE t3 index c c 5 NULL 6 Using index
+1 SIMPLE t3 index c c 5 NULL 6 Using where; Using index
1 SIMPLE t2 ref b b 5 test.t3.c 1 Using index
EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL # Using index
1 SIMPLE t3 index c c 5 NULL # Using index
-1 SIMPLE t2 ref b b 5 test.t3.c # Using index
+1 SIMPLE t2 ref b b 5 test.t3.c # Using where; Using index
SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
a b c
NULL 0 0
@@ -1279,7 +1279,7 @@
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL # Using index
1 SIMPLE t3 index c c 5 NULL # Using index
-1 SIMPLE t2 ref b b 5 test.t3.c # Using index
+1 SIMPLE t2 ref b b 5 test.t3.c # Using where; Using index
SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
a b c
NULL NULL NULL
@@ -1323,8 +1323,8 @@
EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-1 SIMPLE t2 ALL NULL NULL NULL NULL 0
-1 SIMPLE t3 ALL NULL NULL NULL NULL 0
+1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 0 Using where
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL);
INSERT INTO t1 VALUES (23, 2340), (26, 9900);
=== modified file 'mysql-test/suite/pbxt/r/key_cache.result'
--- a/mysql-test/suite/pbxt/r/key_cache.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/key_cache.result 2009-12-15 17:23:55 +0000
@@ -122,7 +122,7 @@
explain select count(*) from t1, t2 where t1.p = t2.i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index
-1 SIMPLE t2 ref k1 k1 5 test.t1.p 1 Using where; Using index
+1 SIMPLE t2 ref k1 k1 5 test.t1.p 1 Using index
select count(*) from t1, t2 where t1.p = t2.i;
count(*)
3
=== modified file 'mysql-test/suite/pbxt/r/negation_elimination.result'
--- a/mysql-test/suite/pbxt/r/negation_elimination.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/negation_elimination.result 2009-12-15 17:23:55 +0000
@@ -79,7 +79,7 @@
19
explain select * from t1 where not(a != 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 5 const 1 Using where; Using index
+1 SIMPLE t1 ref a a 5 const 1 Using index
select * from t1 where not(a != 1);
a
1
=== modified file 'mysql-test/suite/pbxt/r/null.result'
--- a/mysql-test/suite/pbxt/r/null.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/null.result 2009-12-15 17:23:55 +0000
@@ -170,7 +170,7 @@
insert into t1 values(null);
explain select * from t1 where i=2 or i is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null i i 5 const # Using where; Using index
+1 SIMPLE t1 ref_or_null i i 5 const # Using index
select count(*) from t1 where i=2 or i is null;
count(*)
10
=== modified file 'mysql-test/suite/pbxt/r/null_key.result'
--- a/mysql-test/suite/pbxt/r/null_key.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/null_key.result 2009-12-15 17:23:55 +0000
@@ -21,10 +21,10 @@
1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index
explain select * from t1 where (a is null or a = 7) and b=7;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index
+1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using index
explain select * from t1 where (a is null or a = 7) and b=7 order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index; Using filesort
+1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using index; Using filesort
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index
@@ -151,7 +151,7 @@
insert into t1 values (7,null), (8,null), (8,7);
explain select * from t1 where a = 7 and (b=7 or b is null);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using where; Using index
+1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using index
select * from t1 where a = 7 and (b=7 or b is null);
a b
7 7
@@ -166,7 +166,7 @@
NULL 7
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index
+1 SIMPLE t1 ref_or_null a a 5 const 5 Using index
select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
a b
7 NULL
@@ -192,7 +192,7 @@
explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
-1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index
+1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using index
select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
a a b
7 7 7
@@ -202,7 +202,7 @@
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
-1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index
+1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using index
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
a a b
7 7 7
@@ -226,7 +226,7 @@
explain select * from t2,t1 where t1.a=t2.a or t1.a is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 4
-1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index
+1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using index
explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 4
@@ -258,7 +258,7 @@
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
explain select id from t1 where uniq_id is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref idx1 idx1 5 const 5 Using where
+1 SIMPLE t1 ref idx1 idx1 5 const 5 Using index condition
explain select id from t1 where uniq_id =1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const idx1 idx1 5 const 1
=== modified file 'mysql-test/t/myisam_mrr.test'
--- a/mysql-test/t/myisam_mrr.test 2009-12-15 07:16:46 +0000
+++ b/mysql-test/t/myisam_mrr.test 2009-12-15 17:23:55 +0000
@@ -8,7 +8,6 @@
set @read_rnd_buffer_size_save= @@read_rnd_buffer_size;
set read_rnd_buffer_size=79;
-select @@read_rnd_buffer_size;
-- source include/mrr_tests.inc
=== modified file 'sql/ds_mrr.cc'
--- a/sql/ds_mrr.cc 2009-12-15 07:16:46 +0000
+++ b/sql/ds_mrr.cc 2009-12-15 17:23:55 +0000
@@ -950,8 +950,15 @@
((tab->table->file->index_flags(keyno, 0, 1) &
HA_DO_INDEX_COND_PUSHDOWN) &&
tab->join->thd->variables.engine_condition_pushdown);
- // psergey:
- //
+
+ /*
+ Do not try index condition pushdown on indexes which have partially-covered
+ columns. Unpacking from a column prefix into index tuple is not a supported
+ operation in some engines, see e.g. MySQL BUG#42991.
+ TODO: a better solution would be not to consider partially-covered columns
+ as parts of the index and still produce/check index condition for
+ fully-covered index columns.
+ */
KEY *key_info= tab->table->key_info + keyno;
for (uint kp= 0; kp < key_info->key_parts; kp++)
{
@@ -961,7 +968,7 @@
break;
}
}
- // :psergey
+
/*
When WL#5116 is done this DBUG statement must be removed. It's just a
temporary hack to allow us to discriminate whether a test failure relates
@@ -984,7 +991,8 @@
Item *idx_remainder_cond= 0;
tab->pre_idx_push_select_cond= tab->select_cond;
#if 0
- // The following is only needed for BKA:
+ /*
+ psergey: enable the below when we backport BKA: */
/*
For BKA cache we store condition to special BKA cache field
because evaluation of the condition requires additional operations
=== modified file 'sql/ds_mrr.h'
--- a/sql/ds_mrr.h 2009-12-15 07:16:46 +0000
+++ b/sql/ds_mrr.h 2009-12-15 17:23:55 +0000
@@ -1,4 +1,8 @@
-
+/*
+ This file contains declarations for
+ - Disk-Sweep MultiRangeRead (DS-MRR) implementation
+ - Index Condition Pushdown helper functions
+*/
/**
A Disk-Sweep MRR interface implementation
@@ -65,4 +69,5 @@
uint *buffer_size, COST_VECT *cost);
};
+void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok);
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2009-09-07 20:50:10 +0000
+++ b/sql/ha_ndbcluster.cc 2009-12-15 17:23:55 +0000
@@ -8702,6 +8702,8 @@
DBUG_RETURN(FALSE);
}
+#if 0
+/* MRR/NDB is disabled, for details see method declarations in ha_ndbcluster.h */
int
ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
KEY_MULTI_RANGE *ranges,
@@ -9074,6 +9076,7 @@
m_multi_range_result_ptr += reclength;
DBUG_RETURN(0);
}
+#endif
int
ha_ndbcluster::setup_recattr(const NdbRecAttr* curr)
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2008-05-29 18:39:25 +0000
+++ b/sql/ha_ndbcluster.h 2009-12-15 17:23:55 +0000
@@ -259,10 +259,20 @@
/**
* Multi range stuff
*/
+#if 0
+ /*
+ MRR/NDB is disabled in MariaDB. This is because in MariaDB, we've
+ backported
+ - the latest version of MRR interface (BKA needs this)
+ - the latest version of DS-MRR implementation
+ but didn't backport the latest version MRR/NDB implementation.
+
+ */
int read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
KEY_MULTI_RANGE*ranges, uint range_count,
bool sorted, HANDLER_BUFFER *buffer);
int read_multi_range_next(KEY_MULTI_RANGE **found_range_p);
+#endif
bool null_value_index_search(KEY_MULTI_RANGE *ranges,
KEY_MULTI_RANGE *end_range,
HANDLER_BUFFER *buffer);
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2009-12-15 07:16:46 +0000
+++ b/sql/handler.cc 2009-12-15 17:23:55 +0000
@@ -4193,136 +4193,6 @@
return read_time;
}
-#if 0
-// psergey-mrr
-
-/**
- Read the first row of a multi-range set.
-
- @param found_range_p Returns a pointer to the element in 'ranges' that
- corresponds to the returned row.
- @param ranges An array of KEY_MULTI_RANGE range descriptions.
- @param range_count Number of ranges in 'ranges'.
- @param sorted If result should be sorted per key.
- @param buffer A HANDLER_BUFFER for internal handler usage.
-
- @note
- - Record is read into table->record[0].
- - *found_range_p returns a valid value only if read_multi_range_first()
- returns 0.
- - Sorting is done within each range. If you want an overall sort, enter
- 'ranges' with sorted ranges.
-
- @retval
- 0 OK, found a row
- @retval
- HA_ERR_END_OF_FILE No rows in range
- @retval
- \# Error code
-*/
-int handler::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
- KEY_MULTI_RANGE *ranges, uint range_count,
- bool sorted, HANDLER_BUFFER *buffer)
-{
- int result= HA_ERR_END_OF_FILE;
- DBUG_ENTER("handler::read_multi_range_first");
- multi_range_sorted= sorted;
- multi_range_buffer= buffer;
-
- table->mark_columns_used_by_index_no_reset(active_index, table->read_set);
- table->column_bitmaps_set(table->read_set, table->write_set);
-
- for (multi_range_curr= ranges, multi_range_end= ranges + range_count;
- multi_range_curr < multi_range_end;
- multi_range_curr++)
- {
- result= read_range_first(multi_range_curr->start_key.keypart_map ?
- &multi_range_curr->start_key : 0,
- multi_range_curr->end_key.keypart_map ?
- &multi_range_curr->end_key : 0,
- test(multi_range_curr->range_flag & EQ_RANGE),
- multi_range_sorted);
- if (result != HA_ERR_END_OF_FILE)
- break;
- }
-
- *found_range_p= multi_range_curr;
- DBUG_PRINT("exit",("result %d", result));
- DBUG_RETURN(result);
-}
-
-
-/**
- Read the next row of a multi-range set.
-
- @param found_range_p Returns a pointer to the element in 'ranges' that
- corresponds to the returned row.
-
- @note
- - Record is read into table->record[0].
- - *found_range_p returns a valid value only if read_multi_range_next()
- returns 0.
-
- @retval
- 0 OK, found a row
- @retval
- HA_ERR_END_OF_FILE No (more) rows in range
- @retval
- \# Error code
-*/
-int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
-{
- int result;
- DBUG_ENTER("handler::read_multi_range_next");
-
- /* We should not be called after the last call returned EOF. */
- DBUG_ASSERT(multi_range_curr < multi_range_end);
-
- do
- {
- /* Save a call if there can be only one row in range. */
- if (multi_range_curr->range_flag != (UNIQUE_RANGE | EQ_RANGE))
- {
- result= read_range_next();
-
- /* On success or non-EOF errors jump to the end. */
- if (result != HA_ERR_END_OF_FILE)
- break;
- }
- else
- {
- if (was_semi_consistent_read())
- goto scan_it_again;
- /*
- We need to set this for the last range only, but checking this
- condition is more expensive than just setting the result code.
- */
- result= HA_ERR_END_OF_FILE;
- }
-
- multi_range_curr++;
-scan_it_again:
- /* Try the next range(s) until one matches a record. */
- for (; multi_range_curr < multi_range_end; multi_range_curr++)
- {
- result= read_range_first(multi_range_curr->start_key.keypart_map ?
- &multi_range_curr->start_key : 0,
- multi_range_curr->end_key.keypart_map ?
- &multi_range_curr->end_key : 0,
- test(multi_range_curr->range_flag & EQ_RANGE),
- multi_range_sorted);
- if (result != HA_ERR_END_OF_FILE)
- break;
- }
- }
- while ((result == HA_ERR_END_OF_FILE) &&
- (multi_range_curr < multi_range_end));
-
- *found_range_p= multi_range_curr;
- DBUG_PRINT("exit",("handler::read_multi_range_next: result %d", result));
- DBUG_RETURN(result);
-}
-#endif
/**
Read first row between two ranges.
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2009-12-15 14:53:30 +0000
+++ b/sql/handler.h 2009-12-15 17:23:55 +0000
@@ -1290,15 +1290,6 @@
ha_statistics stats;
- /** The following are for read_multi_range */
-//////psergey: was:
-#if 0
- bool multi_range_sorted;
- KEY_MULTI_RANGE *multi_range_curr;
- KEY_MULTI_RANGE *multi_range_end;
- HANDLER_BUFFER *multi_range_buffer;
-#endif
-//////psergey
/** MultiRangeRead-related members: */
range_seq_t mrr_iter; /* Interator to traverse the range sequence */
RANGE_SEQ_IF mrr_funcs; /* Range sequence traversal functions */
@@ -1311,7 +1302,6 @@
bool mrr_have_range;
/** Current range (the one we're now returning rows from) */
KEY_MULTI_RANGE mrr_cur_range;
-//////psergey
/** The following are for read_range() */
key_range save_end_range, *end_range;
@@ -1744,13 +1734,6 @@
update_index_statistics();
return error;
}
-#if 0
- virtual int read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
- KEY_MULTI_RANGE *ranges, uint range_count,
- bool sorted, HANDLER_BUFFER *buffer);
- virtual int read_multi_range_next(KEY_MULTI_RANGE **found_range_p);
-#endif
- //psergey-mrr:
virtual ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param,
uint n_ranges, uint *bufsz,
@@ -1761,7 +1744,6 @@
uint n_ranges, uint mode,
HANDLER_BUFFER *buf);
virtual int multi_range_read_next(char **range_info);
- //psergey-mrr: ends
virtual int read_range_first(const key_range *start_key,
const key_range *end_key,
bool eq_range, bool sorted);
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-12-15 07:16:46 +0000
+++ b/sql/sql_select.cc 2009-12-15 17:23:55 +0000
@@ -16734,11 +16734,12 @@
if (keyno != MAX_KEY && keyno == table->file->pushed_idx_cond_keyno &&
table->file->pushed_idx_cond)
extra.append(STRING_WITH_LEN("; Using index condition"));
- /**
- psergey-mrr:
+ /*
+ psergey: enable the below when we backport BKA:
+
else if (tab->cache_idx_cond)
extra.append(STRING_WITH_LEN("; Using index condition(BKA)"));
- **/
+ */
if (quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION ||
quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT ||
quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE)
=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h 2009-12-15 07:16:46 +0000
+++ b/sql/sql_select.h 2009-12-15 17:23:55 +0000
@@ -780,7 +780,4 @@
void eliminate_tables(JOIN *join);
-/// psergey-mrr:
-void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok);
-
1
0
[Maria-developers] Rev 2734: Backport into MariaDB-5.2 the following: in file:///home/psergey/dev/maria-5.2-dsmrr/
by Sergey Petrunya 15 Dec '09
by Sergey Petrunya 15 Dec '09
15 Dec '09
At file:///home/psergey/dev/maria-5.2-dsmrr/
------------------------------------------------------------
revno: 2734
revision-id: psergey(a)askmonty.org-20091215145330-oqv8jlxh36sl863m
parent: psergey(a)askmonty.org-20091215071646-gbq7406d2xpopd82
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.2-dsmrr
timestamp: Tue 2009-12-15 17:53:30 +0300
message:
Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
WL#2475 "Batched range read functions for MyISAM/InnoDb"
"Index condition pushdown for MyISAM/InnoDB"
- Fix valgrind failures
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2009-12-15 07:16:46 +0000
+++ b/sql/handler.h 2009-12-15 14:53:30 +0000
@@ -1381,7 +1381,9 @@
ref_length(sizeof(my_off_t)),
ft_handler(0), inited(NONE),
locked(FALSE), implicit_emptied(0),
- pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0),
+ pushed_cond(0), pushed_idx_cond(NULL),
+ pushed_idx_cond_keyno(MAX_KEY),
+ next_insert_id(0), insert_id_for_cur_row(0),
auto_inc_intervals_count(0)
{
reset_statistics();
1
0
[Maria-developers] Rev 2733: Backport into MariaDB-5.2 the following: in file:///home/psergey/dev/maria-5.2-dsmrr/
by Sergey Petrunya 15 Dec '09
by Sergey Petrunya 15 Dec '09
15 Dec '09
At file:///home/psergey/dev/maria-5.2-dsmrr/
------------------------------------------------------------
revno: 2733
revision-id: psergey(a)askmonty.org-20091215071646-gbq7406d2xpopd82
parent: igor(a)askmonty.org-20091112043128-yd6odg8zr5ribjal
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.2-dsmrr
timestamp: Tue 2009-12-15 10:16:46 +0300
message:
Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
WL#2475 "Batched range read functions for MyISAM/InnoDb"
"Index condition pushdown for MyISAM/InnoDB"
Igor's fix from sp1r-igor(a)olga.mysql.com-20080330055902-07614:
There could be observed the following problems:
1. EXPLAIN did not mention pushdown conditions from on expressions in the
'extra' column. As a result if a query had no where conditions pushed
down to a table, but had on conditions pushed to this table the 'extra'
column in the EXPLAIN for the table missed 'using where'.
2. Conditions for ref access were not eliminated from on expressions
though such conditions were eliminated from the where condition.
Diff too large for email (23741 lines, the limit is 1000).
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2776)
by knielsen@knielsen-hq.org 14 Dec '09
by knielsen@knielsen-hq.org 14 Dec '09
14 Dec '09
#At lp:maria
2776 knielsen(a)knielsen-hq.org 2009-12-14 [merge]
Merge latest PBXT fixes from Paul.
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-10 11:36:05 +0000
@@ -3041,14 +3041,6 @@ xtPublic MX_CHARSET_INFO *myxt_getcharse
return (MX_CHARSET_INFO *)&my_charset_utf8_general_ci;
}
-#ifdef DBUG_OFF
-//typedef struct st_plugin_int *plugin_ref;
-#define REF_MYSQL_PLUGIN(x) (x)
-#else
-//typedef struct st_plugin_int **plugin_ref;
-#define REF_MYSQL_PLUGIN(x) (*(x))
-#endif
-
xtPublic void *myxt_create_thread()
{
#ifdef DRIZZLED
@@ -3109,14 +3101,18 @@ xtPublic void *myxt_create_thread()
/*
* If PBXT is the default storage engine, then creating any THD objects will add extra
- * 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.
+ * references to the PBXT plugin object. because the threads are created but PBXT
+ * this creates a self reference, and the reference count does not go to zero
+ * on shutdown.
+ *
+ * The server then issues a message that it is forcing shutdown of the plugin.
+ *
+ * However, the engine reference is not required by the THDs used by PBXT, so
+ * I just remove them here.
*/
- LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(new_thd->variables.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--;
- }
+ plugin_unlock(NULL, new_thd->variables.table_plugin);
+ new_thd->variables.table_plugin = NULL;
+
new_thd->thread_stack = (char *) &new_thd;
new_thd->store_globals();
lex_start(new_thd);
@@ -3151,17 +3147,6 @@ xtPublic void myxt_destroy_thread(void *
#else
close_thread_tables(thd);
#endif
-
- /*
- * In myxt_create_thread we decremented plugin ref-count to avoid dead-locking.
- * Here we need to increment ref-count to avoid assertion failures.
- */
- if (thd->variables.table_plugin) {
- LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(thd->variables.table_plugin)->name;
- if ((plugin_name.length == 4) && (strncmp(plugin_name.str, "PBXT", plugin_name.length) == 0)) {
- REF_MYSQL_PLUGIN(thd->variables.table_plugin)->ref_count++;
- }
- }
delete thd;
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2784)
by knielsen@knielsen-hq.org 13 Dec '09
by knielsen@knielsen-hq.org 13 Dec '09
13 Dec '09
#At lp:maria
2784 knielsen(a)knielsen-hq.org 2009-12-13
Fix source tarball name and 99 char path limitation.
Fix obsolete automake usage in AM_INIT_AUTOMAKE so we can use the option to use
tar version without 99 char pathname limit.
modified:
configure.in
win/configure.js
win/make_mariadb_win_dist
per-file messages:
configure.in
Fix obsolete usage of AM_INIT_AUTOMAKE.
Set option to use tar file format without 99 char lenght limit.
win/configure.js
Update parsing of configure.in
win/make_mariadb_win_dist
Update parsing of configure.in
=== modified file 'configure.in'
--- a/configure.in 2009-12-03 11:34:11 +0000
+++ b/configure.in 2009-12-13 22:04:39 +0000
@@ -3,8 +3,6 @@ dnl Process this file with autoconf to p
AC_PREREQ(2.52)dnl Minimum Autoconf version required.
-AC_INIT(sql/mysqld.cc)
-AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also update version.c in ndb
#
@@ -15,7 +13,12 @@ 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)
+# and by win/make_mariadb_win_dist
+AC_INIT(mysql, 5.1.41-MariaDB-beta)
+AC_CONFIG_SRCDIR(sql/mysqld.cc)
+AC_CANONICAL_SYSTEM
+
+AM_INIT_AUTOMAKE([tar-ustar])
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
=== modified file 'win/configure.js'
--- a/win/configure.js 2009-10-07 21:00:29 +0000
+++ b/win/configure.js 2009-12-13 22:04:39 +0000
@@ -155,8 +155,8 @@ function GetValue(str, key)
function GetVersion(str)
{
- var key = "AM_INIT_AUTOMAKE(mysql, ";
- var key2 = "AM_INIT_AUTOMAKE(mariadb, ";
+ var key = "AC_INIT(mysql, ";
+ var key2 = "AC_INIT(mariadb, ";
var key_len = key.length;
var pos = str.indexOf(key); //5.0.6-beta)
if (pos == -1)
=== modified file 'win/make_mariadb_win_dist'
--- a/win/make_mariadb_win_dist 2009-10-30 10:50:48 +0000
+++ b/win/make_mariadb_win_dist 2009-12-13 22:04:39 +0000
@@ -25,7 +25,7 @@ devenv.com MySQL.sln /build Debug
# TODO extract version number
VER=`cat configure.in |
- perl -e 'while (<>) { if (/^AM_INIT_AUTOMAKE\([a-z ]*, *([0-9a-z\.-]+)/) { print "$1\n"; exit(0)} } ; exit 1'`
+ perl -e 'while (<>) { if (/^AC_INIT\([a-z ]*, *([0-9a-z\.-]+)/) { print "$1\n"; exit(0)} } ; exit 1'`
echo Version string: $VER.
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2784)
by knielsen@knielsen-hq.org 12 Dec '09
by knielsen@knielsen-hq.org 12 Dec '09
12 Dec '09
#At lp:maria
2784 knielsen(a)knielsen-hq.org 2009-12-12
Fix source tarball name and 99 char path limitation.
Fix obsolete automake usage in AM_INIT_AUTOMAKE so we can use the option to use
tar version without 99 char pathname limit.
Change package name to get the source tarball to be named mariadb- not mysql-.
Remove extra -MariaDB version string; we can instead change the package name and
use --with-server-suffix when building packages.
modified:
CMakeLists.txt
Makefile.am
configure.in
include/config-netware.h
include/config-win.h
scripts/Makefile.am
support-files/Makefile.am
win/configure.js
win/make_mariadb_win_dist
per-file messages:
CMakeLists.txt
PACKAGE macro should not be needed.
Makefile.am
Fix tarball path name.
configure.in
Fix obsolete usage of AM_INIT_AUTOMAKE.
Change package name to mariadb to get proper naming of source tarball.
Set option to use tar file format without 99 char lenght limit.
include/config-netware.h
PACKAGE macro should not be needed.
include/config-win.h
PACKAGE macro should not be needed.
scripts/Makefile.am
The path should be /mysql not /mariadb for compatibility reasons.
support-files/Makefile.am
The path should be /mysql not /mariadb for compatibility reasons.
win/configure.js
Update parsing of configure.in
win/make_mariadb_win_dist
Update parsing of configure.in
=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt 2009-12-03 11:19:05 +0000
+++ b/CMakeLists.txt 2009-12-11 23:26:09 +0000
@@ -36,7 +36,6 @@ ADD_DEFINITIONS(-DDEFAULT_MYSQL_HOME="c:
ADD_DEFINITIONS(-DDEFAULT_BASEDIR="c:/Program Files/MySQL/")
ADD_DEFINITIONS(-DMYSQL_DATADIR="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/data")
ADD_DEFINITIONS(-DDEFAULT_CHARSET_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
-ADD_DEFINITIONS(-DPACKAGE=mysql)
ADD_DEFINITIONS(-DSHAREDIR="share")
# Set debug options
=== modified file 'Makefile.am'
--- a/Makefile.am 2009-12-03 11:19:05 +0000
+++ b/Makefile.am 2009-12-11 23:26:09 +0000
@@ -63,7 +63,7 @@ dist-hook:
# Simple target to allow scripts etc. to get the name of the source
# tarball easily.
show-dist-name:
- @echo "$(PACKAGE)-$(VERSION)"
+ @echo "$(PACKAGE_TARNAME)-$(VERSION)"
all-local: @ABI_CHECK@
=== modified file 'configure.in'
--- a/configure.in 2009-12-03 11:34:11 +0000
+++ b/configure.in 2009-12-11 23:26:09 +0000
@@ -3,8 +3,6 @@ dnl Process this file with autoconf to p
AC_PREREQ(2.52)dnl Minimum Autoconf version required.
-AC_INIT(sql/mysqld.cc)
-AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also update version.c in ndb
#
@@ -15,7 +13,12 @@ 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)
+# and by win/make_mariadb_win_dist
+AC_INIT([MariaDB], [5.1.41-beta])
+AC_CONFIG_SRCDIR(sql/mysqld.cc)
+AC_CANONICAL_SYSTEM
+
+AM_INIT_AUTOMAKE([tar-ustar])
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
=== modified file 'include/config-netware.h'
--- a/include/config-netware.h 2009-07-31 19:28:15 +0000
+++ b/include/config-netware.h 2009-12-11 23:26:09 +0000
@@ -127,7 +127,6 @@ extern "C" {
/* default directory information */
#define DEFAULT_MYSQL_HOME "sys:/mysql"
-#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "sys:/"
#define SHAREDIR "share/"
#define DEFAULT_CHARSET_HOME "sys:/mysql/"
=== modified file 'include/config-win.h'
--- a/include/config-win.h 2009-09-07 20:50:10 +0000
+++ b/include/config-win.h 2009-12-11 23:26:09 +0000
@@ -348,7 +348,6 @@ inline ulonglong double2ulonglong(double
#ifndef CMAKE_CONFIGD
#define DEFAULT_MYSQL_HOME "c:\\mysql"
#define MYSQL_DATADIR "c:\\mysql\\data"
-#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "C:\\"
#define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/"
=== modified file 'scripts/Makefile.am'
--- a/scripts/Makefile.am 2008-12-10 09:02:25 +0000
+++ b/scripts/Makefile.am 2009-12-11 23:26:09 +0000
@@ -96,7 +96,7 @@ CLEANFILES = @server_scripts@ \
pkgplugindir = $(pkglibdir)/plugin
# Default same as 'pkgdatadir', but we can override it
-pkgsuppdir = $(datadir)/@PACKAGE@
+pkgsuppdir = $(datadir)/mysql
# mysqlbug should be distributed built so that people can report build
# failures with it.
=== modified file 'support-files/Makefile.am'
--- a/support-files/Makefile.am 2009-10-23 16:48:54 +0000
+++ b/support-files/Makefile.am 2009-12-11 23:26:09 +0000
@@ -38,7 +38,7 @@ EXTRA_DIST = mysql.spec.sh \
SUBDIRS = MacOSX RHEL4-SElinux
# Default same as 'pkgdatadir', but we can override it
-pkgsuppdir = $(datadir)/@PACKAGE@
+pkgsuppdir = $(datadir)/mysql
pkgsupp_DATA = my-small.cnf \
my-medium.cnf \
=== modified file 'win/configure.js'
--- a/win/configure.js 2009-10-07 21:00:29 +0000
+++ b/win/configure.js 2009-12-11 23:26:09 +0000
@@ -155,8 +155,8 @@ function GetValue(str, key)
function GetVersion(str)
{
- var key = "AM_INIT_AUTOMAKE(mysql, ";
- var key2 = "AM_INIT_AUTOMAKE(mariadb, ";
+ var key = "AC_INIT([mysql], [";
+ var key2 = "AC_INIT([mariadb], [";
var key_len = key.length;
var pos = str.indexOf(key); //5.0.6-beta)
if (pos == -1)
@@ -166,7 +166,7 @@ function GetVersion(str)
}
if (pos == -1) return null;
pos += key_len;
- var end = str.indexOf(")", pos);
+ var end = str.indexOf("]", pos);
if (end == -1) return null;
return str.substring(pos, end);
}
=== modified file 'win/make_mariadb_win_dist'
--- a/win/make_mariadb_win_dist 2009-10-30 10:50:48 +0000
+++ b/win/make_mariadb_win_dist 2009-12-11 23:26:09 +0000
@@ -25,7 +25,7 @@ devenv.com MySQL.sln /build Debug
# TODO extract version number
VER=`cat configure.in |
- perl -e 'while (<>) { if (/^AM_INIT_AUTOMAKE\([a-z ]*, *([0-9a-z\.-]+)/) { print "$1\n"; exit(0)} } ; exit 1'`
+ perl -e 'while (<>) { if (/^AC_INIT\(\[[a-z ]*\], *\[([0-9a-z\.-]+)\]/) { print "$1\n"; exit(0)} } ; exit 1'`
echo Version string: $VER.
1
0
[Maria-developers] Updated (by Sanja): Subquery optimization: Avoid recalculating subquery if external fields values found in subquery cache (66)
by worklog-noreply@askmonty.org 11 Dec '09
by worklog-noreply@askmonty.org 11 Dec '09
11 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Avoid recalculating subquery if external fields
values found in subquery cache
CREATION DATE..: Wed, 25 Nov 2009, 22:25
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 66 (http://askmonty.org/worklog/?tid=66)
VERSION........: Server-5.2
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Sanja - Fri, 11 Dec 2009, 15:09)=-=-
High-Level Specification modified.
--- /tmp/wklog.66.old.28164 2009-12-11 15:09:15.000000000 +0200
+++ /tmp/wklog.66.new.28164 2009-12-11 15:09:15.000000000 +0200
@@ -3,4 +3,4 @@
To check/discuss:
-Are there sens to put subquery cache on all levels of subqueries of on highest.
+ To put subquery cache on all levels of subqueries or on highest level only.
-=-=(Sanja - Fri, 11 Dec 2009, 15:08)=-=-
Low Level Design modified.
--- /tmp/wklog.66.old.28072 2009-12-11 15:08:16.000000000 +0200
+++ /tmp/wklog.66.new.28072 2009-12-11 15:08:16.000000000 +0200
@@ -1 +1,6 @@
+All items on which subquery depend could be collected in
+st_select_lex::mark_as_dependent (direct of indirect reference?)
+
+Temporary table index should be created by all fields except result field
+(TMP_TABLE_PARAM::keyinfo).
-=-=(Sanja - Fri, 11 Dec 2009, 15:05)=-=-
High-Level Specification modified.
--- /tmp/wklog.66.old.27795 2009-12-11 15:05:04.000000000 +0200
+++ /tmp/wklog.66.new.27795 2009-12-11 15:05:04.000000000 +0200
@@ -1 +1,6 @@
+Attach subquery cache to each Item_subquery. Interface should allow to use hash
+or temporary table inside.
+
+To check/discuss:
+Are there sens to put subquery cache on all levels of subqueries of on highest.
DESCRIPTION:
Collect all outer items/references (left part of the subquiery and outer
references inside the subquery) in key string. Compare the string (which
represents certain value set of the references) against values in hash table and
return cached result of subquery if the reference values combination has already
been used.
For example in the following subquery:
(L1, L2) IN (SELECT A, B FROM T WHERE T.F1>OTER_FIELD)
set of references to look into the subquery cache is (L1, L2, OTER_FIELD).
The subquery cache should be implemented as simple LRU connected to the subquery.
Size of the subquery cache (in number of results (but maybe in used memory
amount)) is limited by session variable (query parameter?).
HIGH-LEVEL SPECIFICATION:
Attach subquery cache to each Item_subquery. Interface should allow to use hash
or temporary table inside.
To check/discuss:
To put subquery cache on all levels of subqueries or on highest level only.
LOW-LEVEL DESIGN:
All items on which subquery depend could be collected in
st_select_lex::mark_as_dependent (direct of indirect reference?)
Temporary table index should be created by all fields except result field
(TMP_TABLE_PARAM::keyinfo).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Sanja): Subquery optimization: Avoid recalculating subquery if external fields values found in subquery cache (66)
by worklog-noreply@askmonty.org 11 Dec '09
by worklog-noreply@askmonty.org 11 Dec '09
11 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Avoid recalculating subquery if external fields
values found in subquery cache
CREATION DATE..: Wed, 25 Nov 2009, 22:25
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 66 (http://askmonty.org/worklog/?tid=66)
VERSION........: Server-5.2
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Sanja - Fri, 11 Dec 2009, 15:09)=-=-
High-Level Specification modified.
--- /tmp/wklog.66.old.28164 2009-12-11 15:09:15.000000000 +0200
+++ /tmp/wklog.66.new.28164 2009-12-11 15:09:15.000000000 +0200
@@ -3,4 +3,4 @@
To check/discuss:
-Are there sens to put subquery cache on all levels of subqueries of on highest.
+ To put subquery cache on all levels of subqueries or on highest level only.
-=-=(Sanja - Fri, 11 Dec 2009, 15:08)=-=-
Low Level Design modified.
--- /tmp/wklog.66.old.28072 2009-12-11 15:08:16.000000000 +0200
+++ /tmp/wklog.66.new.28072 2009-12-11 15:08:16.000000000 +0200
@@ -1 +1,6 @@
+All items on which subquery depend could be collected in
+st_select_lex::mark_as_dependent (direct of indirect reference?)
+
+Temporary table index should be created by all fields except result field
+(TMP_TABLE_PARAM::keyinfo).
-=-=(Sanja - Fri, 11 Dec 2009, 15:05)=-=-
High-Level Specification modified.
--- /tmp/wklog.66.old.27795 2009-12-11 15:05:04.000000000 +0200
+++ /tmp/wklog.66.new.27795 2009-12-11 15:05:04.000000000 +0200
@@ -1 +1,6 @@
+Attach subquery cache to each Item_subquery. Interface should allow to use hash
+or temporary table inside.
+
+To check/discuss:
+Are there sens to put subquery cache on all levels of subqueries of on highest.
DESCRIPTION:
Collect all outer items/references (left part of the subquiery and outer
references inside the subquery) in key string. Compare the string (which
represents certain value set of the references) against values in hash table and
return cached result of subquery if the reference values combination has already
been used.
For example in the following subquery:
(L1, L2) IN (SELECT A, B FROM T WHERE T.F1>OTER_FIELD)
set of references to look into the subquery cache is (L1, L2, OTER_FIELD).
The subquery cache should be implemented as simple LRU connected to the subquery.
Size of the subquery cache (in number of results (but maybe in used memory
amount)) is limited by session variable (query parameter?).
HIGH-LEVEL SPECIFICATION:
Attach subquery cache to each Item_subquery. Interface should allow to use hash
or temporary table inside.
To check/discuss:
To put subquery cache on all levels of subqueries or on highest level only.
LOW-LEVEL DESIGN:
All items on which subquery depend could be collected in
st_select_lex::mark_as_dependent (direct of indirect reference?)
Temporary table index should be created by all fields except result field
(TMP_TABLE_PARAM::keyinfo).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Sanja): Subquery optimization: Avoid recalculating subquery if external fields values found in subquery cache (66)
by worklog-noreply@askmonty.org 11 Dec '09
by worklog-noreply@askmonty.org 11 Dec '09
11 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Avoid recalculating subquery if external fields
values found in subquery cache
CREATION DATE..: Wed, 25 Nov 2009, 22:25
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 66 (http://askmonty.org/worklog/?tid=66)
VERSION........: Server-5.2
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Sanja - Fri, 11 Dec 2009, 15:08)=-=-
Low Level Design modified.
--- /tmp/wklog.66.old.28072 2009-12-11 15:08:16.000000000 +0200
+++ /tmp/wklog.66.new.28072 2009-12-11 15:08:16.000000000 +0200
@@ -1 +1,6 @@
+All items on which subquery depend could be collected in
+st_select_lex::mark_as_dependent (direct of indirect reference?)
+
+Temporary table index should be created by all fields except result field
+(TMP_TABLE_PARAM::keyinfo).
-=-=(Sanja - Fri, 11 Dec 2009, 15:05)=-=-
High-Level Specification modified.
--- /tmp/wklog.66.old.27795 2009-12-11 15:05:04.000000000 +0200
+++ /tmp/wklog.66.new.27795 2009-12-11 15:05:04.000000000 +0200
@@ -1 +1,6 @@
+Attach subquery cache to each Item_subquery. Interface should allow to use hash
+or temporary table inside.
+
+To check/discuss:
+Are there sens to put subquery cache on all levels of subqueries of on highest.
DESCRIPTION:
Collect all outer items/references (left part of the subquiery and outer
references inside the subquery) in key string. Compare the string (which
represents certain value set of the references) against values in hash table and
return cached result of subquery if the reference values combination has already
been used.
For example in the following subquery:
(L1, L2) IN (SELECT A, B FROM T WHERE T.F1>OTER_FIELD)
set of references to look into the subquery cache is (L1, L2, OTER_FIELD).
The subquery cache should be implemented as simple LRU connected to the subquery.
Size of the subquery cache (in number of results (but maybe in used memory
amount)) is limited by session variable (query parameter?).
HIGH-LEVEL SPECIFICATION:
Attach subquery cache to each Item_subquery. Interface should allow to use hash
or temporary table inside.
To check/discuss:
Are there sens to put subquery cache on all levels of subqueries of on highest.
LOW-LEVEL DESIGN:
All items on which subquery depend could be collected in
st_select_lex::mark_as_dependent (direct of indirect reference?)
Temporary table index should be created by all fields except result field
(TMP_TABLE_PARAM::keyinfo).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Sanja): Subquery optimization: Avoid recalculating subquery if external fields values found in subquery cache (66)
by worklog-noreply@askmonty.org 11 Dec '09
by worklog-noreply@askmonty.org 11 Dec '09
11 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Avoid recalculating subquery if external fields
values found in subquery cache
CREATION DATE..: Wed, 25 Nov 2009, 22:25
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 66 (http://askmonty.org/worklog/?tid=66)
VERSION........: Server-5.2
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Sanja - Fri, 11 Dec 2009, 15:08)=-=-
Low Level Design modified.
--- /tmp/wklog.66.old.28072 2009-12-11 15:08:16.000000000 +0200
+++ /tmp/wklog.66.new.28072 2009-12-11 15:08:16.000000000 +0200
@@ -1 +1,6 @@
+All items on which subquery depend could be collected in
+st_select_lex::mark_as_dependent (direct of indirect reference?)
+
+Temporary table index should be created by all fields except result field
+(TMP_TABLE_PARAM::keyinfo).
-=-=(Sanja - Fri, 11 Dec 2009, 15:05)=-=-
High-Level Specification modified.
--- /tmp/wklog.66.old.27795 2009-12-11 15:05:04.000000000 +0200
+++ /tmp/wklog.66.new.27795 2009-12-11 15:05:04.000000000 +0200
@@ -1 +1,6 @@
+Attach subquery cache to each Item_subquery. Interface should allow to use hash
+or temporary table inside.
+
+To check/discuss:
+Are there sens to put subquery cache on all levels of subqueries of on highest.
DESCRIPTION:
Collect all outer items/references (left part of the subquiery and outer
references inside the subquery) in key string. Compare the string (which
represents certain value set of the references) against values in hash table and
return cached result of subquery if the reference values combination has already
been used.
For example in the following subquery:
(L1, L2) IN (SELECT A, B FROM T WHERE T.F1>OTER_FIELD)
set of references to look into the subquery cache is (L1, L2, OTER_FIELD).
The subquery cache should be implemented as simple LRU connected to the subquery.
Size of the subquery cache (in number of results (but maybe in used memory
amount)) is limited by session variable (query parameter?).
HIGH-LEVEL SPECIFICATION:
Attach subquery cache to each Item_subquery. Interface should allow to use hash
or temporary table inside.
To check/discuss:
Are there sens to put subquery cache on all levels of subqueries of on highest.
LOW-LEVEL DESIGN:
All items on which subquery depend could be collected in
st_select_lex::mark_as_dependent (direct of indirect reference?)
Temporary table index should be created by all fields except result field
(TMP_TABLE_PARAM::keyinfo).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Sanja): Subquery optimization: Avoid recalculating subquery if external fields values found in subquery cache (66)
by worklog-noreply@askmonty.org 11 Dec '09
by worklog-noreply@askmonty.org 11 Dec '09
11 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Avoid recalculating subquery if external fields
values found in subquery cache
CREATION DATE..: Wed, 25 Nov 2009, 22:25
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 66 (http://askmonty.org/worklog/?tid=66)
VERSION........: Server-5.2
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Sanja - Fri, 11 Dec 2009, 15:05)=-=-
High-Level Specification modified.
--- /tmp/wklog.66.old.27795 2009-12-11 15:05:04.000000000 +0200
+++ /tmp/wklog.66.new.27795 2009-12-11 15:05:04.000000000 +0200
@@ -1 +1,6 @@
+Attach subquery cache to each Item_subquery. Interface should allow to use hash
+or temporary table inside.
+
+To check/discuss:
+Are there sens to put subquery cache on all levels of subqueries of on highest.
DESCRIPTION:
Collect all outer items/references (left part of the subquiery and outer
references inside the subquery) in key string. Compare the string (which
represents certain value set of the references) against values in hash table and
return cached result of subquery if the reference values combination has already
been used.
For example in the following subquery:
(L1, L2) IN (SELECT A, B FROM T WHERE T.F1>OTER_FIELD)
set of references to look into the subquery cache is (L1, L2, OTER_FIELD).
The subquery cache should be implemented as simple LRU connected to the subquery.
Size of the subquery cache (in number of results (but maybe in used memory
amount)) is limited by session variable (query parameter?).
HIGH-LEVEL SPECIFICATION:
Attach subquery cache to each Item_subquery. Interface should allow to use hash
or temporary table inside.
To check/discuss:
Are there sens to put subquery cache on all levels of subqueries of on highest.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Sanja): Subquery optimization: Avoid recalculating subquery if external fields values found in subquery cache (66)
by worklog-noreply@askmonty.org 11 Dec '09
by worklog-noreply@askmonty.org 11 Dec '09
11 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Avoid recalculating subquery if external fields
values found in subquery cache
CREATION DATE..: Wed, 25 Nov 2009, 22:25
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 66 (http://askmonty.org/worklog/?tid=66)
VERSION........: Server-5.2
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Sanja - Fri, 11 Dec 2009, 15:05)=-=-
High-Level Specification modified.
--- /tmp/wklog.66.old.27795 2009-12-11 15:05:04.000000000 +0200
+++ /tmp/wklog.66.new.27795 2009-12-11 15:05:04.000000000 +0200
@@ -1 +1,6 @@
+Attach subquery cache to each Item_subquery. Interface should allow to use hash
+or temporary table inside.
+
+To check/discuss:
+Are there sens to put subquery cache on all levels of subqueries of on highest.
DESCRIPTION:
Collect all outer items/references (left part of the subquiery and outer
references inside the subquery) in key string. Compare the string (which
represents certain value set of the references) against values in hash table and
return cached result of subquery if the reference values combination has already
been used.
For example in the following subquery:
(L1, L2) IN (SELECT A, B FROM T WHERE T.F1>OTER_FIELD)
set of references to look into the subquery cache is (L1, L2, OTER_FIELD).
The subquery cache should be implemented as simple LRU connected to the subquery.
Size of the subquery cache (in number of results (but maybe in used memory
amount)) is limited by session variable (query parameter?).
HIGH-LEVEL SPECIFICATION:
Attach subquery cache to each Item_subquery. Interface should allow to use hash
or temporary table inside.
To check/discuss:
Are there sens to put subquery cache on all levels of subqueries of on highest.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
Hi,
I just wanted to mention that we now have an RSS feed for MariaDB releases located here:
http://askmonty.org/downloads/feeds/releases/
Best Regards,
--
Bryan Alsdorf, Lead Web Developer
Monty Program, AB. http://askmonty.org
1
0
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2783: Fix for
by noreply@launchpad.net 09 Dec '09
by noreply@launchpad.net 09 Dec '09
09 Dec '09
------------------------------------------------------------
revno: 2783
committer: Hakan Kuecuekyilmaz <hakan(a)askmonty.org>
branch nick: maria
timestamp: Wed 2009-12-09 17:43:00 +0100
message:
Fix for
Bug #494255
Cannot run RQG due to errors in mysql-test-run.pl v1
Problem was missing variable declaration. Most likely due to a merge issue.
modified:
mysql-test/lib/v1/mysql-test-run.pl
--
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] Rev 2735: merge in file:///home/bell/maria/bzr/work-maria-5.2-merge-5.1/
by sanja@askmonty.org 09 Dec '09
by sanja@askmonty.org 09 Dec '09
09 Dec '09
At file:///home/bell/maria/bzr/work-maria-5.2-merge-5.1/
------------------------------------------------------------
revno: 2735 [merge]
revision-id: sanja(a)askmonty.org-20091209095344-ktayauku639479jd
parent: sanja(a)askmonty.org-20091209091419-1vf3iqokr4opvp4k
parent: knielsen(a)knielsen-hq.org-20091207065336-tm59u3231q5dvx7j
committer: sanja(a)askmonty.org
branch nick: work-maria-5.2-merge-5.1
timestamp: Wed 2009-12-09 11:53:44 +0200
message:
merge
modified:
BUILD/FINISH.sh sp1f-finish.sh-20001218212418-rjfhkdbumwhfwg4upd5j2pgfe375sjfq
BUILD/SETUP.sh sp1f-setup.sh-20001218212418-itvzddls4bsqffggcsjklbawdmaxdhde
client/mysql.cc sp1f-mysql.cc-19700101030959-5sipizk7ehvbsi3tywrkdords5qy5zdl
client/mysqlcheck.c sp1f-mysqlcheck.c-20010419220847-mlhe2ixwl5ajjyneyciytsdsis3iujhl
client/mysqlslap.c sp1f-mysqlslap.c-20051130000206-7t375hf5mtlqof5xd4nj76yckxvxykhv
client/mysqltest.cc sp1f-mysqltest.c-20001010065317-ix4zw26srlev7yugcz455ux22zwyynyf
dbug/dbug.c sp1f-dbug.c-19700101030959-dmu3qmh72hbptp5opqnmfgjtfckxi5ug
extra/yassl/taocrypt/include/block.hpp sp1f-block.hpp-20050428132313-36s5yrjvbk36ud3nkobt5zsv2ctac72e
mysql-test/lib/mtr_cases.pm sp1f-mtr_cases.pl-20050203205008-rrteoawyobvgq6u7zeyce4tmuu334ayg
mysql-test/lib/mtr_report.pm sp1f-mtr_report.pl-20041230152648-5foxu5uozo2rvqqrcdpi6gnt4o3z47is
mysql-test/mysql-test-run.pl sp1f-mysqltestrun.pl-20041230152716-xjnn5ndv4rr4by6ijmj5a4ysubxc7qh3
mysql-test/r/ctype_ucs.result sp1f-ctype_ucs.result-20030916112630-sohywipskzw3eqmbhfsqxqjteoun6t2g
mysql-test/r/warnings.result sp1f-warnings.result-20010928050551-uka7prbsewkm4k6eu4jrzvvwjvhxgw3y
mysql-test/suite/federated/disabled.def sp1f-disabled.def-20071212171904-pmuy45bfadht6mm7ig3qvzqc5tfvwfjy
mysql-test/suite/federated/federated_server.result sp1f-federated_server.res-20061202004729-hi4tlt4wdwlni7gwjyolgiey4bwt4ehp
mysql-test/suite/federated/federated_server.test sp1f-federated_server.tes-20061202004730-idhp5qb6ntspupkz2wftb5aguipv27kk
mysql-test/suite/funcs_1/r/innodb_func_view.result sp1f-innodb_func_view.res-20070206175435-zksozsfanah6kcpyvvlsojjqamdrlaix
mysql-test/suite/funcs_1/r/memory_func_view.result sp1f-memory_func_view.res-20070206175436-3fqxnwbedehhtbacqfdpguyzlzigftqi
mysql-test/suite/funcs_1/r/myisam_func_view.result sp1f-myisam_func_view.res-20070206175437-hx5547ncsoco2bpruecyswjziotocyhd
mysql-test/t/ctype_ucs.test sp1f-ctype_ucs.test-20030916112631-7diba44oovwv3h5kqbswfqbveczwbrxv
mysql-test/t/warnings.test sp1f-warnings.test-20001228015637-zfi7dd3hclrgbgbjruiknua2ytqtagx4
plugin/fulltext/plugin_example.c sp1f-plugin_example.c-20051228120521-okmw6cytrbhx3kpxsuswy6v7agqdiaik
sql-common/client.c sp1f-client.c-20030502160736-oraaciqy6jkfwygs6tqfoaxgjbi65yo7
sql/my_decimal.cc sp1f-my_decimal.cc-20050208224937-tgb63ttruwc4ihp23jkciv5vfpwwm5bv
sql/mysqld.cc sp1f-mysqld.cc-19700101030959-zpswdvekpvixxzxf7gdtofzel7nywtfj
sql/share/errmsg.txt sp1f-errmsg.txt-20041213212820-do5w642w224ja7ctyqhyl6iihdmpkzv5
sql/slave.cc sp1f-slave.cc-19700101030959-a636aj3mjxgu7fnznrg5kt77p3u2bvhh
sql/sql_base.cc sp1f-sql_base.cc-19700101030959-w7tul2gb2n4jzayjwlslj3ybmf3uhk6a
sql/sql_class.cc sp1f-sql_class.cc-19700101030959-rpotnweaff2pikkozh3butrf7mv3oero
sql/sql_insert.cc sp1f-sql_insert.cc-19700101030959-xgwqe5svnimxudzdcuitauljzz2zjk5g
storage/federatedx/ha_federatedx.cc ha_federatedx.cc-20091029224633-m824ql737a2j6q5a-6
strings/ctype-ucs2.c sp1f-ctypeucs2.c-20030521102942-3fr4x6ti6jw6vqwdh7byhlxpu6oivdnn
unittest/mysys/Makefile.am sp1f-makefile.am-20060404161610-vihzdr4qjuef3o5tlkhxxs3o74qy7bln
Diff too large for email (1752 lines, the limit is 1000).
1
0
[Maria-developers] Rev 2734: auto-merge in file:///home/bell/maria/bzr/work-maria-5.2-merge-5.1-merge/
by sanja@askmonty.org 09 Dec '09
by sanja@askmonty.org 09 Dec '09
09 Dec '09
At file:///home/bell/maria/bzr/work-maria-5.2-merge-5.1-merge/
------------------------------------------------------------
revno: 2734 [merge]
revision-id: sanja(a)askmonty.org-20091209091419-1vf3iqokr4opvp4k
parent: sanja(a)askmonty.org-20091208214754-6567fbf56f2aif7v
parent: psergey(a)askmonty.org-20091202142609-18bp41q8mejxl47t
committer: sanja(a)askmonty.org
branch nick: work-maria-5.2-merge-5.1-merge
timestamp: Wed 2009-12-09 11:14:19 +0200
message:
auto-merge
modified:
sql/item.h sp1f-item.h-19700101030959-rrkb43htudd62batmoteashkebcwykpa
=== modified file 'sql/item.h'
--- a/sql/item.h 2009-12-08 21:47:54 +0000
+++ b/sql/item.h 2009-12-09 09:14:19 +0000
@@ -25,7 +25,7 @@
sprintf(buff, "%s::%s", where, processor_name);
DBUG_ENTER(buff);
sprintf(buff, "%s returns TRUE: unsupported function", processor_name);
- DBUG_PRINT("info", (buff));
+ DBUG_PRINT("info", ("%s", buff));
DBUG_RETURN(TRUE);
}
1
0
[Maria-developers] Rev 2733: merge 5.1-> 5.2 in file:///home/bell/maria/bzr/work-maria-5.2-merge-5.1/
by sanja@askmonty.org 08 Dec '09
by sanja@askmonty.org 08 Dec '09
08 Dec '09
At file:///home/bell/maria/bzr/work-maria-5.2-merge-5.1/
------------------------------------------------------------
revno: 2733 [merge]
revision-id: sanja(a)askmonty.org-20091208214754-6567fbf56f2aif7v
parent: igor(a)askmonty.org-20091112043128-yd6odg8zr5ribjal
parent: monty(a)askmonty.org-20091201160902-a3iq6lw82xbto9yp
committer: sanja(a)askmonty.org
branch nick: work-maria-5.2-merge-5.1
timestamp: Tue 2009-12-08 23:47:54 +0200
message:
merge 5.1-> 5.2
removed:
mysql-test/include/have_dynamic_loading.inc have_dynamic_loading-20090522174437-1iywv3u2rmhtf5lw-1
mysql-test/suite/innodb/r/innodb_file_format.result innodb_file_format.r-20090730123212-ozvn639s8f71467w-1
mysql-test/suite/innodb/t/innodb_file_format.test innodb_file_format.t-20090730123218-e1mr6rq2zau4lsif-1
mysys/mf_strip.c sp1f-mf_stripp.c-19700101030959-2ym735i6ydnmctuca7s77ymbqt7v66me
storage/innodb_plugin/README readme-20090527093836-7v4wb2xxka10h4d0-6
storage/innodb_plugin/handler/handler0vars.h handler0vars.h-20090730095633-tiqyypxaa0sth5gl-1
storage/innodb_plugin/handler/win_delay_loader.cc win_delay_loader.cc-20090730095633-tiqyypxaa0sth5gl-2
storage/innodb_plugin/win-plugin/ winplugin-20090527093836-7v4wb2xxka10h4d0-45
storage/innodb_plugin/win-plugin/README readme-20090527093836-7v4wb2xxka10h4d0-400
storage/innodb_plugin/win-plugin/win-plugin.diff winplugin.diff-20090527093836-7v4wb2xxka10h4d0-401
storage/xtradb/ut/ut0auxconf.c ut0auxconf.c-20090326061054-ylrdb8libxw6u7e9-10
added:
mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test binlog_failure_mixin-20091006002922-iahrhss60j05ei1h-1
mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test rpl_auto_increment_i-20090914101609-rtpx81itbaubpmgc-1
mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test rpl_auto_increment_i-20090914101534-x7z3gkpnlcvpe8tc-1
mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test rpl_autoinc_func_inv-20090927065809-91q8o1j3cgydbnbf-1
mysql-test/include/have_case_insensitive_fs.inc have_case_insensitiv-20091027080400-j8v9m0ohbe2h6g9j-1
mysql-test/include/have_debug_sync.inc have_debug_sync.inc-20090925124518-2m0htks1bbp5jaf5-1
mysql-test/include/have_dynamic_loading.inc have_dynamic_loading-20090904194100-ugojr9bb769e3fbq-1
mysql-test/include/have_mysql_upgrade.inc have_mysql_upgrade.i-20090917092107-9hgddfty57tkdmvp-1
mysql-test/include/have_not_innodb_plugin.inc have_not_innodb_plug-20090923075831-ufghhe437p4n3lll-2
mysql-test/include/not_windows_embedded.inc not_windows_embedded-20091008083404-t3r99o2khtp7kg90-1
mysql-test/lib/v1/incompatible.tests incompatible.tests-20090716120442-nls1338ddzoeujfy-1
mysql-test/r/bug46760.result bug46760.result-20090918125958-1wth1m4e5jtlymw0-1
mysql-test/r/case_insensitive_fs.require case_insensitive_fs.-20091027080416-za7pbbn63nzc3sq1-1
mysql-test/r/debug_sync.result debug_sync.result-20090925124518-2m0htks1bbp5jaf5-2
mysql-test/r/grant_lowercase_fs.result grant_lowercase_fs.r-20091027080441-p2gwdn1qob67e2sn-1
mysql-test/r/have_debug_sync.require have_debug_sync.requ-20090925124518-2m0htks1bbp5jaf5-3
mysql-test/r/innodb_bug44369.result innodb_bug44369.resu-20091005111405-nbp5t33h95jrqha2-1
mysql-test/r/innodb_bug46000.result innodb_bug46000.resu-20091005110756-z0lgt2d7519jnym8-1
mysql-test/r/innodb_bug47777.result innodb_bug47777.resu-20091102144133-qtzn9xarzh75dlyu-1
mysql-test/r/innodb_file_format.result innodb_file_format.r-20090923000535-ke95wdd4zn27df71-18
mysql-test/r/locale.result locale.result-20091019084441-qaiek29ss4m5rftg-2
mysql-test/r/lowercase_mixed_tmpdir_innodb.result lowercase_mixed_tmpd-20090909093609-nobx9nnvim2rm4w6-1
mysql-test/r/not_true.require not_true.require-20090923075831-ufghhe437p4n3lll-1
mysql-test/r/partition_innodb_builtin.result partition_innodb_bui-20090923084042-z98c8mrrs0g20ib8-1
mysql-test/r/partition_innodb_plugin.result partition_innodb_plu-20090923084042-z98c8mrrs0g20ib8-2
mysql-test/r/partition_open_files_limit.result partition_open_files-20091007154706-q8bf9g4f8yeyzaha-1
mysql-test/r/sp-bugs.result spbugs.result-20091008145837-dfo321akug9vxs7z-2
mysql-test/r/subselect4.result subselect4.result-20090903150316-1sul3u8k29ooxm3r-2
mysql-test/std_data/binlog_transaction.000001 binlog_transaction.0-20090924075501-0p7j6mqdvkocgsqt-1
mysql-test/std_data/latin1.xml latin1.xml-20091012072835-0kzrquhyy5du9pfx-1
mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result binlog_delete_and_fl-20091019225654-0f8r2m0kfopmcyv9-1
mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result binlog_mixed_failure-20091006002922-iahrhss60j05ei1h-2
mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result binlog_row_failure_m-20091006002922-iahrhss60j05ei1h-3
mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result binlog_row_mysqlbinl-20091009083137-wijoi4v49b1btvoa-1
mysql-test/suite/binlog/r/binlog_stm_do_db.result binlog_stm_do_db.res-20090723105556-zwq0kkax3cohfix5-1
mysql-test/suite/binlog/std_data/update-full-row.binlog updatefullrow.binlog-20091009085429-osiv6twgm7nh9ra3-1
mysql-test/suite/binlog/std_data/update-partial-row.binlog updatepartialrow.bin-20091009085429-osiv6twgm7nh9ra3-2
mysql-test/suite/binlog/std_data/write-full-row.binlog writefullrow.binlog-20091009085435-3lxvujqi3h4xswim-1
mysql-test/suite/binlog/std_data/write-partial-row.binlog writepartialrow.binl-20091009085435-3lxvujqi3h4xswim-2
mysql-test/suite/binlog/t/binlog_delete_and_flush_index.test binlog_delete_and_fl-20091019225654-0f8r2m0kfopmcyv9-2
mysql-test/suite/binlog/t/binlog_mixed_failure_mixing_engines.test binlog_mixed_failure-20091006002922-iahrhss60j05ei1h-4
mysql-test/suite/binlog/t/binlog_row_failure_mixing_engines.test binlog_row_failure_m-20091006002922-iahrhss60j05ei1h-5
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test binlog_row_mysqlbinl-20091009083137-wijoi4v49b1btvoa-2
mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt binlog_stm_do_dbmast-20090723105556-zwq0kkax3cohfix5-3
mysql-test/suite/binlog/t/binlog_stm_do_db.test binlog_stm_do_db.tes-20090723105556-zwq0kkax3cohfix5-2
mysql-test/suite/federated/federated_debug-master.opt federated_debugmaste-20090930202808-tky4roen9kpzlmdp-1
mysql-test/suite/federated/federated_debug.result federated_debug.resu-20090930202818-9otpqz3uxpfx2iv1-1
mysql-test/suite/federated/federated_debug.test federated_debug.test-20090930202805-kt19apxdz61tx0ln-1
mysql-test/suite/innodb/r/innodb-consistent.result innodbconsistent.res-20091009132519-hgdn500g0czzt422-1
mysql-test/suite/innodb/r/innodb_bug44571.result innodb_bug44571.resu-20091008104658-12126vr05wqyllai-1
mysql-test/suite/innodb/t/innodb-consistent-master.opt innodbconsistentmast-20091009132511-05q1yxchk8rz94rf-1
mysql-test/suite/innodb/t/innodb-consistent.test innodbconsistent.tes-20091009132503-a1s2ak2b3c32x2xl-1
mysql-test/suite/innodb/t/innodb_bug44571.test innodb_bug44571.test-20091008104658-12126vr05wqyllai-2
mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result rpl_auto_increment_u-20090903144503-al54eug7lpxe5bxp-1
mysql-test/suite/rpl/r/rpl_mysql_upgrade.result rpl_mysql_upgrade.re-20090915080949-vr0m9hda55fjmelr-1
mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result rpl_row_disabled_sla-20090926230521-lkpisp969kum1ko2-1
mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test rpl_auto_increment_u-20090903144442-bgwonv8p7ky8c3ze-1
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock-slave.opt rpl_get_master_versi-20091022015603-0bswyro3q6eqinsm-1
mysql-test/suite/rpl/t/rpl_mysql_upgrade.test rpl_mysql_upgrade.te-20090915080946-ihj08jolsl0jiel5-1
mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test rpl_row_disabled_sla-20090926230521-lkpisp969kum1ko2-2
mysql-test/t/bug46760-master.opt bug46760master.opt-20090918125958-1wth1m4e5jtlymw0-2
mysql-test/t/bug46760.test bug46760.test-20090918125958-1wth1m4e5jtlymw0-3
mysql-test/t/debug_sync.test debug_sync.test-20090925124518-2m0htks1bbp5jaf5-4
mysql-test/t/grant_lowercase_fs.test grant_lowercase_fs.t-20091027080502-vaql5cl7hm77d4va-1
mysql-test/t/innodb_bug44369.test innodb_bug44369.test-20091005111405-nbp5t33h95jrqha2-2
mysql-test/t/innodb_bug46000.test innodb_bug46000.test-20091005110740-z4rhixe6pxtvfzwg-1
mysql-test/t/innodb_bug47777.test innodb_bug47777.test-20091102144121-in0bnk577l2r2niz-1
mysql-test/t/innodb_file_format.test innodb_file_format.t-20090923000535-ke95wdd4zn27df71-19
mysql-test/t/locale.test locale.test-20091019084441-qaiek29ss4m5rftg-1
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt lowercase_mixed_tmpd-20090909093621-493y6grd4ycy587n-1
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh lowercase_mixed_tmpd-20090909093706-tbaggs2flpboi335-1
mysql-test/t/lowercase_mixed_tmpdir_innodb.test lowercase_mixed_tmpd-20090909093625-zly7ha6rwwxch86u-1
mysql-test/t/partition_innodb_builtin.test partition_innodb_bui-20090923082845-g02wtqf81dvzw6gc-1
mysql-test/t/partition_innodb_plugin.test partition_innodb_plu-20090923082850-5l2dv4lq6f99lruy-1
mysql-test/t/partition_open_files_limit-master.opt partition_open_files-20091007154613-kkfm9vev52v7g5qx-1
mysql-test/t/partition_open_files_limit.test partition_open_files-20091007154613-kkfm9vev52v7g5qx-2
mysql-test/t/sp-bugs.test spbugs.test-20091008145837-dfo321akug9vxs7z-1
mysql-test/t/status-master.opt statusmaster.opt-20090827131631-hxfk90w60wdsy2hc-1
mysql-test/t/subselect4.test subselect4.test-20090903150316-1sul3u8k29ooxm3r-1
sql/debug_sync.cc debug_sync.cc-20090925124518-2m0htks1bbp5jaf5-5
sql/debug_sync.h debug_sync.h-20090925124518-2m0htks1bbp5jaf5-6
storage/innodb_plugin/mysql-test/innodb-consistent-master.opt innodbconsistentmast-20091012122637-mepyyow3z5ui6cel-1
storage/innodb_plugin/mysql-test/innodb-consistent.result innodbconsistent.res-20091012122706-h9tv41qfkzisq1b6-1
storage/innodb_plugin/mysql-test/innodb-consistent.test innodbconsistent.tes-20091012122706-h9tv41qfkzisq1b6-2
storage/innodb_plugin/mysql-test/innodb_bug44369.result innodb_bug44369.resu-20091012122706-h9tv41qfkzisq1b6-3
storage/innodb_plugin/mysql-test/innodb_bug44369.test innodb_bug44369.test-20091012122706-h9tv41qfkzisq1b6-4
storage/innodb_plugin/mysql-test/innodb_bug44571.result innodb_bug44571.resu-20091012122706-h9tv41qfkzisq1b6-5
storage/innodb_plugin/mysql-test/innodb_bug44571.test innodb_bug44571.test-20091012122706-h9tv41qfkzisq1b6-6
storage/innodb_plugin/mysql-test/innodb_bug46000.result innodb_bug46000.resu-20091012122706-h9tv41qfkzisq1b6-7
storage/innodb_plugin/mysql-test/innodb_bug46000.test innodb_bug46000.test-20091012122706-h9tv41qfkzisq1b6-8
storage/innodb_plugin/revert_gen.sh revert_gen.sh-20091012123850-w0rv1f2ijprz292d-1
storage/innodb_plugin/scripts/export.sh export.sh-20091012120743-l9z3v18op9lk6dhw-1
storage/innodb_plugin/ut/ut0auxconf_have_gcc_atomics.c ut0auxconf_have_gcc_-20091009120907-rmzjolcnf1dsprof-1
storage/xtradb/COPYING.Percona copying.percona-20090923000535-ke95wdd4zn27df71-1
storage/xtradb/COPYING.Sun_Microsystems copying.sun_microsys-20090923000535-ke95wdd4zn27df71-2
storage/xtradb/Doxyfile doxyfile-20090923000535-ke95wdd4zn27df71-3
storage/xtradb/include/fsp0types.h fsp0types.h-20090923000535-ke95wdd4zn27df71-4
storage/xtradb/ut/ut0auxconf_atomic_pthread_t_gcc.c ut0auxconf_atomic_pt-20090923000535-ke95wdd4zn27df71-20
storage/xtradb/ut/ut0auxconf_atomic_pthread_t_solaris.c ut0auxconf_atomic_pt-20090923000535-ke95wdd4zn27df71-21
storage/xtradb/ut/ut0auxconf_have_solaris_atomics.c ut0auxconf_have_sola-20090923000535-ke95wdd4zn27df71-22
storage/xtradb/ut/ut0auxconf_pause.c ut0auxconf_pause.c-20090923000535-ke95wdd4zn27df71-23
storage/xtradb/ut/ut0auxconf_sizeof_pthread_t.c ut0auxconf_sizeof_pt-20090923000535-ke95wdd4zn27df71-24
renamed:
mysql-test/r/bug40113.result => mysql-test/r/innodb_lock_wait_timeout_1.result bug40113.result-20090619150423-w3im08cym6tyzn8f-3
mysql-test/suite/innodb/r/innodb_bug44032.result => mysql-test/r/innodb_bug44032.result innodb_bug44032.resu-20090610132748-q9m60aph2eqy8zr6-20
mysql-test/suite/innodb/t/innodb_bug44032.test => mysql-test/t/innodb_bug44032.test innodb_bug44032.test-20090610132748-q9m60aph2eqy8zr6-34
mysql-test/t/bug40113-master.opt => mysql-test/t/innodb_lock_wait_timeout_1-master.opt bug40113master.opt-20090619150423-w3im08cym6tyzn8f-1
mysql-test/t/bug40113.test => mysql-test/t/innodb_lock_wait_timeout_1.test bug40113.test-20090619150423-w3im08cym6tyzn8f-2
modified:
.bzrignore sp1f-ignore-20001018235455-q4gxfbritt5f42nwix354ufpsvrf5ebj
BUILD/compile-pentium sp1f-compilepentium-19700101030959-3x4duhrh57l4x3qrpnugtf7w3vum6zfn
CMakeLists.txt sp1f-cmakelists.txt-20060831175236-433hkm7nrqfjbwios4ancgytabw354nr
Docs/INSTALL-BINARY sp1f-installbinary-20071102002932-lm64vo6qp4t3tz7t2edp2mrg5udn2xsy
INSTALL-SOURCE sp1f-installsource-20071102002932-2zshtrwogoj3cs24gl2smml7cigenare
INSTALL-WIN-SOURCE sp1f-installwinsource-20071102113629-gnlyyhvspfpki3lit2lps4hw6blq6u3q
Makefile.am sp1f-makefile.am-19700101030959-jbbpiygwpgybyqknlavdxxupbrjonu7h
README sp1f-readme-19700101030959-ipf4glwvob7zbr3norl5feyy3jwy3sod
client/mysql.cc sp1f-mysql.cc-19700101030959-5sipizk7ehvbsi3tywrkdords5qy5zdl
client/mysql_upgrade.c sp1f-mysql_upgrade.c-20060428040559-3xcugp4nhhb6qfwfacoqw3d4ibgbeboz
client/mysqlbinlog.cc sp1f-mysqlbinlog.cc-19700101030959-b3vgyo47ljent5mhbyj6ik33bi4bukad
client/mysqlcheck.c sp1f-mysqlcheck.c-20010419220847-mlhe2ixwl5ajjyneyciytsdsis3iujhl
client/mysqlimport.c sp1f-mysqlimport.c-19700101030959-m6nmuvl5kbp2qmdqtmu5mxafegtn7ipv
client/mysqlslap.c sp1f-mysqlslap.c-20051130000206-7t375hf5mtlqof5xd4nj76yckxvxykhv
client/mysqltest.cc sp1f-mysqltest.c-20001010065317-ix4zw26srlev7yugcz455ux22zwyynyf
cmd-line-utils/readline/config_readline.h sp1f-config_readline.h-20050419111215-h7qj4r3krmwazb64gm46kzkidw6a2fht
cmd-line-utils/readline/display.c sp1f-display.c-19700101030959-dhuvqj5evnaoid2tbnpgu7zlqrfutn7k
cmd-line-utils/readline/history.c sp1f-history.c-19700101030959-r6q6omzzgxsad5ifoewu7its7jgwaeur
cmd-line-utils/readline/rlmbutil.h sp1f-rlmbutil.h-20021119142529-aqfum336cg5t2jfa5i5odubnq55bm67y
cmd-line-utils/readline/text.c sp1f-text.c-20021119142529-oqwzsftz5nwbqldwyqtvfjqrvzhbolus
cmd-line-utils/readline/xmalloc.c sp1f-xmalloc.c-19700101030959-7zjd3wwo5mcvdg4qn57dmr76ccjlzxop
configure.in sp1f-configure.in-19700101030959-mgdpoxtnh2ewmvusvfpkreuhwvffkcjw
extra/yassl/include/yassl_int.hpp sp1f-yassl_int.hpp-20050428132307-uqdopnog3njo2nicimdqmt7fco35gagn
extra/yassl/taocrypt/src/random.cpp sp1f-random.cpp-20050428132321-q6wudeoop6upz7agf4pmigiyw6d6d3mt
include/ft_global.h sp1f-ft_global.h-19700101030959-qzez255ofrojrptdc5z2oi3sfi3bemf7
include/m_ctype.h sp1f-m_ctype.h-19700101030959-dsoy764fhlrdbb6tsjldsk3e5fohfai6
include/my_dbug.h sp1f-dbug.h-19700101030959-jbasz7hhskrakujn4b3uatfstocyueon
include/my_sys.h sp1f-my_sys.h-19700101030959-lyllvna5vzqfcjnmlcrutgqocylhtb54
include/my_tree.h sp1f-my_tree.h-19700101030959-zri3kg3jzgh5btaillgci2qzmynzkewi
include/myisamchk.h sp1f-myisamchk.h-20060411134400-oxba7mdmuzv2d62tlze6mrs5tpbmhrzw
include/mysql.h sp1f-mysql.h-19700101030959-soi7hu6ji273nui3fm25jjf4m4362pcw
include/mysql.h.pp mysql.h.pp-20080613094407-2m1760u4zdzt4dc7-1
include/mysql/plugin.h sp1f-plugin.h-20051105112032-xacmvx22ghtcgtqhu6v56b4bneqtx7l5
include/mysql/plugin.h.pp plugin.h.pp-20080613094359-py8jez90546shnqt-1
include/mysys_err.h sp1f-mysys_err.h-19700101030959-z4zqei4o4eblzvr5cgyspg6icfo7trix
include/violite.h sp1f-violite.h-19700101030959-jfyqeh5pmto4ncgcdcdf36bl5ininiqx
libmysql/libmysql.c sp1f-libmysql.c-19700101030959-ba4gwsjdmik5puh2qyrfpvoflwer257l
libmysql/libmysql.def sp1f-libmysql.def-20011019010014-dtnxyq3opddoys6ptxjmzhmaa2rlowmq
libmysqld/CMakeLists.txt sp1f-cmakelists.txt-20060403082523-x3vxka3k56u2wpzwcrlpykznlz2akpxd
libmysqld/Makefile.am sp1f-makefile.am-20010411110351-26htpk3ynkyh7pkfvnshztqrxx3few4g
libmysqld/lib_sql.cc sp1f-lib_sql.cc-20010411110351-gt5febleap73tqvapkesopvqtuht5sf5
libmysqld/libmysqld.c sp1f-libmysqld.c-20010411110351-4556sgf6vpnoounnscj2q6zw56ccl332
libmysqld/libmysqld.def sp1f-libmysqld.def-20020109073846-c3x4ovkgky3uok5h6uiaxaevadsluq6k
man/comp_err.1 comp_err.1-20090525095603-4fk5uwzrx2c7shtv-1
man/innochecksum.1 innochecksum.1-20090525095601-iqajpx4dd1tmgcv5-1
man/make_win_bin_dist.1 make_win_bin_dist.1-20090525095616-uxyflq5ybbyscodp-1
man/msql2mysql.1 msql2mysql.1-20090525095615-gdgvhigy9if7xq4g-1
man/my_print_defaults.1 my_print_defaults.1-20090525095609-tni7cnhq2jgs39kn-1
man/myisam_ftdump.1 myisam_ftdump.1-20090525095628-2jh4hkxgv438xsgv-1
man/myisamchk.1 myisamchk.1-20090525095638-dzseeu4ycd9e5ord-1
man/myisamlog.1 myisamlog.1-20090525095612-q6pse99hpl4xobaa-1
man/myisampack.1 myisampack.1-20090525095647-5dbjtz28ostitqta-1
man/mysql-stress-test.pl.1 mysqlstresstest.pl.1-20090525095649-19nwoj9hjrh2h5g6-1
man/mysql-test-run.pl.1 mysqltestrun.pl.1-20090525095613-lxqhkj31dtsojqe9-1
man/mysql.1 mysql.1-20090525095614-mcx09byxwzmmjve9-1
man/mysql.server.1 mysql.server.1-20090525095639-cn3iskg7mylu3f7y-1
man/mysql_client_test.1 mysql_client_test.1-20090525095633-wzvw7zq0frrhvzt9-1
man/mysql_config.1 mysql_config.1-20090525095621-i03klu91hgc51v7v-1
man/mysql_convert_table_format.1 mysql_convert_table_-20090525095631-181nirm84ivqfftv-1
man/mysql_find_rows.1 mysql_find_rows.1-20090525095619-4siq8k2zias4vosn-1
man/mysql_fix_extensions.1 mysql_fix_extensions-20090525095608-bybthq626if21blt-1
man/mysql_fix_privilege_tables.1 mysql_fix_privilege_-20090525095618-7dbntbmbro9h1mq4-1
man/mysql_install_db.1 mysql_install_db.1-20090525095630-dmkfbumaw81atu24-1
man/mysql_secure_installation.1 mysql_secure_install-20090525095646-5j5oc7jsecqqi5fv-1
man/mysql_setpermission.1 mysql_setpermission.-20090525095648-7qb24l20njulwpaf-1
man/mysql_tzinfo_to_sql.1 mysql_tzinfo_to_sql.-20090525095622-95m0xn1wx377hecm-1
man/mysql_upgrade.1 mysql_upgrade.1-20090525095624-3lc34mq3fnbz0keh-1
man/mysql_waitpid.1 mysql_waitpid.1-20090525095623-ukknhxen5c561a01-1
man/mysql_zap.1 mysql_zap.1-20090525095636-fttn5to1r6eqoptk-1
man/mysqlaccess.1 mysqlaccess.1-20090525095634-e84nr9bc820h5lh3-1
man/mysqladmin.1 mysqladmin.1-20090525095607-93akc7rtgncf8d4z-1
man/mysqlbinlog.1 mysqlbinlog.1-20090525095626-jfmz563j8jg73xrb-1
man/mysqlbug.1 mysqlbug.1-20090525095618-hzp6y070bmc1a6cn-1
man/mysqlcheck.1 mysqlcheck.1-20090525095611-8xoc706tixmrd1jf-1
man/mysqld.8 mysqld.8-20090525095600-80gvk83sokzwkf93-1
man/mysqld_multi.1 mysqld_multi.1-20090525095604-4k46xzppayrgbb2p-1
man/mysqld_safe.1 mysqld_safe.1-20090525095642-929nskpxfqo13wst-1
man/mysqldump.1 mysqldump.1-20090525095617-c0vnkqb3h4a3blus-1
man/mysqldumpslow.1 mysqldumpslow.1-20090525095629-dwva1gytzeq6ebha-1
man/mysqlhotcopy.1 mysqlhotcopy.1-20090525095641-uaojhd5lf772ga9b-1
man/mysqlimport.1 mysqlimport.1-20090525095627-mfl13ovw3oornooa-1
man/mysqlmanager.8 mysqlmanager.8-20090525095605-1h3mmx4430hb2n18-1
man/mysqlshow.1 mysqlshow.1-20090525095602-g122t7jqoc3bnqcn-1
man/mysqlslap.1 mysqlslap.1-20090525095610-qfprw8oc5cgsp0wu-1
man/mysqltest.1 mysqltest.1-20090525095620-v74fgi55hw1sr3v8-1
man/ndbd.8 ndbd.8-20090525095643-bylmcypb2afkbix1-1
man/ndbd_redo_log_reader.1 ndbd_redo_log_reader-20090525095632-uavlb6ttl24fathd-1
man/ndbmtd.8 ndbmtd.8-20090525095640-qnk6tubhl257cee3-1
man/perror.1 perror.1-20090525095645-tik3ibzzfve4fvqu-1
man/replace.1 replace.1-20090525095644-t2e5pbl5bcho9z6l-1
man/resolve_stack_dump.1 resolve_stack_dump.1-20090525095637-enz9ko57nji5y4pa-1
man/resolveip.1 resolveip.1-20090525095606-x51yf7vy7vpijf0l-1
mysql-test/collections/README.experimental readme.experimental-20090224115153-en8qgzjquiw0dxzn-1
mysql-test/collections/default.experimental default.experimental-20090224104813-e52mxw708penxv44-1
mysql-test/extra/binlog_tests/binlog.test sp1f-binlog.test-20050223135508-76cdewwz46hwby5kk5g5wmkoxb74yv4y
mysql-test/extra/binlog_tests/drop_temp_table.test sp1f-drop_temp_table.test-20030928163144-dyfrto7gxylnrnim2c5i5wfn7mvjqtgp
mysql-test/extra/rpl_tests/rpl_auto_increment.test sp1f-rpl_auto_increment.t-20051222053450-wnlpmgbkojqq6fnvjocf5ltfbtofin7z
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test sp1f-rpl_extraslave_col.t-20061103140340-egmkull7owd2wp7d4egg6itzef6p7g23
mysql-test/extra/rpl_tests/rpl_failed_optimize.test sp1f-rpl_failed_optimize.-20051222053450-ylhvmukj7czrgqebj3psg6xeigeaovdj
mysql-test/extra/rpl_tests/rpl_loaddata.test sp1f-rpl_loaddata.test-20051222053450-dtp64wd4tqum3ghoumeskw4aslqd3ntv
mysql-test/extra/rpl_tests/rpl_row_sp006.test sp1f-rpl_row_sp006.test-20051222053450-5432dx6ssedtpzocu66e5qdwfxa4vd3c
mysql-test/extra/rpl_tests/rpl_stm_000001.test sp1f-rpl000001.test-20001118063528-ailyrmllkfzwjx3qfvmu555ijzuk5yur
mysql-test/include/check-warnings.test sp1f-checkwarnings.test-20080408145123-h7zoaw4uh3notptmpiebbf3ot3ltza4q
mysql-test/include/concurrent.inc sp1f-innodb_concurrent.te-20051222053459-lwg5sp2ww5pt2wipchfkjjvnmslyp3g3
mysql-test/include/have_example_plugin.inc sp1f-have_example_plugin.-20061214230953-aurfxypudnc5qjcbqivskkglb5ml6ogr
mysql-test/include/have_simple_parser.inc have_simple_parser.i-20081217115927-orp35vg5f5j5mx25-1
mysql-test/include/have_udf.inc sp1f-have_udf.inc-20060215161119-xf74h7vjdqy73koybl4szdso2mj6cr5n
mysql-test/include/index_merge2.inc sp1f-index_merge_innodb.t-20031120202449-xlcs3ske4vzaexqx7gqraoruphzq475l
mysql-test/include/mix1.inc sp1f-innodb_mysql.test-20060426055153-mgtahdmgajg7vffqbq4xrmkzbhvanlaz
mysql-test/include/mtr_warnings.sql sp1f-mtr_warnings.sql-20080408145123-lhtlr627ins6hwi3hxjrcytx4t27nyjr
mysql-test/lib/My/ConfigFactory.pm sp1f-configfactory.pm-20071212171904-umibosyolpj2kzgk32rt5p6pl6vztmaq
mysql-test/lib/My/Platform.pm sp1f-platform.pm-20080220135528-i7dsgofojc7pzjnisb6y43f3kmu6j4ci
mysql-test/lib/My/SafeProcess/safe_kill_win.cc sp1f-safe_kill_win.cc-20071212171905-p26lghnyebz5xacmoguzikby3mb4dmhf
mysql-test/lib/My/SafeProcess/safe_process_win.cc sp1f-safe_process_win.cc-20071212171905-5fxmtbbzzyquscvb7nvjxobmzfwasomh
mysql-test/lib/mtr_cases.pm sp1f-mtr_cases.pl-20050203205008-rrteoawyobvgq6u7zeyce4tmuu334ayg
mysql-test/lib/mtr_report.pm sp1f-mtr_report.pl-20041230152648-5foxu5uozo2rvqqrcdpi6gnt4o3z47is
mysql-test/lib/v1/mtr_cases.pl mtr_cases.pl-20081114073900-ptb78lyx8r1awhv9-1
mysql-test/mysql-stress-test.pl sp1f-mysqlstresstest.pl-20051018162159-2oxz4uxwtkipjw3r7znlxngpg6l5vf63
mysql-test/mysql-test-run.pl sp1f-mysqltestrun.pl-20041230152716-xjnn5ndv4rr4by6ijmj5a4ysubxc7qh3
mysql-test/r/almost_full.result sp1f-almost_full.result-20071112090021-zhr5drqqn7ijqmzeawaiwjfhnqvkfkjr
mysql-test/r/alter_table.result sp1f-alter_table.result-20001228015632-hk5kqhiea33uxdjhnqa2vnagoypjqbi3
mysql-test/r/analyse.result sp1f-analyse.result-20001228015632-2j2wtzdyfq62m65gl6nxekuosny6gy6v
mysql-test/r/archive.result sp1f-archive.result-20040525194738-teb7vr2fyyav2vmvw55tdwgvu3h65flc
mysql-test/r/bug46080.result bug46080.result-20090710115544-bi718vttwzhdrezd-3
mysql-test/r/create.result sp1f-create.result-20001228015633-uy7n6oztnd6vmqcrw6z5tloij5yxv4ov
mysql-test/r/ctype_ldml.result sp1f-ctype_ldml.result-20070607125553-fkqnsdgkmmqoecb76tjv3wzmyqfaik22
mysql-test/r/ctype_uca.result sp1f-ctype_uca.result-20040614165527-sh3blw3yx5333e2d42ctirm72htvwqqs
mysql-test/r/delete.result sp1f-delete.result-20010928050551-vf5sxtd554vuepifylwowaaq7k3mbilw
mysql-test/r/distinct.result sp1f-distinct.result-20001228015633-adu7puhxwf4tiwor5amegcrjobuxljra
mysql-test/r/explain.result sp1f-explain.result-20001228015633-fcck4ixyixae4yjfpahxubumufcrdc7p
mysql-test/r/func_group.result sp1f-func_group.result-20001228015633-oe57bieiww3s6erojiyha7p26m5ul5ql
mysql-test/r/func_in.result sp1f-func_in.result-20001228015633-taucsvp7ggm45m64jbcfu6nyfgdhosnc
mysql-test/r/func_str.result sp1f-strfunc.result-20001215085543-qraqxeite2ybbq4se6ojb2lwaxem3br3
mysql-test/r/gis-rtree.result sp1f-gisrtree.result-20030312125159-uqk53j6wi5kgqzfuaned6oxulziutwoz
mysql-test/r/gis.result sp1f-gis.result-20030301091631-7oyzcwsw4xnrr5tisytvtyymj3p6lvak
mysql-test/r/grant.result sp1f-grant.result-20020905131705-2gfwpyej777fcllxzcvadzd6tqdxfho3
mysql-test/r/grant3.result sp1f-grant3.result-20050322110338-ewbo53qs6fkxfzkc7u2ojzyu6bvyp7w6
mysql-test/r/group_min_max.result sp1f-group_min_max.result-20040827133611-aqzadxttbw23mkanmvdsiaambv2pcy27
mysql-test/r/index_merge_innodb.result sp1f-index_merge_innodb.r-20060816114352-umgqkfavfljswrg7qhdkcoptdwi5gipo
mysql-test/r/index_merge_myisam.result sp1f-index_merge_myisam.r-20060816114353-wd2664hjxwyjdvm4snup647av5fmxfln
mysql-test/r/information_schema_db.result sp1f-information_schema_d-20050506190605-i2emmavt52skkx7n6b5jklprebhrdrxo
mysql-test/r/innodb-autoinc.result innodbautoinc.result-20081201061010-zymrrwrczns2vrex-280
mysql-test/r/innodb-index.result innodbindex.result-20081201061010-zymrrwrczns2vrex-284
mysql-test/r/innodb.result innodb.result-20081201061010-zymrrwrczns2vrex-298
mysql-test/r/innodb_bug36169.result innodb_bug36169.resu-20081201061010-zymrrwrczns2vrex-306
mysql-test/r/innodb_mysql.result sp1f-innodb_mysql.result-20060426055153-bychbbfnqtvmvrwccwhn24i6yi46uqjv
mysql-test/r/insert_select.result sp1f-insert_select.result-20001228015633-wih3pifcw5hofocy6banrbkyhtfy6prn
mysql-test/r/join.result sp1f-join.result-20001228015633-f4navd6fbbzksvhaaqulo5ihgevkjty2
mysql-test/r/lowercase_fs_off.result sp1f-lowercase_fs_off.res-20060504065503-e5mqzuzzst4qdncn4przr2qqszyfdhf4
mysql-test/r/lowercase_table3.result sp1f-lowercase_table3.res-20040306084333-bdleyleqjz73g4ocjm43zmbf6zkjsipm
mysql-test/r/myisam.result sp1f-myisam.result-20010411215653-pgxkk2xg4lh3nxresmfnsuszf5h3nont
mysql-test/r/myisam_crash_before_flush_keys.result myisam_crash_before_-20090402094502-ekp4zzeucx0vftta-1
mysql-test/r/mysqlbinlog.result sp1f-mysqlbinlog.result-20030924192555-7477cirsvcmvihphlv4wbcvd5dfoh3bm
mysql-test/r/mysqltest.result sp1f-mysqltest.result-20041022024801-dfor5httbrm4yhbhqtfjzpkst5hoejym
mysql-test/r/olap.result sp1f-olap.result-20020720115150-egx2d46xkyxi5dgcpyjexyj4ri6wlcvb
mysql-test/r/order_by.result sp1f-order_by.result-20001228015634-omkoitbok7pbz53pkfmplnhbifnrebic
mysql-test/r/partition.result sp1f-partition.result-20050718113029-xlmjyugiq5h2b5wjp236ipsmkmej7i62
mysql-test/r/partition_csv.result sp1f-partition_csv.result-20071022181049-b7rjlf3ifzxbwhry54tng7jif24fuapa
mysql-test/r/partition_innodb.result sp1f-partition_innodb.res-20060518171642-5muwpwnvtxepgop4yhgzzrv2xo2wjlps
mysql-test/r/partition_pruning.result sp1f-partition_pruning.re-20051222092851-tdvef3tnyhio2fj4ktnbr4ienfg7k5qr
mysql-test/r/ps_grant.result sp1f-ps_grant.result-20050330011743-myy3zlxbj2yg7thj2vovrm2sszh6yzas
mysql-test/r/query_cache.result sp1f-query_cache.result-20011205230530-qf3qzwsqsgfi67vv5ijruxeci6cbkwjl
mysql-test/r/range.result sp1f-range.result-20001228015634-6hpoyn74lnc7irf4gop2jbowgpazbbae
mysql-test/r/select.result sp1f-select.result-20010103001548-znkoalxem6wchsbxizfosjhpfmhfyxuk
mysql-test/r/sp-error.result sp1f-sperror.result-20030305184512-euxcpn3oxmcl4dn2kqbdx73ljcbivzto
mysql-test/r/sp.result sp1f-sp.result-20030117133802-duandg3yzagzyv7zhhbbt2kcomcegpc7
mysql-test/r/subselect.result sp1f-subselect.result-20020512204640-zgegcsgavnfd7t7eyrf7ibuqomsw7uzo
mysql-test/r/subselect3.result sp1f-subselect3.result-20061031174245-v7hvtc7uwevifiq4lziwv5gdcxpeak7t
mysql-test/r/system_mysql_db.result sp1f-system_mysql_db.resu-20040310185404-f7br5g4442iqwxireltudlyu5ppbkijo
mysql-test/r/trigger_notembedded.result sp1f-triggergrant.result-20051110192455-2zus7d4a7l2y7ldnokefkk6ibykyn46y
mysql-test/r/type_bit.result sp1f-type_bit.result-20041217140559-ppf6bkjkl3r4tbmlt7ngn46zm6tapa46
mysql-test/r/type_newdecimal.result sp1f-type_newdecimal.resu-20050208224936-kj6dxol5i7zbbfohybib53ffje5i63mk
mysql-test/r/udf.result sp1f-udf.result-20060215161120-pm5l3nyny5gbznc2egfu4bhwgxbuc6wz
mysql-test/r/update.result sp1f-update.result-20001228015634-eddqlilwpyd255hhzq2fnktefhhgzua5
mysql-test/r/upgrade.result sp1f-upgrade.result-20060217091846-vefhbvl6q255bcptbelqp7boemlf7jyp
mysql-test/r/view_grant.result sp1f-view_grant.result-20050404194355-hbbr5ud3thpo5tn65q6eyecswq5mdhwk
mysql-test/r/warnings.result sp1f-warnings.result-20010928050551-uka7prbsewkm4k6eu4jrzvvwjvhxgw3y
mysql-test/r/windows.result sp1f-windows.result-20050901013212-d5xc5u66d6z25c2hig2xgc2zjyazfh6i
mysql-test/r/xa.result sp1f-xa.result-20050403224953-ks6zlldv2mxqgh4edidq7sdrlmj7ko4l
mysql-test/std_data/Index.xml sp1f-index.xml-20070607125553-3iauribiu2zgziawdyrtrdxne2gs5o2y
mysql-test/suite/binlog/r/binlog_killed_simulate.result sp1f-binlog_killed_simula-20071031094843-hn7c5gekip7rxgka7cic7saaqoy6afkn
mysql-test/suite/binlog/r/binlog_row_binlog.result sp1f-binlog_row_binlog.re-20051222053451-vl3rsa7i5wuxj6pjofa7aylzersn25i6
mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result sp1f-binlog_row_drop_tmp_-20051222053451-bsaj7qioh5jt4woxo36t7i6tvuqwdny3
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result sp1f-binlog_row_mix_innod-20051222053451-e65hkpwkx65zhmyddgnozkwk6mudqlhi
mysql-test/suite/binlog/r/binlog_stm_binlog.result sp1f-binlog.result-20050223135507-y6mkcjto5zdkpgaevaqo5epoafa3yiq5
mysql-test/suite/binlog/r/binlog_stm_blackhole.result sp1f-blackhole.result-20050323001036-qq4xfb3k4omfzzjj3to67lnds6i7m6zw
mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result sp1f-drop_temp_table.resu-20030928163144-txtshow2e37lpjddhpazuhs4eulbw2dd
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result sp1f-mix_innodb_myisam_bi-20030822133916-l72xhg2oxjthj6ichxowk55lrbjebfxa
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test binlog_row_mysqlbinl-20090527141831-4bqcdit6efzx76qm-1
mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test binlog_stm_unsafe_wa-20090627130655-dgww8l4zomxa6h9l-3
mysql-test/suite/federated/my.cnf sp1f-my.cnf-20071212171904-j7gg67dkfqjo4f5yirx3nscdzpxieqyv
mysql-test/suite/funcs_1/r/is_columns_mysql.result sp1f-is_columns_mysql.res-20080307163304-a2ymkif2vzliwqqqzr22cglbaf75tthe
mysql-test/suite/funcs_1/r/is_statistics.result sp1f-is_statistics.result-20080307163304-m5utnb3asmvn24qpbivqzlypbjibrtqv
mysql-test/suite/innodb/r/innodb-zip.result innodbzip.result-20090610132748-q9m60aph2eqy8zr6-14
mysql-test/suite/innodb/t/innodb-zip.test innodbzip.test-20090610132748-q9m60aph2eqy8zr6-28
mysql-test/suite/innodb/t/innodb_information_schema.test innodb_information_s-20090610132748-q9m60aph2eqy8zr6-35
mysql-test/suite/parts/inc/partition_auto_increment.inc partition_auto_incre-20080902080504-smrqvl9x3yj3y30u-1
mysql-test/suite/parts/r/partition_auto_increment_innodb.result partition_auto_incre-20080902080538-cpp3r5wsg1iaf0hq-1
mysql-test/suite/parts/r/partition_auto_increment_maria.result partition_auto_incre-20081121141947-lh5ecnr2v4dkwli4-3
mysql-test/suite/parts/r/partition_auto_increment_memory.result partition_auto_incre-20080902130257-psqogw2uun5wtb8c-1
mysql-test/suite/parts/r/partition_auto_increment_myisam.result partition_auto_incre-20080902080538-cpp3r5wsg1iaf0hq-2
mysql-test/suite/parts/r/partition_auto_increment_ndb.result partition_auto_incre-20080902130251-otbifbb7638h2boy-3
mysql-test/suite/parts/r/partition_recover_myisam.result partition_repair_myi-20080609121315-mjya2e9ekn7bunzm-3
mysql-test/suite/parts/t/partition_auto_increment_archive.test partition_auto_incre-20080902130246-2kpijvsifmpe2sjo-1
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test partition_auto_incre-20080902130246-2kpijvsifmpe2sjo-2
mysql-test/suite/parts/t/partition_recover_myisam.test partition_repair_myi-20080609121315-mjya2e9ekn7bunzm-2
mysql-test/suite/pbxt/r/func_group.result func_group.result-20090402100035-4ilk9i91sh65vjcb-50
mysql-test/suite/pbxt/r/grant.result grant.result-20090402100035-4ilk9i91sh65vjcb-65
mysql-test/suite/pbxt/r/group_min_max.result group_min_max.result-20090402100035-4ilk9i91sh65vjcb-69
mysql-test/suite/pbxt/r/join_nested.result join_nested.result-20090402100035-4ilk9i91sh65vjcb-81
mysql-test/suite/pbxt/r/negation_elimination.result negation_elimination-20090402100035-4ilk9i91sh65vjcb-103
mysql-test/suite/pbxt/r/ps_grant.result ps_grant.result-20090402100035-4ilk9i91sh65vjcb-131
mysql-test/suite/pbxt/r/skip_grants.result skip_grants.result-20090402100035-4ilk9i91sh65vjcb-142
mysql-test/suite/pbxt/r/subselect.result subselect.result-20090402100035-4ilk9i91sh65vjcb-146
mysql-test/suite/pbxt/r/view_grant.result view_grant.result-20090402100035-4ilk9i91sh65vjcb-169
mysql-test/suite/pbxt/t/grant.test grant.test-20090402100035-4ilk9i91sh65vjcb-232
mysql-test/suite/pbxt/t/ps_grant.test ps_grant.test-20090402100035-4ilk9i91sh65vjcb-298
mysql-test/suite/pbxt/t/subselect.test subselect.test-20090402100035-4ilk9i91sh65vjcb-313
mysql-test/suite/rpl/r/rpl_auto_increment.result sp1f-rpl_auto_increment.r-20040915191013-ch23iwok7bzpqd7wtcsf4m6mt4txcr3o
mysql-test/suite/rpl/r/rpl_bug33931.result sp1f-rpl_bug33931.result-20080213120940-oicizd2vl3efcyhgeza6sjfbgw5j6ack
mysql-test/suite/rpl/r/rpl_do_grant.result sp1f-rpl_do_grant.result-20030802214618-dy6h6p3wwcdlud4mk6ivfxsgu5celg5t
mysql-test/suite/rpl/r/rpl_extraCol_innodb.result sp1f-rpl_extracol_innodb.-20061103140439-oyaqsdcl3ymjfl5y2wvwjz3cgb36dbj3
mysql-test/suite/rpl/r/rpl_extraCol_myisam.result sp1f-rpl_extracol_myisam.-20061103140439-ipxcnvlavhkichgny6fvkejbdgnvudtd
mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result rpl_get_master_versi-20090714012948-jn3dghe3lx2bda9a-1
mysql-test/suite/rpl/r/rpl_idempotency.result sp1f-rpl_idempotency.resu-20071030201714-gapul4f6owmfen7q2slybdwkvwtonjr4
mysql-test/suite/rpl/r/rpl_init_slave_errors.result rpl_bug38197.result-20090211115331-pkf48eusdtkxwt89-1
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result sp1f-rpl_innodb_mixed_dml-20070206122521-55gg47nv2ebmatncbhfe7ihcle7wzd6n
mysql-test/suite/rpl/r/rpl_loaddata.result sp1f-rpl_loaddata.result-20030114092724-fx5ivt6tn56aiwq4siqhlaxoyw5gha66
mysql-test/suite/rpl/r/rpl_loaddata_fatal.result sp1f-rpl_loaddata_fatal.r-20070609051931-4yb5joctyn3lsurioiijsyz4xb4r2sqj
mysql-test/suite/rpl/r/rpl_loaddata_map.result sp1f-rpl_loaddata_map.res-20071221203440-ccy2zkl5istm7qrpaydhz3lbzt355aie
mysql-test/suite/rpl/r/rpl_loaddatalocal.result sp1f-rpl_loaddatalocal.re-20030228202359-vlyqlboybbakyklqm2lhptrbwruhia2n
mysql-test/suite/rpl/r/rpl_log_pos.result sp1f-rpl000014.result-20001212220135-a5ffppjzfu3hlnpovghh4w3fdmgdmk6c
mysql-test/suite/rpl/r/rpl_packet.result sp1f-rpl_packet.result-20060911211902-zl764nrlzzu3kom3pf3rrm6eltxveylw
mysql-test/suite/rpl/r/rpl_row_create_table.result sp1f-rpl_row_create_table-20051222053452-uud3ktz3erqptqb64rkh7ftoo7bdbf6c
mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result sp1f-rpl_row_sp006_innodb-20051222053454-fadhobwa33eljoqv6iunh46xfx3f4gab
mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result rpl_slave_fail_load_-20090317104308-hlm8218eqojabbnb-1
mysql-test/suite/rpl/r/rpl_stm_log.result sp1f-rpl_log.result-20010621191923-r3yiuhrqrbautxnc66pw6bzlo6qp7sds
mysql-test/suite/rpl/r/rpl_temporary_errors.result sp1f-rpl_temporary_errors-20071020181608-xundxvrjaumpxwejukituoslcc42my7p
mysql-test/suite/rpl/t/disabled.def sp1f-disabled.def-20070627122758-vdqevwzhnizicdrxrmfy4w4afgprx46x
mysql-test/suite/rpl/t/rpl_bug33931.test sp1f-rpl_bug33931.test-20080213120940-zrvpqfftvysveivghh37d77gupwv6ryc
mysql-test/suite/rpl/t/rpl_do_grant.test sp1f-rpl_do_grant.test-20030802214619-wincvjltx3w7wntnmnquss36fcszy2wa
mysql-test/suite/rpl/t/rpl_drop_temp.test sp1f-rpl_drop_temp.test-20050214224649-nglnrerjic7a76wtis7mlhcr3nzxcioi
mysql-test/suite/rpl/t/rpl_err_ignoredtable.test sp1f-rpl_error_ignored_ta-20030708095933-nrriw3pbfsfrugbgvjpriczjb3dwm4mn
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test rpl_get_master_versi-20090714012921-gi0n2a3z1he17ht5-1
mysql-test/suite/rpl/t/rpl_idempotency.test sp1f-rpl_idempotency.test-20071030201714-dbiujbc2tp25eunlqd4msz66kri542ju
mysql-test/suite/rpl/t/rpl_init_slave_errors.test rpl_bug38197.test-20090211115331-pkf48eusdtkxwt89-2
mysql-test/suite/rpl/t/rpl_loaddatalocal.test sp1f-rpl_loaddatalocal.te-20030228202359-thkinry6nfontmohwt4ppxanoj2g2yfd
mysql-test/suite/rpl/t/rpl_log_pos.test sp1f-rpl000014.test-20001212220135-bejuuiqndvmgqdoni6j4db7qxhci65dg
mysql-test/suite/rpl/t/rpl_packet.test sp1f-rpl_packet.test-20060911211902-zxv62juvripcfcrseay32yorn6veiwfl
mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test rpl_slave_fail_load_-20090316155115-ydeyw4dljkuo6vf5-1
mysql-test/suite/rpl/t/rpl_temporary_errors.test sp1f-rpl_temporary_errors-20071020181608-od3xavonaky32wsy7gbvwomesyi5fiye
mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result sp1f-rpl_ndb_circular_sim-20070412065801-k2ky5wpm6vtdcj53bacwmwxhhj4ofcy2
mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result sp1f-rpl_ndb_extracol.res-20061103140449-ucihyswq7mtsamyjm2whggyjxyfekxeo
mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result sp1f-rpl_ndb_sp006.result-20060209212318-oue4xsmivduntdk47fzqt36ws5bbmhmq
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test sp1f-rpl_ndb_circular.tes-20070412141346-av6rslz2h32ovpuk3ppyehbg7dbsgcu4
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test sp1f-rpl_ndb_circular_sim-20070412065801-khbc7ydsapuk7454j2xfa54untsyzox5
mysql-test/t/almost_full.test sp1f-almost_full.test-20071112090021-ehngu75n2rqd6mngclfwfoxrj6ipxofo
mysql-test/t/alter_table.test sp1f-alter_table.test-20001228015635-ibytgjjpm4y57rzxqoascmr2hqujnjge
mysql-test/t/analyse.test sp1f-analyse.test-20001228015635-x364ynbakdxnjmftcf6js527huqaoipj
mysql-test/t/archive.test sp1f-archive.test-20040525194738-qla5yawytktcj3tlbgrlhvf3thbo6ghq
mysql-test/t/bug46080.test bug46080.test-20090710115544-bi718vttwzhdrezd-1
mysql-test/t/create.test sp1f-create.test-20001228015635-grq5cruh7q3juapcegeza6mshjkzsxzo
mysql-test/t/ctype_ldml.test sp1f-ctype_ldml.test-20070607125553-mqkp3r7v2bep7crb3ooj7q5qxx7m2257
mysql-test/t/ctype_uca.test sp1f-ctype_uca.test-20040614165527-nfbh56fowcrwgwtbyyi5nczcykzaya45
mysql-test/t/delete.test sp1f-delete.test-20001228015635-7lhk263y3s3wild7htgoaesssx5wdy4s
mysql-test/t/disabled.def sp1f-disabled.def-20050315184020-inpdp4hiogithilv62snllppjz2dcing
mysql-test/t/distinct.test sp1f-distinct.test-20001228015635-qewnmgwdqesya4ppb2fbev4mxjvlme2f
mysql-test/t/explain.test sp1f-explain.test-20001228015635-wk7l25cmz54vfufovxkip3auyxz2s36e
mysql-test/t/flush_read_lock_kill.test sp1f-flush_read_lock_kill-20041202220229-cx7dgk5hubrznmauw6vq6lnvahvcwew5
mysql-test/t/func_group.test sp1f-func_group.test-20001228015635-wkz277djccbddkitm63hibutxp7o4rb7
mysql-test/t/func_in.test sp1f-func_in.test-20001228015635-dykb2qebuowolk7cf6gpa4brezc4m5gk
mysql-test/t/func_str.test sp1f-strfunc.test-20001215085543-mqigcxue3chlbvewleghlo7v5ob5x6vj
mysql-test/t/gis-rtree.test sp1f-gisrtree.test-20030312125159-kg66qt2bmrgz7yscu55gymo7pqha5ra2
mysql-test/t/gis.test sp1f-gis.test-20030301091631-6xbsjkakono4hhavzhol5dhxlmcms4pj
mysql-test/t/grant3.test sp1f-grant3.test-20050322110327-afyko7s7c6kg2wqmwekxz7stzflyxe2s
mysql-test/t/information_schema.test sp1f-information_schema.t-20041113105545-lgutyhqnhpfgiswiwj2ykmjnolmsfq5h
mysql-test/t/information_schema_db.test sp1f-information_schema_d-20050506190606-kvrvmvgttlnqukdm6gfrtdntjs4tfjrm
mysql-test/t/innodb-autoinc.test innodbautoinc.test-20081201061010-zymrrwrczns2vrex-281
mysql-test/t/innodb-index.test innodbindex.test-20081201061010-zymrrwrczns2vrex-285
mysql-test/t/innodb.test innodb.test-20081201061010-zymrrwrczns2vrex-299
mysql-test/t/innodb_bug36169.test innodb_bug36169.test-20081201061010-zymrrwrczns2vrex-307
mysql-test/t/innodb_bug36172.test innodb_bug36172.test-20081203050234-edoolglm28lyejuc-10
mysql-test/t/innodb_bug39438.test innodb_bug39438.test-20081214202842-57uir9gc3v9g1pge-3
mysql-test/t/innodb_mysql.test sp1f-innodb_mysql.test-20060816102624-6ymo37d3nyhvbqyzqn5ohsfuydwo426k
mysql-test/t/insert_select.test sp1f-insert_select.test-20001228015636-zjrqdr7pnvxymgj7brilmnuk2ywuj5u4
mysql-test/t/join.test sp1f-join.test-20001228015636-punt3oq3irbqswtbrlkelkxape6lttnl
mysql-test/t/kill.test sp1f-kill.test-20010314060712-batcuefxmzrvmgnamk2ljdbhvztus52g
mysql-test/t/lowercase_fs_off.test sp1f-lowercase_fs_off.tes-20060504065504-i6dehorpaxhrhthhkdl7ioqcnzsktaqa
mysql-test/t/lowercase_table3.test sp1f-lowercase_table3.tes-20040306084333-hnvnsyhtqiysn2fmfz3zkqfjy3mivo4d
mysql-test/t/myisam-system.test sp1f-myisamsystem.test-20060503125913-ozpyqynhhwo5iiwxdgyt7iljauvr2obd
mysql-test/t/myisam.test sp1f-myisam.test-20010411215653-cdmhjqbeu3xtipkauwbbirystludnac3
mysql-test/t/myisam_crash_before_flush_keys.test myisam_crash_before_-20090402094436-q8pxw24lav2lpjzk-1
mysql-test/t/mysqlbinlog.test sp1f-mysqlbinlog.test-20030924192555-wsghaldjdiuxo36sss7fu2urp47axjk7
mysql-test/t/mysqltest.test sp1f-mysqltest.test-20041022024800-v3hvkzs4236l6rpunai7xttdltot7rvz
mysql-test/t/named_pipe.test sp1f-named_pipe.test-20070924104241-daakp7etk2k4hxuzofbxrgkdkzcwmw2a
mysql-test/t/not_partition.test sp1f-not_partition.test-20061026171106-weuf2mmixpkzlidd3r3j4yme2whe35rj
mysql-test/t/olap.test sp1f-olap.test-20020720115151-u3y5qjyyz4c7hufu5vftj74rijkr7rf2
mysql-test/t/order_by.test sp1f-order_by.test-20001228015636-nr7aml75ra7mdlruhoqo5dgbfv5tcesc
mysql-test/t/partition.test sp1f-partition.test-20050718113034-pbo3ht3bf4gfa3mz44on3sqafyctwo35
mysql-test/t/partition_csv.test sp1f-partition_csv.test-20071022181049-u2nodruhqzkicgs2isvjxv5xfkj3q5hc
mysql-test/t/partition_innodb.test sp1f-partition_innodb.tes-20060518171642-twfw23mpackjkfvorfvay4dhvjxhtbfm
mysql-test/t/plugin.test sp1f-plugin.test-20061214230953-rdqkovjzpupoeypjzzvefseahkmrdz4f
mysql-test/t/plugin_load.test sp1f-plugin_load.test-20080126000459-32quuvob6bm45mqub6nydrb66zhyumvz
mysql-test/t/ps_not_windows.test sp1f-ps_not_windows.test-20061117214908-5zcao5tiy3glx2i3aqg2sn4koijafp6u
mysql-test/t/query_cache.test sp1f-query_cache.test-20011205230530-yfwho76ujeasygr3magwlmssnvwsukio
mysql-test/t/range.test sp1f-range.test-20001228015636-xfak6bsaw5p3ek36np7bznadjb3boh2q
mysql-test/t/select.test sp1f-select.test-20010103001548-tbl2ff7qehzh43qnsmf4ejhjqe66f46n
mysql-test/t/sp-error.test sp1f-sperror.test-20030305184512-aipdocqcicc6rgsz672mr32qowtm5ceb
mysql-test/t/sp.test sp1f-sp.test-20030117133803-b6pcfv2yscbqkur5fszep7acmdg7nf5k
mysql-test/t/subselect.test sp1f-subselect.test-20020512204640-lyqrayx6uwsn7zih6y7kerkenuitzbvr
mysql-test/t/subselect3.test sp1f-subselect3.test-20061031174245-pcxt5ljylerxhx2jkfhrbqfv5vqcazlz
mysql-test/t/type_bit.test sp1f-type_bit.test-20041217140559-tzpygypzmjyjiukpq75swmn6zq4ytqe4
mysql-test/t/type_newdecimal.test sp1f-type_newdecimal.test-20050208224936-e244l5ugrk3oditjqp53n6izptkrteq2
mysql-test/t/udf.test sp1f-udf.test-20060215161120-inrv7ph3327gnzcvcqk25vmihneybyhk
mysql-test/t/update.test sp1f-update.test-20001228015637-63zlejfzul4bql7vagkgrfew3bn7qdhq
mysql-test/t/upgrade.test sp1f-upgrade.test-20060217091845-b2j6eahffx256stwqu5aki5p55sq2bz3
mysql-test/t/view_grant.test sp1f-view_grant.test-20050404194355-y5ik7soywcms7xriyzo72dooviahc7cx
mysql-test/t/warnings.test sp1f-warnings.test-20001228015637-zfi7dd3hclrgbgbjruiknua2ytqtagx4
mysql-test/t/windows.test sp1f-windows.test-20050901013213-brlrkwlhdfgrngb2t563kyzyenq6gls2
mysql-test/t/xa.test sp1f-xa.test-20050403224954-lwrpyxgzlsnvmlzqdkoeuxg62yhkyecp
mysql-test/valgrind.supp sp1f-valgrind.supp-20050406142216-yg7xhezklqhgqlc3inx36vbghodhbovy
mysys/CMakeLists.txt sp1f-cmakelists.txt-20060831175237-shgpjtu5x7rmyswxjiriviagwnm5kvpd
mysys/Makefile.am sp1f-makefile.am-19700101030959-36zaboyabq4ooqfc2jpion3pic7yhpgb
mysys/charset-def.c sp1f-charsetdef.c-20031006195631-2zdalecmihnwhbxa6t6z67yy7avh5zgj
mysys/errors.c sp1f-errors.c-19700101030959-xfxez7oem4mhljuj3yhmevl3vohnvgh3
mysys/hash.c sp1f-hash.c-19700101030959-ny373x26eb7225kqbdbb7l23bjwr6pun
mysys/lf_hash.c sp1f-lf_hash.c-20060802110035-r7bxwavbhraiyl2mnakqg4fj6dkhs2bi
mysys/mf_keycache.c sp1f-mf_keycache.c-19700101030959-wtigyxt4n6zscc6ezr56wziqguyc5bds
mysys/my_copy.c sp1f-my_copy.c-19700101030959-jt6k3uijhnzawhndg4d4ocqbucojvwve
mysys/my_getopt.c sp1f-my_getopt.c-20020125212008-5ppwsdqmfhny46gxkjxph22zh3phetir
mysys/my_largepage.c sp1f-my_largepage.c-20041214192504-4n2x3wmc6b43qlmnfmpmjlxvtke7lrcz
mysys/my_redel.c sp1f-my_redel.c-19700101030959-ki322j4p74mpkdbdsettqo2bh2y2ln2g
mysys/my_seek.c sp1f-my_seek.c-19700101030959-ud6rvcvrfr5z3bkv2uapwxioynoau3pv
mysys/my_static.c sp1f-my_static.c-19700101030959-vmmfiyygpz2awmm7d3pguy4rsuugbhcs
mysys/my_thr_init.c sp1f-my_thr_init.c-19700101030959-siwg2eavxsdwdc4kkmwxvs42rp6ntkrm
mysys/my_wincond.c sp1f-my_wincond.c-19700101030959-qdv7yylq5t4imwxjnjub6dyqcq3wqwow
mysys/thr_lock.c sp1f-thr_lock.c-19700101030959-igvxgo25qd7i2moc4pgo5eoth3xp34mh
mysys/thr_mutex.c sp1f-thr_mutex.c-19700101030959-ukbiyuwnq6i24hphqxuabckaeqaffe4p
mysys/tree.c sp1f-tree.c-19700101030959-febyd36tcwqmhiyrrcuaqate66xykgg3
mysys/typelib.c sp1f-typelib.c-19700101030959-yks6u7xso4ru4dpd6v7uq7ynmxg6wsgt
plugin/fulltext/plugin_example.c sp1f-plugin_example.c-20051228120521-okmw6cytrbhx3kpxsuswy6v7agqdiaik
regex/CMakeLists.txt sp1f-cmakelists.txt-20060831175237-6kmn7fqqj7jzzviead26v47chae5xab3
regex/engine.c sp1f-engine.c-19700101030959-ot7oocwwykoohvrrlnq6jcjy5gqp4hbe
regex/engine.ih sp1f-engine.ih-19700101030959-kktic6x6t5cuk5tpi7skcvt4cxs2im2m
scripts/fill_help_tables.sql sp1f-fill_help_tables.sql-20050413141357-uj2k2dquxn5t7vqrggtap5xrxnotzrts
scripts/make_win_bin_dist sp1f-make_win_bin_dist-20060901123056-xnusgszvkfrrcxkqidb7zszax2ezpyto
scripts/mysql_system_tables.sql sp1f-mysql_system_tables.-20070226104923-4n5a67fuifobcyhhicfbacpsv5npohgv
scripts/mysql_system_tables_fix.sql sp1f-mysql_fix_privilege_-20030604152848-cz6lnrig5srcrvkt7d5m35bk3wsz4bdc
sql-common/client.c sp1f-client.c-20030502160736-oraaciqy6jkfwygs6tqfoaxgjbi65yo7
sql-common/my_time.c sp1f-my_time.c-20040624160839-c5ljhxyjpi5czybdscnldwjexwdyx3o6
sql/CMakeLists.txt sp1f-cmakelists.txt-20060831175237-esoeu5kpdtwjvehkghwy6fzbleniq2wy
sql/Makefile.am sp1f-makefile.am-19700101030959-xsjdiakci3nqcdd4xl4yomwdl5eo2f3q
sql/event_data_objects.cc sp1f-event_timed.cc-20051205104456-ckd2gzuwhr4u5umqbncmt43nvv45pxmf
sql/events.cc sp1f-event.cc-20051202122200-as66hughd4bhrhu2uqbb6mpogou2yihk
sql/field.cc sp1f-field.cc-19700101030959-f4imaofclsea3n4fj4ow5m7havmyxa2r
sql/field.h sp1f-field.h-19700101030959-3n6smzxcwkjl7bikm3wg4hfkjn66uvvp
sql/ha_ndbcluster.cc sp1f-ha_ndbcluster.cc-20040414175836-rvqnoxrkqexyhfu3d62s4t345ip7rez2
sql/ha_ndbcluster_binlog.cc sp1f-ha_ndbcluster_binlog-20060112185048-3hthowbxyrrly3srxavlrufjf5mmgqm6
sql/ha_partition.cc sp1f-ha_partition.cc-20050718113037-eoky4qluumb5dmdyg5z6n2fvdkgutxms
sql/ha_partition.h sp1f-ha_partition.h-20050718113038-4xxwqkuu2xgxqtrwfbc43zgfyfcwzjsq
sql/handler.cc sp1f-handler.cc-19700101030959-ta6zfrlbxzucylciyro3musjsdpocrdh
sql/handler.h sp1f-handler.h-19700101030959-mumq2hpilkpgxuf22ftyv5kbilysnzvn
sql/item.cc sp1f-item.cc-19700101030959-u7hxqopwpfly4kf5ctlyk2dvrq4l3dhn
sql/item.h sp1f-item.h-19700101030959-rrkb43htudd62batmoteashkebcwykpa
sql/item_cmpfunc.cc sp1f-item_cmpfunc.cc-19700101030959-hrk7pi2n6qpwxauufnkizirsoucdcx2e
sql/item_cmpfunc.h sp1f-item_cmpfunc.h-19700101030959-pcvbjplo4e4ng7ibynfhcd6pjyem57gr
sql/item_func.cc sp1f-item_func.cc-19700101030959-3wmsx76yvc25sroqpfrx2n77kqdxxn3y
sql/item_func.h sp1f-item_func.h-19700101030959-fbjcbwkg66qubbzptqwh5w5evhnpukze
sql/item_geofunc.cc sp1f-item_geofunc.cc-20030530102226-vdbf2bd6tpkrzoy6q2wdibkzd3bkv2io
sql/item_strfunc.cc sp1f-item_strfunc.cc-19700101030959-yl2pwnrngmla3nmlgiuiwrztx3iu4ffl
sql/item_subselect.cc sp1f-item_subselect.cc-20020512204640-qep43aqhsfrwkqmrobni6czc3fqj36oo
sql/item_sum.cc sp1f-item_sum.cc-19700101030959-4woo23bi3am2t2zvsddqbpxk7xbttdkm
sql/item_timefunc.cc sp1f-item_timefunc.cc-19700101030959-rvvlgmw5b4ewpuuxuntrkiqimyrr5sw2
sql/item_xmlfunc.cc sp1f-item_xmlfunc.cc-20051221130500-wo5dgojvjjm6mmra7fay3ri7ud5ow3yl
sql/log.cc sp1f-log.cc-19700101030959-r3hdfovek4kl6nd64ovoaknmirota6bq
sql/log_event.cc sp1f-log_event.cc-19700101030959-msmqlflsngxosswid2hpzxly5vfqdddc
sql/log_event.h sp1f-log_event.h-19700101030959-clq6ett55tcqbpys2i4cpfrdccq7j4om
sql/log_event_old.cc sp1f-log_event_old.cc-20070412135046-uu5xq4cnpwslzif6fbmj3g65x4vdkzxu
sql/my_decimal.h sp1f-my_decimal.h-20050208224937-z6shzy3pf5uyso4mvtc2f6pckjzfeg5f
sql/mysql_priv.h sp1f-mysql_priv.h-19700101030959-4fl65tqpop5zfgxaxkqotu2fa2ree5ci
sql/mysqld.cc sp1f-mysqld.cc-19700101030959-zpswdvekpvixxzxf7gdtofzel7nywtfj
sql/opt_range.cc sp1f-opt_range.cc-19700101030959-afe3wtevb7zwrg4xyibt35uamov5r7ds
sql/opt_sum.cc sp1f-opt_sum.cc-19700101030959-ygmsylwaxwx3wf77i2nv2hdupycvexro
sql/partition_info.cc sp1f-partition_info.cpp-20060216163637-eco35bnz46tcywduzmpjofzudmzlgyog
sql/records.cc sp1f-records.cc-19700101030959-xg6elqzdqhvrmobazxrjajmiyqxf7lx7
sql/repl_failsafe.cc sp1f-repl_failsafe.cc-20011010025623-k7zhoyc3smc7tbliyp7vaf3f4idq22so
sql/rpl_filter.cc sp1f-table_filter.cc-20050308201116-4anzb26smj76r56ihkpxzbtnzlzatr2k
sql/scheduler.cc sp1f-scheduler.cc-20070223111352-qwtxm54kmlec25urietuqte6v76hjp4b
sql/set_var.cc sp1f-set_var.cc-20020723153119-nwbpg2pwpz55pfw7yfzaxt7hsszzy7y3
sql/set_var.h sp1f-set_var.h-20020723153119-2yomygq3s4xjbqvuue3cdlpbjtj3kwmk
sql/share/errmsg.txt sp1f-errmsg.txt-20041213212820-do5w642w224ja7ctyqhyl6iihdmpkzv5
sql/slave.cc sp1f-slave.cc-19700101030959-a636aj3mjxgu7fnznrg5kt77p3u2bvhh
sql/slave.h sp1f-slave.h-20001111215010-k3xq56z2cul6s766om7zrdsnlwdc23y5
sql/sp.cc sp1f-sp.cc-20021212121421-6xwuvxq5bku2b4yv655kp2e5gsvautd5
sql/sp_head.cc sp1f-sp_head.cc-20021208185920-jtgc5wvyqdnu2gvcdus3gazrfhxbofxd
sql/sql_acl.cc sp1f-sql_acl.cc-19700101030959-c4hku3uqxzujthqnndeprbrhamqy6a4i
sql/sql_base.cc sp1f-sql_base.cc-19700101030959-w7tul2gb2n4jzayjwlslj3ybmf3uhk6a
sql/sql_binlog.cc sp1f-sql_binlog.cc-20051222053449-o6vkdfrjkuledkjdwz2jx3zykz4izfsz
sql/sql_builtin.cc.in sp1f-sql_builtin.cc.in-20060413204924-2uqxqmqkyuh3wtmodadlo23ag3lchfp6
sql/sql_cache.cc sp1f-sql_cache.cc-19700101030959-74bsqwcnhboovijsogcenqana5inu6wo
sql/sql_class.cc sp1f-sql_class.cc-19700101030959-rpotnweaff2pikkozh3butrf7mv3oero
sql/sql_class.h sp1f-sql_class.h-19700101030959-jnqnbrjyqsvgncsibnumsmg3lyi7pa5s
sql/sql_db.cc sp1f-sql_db.cc-19700101030959-hyw6zjuisjyda5cj5746a2zzuzz5yibr
sql/sql_delete.cc sp1f-sql_delete.cc-19700101030959-ch2a6r6ushvc2vfwxt7ehcjuplelwthr
sql/sql_handler.cc sp1f-sql_handler.cc-20010406221833-l4tsiortoyipmoyajcoz2tcdppvyeltl
sql/sql_insert.cc sp1f-sql_insert.cc-19700101030959-xgwqe5svnimxudzdcuitauljzz2zjk5g
sql/sql_lex.h sp1f-sql_lex.h-19700101030959-sgldb2sooc7twtw5q7pgjx7qzqiaa3sn
sql/sql_load.cc sp1f-sql_load.cc-19700101030959-hoqlay5we4yslrw23xqedulkejw6a3o5
sql/sql_locale.cc sp1f-sql_locale.cc-20060704124016-q5yfdbfinszhklmgyjf4kmnepgd4biai
sql/sql_parse.cc sp1f-sql_parse.cc-19700101030959-ehcre3rwhv5l3mlxqhaxg36ujenxnrcd
sql/sql_partition.cc sp1f-sql_partition.cc-20050718113038-57h5bzswps6cel2y7k7qideue3ghbg3u
sql/sql_plugin.cc sp1f-sql_plugin.cc-20051105112032-hrm64p6xfjq33ud6zy3uivpo7azm75a2
sql/sql_prepare.cc sp1f-sql_prepare.cc-20020612210720-gtqjjiu7vpmfxb5xct2qke7urmqcabli
sql/sql_rename.cc sp1f-sql_rename.cc-20000821000147-ltbepgfv52umnrkaxzycedl5p2tlr3fp
sql/sql_repl.cc sp1f-sql_repl.cc-20001002032713-xqbns5ofqsaebhgi2ypcfn7nhz7nh5rp
sql/sql_select.cc sp1f-sql_select.cc-19700101030959-egb7whpkh76zzvikycs5nsnuviu4fdlb
sql/sql_select.h sp1f-sql_select.h-19700101030959-oqegfxr76xlgmrzd6qlevonoibfnwzoz
sql/sql_show.cc sp1f-sql_show.cc-19700101030959-umlljfnpplg452h7reeyqr4xnbmlkvfj
sql/sql_table.cc sp1f-sql_table.cc-19700101030959-tzdkvgigezpuaxnldqh3fx2h7h2ggslu
sql/sql_tablespace.cc sp1f-sql_tablespace.cc-20060111103519-oyr2sz233kphdr5xpru4mqwtac2mt4uf
sql/sql_trigger.cc sp1f-sql_trigger.cc-20040907122911-35k3wamrp6g7qsupxe7hisftpobcwin5
sql/sql_udf.cc sp1f-sql_udf.cc-19700101030959-tk7ysmv4dpwkfhtdovfbqe5i6uvq67ft
sql/sql_update.cc sp1f-sql_update.cc-19700101030959-edlgskfuer2ylczbw2znrr5gzfefiyw7
sql/sql_view.cc sp1f-sql_view.cc-20040715221517-nw4p4mja6nzzlvwwhzfgfqb4umxqobe4
sql/sql_yacc.yy sp1f-sql_yacc.yy-19700101030959-wvn4qyy2drpmge7kaq3dysprbhlrv27j
sql/structs.h sp1f-structs.h-19700101030959-dqulhwijezc2pwv2x4g32qdggnybj2nc
sql/table.cc sp1f-table.cc-19700101030959-nsxtem2adyqzwe6nz4cgrpcmts3o54v7
sql/table.h sp1f-table.h-19700101030959-dv72bajftxj5fbdjuajquappanuv2ija
sql/time.cc sp1f-time.cc-19700101030959-vhvl5k35iuojsrxbsg62xysptyi4pc64
sql/udf_example.c sp1f-udf_example.cc-19700101030959-ze6kwdimrvfxkxofoegzwby3qce75brj
sql/unireg.cc sp1f-unireg.cc-19700101030959-6a4wymwak6cmvk25gch56ctjvadrhu3v
storage/archive/ha_archive.cc sp1f-ha_archive.cc-20040521001938-uy57z43drkjeirpjafdzdpvfxruqho4q
storage/blackhole/ha_blackhole.cc sp1f-ha_blackhole.cc-20050323001036-ikllt6ts2equ6w4aru2q3rhdbrn64twz
storage/csv/ha_tina.cc sp1f-ha_tina.cc-20040813035429-5pwcme2ehkkuei6gu6ueo4tfldeeyw7l
storage/federatedx/Makefile.am makefile.am-20091029224633-m824ql737a2j6q5a-9
storage/federatedx/ha_federatedx.cc ha_federatedx.cc-20091029224633-m824ql737a2j6q5a-6
storage/heap/hp_write.c sp1f-hp_write.c-19700101030959-fyft5higet4kliqpr6vywernwiypjfzr
storage/innobase/dict/dict0dict.c sp1f-dict0dict.c-20010217121859-dhmp6wllhccos4vvwyuqz5dmuctjxgmm
storage/innobase/handler/ha_innodb.cc sp1f-ha_innobase.cc-20001205235417-rlet3ei56gdrss673dssnrqgug67lwno
storage/innobase/handler/ha_innodb.h sp1f-ha_innobase.h-20001205235417-hami5r4niirc73bybnkeudrtmaqghhlk
storage/innobase/os/os0proc.c sp1f-os0proc.c-20010217121911-iociah67deec5bczgjf6gr33stj75df2
storage/innobase/row/row0mysql.c sp1f-row0mysql.c-20010217121914-f6pdtzldiainoq3xyil2uwziayos4irm
storage/innodb_plugin/CMakeLists.txt cmakelists.txt-20090527093836-7v4wb2xxka10h4d0-2
storage/innodb_plugin/ChangeLog changelog-20090527093836-7v4wb2xxka10h4d0-4
storage/innodb_plugin/Makefile.am makefile.am-20090527093836-7v4wb2xxka10h4d0-5
storage/innodb_plugin/btr/btr0btr.c btr0btr.c-20090527093836-7v4wb2xxka10h4d0-46
storage/innodb_plugin/btr/btr0sea.c btr0sea.c-20090527093836-7v4wb2xxka10h4d0-49
storage/innodb_plugin/buf/buf0buf.c buf0buf.c-20090527093836-7v4wb2xxka10h4d0-51
storage/innodb_plugin/buf/buf0flu.c buf0flu.c-20090527093836-7v4wb2xxka10h4d0-52
storage/innodb_plugin/buf/buf0lru.c buf0lru.c-20090527093836-7v4wb2xxka10h4d0-53
storage/innodb_plugin/buf/buf0rea.c buf0rea.c-20090527093836-7v4wb2xxka10h4d0-54
storage/innodb_plugin/dict/dict0crea.c dict0crea.c-20090527093836-7v4wb2xxka10h4d0-58
storage/innodb_plugin/dict/dict0dict.c dict0dict.c-20090527093836-7v4wb2xxka10h4d0-59
storage/innodb_plugin/fil/fil0fil.c fil0fil.c-20090527093836-7v4wb2xxka10h4d0-65
storage/innodb_plugin/fsp/fsp0fsp.c fsp0fsp.c-20090527093836-7v4wb2xxka10h4d0-66
storage/innodb_plugin/handler/ha_innodb.cc ha_innodb.cc-20090527093836-7v4wb2xxka10h4d0-72
storage/innodb_plugin/handler/ha_innodb.h ha_innodb.h-20090527093836-7v4wb2xxka10h4d0-73
storage/innodb_plugin/handler/handler0alter.cc handler0alter.cc-20090527093836-7v4wb2xxka10h4d0-74
storage/innodb_plugin/include/buf0buf.h buf0buf.h-20090527093836-7v4wb2xxka10h4d0-92
storage/innodb_plugin/include/buf0buf.ic buf0buf.ic-20090527093836-7v4wb2xxka10h4d0-93
storage/innodb_plugin/include/buf0lru.h buf0lru.h-20090527093836-7v4wb2xxka10h4d0-96
storage/innodb_plugin/include/buf0rea.h buf0rea.h-20090527093836-7v4wb2xxka10h4d0-98
storage/innodb_plugin/include/buf0types.h buf0types.h-20090527093836-7v4wb2xxka10h4d0-99
storage/innodb_plugin/include/dict0crea.h dict0crea.h-20090527093836-7v4wb2xxka10h4d0-108
storage/innodb_plugin/include/dict0dict.h dict0dict.h-20090527093836-7v4wb2xxka10h4d0-110
storage/innodb_plugin/include/dict0mem.h dict0mem.h-20090527093836-7v4wb2xxka10h4d0-114
storage/innodb_plugin/include/fsp0fsp.h fsp0fsp.h-20090527093836-7v4wb2xxka10h4d0-124
storage/innodb_plugin/include/lock0lock.h lock0lock.h-20090527093836-7v4wb2xxka10h4d0-142
storage/innodb_plugin/include/log0log.h log0log.h-20090527093836-7v4wb2xxka10h4d0-147
storage/innodb_plugin/include/log0log.ic log0log.ic-20090527093836-7v4wb2xxka10h4d0-148
storage/innodb_plugin/include/log0recv.h log0recv.h-20090527093836-7v4wb2xxka10h4d0-149
storage/innodb_plugin/include/mtr0mtr.h mtr0mtr.h-20090527093836-7v4wb2xxka10h4d0-161
storage/innodb_plugin/include/os0file.h os0file.h-20090527093836-7v4wb2xxka10h4d0-165
storage/innodb_plugin/include/os0sync.h os0sync.h-20090527093836-7v4wb2xxka10h4d0-168
storage/innodb_plugin/include/page0page.h page0page.h-20090527093836-7v4wb2xxka10h4d0-174
storage/innodb_plugin/include/page0page.ic page0page.ic-20090527093836-7v4wb2xxka10h4d0-175
storage/innodb_plugin/include/page0zip.h page0zip.h-20090527093836-7v4wb2xxka10h4d0-177
storage/innodb_plugin/include/rem0cmp.h rem0cmp.h-20090527093836-7v4wb2xxka10h4d0-193
storage/innodb_plugin/include/rem0rec.ic rem0rec.ic-20090527093836-7v4wb2xxka10h4d0-196
storage/innodb_plugin/include/row0ins.h row0ins.h-20090527093836-7v4wb2xxka10h4d0-200
storage/innodb_plugin/include/row0mysql.h row0mysql.h-20090527093836-7v4wb2xxka10h4d0-203
storage/innodb_plugin/include/srv0srv.h srv0srv.h-20090527093836-7v4wb2xxka10h4d0-223
storage/innodb_plugin/include/trx0rec.h trx0rec.h-20090527093836-7v4wb2xxka10h4d0-238
storage/innodb_plugin/include/trx0rec.ic trx0rec.ic-20090527093836-7v4wb2xxka10h4d0-239
storage/innodb_plugin/include/trx0roll.h trx0roll.h-20090527093836-7v4wb2xxka10h4d0-240
storage/innodb_plugin/include/trx0sys.ic trx0sys.ic-20090527093836-7v4wb2xxka10h4d0-245
storage/innodb_plugin/include/trx0trx.h trx0trx.h-20090527093836-7v4wb2xxka10h4d0-246
storage/innodb_plugin/include/univ.i univ.i-20090527093836-7v4wb2xxka10h4d0-252
storage/innodb_plugin/include/ut0auxconf.h ut0auxconf.h-20090527093836-7v4wb2xxka10h4d0-256
storage/innodb_plugin/include/ut0byte.h ut0byte.h-20090527093836-7v4wb2xxka10h4d0-257
storage/innodb_plugin/include/ut0byte.ic ut0byte.ic-20090527093836-7v4wb2xxka10h4d0-258
storage/innodb_plugin/include/ut0ut.h ut0ut.h-20090527093836-7v4wb2xxka10h4d0-268
storage/innodb_plugin/lock/lock0lock.c lock0lock.c-20090527093836-7v4wb2xxka10h4d0-274
storage/innodb_plugin/log/log0log.c log0log.c-20090527093836-7v4wb2xxka10h4d0-275
storage/innodb_plugin/log/log0recv.c log0recv.c-20090527093836-7v4wb2xxka10h4d0-276
storage/innodb_plugin/mem/mem0mem.c mem0mem.c-20090527093836-7v4wb2xxka10h4d0-279
storage/innodb_plugin/mtr/mtr0mtr.c mtr0mtr.c-20090527093836-7v4wb2xxka10h4d0-282
storage/innodb_plugin/mysql-test/innodb-analyze.test innodbanalyze.test-20090527093836-7v4wb2xxka10h4d0-286
storage/innodb_plugin/mysql-test/innodb-zip.result innodbzip.result-20090527093836-7v4wb2xxka10h4d0-307
storage/innodb_plugin/mysql-test/innodb-zip.test innodbzip.test-20090527093836-7v4wb2xxka10h4d0-308
storage/innodb_plugin/mysql-test/innodb_bug34300.test innodb_bug34300.test-20090527093836-7v4wb2xxka10h4d0-314
storage/innodb_plugin/mysql-test/innodb_bug36169.test innodb_bug36169.test-20090527093836-7v4wb2xxka10h4d0-318
storage/innodb_plugin/mysql-test/innodb_bug36172.test innodb_bug36172.test-20090527093836-7v4wb2xxka10h4d0-320
storage/innodb_plugin/mysql-test/innodb_file_format.result innodb_file_format.r-20090730103340-a7df5hza0ep3xo6j-7
storage/innodb_plugin/mysql-test/innodb_file_format.test innodb_file_format.t-20090730103340-a7df5hza0ep3xo6j-8
storage/innodb_plugin/os/os0file.c os0file.c-20090527093836-7v4wb2xxka10h4d0-338
storage/innodb_plugin/os/os0proc.c os0proc.c-20090527093836-7v4wb2xxka10h4d0-339
storage/innodb_plugin/page/page0cur.c page0cur.c-20090527093836-7v4wb2xxka10h4d0-342
storage/innodb_plugin/page/page0page.c page0page.c-20090527093836-7v4wb2xxka10h4d0-343
storage/innodb_plugin/page/page0zip.c page0zip.c-20090527093836-7v4wb2xxka10h4d0-344
storage/innodb_plugin/plug.in.disabled plug.in-20090527093836-7v4wb2xxka10h4d0-32
storage/innodb_plugin/rem/rem0cmp.c rem0cmp.c-20090527093836-7v4wb2xxka10h4d0-356
storage/innodb_plugin/row/row0ins.c row0ins.c-20090527093836-7v4wb2xxka10h4d0-359
storage/innodb_plugin/row/row0merge.c row0merge.c-20090527093836-7v4wb2xxka10h4d0-360
storage/innodb_plugin/row/row0mysql.c row0mysql.c-20090527093836-7v4wb2xxka10h4d0-361
storage/innodb_plugin/srv/srv0srv.c srv0srv.c-20090527093836-7v4wb2xxka10h4d0-373
storage/innodb_plugin/srv/srv0start.c srv0start.c-20090527093836-7v4wb2xxka10h4d0-374
storage/innodb_plugin/sync/sync0rw.c sync0rw.c-20090527093836-7v4wb2xxka10h4d0-376
storage/innodb_plugin/sync/sync0sync.c sync0sync.c-20090527093836-7v4wb2xxka10h4d0-377
storage/innodb_plugin/thr/thr0loc.c thr0loc.c-20090527093836-7v4wb2xxka10h4d0-378
storage/innodb_plugin/trx/trx0rec.c trx0rec.c-20090527093836-7v4wb2xxka10h4d0-381
storage/innodb_plugin/trx/trx0roll.c trx0roll.c-20090527093836-7v4wb2xxka10h4d0-382
storage/innodb_plugin/trx/trx0trx.c trx0trx.c-20090527093836-7v4wb2xxka10h4d0-385
storage/innodb_plugin/ut/ut0auxconf_atomic_pthread_t_solaris.c ut0auxconf_atomic_pt-20090527093836-7v4wb2xxka10h4d0-389
storage/innodb_plugin/ut/ut0ut.c ut0ut.c-20090527093836-7v4wb2xxka10h4d0-397
storage/maria/ha_maria.cc sp1f-ha_maria.cc-20060411134405-dmngb4v5x5fxlxhff527ud3etiutxuxk
storage/maria/lockman.c sp1f-lockman.c-20061011145721-yvoyfytlt3pai3ojxszlkm7aoskod2k7
storage/maria/ma_check.c sp1f-ma_check.c-20060411134408-m5d5jao4sr32xsjjkig2uhdndqm5cgba
storage/maria/ma_check_standalone.h sp1f-ma_check_standalone.-20071003161031-zy6jbpaapkfiopgjilyz6crfhjcyqqwq
storage/maria/ma_ft_boolean_search.c sp1f-ma_ft_boolean_search-20060411134414-l4bscelblvehls4cor5iwq3lbxkj4zwx
storage/maria/ma_ft_nlq_search.c sp1f-ma_ft_nlq_search.c-20060411134416-6huckpmebrw3u4tbi3z7hva6ghbomxzz
storage/maria/ma_ft_parser.c sp1f-ma_ft_parser.c-20060411134416-kws2xhd3kaxxjif2sauw4k5gztutzjye
storage/maria/ma_ftdefs.h sp1f-ma_ftdefs.h-20060411134419-oqk6vygfkih4joszmxt5mgy46rv2fizk
storage/maria/ma_sort.c sp1f-ma_sort.c-20060411134442-cgxklkm2tqazbdc57w5xhs3qxbdcjpmh
storage/maria/ma_state.c sp1f-ma_state.c-20080529153331-ttwxiq5ksyib6sdrdsdl2lnbbm362lwh
storage/maria/maria_def.h sp1f-maria_def.h-20060411134454-urdx4joxwcwzxbmltpzejn53y2rgjs44
storage/maria/maria_ftdump.c sp1f-maria_ftdump.c-20060411134454-xw7hmkx3ryphoh7mqirrxbrnvcewp5yj
storage/maria/trnman.c sp1f-trxman.c-20060816182810-j2a3jdxiefkpc62ad3xtioi44dbmr3dv
storage/myisam/ft_boolean_search.c sp1f-ft_boolean_search.c-20010411110351-pu6lfsyiumvnnewko2oqbyjz6g3q4xm3
storage/myisam/ft_nlq_search.c sp1f-ft_nlq_search.c-20010411110351-a7dhoojgfpsydi5k4qawswaatmakqe7b
storage/myisam/ft_parser.c sp1f-ft_parser.c-19700101030959-goim35zn24ujo7rbznobwhhw5r3lemab
storage/myisam/ft_stopwords.c sp1f-ft_stopwords.c-19700101030959-vgask5ebyzpaoa7j37ybfnjhx4rkzm63
storage/myisam/ftdefs.h sp1f-ftdefs.h-19700101030959-c5sgpgnpbutzv5fvbe6a63x6up2niz2p
storage/myisam/ha_myisam.cc sp1f-ha_myisam.cc-19700101030959-7xzssylbn7zfz3nupnsw43wws6xlltsu
storage/myisam/mi_check.c sp1f-mi_check.c-19700101030959-yzbhnjgzcmqdyj4zz5codhkkw5eedp6f
storage/myisam/mi_search.c sp1f-mi_search.c-19700101030959-kdl3zf7h3booyy7xyrnnoejouhznu4cs
storage/myisam/mi_write.c sp1f-mi_write.c-19700101030959-l47ss6e3phtvbf4dlpzjkleglspv72ef
storage/myisam/myisam_ftdump.c sp1f-ft_dump.c-20010411110351-jbiwe2tgwwoql6m5wgmorbnd5fydlehw
storage/myisam/myisamchk.c sp1f-myisamchk.c-19700101030959-hdnrqowbdb3ujo3qgjtzs6lgogwckvgc
storage/myisam/myisamdef.h sp1f-myisamdef.h-19700101030959-fzrxvpmzhzqfn5w2clasmcw7af4kanoa
storage/myisam/myisamlog.c sp1f-myisamlog.c-19700101030959-curz5f2h5crvlm6bfj5a5el6y4pad2ul
storage/myisam/sort.c sp1f-sort.c-19700101030959-n36775hcenftishba6lu6m7qtninzzgb
storage/myisammrg/myrg_open.c sp1f-myrg_open.c-19700101030959-vmszttys66wqrvmecn2q3yr57pnxhjox
storage/mysql_storage_engine.cmake mysql_storage_engine-20090610083740-kj4pwd9fzdgs1ocd-1
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp sp1f-dblqhmain.cpp-20040414082419-5mtvgr6eg47fgddawjjch74crdnaduvi
storage/ndb/src/kernel/blocks/suma/Suma.cpp sp1f-suma.cpp-20040414082421-p4toipzza63cmyzczerf4mdsbvqbwi5r
storage/pbxt/src/discover_xt.cc discover_xt.cc-20090326121724-x683v32twzr3fi0y-26
storage/xtradb/CMakeLists.txt cmakelists.txt-20081201061010-zymrrwrczns2vrex-1
storage/xtradb/ChangeLog changelog-20081201061010-zymrrwrczns2vrex-3
storage/xtradb/Makefile.am makefile.am-20081201061010-zymrrwrczns2vrex-4
storage/xtradb/btr/btr0btr.c btr0btr.c-20081201061010-zymrrwrczns2vrex-44
storage/xtradb/btr/btr0cur.c btr0cur.c-20081201061010-zymrrwrczns2vrex-45
storage/xtradb/btr/btr0pcur.c btr0pcur.c-20081201061010-zymrrwrczns2vrex-46
storage/xtradb/btr/btr0sea.c btr0sea.c-20081201061010-zymrrwrczns2vrex-47
storage/xtradb/buf/buf0buddy.c buf0buddy.c-20081201061010-zymrrwrczns2vrex-48
storage/xtradb/buf/buf0buf.c buf0buf.c-20081201061010-zymrrwrczns2vrex-49
storage/xtradb/buf/buf0flu.c buf0flu.c-20081201061010-zymrrwrczns2vrex-50
storage/xtradb/buf/buf0lru.c buf0lru.c-20081201061010-zymrrwrczns2vrex-51
storage/xtradb/buf/buf0rea.c buf0rea.c-20081201061010-zymrrwrczns2vrex-52
storage/xtradb/data/data0data.c data0data.c-20081201061010-zymrrwrczns2vrex-53
storage/xtradb/data/data0type.c data0type.c-20081201061010-zymrrwrczns2vrex-54
storage/xtradb/dict/dict0boot.c dict0boot.c-20081201061010-zymrrwrczns2vrex-55
storage/xtradb/dict/dict0crea.c dict0crea.c-20081201061010-zymrrwrczns2vrex-56
storage/xtradb/dict/dict0dict.c dict0dict.c-20081201061010-zymrrwrczns2vrex-57
storage/xtradb/dict/dict0load.c dict0load.c-20081201061010-zymrrwrczns2vrex-58
storage/xtradb/dict/dict0mem.c dict0mem.c-20081201061010-zymrrwrczns2vrex-59
storage/xtradb/dyn/dyn0dyn.c dyn0dyn.c-20081201061010-zymrrwrczns2vrex-60
storage/xtradb/eval/eval0eval.c eval0eval.c-20081201061010-zymrrwrczns2vrex-61
storage/xtradb/eval/eval0proc.c eval0proc.c-20081201061010-zymrrwrczns2vrex-62
storage/xtradb/fil/fil0fil.c fil0fil.c-20081201061010-zymrrwrczns2vrex-63
storage/xtradb/fsp/fsp0fsp.c fsp0fsp.c-20081201061010-zymrrwrczns2vrex-64
storage/xtradb/fut/fut0fut.c fut0fut.c-20081201061010-zymrrwrczns2vrex-65
storage/xtradb/fut/fut0lst.c fut0lst.c-20081201061010-zymrrwrczns2vrex-66
storage/xtradb/ha/ha0ha.c ha0ha.c-20081201061010-zymrrwrczns2vrex-67
storage/xtradb/ha/ha0storage.c ha0storage.c-20081201061010-zymrrwrczns2vrex-68
storage/xtradb/ha/hash0hash.c hash0hash.c-20081201061010-zymrrwrczns2vrex-69
storage/xtradb/handler/ha_innodb.cc ha_innodb.cc-20081201061010-zymrrwrczns2vrex-70
storage/xtradb/handler/ha_innodb.h ha_innodb.h-20081201061010-zymrrwrczns2vrex-71
storage/xtradb/handler/handler0alter.cc handler0alter.cc-20081201061010-zymrrwrczns2vrex-72
storage/xtradb/handler/handler0vars.h handler0vars.h-20081203050234-edoolglm28lyejuc-3
storage/xtradb/handler/i_s.cc i_s.cc-20081201061010-zymrrwrczns2vrex-73
storage/xtradb/handler/i_s.h i_s.h-20081201061010-zymrrwrczns2vrex-74
storage/xtradb/handler/innodb_patch_info.h innodb_patch_info.h-20081206234022-hep6ryfeacyr0572-1
storage/xtradb/handler/mysql_addons.cc mysql_addons.cc-20081201061010-zymrrwrczns2vrex-75
storage/xtradb/handler/win_delay_loader.cc win_delay_loader.cc-20081203050234-edoolglm28lyejuc-4
storage/xtradb/ibuf/ibuf0ibuf.c ibuf0ibuf.c-20081201061010-zymrrwrczns2vrex-76
storage/xtradb/include/btr0btr.h btr0btr.h-20081201061010-zymrrwrczns2vrex-77
storage/xtradb/include/btr0btr.ic btr0btr.ic-20081201061010-zymrrwrczns2vrex-78
storage/xtradb/include/btr0cur.h btr0cur.h-20081201061010-zymrrwrczns2vrex-79
storage/xtradb/include/btr0cur.ic btr0cur.ic-20081201061010-zymrrwrczns2vrex-80
storage/xtradb/include/btr0pcur.h btr0pcur.h-20081201061010-zymrrwrczns2vrex-81
storage/xtradb/include/btr0pcur.ic btr0pcur.ic-20081201061010-zymrrwrczns2vrex-82
storage/xtradb/include/btr0sea.h btr0sea.h-20081201061010-zymrrwrczns2vrex-83
storage/xtradb/include/btr0sea.ic btr0sea.ic-20081201061010-zymrrwrczns2vrex-84
storage/xtradb/include/btr0types.h btr0types.h-20081201061010-zymrrwrczns2vrex-85
storage/xtradb/include/buf0buddy.h buf0buddy.h-20081201061010-zymrrwrczns2vrex-86
storage/xtradb/include/buf0buddy.ic buf0buddy.ic-20081201061010-zymrrwrczns2vrex-87
storage/xtradb/include/buf0buf.h buf0buf.h-20081201061010-zymrrwrczns2vrex-88
storage/xtradb/include/buf0buf.ic buf0buf.ic-20081201061010-zymrrwrczns2vrex-89
storage/xtradb/include/buf0flu.h buf0flu.h-20081201061010-zymrrwrczns2vrex-90
storage/xtradb/include/buf0flu.ic buf0flu.ic-20081201061010-zymrrwrczns2vrex-91
storage/xtradb/include/buf0lru.h buf0lru.h-20081201061010-zymrrwrczns2vrex-92
storage/xtradb/include/buf0lru.ic buf0lru.ic-20081201061010-zymrrwrczns2vrex-93
storage/xtradb/include/buf0rea.h buf0rea.h-20081201061010-zymrrwrczns2vrex-94
storage/xtradb/include/buf0types.h buf0types.h-20081201061010-zymrrwrczns2vrex-95
storage/xtradb/include/data0data.h data0data.h-20081201061010-zymrrwrczns2vrex-96
storage/xtradb/include/data0data.ic data0data.ic-20081201061010-zymrrwrczns2vrex-97
storage/xtradb/include/data0type.h data0type.h-20081201061010-zymrrwrczns2vrex-98
storage/xtradb/include/data0type.ic data0type.ic-20081201061010-zymrrwrczns2vrex-99
storage/xtradb/include/data0types.h data0types.h-20081201061010-zymrrwrczns2vrex-100
storage/xtradb/include/db0err.h db0err.h-20081201061010-zymrrwrczns2vrex-101
storage/xtradb/include/dict0boot.h dict0boot.h-20081201061010-zymrrwrczns2vrex-102
storage/xtradb/include/dict0boot.ic dict0boot.ic-20081201061010-zymrrwrczns2vrex-103
storage/xtradb/include/dict0crea.h dict0crea.h-20081201061010-zymrrwrczns2vrex-104
storage/xtradb/include/dict0crea.ic dict0crea.ic-20081201061010-zymrrwrczns2vrex-105
storage/xtradb/include/dict0dict.h dict0dict.h-20081201061010-zymrrwrczns2vrex-106
storage/xtradb/include/dict0dict.ic dict0dict.ic-20081201061010-zymrrwrczns2vrex-107
storage/xtradb/include/dict0load.h dict0load.h-20081201061010-zymrrwrczns2vrex-108
storage/xtradb/include/dict0load.ic dict0load.ic-20081201061010-zymrrwrczns2vrex-109
storage/xtradb/include/dict0mem.h dict0mem.h-20081201061010-zymrrwrczns2vrex-110
storage/xtradb/include/dict0mem.ic dict0mem.ic-20081201061010-zymrrwrczns2vrex-111
storage/xtradb/include/dict0types.h dict0types.h-20081201061010-zymrrwrczns2vrex-112
storage/xtradb/include/dyn0dyn.h dyn0dyn.h-20081201061010-zymrrwrczns2vrex-113
storage/xtradb/include/dyn0dyn.ic dyn0dyn.ic-20081201061010-zymrrwrczns2vrex-114
storage/xtradb/include/eval0eval.h eval0eval.h-20081201061010-zymrrwrczns2vrex-115
storage/xtradb/include/eval0eval.ic eval0eval.ic-20081201061010-zymrrwrczns2vrex-116
storage/xtradb/include/eval0proc.h eval0proc.h-20081201061010-zymrrwrczns2vrex-117
storage/xtradb/include/eval0proc.ic eval0proc.ic-20081201061010-zymrrwrczns2vrex-118
storage/xtradb/include/fil0fil.h fil0fil.h-20081201061010-zymrrwrczns2vrex-119
storage/xtradb/include/fsp0fsp.h fsp0fsp.h-20081201061010-zymrrwrczns2vrex-120
storage/xtradb/include/fsp0fsp.ic fsp0fsp.ic-20081201061010-zymrrwrczns2vrex-121
storage/xtradb/include/fut0fut.h fut0fut.h-20081201061010-zymrrwrczns2vrex-122
storage/xtradb/include/fut0fut.ic fut0fut.ic-20081201061010-zymrrwrczns2vrex-123
storage/xtradb/include/fut0lst.h fut0lst.h-20081201061010-zymrrwrczns2vrex-124
storage/xtradb/include/fut0lst.ic fut0lst.ic-20081201061010-zymrrwrczns2vrex-125
storage/xtradb/include/ha0ha.h ha0ha.h-20081201061010-zymrrwrczns2vrex-126
storage/xtradb/include/ha0ha.ic ha0ha.ic-20081201061010-zymrrwrczns2vrex-127
storage/xtradb/include/ha0storage.h ha0storage.h-20081201061010-zymrrwrczns2vrex-128
storage/xtradb/include/ha0storage.ic ha0storage.ic-20081201061010-zymrrwrczns2vrex-129
storage/xtradb/include/ha_prototypes.h ha_prototypes.h-20081201061010-zymrrwrczns2vrex-130
storage/xtradb/include/handler0alter.h handler0alter.h-20081201061010-zymrrwrczns2vrex-131
storage/xtradb/include/hash0hash.h hash0hash.h-20081201061010-zymrrwrczns2vrex-132
storage/xtradb/include/hash0hash.ic hash0hash.ic-20081201061010-zymrrwrczns2vrex-133
storage/xtradb/include/ibuf0ibuf.h ibuf0ibuf.h-20081201061010-zymrrwrczns2vrex-134
storage/xtradb/include/ibuf0ibuf.ic ibuf0ibuf.ic-20081201061010-zymrrwrczns2vrex-135
storage/xtradb/include/ibuf0types.h ibuf0types.h-20081201061010-zymrrwrczns2vrex-136
storage/xtradb/include/lock0iter.h lock0iter.h-20081201061010-zymrrwrczns2vrex-137
storage/xtradb/include/lock0lock.h lock0lock.h-20081201061010-zymrrwrczns2vrex-138
storage/xtradb/include/lock0lock.ic lock0lock.ic-20081201061010-zymrrwrczns2vrex-139
storage/xtradb/include/lock0priv.h lock0priv.h-20081201061010-zymrrwrczns2vrex-140
storage/xtradb/include/lock0priv.ic lock0priv.ic-20081201061010-zymrrwrczns2vrex-141
storage/xtradb/include/lock0types.h lock0types.h-20081201061010-zymrrwrczns2vrex-142
storage/xtradb/include/log0log.h log0log.h-20081201061010-zymrrwrczns2vrex-143
storage/xtradb/include/log0log.ic log0log.ic-20081201061010-zymrrwrczns2vrex-144
storage/xtradb/include/log0recv.h log0recv.h-20081201061010-zymrrwrczns2vrex-145
storage/xtradb/include/log0recv.ic log0recv.ic-20081201061010-zymrrwrczns2vrex-146
storage/xtradb/include/mach0data.h mach0data.h-20081201061010-zymrrwrczns2vrex-147
storage/xtradb/include/mach0data.ic mach0data.ic-20081201061010-zymrrwrczns2vrex-148
storage/xtradb/include/mem0dbg.h mem0dbg.h-20081201061010-zymrrwrczns2vrex-149
storage/xtradb/include/mem0dbg.ic mem0dbg.ic-20081201061010-zymrrwrczns2vrex-150
storage/xtradb/include/mem0mem.h mem0mem.h-20081201061010-zymrrwrczns2vrex-151
storage/xtradb/include/mem0mem.ic mem0mem.ic-20081201061010-zymrrwrczns2vrex-152
storage/xtradb/include/mem0pool.h mem0pool.h-20081201061010-zymrrwrczns2vrex-153
storage/xtradb/include/mem0pool.ic mem0pool.ic-20081201061010-zymrrwrczns2vrex-154
storage/xtradb/include/mtr0log.h mtr0log.h-20081201061010-zymrrwrczns2vrex-155
storage/xtradb/include/mtr0log.ic mtr0log.ic-20081201061010-zymrrwrczns2vrex-156
storage/xtradb/include/mtr0mtr.h mtr0mtr.h-20081201061010-zymrrwrczns2vrex-157
storage/xtradb/include/mtr0mtr.ic mtr0mtr.ic-20081201061010-zymrrwrczns2vrex-158
storage/xtradb/include/mtr0types.h mtr0types.h-20081201061010-zymrrwrczns2vrex-159
storage/xtradb/include/mysql_addons.h mysql_addons.h-20081201061010-zymrrwrczns2vrex-160
storage/xtradb/include/os0file.h os0file.h-20081201061010-zymrrwrczns2vrex-161
storage/xtradb/include/os0proc.h os0proc.h-20081201061010-zymrrwrczns2vrex-162
storage/xtradb/include/os0proc.ic os0proc.ic-20081201061010-zymrrwrczns2vrex-163
storage/xtradb/include/os0sync.h os0sync.h-20081201061010-zymrrwrczns2vrex-164
storage/xtradb/include/os0sync.ic os0sync.ic-20081201061010-zymrrwrczns2vrex-165
storage/xtradb/include/os0thread.h os0thread.h-20081201061010-zymrrwrczns2vrex-166
storage/xtradb/include/os0thread.ic os0thread.ic-20081201061010-zymrrwrczns2vrex-167
storage/xtradb/include/page0cur.h page0cur.h-20081201061010-zymrrwrczns2vrex-168
storage/xtradb/include/page0cur.ic page0cur.ic-20081201061010-zymrrwrczns2vrex-169
storage/xtradb/include/page0page.h page0page.h-20081201061010-zymrrwrczns2vrex-170
storage/xtradb/include/page0page.ic page0page.ic-20081201061010-zymrrwrczns2vrex-171
storage/xtradb/include/page0types.h page0types.h-20081201061010-zymrrwrczns2vrex-172
storage/xtradb/include/page0zip.h page0zip.h-20081201061010-zymrrwrczns2vrex-173
storage/xtradb/include/page0zip.ic page0zip.ic-20081201061010-zymrrwrczns2vrex-174
storage/xtradb/include/pars0opt.h pars0opt.h-20081201061010-zymrrwrczns2vrex-176
storage/xtradb/include/pars0opt.ic pars0opt.ic-20081201061010-zymrrwrczns2vrex-177
storage/xtradb/include/pars0pars.h pars0pars.h-20081201061010-zymrrwrczns2vrex-178
storage/xtradb/include/pars0pars.ic pars0pars.ic-20081201061010-zymrrwrczns2vrex-179
storage/xtradb/include/pars0sym.h pars0sym.h-20081201061010-zymrrwrczns2vrex-180
storage/xtradb/include/pars0sym.ic pars0sym.ic-20081201061010-zymrrwrczns2vrex-181
storage/xtradb/include/pars0types.h pars0types.h-20081201061010-zymrrwrczns2vrex-182
storage/xtradb/include/que0que.h que0que.h-20081201061010-zymrrwrczns2vrex-183
storage/xtradb/include/que0que.ic que0que.ic-20081201061010-zymrrwrczns2vrex-184
storage/xtradb/include/que0types.h que0types.h-20081201061010-zymrrwrczns2vrex-185
storage/xtradb/include/read0read.h read0read.h-20081201061010-zymrrwrczns2vrex-186
storage/xtradb/include/read0read.ic read0read.ic-20081201061010-zymrrwrczns2vrex-187
storage/xtradb/include/read0types.h read0types.h-20081201061010-zymrrwrczns2vrex-188
storage/xtradb/include/rem0cmp.h rem0cmp.h-20081201061010-zymrrwrczns2vrex-189
storage/xtradb/include/rem0cmp.ic rem0cmp.ic-20081201061010-zymrrwrczns2vrex-190
storage/xtradb/include/rem0rec.h rem0rec.h-20081201061010-zymrrwrczns2vrex-191
storage/xtradb/include/rem0rec.ic rem0rec.ic-20081201061010-zymrrwrczns2vrex-192
storage/xtradb/include/rem0types.h rem0types.h-20081201061010-zymrrwrczns2vrex-193
storage/xtradb/include/row0ext.h row0ext.h-20081201061010-zymrrwrczns2vrex-194
storage/xtradb/include/row0ext.ic row0ext.ic-20081201061010-zymrrwrczns2vrex-195
storage/xtradb/include/row0ins.h row0ins.h-20081201061010-zymrrwrczns2vrex-196
storage/xtradb/include/row0ins.ic row0ins.ic-20081201061010-zymrrwrczns2vrex-197
storage/xtradb/include/row0merge.h row0merge.h-20081201061010-zymrrwrczns2vrex-198
storage/xtradb/include/row0mysql.h row0mysql.h-20081201061010-zymrrwrczns2vrex-199
storage/xtradb/include/row0mysql.ic row0mysql.ic-20081201061010-zymrrwrczns2vrex-200
storage/xtradb/include/row0purge.h row0purge.h-20081201061010-zymrrwrczns2vrex-201
storage/xtradb/include/row0purge.ic row0purge.ic-20081201061010-zymrrwrczns2vrex-202
storage/xtradb/include/row0row.h row0row.h-20081201061010-zymrrwrczns2vrex-203
storage/xtradb/include/row0row.ic row0row.ic-20081201061010-zymrrwrczns2vrex-204
storage/xtradb/include/row0sel.h row0sel.h-20081201061010-zymrrwrczns2vrex-205
storage/xtradb/include/row0sel.ic row0sel.ic-20081201061010-zymrrwrczns2vrex-206
storage/xtradb/include/row0types.h row0types.h-20081201061010-zymrrwrczns2vrex-207
storage/xtradb/include/row0uins.h row0uins.h-20081201061010-zymrrwrczns2vrex-208
storage/xtradb/include/row0uins.ic row0uins.ic-20081201061010-zymrrwrczns2vrex-209
storage/xtradb/include/row0umod.h row0umod.h-20081201061010-zymrrwrczns2vrex-210
storage/xtradb/include/row0umod.ic row0umod.ic-20081201061010-zymrrwrczns2vrex-211
storage/xtradb/include/row0undo.h row0undo.h-20081201061010-zymrrwrczns2vrex-212
storage/xtradb/include/row0undo.ic row0undo.ic-20081201061010-zymrrwrczns2vrex-213
storage/xtradb/include/row0upd.h row0upd.h-20081201061010-zymrrwrczns2vrex-214
storage/xtradb/include/row0upd.ic row0upd.ic-20081201061010-zymrrwrczns2vrex-215
storage/xtradb/include/row0vers.h row0vers.h-20081201061010-zymrrwrczns2vrex-216
storage/xtradb/include/row0vers.ic row0vers.ic-20081201061010-zymrrwrczns2vrex-217
storage/xtradb/include/srv0que.h srv0que.h-20081201061010-zymrrwrczns2vrex-218
storage/xtradb/include/srv0srv.h srv0srv.h-20081201061010-zymrrwrczns2vrex-219
storage/xtradb/include/srv0srv.ic srv0srv.ic-20081201061010-zymrrwrczns2vrex-220
storage/xtradb/include/srv0start.h srv0start.h-20081201061010-zymrrwrczns2vrex-221
storage/xtradb/include/sync0arr.h sync0arr.h-20081201061010-zymrrwrczns2vrex-222
storage/xtradb/include/sync0arr.ic sync0arr.ic-20081201061010-zymrrwrczns2vrex-223
storage/xtradb/include/sync0rw.h sync0rw.h-20081201061010-zymrrwrczns2vrex-224
storage/xtradb/include/sync0rw.ic sync0rw.ic-20081201061010-zymrrwrczns2vrex-225
storage/xtradb/include/sync0sync.h sync0sync.h-20081201061010-zymrrwrczns2vrex-226
storage/xtradb/include/sync0sync.ic sync0sync.ic-20081201061010-zymrrwrczns2vrex-227
storage/xtradb/include/sync0types.h sync0types.h-20081201061010-zymrrwrczns2vrex-228
storage/xtradb/include/thr0loc.h thr0loc.h-20081201061010-zymrrwrczns2vrex-229
storage/xtradb/include/thr0loc.ic thr0loc.ic-20081201061010-zymrrwrczns2vrex-230
storage/xtradb/include/trx0i_s.h trx0i_s.h-20081201061010-zymrrwrczns2vrex-231
storage/xtradb/include/trx0purge.h trx0purge.h-20081201061010-zymrrwrczns2vrex-232
storage/xtradb/include/trx0purge.ic trx0purge.ic-20081201061010-zymrrwrczns2vrex-233
storage/xtradb/include/trx0rec.h trx0rec.h-20081201061010-zymrrwrczns2vrex-234
storage/xtradb/include/trx0rec.ic trx0rec.ic-20081201061010-zymrrwrczns2vrex-235
storage/xtradb/include/trx0roll.h trx0roll.h-20081201061010-zymrrwrczns2vrex-236
storage/xtradb/include/trx0roll.ic trx0roll.ic-20081201061010-zymrrwrczns2vrex-237
storage/xtradb/include/trx0rseg.h trx0rseg.h-20081201061010-zymrrwrczns2vrex-238
storage/xtradb/include/trx0rseg.ic trx0rseg.ic-20081201061010-zymrrwrczns2vrex-239
storage/xtradb/include/trx0sys.h trx0sys.h-20081201061010-zymrrwrczns2vrex-240
storage/xtradb/include/trx0sys.ic trx0sys.ic-20081201061010-zymrrwrczns2vrex-241
storage/xtradb/include/trx0trx.h trx0trx.h-20081201061010-zymrrwrczns2vrex-242
storage/xtradb/include/trx0trx.ic trx0trx.ic-20081201061010-zymrrwrczns2vrex-243
storage/xtradb/include/trx0types.h trx0types.h-20081201061010-zymrrwrczns2vrex-244
storage/xtradb/include/trx0undo.h trx0undo.h-20081201061010-zymrrwrczns2vrex-245
storage/xtradb/include/trx0undo.ic trx0undo.ic-20081201061010-zymrrwrczns2vrex-246
storage/xtradb/include/trx0xa.h trx0xa.h-20081201061010-zymrrwrczns2vrex-247
storage/xtradb/include/univ.i univ.i-20081201061010-zymrrwrczns2vrex-248
storage/xtradb/include/usr0sess.h usr0sess.h-20081201061010-zymrrwrczns2vrex-249
storage/xtradb/include/usr0sess.ic usr0sess.ic-20081201061010-zymrrwrczns2vrex-250
storage/xtradb/include/usr0types.h usr0types.h-20081201061010-zymrrwrczns2vrex-251
storage/xtradb/include/ut0auxconf.h ut0auxconf.h-20090326061054-ylrdb8libxw6u7e9-2
storage/xtradb/include/ut0byte.h ut0byte.h-20081201061010-zymrrwrczns2vrex-252
storage/xtradb/include/ut0byte.ic ut0byte.ic-20081201061010-zymrrwrczns2vrex-253
storage/xtradb/include/ut0dbg.h ut0dbg.h-20081201061010-zymrrwrczns2vrex-254
storage/xtradb/include/ut0list.h ut0list.h-20081201061010-zymrrwrczns2vrex-255
storage/xtradb/include/ut0list.ic ut0list.ic-20081201061010-zymrrwrczns2vrex-256
storage/xtradb/include/ut0lst.h ut0lst.h-20081201061010-zymrrwrczns2vrex-257
storage/xtradb/include/ut0mem.h ut0mem.h-20081201061010-zymrrwrczns2vrex-258
storage/xtradb/include/ut0mem.ic ut0mem.ic-20081201061010-zymrrwrczns2vrex-259
storage/xtradb/include/ut0rnd.h ut0rnd.h-20081201061010-zymrrwrczns2vrex-260
storage/xtradb/include/ut0rnd.ic ut0rnd.ic-20081201061010-zymrrwrczns2vrex-261
storage/xtradb/include/ut0sort.h ut0sort.h-20081201061010-zymrrwrczns2vrex-262
storage/xtradb/include/ut0ut.h ut0ut.h-20081201061010-zymrrwrczns2vrex-263
storage/xtradb/include/ut0ut.ic ut0ut.ic-20081201061010-zymrrwrczns2vrex-264
storage/xtradb/include/ut0vec.h ut0vec.h-20081201061010-zymrrwrczns2vrex-265
storage/xtradb/include/ut0vec.ic ut0vec.ic-20081201061010-zymrrwrczns2vrex-266
storage/xtradb/include/ut0wqueue.h ut0wqueue.h-20081201061010-zymrrwrczns2vrex-267
storage/xtradb/lock/lock0iter.c lock0iter.c-20081201061010-zymrrwrczns2vrex-268
storage/xtradb/lock/lock0lock.c lock0lock.c-20081201061010-zymrrwrczns2vrex-269
storage/xtradb/log/log0log.c log0log.c-20081201061010-zymrrwrczns2vrex-270
storage/xtradb/log/log0recv.c log0recv.c-20081201061010-zymrrwrczns2vrex-271
storage/xtradb/mach/mach0data.c mach0data.c-20081201061010-zymrrwrczns2vrex-272
storage/xtradb/mem/mem0dbg.c mem0dbg.c-20081201061010-zymrrwrczns2vrex-273
storage/xtradb/mem/mem0mem.c mem0mem.c-20081201061010-zymrrwrczns2vrex-274
storage/xtradb/mem/mem0pool.c mem0pool.c-20081201061010-zymrrwrczns2vrex-275
storage/xtradb/mtr/mtr0log.c mtr0log.c-20081201061010-zymrrwrczns2vrex-276
storage/xtradb/mtr/mtr0mtr.c mtr0mtr.c-20081201061010-zymrrwrczns2vrex-277
storage/xtradb/os/os0file.c os0file.c-20081201061010-zymrrwrczns2vrex-313
storage/xtradb/os/os0proc.c os0proc.c-20081201061010-zymrrwrczns2vrex-314
storage/xtradb/os/os0sync.c os0sync.c-20081201061010-zymrrwrczns2vrex-315
storage/xtradb/os/os0thread.c os0thread.c-20081201061010-zymrrwrczns2vrex-316
storage/xtradb/page/page0cur.c page0cur.c-20081201061010-zymrrwrczns2vrex-317
storage/xtradb/page/page0page.c page0page.c-20081201061010-zymrrwrczns2vrex-318
storage/xtradb/page/page0zip.c page0zip.c-20081201061010-zymrrwrczns2vrex-319
storage/xtradb/pars/lexyy.c lexyy.c-20081201061010-zymrrwrczns2vrex-320
storage/xtradb/pars/pars0lex.l pars0lex.l-20081201061010-zymrrwrczns2vrex-325
storage/xtradb/pars/pars0opt.c pars0opt.c-20081201061010-zymrrwrczns2vrex-326
storage/xtradb/pars/pars0pars.c pars0pars.c-20081201061010-zymrrwrczns2vrex-327
storage/xtradb/pars/pars0sym.c pars0sym.c-20081201061010-zymrrwrczns2vrex-328
storage/xtradb/plug.in plug.in-20081201061010-zymrrwrczns2vrex-31
storage/xtradb/que/que0que.c que0que.c-20081201061010-zymrrwrczns2vrex-329
storage/xtradb/read/read0read.c read0read.c-20081201061010-zymrrwrczns2vrex-330
storage/xtradb/rem/rem0cmp.c rem0cmp.c-20081201061010-zymrrwrczns2vrex-331
storage/xtradb/rem/rem0rec.c rem0rec.c-20081201061010-zymrrwrczns2vrex-332
storage/xtradb/row/row0ext.c row0ext.c-20081201061010-zymrrwrczns2vrex-333
storage/xtradb/row/row0ins.c row0ins.c-20081201061010-zymrrwrczns2vrex-334
storage/xtradb/row/row0merge.c row0merge.c-20081201061010-zymrrwrczns2vrex-335
storage/xtradb/row/row0mysql.c row0mysql.c-20081201061010-zymrrwrczns2vrex-336
storage/xtradb/row/row0purge.c row0purge.c-20081201061010-zymrrwrczns2vrex-337
storage/xtradb/row/row0row.c row0row.c-20081201061010-zymrrwrczns2vrex-338
storage/xtradb/row/row0sel.c row0sel.c-20081201061010-zymrrwrczns2vrex-339
storage/xtradb/row/row0uins.c row0uins.c-20081201061010-zymrrwrczns2vrex-340
storage/xtradb/row/row0umod.c row0umod.c-20081201061010-zymrrwrczns2vrex-341
storage/xtradb/row/row0undo.c row0undo.c-20081201061010-zymrrwrczns2vrex-342
storage/xtradb/row/row0upd.c row0upd.c-20081201061010-zymrrwrczns2vrex-343
storage/xtradb/row/row0vers.c row0vers.c-20081201061010-zymrrwrczns2vrex-344
storage/xtradb/srv/srv0que.c srv0que.c-20081201061010-zymrrwrczns2vrex-346
storage/xtradb/srv/srv0srv.c srv0srv.c-20081201061010-zymrrwrczns2vrex-347
storage/xtradb/srv/srv0start.c srv0start.c-20081201061010-zymrrwrczns2vrex-348
storage/xtradb/sync/sync0arr.c sync0arr.c-20081201061010-zymrrwrczns2vrex-349
storage/xtradb/sync/sync0rw.c sync0rw.c-20081201061010-zymrrwrczns2vrex-350
storage/xtradb/sync/sync0sync.c sync0sync.c-20081201061010-zymrrwrczns2vrex-351
storage/xtradb/thr/thr0loc.c thr0loc.c-20081201061010-zymrrwrczns2vrex-352
storage/xtradb/trx/trx0i_s.c trx0i_s.c-20081201061010-zymrrwrczns2vrex-353
storage/xtradb/trx/trx0purge.c trx0purge.c-20081201061010-zymrrwrczns2vrex-354
storage/xtradb/trx/trx0rec.c trx0rec.c-20081201061010-zymrrwrczns2vrex-355
storage/xtradb/trx/trx0roll.c trx0roll.c-20081201061010-zymrrwrczns2vrex-356
storage/xtradb/trx/trx0rseg.c trx0rseg.c-20081201061010-zymrrwrczns2vrex-357
storage/xtradb/trx/trx0sys.c trx0sys.c-20081201061010-zymrrwrczns2vrex-358
storage/xtradb/trx/trx0trx.c trx0trx.c-20081201061010-zymrrwrczns2vrex-359
storage/xtradb/trx/trx0undo.c trx0undo.c-20081201061010-zymrrwrczns2vrex-360
storage/xtradb/usr/usr0sess.c usr0sess.c-20081201061010-zymrrwrczns2vrex-361
storage/xtradb/ut/ut0byte.c ut0byte.c-20081201061010-zymrrwrczns2vrex-362
storage/xtradb/ut/ut0dbg.c ut0dbg.c-20081201061010-zymrrwrczns2vrex-363
storage/xtradb/ut/ut0list.c ut0list.c-20081201061010-zymrrwrczns2vrex-364
storage/xtradb/ut/ut0mem.c ut0mem.c-20081201061010-zymrrwrczns2vrex-365
storage/xtradb/ut/ut0rnd.c ut0rnd.c-20081201061010-zymrrwrczns2vrex-366
storage/xtradb/ut/ut0ut.c ut0ut.c-20081201061010-zymrrwrczns2vrex-367
storage/xtradb/ut/ut0vec.c ut0vec.c-20081201061010-zymrrwrczns2vrex-368
storage/xtradb/ut/ut0wqueue.c ut0wqueue.c-20081201061010-zymrrwrczns2vrex-369
storage/xtradb/win-plugin/README readme-20081203050234-edoolglm28lyejuc-15
storage/xtradb/win-plugin/win-plugin.diff winplugin.diff-20081203050234-edoolglm28lyejuc-16
strings/ctype-mb.c sp1f-ctypemb.c-20020312173754-rtl7oemmrocifpvc2z4og7rvep3jrhkh
strings/ctype-simple.c sp1f-ctypesimple.c-20020312173754-2nnl6235owml5myqwzsl3uzlhz72bwho
strings/ctype-uca.c sp1f-ctypeuca.c-20040324121604-kwaskdasqzdrufymlf27j4gl3gwdy5fq
strings/ctype-ucs2.c sp1f-ctypeucs2.c-20030521102942-3fr4x6ti6jw6vqwdh7byhlxpu6oivdnn
support-files/MacOSX/ReadMe.txt sp1f-readme.txt-20071102002932-oqaazdag65tr7zn4vqtp6h2aywxyg754
support-files/binary-configure.sh sp1f-binaryconfigure.sh-19700101030959-brbiq3yf2mdlmehb4p77iqvjg535f4fs
tests/mysql_client_test.c sp1f-client_test.c-20020614002636-eqy2zzksgelocknwbbogfuwxfwqy7q5x
unittest/mysys/Makefile.am sp1f-makefile.am-20060404161610-vihzdr4qjuef3o5tlkhxxs3o74qy7bln
vio/vio.c sp1f-vio.c-20010520120430-aw76h22ssarmssof7rplhty5elqiexku
vio/vio_priv.h sp1f-vio_priv.h-20030826235137-5sdl43z73qga2fo4s5g55pqqgyvkhbo7
vio/viosocket.c sp1f-viotcpip.c-20010520120437-u3pbzbt3fdfbclbmusalnzmuqh2y4nav
vio/viosslfactories.c sp1f-viosslfactories.c-20010520120431-walfvbsc6adzg7cj5g6xl3r73ycxspmb
mysql-test/r/innodb_lock_wait_timeout_1.result bug40113.result-20090619150423-w3im08cym6tyzn8f-3
mysql-test/t/innodb_lock_wait_timeout_1.test bug40113.test-20090619150423-w3im08cym6tyzn8f-2
Diff too large for email (179540 lines, the limit is 1000).
1
0
I started working on a task management tool based on the rough
specification at http://askmonty.org/wiki/index.php/Tools_we_need .
Account management is currently a manual process and I am currently
working on adding the pieces to add products, projects and tasks.
Once that is finished I will look into adding the task sharing piece
and e-mail task management support.
You can find the very rough proof of concept at:
http://tickr.thefuturegrid.org/
and the code at:
http://git.thefuturegrid.org
-Adam
2
1
Recently setup a Drupal staging server with MariaDB and it looks good.
Everything went perfectly well, and no code changes were required.
Keep up the good work :)
2
1
Re: [Maria-developers] Crash during shutdown (need help from PBXT team)
by Kristian Nielsen 07 Dec '09
by Kristian Nielsen 07 Dec '09
07 Dec '09
[I Cc'ed Paul, let me know if there is another prefered way of communicating,
like using Launchpad bugs or some mailing list]
Vladimir Kolesnikov <vladimir(a)primebase.org> writes:
> "Crash during shutdown (need help from PBXT team)"
>
> can you provide any details?
Yes, of course! Just been busy with other stuff, but very happy that you
mention it on your own initiative!
Basically, after merging PBXT I see crashes in the main.mysqld_option_err test
case. Here is an example build from Buildbot showing this:
http://askmonty.org/buildbot/builders/debian5-i386-fulltest/builds/52
http://askmonty.org/buildbot/builders/debian5-i386-fulltest/builds/52/steps…
The failure appears to be somewhat random, but I was able to repeat it easily
enough locally using a release build. Debug build did not seem to show the
problem.
The issue is with the fix that Paul pushed for Bug#489088:
https://bugs.launchpad.net/pbxt/+bug/489088
=== modified file 'storage/pbxt/src/myxt_xt.cc'
--- storage/pbxt/src/myxt_xt.cc 2009-11-27 15:37:02 +0000
+++ storage/pbxt/src/myxt_xt.cc 2009-12-01 09:50:46 +0000
@@ -3041,6 +3041,14 @@ xtPublic MX_CHARSET_INFO *myxt_getcharse
return (MX_CHARSET_INFO *)&my_charset_utf8_general_ci;
}
+#ifdef DBUG_OFF
+//typedef struct st_plugin_int *plugin_ref;
+#define REF_MYSQL_PLUGIN(x) (x)
+#else
+//typedef struct st_plugin_int **plugin_ref;
+#define REF_MYSQL_PLUGIN(x) (*(x))
+#endif
+
xtPublic void *myxt_create_thread()
{
#ifdef DRIZZLED
+ LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(new_thd->variables.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--;
+ }
new_thd->thread_stack = (char *) &new_thd;
new_thd->store_globals();
lex_start(new_thd);
This code crashes because new_thd->variables.table_plugin is NULL at this
point in the code (or at least sometimes is).
So this problem is similar to the previous problem handled just above in the
code with global_system_variables.table_plugin being NULL.
I tried a patch like this:
=== modified file 'storage/pbxt/src/myxt_xt.cc'
--- storage/pbxt/src/myxt_xt.cc 2009-12-01 09:50:46 +0000
+++ storage/pbxt/src/myxt_xt.cc 2009-12-04 21:41:25 +0000
@@ -3112,10 +3112,15 @@ 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;
- if ((plugin_name.length == 4) && (strncmp(plugin_name.str, "PBXT", plugin_name.length) == 0)) {
- REF_MYSQL_PLUGIN(new_thd->variables.table_plugin)->ref_count--;
+ plugin_ref table_plugin = new_thd->variables.table_plugin;
+ if (table_plugin) {
+ 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(table_plugin)->ref_count--;
+ }
}
new_thd->thread_stack = (char *) &new_thd;
new_thd->store_globals();
So this fixes the crashes, but of course re-introduces the original problem in
Bug#489088 with warnings about forced shutdown.
I think you should be able to repeat the problem easily enough on Linux with a
non-debug build running the test main.mysqld_option_err, but if not let me
know and I will help set something up.
- Kristian.
3
3
Hi!
I have been removing warnings (found by buildbot) from the MariaDB 5.1 tree.
(Will be pushed later today).
Here is some comments, suggestions of what we still to do to make the
buildbot part 'more clean:
------
We get a lot of warnings of the type:
ctype-ucs2.c:206: warning: ‘s_wc’ may be used uninitialized in this function
This are false warnings (The compiler is not smart enough to figure
this out). The variables are also protected with the LINT_INIT() macro.
Suggestion (for Kristian):
- If you compile with -Wuninitialized, also use the -DFORCE_INIT_OF_VARS
When compiling for valgrind, we should not use
-Wuninitialized or -DFORCE_INIT_OF_VARS
-------
For Percona:
We get the following warnings from xtradb:
../../storage/xtradb/include/dict0dict.ic:729: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../storage/xtradb/include/dict0dict.ic:788: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../storage/xtradb/include/dict0dict.ic:729: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../storage/xtradb/include/dict0dict.ic:788: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../include/../storage/xtradb/include/dict0dict.ic:729: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../include/../storage/xtradb/include/dict0dict.ic:788: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
Can you fix these ?
----------
I don't know if the following warning comes from us or from the
include files:
/usr/include/bits/string3.h:82: warning: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters
Need suggestions/help to solve this one.
Either we need to find the code in MariaDB that generates the warning
or disable warnings in buildbot from /usr/include
---------
Regards,
Monty
2
1
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2782: Automatic merge
by noreply@launchpad.net 07 Dec '09
by noreply@launchpad.net 07 Dec '09
07 Dec '09
Merge authors:
Kristian Nielsen (knielsen)
------------------------------------------------------------
revno: 2782 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1-mtr2
timestamp: Mon 2009-12-07 07:53:36 +0100
message:
Automatic merge
modified:
BUILD/FINISH.sh
BUILD/SETUP.sh
extra/yassl/taocrypt/include/block.hpp
mysql-test/lib/mtr_cases.pm
mysql-test/mysql-test-run.pl
plugin/fulltext/plugin_example.c
vio/viosslfactories.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] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2782)
by knielsen@knielsen-hq.org 07 Dec '09
by knielsen@knielsen-hq.org 07 Dec '09
07 Dec '09
#At lp:maria
2782 knielsen(a)knielsen-hq.org 2009-12-07 [merge]
Automatic merge
modified:
BUILD/FINISH.sh
BUILD/SETUP.sh
extra/yassl/taocrypt/include/block.hpp
mysql-test/lib/mtr_cases.pm
mysql-test/mysql-test-run.pl
plugin/fulltext/plugin_example.c
vio/viosslfactories.c
=== modified file 'BUILD/FINISH.sh'
--- a/BUILD/FINISH.sh 2009-10-27 13:20:34 +0000
+++ b/BUILD/FINISH.sh 2009-12-06 17:34:54 +0000
@@ -1,6 +1,6 @@
-cflags="$c_warnings $extra_flags"
-cxxflags="$cxx_warnings $base_cxxflags $extra_flags"
-extra_configs="$extra_configs $local_infile_configs"
+cflags="$c_warnings $extra_flags $EXTRA_FLAGS $EXTRA_CFLAGS"
+cxxflags="$cxx_warnings $base_cxxflags $extra_flags $EXTRA_FLAGS $EXTRA_CXXFLAGS"
+extra_configs="$extra_configs $local_infile_configs $EXTRA_CONFIGS"
configure="./configure $base_configs $extra_configs"
commands="\
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh 2009-10-29 00:04:56 +0000
+++ b/BUILD/SETUP.sh 2009-12-06 17:34:54 +0000
@@ -34,6 +34,14 @@ parse_options()
full_debug="=full";;
--warning-mode=*)
warning_mode=`get_key_value "$1"`;;
+ --extra-flags=*)
+ EXTRA_FLAGS=`get_key_value "$1"`;;
+ --extra-cflags=*)
+ EXTRA_CFLAGS=`get_key_value "$1"`;;
+ --extra-cxxflags=*)
+ EXTRA_CXXFLAGS=`get_key_value "$1"`;;
+ --extra-configs=*)
+ EXTRA_CONFIGS=`get_key_value "$1"`;;
-c | --just-configure)
just_configure=1;;
-n | --just-print | --print)
=== modified file 'extra/yassl/taocrypt/include/block.hpp'
--- a/extra/yassl/taocrypt/include/block.hpp 2009-02-10 22:47:54 +0000
+++ b/extra/yassl/taocrypt/include/block.hpp 2009-12-06 17:34:54 +0000
@@ -167,7 +167,8 @@ public:
void CleanNew(word32 newSize)
{
New(newSize);
- memset(buffer_, 0, sz_ * sizeof(T));
+ if (sz_ > 0)
+ memset(buffer_, 0, sz_ * sizeof(T));
}
void New(word32 newSize)
=== modified file 'mysql-test/lib/mtr_cases.pm'
--- a/mysql-test/lib/mtr_cases.pm 2009-12-03 11:19:05 +0000
+++ b/mysql-test/lib/mtr_cases.pm 2009-12-06 17:34:54 +0000
@@ -101,7 +101,6 @@ sub init_pattern {
sub collect_test_cases ($$) {
my $suites= shift; # Semicolon separated list of test suites
- my %found_suites;
my $opt_cases= shift;
my $cases= []; # Array of hash(one hash for each testcase)
@@ -115,7 +114,6 @@ sub collect_test_cases ($$) {
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
"ha_innodb_plugin.sl"],
NOT_REQUIRED);
-
$do_innodb_plugin= ($::mysql_version_id >= 50100 &&
!(IS_WINDOWS && $::opt_embedded_server) &&
$lib_innodb_plugin);
@@ -123,7 +121,6 @@ sub collect_test_cases ($$) {
foreach my $suite (split(",", $suites))
{
push(@$cases, collect_one_suite($suite, $opt_cases));
- $found_suites{$suite}= 1;
last if $some_test_found;
}
@@ -136,12 +133,6 @@ sub collect_test_cases ($$) {
{
my $found= 0;
my ($sname, $tname, $extension)= split_testname($test_name_spec);
- if (defined($sname) && !defined($found_suites{$sname}))
- {
- $found_suites{$sname}= 1;
- push(@$cases, collect_one_suite($sname));
- }
-
foreach my $test ( @$cases )
{
# test->{name} is always in suite.name format
@@ -247,7 +238,7 @@ sub split_testname {
}
-sub collect_one_suite($)
+sub collect_one_suite
{
my $suite= shift; # Test suite name
my $opt_cases= shift;
@@ -767,7 +758,6 @@ sub process_opts_file {
}
}
-
##############################################################################
#
# Collect information about a single test case
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-12-03 11:34:11 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-12-06 17:34:54 +0000
@@ -5683,12 +5683,15 @@ Misc options
servers to exit before finishing the process
fast Run as fast as possible, dont't wait for servers
to shutdown etc.
- parallel=N Run tests in N parallel threads (default=1)
+ parallel=N Run tests in N parallel threads (default 1)
Use parallel=auto for auto-setting of N
repeat=N Run each test N number of times
- retry=N Retry tests that fail N times, limit number of failures
- to $opt_retry_failure
- retry-failure=N Limit number of retries for a failed test
+ retry=N Retry tests that fail up to N times (default $opt_retry).
+ Retries are also limited by the maximum number of
+ failures before stopping, set with the --retry-failure
+ option
+ retry-failure=N When using the --retry option to retry failed tests,
+ stop when N failures have occured (default $opt_retry_failure)
reorder Reorder tests to get fewer server restarts
help Get this help text
=== modified file 'plugin/fulltext/plugin_example.c'
--- a/plugin/fulltext/plugin_example.c 2007-04-26 19:26:04 +0000
+++ b/plugin/fulltext/plugin_example.c 2009-12-06 17:34:54 +0000
@@ -145,7 +145,7 @@ static int simple_parser_deinit(MYSQL_FT
the list of search terms when parsing a search string.
*/
-static void add_word(MYSQL_FTPARSER_PARAM *param, char *word, size_t len)
+static void add_word(MYSQL_FTPARSER_PARAM *param, const unsigned char *word, size_t len)
{
MYSQL_FTPARSER_BOOLEAN_INFO bool_info=
{ FT_TOKEN_WORD, 0, 0, 0, 0, ' ', 0 };
@@ -169,7 +169,7 @@ static void add_word(MYSQL_FTPARSER_PARA
static int simple_parser_parse(MYSQL_FTPARSER_PARAM *param)
{
- char *end, *start, *docend= param->doc + param->length;
+ const unsigned char *end, *start, *docend= param->doc + param->length;
number_of_calls++;
=== modified file 'vio/viosslfactories.c'
--- a/vio/viosslfactories.c 2009-10-27 13:20:34 +0000
+++ b/vio/viosslfactories.c 2009-12-06 17:34:54 +0000
@@ -19,7 +19,6 @@
static my_bool ssl_algorithms_added = FALSE;
static my_bool ssl_error_strings_loaded= FALSE;
-static int verify_depth = 0;
static unsigned char dh512_p[]=
{
1
0
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2781: Protect stack->keywords with THR_LOCK_dbug
by noreply@launchpad.net 07 Dec '09
by noreply@launchpad.net 07 Dec '09
07 Dec '09
------------------------------------------------------------
revno: 2781
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Mon 2009-12-07 02:52:40 +0200
message:
Protect stack->keywords with THR_LOCK_dbug
This solves a core dump in MariaDB when one sets the GLOBAL.DEBUG variable in mysql-test-run when other threads are checking the keyword list
modified:
dbug/dbug.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 2780: Fixed bug #49474 Replication from 4.0 to 5.1 broken
by noreply@launchpad.net 07 Dec '09
by noreply@launchpad.net 07 Dec '09
07 Dec '09
------------------------------------------------------------
revno: 2780
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Sun 2009-12-06 19:51:48 +0200
message:
Fixed bug #49474 Replication from 4.0 to 5.1 broken
Reviewer: knielsens
modified:
sql/slave.cc
--
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 2779: Changed -1 row number in some warnings to 0
by noreply@launchpad.net 07 Dec '09
by noreply@launchpad.net 07 Dec '09
07 Dec '09
------------------------------------------------------------
revno: 2779
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Sun 2009-12-06 19:26:12 +0200
message:
Changed -1 row number in some warnings to 0
(-1 doesn't make sence as a row number and when doing insert / load data, first row is 1, so 0 is free to use)
modified:
mysql-test/r/warnings.result
mysql-test/suite/funcs_1/r/innodb_func_view.result
mysql-test/suite/funcs_1/r/memory_func_view.result
mysql-test/suite/funcs_1/r/myisam_func_view.result
mysql-test/t/warnings.test
sql/my_decimal.cc
sql/share/errmsg.txt
--
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:2781)
by Michael Widenius 07 Dec '09
by Michael Widenius 07 Dec '09
07 Dec '09
#At lp:maria based on revid:monty@askmonty.org-20091206175148-d5wnieuylgkbeyux
2781 Michael Widenius 2009-12-07
Protect stack->keywords with THR_LOCK_dbug
This solves a core dump in MariaDB when one sets the GLOBAL.DEBUG variable in mysql-test-run when other threads are checking the keyword list
modified:
dbug/dbug.c
per-file messages:
dbug/dbug.c
Protect stack->keywords with THR_LOCK_dbug
=== modified file 'dbug/dbug.c'
--- a/dbug/dbug.c 2009-09-07 20:50:10 +0000
+++ b/dbug/dbug.c 2009-12-07 00:52:40 +0000
@@ -497,12 +497,18 @@ int DbugParse(CODE_STATE *cs, const char
const char *end;
int rel, f_used=0;
struct settings *stack;
+ int org_cs_locked;
stack= cs->stack;
+ if (!(org_cs_locked= cs->locked))
+ {
+ cs->locked= 1;
+ pthread_mutex_lock(&THR_LOCK_dbug);
+ }
+
if (control[0] == '-' && control[1] == '#')
control+=2;
-
rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next)))
{
@@ -550,9 +556,11 @@ int DbugParse(CODE_STATE *cs, const char
while (control < end)
{
int c, sign= (*control == '+') ? 1 : (*control == '-') ? -1 : 0;
- if (sign) control++;
+ if (sign)
+ control++;
c= *control++;
- if (*control == ',') control++;
+ if (*control == ',')
+ control++;
/* XXX when adding new cases here, don't forget _db_explain_ ! */
switch (c) {
case 'd':
@@ -570,7 +578,7 @@ int DbugParse(CODE_STATE *cs, const char
{
if (DEBUGGING)
stack->keywords= ListDel(stack->keywords, control, end);
- break;
+ break;
}
stack->keywords= ListAdd(stack->keywords, control, end);
stack->flags |= DEBUG_ON;
@@ -718,8 +726,13 @@ int DbugParse(CODE_STATE *cs, const char
control=end+1;
end= DbugStrTok(control);
}
- return !rel || f_used;
-}
+ if (!org_cs_locked)
+ {
+ pthread_mutex_unlock(&THR_LOCK_dbug);
+ cs->locked= 0;
+ }
+ return !rel || f_used;}
+
#define framep_trace_flag(cs, frp) (frp ? \
frp->level & TRACE_ON : \
@@ -1340,11 +1353,11 @@ void _db_doprnt_(const char *format,...)
va_start(args,format);
+ if (!cs->locked)
+ pthread_mutex_lock(&THR_LOCK_dbug);
if (_db_keyword_(cs, cs->u_keyword, 0))
{
int save_errno=errno;
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
DoPrefix(cs, cs->u_line);
if (TRACING)
Indent(cs, cs->level + 1);
@@ -1356,6 +1369,9 @@ void _db_doprnt_(const char *format,...)
DbugFlush(cs);
errno=save_errno;
}
+ else if (!cs->locked)
+ pthread_mutex_unlock(&THR_LOCK_dbug);
+
va_end(args);
}
@@ -1386,10 +1402,10 @@ void _db_dump_(uint _line_, const char *
CODE_STATE *cs;
get_code_state_or_return;
+ if (!cs->locked)
+ pthread_mutex_lock(&THR_LOCK_dbug);
if (_db_keyword_(cs, keyword, 0))
{
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
DoPrefix(cs, _line_);
if (TRACING)
{
@@ -1420,6 +1436,8 @@ void _db_dump_(uint _line_, const char *
(void) fputc('\n',cs->stack->out_file);
DbugFlush(cs);
}
+ else if (!cs->locked)
+ pthread_mutex_unlock(&THR_LOCK_dbug);
}
@@ -2105,7 +2123,8 @@ static void DBUGCloseFile(CODE_STATE *cs
{
if (fp != stderr && fp != stdout && fclose(fp) == EOF)
{
- pthread_mutex_lock(&THR_LOCK_dbug);
+ if (!cs->locked)
+ pthread_mutex_lock(&THR_LOCK_dbug);
(void) fprintf(cs->stack->out_file, ERR_CLOSE, cs->process);
perror("");
DbugFlush(cs);
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2780) Bug#49474
by Michael Widenius 06 Dec '09
by Michael Widenius 06 Dec '09
06 Dec '09
#At lp:maria based on revid:monty@askmonty.org-20091206172612-zemnptoycsg283y3
2780 Michael Widenius 2009-12-06
Fixed bug #49474 Replication from 4.0 to 5.1 broken
Reviewer: knielsens
modified:
sql/slave.cc
per-file messages:
sql/slave.cc
For 4.0 server (with no time_zone variable), don't stop replication but give a warning
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc 2009-12-03 11:19:05 +0000
+++ b/sql/slave.cc 2009-12-06 17:51:48 +0000
@@ -1117,18 +1117,27 @@ be equal for the Statement-format replic
goto err;
}
}
- else if (is_network_error(mysql_errno(mysql)))
+ else if (is_network_error(err_code= mysql_errno(mysql)))
{
- mi->report(WARNING_LEVEL, mysql_errno(mysql),
- "Get master TIME_ZONE failed with error: %s", mysql_error(mysql));
+ mi->report(ERROR_LEVEL, err_code,
+ "Get master TIME_ZONE failed with error: %s",
+ mysql_error(mysql));
goto network_err;
- }
+ }
+ else if (err_code == ER_UNKNOWN_SYSTEM_VARIABLE)
+ {
+ /* We use ERROR_LEVEL to get the error logged to file */
+ mi->report(ERROR_LEVEL, err_code,
+
+ "MySQL master doesn't have a TIME_ZONE variable. Note that"
+ "if your timezone is not same between master and slave, your "
+ "slave may get wrong data into timestamp columns");
+ }
else
{
/* Fatal error */
errmsg= "The slave I/O thread stops because a fatal error is encountered \
when it try to get the value of TIME_ZONE global variable from master.";
- err_code= mysql_errno(mysql);
sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
goto err;
}
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2779)
by knielsen@knielsen-hq.org 06 Dec '09
by knielsen@knielsen-hq.org 06 Dec '09
06 Dec '09
#At lp:maria
2779 knielsen(a)knielsen-hq.org 2009-12-06
Fix some compiler warnings.
Fix bad merge causing error when specifying test case in non-default suite for mysql-test-run.
Implement the ability to add extra flags and configure options when running BUILD/xxx scripts.
Improve unclear help text in mysql-test-run
modified:
BUILD/FINISH.sh
BUILD/SETUP.sh
extra/yassl/taocrypt/include/block.hpp
mysql-test/lib/mtr_cases.pm
mysql-test/mysql-test-run.pl
plugin/fulltext/plugin_example.c
vio/viosslfactories.c
per-file messages:
BUILD/FINISH.sh
Implement the ability to add extra flags and configure options when running BUILD/xxx scripts.
BUILD/SETUP.sh
Implement the ability to add extra flags and configure options when running BUILD/xxx scripts.
extra/yassl/taocrypt/include/block.hpp
Fix some compiler warnings.
mysql-test/lib/mtr_cases.pm
Fix bad merge causing error when specifying test case in non-default suite for mysql-test-run.
Also remove some non-essential differences to mysql version to simplify future merges.
mysql-test/mysql-test-run.pl
Improve help texts.
plugin/fulltext/plugin_example.c
Fix some compiler warnings.
vio/viosslfactories.c
Fix some compiler warnings.
=== modified file 'BUILD/FINISH.sh'
--- a/BUILD/FINISH.sh 2009-10-27 13:20:34 +0000
+++ b/BUILD/FINISH.sh 2009-12-06 17:34:54 +0000
@@ -1,6 +1,6 @@
-cflags="$c_warnings $extra_flags"
-cxxflags="$cxx_warnings $base_cxxflags $extra_flags"
-extra_configs="$extra_configs $local_infile_configs"
+cflags="$c_warnings $extra_flags $EXTRA_FLAGS $EXTRA_CFLAGS"
+cxxflags="$cxx_warnings $base_cxxflags $extra_flags $EXTRA_FLAGS $EXTRA_CXXFLAGS"
+extra_configs="$extra_configs $local_infile_configs $EXTRA_CONFIGS"
configure="./configure $base_configs $extra_configs"
commands="\
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh 2009-10-29 00:04:56 +0000
+++ b/BUILD/SETUP.sh 2009-12-06 17:34:54 +0000
@@ -34,6 +34,14 @@ parse_options()
full_debug="=full";;
--warning-mode=*)
warning_mode=`get_key_value "$1"`;;
+ --extra-flags=*)
+ EXTRA_FLAGS=`get_key_value "$1"`;;
+ --extra-cflags=*)
+ EXTRA_CFLAGS=`get_key_value "$1"`;;
+ --extra-cxxflags=*)
+ EXTRA_CXXFLAGS=`get_key_value "$1"`;;
+ --extra-configs=*)
+ EXTRA_CONFIGS=`get_key_value "$1"`;;
-c | --just-configure)
just_configure=1;;
-n | --just-print | --print)
=== modified file 'extra/yassl/taocrypt/include/block.hpp'
--- a/extra/yassl/taocrypt/include/block.hpp 2009-02-10 22:47:54 +0000
+++ b/extra/yassl/taocrypt/include/block.hpp 2009-12-06 17:34:54 +0000
@@ -167,7 +167,8 @@ public:
void CleanNew(word32 newSize)
{
New(newSize);
- memset(buffer_, 0, sz_ * sizeof(T));
+ if (sz_ > 0)
+ memset(buffer_, 0, sz_ * sizeof(T));
}
void New(word32 newSize)
=== modified file 'mysql-test/lib/mtr_cases.pm'
--- a/mysql-test/lib/mtr_cases.pm 2009-12-03 11:19:05 +0000
+++ b/mysql-test/lib/mtr_cases.pm 2009-12-06 17:34:54 +0000
@@ -101,7 +101,6 @@ sub init_pattern {
sub collect_test_cases ($$) {
my $suites= shift; # Semicolon separated list of test suites
- my %found_suites;
my $opt_cases= shift;
my $cases= []; # Array of hash(one hash for each testcase)
@@ -115,7 +114,6 @@ sub collect_test_cases ($$) {
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
"ha_innodb_plugin.sl"],
NOT_REQUIRED);
-
$do_innodb_plugin= ($::mysql_version_id >= 50100 &&
!(IS_WINDOWS && $::opt_embedded_server) &&
$lib_innodb_plugin);
@@ -123,7 +121,6 @@ sub collect_test_cases ($$) {
foreach my $suite (split(",", $suites))
{
push(@$cases, collect_one_suite($suite, $opt_cases));
- $found_suites{$suite}= 1;
last if $some_test_found;
}
@@ -136,12 +133,6 @@ sub collect_test_cases ($$) {
{
my $found= 0;
my ($sname, $tname, $extension)= split_testname($test_name_spec);
- if (defined($sname) && !defined($found_suites{$sname}))
- {
- $found_suites{$sname}= 1;
- push(@$cases, collect_one_suite($sname));
- }
-
foreach my $test ( @$cases )
{
# test->{name} is always in suite.name format
@@ -247,7 +238,7 @@ sub split_testname {
}
-sub collect_one_suite($)
+sub collect_one_suite
{
my $suite= shift; # Test suite name
my $opt_cases= shift;
@@ -767,7 +758,6 @@ sub process_opts_file {
}
}
-
##############################################################################
#
# Collect information about a single test case
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-12-03 11:34:11 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-12-06 17:34:54 +0000
@@ -5683,12 +5683,15 @@ Misc options
servers to exit before finishing the process
fast Run as fast as possible, dont't wait for servers
to shutdown etc.
- parallel=N Run tests in N parallel threads (default=1)
+ parallel=N Run tests in N parallel threads (default 1)
Use parallel=auto for auto-setting of N
repeat=N Run each test N number of times
- retry=N Retry tests that fail N times, limit number of failures
- to $opt_retry_failure
- retry-failure=N Limit number of retries for a failed test
+ retry=N Retry tests that fail up to N times (default $opt_retry).
+ Retries are also limited by the maximum number of
+ failures before stopping, set with the --retry-failure
+ option
+ retry-failure=N When using the --retry option to retry failed tests,
+ stop when N failures have occured (default $opt_retry_failure)
reorder Reorder tests to get fewer server restarts
help Get this help text
=== modified file 'plugin/fulltext/plugin_example.c'
--- a/plugin/fulltext/plugin_example.c 2007-04-26 19:26:04 +0000
+++ b/plugin/fulltext/plugin_example.c 2009-12-06 17:34:54 +0000
@@ -145,7 +145,7 @@ static int simple_parser_deinit(MYSQL_FT
the list of search terms when parsing a search string.
*/
-static void add_word(MYSQL_FTPARSER_PARAM *param, char *word, size_t len)
+static void add_word(MYSQL_FTPARSER_PARAM *param, const unsigned char *word, size_t len)
{
MYSQL_FTPARSER_BOOLEAN_INFO bool_info=
{ FT_TOKEN_WORD, 0, 0, 0, 0, ' ', 0 };
@@ -169,7 +169,7 @@ static void add_word(MYSQL_FTPARSER_PARA
static int simple_parser_parse(MYSQL_FTPARSER_PARAM *param)
{
- char *end, *start, *docend= param->doc + param->length;
+ const unsigned char *end, *start, *docend= param->doc + param->length;
number_of_calls++;
=== modified file 'vio/viosslfactories.c'
--- a/vio/viosslfactories.c 2009-10-27 13:20:34 +0000
+++ b/vio/viosslfactories.c 2009-12-06 17:34:54 +0000
@@ -19,7 +19,6 @@
static my_bool ssl_algorithms_added = FALSE;
static my_bool ssl_error_strings_loaded= FALSE;
-static int verify_depth = 0;
static unsigned char dh512_p[]=
{
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2779)
by Michael Widenius 06 Dec '09
by Michael Widenius 06 Dec '09
06 Dec '09
#At lp:maria based on revid:monty@askmonty.org-20091204151222-xq8zhmvtas511f91
2779 Michael Widenius 2009-12-06
Changed -1 row number in some warnings to 0
(-1 doesn't make sence as a row number and when doing insert / load data, first row is 1, so 0 is free to use)
modified:
mysql-test/r/warnings.result
mysql-test/suite/funcs_1/r/innodb_func_view.result
mysql-test/suite/funcs_1/r/memory_func_view.result
mysql-test/suite/funcs_1/r/myisam_func_view.result
mysql-test/t/warnings.test
sql/my_decimal.cc
sql/share/errmsg.txt
per-file messages:
mysql-test/r/warnings.result
Added test for warnings with row number
mysql-test/suite/funcs_1/r/innodb_func_view.result
Updated test results
mysql-test/suite/funcs_1/r/memory_func_view.result
Updated test results
mysql-test/suite/funcs_1/r/myisam_func_view.result
Updated test results
mysql-test/t/warnings.test
Added test for warnings with row numberAdded test for warnings with row number
sql/my_decimal.cc
Don't use -1 as row number
sql/share/errmsg.txt
Make row numbers unsigned
=== modified file 'mysql-test/r/warnings.result'
--- a/mysql-test/r/warnings.result 2009-09-10 08:49:49 +0000
+++ b/mysql-test/r/warnings.result 2009-12-06 17:26:12 +0000
@@ -319,3 +319,17 @@ SHOW ERRORS;
Level Code Message
Error 1051 Unknown table 't1'
End of 5.0 tests
+set sql_mode = default;
+select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t;
+CAST(a AS DECIMAL(13,5))
+0.00000
+Warnings:
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Warning 1292 Truncated incorrect DECIMAL value: ''
+create table t1 (a integer unsigned);
+insert into t1 values (1),(-1),(0),(-2);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 4
+drop table t1;
+End of 5.1 tests
=== modified file 'mysql-test/suite/funcs_1/r/innodb_func_view.result'
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result 2009-05-15 12:57:51 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result 2009-12-06 17:26:12 +0000
@@ -3372,9 +3372,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3389,9 +3389,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3408,11 +3408,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3430,11 +3430,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3454,9 +3454,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3471,9 +3471,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3490,11 +3490,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3510,11 +3510,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
DROP VIEW v1;
=== modified file 'mysql-test/suite/funcs_1/r/memory_func_view.result'
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result 2009-02-14 16:00:11 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result 2009-12-06 17:26:12 +0000
@@ -3373,9 +3373,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3390,9 +3390,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3409,11 +3409,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3431,11 +3431,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3455,9 +3455,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3472,9 +3472,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3491,11 +3491,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3511,11 +3511,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
DROP VIEW v1;
=== modified file 'mysql-test/suite/funcs_1/r/myisam_func_view.result'
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result 2009-02-14 16:00:11 +0000
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result 2009-12-06 17:26:12 +0000
@@ -3373,9 +3373,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3390,9 +3390,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3409,11 +3409,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3431,11 +3431,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@@ -3455,9 +3455,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3472,9 +3472,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
+Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@@ -3491,11 +3491,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3511,11 +3511,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
-Error 1366 Incorrect decimal value: '' for column '' at row -1
+Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
DROP VIEW v1;
=== modified file 'mysql-test/t/warnings.test'
--- a/mysql-test/t/warnings.test 2009-12-03 11:19:05 +0000
+++ b/mysql-test/t/warnings.test 2009-12-06 17:26:12 +0000
@@ -194,7 +194,6 @@ DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
DROP PROCEDURE sp3;
-
#
# Bug#30059: End-space truncation warnings are inconsistent or incorrect
#
@@ -235,3 +234,15 @@ DROP TABLE t1;
SHOW ERRORS;
--echo End of 5.0 tests
+
+#
+# Test warning with row numbers
+#
+
+set sql_mode = default;
+select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t;
+create table t1 (a integer unsigned);
+insert into t1 values (1),(-1),(0),(-2);
+drop table t1;
+
+--echo End of 5.1 tests
=== modified file 'sql/my_decimal.cc'
--- a/sql/my_decimal.cc 2008-11-27 11:33:04 +0000
+++ b/sql/my_decimal.cc 2009-12-06 17:26:12 +0000
@@ -38,7 +38,7 @@ int decimal_operation_results(int result
case E_DEC_TRUNCATED:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
- "", (long)-1);
+ "", (ulong) 0);
break;
case E_DEC_OVERFLOW:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
@@ -54,7 +54,7 @@ int decimal_operation_results(int result
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
- "decimal", "", "", (long)-1);
+ "decimal", "", "", (ulong) 0);
break;
case E_DEC_OOM:
my_error(ER_OUT_OF_RESOURCES, MYF(0));
=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt 2009-12-04 15:12:22 +0000
+++ b/sql/share/errmsg.txt 2009-12-06 17:26:12 +0000
@@ -3173,22 +3173,22 @@ ER_CANT_CREATE_THREAD
swe "Kan inte skapa en ny tr�d (errno %d)"
ukr "�� ���� �������� ���� ����� (������� %d). ���� �� �� ����������� ��� ���'���, �� ���������� ������������ �� ����� �� - ������� �� ������� ��"
ER_WRONG_VALUE_COUNT_ON_ROW 21S01
- cze "Po-B�et sloupc� neodpov�d� po�tu hodnot na ��dku %ld"
- dan "Kolonne antallet stemmer ikke overens med antallet af v�rdier i post %ld"
- nla "Kolom aantal komt niet overeen met waarde aantal in rij %ld"
- eng "Column count doesn't match value count at row %ld"
- est "Tulpade hulk erineb v��rtuste hulgast real %ld"
- ger "Anzahl der Felder stimmt nicht mit der Anzahl der Werte in Zeile %ld �berein"
- hun "Az oszlopban talalhato ertek nem egyezik meg a %ld sorban szamitott ertekkel"
- ita "Il numero delle colonne non corrisponde al conteggio alla riga %ld"
- kor "Row %ld���� ���� �������� value �������� �������� ��������."
- por "Contagem de colunas n�o confere com a contagem de valores na linha %ld"
- rum "Numarul de coloane nu corespunde cu numarul de valori la linia %ld"
- rus "���������� �������� �� ��������� � ����������� �������� � ������ %ld"
- serbian "Broj kolona ne odgovara broju vrednosti u slogu %ld"
- spa "El n�mero de columnas no corresponde al n�mero en la l�nea %ld"
- swe "Antalet kolumner motsvarar inte antalet v�rden p� rad: %ld"
- ukr "��������� �������� �� ��������� � ��������� ������� � ������ %ld"
+ cze "Po-B�et sloupc� neodpov�d� po�tu hodnot na ��dku %lu"
+ dan "Kolonne antallet stemmer ikke overens med antallet af v�rdier i post %lu"
+ nla "Kolom aantal komt niet overeen met waarde aantal in rij %lu"
+ eng "Column count doesn't match value count at row %lu"
+ est "Tulpade hulk erineb v��rtuste hulgast real %lu"
+ ger "Anzahl der Felder stimmt nicht mit der Anzahl der Werte in Zeile %lu �berein"
+ hun "Az oszlopban talalhato ertek nem egyezik meg a %lu sorban szamitott ertekkel"
+ ita "Il numero delle colonne non corrisponde al conteggio alla riga %lu"
+ kor "Row %lu���� ���� �������� value �������� �������� ��������."
+ por "Contagem de colunas n�o confere com a contagem de valores na linha %lu"
+ rum "Numarul de coloane nu corespunde cu numarul de valori la linia %lu"
+ rus "���������� �������� �� ��������� � ����������� �������� � ������ %lu"
+ serbian "Broj kolona ne odgovara broju vrednosti u slogu %lu"
+ spa "El n�mero de columnas no corresponde al n�mero en la l�nea %lu"
+ swe "Antalet kolumner motsvarar inte antalet v�rden p� rad: %lu"
+ ukr "��������� �������� �� ��������� � ��������� ������� � ������ %lu"
ER_CANT_REOPEN_TABLE
cze "Nemohu znovuotev-B��t tabulku: '%-.192s"
dan "Kan ikke gen�bne tabel '%-.192s"
@@ -4887,29 +4887,29 @@ ER_CUT_VALUE_GROUP_CONCAT
swe "%d rad(er) kapades av group_concat()"
ukr "%d line(s) was(were) cut by group_concat()"
ER_WARN_TOO_FEW_RECORDS 01000
- eng "Row %ld doesn't contain data for all columns"
- ger "Zeile %ld enth�lt nicht f�r alle Felder Daten"
- nla "Rij %ld bevat niet de data voor alle kolommen"
- por "Conta de registro � menor que a conta de coluna na linha %ld"
- spa "L�nea %ld no contiene datos para todas las columnas"
+ eng "Row %lu doesn't contain data for all columns"
+ ger "Zeile %lu enth�lt nicht f�r alle Felder Daten"
+ nla "Rij %lu bevat niet de data voor alle kolommen"
+ por "Conta de registro � menor que a conta de coluna na linha %lu"
+ spa "L�nea %lu no contiene datos para todas las columnas"
ER_WARN_TOO_MANY_RECORDS 01000
- eng "Row %ld was truncated; it contained more data than there were input columns"
- ger "Zeile %ld gek�rzt, die Zeile enthielt mehr Daten, als es Eingabefelder gibt"
- nla "Regel %ld ingekort, bevatte meer data dan invoer kolommen"
- por "Conta de registro � maior que a conta de coluna na linha %ld"
- spa "L�nea %ld fu� truncada; La misma contine mas datos que las que existen en las columnas de entrada"
+ eng "Row %lu was truncated; it contained more data than there were input columns"
+ ger "Zeile %lu gek�rzt, die Zeile enthielt mehr Daten, als es Eingabefelder gibt"
+ nla "Regel %lu ingekort, bevatte meer data dan invoer kolommen"
+ por "Conta de registro � maior que a conta de coluna na linha %lu"
+ spa "L�nea %lu fu� truncada; La misma contine mas datos que las que existen en las columnas de entrada"
ER_WARN_NULL_TO_NOTNULL 22004
- eng "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld"
- ger "Feld auf Vorgabewert gesetzt, da NULL f�r NOT-NULL-Feld '%s' in Zeile %ld angegeben"
- por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %ld"
- spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la l�nea %ld"
+ eng "Column set to default value; NULL supplied to NOT NULL column '%s' at row %lu"
+ ger "Feld auf Vorgabewert gesetzt, da NULL f�r NOT-NULL-Feld '%s' in Zeile %lu angegeben"
+ por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %lu"
+ spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la l�nea %lu"
ER_WARN_DATA_OUT_OF_RANGE 22003
- eng "Out of range value for column '%s' at row %ld"
+ eng "Out of range value for column '%s' at row %lu"
WARN_DATA_TRUNCATED 01000
- eng "Data truncated for column '%s' at row %ld"
- ger "Daten abgeschnitten f�r Feld '%s' in Zeile %ld"
- por "Dado truncado para coluna '%s' na linha %ld"
- spa "Datos truncados para columna '%s' en la l�nea %ld"
+ eng "Data truncated for column '%s' at row %lu"
+ ger "Daten abgeschnitten f�r Feld '%s' in Zeile %lu"
+ por "Dado truncado para coluna '%s' na linha %lu"
+ spa "Datos truncados para columna '%s' en la l�nea %lu"
ER_WARN_USING_OTHER_HANDLER
eng "Using storage engine %s for table '%s'"
ger "F�r Tabelle '%s' wird Speicher-Engine %s benutzt"
@@ -5090,8 +5090,8 @@ ER_UNKNOWN_TIME_ZONE
eng "Unknown or incorrect time zone: '%-.64s'"
ger "Unbekannte oder falsche Zeitzone: '%-.64s'"
ER_WARN_INVALID_TIMESTAMP
- eng "Invalid TIMESTAMP value in column '%s' at row %ld"
- ger "Ung�ltiger TIMESTAMP-Wert in Feld '%s', Zeile %ld"
+ eng "Invalid TIMESTAMP value in column '%s' at row %lu"
+ ger "Ung�ltiger TIMESTAMP-Wert in Feld '%s', Zeile %lu"
ER_INVALID_CHARACTER_STRING
eng "Invalid %s character string: '%.64s'"
ger "Ung�ltiger %s-Zeichen-String: '%.64s'"
@@ -5456,8 +5456,8 @@ ER_PROC_AUTO_REVOKE_FAIL
eng "Failed to revoke all privileges to dropped routine"
ger "R�cknahme aller Rechte f�r die gel�schte Routine fehlgeschlagen"
ER_DATA_TOO_LONG 22001
- eng "Data too long for column '%s' at row %ld"
- ger "Daten zu lang f�r Feld '%s' in Zeile %ld"
+ eng "Data too long for column '%s' at row %lu"
+ ger "Daten zu lang f�r Feld '%s' in Zeile %lu"
ER_SP_BAD_SQLSTATE 42000
eng "Bad SQLSTATE: '%s'"
ger "Ung�ltiger SQLSTATE: '%s'"
1
0
[Maria-developers] Updated (by Timour): Subquery optimization: Efficient NOT IN execution with NULLs (68)
by worklog-noreply@askmonty.org 06 Dec '09
by worklog-noreply@askmonty.org 06 Dec '09
06 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Efficient NOT IN execution with NULLs
CREATION DATE..: Fri, 27 Nov 2009, 13:22
SUPERVISOR.....: Monty
IMPLEMENTOR....: Timour
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 68 (http://askmonty.org/worklog/?tid=68)
VERSION........: Server-9.x
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Timour - Sun, 06 Dec 2009, 14:36)=-=-
High-Level Specification modified.
--- /tmp/wklog.68.old.12919 2009-12-06 14:36:18.000000000 +0200
+++ /tmp/wklog.68.new.12919 2009-12-06 14:36:18.000000000 +0200
@@ -87,3 +87,8 @@
7. If you get a row with nulls in all columns stop filling the temporary
table and return UNKNOWN for any tuple <v1,...,vn>.
+8. [timour]
+ Consider that due to materialization, we already have a unique index
+on all columns <a_1,..., a_n>. We can use the first key part of this index
+over column a_1, instead of the index rowid{a_i=v_i}. Thus we can avoid
+creating the index rowid{a_i=v_i}.
-=-=(Timour - Fri, 04 Dec 2009, 14:04)=-=-
High-Level Specification modified.
--- /tmp/wklog.68.old.16724 2009-12-04 14:04:28.000000000 +0200
+++ /tmp/wklog.68.new.16724 2009-12-04 14:04:28.000000000 +0200
@@ -10,7 +10,8 @@
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
+ (2) For each i: rowid{a_i is null} is the same for each tuple,
+ that is, this set is independent of the left-side tuples.
Due to (2) it makes sense to build rowid{a_i is null} only once.
A good representation for such sets would be bitmaps:
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Version updated.
--- /tmp/wklog.68.old.5257 2009-12-04 11:27:11.000000000 +0200
+++ /tmp/wklog.68.new.5257 2009-12-04 11:27:11.000000000 +0200
@@ -1 +1 @@
-Benchmarks-3.0
+Server-9.x
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Category updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Status updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(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,
that is, this set is independent of the left-side tuples.
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>.
8. [timour]
Consider that due to materialization, we already have a unique index
on all columns <a_1,..., a_n>. We can use the first key part of this index
over column a_1, instead of the index rowid{a_i=v_i}. Thus we can avoid
creating the index rowid{a_i=v_i}.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Timour): Subquery optimization: Efficient NOT IN execution with NULLs (68)
by worklog-noreply@askmonty.org 06 Dec '09
by worklog-noreply@askmonty.org 06 Dec '09
06 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Efficient NOT IN execution with NULLs
CREATION DATE..: Fri, 27 Nov 2009, 13:22
SUPERVISOR.....: Monty
IMPLEMENTOR....: Timour
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 68 (http://askmonty.org/worklog/?tid=68)
VERSION........: Server-9.x
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Timour - Sun, 06 Dec 2009, 14:36)=-=-
High-Level Specification modified.
--- /tmp/wklog.68.old.12919 2009-12-06 14:36:18.000000000 +0200
+++ /tmp/wklog.68.new.12919 2009-12-06 14:36:18.000000000 +0200
@@ -87,3 +87,8 @@
7. If you get a row with nulls in all columns stop filling the temporary
table and return UNKNOWN for any tuple <v1,...,vn>.
+8. [timour]
+ Consider that due to materialization, we already have a unique index
+on all columns <a_1,..., a_n>. We can use the first key part of this index
+over column a_1, instead of the index rowid{a_i=v_i}. Thus we can avoid
+creating the index rowid{a_i=v_i}.
-=-=(Timour - Fri, 04 Dec 2009, 14:04)=-=-
High-Level Specification modified.
--- /tmp/wklog.68.old.16724 2009-12-04 14:04:28.000000000 +0200
+++ /tmp/wklog.68.new.16724 2009-12-04 14:04:28.000000000 +0200
@@ -10,7 +10,8 @@
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
+ (2) For each i: rowid{a_i is null} is the same for each tuple,
+ that is, this set is independent of the left-side tuples.
Due to (2) it makes sense to build rowid{a_i is null} only once.
A good representation for such sets would be bitmaps:
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Version updated.
--- /tmp/wklog.68.old.5257 2009-12-04 11:27:11.000000000 +0200
+++ /tmp/wklog.68.new.5257 2009-12-04 11:27:11.000000000 +0200
@@ -1 +1 @@
-Benchmarks-3.0
+Server-9.x
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Category updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Status updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(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,
that is, this set is independent of the left-side tuples.
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>.
8. [timour]
Consider that due to materialization, we already have a unique index
on all columns <a_1,..., a_n>. We can use the first key part of this index
over column a_1, instead of the index rowid{a_i=v_i}. Thus we can avoid
creating the index rowid{a_i=v_i}.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2777)
by Michael Widenius 04 Dec '09
by Michael Widenius 04 Dec '09
04 Dec '09
#At lp:maria based on revid:monty@askmonty.org-20091203120237-g7oekcuv6emhor1z
2777 Michael Widenius 2009-12-03
Ensure that mysql_get_server_version() also works if there is a non numerical prefix before the version number
modified:
sql-common/client.c
=== modified file 'sql-common/client.c'
--- a/sql-common/client.c 2009-12-03 11:19:05 +0000
+++ b/sql-common/client.c 2009-12-03 15:26:54 +0000
@@ -3208,7 +3208,7 @@ const char * STDCALL mysql_error(MYSQL *
mysql Connection
EXAMPLE
- 4.1.0-alfa -> 40100
+ MariaDB-4.1.0-alfa -> 40100
NOTES
We will ensure that a newer server always has a bigger number.
@@ -3221,7 +3221,11 @@ ulong STDCALL
mysql_get_server_version(MYSQL *mysql)
{
uint major, minor, version;
- char *pos= mysql->server_version, *end_pos;
+ const char *pos= mysql->server_version;
+ char *end_pos;
+ /* Skip possible prefix */
+ while (*pos && !my_isdigit(&my_charset_latin1, *pos))
+ pos++;
major= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
minor= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
version= (uint) strtoul(pos, &end_pos, 10);
2
1
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2778: Fixed Bug#47017 rpl_timezone fails on PB-2 with mismatch error
by noreply@launchpad.net 04 Dec '09
by noreply@launchpad.net 04 Dec '09
04 Dec '09
------------------------------------------------------------
revno: 2778
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Fri 2009-12-04 17:12:22 +0200
message:
Fixed Bug#47017 rpl_timezone fails on PB-2 with mismatch error
Fixed coredump in sql_plugin.cc:intern_plugin_lock() on mysqld start with PBXT
modified:
sql/mysqld.cc
sql/share/errmsg.txt
sql/sql_base.cc
sql/sql_class.cc
sql/sql_insert.cc
--
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 2777: Ensure that mysql_get_server_version() also works if there is a non numerical prefix before the v...
by noreply@launchpad.net 04 Dec '09
by noreply@launchpad.net 04 Dec '09
04 Dec '09
------------------------------------------------------------
revno: 2777
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Thu 2009-12-03 17:26:54 +0200
message:
Ensure that mysql_get_server_version() also works if there is a non numerical prefix before the version number
modified:
sql-common/client.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] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2778) Bug#47017
by Michael Widenius 04 Dec '09
by Michael Widenius 04 Dec '09
04 Dec '09
#At lp:maria based on revid:monty@askmonty.org-20091203152654-839losfiuarve9w5
2778 Michael Widenius 2009-12-04
Fixed Bug#47017 rpl_timezone fails on PB-2 with mismatch error
Fixed coredump in sql_plugin.cc:intern_plugin_lock() on mysqld start with PBXT
modified:
sql/mysqld.cc
sql/share/errmsg.txt
sql/sql_base.cc
sql/sql_class.cc
sql/sql_insert.cc
per-file messages:
sql/mysqld.cc
Fixed coredump in sql_plugin.cc:intern_plugin_lock() on mysqld start with PBXT
sql/share/errmsg.txt
Row numbers are always positive
sql/sql_base.cc
Fixed race condition in lock tables when killing insert_delayed thread.
This fixes Bug#47017 rpl_timezone fails on PB-2 with mismatch error
(Note that the patch only adds a continue; The rest is (required) indentation changes)
sql/sql_class.cc
Fixed wrong output for high end machines in outfile_loaddata.
(Problem was that ER_TRUNCATED_WRONG_VALUE_FOR_FIELD expects ulong, not ulonglong)
sql/sql_insert.cc
Ensure that if we get a lock problem with delayed_insert, the error is logged.
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-12-03 11:34:11 +0000
+++ b/sql/mysqld.cc 2009-12-04 15:12:22 +0000
@@ -4169,8 +4169,10 @@ server.");
Need to unlock as global_system_variables.table_plugin
was acquired during plugin_init()
*/
+ pthread_mutex_lock(&LOCK_global_system_variables);
plugin_unlock(0, global_system_variables.table_plugin);
global_system_variables.table_plugin= plugin;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
}
}
#if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)
=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt 2009-12-03 11:19:05 +0000
+++ b/sql/share/errmsg.txt 2009-12-04 15:12:22 +0000
@@ -5322,8 +5322,8 @@ ER_DIVISION_BY_ZERO 22012
eng "Division by 0"
ger "Division durch 0"
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
- eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %ld"
- ger "Falscher %-.32s-Wert: '%-.128s' f�r Feld '%.192s' in Zeile %ld"
+ eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %lu"
+ ger "Falscher %-.32s-Wert: '%-.128s' f�r Feld '%.192s' in Zeile %lu"
ER_ILLEGAL_VALUE_FOR_TYPE 22007
eng "Illegal %s '%-.192s' value found during parsing"
ger "Nicht zul�ssiger %s-Wert '%-.192s' beim Parsen gefunden"
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2009-12-03 11:34:11 +0000
+++ b/sql/sql_base.cc 2009-12-04 15:12:22 +0000
@@ -8488,19 +8488,26 @@ bool remove_table_from_cache(THD *thd, c
result=1;
}
/* Kill delayed insert threads */
- if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
- ! in_use->killed)
+ if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT))
{
- in_use->killed= THD::KILL_CONNECTION;
- pthread_mutex_lock(&in_use->mysys_var->mutex);
- if (in_use->mysys_var->current_cond)
- {
- pthread_mutex_lock(in_use->mysys_var->current_mutex);
- signalled= 1;
- pthread_cond_broadcast(in_use->mysys_var->current_cond);
- pthread_mutex_unlock(in_use->mysys_var->current_mutex);
- }
- pthread_mutex_unlock(&in_use->mysys_var->mutex);
+ if (!in_use->killed)
+ {
+ in_use->killed= THD::KILL_CONNECTION;
+ pthread_mutex_lock(&in_use->mysys_var->mutex);
+ if (in_use->mysys_var->current_cond)
+ {
+ pthread_mutex_lock(in_use->mysys_var->current_mutex);
+ signalled= 1;
+ pthread_cond_broadcast(in_use->mysys_var->current_cond);
+ pthread_mutex_unlock(in_use->mysys_var->current_mutex);
+ }
+ pthread_mutex_unlock(&in_use->mysys_var->mutex);
+ }
+ /*
+ Don't abort locks. Instead give the delayed insert thread
+ time to finish it's inserts and die gracefully.
+ */
+ continue;
}
/*
Now we must abort all tables locks used by this thread
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2009-12-03 11:34:11 +0000
+++ b/sql/sql_class.cc 2009-12-04 15:12:22 +0000
@@ -2046,7 +2046,7 @@ bool select_export::send_data(List<Item>
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"string", printable_buff,
- item->name, row_count);
+ item->name, (ulong) row_count);
}
cvt_str.length(bytes);
res= &cvt_str;
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2009-12-03 11:34:11 +0000
+++ b/sql/sql_insert.cc 2009-12-04 15:12:22 +0000
@@ -2618,7 +2618,7 @@ bool Delayed_insert::handle_inserts(void
or if another thread is removing the current table definition
from the table cache.
*/
- my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR),
+ my_error(ER_DELAYED_CANT_CHANGE_LOCK, MYF(ME_FATALERROR | ME_NOREFRESH),
table->s->table_name.str);
goto err;
}
@@ -2791,10 +2791,11 @@ bool Delayed_insert::handle_inserts(void
query_cache_invalidate3(&thd, table, 1);
if (thr_reschedule_write_lock(*thd.lock->locks))
{
- /* This is not known to happen. */
- my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR),
- table->s->table_name.str);
- goto err;
+ /* This is not known to happen. */
+ my_error(ER_DELAYED_CANT_CHANGE_LOCK,
+ MYF(ME_FATALERROR | ME_NOREFRESH),
+ table->s->table_name.str);
+ goto err;
}
if (!using_bin_log)
table->file->extra(HA_EXTRA_WRITE_CACHE);
1
0
[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....: Timour
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 68 (http://askmonty.org/worklog/?tid=68)
VERSION........: Server-9.x
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Timour - Fri, 04 Dec 2009, 14:04)=-=-
High-Level Specification modified.
--- /tmp/wklog.68.old.16724 2009-12-04 14:04:28.000000000 +0200
+++ /tmp/wklog.68.new.16724 2009-12-04 14:04:28.000000000 +0200
@@ -10,7 +10,8 @@
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
+ (2) For each i: rowid{a_i is null} is the same for each tuple,
+ that is, this set is independent of the left-side tuples.
Due to (2) it makes sense to build rowid{a_i is null} only once.
A good representation for such sets would be bitmaps:
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Version updated.
--- /tmp/wklog.68.old.5257 2009-12-04 11:27:11.000000000 +0200
+++ /tmp/wklog.68.new.5257 2009-12-04 11:27:11.000000000 +0200
@@ -1 +1 @@
-Benchmarks-3.0
+Server-9.x
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Category updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Status updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(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,
that is, this set is independent of the left-side tuples.
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] 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....: Timour
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 68 (http://askmonty.org/worklog/?tid=68)
VERSION........: Server-9.x
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Timour - Fri, 04 Dec 2009, 14:04)=-=-
High-Level Specification modified.
--- /tmp/wklog.68.old.16724 2009-12-04 14:04:28.000000000 +0200
+++ /tmp/wklog.68.new.16724 2009-12-04 14:04:28.000000000 +0200
@@ -10,7 +10,8 @@
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
+ (2) For each i: rowid{a_i is null} is the same for each tuple,
+ that is, this set is independent of the left-side tuples.
Due to (2) it makes sense to build rowid{a_i is null} only once.
A good representation for such sets would be bitmaps:
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Version updated.
--- /tmp/wklog.68.old.5257 2009-12-04 11:27:11.000000000 +0200
+++ /tmp/wklog.68.new.5257 2009-12-04 11:27:11.000000000 +0200
@@ -1 +1 @@
-Benchmarks-3.0
+Server-9.x
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Category updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Status updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(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,
that is, this set is independent of the left-side tuples.
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] Updated (by Sanja): Add info to engine description (61)
by worklog-noreply@askmonty.org 04 Dec '09
by worklog-noreply@askmonty.org 04 Dec '09
04 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add info to engine description
CREATION DATE..: Mon, 02 Nov 2009, 22:58
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 61 (http://askmonty.org/worklog/?tid=61)
VERSION........: Server-5.1
STATUS.........: Code-Review
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 5 (hours remain)
ORIG. ESTIMATE.: 5
PROGRESS NOTES:
-=-=(Sanja - Fri, 04 Dec 2009, 13:50)=-=-
Status updated.
--- /tmp/wklog.61.old.16175 2009-12-04 13:50:12.000000000 +0200
+++ /tmp/wklog.61.new.16175 2009-12-04 13:50:12.000000000 +0200
@@ -1 +1 @@
-Assigned
+Code-Review
-=-=(Sanja - Fri, 20 Nov 2009, 00:18)=-=-
High-Level Specification modified.
--- /tmp/wklog.61.old.19932 2009-11-20 00:18:57.000000000 +0200
+++ /tmp/wklog.61.new.19932 2009-11-20 00:18:57.000000000 +0200
@@ -1 +1,9 @@
+There is two time of engines/plugins build in and loadable. For both we add
+structure with additional information
+1) for build in we will modify MYSQL_PLUGIN_STATIC to collect that strucures in
+array also with builtin_*_plugin structures.
+
+2) for dinamic plugins we check in plugin_dl_add() if the pligin defins maria
+simbols we read info in if no then fill maturety with UNKNOWN and version with
+empty string.
-=-=(Sanja - Thu, 19 Nov 2009, 23:56)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.19057 2009-11-19 23:56:48.000000000 +0200
+++ /tmp/wklog.61.new.19057 2009-11-19 23:56:48.000000000 +0200
@@ -1,8 +1,6 @@
-Add additional information about engine and show it in SHOW ENGINES:
+Add additional information about engine and show it in information schema:
-License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
-
-Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
+Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
-=-=(Hakan - Thu, 05 Nov 2009, 21:09)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.22402 2009-11-05 21:09:08.000000000 +0200
+++ /tmp/wklog.61.new.22402 2009-11-05 21:09:08.000000000 +0200
@@ -1,8 +1,8 @@
Add additional information about engine and show it in SHOW ENGINES:
-License (PROPRIETARY, GPL, BSD) (it is present just have to be shown)
+License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
-Version (just string from engine developer like "0.99 betta", better if it will
+Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
DESCRIPTION:
Add additional information about engine and show it in information schema:
Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
HIGH-LEVEL SPECIFICATION:
There is two time of engines/plugins build in and loadable. For both we add
structure with additional information
1) for build in we will modify MYSQL_PLUGIN_STATIC to collect that strucures in
array also with builtin_*_plugin structures.
2) for dinamic plugins we check in plugin_dl_add() if the pligin defins maria
simbols we read info in if no then fill maturety with UNKNOWN and version with
empty string.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Sanja): Add info to engine description (61)
by worklog-noreply@askmonty.org 04 Dec '09
by worklog-noreply@askmonty.org 04 Dec '09
04 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add info to engine description
CREATION DATE..: Mon, 02 Nov 2009, 22:58
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 61 (http://askmonty.org/worklog/?tid=61)
VERSION........: Server-5.1
STATUS.........: Code-Review
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 5 (hours remain)
ORIG. ESTIMATE.: 5
PROGRESS NOTES:
-=-=(Sanja - Fri, 04 Dec 2009, 13:50)=-=-
Status updated.
--- /tmp/wklog.61.old.16175 2009-12-04 13:50:12.000000000 +0200
+++ /tmp/wklog.61.new.16175 2009-12-04 13:50:12.000000000 +0200
@@ -1 +1 @@
-Assigned
+Code-Review
-=-=(Sanja - Fri, 20 Nov 2009, 00:18)=-=-
High-Level Specification modified.
--- /tmp/wklog.61.old.19932 2009-11-20 00:18:57.000000000 +0200
+++ /tmp/wklog.61.new.19932 2009-11-20 00:18:57.000000000 +0200
@@ -1 +1,9 @@
+There is two time of engines/plugins build in and loadable. For both we add
+structure with additional information
+1) for build in we will modify MYSQL_PLUGIN_STATIC to collect that strucures in
+array also with builtin_*_plugin structures.
+
+2) for dinamic plugins we check in plugin_dl_add() if the pligin defins maria
+simbols we read info in if no then fill maturety with UNKNOWN and version with
+empty string.
-=-=(Sanja - Thu, 19 Nov 2009, 23:56)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.19057 2009-11-19 23:56:48.000000000 +0200
+++ /tmp/wklog.61.new.19057 2009-11-19 23:56:48.000000000 +0200
@@ -1,8 +1,6 @@
-Add additional information about engine and show it in SHOW ENGINES:
+Add additional information about engine and show it in information schema:
-License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
-
-Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
+Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
-=-=(Hakan - Thu, 05 Nov 2009, 21:09)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.22402 2009-11-05 21:09:08.000000000 +0200
+++ /tmp/wklog.61.new.22402 2009-11-05 21:09:08.000000000 +0200
@@ -1,8 +1,8 @@
Add additional information about engine and show it in SHOW ENGINES:
-License (PROPRIETARY, GPL, BSD) (it is present just have to be shown)
+License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
-Version (just string from engine developer like "0.99 betta", better if it will
+Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
DESCRIPTION:
Add additional information about engine and show it in information schema:
Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
HIGH-LEVEL SPECIFICATION:
There is two time of engines/plugins build in and loadable. For both we add
structure with additional information
1) for build in we will modify MYSQL_PLUGIN_STATIC to collect that strucures in
array also with builtin_*_plugin structures.
2) for dinamic plugins we check in plugin_dl_add() if the pligin defins maria
simbols we read info in if no then fill maturety with UNKNOWN and version with
empty string.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 04 Dec '09
by worklog-noreply@askmonty.org 04 Dec '09
04 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 04 Dec '09
by worklog-noreply@askmonty.org 04 Dec '09
04 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 04 Dec '09
by worklog-noreply@askmonty.org 04 Dec '09
04 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[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....: Timour
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 68 (http://askmonty.org/worklog/?tid=68)
VERSION........: Server-9.x
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Version updated.
--- /tmp/wklog.68.old.5257 2009-12-04 11:27:11.000000000 +0200
+++ /tmp/wklog.68.new.5257 2009-12-04 11:27:11.000000000 +0200
@@ -1 +1 @@
-Benchmarks-3.0
+Server-9.x
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Category updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Status updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(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] 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....: Timour
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 68 (http://askmonty.org/worklog/?tid=68)
VERSION........: Server-9.x
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Version updated.
--- /tmp/wklog.68.old.5257 2009-12-04 11:27:11.000000000 +0200
+++ /tmp/wklog.68.new.5257 2009-12-04 11:27:11.000000000 +0200
@@ -1 +1 @@
-Benchmarks-3.0
+Server-9.x
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Category updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Status updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(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] 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....: Timour
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 68 (http://askmonty.org/worklog/?tid=68)
VERSION........: Benchmarks-3.0
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Category updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Status updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(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] 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....: Timour
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 68 (http://askmonty.org/worklog/?tid=68)
VERSION........: Benchmarks-3.0
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Category updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Timour - Fri, 04 Dec 2009, 11:27)=-=-
Status updated.
--- /tmp/wklog.68.old.5242 2009-12-04 11:27:02.000000000 +0200
+++ /tmp/wklog.68.new.5242 2009-12-04 11:27:02.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(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] 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] 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
Re: [Maria-developers] [Merge] lp:~paul-mccullagh/maria/maria-pbxt-rc3 into lp:maria
by Sergei Golubchik 02 Dec '09
by Sergei Golubchik 02 Dec '09
02 Dec '09
Hi, Paul!
On Dec 02, Paul McCullagh wrote:
> On Dec 2, 2009, at 2:46 PM, Paul McCullagh wrote:
>>
>> I have tested this, and it all works as you specified, but now I have
>> found a problem with PBXT.
>>
>> The problem stems from code in PBXT (in functions ha_pbxt::write_row,
>> ha_pbxt::update_row, ha_pbxt::delete_row) which I have pasted below.
>> The code is a hack!
...
>> I noticed that InnoDB and NDB call trans_register_ha()
>> unconditionally at the start of a statement.
>>
>> Could it be that the problem that lead to my "hack" has been fixed?
>
> Just doing some testing, and it looks like the problem has been fixed,
> so I can remove my hack ... :)
Great!
Yes, I vaguely remember that there were changes that could've had fixed
that. I'd need to check the code to be sure, but as you say it works...
:)
Regards / Mit vielen Grüßen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg(a)sun.com>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring
1
0
Re: [Maria-developers] [Merge] lp:~paul-mccullagh/maria/maria-pbxt-rc3 into lp:maria
by Sergei Golubchik 02 Dec '09
by Sergei Golubchik 02 Dec '09
02 Dec '09
Hi, Paul!
On Dec 01, Paul McCullagh wrote:
>
> This patch changes MariaDB code in one case:
>
> File handler.cc, Line 1591
>
> DBUG_ASSERT(total_ha_2pc == (ulong) opt_bin_log+1); // only InnoDB and binlog
>
> This line has been commented out, because the assertions fails now
> that PBXT supports XA.
>
> Although this assertion implies that not everything will work, I have
> not found any problem with the stability of MySQL due to the addition
> of PBXT XA.
Eh, no, not exactly. This assertion was to make sure that the ifdef'ed
code only runs when InnoDB is the only XA-capable engine.
As it's no longer the case, you need to remove the whole ifdef block,
not only the assert.
> PBXT XA can be disabled by setting pbxt_support_xa=0, it is enabled by
> default.
>
Regards / Mit vielen Grüßen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg(a)sun.com>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring
3
7
[Maria-developers] Rev 2733: Remove compiler warning: always use literal string for printf-format line. in file:///home/psergey/dev/maria-5.2/
by Sergey Petrunya 02 Dec '09
by Sergey Petrunya 02 Dec '09
02 Dec '09
At file:///home/psergey/dev/maria-5.2/
------------------------------------------------------------
revno: 2733
revision-id: psergey(a)askmonty.org-20091202142609-18bp41q8mejxl47t
parent: igor(a)askmonty.org-20091112043128-yd6odg8zr5ribjal
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.2
timestamp: Wed 2009-12-02 16:26:09 +0200
message:
Remove compiler warning: always use literal string for printf-format line.
=== modified file 'sql/item.h'
--- a/sql/item.h 2009-11-10 02:32:39 +0000
+++ b/sql/item.h 2009-12-02 14:26:09 +0000
@@ -25,7 +25,7 @@
sprintf(buff, "%s::%s", where, processor_name);
DBUG_ENTER(buff);
sprintf(buff, "%s returns TRUE: unsupported function", processor_name);
- DBUG_PRINT("info", (buff));
+ DBUG_PRINT("info", ("%s", buff));
DBUG_RETURN(TRUE);
}
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 14:19:34 +0000
@@ -3112,8 +3112,17 @@ 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 = REF_MYSQL_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 = 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--;
}
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2775)
by knielsen@knielsen-hq.org 02 Dec '09
by knielsen@knielsen-hq.org 02 Dec '09
02 Dec '09
#At lp:maria
2775 knielsen(a)knielsen-hq.org 2009-12-02 [merge]
Merge PBXT 1.0.09f RC3 into MariaDB.
added:
storage/pbxt/src/backup_xt.cc
storage/pbxt/src/backup_xt.h
modified:
sql/handler.cc
storage/pbxt/ChangeLog
storage/pbxt/src/Makefile.am
storage/pbxt/src/cache_xt.cc
storage/pbxt/src/cache_xt.h
storage/pbxt/src/database_xt.cc
storage/pbxt/src/database_xt.h
storage/pbxt/src/datadic_xt.cc
storage/pbxt/src/datalog_xt.cc
storage/pbxt/src/discover_xt.cc
storage/pbxt/src/filesys_xt.cc
storage/pbxt/src/filesys_xt.h
storage/pbxt/src/ha_pbxt.cc
storage/pbxt/src/ha_pbxt.h
storage/pbxt/src/ha_xtsys.h
storage/pbxt/src/heap_xt.cc
storage/pbxt/src/index_xt.cc
storage/pbxt/src/lock_xt.cc
storage/pbxt/src/locklist_xt.h
storage/pbxt/src/memory_xt.cc
storage/pbxt/src/myxt_xt.cc
storage/pbxt/src/myxt_xt.h
storage/pbxt/src/pbms.h
storage/pbxt/src/pbms_enabled.cc
storage/pbxt/src/pbms_enabled.h
storage/pbxt/src/pthread_xt.cc
storage/pbxt/src/restart_xt.cc
storage/pbxt/src/restart_xt.h
storage/pbxt/src/strutil_xt.cc
storage/pbxt/src/systab_xt.cc
storage/pbxt/src/tabcache_xt.cc
storage/pbxt/src/tabcache_xt.h
storage/pbxt/src/table_xt.cc
storage/pbxt/src/table_xt.h
storage/pbxt/src/thread_xt.cc
storage/pbxt/src/thread_xt.h
storage/pbxt/src/util_xt.cc
storage/pbxt/src/util_xt.h
storage/pbxt/src/xaction_xt.cc
storage/pbxt/src/xaction_xt.h
storage/pbxt/src/xactlog_xt.cc
storage/pbxt/src/xactlog_xt.h
storage/pbxt/src/xt_config.h
storage/pbxt/src/xt_defs.h
storage/pbxt/src/xt_errno.h
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2009-11-16 20:49:51 +0000
+++ b/sql/handler.cc 2009-12-02 11:50:40 +0000
@@ -1584,16 +1584,6 @@ int ha_recover(HASH *commit_list)
if (info.commit_list)
sql_print_information("Starting crash recovery...");
-#ifndef WILL_BE_DELETED_LATER
- /*
- for now, only InnoDB supports 2pc. It means we can always safely
- rollback all pending transactions, without risking inconsistent data
- */
- DBUG_ASSERT(total_ha_2pc == (ulong) opt_bin_log+1); // only InnoDB and binlog
- tc_heuristic_recover= TC_HEURISTIC_RECOVER_ROLLBACK; // forcing ROLLBACK
- info.dry_run=FALSE;
-#endif
-
for (info.len= MAX_XID_LIST_SIZE ;
info.list==0 && info.len > MIN_XID_LIST_SIZE; info.len/=2)
{
=== modified file 'storage/pbxt/ChangeLog'
--- a/storage/pbxt/ChangeLog 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/ChangeLog 2009-12-01 09:50:46 +0000
@@ -1,6 +1,58 @@
PBXT Release Notes
==================
+------- 1.0.09f RC3 - 2009-11-30
+
+RN291: Fixed bug #489088: On shutdown MySQL reports: [Warning] Plugin 'PBXT' will be forced to shutdown.
+
+RN290: Fixed bug #345524: pbxt does not compile on 64 bit windows. Currently atomic operations are not supported on this platform.
+
+RN286: Fixed a bug introduced in RN281, which could cause an index scan to hang. The original change was to prevent a warning in Valgrind.
+
+RN285: Merged changes required to compile with Drizzle.
+
+RN284: Fixed bug that cause the error "[ERROR] Invalid (old?) table or database name 'mysqld.1'", when running temp_table.test under MariaDB (thanks to Monty for his initial bug fix). Added a fix for partition table names as well.
+
+RN283: Added win_inttypes.h to the distribution. This file is only required for the Windows build.
+
+RN282: Fixed bug #451101: jump or move depends on uninitialised value in myxt_get_key_length
+
+RN281: Fixed bug #451080: Uninitialised memory write in XTDatabaseLog::xlog_append
+
+RN280: Fixed bug #451085: jump or move depends on uninitialised value in my_type_to_string
+
+RN279: Fixed bug #441000: xtstat crashes with segmentation fault on startup if max_pbxt_threads exceeded.
+
+------- 1.0.09e RC3 - 2009-11-20
+
+RN278: Fixed compile error with MySQL 5.1.41.
+
+------- 1.0.09d RC3 - 2009-09-30
+
+RN277: Added r/o flag to pbxt_max_threads server variable (this fix is related to bug #430637)
+
+RN276: Added test case for replication on tables w/o PKs (see bug #430716)
+
+RN275: Fixed bug #430600: 'Failed to read auto-increment value from storage engine' error.
+
+RN274: Fixed bug #431240: This report is public edit xtstat fails if no PBXT table has been created. xtstat now accepts --database=information_schema or --database=pbxt. Depending on this setting PBXT will either use the information_schema.pbxt_statistics or the pbxt.statistics table. If information_schema is used, then the statistics are displayed even when no PBXT table exists. Recovery activity is also displayed, unless pbxt_support_xa=1, in which case MySQL will wait for PBXT recovery to complete before allowing connections.
+
+RN273: Fixed bug #430633: XA_RBDEADLOCK is not returned on XA END after the transacting ended with a deadlock.
+
+RN272: Fixed bug #430596: Backup/restore does not work well even on a basic PBXT table with auto-increment.
+
+------- 1.0.09c RC3 - 2009-09-16
+
+RN271: Windows build update: now you can simply put the pbxt directory under <mysql-root>/storage and build the PBXT engine as a part of the source tree. The engine will be linked statically. Be sure to specify the WITH_PBXT_STORAGE_ENGINE option when running win\configure.js
+
+RN270: Correctly disabled PBMS so that this version now compiles under Windows. If PBMS_ENABLED is defined, PBXT will not compile under Windows becaause of a getpid() call in pbms.h.
+
+------- 1.0.09 RC3 - 2009-09-09
+
+RN269: Implemented online backup. A native online backup driver now performs BACKUP and RESTORE DATABASE operations for PBXT. NOTE: This feature is only supported by MySQL 6.0.9 or later.
+
+RN268: Implemented XA support. PBXT now supports all XA related MySQL statements. The variable pbxt_support_xa determines if XA support is enabled. Note: due to MySQL bug #47134, enabling XA support could lead to a crash.
+
------- 1.0.08d RC2 - 2009-09-02
RN267: Fixed a bug that caused MySQL to crash on shutdown, after an incorrect command line parameter was given. The crash occurred because the background recovery task was not cleaned up before the PBXT engine was de-initialized.
=== modified file 'storage/pbxt/src/Makefile.am'
--- a/storage/pbxt/src/Makefile.am 2009-10-07 07:40:56 +0000
+++ b/storage/pbxt/src/Makefile.am 2009-11-24 10:55:06 +0000
@@ -22,7 +22,7 @@ noinst_HEADERS = bsearch_xt.h cache_xt.
pbms_enabled.h sortedlist_xt.h strutil_xt.h \
tabcache_xt.h table_xt.h trace_xt.h thread_xt.h \
util_xt.h xaction_xt.h xactlog_xt.h lock_xt.h \
- systab_xt.h ha_xtsys.h discover_xt.h \
+ systab_xt.h ha_xtsys.h discover_xt.h backup_xt.h \
pbms.h xt_config.h xt_defs.h xt_errno.h locklist_xt.h
EXTRA_LTLIBRARIES = libpbxt.la
@@ -32,7 +32,7 @@ libpbxt_la_SOURCES = bsearch_xt.cc cache
memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \
sortedlist_xt.cc strutil_xt.cc \
tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \
- systab_xt.cc ha_xtsys.cc discover_xt.cc \
+ systab_xt.cc ha_xtsys.cc discover_xt.cc backup_xt.cc \
util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc
libpbxt_la_LDFLAGS = -module
=== added file 'storage/pbxt/src/backup_xt.cc'
--- a/storage/pbxt/src/backup_xt.cc 1970-01-01 00:00:00 +0000
+++ b/storage/pbxt/src/backup_xt.cc 2009-11-24 10:55:06 +0000
@@ -0,0 +1,802 @@
+/* Copyright (c) 2009 PrimeBase Technologies GmbH
+ *
+ * PrimeBase XT
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * 2009-09-07 Paul McCullagh
+ *
+ * H&G2JCtL
+ */
+
+#include "xt_config.h"
+
+#ifdef MYSQL_SUPPORTS_BACKUP
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <ctype.h>
+
+#include "mysql_priv.h"
+#include <backup/api_types.h>
+#include <backup/backup_engine.h>
+#include <backup/backup_aux.h> // for build_table_list()
+#include <hash.h>
+
+#include "ha_pbxt.h"
+
+#include "backup_xt.h"
+#include "pthread_xt.h"
+#include "filesys_xt.h"
+#include "database_xt.h"
+#include "strutil_xt.h"
+#include "memory_xt.h"
+#include "trace_xt.h"
+#include "myxt_xt.h"
+
+#ifdef OK
+#undef OK
+#endif
+
+#ifdef byte
+#undef byte
+#endif
+
+#ifdef DEBUG
+//#define TRACE_BACKUP_CALLS
+//#define TEST_SMALL_BLOCK 100000
+#endif
+
+using backup::byte;
+using backup::result_t;
+using backup::version_t;
+using backup::Table_list;
+using backup::Table_ref;
+using backup::Buffer;
+
+#ifdef TRACE_BACKUP_CALLS
+#define XT_TRACE_CALL() ha_trace_function(__FUNC__, NULL)
+#else
+#define XT_TRACE_CALL()
+#endif
+
+#define XT_RESTORE_BATCH_SIZE 10000
+
+#define BUP_STATE_BEFORE_LOCK 0
+#define BUP_STATE_AFTER_LOCK 1
+
+#define BUP_STANDARD_VAR_RECORD 1
+#define BUP_RECORD_BLOCK_4_START 2 // Part of a record, with a 4 byte total length, and 4 byte data length
+#define BUP_RECORD_BLOCK_4 3 // Part of a record, with a 4 byte length
+#define BUP_RECORD_BLOCK_4_END 4 // Last part of a record with a 4 byte length
+
+/*
+ * -----------------------------------------------------------------------
+ * UTILITIES
+ */
+
+#ifdef TRACE_BACKUP_CALLS
+static void ha_trace_function(const char *function, char *table)
+{
+ char func_buf[50], *ptr;
+ XTThreadPtr thread = xt_get_self();
+
+ if ((ptr = strchr(function, '('))) {
+ ptr--;
+ while (ptr > function) {
+ if (!(isalnum(*ptr) || *ptr == '_'))
+ break;
+ ptr--;
+ }
+ ptr++;
+ xt_strcpy(50, func_buf, ptr);
+ if ((ptr = strchr(func_buf, '(')))
+ *ptr = 0;
+ }
+ else
+ xt_strcpy(50, func_buf, function);
+ if (table)
+ printf("%s %s (%s)\n", thread ? thread->t_name : "-unknown-", func_buf, table);
+ else
+ printf("%s %s\n", thread ? thread->t_name : "-unknown-", func_buf);
+}
+#endif
+
+/*
+ * -----------------------------------------------------------------------
+ * BACKUP DRIVER
+ */
+
+class PBXTBackupDriver: public Backup_driver
+{
+ public:
+ PBXTBackupDriver(const Table_list &);
+ virtual ~PBXTBackupDriver();
+
+ virtual size_t size();
+ virtual size_t init_size();
+ virtual result_t begin(const size_t);
+ virtual result_t end();
+ virtual result_t get_data(Buffer &);
+ virtual result_t prelock();
+ virtual result_t lock();
+ virtual result_t unlock();
+ virtual result_t cancel();
+ virtual void free();
+ void lock_tables_TL_READ_NO_INSERT();
+
+ private:
+ XTThreadPtr bd_thread;
+ int bd_state;
+ u_int bd_table_no;
+ XTOpenTablePtr bd_ot;
+ xtWord1 *bd_row_buf;
+
+ /* Non-zero if we last returned only part of
+ * a row.
+ */
+ xtWord1 *db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *size, xtWord4 row_len);
+ xtWord1 *db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *size, xtWord4 total_len, xtWord4 row_len);
+
+ xtWord4 bd_row_offset;
+ xtWord4 bd_row_size;
+};
+
+
+PBXTBackupDriver::PBXTBackupDriver(const Table_list &tables):
+Backup_driver(tables),
+bd_state(BUP_STATE_BEFORE_LOCK),
+bd_table_no(0),
+bd_ot(NULL),
+bd_row_buf(NULL),
+bd_row_offset(0),
+bd_row_size(0)
+{
+}
+
+PBXTBackupDriver::~PBXTBackupDriver()
+{
+}
+
+/** Estimates total size of backup. @todo improve it */
+size_t PBXTBackupDriver::size()
+{
+ XT_TRACE_CALL();
+ return UNKNOWN_SIZE;
+}
+
+/** Estimates size of backup before lock. @todo improve it */
+size_t PBXTBackupDriver::init_size()
+{
+ XT_TRACE_CALL();
+ return 0;
+}
+
+result_t PBXTBackupDriver::begin(const size_t)
+{
+ THD *thd = current_thd;
+ XTExceptionRec e;
+
+ XT_TRACE_CALL();
+
+ if (!(bd_thread = xt_ha_set_current_thread(thd, &e))) {
+ xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
+ return backup::ERROR;
+ }
+
+ return backup::OK;
+}
+
+result_t PBXTBackupDriver::end()
+{
+ XT_TRACE_CALL();
+ if (bd_ot) {
+ xt_tab_seq_exit(bd_ot);
+ xt_db_return_table_to_pool_ns(bd_ot);
+ bd_ot = NULL;
+ }
+ if (bd_thread->st_xact_data) {
+ if (!xt_xn_commit(bd_thread))
+ return backup::ERROR;
+ }
+ return backup::OK;
+}
+
+xtWord1 *PBXTBackupDriver::db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *ret_size, xtWord4 row_len)
+{
+ register size_t size = *ret_size;
+
+ *buffer = bup_type; // Record type identifier.
+ buffer++;
+ size--;
+ memcpy(buffer, bd_ot->ot_row_wbuffer, row_len);
+ buffer += row_len;
+ size -= row_len;
+ *ret_size = size;
+ return buffer;
+}
+
+xtWord1 *PBXTBackupDriver::db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *ret_size, xtWord4 total_len, xtWord4 row_len)
+{
+ register size_t size = *ret_size;
+
+ *buffer = bup_type; // Record type identifier.
+ buffer++;
+ size--;
+ if (bup_type == BUP_RECORD_BLOCK_4_START) {
+ XT_SET_DISK_4(buffer, total_len);
+ buffer += 4;
+ size -= 4;
+ }
+ XT_SET_DISK_4(buffer, row_len);
+ buffer += 4;
+ size -= 4;
+ memcpy(buffer, bd_ot->ot_row_wbuffer+bd_row_offset, row_len);
+ buffer += row_len;
+ size -= row_len;
+ bd_row_size -= row_len;
+ bd_row_offset += row_len;
+ *ret_size = size;
+ return buffer;
+}
+
+result_t PBXTBackupDriver::get_data(Buffer &buf)
+{
+ xtBool eof = FALSE;
+ size_t size;
+ xtWord4 row_len;
+ xtWord1 *buffer;
+
+ XT_TRACE_CALL();
+
+ if (bd_state == BUP_STATE_BEFORE_LOCK) {
+ buf.table_num = 0;
+ buf.size = 0;
+ buf.last = FALSE;
+ return backup::READY;
+ }
+
+ /* Open the backup table: */
+ if (!bd_ot) {
+ XTThreadPtr self = bd_thread;
+ XTTableHPtr tab;
+ char path[PATH_MAX];
+
+ if (bd_table_no == m_tables.count()) {
+ buf.size = 0;
+ buf.table_num = 0;
+ buf.last = TRUE;
+ return backup::DONE;
+ }
+
+ m_tables[bd_table_no].internal_name(path, sizeof(path));
+ bd_table_no++;
+ try_(a) {
+ xt_ha_open_database_of_table(self, (XTPathStrPtr) path);
+ tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE, NULL);
+ pushr_(xt_heap_release, tab);
+ if (!(bd_ot = xt_db_open_table_using_tab(tab, bd_thread)))
+ xt_throw(self);
+ freer_(); // xt_heap_release(tab)
+
+ /* Prepare the seqential scan: */
+ xt_tab_seq_exit(bd_ot);
+ if (!xt_tab_seq_init(bd_ot))
+ xt_throw(self);
+
+ if (bd_row_buf) {
+ xt_free(self, bd_row_buf);
+ bd_row_buf = NULL;
+ }
+ bd_row_buf = (xtWord1 *) xt_malloc(self, bd_ot->ot_table->tab_dic.dic_mysql_buf_size);
+ bd_ot->ot_cols_req = bd_ot->ot_table->tab_dic.dic_no_of_cols;
+ }
+ catch_(a) {
+ ;
+ }
+ cont_(a);
+
+ if (!bd_ot)
+ goto failed;
+ }
+
+ buf.table_num = bd_table_no;
+#ifdef TEST_SMALL_BLOCK
+ buf.size = TEST_SMALL_BLOCK;
+#endif
+ size = buf.size;
+ buffer = (xtWord1 *) buf.data;
+ ASSERT_NS(size > 9);
+
+ /* First check of a record was partically written
+ * last time.
+ */
+ write_row:
+ if (bd_row_size > 0) {
+ row_len = bd_row_size;
+ if (bd_row_offset == 0) {
+ if (row_len+1 > size) {
+ ASSERT_NS(size > 9);
+ row_len = size - 9;
+ buffer = db_write_block(buffer, BUP_RECORD_BLOCK_4_START, &size, bd_row_size, row_len);
+ goto done;
+ }
+ buffer = db_write_block(buffer, BUP_STANDARD_VAR_RECORD, &size, row_len);
+ bd_row_size = 0;
+ }
+ else {
+ if (row_len+5 > size) {
+ row_len = size - 5;
+ buffer = db_write_block(buffer, BUP_RECORD_BLOCK_4, &size, 0, row_len);
+ goto done;
+ }
+ buffer = db_write_block(buffer, BUP_RECORD_BLOCK_4_END, &size, 0, row_len);
+ }
+ }
+
+ /* Now continue with the sequential scan. */
+ while (size > 1) {
+ if (!xt_tab_seq_next(bd_ot, bd_row_buf, &eof))
+ goto failed;
+ if (eof) {
+ /* We will go the next table, on the next call. */
+ xt_tab_seq_exit(bd_ot);
+ xt_db_return_table_to_pool_ns(bd_ot);
+ bd_ot = NULL;
+ break;
+ }
+ if (!(row_len = myxt_store_row_data(bd_ot, 0, (char *) bd_row_buf)))
+ goto failed;
+ if (row_len+1 > size) {
+ /* Does not fit: */
+ bd_row_offset = 0;
+ bd_row_size = row_len;
+ /* Only add part of the row, if there is still
+ * quite a bit of space left:
+ */
+ if (size >= (32 * 1024))
+ goto write_row;
+ break;
+ }
+ buffer = db_write_block(buffer, BUP_STANDARD_VAR_RECORD, &size, row_len);
+ }
+
+ done:
+ buf.size = buf.size - size;
+ /* This indicates wnd of data for a table! */
+ buf.last = eof;
+
+ return backup::OK;
+
+ failed:
+ xt_log_and_clear_exception(bd_thread);
+ return backup::ERROR;
+}
+
+result_t PBXTBackupDriver::prelock()
+{
+ XT_TRACE_CALL();
+ return backup::READY;
+}
+
+result_t PBXTBackupDriver::lock()
+{
+ XT_TRACE_CALL();
+ bd_thread->st_xact_mode = XT_XACT_COMMITTED_READ;
+ bd_thread->st_ignore_fkeys = FALSE;
+ bd_thread->st_auto_commit = FALSE;
+ bd_thread->st_table_trans = FALSE;
+ bd_thread->st_abort_trans = FALSE;
+ bd_thread->st_stat_ended = FALSE;
+ bd_thread->st_stat_trans = FALSE;
+ bd_thread->st_is_update = FALSE;
+ if (!xt_xn_begin(bd_thread))
+ return backup::ERROR;
+ bd_state = BUP_STATE_AFTER_LOCK;
+ return backup::OK;
+}
+
+result_t PBXTBackupDriver::unlock()
+{
+ XT_TRACE_CALL();
+ return backup::OK;
+}
+
+result_t PBXTBackupDriver::cancel()
+{
+ XT_TRACE_CALL();
+ return backup::OK; // free() will be called and suffice
+}
+
+void PBXTBackupDriver::free()
+{
+ XT_TRACE_CALL();
+ if (bd_ot) {
+ xt_tab_seq_exit(bd_ot);
+ xt_db_return_table_to_pool_ns(bd_ot);
+ bd_ot = NULL;
+ }
+ if (bd_row_buf) {
+ xt_free_ns(bd_row_buf);
+ bd_row_buf = NULL;
+ }
+ if (bd_thread->st_xact_data)
+ xt_xn_rollback(bd_thread);
+ delete this;
+}
+
+void PBXTBackupDriver::lock_tables_TL_READ_NO_INSERT()
+{
+ XT_TRACE_CALL();
+}
+
+/*
+ * -----------------------------------------------------------------------
+ * BACKUP DRIVER
+ */
+
+class PBXTRestoreDriver: public Restore_driver
+{
+ public:
+ PBXTRestoreDriver(const Table_list &tables);
+ virtual ~PBXTRestoreDriver();
+
+ virtual result_t begin(const size_t);
+ virtual result_t end();
+ virtual result_t send_data(Buffer &buf);
+ virtual result_t cancel();
+ virtual void free();
+
+ private:
+ XTThreadPtr rd_thread;
+ u_int rd_table_no;
+ XTOpenTablePtr rd_ot;
+ STRUCT_TABLE *rd_my_table;
+ xtWord1 *rb_row_buf;
+ u_int rb_col_cnt;
+ u_int rb_insert_count;
+
+ /* Long rows are accumulated here: */
+ xtWord4 rb_row_len;
+ xtWord4 rb_data_size;
+ xtWord1 *rb_row_data;
+};
+
+PBXTRestoreDriver::PBXTRestoreDriver(const Table_list &tables):
+Restore_driver(tables),
+rd_thread(NULL),
+rd_table_no(0),
+rd_ot(NULL),
+rb_row_buf(NULL),
+rb_row_len(0),
+rb_data_size(0),
+rb_row_data(NULL)
+{
+}
+
+PBXTRestoreDriver::~PBXTRestoreDriver()
+{
+}
+
+result_t PBXTRestoreDriver::begin(const size_t)
+{
+ THD *thd = current_thd;
+ XTExceptionRec e;
+
+ XT_TRACE_CALL();
+
+ if (!(rd_thread = xt_ha_set_current_thread(thd, &e))) {
+ xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
+ return backup::ERROR;
+ }
+
+ return backup::OK;
+}
+
+result_t PBXTRestoreDriver::end()
+{
+ XT_TRACE_CALL();
+ if (rd_ot) {
+ xt_db_return_table_to_pool_ns(rd_ot);
+ rd_ot = NULL;
+ }
+ //if (rb_row_buf) {
+ // xt_free_ns(rb_row_buf);
+ // rb_row_buf = NULL;
+ //}
+ if (rb_row_data) {
+ xt_free_ns(rb_row_data);
+ rb_row_data = NULL;
+ }
+ if (rd_thread->st_xact_data) {
+ if (!xt_xn_commit(rd_thread))
+ return backup::ERROR;
+ }
+ return backup::OK;
+}
+
+
+result_t PBXTRestoreDriver::send_data(Buffer &buf)
+{
+ size_t size;
+ xtWord1 type;
+ xtWord1 *buffer;
+ xtWord4 row_len;
+ xtWord1 *rec_data;
+
+ XT_TRACE_CALL();
+
+ if (buf.table_num != rd_table_no) {
+ XTThreadPtr self = rd_thread;
+ XTTableHPtr tab;
+ char path[PATH_MAX];
+
+ if (rd_ot) {
+ xt_db_return_table_to_pool_ns(rd_ot);
+ rd_ot = NULL;
+ }
+
+ if (rd_thread->st_xact_data) {
+ if (!xt_xn_commit(rd_thread))
+ goto failed;
+ }
+ if (!xt_xn_begin(rd_thread))
+ goto failed;
+ rb_insert_count = 0;
+
+ rd_table_no = buf.table_num;
+ m_tables[rd_table_no-1].internal_name(path, sizeof(path));
+ try_(a) {
+ xt_ha_open_database_of_table(self, (XTPathStrPtr) path);
+ tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE, NULL);
+ pushr_(xt_heap_release, tab);
+ if (!(rd_ot = xt_db_open_table_using_tab(tab, rd_thread)))
+ xt_throw(self);
+ freer_(); // xt_heap_release(tab)
+
+ rd_my_table = rd_ot->ot_table->tab_dic.dic_my_table;
+ if (rd_my_table->found_next_number_field) {
+ rd_my_table->in_use = current_thd;
+ rd_my_table->next_number_field = rd_my_table->found_next_number_field;
+ rd_my_table->mark_columns_used_by_index_no_reset(rd_my_table->s->next_number_index, rd_my_table->read_set);
+ }
+
+ /* This is safe because only one thread can restore a table at
+ * a time!
+ */
+ rb_row_buf = (xtWord1 *) rd_my_table->record[0];
+ //if (rb_row_buf) {
+ // xt_free(self, rb_row_buf);
+ // rb_row_buf = NULL;
+ //}
+ //rb_row_buf = (xtWord1 *) xt_malloc(self, rd_ot->ot_table->tab_dic.dic_mysql_buf_size);
+
+ rb_col_cnt = rd_ot->ot_table->tab_dic.dic_no_of_cols;
+
+ }
+ catch_(a) {
+ ;
+ }
+ cont_(a);
+
+ if (!rd_ot)
+ goto failed;
+ }
+
+ buffer = (xtWord1 *) buf.data;
+ size = buf.size;
+
+ while (size > 0) {
+ type = *buffer;
+ switch (type) {
+ case BUP_STANDARD_VAR_RECORD:
+ rec_data = buffer + 1;
+ break;
+ case BUP_RECORD_BLOCK_4_START:
+ buffer++;
+ row_len = XT_GET_DISK_4(buffer);
+ buffer += 4;
+ if (rb_data_size < row_len) {
+ if (!xt_realloc_ns((void **) &rb_row_data, row_len))
+ goto failed;
+ rb_data_size = row_len;
+ }
+ row_len = XT_GET_DISK_4(buffer);
+ buffer += 4;
+ ASSERT_NS(row_len <= rb_data_size);
+ if (row_len > rb_data_size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ memcpy(rb_row_data, buffer, row_len);
+ rb_row_len = row_len;
+ buffer += row_len;
+ if (row_len + 9 > size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ size -= row_len + 9;
+ continue;
+ case BUP_RECORD_BLOCK_4:
+ buffer++;
+ row_len = XT_GET_DISK_4(buffer);
+ buffer += 4;
+ ASSERT_NS(rb_row_len + row_len <= rb_data_size);
+ if (rb_row_len + row_len > rb_data_size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ memcpy(rb_row_data + rb_row_len, buffer, row_len);
+ rb_row_len += row_len;
+ buffer += row_len;
+ if (row_len + 5 > size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ size -= row_len + 5;
+ continue;
+ case BUP_RECORD_BLOCK_4_END:
+ buffer++;
+ row_len = XT_GET_DISK_4(buffer);
+ buffer += 4;
+ ASSERT_NS(rb_row_len + row_len <= rb_data_size);
+ if (rb_row_len + row_len > rb_data_size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ memcpy(rb_row_data + rb_row_len, buffer, row_len);
+ buffer += row_len;
+ if (row_len + 5 > size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ size -= row_len + 5;
+ rec_data = rb_row_data;
+ break;
+ default:
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+
+ if (!(row_len = myxt_load_row_data(rd_ot, rec_data, rb_row_buf, rb_col_cnt)))
+ goto failed;
+
+ if (rd_ot->ot_table->tab_dic.dic_my_table->found_next_number_field)
+ ha_set_auto_increment(rd_ot, rd_ot->ot_table->tab_dic.dic_my_table->found_next_number_field);
+
+ if (!xt_tab_new_record(rd_ot, rb_row_buf))
+ goto failed;
+
+ if (type == BUP_STANDARD_VAR_RECORD) {
+ buffer += row_len+1;
+ if (row_len + 1 > size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ size -= row_len + 1;
+ }
+
+ rb_insert_count++;
+ if (rb_insert_count == XT_RESTORE_BATCH_SIZE) {
+ if (!xt_xn_commit(rd_thread))
+ goto failed;
+ if (!xt_xn_begin(rd_thread))
+ goto failed;
+ rb_insert_count = 0;
+ }
+ }
+
+ return backup::OK;
+
+ failed:
+ xt_log_and_clear_exception(rd_thread);
+ return backup::ERROR;
+}
+
+
+result_t PBXTRestoreDriver::cancel()
+{
+ XT_TRACE_CALL();
+ /* Nothing to do in cancel(); free() will suffice */
+ return backup::OK;
+}
+
+void PBXTRestoreDriver::free()
+{
+ XT_TRACE_CALL();
+ if (rd_ot) {
+ xt_db_return_table_to_pool_ns(rd_ot);
+ rd_ot = NULL;
+ }
+ //if (rb_row_buf) {
+ // xt_free_ns(rb_row_buf);
+ // rb_row_buf = NULL;
+ //}
+ if (rb_row_data) {
+ xt_free_ns(rb_row_data);
+ rb_row_data = NULL;
+ }
+ if (rd_thread->st_xact_data)
+ xt_xn_rollback(rd_thread);
+ delete this;
+}
+
+/*
+ * -----------------------------------------------------------------------
+ * BACKUP ENGINE FACTORY
+ */
+
+#define PBXT_BACKUP_VERSION 1
+
+
+class PBXTBackupEngine: public Backup_engine
+{
+ public:
+ PBXTBackupEngine() { };
+
+ virtual version_t version() const {
+ return PBXT_BACKUP_VERSION;
+ };
+
+ virtual result_t get_backup(const uint32, const Table_list &, Backup_driver* &);
+
+ virtual result_t get_restore(const version_t, const uint32, const Table_list &,Restore_driver* &);
+
+ virtual void free()
+ {
+ delete this;
+ }
+};
+
+result_t PBXTBackupEngine::get_backup(const u_int count, const Table_list &tables, Backup_driver* &drv)
+{
+ PBXTBackupDriver *ptr = new PBXTBackupDriver(tables);
+
+ if (!ptr)
+ return backup::ERROR;
+ drv = ptr;
+ return backup::OK;
+}
+
+result_t PBXTBackupEngine::get_restore(const version_t ver, const uint32,
+ const Table_list &tables, Restore_driver* &drv)
+{
+ if (ver > PBXT_BACKUP_VERSION)
+ {
+ return backup::ERROR;
+ }
+
+ PBXTRestoreDriver *ptr = new PBXTRestoreDriver(tables);
+
+ if (!ptr)
+ return backup::ERROR;
+ drv = (Restore_driver *) ptr;
+ return backup::OK;
+}
+
+
+Backup_result_t pbxt_backup_engine(handlerton *self, Backup_engine* &be)
+{
+ be = new PBXTBackupEngine();
+
+ if (!be)
+ return backup::ERROR;
+
+ return backup::OK;
+}
+
+#endif
=== added file 'storage/pbxt/src/backup_xt.h'
--- a/storage/pbxt/src/backup_xt.h 1970-01-01 00:00:00 +0000
+++ b/storage/pbxt/src/backup_xt.h 2009-11-24 10:55:06 +0000
@@ -0,0 +1,34 @@
+/* Copyright (c) 2009 PrimeBase Technologies GmbH
+ *
+ * PrimeBase XT
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * 2009-09-07 Paul McCullagh
+ *
+ * H&G2JCtL
+ */
+
+#ifndef __backup_xt_h__
+#define __backup_xt_h__
+
+#include "xt_defs.h"
+
+#ifdef MYSQL_SUPPORTS_BACKUP
+
+Backup_result_t pbxt_backup_engine(handlerton *self, Backup_engine* &be);
+
+#endif
+#endif
=== modified file 'storage/pbxt/src/cache_xt.cc'
--- a/storage/pbxt/src/cache_xt.cc 2009-10-30 18:50:56 +0000
+++ b/storage/pbxt/src/cache_xt.cc 2009-11-24 10:55:06 +0000
@@ -73,7 +73,7 @@
#define IDX_CAC_UNLOCK(i, o) xt_xsmutex_unlock(&(i)->cs_lock, (o)->t_id)
#elif defined(IDX_CAC_USE_PTHREAD_RW)
#define IDX_CAC_LOCK_TYPE xt_rwlock_type
-#define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock(s, &(i)->cs_lock)
+#define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, &(i)->cs_lock)
#define IDX_CAC_FREE_LOCK(s, i) xt_free_rwlock(&(i)->cs_lock)
#define IDX_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(&(i)->cs_lock)
#define IDX_CAC_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(&(i)->cs_lock)
@@ -94,8 +94,12 @@
#define IDX_CAC_UNLOCK(i, s) xt_spinxslock_unlock(&(i)->cs_lock, (s)->t_id)
#endif
+#ifdef XT_NO_ATOMICS
+#define ID_HANDLE_USE_PTHREAD_RW
+#else
#define ID_HANDLE_USE_SPINLOCK
//#define ID_HANDLE_USE_PTHREAD_RW
+#endif
#if defined(ID_HANDLE_USE_PTHREAD_RW)
#define ID_HANDLE_LOCK_TYPE xt_mutex_type
@@ -374,7 +378,7 @@ xtPublic void xt_ind_release_handle(XTIn
{
DcHandleSlotPtr hs;
XTIndBlockPtr block = NULL;
- u_int hash_idx = 0;
+ u_int hash_idx = 0;
DcSegmentPtr seg = NULL;
XTIndBlockPtr xblock;
@@ -1379,7 +1383,7 @@ xtPublic xtBool xt_ind_fetch(XTOpenTable
ASSERT_NS(iref->ir_xlock == 2);
#endif
if (!(block = ind_cac_fetch(ot, ind, address, &seg, TRUE)))
- return 0;
+ return FAILED;
branch_size = XT_GET_DISK_2(((XTIdxBranchDPtr) block->cb_data)->tb_size_2);
if (XT_GET_INDEX_BLOCK_LEN(branch_size) < 2 || XT_GET_INDEX_BLOCK_LEN(branch_size) > XT_INDEX_PAGE_SIZE) {
=== modified file 'storage/pbxt/src/cache_xt.h'
--- a/storage/pbxt/src/cache_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/cache_xt.h 2009-11-24 10:55:06 +0000
@@ -62,7 +62,7 @@ struct XTIdxReadBuffer;
#define XT_IPAGE_UNLOCK(i, x) xt_atomicrwlock_unlock(i, x)
#elif defined(XT_IPAGE_USE_PTHREAD_RW)
#define XT_IPAGE_LOCK_TYPE xt_rwlock_type
-#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_free_rwlock(i)
#define XT_IPAGE_READ_LOCK(i) xt_slock_rwlock_ns(i)
#define XT_IPAGE_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
=== modified file 'storage/pbxt/src/database_xt.cc'
--- a/storage/pbxt/src/database_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/database_xt.cc 2009-11-24 10:55:06 +0000
@@ -54,6 +54,8 @@
* GLOBALS
*/
+xtPublic XTDatabaseHPtr pbxt_database = NULL; // The global open database
+
xtPublic xtLogOffset xt_db_log_file_threshold;
xtPublic size_t xt_db_log_buffer_size;
xtPublic size_t xt_db_transaction_buffer_size;
@@ -505,6 +507,15 @@ xtPublic XTDatabaseHPtr xt_get_database(
* all index entries that are not visible have
* been removed.
*
+ * REASON WHY WE SET ROWID ON RECOVERY:
+ * The row ID is set on recovery because the
+ * change to the index may be lost after a crash.
+ * The change to the index is done by the sweeper, and
+ * there is no record of this change in the log.
+ * The sweeper will not "re-sweep" all transations
+ * that are recovered. As a result, this upadte
+ * of the index by the sweeper may be lost.
+ *
* {OPEN-DB-SWEEPER-WAIT}
* This has been moved to after the release of the open
* database lock because:
@@ -518,9 +529,12 @@ xtPublic XTDatabaseHPtr xt_get_database(
* - To open the database it needs the open database
* lock.
*/
+ /*
+ * This has been moved, see: {WAIT-FOR-SW-AFTER-RECOV}
pushr_(xt_heap_release, db);
xt_wait_for_sweeper(self, db, 0);
popr_();
+ */
return db;
}
=== modified file 'storage/pbxt/src/database_xt.h'
--- a/storage/pbxt/src/database_xt.h 2009-04-02 10:03:14 +0000
+++ b/storage/pbxt/src/database_xt.h 2009-11-24 10:55:06 +0000
@@ -105,6 +105,8 @@ typedef struct XTTablePath {
#define XT_THREAD_IDLE 1
#define XT_THREAD_INERR 2
+#define XT_XA_HASH_TAB_SIZE 223
+
typedef struct XTDatabase : public XTHeap {
char *db_name; /* The name of the database, last component of the path! */
char *db_main_path;
@@ -131,6 +133,9 @@ typedef struct XTDatabase : public XTHea
u_int db_stat_sweep_waits; /* STATISTICS: count the sweeper waits. */
XTDatabaseLogRec db_xlog; /* The transaction log for this database. */
XTXactRestartRec db_restart; /* Database recovery stuff. */
+ xt_mutex_type db_xn_xa_lock;
+ XTXactPreparePtr db_xn_xa_table[XT_XA_HASH_TAB_SIZE];
+ XTSortedListPtr db_xn_xa_list; /* The "wait-for" list, of transactions waiting for other transactions. */
XTSortedListPtr db_xn_wait_for; /* The "wait-for" list, of transactions waiting for other transactions. */
u_int db_xn_call_start; /* Start of the post wait calls. */
@@ -198,6 +203,7 @@ void xt_check_database(XTThreadPtr se
void xt_add_pbxt_file(size_t size, char *path, const char *file);
void xt_add_location_file(size_t size, char *path);
+void xt_add_pbxt_dir(size_t size, char *path);
void xt_add_system_dir(size_t size, char *path);
void xt_add_data_dir(size_t size, char *path);
@@ -244,4 +250,6 @@ inline void xt_xlog_check_long_writer(XT
}
}
+extern XTDatabaseHPtr pbxt_database; // The global open database
+
#endif
=== modified file 'storage/pbxt/src/datadic_xt.cc'
--- a/storage/pbxt/src/datadic_xt.cc 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/datadic_xt.cc 2009-11-24 10:55:06 +0000
@@ -35,7 +35,7 @@
#ifdef DEBUG
#ifdef DRIZZLED
-#include <drizzled/common_includes.h>
+//#include <drizzled/common_includes.h>
#else
#include "mysql_priv.h"
#endif
@@ -437,11 +437,6 @@ class XTTokenizer {
XTToken *nextToken(XTThreadPtr self, c_char *keyword, XTToken *tk);
};
-void ri_free_token(XTThreadPtr XT_UNUSED(self), XTToken *tk)
-{
- delete tk;
-}
-
XTToken *XTTokenizer::newToken(XTThreadPtr self, u_int type, char *start, char *end)
{
if (!tkn_current) {
=== modified file 'storage/pbxt/src/datalog_xt.cc'
--- a/storage/pbxt/src/datalog_xt.cc 2009-09-04 07:29:34 +0000
+++ b/storage/pbxt/src/datalog_xt.cc 2009-11-24 10:55:06 +0000
@@ -410,7 +410,7 @@ static void dl_recover_log(XTThreadPtr s
ASSERT_NS(seq_read.sl_log_eof == seq_read.sl_rec_log_offset);
data_log->dlf_log_eof = seq_read.sl_rec_log_offset;
- if ((size_t) data_log->dlf_log_eof < sizeof(XTXactLogHeaderDRec)) {
+ if (data_log->dlf_log_eof < (off_t) sizeof(XTXactLogHeaderDRec)) {
data_log->dlf_log_eof = sizeof(XTXactLogHeaderDRec);
if (!dl_create_log_header(data_log, seq_read.sl_log_file, self))
xt_throw(self);
@@ -1162,7 +1162,7 @@ xtBool XTDataLogBuffer::dlb_close_log(XT
/* When I use 'thread' instead of 'self', this means
* that I will not throw an error.
*/
-xtBool XTDataLogBuffer::dlb_get_log_offset(xtLogID *log_id, xtLogOffset *out_offset, size_t req_size, struct XTThread *thread)
+xtBool XTDataLogBuffer::dlb_get_log_offset(xtLogID *log_id, xtLogOffset *out_offset, size_t XT_UNUSED(req_size), struct XTThread *thread)
{
/* Note, I am allowing a log to grow beyond the threshold.
* The amount depends on the maximum extended record size.
@@ -1757,7 +1757,7 @@ static xtBool dl_collect_garbage(XTThrea
freer_(); // xt_unlock_mutex(&db->db_co_dlog_lock)
/* Flush the transaction log. */
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(db, self))
xt_throw(self);
xt_lock_mutex_ns(&db->db_datalogs.dlc_head_lock);
@@ -1891,7 +1891,7 @@ static xtBool dl_collect_garbage(XTThrea
freer_(); // xt_unlock_mutex(&db->db_co_dlog_lock)
/* Flush the transaction log. */
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(db, self))
xt_throw(self);
/* Save state in source log header. */
=== modified file 'storage/pbxt/src/discover_xt.cc'
--- a/storage/pbxt/src/discover_xt.cc 2009-11-16 20:49:51 +0000
+++ b/storage/pbxt/src/discover_xt.cc 2009-12-02 11:50:40 +0000
@@ -31,6 +31,9 @@
#include <drizzled/session.h>
#include <drizzled/server_includes.h>
#include <drizzled/sql_base.h>
+#include <drizzled/statement/alter_table.h>
+#include <algorithm>
+#include <sstream>
#endif
#include "strutil_xt.h"
@@ -39,18 +42,273 @@
#include "ha_xtsys.h"
#ifndef DRIZZLED
-#if MYSQL_VERSION_ID > 60005
+#if MYSQL_VERSION_ID >= 50404
#define DOT_STR(x) x.str
#else
#define DOT_STR(x) x
#endif
#endif
-#ifndef DRIZZLED
+//#ifndef DRIZZLED
#define LOCK_OPEN_HACK_REQUIRED
-#endif // DRIZZLED
+//#endif // DRIZZLED
#ifdef LOCK_OPEN_HACK_REQUIRED
+#ifdef DRIZZLED
+
+using namespace drizzled;
+using namespace std;
+
+#define mysql_create_table_no_lock hacked_mysql_create_table_no_lock
+
+namespace drizzled {
+
+int rea_create_table(Session *session, const char *path,
+ const char *db, const char *table_name,
+ message::Table *table_proto,
+ HA_CREATE_INFO *create_info,
+ List<CreateField> &create_field,
+ uint32_t key_count,KEY *key_info);
+}
+
+static uint32_t build_tmptable_filename(Session* session,
+ char *buff, size_t bufflen)
+{
+ uint32_t length;
+ ostringstream path_str, post_tmpdir_str;
+ string tmp;
+
+ path_str << drizzle_tmpdir;
+ post_tmpdir_str << "/" << TMP_FILE_PREFIX << current_pid;
+ post_tmpdir_str << session->thread_id << session->tmp_table++;
+ tmp= post_tmpdir_str.str();
+
+ transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
+
+ path_str << tmp;
+
+ if (bufflen < path_str.str().length())
+ length= 0;
+ else
+ length= unpack_filename(buff, path_str.str().c_str());
+
+ return length;
+}
+
+static bool mysql_create_table_no_lock(Session *session,
+ const char *db, const char *table_name,
+ HA_CREATE_INFO *create_info,
+ message::Table *table_proto,
+ AlterInfo *alter_info,
+ bool internal_tmp_table,
+ uint32_t select_field_count)
+{
+ char path[FN_REFLEN];
+ uint32_t path_length;
+ uint db_options, key_count;
+ KEY *key_info_buffer;
+ Cursor *file;
+ bool error= true;
+ /* Check for duplicate fields and check type of table to create */
+ if (!alter_info->create_list.elements)
+ {
+ my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
+ MYF(0));
+ return true;
+ }
+ assert(strcmp(table_name,table_proto->name().c_str())==0);
+ if (check_engine(session, table_name, create_info))
+ return true;
+ db_options= create_info->table_options;
+ if (create_info->row_type == ROW_TYPE_DYNAMIC)
+ db_options|=HA_OPTION_PACK_RECORD;
+
+ /*if (!(file= create_info->db_type->getCursor((TableShare*) 0, session->mem_root)))
+ {
+ my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Cursor));
+ return true;
+ }*/
+
+ /* PMC - Done to avoid getting the partition handler by mistake! */
+ if (!(file= new (session->mem_root) ha_xtsys(pbxt_hton, NULL)))
+ {
+ my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Cursor));
+ return true;
+ }
+
+ set_table_default_charset(create_info, (char*) db);
+
+ if (mysql_prepare_create_table(session,
+ create_info,
+ table_proto,
+ alter_info,
+ internal_tmp_table,
+ &db_options, file,
+ &key_info_buffer, &key_count,
+ select_field_count))
+ goto err;
+
+ /* Check if table exists */
+ if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ {
+ path_length= build_tmptable_filename(session, path, sizeof(path));
+ }
+ else
+ {
+ #ifdef FN_DEVCHAR
+ /* check if the table name contains FN_DEVCHAR when defined */
+ if (strchr(table_name, FN_DEVCHAR))
+ {
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name);
+ return true;
+ }
+#endif
+ path_length= build_table_filename(path, sizeof(path), db, table_name, internal_tmp_table);
+ }
+
+ /* Check if table already exists */
+ if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
+ session->find_temporary_table(db, table_name))
+ {
+ if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
+ {
+ create_info->table_existed= 1; // Mark that table existed
+ push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ table_name);
+ error= 0;
+ goto err;
+ }
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
+ goto err;
+ }
+
+ //pthread_mutex_lock(&LOCK_open); /* CREATE TABLE (some confussion on naming, double check) */
+ if (!internal_tmp_table && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ if (plugin::StorageEngine::getTableDefinition(*session,
+ path,
+ db,
+ table_name,
+ internal_tmp_table) == EEXIST)
+ {
+ if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
+ {
+ error= false;
+ push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ table_name);
+ create_info->table_existed= 1; // Mark that table existed
+ }
+ else
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
+
+ goto unlock_and_end;
+ }
+ /*
+ * We don't assert here, but check the result, because the table could be
+ * in the table definition cache and in the same time the .frm could be
+ * missing from the disk, in case of manual intervention which deletes
+ * the .frm file. The user has to use FLUSH TABLES; to clear the cache.
+ * Then she could create the table. This case is pretty obscure and
+ * therefore we don't introduce a new error message only for it.
+ * */
+ if (TableShare::getShare(db, table_name))
+ {
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
+ goto unlock_and_end;
+ }
+ }
+ /*
+ * Check that table with given name does not already
+ * exist in any storage engine. In such a case it should
+ * be discovered and the error ER_TABLE_EXISTS_ERROR be returned
+ * unless user specified CREATE TABLE IF EXISTS
+ * The LOCK_open mutex has been locked to make sure no
+ * one else is attempting to discover the table. Since
+ * it's not on disk as a frm file, no one could be using it!
+ * */
+ if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ bool create_if_not_exists =
+ create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS;
+
+ char table_path[FN_REFLEN];
+ uint32_t table_path_length;
+
+ table_path_length= build_table_filename(table_path, sizeof(table_path),
+ db, table_name, false);
+
+ int retcode= plugin::StorageEngine::getTableDefinition(*session,
+ table_path,
+ db,
+ table_name,
+ false);
+ switch (retcode)
+ {
+ case ENOENT:
+ /* Normal case, no table exists. we can go and create it */
+ break;
+ case EEXIST:
+ if (create_if_not_exists)
+ {
+ error= false;
+ push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ table_name);
+ create_info->table_existed= 1; // Mark that table existed
+ goto unlock_and_end;
+ }
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
+ goto unlock_and_end;
+ default:
+ my_error(retcode, MYF(0),table_name);
+ goto unlock_and_end;
+ }
+ }
+
+ session->set_proc_info("creating table");
+ create_info->table_existed= 0; // Mark that table is created
+
+ create_info->table_options=db_options;
+
+ if (rea_create_table(session, path, db, table_name,
+ table_proto,
+ create_info, alter_info->create_list,
+ key_count, key_info_buffer))
+ goto unlock_and_end;
+
+ if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ {
+ /* Open table and put in temporary table list */
+ if (!(session->open_temporary_table(path, db, table_name, 1, OTM_OPEN)))
+ {
+ (void) session->rm_temporary_table(create_info->db_type, path);
+ goto unlock_and_end;
+ }
+ }
+
+ /*
+ * Don't write statement if:
+ * - It is an internal temporary table,
+ * - Row-based logging is used and it we are creating a temporary table, or
+ * - The binary log is not open.
+ * Otherwise, the statement shall be binlogged.
+ * */
+ if (!internal_tmp_table &&
+ ((!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
+ write_bin_log(session, session->query, session->query_length);
+ error= false;
+unlock_and_end:
+ //pthread_mutex_unlock(&LOCK_open);
+
+err:
+ session->set_proc_info("After create");
+ delete file;
+ return(error);
+}
+
+#else // MySQL case
///////////////////////////////
/*
* Unfortunately I cannot use the standard mysql_create_table_no_lock() because it will lock "LOCK_open"
@@ -1229,13 +1487,13 @@ static bool mysql_create_table_no_lock(T
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
/* Open table and put in temporary table list */
-#if MYSQL_VERSION_ID > 60005
+#if MYSQL_VERSION_ID >= 50404
if (!(open_temporary_table(thd, path, db, table_name, 1, OTM_OPEN)))
#else
if (!(open_temporary_table(thd, path, db, table_name, 1)))
#endif
{
-#if MYSQL_VERSION_ID > 60005
+#if MYSQL_VERSION_ID >= 50404
(void) rm_temporary_table(create_info->db_type, path, false);
#else
(void) rm_temporary_table(create_info->db_type, path);
@@ -1252,11 +1510,21 @@ static bool mysql_create_table_no_lock(T
- The binary log is not open.
Otherwise, the statement shall be binlogged.
*/
+ /* PBXT 1.0.09e
+ * Firstly we had a compile problem with MySQL 5.1.42 and
+ * the write_bin_log() call below:
+ * discover_xt.cc:1259: error: argument of type 'char* (Statement::)()' does not match 'const char*'
+ *
+ * And secondly, we should no write the BINLOG anyway because this is
+ * an internal PBXT system table.
+ *
+ * So I am just commenting out the code altogether.
if (!internal_tmp_table &&
(!thd->current_stmt_binlog_row_based ||
(thd->current_stmt_binlog_row_based &&
!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
- write_bin_log(thd, TRUE, thd->query(), thd->query_length());
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ */
error= FALSE;
unlock_and_end:
pthread_mutex_unlock(&LOCK_open);
@@ -1279,37 +1547,51 @@ warn:
////// END OF CUT AND PASTES FROM sql_table.cc ////////
////////////////////////////////////////////////////////
+#endif // DRIZZLED
#endif // LOCK_OPEN_HACK_REQUIRED
//------------------------------
int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *XT_UNUSED(keys), xtBool skip_existing)
{
#ifdef DRIZZLED
- drizzled::message::Table table_proto;
+#define MYLEX_CREATE_INFO create_info
+#else
+#define MYLEX_CREATE_INFO mylex.create_info
+#endif
+
+#ifdef DRIZZLED
+ drizzled::statement::AlterTable *stmt = new drizzled::statement::AlterTable(thd);
+ HA_CREATE_INFO create_info;
+ //AlterInfo alter_info;
+ drizzled::message::Table table_proto;
static const char *ext = ".dfe";
static const int ext_len = 4;
+
+ table_proto.mutable_engine()->mutable_name()->assign("PBXT");
#else
static const char *ext = ".frm";
static const int ext_len = 4;
#endif
int err = 1;
- //HA_CREATE_INFO create_info = {0};
- //Alter_info alter_info;
char field_length_buffer[12], *field_length_ptr;
LEX *save_lex= thd->lex, mylex;
-
- memset(&mylex.create_info, 0, sizeof(HA_CREATE_INFO));
+
+ memset(&MYLEX_CREATE_INFO, 0, sizeof(HA_CREATE_INFO));
thd->lex = &mylex;
- lex_start(thd);
+ lex_start(thd);
+#ifdef DRIZZLED
+ mylex.statement = stmt;
+#endif
/* setup the create info */
- mylex.create_info.db_type = hton;
+ MYLEX_CREATE_INFO.db_type = hton;
+
#ifndef DRIZZLED
mylex.create_info.frm_only = 1;
#endif
- mylex.create_info.default_table_charset = system_charset_info;
+ MYLEX_CREATE_INFO.default_table_charset = system_charset_info;
/* setup the column info. */
while (info->field_name) {
@@ -1335,7 +1617,7 @@ int xt_create_table_frm(handlerton *hton
#else
if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,
info->field_flags,
-#if MYSQL_VERSION_ID > 60005
+#if MYSQL_VERSION_ID >= 50404
HA_SM_DISK,
COLUMN_FORMAT_TYPE_FIXED,
#endif
@@ -1369,7 +1651,7 @@ int xt_create_table_frm(handlerton *hton
table_proto.set_name(name);
table_proto.set_type(drizzled::message::Table::STANDARD);
- if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &table_proto, &mylex.alter_info, 1, 0, false))
+ if (mysql_create_table_no_lock(thd, db, name, &create_info, &table_proto, &stmt->alter_info, 1, 0))
goto error;
#else
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0))
=== modified file 'storage/pbxt/src/filesys_xt.cc'
--- a/storage/pbxt/src/filesys_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/filesys_xt.cc 2009-11-24 10:55:06 +0000
@@ -56,6 +56,8 @@
//#define DEBUG_TRACE_FILES
//#define INJECT_WRITE_REMAP_ERROR
/* This is required to make testing on the Mac faster: */
+/* It turns of full file sync. */
+#define DEBUG_FAST_MAC
#endif
#ifdef DEBUG_TRACE_FILES
@@ -63,10 +65,6 @@
#define PRINTF xt_trace
#endif
-#if defined(XT_MAC) && defined(F_FULLFSYNC)
-#undef F_FULLFSYNC
-#endif
-
#ifdef INJECT_WRITE_REMAP_ERROR
#define INJECT_REMAP_FILE_SIZE 1000000
#define INJECT_REMAP_FILE_TYPE "xtd"
@@ -883,7 +881,7 @@ xtPublic xtBool xt_flush_file(XTOpenFile
* fsync didn't really flush index pages to disk. fcntl(F_FULLFSYNC) is considered more effective
* in such case.
*/
-#ifdef F_FULLFSYNC
+#if defined(F_FULLFSYNC) && !defined(DEBUG_FAST_MAC)
if (fcntl(of->of_filedes, F_FULLFSYNC, 0) == -1) {
xt_register_ferrno(XT_REG_CONTEXT, errno, xt_file_path(of));
goto failed;
=== modified file 'storage/pbxt/src/filesys_xt.h'
--- a/storage/pbxt/src/filesys_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/filesys_xt.h 2009-11-24 10:55:06 +0000
@@ -102,7 +102,7 @@ xtBool xt_fs_rename(struct XTThread *s
#define FILE_MAP_UNLOCK(i, o) xt_xsmutex_unlock(i, o)
#elif defined(FILE_MAP_USE_PTHREAD_RW)
#define FILE_MAP_LOCK_TYPE xt_rwlock_type
-#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_free_rwlock(i)
#define FILE_MAP_READ_LOCK(i, o) xt_slock_rwlock_ns(i)
#define FILE_MAP_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(i)
=== modified file 'storage/pbxt/src/ha_pbxt.cc'
--- a/storage/pbxt/src/ha_pbxt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/ha_pbxt.cc 2009-11-27 15:37:02 +0000
@@ -35,6 +35,7 @@
#include <stdlib.h>
#include <time.h>
+#include <ctype.h>
#ifdef DRIZZLED
#include <drizzled/common.h>
@@ -42,14 +43,21 @@
#include <mysys/my_alloc.h>
#include <mysys/hash.h>
#include <drizzled/field.h>
-#include <drizzled/current_session.h>
+#include <drizzled/session.h>
#include <drizzled/data_home.h>
#include <drizzled/error.h>
#include <drizzled/table.h>
#include <drizzled/field/timestamp.h>
#include <drizzled/server_includes.h>
+#include <drizzled/plugin/info_schema_table.h>
extern "C" char **session_query(Session *session);
#define my_strdup(a,b) strdup(a)
+
+using drizzled::plugin::Registry;
+using drizzled::plugin::ColumnInfo;
+using drizzled::plugin::InfoSchemaTable;
+using drizzled::plugin::InfoSchemaMethods;
+
#else
#include "mysql_priv.h"
#include <mysql/plugin.h>
@@ -71,7 +79,7 @@ extern "C" char **session_query(Session
#include "tabcache_xt.h"
#include "systab_xt.h"
#include "xaction_xt.h"
-#include "restart_xt.h"
+#include "backup_xt.h"
#ifdef DEBUG
//#define XT_USE_SYS_PAR_DEBUG_SIZES
@@ -101,6 +109,10 @@ static void pbxt_drop_database(handlert
static int pbxt_close_connection(handlerton *hton, THD* thd);
static int pbxt_commit(handlerton *hton, THD *thd, bool all);
static int pbxt_rollback(handlerton *hton, THD *thd, bool all);
+static int pbxt_prepare(handlerton *hton, THD *thd, bool all);
+static int pbxt_recover(handlerton *hton, XID *xid_list, uint len);
+static int pbxt_commit_by_xid(handlerton *hton, XID *xid);
+static int pbxt_rollback_by_xid(handlerton *hton, XID *xid);
#endif
static void ha_aquire_exclusive_use(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);
static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share);
@@ -123,7 +135,9 @@ static void ha_close_open_tables(XTThre
#ifdef PBXT_HANDLER_TRACE
#define PBXT_ALLOW_PRINTING
-#define XT_TRACE_CALL() do { XTThreadPtr s = xt_get_self(); printf("%s %s\n", s ? s->t_name : "-unknown-", __FUNC__); } while (0)
+#define XT_TRACE_CALL() ha_trace_function(__FUNC__, NULL)
+#define XT_TRACE_METHOD() ha_trace_function(__FUNC__, pb_share->sh_table_path->ps_path)
+
#ifdef PBXT_TRACE_RETURN
#define XT_RETURN(x) do { printf("%d\n", (int) (x)); return (x); } while (0)
#define XT_RETURN_VOID do { printf("out\n"); return; } while (0)
@@ -135,6 +149,7 @@ static void ha_close_open_tables(XTThre
#else
#define XT_TRACE_CALL()
+#define XT_TRACE_METHOD()
#define XT_RETURN(x) return (x)
#define XT_RETURN_VOID return
@@ -165,10 +180,10 @@ xtBool pbxt_crash_debug = TRUE;
xtBool pbxt_crash_debug = FALSE;
#endif
+
/* Variables for pbxt share methods */
static xt_mutex_type pbxt_database_mutex; // Prevent a database from being opened while it is being dropped
static XTHashTabPtr pbxt_share_tables; // Hash used to track open tables
-XTDatabaseHPtr pbxt_database = NULL; // The global open database
static char *pbxt_index_cache_size;
static char *pbxt_record_cache_size;
static char *pbxt_log_cache_size;
@@ -180,6 +195,12 @@ static char *pbxt_data_log_threshold;
static char *pbxt_data_file_grow_size;
static char *pbxt_row_file_grow_size;
static int pbxt_max_threads;
+static my_bool pbxt_support_xa;
+
+#ifndef DRIZZLED
+// drizzle complains it's not used
+static XTXactEnumXARec pbxt_xa_enum;
+#endif
#ifdef DEBUG
#define XT_SHARE_LOCK_WAIT 5000
@@ -259,6 +280,33 @@ static HAVarParamsRec vp_row_file_grow_s
//#define XT_AUTO_INCREMENT_DEF 1
#endif
+#ifdef PBXT_HANDLER_TRACE
+static void ha_trace_function(const char *function, char *table)
+{
+ char func_buf[50], *ptr;
+ XTThreadPtr thread = xt_get_self();
+
+ if ((ptr = strchr(function, '('))) {
+ ptr--;
+ while (ptr > function) {
+ if (!(isalnum(*ptr) || *ptr == '_'))
+ break;
+ ptr--;
+ }
+ ptr++;
+ xt_strcpy(50, func_buf, ptr);
+ if ((ptr = strchr(func_buf, '(')))
+ *ptr = 0;
+ }
+ else
+ xt_strcpy(50, func_buf, function);
+ if (table)
+ printf("%s %s (%s)\n", thread ? thread->t_name : "-unknown-", func_buf, table);
+ else
+ printf("%s %s\n", thread ? thread->t_name : "-unknown-", func_buf);
+}
+#endif
+
/*
* -----------------------------------------------------------------------
* SHARED TABLE DATA
@@ -584,6 +632,9 @@ xtPublic XTThreadPtr xt_ha_thd_to_self(T
/* The first bit is 1. */
static u_int ha_get_max_bit(MX_BITMAP *map)
{
+#ifdef DRIZZLED
+ return map->getFirstSet();
+#else
my_bitmap_map *data_ptr = map->bitmap;
my_bitmap_map *end_ptr = map->last_word_ptr;
my_bitmap_map b;
@@ -612,6 +663,7 @@ static u_int ha_get_max_bit(MX_BITMAP *m
cnt -= 32;
}
return 0;
+#endif
}
/*
@@ -684,9 +736,10 @@ xtPublic int xt_ha_pbxt_to_mysql_error(i
return(-1); // Unknown error
}
-xtPublic int xt_ha_pbxt_thread_error_for_mysql(THD *XT_UNUSED(thd), const XTThreadPtr self, int ignore_dup_key)
+xtPublic int xt_ha_pbxt_thread_error_for_mysql(THD *thd, const XTThreadPtr self, int ignore_dup_key)
{
- int xt_err = self->t_exception.e_xt_err;
+ int xt_err = self->t_exception.e_xt_err;
+ xtBool dup_key = FALSE;
XT_PRINT2(self, "xt_ha_pbxt_thread_error_for_mysql xt_err=%d auto commit=%d\n", (int) xt_err, (int) self->st_auto_commit);
switch (xt_err) {
@@ -725,6 +778,7 @@ xtPublic int xt_ha_pbxt_thread_error_for
/* If we are in auto-commit mode (and we are not ignoring
* duplicate keys) then rollback the transaction automatically.
*/
+ dup_key = TRUE;
if (!ignore_dup_key && self->st_auto_commit)
goto abort_transaction;
break;
@@ -790,26 +844,20 @@ xtPublic int xt_ha_pbxt_thread_error_for
/* Locks are held on tables.
* Only rollback after locks are released.
*/
- self->st_auto_commit = TRUE;
+ /* I do not think this is required, because
+ * I tell mysql to rollback below,
+ * besides it is a hack!
+ self->st_auto_commit = TRUE;
+ */
self->st_abort_trans = TRUE;
}
-#ifdef xxxx
-/* DBUG_ASSERT(thd->transaction.stmt.ha_list == NULL ||
- trans == &thd->transaction.stmt); in handler.cc now
- * fails, and I don't know if this function can be called anymore! */
- /* Cause any other DBs to do a rollback as well... */
- if (thd) {
- /*
- * GOTCHA:
- * This is a BUG in MySQL. I cannot rollback a transaction if
- * pb_mysql_thd->in_sub_stmt! But I must....?!
- */
-#ifdef MYSQL_SERVER
- if (!thd->in_sub_stmt)
- ha_rollback(thd);
-#endif
+ /* Only tell MySQL to rollback if we automatically rollback.
+ * Note: calling this with (thd, FALSE), cause sp.test to fail.
+ */
+ if (!dup_key) {
+ if (thd)
+ thd_mark_transaction_to_rollback(thd, TRUE);
}
-#endif
}
break;
}
@@ -908,7 +956,11 @@ static void pbxt_call_init(XTThreadPtr s
xt_db_data_file_grow_size = (size_t) data_file_grow_size;
xt_db_row_file_grow_size = (size_t) row_file_grow_size;
+#ifdef DRIZZLED
+ pbxt_ignore_case = TRUE;
+#else
pbxt_ignore_case = lower_case_table_names != 0;
+#endif
if (pbxt_ignore_case)
pbxt_share_tables = xt_new_hashtable(self, ha_hash_comp_ci, ha_hash_ci, ha_hash_free, TRUE, FALSE);
else
@@ -968,7 +1020,7 @@ static void pbxt_call_exit(XTThreadPtr s
*/
static void ha_exit(XTThreadPtr self)
{
- xt_xres_wait_for_recovery(self);
+ xt_xres_terminate_recovery(self);
/* Wrap things up... */
xt_unuse_database(self, self); /* Just in case the main thread has a database in use (for testing)? */
@@ -1024,7 +1076,7 @@ static bool pbxt_show_status(handlerton
cont_(a);
if (!not_ok) {
- if (stat_print(thd, "PBXT", 4, "", 0, strbuf.sb_cstring, strbuf.sb_len))
+ if (stat_print(thd, "PBXT", 4, "", 0, strbuf.sb_cstring, (uint) strbuf.sb_len))
not_ok = TRUE;
}
xt_sb_set_size(self, &strbuf, 0);
@@ -1038,14 +1090,14 @@ static bool pbxt_show_status(handlerton
* return 1 on error, else 0.
*/
#ifdef DRIZZLED
-static int pbxt_init(PluginRegistry ®istry)
+static int pbxt_init(Registry ®istry)
#else
static int pbxt_init(void *p)
#endif
{
int init_err = 0;
- XT_TRACE_CALL();
+ XT_PRINT0(NULL, "pbxt_init\n");
if (sizeof(xtWordPS) != sizeof(void *)) {
printf("PBXT: This won't work, I require that sizeof(xtWordPS) == sizeof(void *)!\n");
@@ -1076,11 +1128,27 @@ static int pbxt_init(void *p)
pbxt_hton->close_connection = pbxt_close_connection; /* close_connection, cleanup thread related data. */
pbxt_hton->commit = pbxt_commit; /* commit */
pbxt_hton->rollback = pbxt_rollback; /* rollback */
+ if (pbxt_support_xa) {
+ pbxt_hton->prepare = pbxt_prepare;
+ pbxt_hton->recover = pbxt_recover;
+ pbxt_hton->commit_by_xid = pbxt_commit_by_xid;
+ pbxt_hton->rollback_by_xid = pbxt_rollback_by_xid;
+ }
+ else {
+ pbxt_hton->prepare = NULL;
+ pbxt_hton->recover = NULL;
+ pbxt_hton->commit_by_xid = NULL;
+ pbxt_hton->rollback_by_xid = NULL;
+ }
pbxt_hton->create = pbxt_create_handler; /* Create a new handler */
pbxt_hton->drop_database = pbxt_drop_database; /* Drop a database */
pbxt_hton->panic = pbxt_panic; /* Panic call */
pbxt_hton->show_status = pbxt_show_status;
pbxt_hton->flags = HTON_NO_FLAGS; /* HTON_CAN_RECREATE - Without this flags TRUNCATE uses delete_all_rows() */
+ pbxt_hton->slot = (uint)-1; /* assign invald value, so we know when it's inited later */
+#if defined(MYSQL_SUPPORTS_BACKUP) && defined(XT_ENABLE_ONLINE_BACKUP)
+ pbxt_hton->get_backup_engine = pbxt_backup_engine;
+#endif
#endif
if (!xt_init_logging()) /* Initialize logging */
goto error_1;
@@ -1160,8 +1228,10 @@ static int pbxt_init(void *p)
* Only real problem, 2 threads try to load the same
* plugin at the same time.
*/
+#if MYSQL_VERSION_ID < 60014
myxt_mutex_unlock(&LOCK_plugin);
#endif
+#endif
/* Can't do this here yet, because I need a THD! */
try_(b) {
@@ -1195,8 +1265,10 @@ static int pbxt_init(void *p)
if (thd)
myxt_destroy_thread(thd, FALSE);
#ifndef DRIZZLED
+#if MYSQL_VERSION_ID < 60014
myxt_mutex_lock(&LOCK_plugin);
#endif
+#endif
}
#endif
}
@@ -1262,7 +1334,7 @@ static int pbxt_init(void *p)
}
#ifdef DRIZZLED
-static int pbxt_end(PluginRegistry ®istry)
+static int pbxt_end(Registry ®istry)
#else
static int pbxt_end(void *)
#endif
@@ -1378,7 +1450,7 @@ static int pbxt_commit(handlerton *hton,
* transaction (!all && !self->st_auto_commit).
*/
if (all || self->st_auto_commit) {
- XT_PRINT0(self, "xt_xn_commit\n");
+ XT_PRINT0(self, "xt_xn_commit in pbxt_commit\n");
if (!xt_xn_commit(self))
err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
@@ -1402,7 +1474,7 @@ static int pbxt_rollback(handlerton *hto
XTThreadPtr self;
if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) {
- XT_PRINT1(self, "pbxt_rollback all=%d\n", all);
+ XT_PRINT1(self, "pbxt_rollback all=%d in pbxt_commit\n", all);
if (self->st_xact_data) {
/* There are no table locks, rollback immediately in all cases
@@ -1431,7 +1503,7 @@ static int pbxt_rollback(handlerton *hto
}
#ifdef DRIZZLED
-handler *PBXTStorageEngine::create(TABLE_SHARE *table, MEM_ROOT *mem_root)
+Cursor *PBXTStorageEngine::create(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
PBXTStorageEngine * const hton = this;
#else
@@ -1446,6 +1518,182 @@ static handler *pbxt_create_handler(hand
/*
* -----------------------------------------------------------------------
+ * 2-PHASE COMMIT
+ *
+ */
+
+#ifndef DRIZZLED
+
+static int pbxt_prepare(handlerton *hton, THD *thd, bool all)
+{
+ int err = 0;
+ XTThreadPtr self;
+
+ XT_TRACE_CALL();
+ if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) {
+ XT_PRINT1(self, "pbxt_commit all=%d\n", all);
+
+ if (self->st_xact_data) {
+ /* There are no table locks, commit immediately in all cases
+ * except when this is a statement commit with an explicit
+ * transaction (!all && !self->st_auto_commit).
+ */
+ if (all) {
+ XID xid;
+
+ XT_PRINT0(self, "xt_xn_prepare in pbxt_prepare\n");
+ thd_get_xid(thd, (MYSQL_XID*) &xid);
+
+ if (!xt_xn_prepare(xid.length(), (xtWord1 *) &xid, self))
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
+ }
+ }
+ }
+ return err;
+}
+
+static XTThreadPtr ha_temp_open_global_database(handlerton *hton, THD **ret_thd, int *temp_thread, char *thread_name, int *err)
+{
+ THD *thd;
+ XTThreadPtr self = NULL;
+
+ *temp_thread = 0;
+ if ((thd = current_thd))
+ self = (XTThreadPtr) *thd_ha_data(thd, hton);
+ else {
+ //thd = (THD *) myxt_create_thread();
+ //*temp_thread |= 2;
+ }
+
+ if (!self) {
+ XTExceptionRec e;
+
+ if (!(self = xt_create_thread(thread_name, FALSE, TRUE, &e))) {
+ *err = xt_ha_pbxt_to_mysql_error(e.e_xt_err);
+ xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
+ return NULL;
+ }
+ *temp_thread |= 1;
+ }
+
+ xt_xres_wait_for_recovery(self, XT_RECOVER_DONE);
+
+ try_(a) {
+ xt_open_database(self, mysql_real_data_home, TRUE);
+ }
+ catch_(a) {
+ *err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
+ if ((*temp_thread & 1))
+ xt_free_thread(self);
+ if (*temp_thread & 2)
+ myxt_destroy_thread(thd, FALSE);
+ self = NULL;
+ }
+ cont_(a);
+
+ *ret_thd = thd;
+ return self;
+}
+
+static void ha_temp_close_database(XTThreadPtr self, THD *thd, int temp_thread)
+{
+ xt_unuse_database(self, self);
+ if (temp_thread & 1)
+ xt_free_thread(self);
+ if (temp_thread & 2)
+ myxt_destroy_thread(thd, TRUE);
+}
+
+/* Return all prepared transactions, found during recovery.
+ * This function returns a count. If len is returned, the
+ * function will be called again.
+ */
+static int pbxt_recover(handlerton *hton, XID *xid_list, uint len)
+{
+ xtBool temp_thread;
+ XTThreadPtr self;
+ XTDatabaseHPtr db;
+ uint count = 0;
+ XTXactPreparePtr xap;
+ int err;
+ THD *thd;
+
+ if (!(self = ha_temp_open_global_database(hton, &thd, &temp_thread, "TempForRecover", &err)))
+ return 0;
+
+ db = self->st_database;
+
+ for (count=0; count<len; count++) {
+ xap = xt_xn_enum_xa_data(db, &pbxt_xa_enum);
+ if (!xap)
+ break;
+ memcpy(&xid_list[count], xap->xp_xa_data, xap->xp_data_len);
+ }
+
+ ha_temp_close_database(self, thd, temp_thread);
+ return (int) count;
+}
+
+static int pbxt_commit_by_xid(handlerton *hton, XID *xid)
+{
+ xtBool temp_thread;
+ XTThreadPtr self;
+ XTDatabaseHPtr db;
+ int err = 0;
+ XTXactPreparePtr xap;
+ THD *thd;
+
+ XT_TRACE_CALL();
+
+ if (!(self = ha_temp_open_global_database(hton, &thd, &temp_thread, "TempForCommitXA", &err)))
+ return err;
+ db = self->st_database;
+
+ if ((xap = xt_xn_find_xa_data(db, xid->length(), (xtWord1 *) xid, TRUE, self))) {
+ if ((self->st_xact_data = xt_xn_get_xact(db, xap->xp_xact_id, self))) {
+ self->st_xact_data->xd_flags &= ~XT_XN_XAC_PREPARED; // Prepared transactions cannot be swept!
+ if (!xt_xn_commit(self))
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
+ }
+ xt_xn_delete_xa_data(db, xap, TRUE, self);
+ }
+
+ ha_temp_close_database(self, thd, temp_thread);
+ return 0;
+}
+
+static int pbxt_rollback_by_xid(handlerton *hton, XID *xid)
+{
+ int temp_thread;
+ XTThreadPtr self;
+ XTDatabaseHPtr db;
+ int err = 0;
+ XTXactPreparePtr xap;
+ THD *thd;
+
+ XT_TRACE_CALL();
+
+ if (!(self = ha_temp_open_global_database(hton, &thd, &temp_thread, "TempForRollbackXA", &err)))
+ return err;
+ db = self->st_database;
+
+ if ((xap = xt_xn_find_xa_data(db, xid->length(), (xtWord1 *) xid, TRUE, self))) {
+ if ((self->st_xact_data = xt_xn_get_xact(db, xap->xp_xact_id, self))) {
+ self->st_xact_data->xd_flags &= ~XT_XN_XAC_PREPARED; // Prepared transactions cannot be swept!
+ if (!xt_xn_rollback(self))
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
+ }
+ xt_xn_delete_xa_data(db, xap, TRUE, self);
+ }
+
+ ha_temp_close_database(self, thd, temp_thread);
+ return 0;
+}
+
+#endif
+
+/*
+ * -----------------------------------------------------------------------
* HANDLER LOCKING FUNCTIONS
*
* These functions are used get a lock on all handles of a particular table.
@@ -1497,7 +1745,7 @@ static void ha_aquire_exclusive_use(XTTh
ha_pbxt *handler;
time_t end_time = time(NULL) + XT_SHARE_LOCK_TIMEOUT / 1000;
- XT_PRINT1(self, "ha_aquire_exclusive_use %s PBXT X lock\n", share->sh_table_path->ps_path);
+ XT_PRINT1(self, "ha_aquire_exclusive_use (%s) PBXT X lock\n", share->sh_table_path->ps_path);
/* GOTCHA: It is possible to hang here, if you hold
* onto the sh_ex_mutex lock, before we really
* have the exclusive lock (i.e. before all
@@ -1578,7 +1826,7 @@ static void ha_release_exclusive_use(XTT
static void ha_release_exclusive_use(XTThreadPtr XT_UNUSED(self), XTSharePtr share)
#endif
{
- XT_PRINT1(self, "ha_release_exclusive_use %s PBXT X UNLOCK\n", share->sh_table_path->ps_path);
+ XT_PRINT1(self, "ha_release_exclusive_use (%s) PBXT X UNLOCK\n", share->sh_table_path->ps_path);
xt_lock_mutex_ns((xt_mutex_type *) share->sh_ex_mutex);
share->sh_table_lock = FALSE;
xt_broadcast_cond_ns((xt_cond_type *) share->sh_ex_cond);
@@ -1589,7 +1837,7 @@ static xtBool ha_wait_for_shared_use(ha_
{
time_t end_time = time(NULL) + XT_SHARE_LOCK_TIMEOUT / 1000;
- XT_PRINT1(xt_get_self(), "ha_wait_for_shared_use %s share lock wait...\n", share->sh_table_path->ps_path);
+ XT_PRINT1(xt_get_self(), "ha_wait_for_shared_use (%s) share lock wait...\n", share->sh_table_path->ps_path);
mine->pb_ex_in_use = 0;
xt_lock_mutex_ns((xt_mutex_type *) share->sh_ex_mutex);
while (share->sh_table_lock) {
@@ -1667,14 +1915,38 @@ xtPublic int ha_pbxt::reopen()
*
*/
-int pbxt_statistics_fill_table(THD *thd, TABLE_LIST *tables, COND *cond)
+static int pbxt_statistics_fill_table(THD *thd, TABLE_LIST *tables, COND *cond)
{
- XTThreadPtr self;
+ XTThreadPtr self = NULL;
int err = 0;
+ if (!pbxt_hton) {
+ /* Can't do if PBXT is not loaded! */
+ XTExceptionRec e;
+
+ xt_exception_xterr(&e, XT_CONTEXT, XT_ERR_PBXT_NOT_INSTALLED);
+ xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
+ /* Just return an empty set: */
+ return 0;
+ }
+
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
+
+
try_(a) {
+ /* If the thread has no open database, and the global
+ * database is already open, then open
+ * the database. Otherwise the statement will be
+ * executed without an open database, which means
+ * that the related statistics will be missing.
+ *
+ * This includes all background threads.
+ */
+ if (!self->st_database && pbxt_database) {
+ xt_ha_open_database_of_table(self, (XTPathStrPtr) NULL);
+ }
+
err = myxt_statistics_fill_table(self, thd, tables, cond, system_charset_info);
}
catch_(a) {
@@ -1684,6 +1956,24 @@ int pbxt_statistics_fill_table(THD *thd,
return err;
}
+#ifdef DRIZZLED
+ColumnInfo pbxt_statistics_fields_info[]=
+{
+ ColumnInfo("ID", 4, MYSQL_TYPE_LONG, 0, 0, "The ID of the statistic", SKIP_OPEN_TABLE),
+ ColumnInfo("Name", 40, MYSQL_TYPE_STRING, 0, 0, "The name of the statistic", SKIP_OPEN_TABLE),
+ ColumnInfo("Value", 8, MYSQL_TYPE_LONGLONG, 0, 0, "The accumulated value", SKIP_OPEN_TABLE),
+ ColumnInfo()
+};
+
+class PBXTStatisticsMethods : public InfoSchemaMethods
+{
+public:
+ int fillTable(Session *session, TableList *tables, COND *cond)
+ {
+ return pbxt_statistics_fill_table(session, tables, cond);
+ }
+};
+#else
ST_FIELD_INFO pbxt_statistics_fields_info[]=
{
{ "ID", 4, MYSQL_TYPE_LONG, 0, 0, "The ID of the statistic", SKIP_OPEN_TABLE},
@@ -1691,24 +1981,28 @@ ST_FIELD_INFO pbxt_statistics_fields_inf
{ "Value", 8, MYSQL_TYPE_LONGLONG, 0, 0, "The accumulated value", SKIP_OPEN_TABLE},
{ 0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
+#endif
#ifdef DRIZZLED
static InfoSchemaTable *pbxt_statistics_table;
-
-int pbxt_init_statitics(PluginRegistry ®istry)
+static PBXTStatisticsMethods pbxt_statistics_methods;
+static int pbxt_init_statistics(Registry ®istry)
#else
-int pbxt_init_statitics(void *p)
+static int pbxt_init_statistics(void *p)
#endif
{
#ifdef DRIZZLED
- pbxt_statistics_table = (InfoSchemaTable *)xt_calloc_ns(sizeof(InfoSchemaTable));
- pbxt_statistics_table->table_name= "PBXT_STATISTICS";
+ //pbxt_statistics_table = (InfoSchemaTable *)xt_calloc_ns(sizeof(InfoSchemaTable));
+ //pbxt_statistics_table->table_name= "PBXT_STATISTICS";
+ pbxt_statistics_table = new InfoSchemaTable("PBXT_STATISTICS");
+ pbxt_statistics_table->setColumnInfo(pbxt_statistics_fields_info);
+ pbxt_statistics_table->setInfoSchemaMethods(&pbxt_statistics_methods);
registry.add(pbxt_statistics_table);
#else
ST_SCHEMA_TABLE *pbxt_statistics_table = (ST_SCHEMA_TABLE *) p;
-#endif
pbxt_statistics_table->fields_info = pbxt_statistics_fields_info;
pbxt_statistics_table->fill_table = pbxt_statistics_fill_table;
+#endif
#if defined(XT_WIN) && defined(XT_COREDUMP)
void register_crash_filter();
@@ -1721,14 +2015,14 @@ int pbxt_init_statitics(void *p)
}
#ifdef DRIZZLED
-int pbxt_exit_statitics(PluginRegistry ®istry)
+static int pbxt_exit_statistics(Registry ®istry)
#else
-int pbxt_exit_statitics(void *XT_UNUSED(p))
+static int pbxt_exit_statistics(void *XT_UNUSED(p))
#endif
{
#ifdef DRIZZLED
registry.remove(pbxt_statistics_table);
- xt_free_ns(pbxt_statistics_table);
+ delete pbxt_statistics_table;
#endif
return(0);
}
@@ -1758,7 +2052,11 @@ ha_pbxt::ha_pbxt(handlerton *hton, TABLE
* exist for the storage engine. This is also used by the default rename_table and
* delete_table method in handler.cc.
*/
+#ifdef DRIZZLED
+const char **PBXTStorageEngine::bas_ext() const
+#else
const char **ha_pbxt::bas_ext() const
+#endif
{
return pbxt_extensions;
}
@@ -1800,11 +2098,13 @@ MX_TABLE_TYPES_T ha_pbxt::table_flags()
* purposes!
HA_NOT_EXACT_COUNT |
*/
+#ifndef DRIZZLED
/*
* This basically means we have a file with the name of
* database table (which we do).
*/
HA_FILE_BASED |
+#endif
/*
* Not sure what this does (but MyISAM and InnoDB have it)?!
* Could it mean that we support the handler functions.
@@ -1971,7 +2271,7 @@ int ha_pbxt::open(const char *table_path
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
- XT_PRINT1(self, "ha_pbxt::open %s\n", table_path);
+ XT_PRINT1(self, "open (%s)\n", table_path);
pb_ex_in_use = 1;
try_(a) {
@@ -2049,7 +2349,7 @@ int ha_pbxt::close(void)
}
}
- XT_PRINT1(self, "ha_pbxt::close %s\n", pb_share && pb_share->sh_table_path->ps_path ? pb_share->sh_table_path->ps_path : "unknown");
+ XT_PRINT1(self, "close (%s)\n", pb_share && pb_share->sh_table_path->ps_path ? pb_share->sh_table_path->ps_path : "unknown");
if (self) {
try_(a) {
@@ -2125,9 +2425,10 @@ void ha_pbxt::init_auto_increment(xtWord
if (!TS(table)->next_number_key_offset) {
// Autoincrement at key-start
err = index_last(table->record[1]);
- if (!err)
+ if (!err && !table->next_number_field->is_null(TS(table)->rec_buff_length)) {
/* {PRE-INC} */
nr = (xtWord8) table->next_number_field->val_int_offset(TS(table)->rec_buff_length);
+ }
}
else {
/* Do an index scan to find the largest value! */
@@ -2180,8 +2481,10 @@ void ha_pbxt::init_auto_increment(xtWord
table->next_number_field = tmp_fie;
table->in_use = tmp_thd;
- if (xn_started)
+ if (xn_started) {
+ XT_PRINT0(self, "xt_xn_commit in init_auto_increment\n");
xt_xn_commit(self);
+ }
}
xt_spinlock_unlock(&tab->tab_ainc_lock);
}
@@ -2228,13 +2531,13 @@ void ha_pbxt::get_auto_increment(MX_ULON
* insert into t1 values (-1);
* insert into t1 values (NULL);
*/
-void ha_pbxt::set_auto_increment(Field *nr)
+xtPublic void ha_set_auto_increment(XTOpenTablePtr ot, Field *nr)
{
register XTTableHPtr tab;
MX_ULONGLONG_T nr_int_val;
nr_int_val = nr->val_int();
- tab = pb_open_tab->ot_table;
+ tab = ot->ot_table;
if (nr->cmp((const unsigned char *)&tab->tab_auto_inc) > 0) {
xt_spinlock_lock(&tab->tab_ainc_lock);
@@ -2260,9 +2563,9 @@ void ha_pbxt::set_auto_increment(Field *
#else
tab->tab_dic.dic_min_auto_inc = nr_int_val + 100;
#endif
- pb_open_tab->ot_thread = xt_get_self();
- if (!xt_tab_write_min_auto_inc(pb_open_tab))
- xt_log_and_clear_exception(pb_open_tab->ot_thread);
+ ot->ot_thread = xt_get_self();
+ if (!xt_tab_write_min_auto_inc(ot))
+ xt_log_and_clear_exception(ot->ot_thread);
}
}
}
@@ -2305,7 +2608,7 @@ int ha_pbxt::write_row(byte *buf)
ASSERT_NS(pb_ex_in_use);
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::write_row %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(pb_open_tab->ot_thread, "write_row (%s)\n", pb_share->sh_table_path->ps_path);
XT_DISABLED_TRACE(("INSERT tx=%d val=%d\n", (int) pb_open_tab->ot_thread->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(&buf[1])));
//statistic_increment(ha_write_count,&LOCK_status);
#ifdef PBMS_ENABLED
@@ -2350,7 +2653,7 @@ int ha_pbxt::write_row(byte *buf)
err = update_err;
goto done;
}
- set_auto_increment(table->next_number_field);
+ ha_set_auto_increment(pb_open_tab, table->next_number_field);
}
if (!xt_tab_new_record(pb_open_tab, (xtWord1 *) buf)) {
@@ -2423,7 +2726,7 @@ int ha_pbxt::update_row(const byte * old
ASSERT_NS(pb_ex_in_use);
- XT_PRINT1(self, "ha_pbxt::update_row %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(self, "update_row (%s)\n", pb_share->sh_table_path->ps_path);
XT_DISABLED_TRACE(("UPDATE tx=%d val=%d\n", (int) self->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(&new_data[1])));
//statistic_increment(ha_update_count,&LOCK_status);
@@ -2472,7 +2775,7 @@ int ha_pbxt::update_row(const byte * old
old_map = mx_tmp_use_all_columns(table, table->read_set);
nr = table->found_next_number_field->val_int();
- set_auto_increment(table->found_next_number_field);
+ ha_set_auto_increment(pb_open_tab, table->found_next_number_field);
mx_tmp_restore_column_map(table, old_map);
}
@@ -2504,7 +2807,7 @@ int ha_pbxt::delete_row(const byte * buf
ASSERT_NS(pb_ex_in_use);
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::delete_row %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(pb_open_tab->ot_thread, "delete_row (%s)\n", pb_share->sh_table_path->ps_path);
XT_DISABLED_TRACE(("DELETE tx=%d val=%d\n", (int) pb_open_tab->ot_thread->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(&buf[1])));
//statistic_increment(ha_delete_count,&LOCK_status);
@@ -2829,7 +3132,8 @@ int ha_pbxt::xt_index_prev_read(XTOpenTa
int ha_pbxt::index_init(uint idx, bool XT_UNUSED(sorted))
{
- XTIndexPtr ind;
+ XTIndexPtr ind;
+ XTThreadPtr thread = pb_open_tab->ot_thread;
/* select count(*) from smalltab_PBXT;
* ignores the error below, and continues to
@@ -2851,6 +3155,15 @@ int ha_pbxt::index_init(uint idx, bool X
printf("index_init %s index %d cols req=%d/%d read_bits=%X write_bits=%X index_bits=%X\n", pb_open_tab->ot_table->tab_name->ps_path, (int) idx, pb_open_tab->ot_cols_req, pb_open_tab->ot_cols_req, (int) *table->read_set->bitmap, (int) *table->write_set->bitmap, (int) *ind->mi_col_map.bitmap);
#endif
+ /* Start a statement based transaction as soon
+ * as a read is done for a modify type statement!
+ * Previously, this was done too late!
+ */
+ if (!thread->st_stat_trans) {
+ trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
+ XT_PRINT0(thread, "ha_pbxt::update_row trans_register_ha all=FALSE\n");
+ thread->st_stat_trans = TRUE;
+ }
}
else {
pb_open_tab->ot_cols_req = ha_get_max_bit(table->read_set);
@@ -2901,7 +3214,7 @@ int ha_pbxt::index_init(uint idx, bool X
#endif
}
- xt_xlog_check_long_writer(pb_open_tab->ot_thread);
+ xt_xlog_check_long_writer(thread);
pb_open_tab->ot_thread->st_statistics.st_scan_index++;
return 0;
@@ -2911,7 +3224,7 @@ int ha_pbxt::index_end()
{
int err = 0;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
XTThreadPtr thread = pb_open_tab->ot_thread;
@@ -2991,7 +3304,7 @@ int ha_pbxt::index_read_xt(byte * buf, u
ASSERT_NS(pb_ex_in_use);
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::index_read_xt %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(pb_open_tab->ot_thread, "index_read_xt (%s)\n", pb_share->sh_table_path->ps_path);
XT_DISABLED_TRACE(("search tx=%d val=%d update=%d\n", (int) pb_open_tab->ot_thread->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(key), pb_modified));
ind = (XTIndexPtr) pb_share->sh_dic_keys[idx];
@@ -3072,7 +3385,7 @@ int ha_pbxt::index_next(byte * buf)
int err = 0;
XTIndexPtr ind;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_next_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3114,7 +3427,7 @@ int ha_pbxt::index_next_same(byte * buf,
XTIndexPtr ind;
XTIdxSearchKeyRec search_key;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_next_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3154,7 +3467,7 @@ int ha_pbxt::index_prev(byte * buf)
int err = 0;
XTIndexPtr ind;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_prev_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3188,7 +3501,7 @@ int ha_pbxt::index_first(byte * buf)
XTIndexPtr ind;
XTIdxSearchKeyRec search_key;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_first_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3228,7 +3541,7 @@ int ha_pbxt::index_last(byte * buf)
XTIndexPtr ind;
XTIdxSearchKeyRec search_key;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_last_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3275,10 +3588,11 @@ int ha_pbxt::index_last(byte * buf)
*/
int ha_pbxt::rnd_init(bool scan)
{
- int err = 0;
+ int err = 0;
+ XTThreadPtr thread = pb_open_tab->ot_thread;
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::rnd_init %s\n", pb_share->sh_table_path->ps_path);
- XT_DISABLED_TRACE(("seq scan tx=%d\n", (int) pb_open_tab->ot_thread->st_xact_data->xd_start_xn_id));
+ XT_PRINT1(thread, "rnd_init (%s)\n", pb_share->sh_table_path->ps_path);
+ XT_DISABLED_TRACE(("seq scan tx=%d\n", (int) thread->st_xact_data->xd_start_xn_id));
/* Call xt_tab_seq_exit() to make sure the resources used by the previous
* scan are freed. In particular make sure cache page ref count is decremented.
@@ -3296,8 +3610,18 @@ int ha_pbxt::rnd_init(bool scan)
xt_tab_seq_exit(pb_open_tab);
/* The number of columns required: */
- if (pb_open_tab->ot_is_modify)
+ if (pb_open_tab->ot_is_modify) {
pb_open_tab->ot_cols_req = table->read_set->MX_BIT_SIZE();
+ /* Start a statement based transaction as soon
+ * as a read is done for a modify type statement!
+ * Previously, this was done too late!
+ */
+ if (!thread->st_stat_trans) {
+ trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
+ XT_PRINT0(thread, "ha_pbxt::update_row trans_register_ha all=FALSE\n");
+ thread->st_stat_trans = TRUE;
+ }
+ }
else {
pb_open_tab->ot_cols_req = ha_get_max_bit(table->read_set);
@@ -3322,14 +3646,14 @@ int ha_pbxt::rnd_init(bool scan)
else
xt_tab_seq_reset(pb_open_tab);
- xt_xlog_check_long_writer(pb_open_tab->ot_thread);
+ xt_xlog_check_long_writer(thread);
return err;
}
int ha_pbxt::rnd_end()
{
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
/*
* make permanent the lock for the last scanned row
@@ -3358,7 +3682,7 @@ int ha_pbxt::rnd_next(byte *buf)
int err = 0;
xtBool eof;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
ASSERT_NS(pb_ex_in_use);
//statistic_increment(ha_read_rnd_next_count, &LOCK_status);
xt_xlog_check_long_writer(pb_open_tab->ot_thread);
@@ -3393,7 +3717,7 @@ int ha_pbxt::rnd_next(byte *buf)
*/
void ha_pbxt::position(const byte *XT_UNUSED(record))
{
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
ASSERT_NS(pb_ex_in_use);
/*
* I changed this from using little endian to big endian.
@@ -3429,10 +3753,10 @@ int ha_pbxt::rnd_pos(byte * buf, byte *p
{
int err = 0;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
ASSERT_NS(pb_ex_in_use);
//statistic_increment(ha_read_rnd_count, &LOCK_status);
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::rnd_pos %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(pb_open_tab->ot_thread, "rnd_pos (%s)\n", pb_share->sh_table_path->ps_path);
pb_open_tab->ot_curr_rec_id = mi_uint4korr((xtWord1 *) pos);
switch (xt_tab_dirty_read_record(pb_open_tab, (xtWord1 *) buf)) {
@@ -3509,7 +3833,7 @@ int ha_pbxt::info(uint flag)
XTOpenTablePtr ot;
int in_use;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
if (!(in_use = pb_ex_in_use)) {
pb_ex_in_use = 1;
@@ -3535,7 +3859,7 @@ int ha_pbxt::info(uint flag)
stats.index_file_length = xt_ind_node_to_offset(ot->ot_table, ot->ot_table->tab_ind_eof);
stats.delete_length = ot->ot_table->tab_rec_fnum * ot->ot_rec_size;
//check_time = info.check_time;
- stats.mean_rec_length = ot->ot_rec_size;
+ stats.mean_rec_length = (ulong) ot->ot_rec_size;
}
if (flag & HA_STATUS_CONST) {
@@ -3551,7 +3875,9 @@ int ha_pbxt::info(uint flag)
stats.block_size = XT_INDEX_PAGE_SIZE;
if (share->tmp_table == NO_TMP_TABLE)
-#if MYSQL_VERSION_ID > 60005
+#ifdef DRIZZLED
+#define WHICH_MUTEX mutex
+#elif MYSQL_VERSION_ID >= 50404
#define WHICH_MUTEX LOCK_ha_data
#else
#define WHICH_MUTEX mutex
@@ -3559,19 +3885,15 @@ int ha_pbxt::info(uint flag)
#ifdef SAFE_MUTEX
-#if MYSQL_VERSION_ID < 60000
+#if MYSQL_VERSION_ID < 50404
#if MYSQL_VERSION_ID < 50123
safe_mutex_lock(&share->mutex,__FILE__,__LINE__);
#else
safe_mutex_lock(&share->mutex,0,__FILE__,__LINE__);
#endif
#else
-#if MYSQL_VERSION_ID < 60004
- safe_mutex_lock(&share->mutex,__FILE__,__LINE__);
-#else
safe_mutex_lock(&share->WHICH_MUTEX,0,__FILE__,__LINE__);
#endif
-#endif
#else // SAFE_MUTEX
@@ -3675,7 +3997,7 @@ int ha_pbxt::extra(enum ha_extra_functio
{
int err = 0;
- XT_PRINT2(xt_get_self(), "ha_pbxt::extra %s operation=%d\n", pb_share->sh_table_path->ps_path, operation);
+ XT_PRINT2(xt_get_self(), "ha_pbxt::extra (%s) operation=%d\n", pb_share->sh_table_path->ps_path, operation);
switch (operation) {
case HA_EXTRA_RESET_STATE:
@@ -3771,14 +4093,14 @@ int ha_pbxt::extra(enum ha_extra_functio
*/
int ha_pbxt::reset(void)
{
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
extra(HA_EXTRA_RESET_STATE);
XT_RETURN(0);
}
void ha_pbxt::unlock_row()
{
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
if (pb_open_tab)
pb_open_tab->ot_table->tab_locks.xt_remove_temp_lock(pb_open_tab, FALSE);
}
@@ -3802,7 +4124,7 @@ int ha_pbxt::delete_all_rows()
XTDDTable *tab_def = NULL;
char path[PATH_MAX];
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
if (thd_sql_command(thd) != SQLCOM_TRUNCATE) {
/* Just like InnoDB we only handle TRUNCATE TABLE
@@ -3906,7 +4228,7 @@ int ha_pbxt::analyze(THD *thd, HA_CHECK_
xtXactID clean_xn_id = 0;
uint cnt = 10;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
if (!pb_open_tab) {
if ((err = reopen()))
@@ -4056,7 +4378,7 @@ xtPublic int ha_pbxt::external_lock(THD
ASSERT_NS(pb_ex_in_use);
*/
- XT_PRINT1(self, "ha_pbxt::EXTERNAL_LOCK %s lock_type=UNLOCK\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(self, "EXTERNAL_LOCK (%s) lock_type=UNLOCK\n", pb_share->sh_table_path->ps_path);
/* Make any temporary locks on this table permanent.
*
@@ -4189,10 +4511,9 @@ xtPublic int ha_pbxt::external_lock(THD
xt_broadcast_cond_ns((xt_cond_type *) pb_share->sh_ex_cond);
}
else {
- XT_PRINT2(self, "ha_pbxt::EXTERNAL_LOCK %s lock_type=%d\n", pb_share->sh_table_path->ps_path, lock_type);
+ XT_PRINT2(self, "ha_pbxt::EXTERNAL_LOCK (%s) lock_type=%d\n", pb_share->sh_table_path->ps_path, lock_type);
if (pb_lock_table) {
-
pb_ex_in_use = 1;
try_(a) {
if (!pb_table_locked)
@@ -4243,14 +4564,18 @@ xtPublic int ha_pbxt::external_lock(THD
if ((pb_open_tab->ot_for_update = (lock_type == F_WRLCK))) {
switch ((int) thd_sql_command(thd)) {
case SQLCOM_DELETE:
+#ifndef DRIZZLED
case SQLCOM_DELETE_MULTI:
+#endif
/* turn DELETE IGNORE into normal DELETE. The IGNORE option causes problems because
* when a record is deleted we add an xlog record which we cannot "rollback" later
* when we find that an FK-constraint has failed.
*/
thd->lex->ignore = false;
case SQLCOM_UPDATE:
+#ifndef DRIZZLED
case SQLCOM_UPDATE_MULTI:
+#endif
case SQLCOM_REPLACE:
case SQLCOM_REPLACE_SELECT:
case SQLCOM_INSERT:
@@ -4265,7 +4590,9 @@ xtPublic int ha_pbxt::external_lock(THD
case SQLCOM_DROP_TABLE:
case SQLCOM_DROP_INDEX:
case SQLCOM_LOAD:
+#ifndef DRIZZLED
case SQLCOM_REPAIR:
+#endif
case SQLCOM_OPTIMIZE:
self->st_stat_modify = TRUE;
break;
@@ -4316,11 +4643,16 @@ xtPublic int ha_pbxt::external_lock(THD
self->st_xact_mode = thd_tx_isolation(thd) <= ISO_READ_COMMITTED ? XT_XACT_COMMITTED_READ : XT_XACT_REPEATABLE_READ;
self->st_ignore_fkeys = (thd_test_options(thd,OPTION_NO_FOREIGN_KEY_CHECKS)) != 0;
self->st_auto_commit = (thd_test_options(thd, (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) == 0;
+#ifdef DRIZZLED
+ self->st_table_trans = FALSE;
+#else
self->st_table_trans = thd_sql_command(thd) == SQLCOM_LOCK_TABLES;
+#endif
self->st_abort_trans = FALSE;
self->st_stat_ended = FALSE;
self->st_stat_trans = FALSE;
XT_PRINT0(self, "xt_xn_begin\n");
+ xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT);
if (!xt_xn_begin(self)) {
err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
pb_ex_in_use = 0;
@@ -4404,7 +4736,7 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
- XT_PRINT2(self, "ha_pbxt::start_stmt %s lock_type=%d\n", pb_share->sh_table_path->ps_path, (int) lock_type);
+ XT_PRINT2(self, "ha_pbxt::start_stmt (%s) lock_type=%d\n", pb_share->sh_table_path->ps_path, (int) lock_type);
if (!pb_open_tab) {
if ((err = reopen()))
@@ -4430,12 +4762,12 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
/* This section handles "auto-commit"... */
if (self->st_xact_data && self->st_auto_commit && self->st_table_trans) {
if (self->st_abort_trans) {
- XT_PRINT0(self, "xt_xn_rollback\n");
+ XT_PRINT0(self, "xt_xn_rollback in start_stmt\n");
if (!xt_xn_rollback(self))
err = xt_ha_pbxt_thread_error_for_mysql(pb_mysql_thd, self, pb_ignore_dup_key);
}
else {
- XT_PRINT0(self, "xt_xn_commit\n");
+ XT_PRINT0(self, "xt_xn_commit in start_stmt\n");
if (!xt_xn_commit(self))
err = xt_ha_pbxt_thread_error_for_mysql(pb_mysql_thd, self, pb_ignore_dup_key);
}
@@ -4466,9 +4798,11 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
if (pb_open_tab->ot_for_update) {
switch ((int) thd_sql_command(thd)) {
case SQLCOM_UPDATE:
- case SQLCOM_UPDATE_MULTI:
case SQLCOM_DELETE:
+#ifndef DRIZZLED
+ case SQLCOM_UPDATE_MULTI:
case SQLCOM_DELETE_MULTI:
+#endif
case SQLCOM_REPLACE:
case SQLCOM_REPLACE_SELECT:
case SQLCOM_INSERT:
@@ -4483,14 +4817,15 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
case SQLCOM_DROP_TABLE:
case SQLCOM_DROP_INDEX:
case SQLCOM_LOAD:
+#ifndef DRIZZLED
case SQLCOM_REPAIR:
+#endif
case SQLCOM_OPTIMIZE:
self->st_stat_modify = TRUE;
break;
}
}
-
/* (***) This is required at this level!
* No matter how often it is called, it is still the start of a
* statement. We need to make sure statements that are NOT mistaken
@@ -4516,6 +4851,7 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
self->st_stat_ended = FALSE;
self->st_stat_trans = FALSE;
XT_PRINT0(self, "xt_xn_begin\n");
+ xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT);
if (!xt_xn_begin(self)) {
err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
goto complete;
@@ -4673,7 +5009,9 @@ THR_LOCK_DATA **ha_pbxt::store_lock(THD
*
*/
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE) &&
+#ifndef DRIZZLED
!(thd_in_lock_tables(thd) && thd_sql_command(thd) == SQLCOM_LOCK_TABLES) &&
+#endif
!thd_tablespace_op(thd) &&
thd_sql_command(thd) != SQLCOM_TRUNCATE &&
thd_sql_command(thd) != SQLCOM_OPTIMIZE &&
@@ -4691,22 +5029,23 @@ THR_LOCK_DATA **ha_pbxt::store_lock(THD
* Stewart: removed SQLCOM_CALL, not sure of implications.
*/
- if (lock_type == TL_READ_NO_INSERT &&
- (!thd_in_lock_tables(thd)
+ if (lock_type == TL_READ_NO_INSERT
#ifndef DRIZZLED
+ && (!thd_in_lock_tables(thd)
|| thd_sql_command(thd) == SQLCOM_CALL
+ )
#endif
- ))
+ )
{
lock_type = TL_READ;
}
- XT_PRINT3(xt_get_self(), "ha_pbxt::store_lock %s %d->%d\n", pb_share->sh_table_path->ps_path, pb_lock.type, lock_type);
+ XT_PRINT3(xt_get_self(), "store_lock (%s) %d->%d\n", pb_share->sh_table_path->ps_path, pb_lock.type, lock_type);
pb_lock.type = lock_type;
}
#ifdef PBXT_HANDLER_TRACE
else {
- XT_PRINT3(xt_get_self(), "ha_pbxt::store_lock %s %d->%d (ignore/unlock)\n", pb_share->sh_table_path->ps_path, lock_type, lock_type);
+ XT_PRINT3(xt_get_self(), "store_lock (%s) %d->%d (ignore/unlock)\n", pb_share->sh_table_path->ps_path, lock_type, lock_type);
}
#endif
*to++= &pb_lock;
@@ -4723,15 +5062,23 @@ THR_LOCK_DATA **ha_pbxt::store_lock(THD
* during create if the table_flag HA_DROP_BEFORE_CREATE was specified for
* the storage engine.
*/
+#ifdef DRIZZLED
+int PBXTStorageEngine::doDropTable(Session &, std::string table_path_str)
+#else
int ha_pbxt::delete_table(const char *table_path)
+#endif
{
THD *thd = current_thd;
int err = 0;
XTThreadPtr self = NULL;
XTSharePtr share;
+#ifdef DRIZZLED
+ const char *table_path = table_path_str.c_str();
+#endif
+
STAT_TRACE(self, *thd_query(thd));
- XT_PRINT1(self, "ha_pbxt::delete_table %s\n", table_path);
+ XT_PRINT1(self, "delete_table (%s)\n", table_path);
if (XTSystemTableShare::isSystemTable(table_path))
return delete_system_table(table_path);
@@ -4795,7 +5142,7 @@ int ha_pbxt::delete_table(const char *ta
#endif
}
catch_(a) {
- err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
#ifdef DRIZZLED
if (err == HA_ERR_NO_SUCH_TABLE)
err = ENOENT;
@@ -4819,7 +5166,11 @@ int ha_pbxt::delete_table(const char *ta
return err;
}
+#ifdef DRIZZLED
+int PBXTStorageEngine::delete_system_table(const char *table_path)
+#else
int ha_pbxt::delete_system_table(const char *table_path)
+#endif
{
THD *thd = current_thd;
XTExceptionRec e;
@@ -4857,7 +5208,13 @@ int ha_pbxt::delete_system_table(const c
* This function can be used to move a table from one database to
* another.
*/
+#ifdef DRIZZLED
+int PBXTStorageEngine::doRenameTable(Session *,
+ const char *from,
+ const char *to)
+#else
int ha_pbxt::rename_table(const char *from, const char *to)
+#endif
{
THD *thd = current_thd;
int err = 0;
@@ -4865,15 +5222,13 @@ int ha_pbxt::rename_table(const char *fr
XTSharePtr share;
XTDatabaseHPtr to_db;
- XT_TRACE_CALL();
-
if (XTSystemTableShare::isSystemTable(from))
return rename_system_table(from, to);
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
- XT_PRINT2(self, "ha_pbxt::rename_table %s -> %s\n", from, to);
+ XT_PRINT2(self, "rename_table (%s -> %s)\n", from, to);
#ifdef PBMS_ENABLED
PBMSResultRec result;
@@ -4929,7 +5284,7 @@ int ha_pbxt::rename_table(const char *fr
#endif
}
catch_(a) {
- err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
}
cont_(a);
@@ -4940,7 +5295,11 @@ int ha_pbxt::rename_table(const char *fr
XT_RETURN(err);
}
+#ifdef DRIZZLED
+int PBXTStorageEngine::rename_system_table(const char *XT_UNUSED(from), const char *XT_UNUSED(to))
+#else
int ha_pbxt::rename_system_table(const char *XT_UNUSED(from), const char *XT_UNUSED(to))
+#endif
{
return ER_NOT_SUPPORTED_YET;
}
@@ -5029,7 +5388,15 @@ ha_rows ha_pbxt::records_in_range(uint i
* Called from handle.cc by ha_create_table().
*/
+#ifdef DRIZZLED
+int PBXTStorageEngine::doCreateTable(Session *,
+ const char *table_path,
+ Table &table_arg,
+ HA_CREATE_INFO &create_info,
+ drizzled::message::Table &XT_UNUSED(proto))
+#else
int ha_pbxt::create(const char *table_path, TABLE *table_arg, HA_CREATE_INFO *create_info)
+#endif
{
THD *thd = current_thd;
int err = 0;
@@ -5037,37 +5404,61 @@ int ha_pbxt::create(const char *table_pa
XTDDTable *tab_def = NULL;
XTDictionaryRec dic;
- memset(&dic, 0, sizeof(dic));
+ if ((strcmp(table_path, "./pbxt/location") == 0) || (strcmp(table_path, "./pbxt/statistics") == 0))
+ return 0;
- XT_TRACE_CALL();
+ memset(&dic, 0, sizeof(dic));
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
+#ifdef DRIZZLED
+ XT_PRINT2(self, "create (%s) %s\n", table_path, (create_info.options & HA_LEX_CREATE_TMP_TABLE) ? "temporary" : "");
+#else
+ XT_PRINT2(self, "create (%s) %s\n", table_path, (create_info->options & HA_LEX_CREATE_TMP_TABLE) ? "temporary" : "");
+#endif
STAT_TRACE(self, *thd_query(thd));
- XT_PRINT1(self, "ha_pbxt::create %s\n", table_path);
try_(a) {
xt_ha_open_database_of_table(self, (XTPathStrPtr) table_path);
+#ifdef DRIZZLED
+ for (uint i=0; i<TS(&table_arg)->keys; i++) {
+ if (table_arg.key_info[i].key_length > XT_INDEX_MAX_KEY_SIZE)
+ xt_throw_sulxterr(XT_CONTEXT, XT_ERR_KEY_TOO_LARGE, table_arg.key_info[i].name, (u_long) XT_INDEX_MAX_KEY_SIZE);
+ }
+#else
for (uint i=0; i<TS(table_arg)->keys; i++) {
if (table_arg->key_info[i].key_length > XT_INDEX_MAX_KEY_SIZE)
xt_throw_sulxterr(XT_CONTEXT, XT_ERR_KEY_TOO_LARGE, table_arg->key_info[i].name, (u_long) XT_INDEX_MAX_KEY_SIZE);
}
+#endif
/* ($) auto_increment_value will be zero if
* AUTO_INCREMENT is not used. Otherwise
* Query was ALTER TABLE ... AUTO_INCREMENT = x; or
* CREATE TABLE ... AUTO_INCREMENT = x;
*/
+#ifdef DRIZZLED
+ tab_def = xt_ri_create_table(self, true, (XTPathStrPtr) table_path, *thd_query(thd), myxt_create_table_from_table(self, &table_arg));
+ tab_def->checkForeignKeys(self, create_info.options & HA_LEX_CREATE_TMP_TABLE);
+#else
tab_def = xt_ri_create_table(self, true, (XTPathStrPtr) table_path, *thd_query(thd), myxt_create_table_from_table(self, table_arg));
tab_def->checkForeignKeys(self, create_info->options & HA_LEX_CREATE_TMP_TABLE);
+#endif
dic.dic_table = tab_def;
+#ifdef DRIZZLED
+ dic.dic_my_table = &table_arg;
+ dic.dic_tab_flags = (create_info.options & HA_LEX_CREATE_TMP_TABLE) ? XT_TAB_FLAGS_TEMP_TAB : 0;
+ dic.dic_min_auto_inc = (xtWord8) create_info.auto_increment_value; /* ($) */
+ dic.dic_def_ave_row_size = table_arg.s->getAvgRowLength();
+#else
dic.dic_my_table = table_arg;
dic.dic_tab_flags = (create_info->options & HA_LEX_CREATE_TMP_TABLE) ? XT_TAB_FLAGS_TEMP_TAB : 0;
dic.dic_min_auto_inc = (xtWord8) create_info->auto_increment_value; /* ($) */
dic.dic_def_ave_row_size = (xtWord8) table_arg->s->avg_row_length;
+#endif
myxt_setup_dictionary(self, &dic);
/*
@@ -5089,7 +5480,7 @@ int ha_pbxt::create(const char *table_pa
if (tab_def)
tab_def->finalize(self);
dic.dic_table = NULL;
- err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
}
cont_(a);
@@ -5161,7 +5552,7 @@ bool ha_pbxt::get_error_message(int XT_U
if (!self->t_exception.e_xt_err)
return FALSE;
- buf->copy(self->t_exception.e_err_msg, strlen(self->t_exception.e_err_msg), system_charset_info);
+ buf->copy(self->t_exception.e_err_msg, (uint32) strlen(self->t_exception.e_err_msg), system_charset_info);
return TRUE;
}
@@ -5421,16 +5812,31 @@ static MYSQL_SYSVAR_INT(sweeper_priority
#ifdef DRIZZLED
static MYSQL_SYSVAR_INT(max_threads, pbxt_max_threads,
- PLUGIN_VAR_OPCMDARG,
+ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"The maximum number of threads used by PBXT",
NULL, NULL, 500, 20, 20000, 1);
#else
static MYSQL_SYSVAR_INT(max_threads, pbxt_max_threads,
- PLUGIN_VAR_OPCMDARG,
+ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"The maximum number of threads used by PBXT, 0 = set according to MySQL max_connections.",
NULL, NULL, 0, 0, 20000, 1);
#endif
+#ifndef DEBUG
+static MYSQL_SYSVAR_BOOL(support_xa, pbxt_support_xa,
+ PLUGIN_VAR_OPCMDARG,
+ "Enable PBXT support for the XA two-phase commit, default is enabled",
+ NULL, NULL, TRUE);
+#else
+static MYSQL_SYSVAR_BOOL(support_xa, pbxt_support_xa,
+ PLUGIN_VAR_OPCMDARG,
+ "Enable PBXT support for the XA two-phase commit, default is disabled (due to assertion failure in MySQL)",
+ /* The problem is, in MySQL an assertion fails in debug mode:
+ * Assertion failed: (total_ha_2pc == (ulong) opt_bin_log+1), function ha_recover, file handler.cc, line 1557.
+ */
+ NULL, NULL, FALSE);
+#endif
+
static struct st_mysql_sys_var* pbxt_system_variables[] = {
MYSQL_SYSVAR(index_cache_size),
MYSQL_SYSVAR(record_cache_size),
@@ -5448,6 +5854,7 @@ static struct st_mysql_sys_var* pbxt_sys
MYSQL_SYSVAR(offline_log_function),
MYSQL_SYSVAR(sweeper_priority),
MYSQL_SYSVAR(max_threads),
+ MYSQL_SYSVAR(support_xa),
NULL
};
#endif
@@ -5494,8 +5901,8 @@ mysql_declare_plugin(pbxt)
"Paul McCullagh, PrimeBase Technologies GmbH",
"PBXT internal system statitics",
PLUGIN_LICENSE_GPL,
- pbxt_init_statitics, /* plugin init */
- pbxt_exit_statitics, /* plugin deinit */
+ pbxt_init_statistics, /* plugin init */
+ pbxt_exit_statistics, /* plugin deinit */
#ifndef DRIZZLED
0x0005,
#endif
=== modified file 'storage/pbxt/src/ha_pbxt.h'
--- a/storage/pbxt/src/ha_pbxt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/ha_pbxt.h 2009-11-24 10:55:06 +0000
@@ -27,9 +27,9 @@
#ifdef DRIZZLED
#include <drizzled/common.h>
-#include <drizzled/handler.h>
-#include <drizzled/plugin/storage_engine.h>
#include <mysys/thr_lock.h>
+#include <drizzled/cursor.h>
+
#else
#include "mysql_priv.h"
#endif
@@ -53,17 +53,31 @@ class ha_pbxt;
#ifdef DRIZZLED
-class PBXTStorageEngine : public StorageEngine {
+class PBXTStorageEngine : public drizzled::plugin::StorageEngine
+{
+
+ int delete_system_table(const char *table_path);
+ int rename_system_table(const char * from, const char * to);
+
public:
PBXTStorageEngine(std::string name_arg)
- : StorageEngine(name_arg, HTON_NO_FLAGS) {}
+ : drizzled::plugin::StorageEngine(name_arg, HTON_NO_FLAGS) {}
+
+ void operator delete(void *) {}
+ void operator delete[] (void *) {}
/* override */ int close_connection(Session *);
/* override */ int commit(Session *, bool);
/* override */ int rollback(Session *, bool);
- /* override */ handler *create(TABLE_SHARE *, MEM_ROOT *);
+ /* override */ Cursor *create(TABLE_SHARE *, MEM_ROOT *);
/* override */ void drop_database(char *);
/* override */ bool show_status(Session *, stat_print_fn *, enum ha_stat_type);
+ /* override */ const char **bas_ext() const;
+ /* override */ int doCreateTable(Session *session, const char *table_name,
+ Table &table_arg, HA_CREATE_INFO
+ &create_info, drizzled::message::Table &proto);
+ /* override */ int doRenameTable(Session *, const char *from, const char *to);
+ /* override */ int doDropTable(Session &session, std::string table_path);
};
typedef PBXTStorageEngine handlerton;
@@ -139,9 +153,9 @@ class ha_pbxt: public handler
* don't implement this method unless you really have indexes.
*/
const char *index_type(uint inx) { (void) inx; return "BTREE"; }
-
+#ifndef DRIZZLED
const char **bas_ext() const;
-
+#endif
MX_UINT8_T table_cache_type();
/*
@@ -241,11 +255,13 @@ class ha_pbxt: public handler
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
int check(THD* thd, HA_CHECK_OPT* check_opt);
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
- int delete_table(const char *from);
+#ifndef DRIZZLED
int delete_system_table(const char *table_path);
- int rename_table(const char * from, const char * to);
+ int delete_table(const char *from);
int rename_system_table(const char * from, const char * to);
+ int rename_table(const char * from, const char * to);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); //required
+#endif
void update_create_info(HA_CREATE_INFO *create_info);
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); //required
@@ -277,6 +293,7 @@ struct XTThread *xt_ha_thd_to_self(THD*
int xt_ha_pbxt_to_mysql_error(int xt_err);
int xt_ha_pbxt_thread_error_for_mysql(THD *thd, const XTThreadPtr self, int ignore_dup_key);
void xt_ha_all_threads_close_database(XTThreadPtr self, XTDatabase *db);
+void ha_set_auto_increment(XTOpenTablePtr ot, Field *nr);
/*
* These hooks are suppossed to only be used by InnoDB:
=== modified file 'storage/pbxt/src/ha_xtsys.h'
--- a/storage/pbxt/src/ha_xtsys.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/ha_xtsys.h 2009-11-24 10:55:06 +0000
@@ -30,8 +30,9 @@
#ifdef DRIZZLED
#include <drizzled/common.h>
-#include <drizzled/handler.h>
+#include <drizzled/handler_structs.h>
#include <drizzled/current_session.h>
+#include <drizzled/cursor.h>
#else
#include "mysql_priv.h"
#endif
=== modified file 'storage/pbxt/src/heap_xt.cc'
--- a/storage/pbxt/src/heap_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/heap_xt.cc 2009-11-24 10:55:06 +0000
@@ -73,7 +73,7 @@ xtPublic void xt_check_heap(XTThreadPtr
}
#ifdef DEBUG_MEMORY
-xtPublic void xt_mm_heap_reference(XTThreadPtr self, XTHeapPtr hp, u_int line, c_char *file)
+xtPublic void xt_mm_heap_reference(XTThreadPtr XT_UNUSED(self), XTHeapPtr hp, u_int line, c_char *file)
#else
xtPublic void xt_heap_reference(XTThreadPtr, XTHeapPtr hp)
#endif
=== modified file 'storage/pbxt/src/index_xt.cc'
--- a/storage/pbxt/src/index_xt.cc 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/index_xt.cc 2009-11-24 10:55:06 +0000
@@ -829,14 +829,25 @@ static void idx_next_branch_item(XTTable
result->sr_item.i_item_offset += result->sr_item.i_item_size + result->sr_item.i_node_ref_size;
bitem = branch->tb_data + result->sr_item.i_item_offset;
- if (ind->mi_fix_key)
- ilen = result->sr_item.i_item_size;
+ if (result->sr_item.i_item_offset < result->sr_item.i_total_size) {
+ if (ind->mi_fix_key)
+ ilen = result->sr_item.i_item_size;
+ else {
+ ilen = myxt_get_key_length(ind, bitem) + XT_RECORD_REF_SIZE;
+ result->sr_item.i_item_size = ilen;
+ }
+ xt_get_res_record_ref(bitem + ilen - XT_RECORD_REF_SIZE, result); /* (Only valid if i_item_offset < i_total_size) */
+ }
else {
- ilen = myxt_get_key_length(ind, bitem) + XT_RECORD_REF_SIZE;
- result->sr_item.i_item_size = ilen;
+ result->sr_item.i_item_size = 0;
+ result->sr_rec_id = 0;
+ result->sr_row_id = 0;
}
- xt_get_res_record_ref(bitem + ilen - XT_RECORD_REF_SIZE, result); /* (Only valid if i_item_offset < i_total_size) */
- result->sr_branch = IDX_GET_NODE_REF(tab, bitem, result->sr_item.i_node_ref_size);
+ if (result->sr_item.i_node_ref_size)
+ /* IDX_GET_NODE_REF() loads the branch reference to the LEFT of the item. */
+ result->sr_branch = IDX_GET_NODE_REF(tab, bitem, result->sr_item.i_node_ref_size);
+ else
+ result->sr_branch = 0;
}
xtPublic void xt_prev_branch_item_fix(XTTableHPtr XT_UNUSED(tab), XTIndexPtr XT_UNUSED(ind), XTIdxBranchDPtr branch, register XTIdxResultRec *result)
@@ -3987,7 +3998,7 @@ xtPublic xtBool xt_flush_indices(XTOpenT
* here.
*/
if (!(tab->tab_dic.dic_tab_flags & XT_TAB_FLAGS_TEMP_TAB)) {
- if (!xt_xlog_flush_log(ot->ot_thread))
+ if (!xt_xlog_flush_log(tab->tab_db, ot->ot_thread))
goto failed_2;
if (!il->il_flush(ot))
goto failed_2;
=== modified file 'storage/pbxt/src/lock_xt.cc'
--- a/storage/pbxt/src/lock_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/lock_xt.cc 2009-11-24 10:55:06 +0000
@@ -1246,7 +1246,7 @@ xtPublic void xt_spinlock_init(XTThreadP
(void) self;
spl->spl_lock = 0;
#ifdef XT_NO_ATOMICS
- xt_init_mutex(self, &spl->spl_mutex);
+ xt_init_mutex_with_autoname(self, &spl->spl_mutex);
#endif
#ifdef DEBUG
spl->spl_locker = 0;
=== modified file 'storage/pbxt/src/locklist_xt.h'
--- a/storage/pbxt/src/locklist_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/locklist_xt.h 2009-11-27 15:37:02 +0000
@@ -24,11 +24,16 @@
#ifndef __xt_locklist_h__
#define __xt_locklist_h__
+/*
+ * XT_THREAD_LOCK_INFO and DEBUG_LOCKING code must be updated to avoid calls to xt_get_self() as it can be called before hton->slot is
+ * assigned by MySQL which is used by xt_get_self()
+ */
+
#ifdef DEBUG
-#define XT_THREAD_LOCK_INFO
+//#define XT_THREAD_LOCK_INFO
#ifndef XT_WIN
/* We need DEBUG_LOCKING in order to enable pthread function wrappers */
-#define DEBUG_LOCKING
+//#define DEBUG_LOCKING
#endif
#endif
=== modified file 'storage/pbxt/src/memory_xt.cc'
--- a/storage/pbxt/src/memory_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/memory_xt.cc 2009-11-25 15:06:47 +0000
@@ -34,7 +34,7 @@
#include "trace_xt.h"
#ifdef DEBUG
-//#define RECORD_MM
+#define RECORD_MM
#endif
#ifdef DEBUG
@@ -367,9 +367,8 @@ static long mm_find_pointer(void *ptr)
return(-1);
}
-static long mm_add_pointer(void *ptr, u_int id)
+static long mm_add_pointer(void *ptr, u_int XT_UNUSED(id))
{
-#pragma unused(id)
register int i, n, guess;
if (mm_nr_in_use == mm_total_allocated) {
=== modified file 'storage/pbxt/src/myxt_xt.cc'
--- a/storage/pbxt/src/myxt_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/myxt_xt.cc 2009-12-01 09:50:46 +0000
@@ -36,7 +36,7 @@
#include <drizzled/current_session.h>
#include <drizzled/sql_lex.h>
#include <drizzled/session.h>
-extern "C" struct charset_info_st *session_charset(Session *session);
+//extern "C" struct charset_info_st *session_charset(Session *session);
extern pthread_key_t THR_Session;
#else
#include "mysql_priv.h"
@@ -171,7 +171,9 @@ xtPublic u_int myxt_create_key_from_key(
for (u_int i=0; i<ind->mi_seg_count && (int) k_length > 0; i++, old += keyseg->length, keyseg++)
{
+#ifndef DRIZZLED
enum ha_base_keytype type = (enum ha_base_keytype) keyseg->type;
+#endif
u_int length = keyseg->length < k_length ? keyseg->length : k_length;
u_int char_length;
xtWord1 *pos;
@@ -192,14 +194,18 @@ xtPublic u_int myxt_create_key_from_key(
pos = old;
if (keyseg->flag & HA_SPACE_PACK) {
uchar *end = pos + length;
+#ifndef DRIZZLED
if (type != HA_KEYTYPE_NUM) {
+#endif
while (end > pos && end[-1] == ' ')
end--;
+#ifndef DRIZZLED
}
else {
while (pos < end && pos[0] == ' ')
pos++;
}
+#endif
k_length -= length;
length = (u_int) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
@@ -276,6 +282,7 @@ xtPublic u_int myxt_create_key_from_row(
char_length= ((cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : length);
pos = record + keyseg->start;
+#ifndef DRIZZLED
if (type == HA_KEYTYPE_BIT)
{
if (keyseg->bit_length)
@@ -289,17 +296,22 @@ xtPublic u_int myxt_create_key_from_row(
key+= length;
continue;
}
+#endif
if (keyseg->flag & HA_SPACE_PACK)
{
end = pos + length;
+#ifndef DRIZZLED
if (type != HA_KEYTYPE_NUM) {
+#endif
while (end > pos && end[-1] == ' ')
end--;
+#ifndef DRIZZLED
}
else {
while (pos < end && pos[0] == ' ')
pos++;
}
+#endif
length = (u_int) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
@@ -333,6 +345,7 @@ xtPublic u_int myxt_create_key_from_row(
if (keyseg->flag & HA_SWAP_KEY)
{ /* Numerical column */
#ifdef HAVE_ISNAN
+#ifndef DRIZZLED
if (type == HA_KEYTYPE_FLOAT)
{
float nr;
@@ -345,7 +358,9 @@ xtPublic u_int myxt_create_key_from_row(
continue;
}
}
- else if (type == HA_KEYTYPE_DOUBLE) {
+ else
+#endif
+ if (type == HA_KEYTYPE_DOUBLE) {
double nr;
float8get(nr,pos);
@@ -414,6 +429,7 @@ xtPublic u_int myxt_create_foreign_key_f
char_length= ((cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : length);
pos = record + keyseg->start;
+#ifndef DRIZZLED
if (type == HA_KEYTYPE_BIT)
{
if (keyseg->bit_length)
@@ -427,17 +443,22 @@ xtPublic u_int myxt_create_foreign_key_f
key+= length;
continue;
}
+#endif
if (keyseg->flag & HA_SPACE_PACK)
{
end = pos + length;
+#ifndef DRIZZLED
if (type != HA_KEYTYPE_NUM) {
+#endif
while (end > pos && end[-1] == ' ')
end--;
+#ifndef DRIZZLED
}
else {
while (pos < end && pos[0] == ' ')
pos++;
}
+#endif
length = (u_int) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
@@ -471,6 +492,7 @@ xtPublic u_int myxt_create_foreign_key_f
if (keyseg->flag & HA_SWAP_KEY)
{ /* Numerical column */
#ifdef HAVE_ISNAN
+#ifndef DRIZZLED
if (type == HA_KEYTYPE_FLOAT)
{
float nr;
@@ -483,7 +505,9 @@ xtPublic u_int myxt_create_foreign_key_f
continue;
}
}
- else if (type == HA_KEYTYPE_DOUBLE) {
+ else
+#endif
+ if (type == HA_KEYTYPE_DOUBLE) {
double nr;
float8get(nr,pos);
@@ -622,7 +646,6 @@ static char *mx_get_length_and_data(Fiel
case MYSQL_TYPE_SET:
case MYSQL_TYPE_GEOMETRY:
#else
- case DRIZZLE_TYPE_TINY:
case DRIZZLE_TYPE_LONG:
case DRIZZLE_TYPE_DOUBLE:
case DRIZZLE_TYPE_NULL:
@@ -740,7 +763,6 @@ static void mx_set_length_and_data(Field
case MYSQL_TYPE_SET:
case MYSQL_TYPE_GEOMETRY:
#else
- case DRIZZLE_TYPE_TINY:
case DRIZZLE_TYPE_LONG:
case DRIZZLE_TYPE_DOUBLE:
case DRIZZLE_TYPE_NULL:
@@ -825,6 +847,7 @@ xtPublic xtBool myxt_create_row_from_key
}
record[keyseg->null_pos] &= ~keyseg->null_bit;
}
+#ifndef DRIZZLED
if (keyseg->type == HA_KEYTYPE_BIT)
{
uint length = keyseg->length;
@@ -845,6 +868,7 @@ xtPublic xtBool myxt_create_row_from_key
key+= length;
continue;
}
+#endif
if (keyseg->flag & HA_SPACE_PACK)
{
uint length;
@@ -854,16 +878,20 @@ xtPublic xtBool myxt_create_row_from_key
goto err;
#endif
pos = record+keyseg->start;
+#ifndef DRIZZLED
if (keyseg->type != (int) HA_KEYTYPE_NUM)
{
+#endif
memcpy(pos,key,(size_t) length);
bfill(pos+length,keyseg->length-length,' ');
+#ifndef DRIZZLED
}
else
{
bfill(pos,keyseg->length-length,' ');
memcpy(pos+keyseg->length-length,key,(size_t) length);
}
+#endif
key+=length;
continue;
}
@@ -945,7 +973,7 @@ xtPublic xtBool myxt_create_row_from_key
static int my_compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
my_bool part_key, my_bool skip_end_space)
{
- uint length= min(a_length,b_length);
+ uint length= a_length < b_length ? a_length : b_length;
uchar *end= a+ length;
int flag;
@@ -1023,6 +1051,7 @@ xtPublic u_int myxt_get_key_length(XTInd
get_key_pack_length(seg_len, pack_len, key_data);
key_data += seg_len;
break;
+#ifndef DRIZZLED
case HA_KEYTYPE_NUM: {
/* Numeric key */
if (keyseg->flag & HA_SPACE_PACK)
@@ -1035,15 +1064,16 @@ xtPublic u_int myxt_get_key_length(XTInd
case HA_KEYTYPE_INT8:
case HA_KEYTYPE_SHORT_INT:
case HA_KEYTYPE_USHORT_INT:
+ case HA_KEYTYPE_INT24:
+ case HA_KEYTYPE_FLOAT:
+ case HA_KEYTYPE_BIT:
+#endif
case HA_KEYTYPE_LONG_INT:
case HA_KEYTYPE_ULONG_INT:
- case HA_KEYTYPE_INT24:
case HA_KEYTYPE_UINT24:
- case HA_KEYTYPE_FLOAT:
case HA_KEYTYPE_DOUBLE:
case HA_KEYTYPE_LONGLONG:
case HA_KEYTYPE_ULONGLONG:
- case HA_KEYTYPE_BIT:
key_data += keyseg->length;
break;
case HA_KEYTYPE_END:
@@ -1190,6 +1220,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += b_length;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_INT8:
{
int i_1 = (int) *((signed char *) a);
@@ -1218,6 +1249,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#endif
case HA_KEYTYPE_LONG_INT: {
int32 l_1 = sint4korr(a);
int32 l_2 = sint4korr(b);
@@ -1236,6 +1268,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_INT24: {
int32 l_1 = sint3korr(a);
int32 l_2 = sint3korr(b);
@@ -1245,6 +1278,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#endif
case HA_KEYTYPE_UINT24: {
int32 l_1 = uint3korr(a);
int32 l_2 = uint3korr(b);
@@ -1254,6 +1288,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_FLOAT: {
float f_1, f_2;
@@ -1270,6 +1305,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#endif
case HA_KEYTYPE_DOUBLE: {
double d_1, d_2;
@@ -1286,6 +1322,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_NUM: {
/* Numeric key */
if (keyseg->flag & HA_SPACE_PACK) {
@@ -1339,6 +1376,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += b_length;
break;
}
+#endif
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG: {
longlong ll_a = sint8korr(a);
@@ -1359,9 +1397,11 @@ xtPublic int myxt_compare_key(XTIndexPtr
break;
}
#endif
+#ifndef DRIZZLED
case HA_KEYTYPE_BIT:
/* TODO: What here? */
break;
+#endif
case HA_KEYTYPE_END: /* Ready */
goto end;
}
@@ -1410,16 +1450,19 @@ xtPublic u_int myxt_key_seg_length(XTInd
key_length = has_null + a_length + pack_len;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_INT8:
case HA_KEYTYPE_SHORT_INT:
case HA_KEYTYPE_USHORT_INT:
+ case HA_KEYTYPE_INT24:
+ case HA_KEYTYPE_FLOAT:
+#endif
case HA_KEYTYPE_LONG_INT:
case HA_KEYTYPE_ULONG_INT:
- case HA_KEYTYPE_INT24:
case HA_KEYTYPE_UINT24:
- case HA_KEYTYPE_FLOAT:
case HA_KEYTYPE_DOUBLE:
break;
+#ifndef DRIZZLED
case HA_KEYTYPE_NUM: {
/* Numeric key */
if (keyseg->flag & HA_SPACE_PACK) {
@@ -1428,14 +1471,17 @@ xtPublic u_int myxt_key_seg_length(XTInd
}
break;
}
+#endif
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
case HA_KEYTYPE_ULONGLONG:
break;
#endif
+#ifndef DRIZZLED
case HA_KEYTYPE_BIT:
/* TODO: What here? */
break;
+#endif
case HA_KEYTYPE_END: /* Ready */
break;
}
@@ -1486,7 +1532,7 @@ xtPublic xtWord4 myxt_store_row_length(X
return row_size;
}
-static xtWord4 mx_store_row(XTOpenTablePtr ot, xtWord4 row_size, char *rec_buff)
+xtPublic xtWord4 myxt_store_row_data(XTOpenTablePtr ot, xtWord4 row_size, char *rec_buff)
{
TABLE *table = ot->ot_table->tab_dic.dic_my_table;
char *sdata;
@@ -1614,8 +1660,9 @@ xtPublic size_t myxt_load_row_length(XTO
}
/* Unload from PBXT variable length format to the MySQL row format. */
-xtPublic xtBool myxt_load_row(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt)
+xtPublic xtWord4 myxt_load_row_data(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt)
{
+ xtWord1 *input_buf = source_buf;
TABLE *table;
xtWord4 len;
Field *curr_field;
@@ -1624,7 +1671,7 @@ xtPublic xtBool myxt_load_row(XTOpenTabl
if (!(table = ot->ot_table->tab_dic.dic_my_table)) {
xt_register_taberr(XT_REG_CONTEXT, XT_ERR_NO_DICTIONARY, ot->ot_table->tab_name);
- return FAILED;
+ return 0;
}
/* According to the InnoDB implementation:
@@ -1657,7 +1704,7 @@ xtPublic xtBool myxt_load_row(XTOpenTabl
default: // Length byte
if (*source_buf > 240) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_RECORD_FORMAT);
- return FAILED;
+ return 0;
}
len = *source_buf;
source_buf++;
@@ -1671,7 +1718,12 @@ xtPublic xtBool myxt_load_row(XTOpenTabl
source_buf += len;
}
- return OK;
+ return (xtWord4) (source_buf - input_buf);
+}
+
+xtPublic xtBool myxt_load_row(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt)
+{
+ return myxt_load_row_data(ot, source_buf, dest_buff, col_cnt) != 0;
}
xtPublic xtBool myxt_find_column(XTOpenTablePtr ot, u_int *col_idx, const char *col_name)
@@ -1784,7 +1836,7 @@ xtPublic xtBool myxt_store_row(XTOpenTab
else {
xtWord4 row_size;
- if (!(row_size = mx_store_row(ot, XT_REC_EXT_HEADER_SIZE, rec_buff)))
+ if (!(row_size = myxt_store_row_data(ot, XT_REC_EXT_HEADER_SIZE, rec_buff)))
return FAILED;
if (row_size - XT_REC_FIX_EXT_HEADER_DIFF <= ot->ot_rec_size) {
rec_info->ri_fix_rec_buf = (XTTabRecFixDPtr) &ot->ot_row_wbuffer[XT_REC_FIX_EXT_HEADER_DIFF];
@@ -1951,7 +2003,7 @@ static TABLE *my_open_table(XTThreadPtr
#ifdef DRIZZLED
share->init(db_name, 0, name, path);
- if ((error = open_table_def(thd, share)) ||
+ if ((error = open_table_def(*thd, share)) ||
(error = open_table_from_share(thd, share, "", 0, (uint32_t) READ_ALL, 0, table, OTM_OPEN)))
{
xt_free(self, table);
@@ -1995,7 +2047,7 @@ static TABLE *my_open_table(XTThreadPtr
return NULL;
}
-#if MYSQL_VERSION_ID >= 60003
+#if MYSQL_VERSION_ID >= 50404
if ((error = open_table_from_share(thd, share, "", 0, (uint) READ_ALL, 0, table, OTM_OPEN)))
#else
if ((error = open_table_from_share(thd, share, "", 0, (uint) READ_ALL, 0, table, FALSE)))
@@ -2145,7 +2197,10 @@ static XTIndexPtr my_create_index(XTThre
if (options & HA_OPTION_PACK_KEYS ||
(index->flags & (HA_PACK_KEY | HA_BINARY_PACK_KEY | HA_SPACE_PACK_USED)))
{
- if (key_part->length > 8 && (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_NUM ||
+ if (key_part->length > 8 && (type == HA_KEYTYPE_TEXT ||
+#ifndef DRIZZLED
+ type == HA_KEYTYPE_NUM ||
+#endif
(type == HA_KEYTYPE_BINARY && !field->zero_pack())))
{
/* No blobs here */
@@ -2213,8 +2268,12 @@ static XTIndexPtr my_create_index(XTThre
else if (field->type() == MYSQL_TYPE_ENUM) {
switch (seg->length) {
case 2:
+#ifdef DRIZZLED
+ ASSERT_NS(FALSE);
+#else
seg->type = HA_KEYTYPE_USHORT_INT;
break;
+#endif
case 3:
seg->type = HA_KEYTYPE_UINT24;
break;
@@ -2675,7 +2734,11 @@ xtPublic xtBool myxt_load_dictionary(XTT
if (!(my_tab = my_open_table(self, db, tab_path)))
return FAILED;
dic->dic_my_table = my_tab;
+#ifdef DRIZZLED
+ dic->dic_def_ave_row_size = (xtWord8) my_tab->s->getAvgRowLength();
+#else
dic->dic_def_ave_row_size = (xtWord8) my_tab->s->avg_row_length;
+#endif
myxt_setup_dictionary(self, dic);
dic->dic_keys = (XTIndexPtr *) xt_calloc(self, sizeof(XTIndexPtr) * TS(my_tab)->keys);
for (uint i=0; i<TS(my_tab)->keys; i++)
@@ -2805,8 +2868,10 @@ static void ha_create_dd_index(XTThreadP
static char *my_type_to_string(XTThreadPtr self, Field *field, TABLE *XT_UNUSED(my_tab))
{
- char buffer[MAX_FIELD_WIDTH + 400], *ptr;
+ char buffer[MAX_FIELD_WIDTH + 400];
+ const char *ptr;
String type((char *) buffer, sizeof(buffer), system_charset_info);
+ xtWord4 len;
/* GOTCHA:
* - Above sets the string length to the same as the buffer,
@@ -2817,10 +2882,17 @@ static char *my_type_to_string(XTThreadP
*/
type.length(0);
field->sql_type(type);
- ptr = type.c_ptr();
+ ptr = type.ptr();
+ len = type.length();
+
+ if (len >= sizeof(buffer))
+ len = sizeof(buffer)-1;
+
if (ptr != buffer)
- xt_strcpy(sizeof(buffer), buffer, ptr);
+ xt_strcpy(sizeof(buffer), buffer, ptr);
+ buffer[len] = 0;
+
if (field->has_charset()) {
/* Always include the charset so that we can compare types
* for FK/PK releations.
@@ -2877,6 +2949,10 @@ xtPublic XTDDTable *myxt_create_table_fr
xtPublic void myxt_static_convert_identifier(XTThreadPtr XT_UNUSED(self), MX_CHARSET_INFO *cs, char *from, char *to, size_t to_len)
{
+#ifdef DRIZZLED
+ ((void *)cs);
+ xt_strcpy(to_len, to, from);
+#else
uint errors;
/*
@@ -2888,11 +2964,16 @@ xtPublic void myxt_static_convert_identi
xt_strcpy(to_len, to, from);
else
strconvert(cs, from, &my_charset_utf8_general_ci, to, to_len, &errors);
+#endif
}
// cs == current_thd->charset()
xtPublic char *myxt_convert_identifier(XTThreadPtr self, MX_CHARSET_INFO *cs, char *from)
{
+#ifdef DRIZZLED
+ char *to = xt_dup_string(self, from);
+ ((void *)cs);
+#else
uint errors;
u_int len;
char *to;
@@ -2904,6 +2985,7 @@ xtPublic char *myxt_convert_identifier(X
to = (char *) xt_malloc(self, len);
strconvert(cs, from, &my_charset_utf8_general_ci, to, len, &errors);
}
+#endif
return to;
}
@@ -2954,11 +3036,19 @@ xtPublic MX_CHARSET_INFO *myxt_getcharse
THD *thd = current_thd;
if (thd)
- return thd_charset(thd);
+ return (MX_CHARSET_INFO *)thd_charset(thd);
}
- return &my_charset_utf8_general_ci;
+ return (MX_CHARSET_INFO *)&my_charset_utf8_general_ci;
}
+#ifdef DBUG_OFF
+//typedef struct st_plugin_int *plugin_ref;
+#define REF_MYSQL_PLUGIN(x) (x)
+#else
+//typedef struct st_plugin_int **plugin_ref;
+#define REF_MYSQL_PLUGIN(x) (*(x))
+#endif
+
xtPublic void *myxt_create_thread()
{
#ifdef DRIZZLED
@@ -3011,12 +3101,22 @@ xtPublic void *myxt_create_thread()
return NULL;
}
- if (!(new_thd = new THD())) {
+ if (!(new_thd = new THD)) {
my_thread_end();
xt_register_error(XT_REG_CONTEXT, XT_ERR_MYSQL_ERROR, 0, "Unable to create MySQL thread (THD)");
return NULL;
}
+ /*
+ * If PBXT is the default storage engine, then creating any THD objects will add extra
+ * 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.
+ */
+ LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(new_thd->variables.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--;
+ }
new_thd->thread_stack = (char *) &new_thd;
new_thd->store_globals();
lex_start(new_thd);
@@ -3052,6 +3152,17 @@ xtPublic void myxt_destroy_thread(void *
close_thread_tables(thd);
#endif
+ /*
+ * In myxt_create_thread we decremented plugin ref-count to avoid dead-locking.
+ * Here we need to increment ref-count to avoid assertion failures.
+ */
+ if (thd->variables.table_plugin) {
+ LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(thd->variables.table_plugin)->name;
+ if ((plugin_name.length == 4) && (strncmp(plugin_name.str, "PBXT", plugin_name.length) == 0)) {
+ REF_MYSQL_PLUGIN(thd->variables.table_plugin)->ref_count++;
+ }
+ }
+
delete thd;
/* Remember that we don't have a THD */
@@ -3128,11 +3239,12 @@ xtPublic int myxt_statistics_fill_table(
const char *stat_name;
u_llong stat_value;
XTStatisticsRec statistics;
+ XTDatabaseHPtr db = self->st_database;
xt_gather_statistics(&statistics);
for (u_int rec_id=0; !err && rec_id<XT_STAT_CURRENT_MAX; rec_id++) {
stat_name = xt_get_stat_meta_data(rec_id)->sm_name;
- stat_value = xt_get_statistic(&statistics, self->st_database, rec_id);
+ stat_value = xt_get_statistic(&statistics, db, rec_id);
col=0;
mx_put_u_llong(table, col++, rec_id+1);
@@ -3213,19 +3325,31 @@ static void myxt_bitmap_init(XTThreadPtr
my_bitmap_map *buf;
uint size_in_bytes = (((n_bits) + 31) / 32) * 4;
- buf = (my_bitmap_map *) xt_malloc(self, size_in_bytes);
+ buf = (my_bitmap_map *) xt_malloc(self, size_in_bytes);
+
+#ifdef DRIZZLED
+ map->init(buf, n_bits);
+#else
map->bitmap= buf;
map->n_bits= n_bits;
create_last_word_mask(map);
bitmap_clear_all(map);
+#endif
}
static void myxt_bitmap_free(XTThreadPtr self, MX_BITMAP *map)
{
+#ifdef DRIZZLED
+ my_bitmap_map *buf = map->getBitmap();
+ if (buf)
+ xt_free(self, buf);
+ map->setBitmap(NULL);
+#else
if (map->bitmap) {
xt_free(self, map->bitmap);
map->bitmap = NULL;
}
+#endif
}
/*
@@ -3269,3 +3393,29 @@ XTDDColumn *XTDDColumnFactory::createFro
return col;
}
+/*
+ * -----------------------------------------------------------------------
+ * utilities
+ */
+
+/*
+ * MySQL (not sure about Drizzle) first calls hton->init and then assigns the plugin a thread slot
+ * which is used by xt_get_self(). This is a problem as pbxt_init() starts a number of daemon threads
+ * which could try to use the slot before it is assigned. This code waits till slot is inited.
+ * We cannot directly check hton->slot as in some versions of MySQL it can be 0 before init which is a
+ * valid value.
+ */
+extern ulong total_ha;
+
+xtPublic void myxt_wait_pbxt_plugin_slot_assigned(XTThread *self)
+{
+#ifdef DRIZZLED
+ static LEX_STRING plugin_name = { C_STRING_WITH_LEN("PBXT") };
+
+ while (!self->t_quit && !Registry::singleton().find(&plugin_name))
+ xt_sleep_milli_second(1);
+#else
+ while(!self->t_quit && (pbxt_hton->slot >= total_ha))
+ xt_sleep_milli_second(1);
+#endif
+}
=== modified file 'storage/pbxt/src/myxt_xt.h'
--- a/storage/pbxt/src/myxt_xt.h 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/myxt_xt.h 2009-11-27 15:37:02 +0000
@@ -52,8 +52,10 @@ void myxt_set_default_row_from_key(XTOp
void myxt_print_key(XTIndexPtr ind, xtWord1 *key_value);
xtWord4 myxt_store_row_length(XTOpenTablePtr ot, char *rec_buff);
+xtWord4 myxt_store_row_data(XTOpenTablePtr ot, xtWord4 row_size, char *rec_buff);
xtBool myxt_store_row(XTOpenTablePtr ot, XTTabRecInfoPtr rec_info, char *rec_buff);
size_t myxt_load_row_length(XTOpenTablePtr ot, size_t buffer_size, xtWord1 *source_buf, u_int *ret_col_cnt);
+xtWord4 myxt_load_row_data(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt);
xtBool myxt_load_row(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt);
xtBool myxt_find_column(XTOpenTablePtr ot, u_int *col_idx, const char *col_name);
void myxt_get_column_name(XTOpenTablePtr ot, u_int col_idx, u_int len, char *col_name);
@@ -93,4 +95,6 @@ public:
static XTDDColumn *createFromMySQLField(XTThread *self, STRUCT_TABLE *, Field *);
};
+void myxt_wait_pbxt_plugin_slot_assigned(XTThread *self);
+
#endif
=== modified file 'storage/pbxt/src/pbms.h'
--- a/storage/pbxt/src/pbms.h 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/pbms.h 2009-11-24 10:55:06 +0000
@@ -344,16 +344,16 @@ public:
int couldBeURL(char *blob_url, int size)
{
if (blob_url && (size < PBMS_BLOB_URL_SIZE)) {
- char buffer[PBMS_BLOB_URL_SIZE+1];
- u_int32_t db_id = 0;
- u_int32_t tab_id = 0;
- u_int64_t blob_id = 0;
- u_int64_t blob_ref_id = 0;
- u_int64_t blob_size = 0;
- u_int32_t auth_code = 0;
- u_int32_t server_id = 0;
- char type, junk[5];
- int scanned;
+ char buffer[PBMS_BLOB_URL_SIZE+1];
+ unsigned long db_id = 0;
+ unsigned long tab_id = 0;
+ unsigned long long blob_id = 0;
+ unsigned long long blob_ref_id = 0;
+ unsigned long long blob_size = 0;
+ unsigned long auth_code = 0;
+ unsigned long server_id = 0;
+ char type, junk[5];
+ int scanned;
junk[0] = 0;
if (blob_url[size]) { // There is no guarantee that the URL will be null terminated.
@@ -364,12 +364,12 @@ public:
scanned = sscanf(blob_url, URL_FMT"%4s", &db_id, &type, &tab_id, &blob_id, &auth_code, &server_id, &blob_ref_id, &blob_size, junk);
if (scanned != 8) {// If junk is found at the end this will also result in an invalid URL.
- printf("Bad URL \"%s\": scanned = %d, junk: %d, %d, %d, %d\n", blob_url, scanned, junk[0], junk[1], junk[2], junk[3]);
+ printf("Bad URL \"%s\": scanned = %d, junk: %d, %d, %d, %d\n", blob_url, scanned, junk[0], junk[1], junk[2], junk[3]);
return 0;
}
if (junk[0] || (type != '~' && type != '_')) {
- printf("Bad URL \"%s\": scanned = %d, junk: %d, %d, %d, %d\n", blob_url, scanned, junk[0], junk[1], junk[2], junk[3]);
+ printf("Bad URL \"%s\": scanned = %d, junk: %d, %d, %d, %d\n", blob_url, scanned, junk[0], junk[1], junk[2], junk[3]);
return 0;
}
=== modified file 'storage/pbxt/src/pbms_enabled.cc'
--- a/storage/pbxt/src/pbms_enabled.cc 2009-10-06 15:16:01 +0000
+++ b/storage/pbxt/src/pbms_enabled.cc 2009-11-24 10:55:06 +0000
@@ -29,15 +29,10 @@
*
*/
-/*
- The following two lines backported by psergey. Remove them when we merge from PBXT again.
-*/
#include "xt_config.h"
-#ifdef PBMS_ENABLED
-#define PBMS_API pbms_enabled_api
+#ifdef PBMS_ENABLED
-#include "pbms_enabled.h"
#ifdef DRIZZLED
#include <sys/stat.h>
#include <drizzled/common_includes.h>
@@ -47,11 +42,15 @@
#include <mysql/plugin.h>
#define session_alloc(sess, size) thd_alloc(sess, size);
#define current_session current_thd
-#endif
+#endif
-#define GET_BLOB_FIELD(t, i) (Field_blob *)(t->field[t->s->blob_field[i]])
-#define DB_NAME(f) (f->table->s->db.str)
-#define TAB_NAME(f) (*(f->table_name))
+#define GET_BLOB_FIELD(t, i) (Field_blob *)(t->field[t->s->blob_field[i]])
+#define DB_NAME(f) (f->table->s->db.str)
+#define TAB_NAME(f) (*(f->table_name))
+
+#define PBMS_API pbms_enabled_api
+
+#include "pbms_enabled.h"
static PBMS_API pbms_api;
@@ -242,4 +241,4 @@ void pbms_completed(TABLE *table, bool o
return ;
}
-#endif
\ No newline at end of file
+#endif // PBMS_ENABLED
=== modified file 'storage/pbxt/src/pbms_enabled.h'
--- a/storage/pbxt/src/pbms_enabled.h 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/pbms_enabled.h 2009-11-24 10:55:06 +0000
@@ -35,13 +35,6 @@
#include "pbms.h"
-#ifdef DRIZZLED
-#include <drizzled/server_includes.h>
-#define TABLE Table
-#else
-#include <mysql_priv.h>
-#endif
-
/*
* pbms_initialize() should be called from the engines plugIn's 'init()' function.
* The engine_name is the name of your engine, "PBXT" or "InnoDB" for example.
=== modified file 'storage/pbxt/src/pthread_xt.cc'
--- a/storage/pbxt/src/pthread_xt.cc 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/pthread_xt.cc 2009-11-24 10:55:06 +0000
@@ -578,8 +578,8 @@ xtPublic int xt_p_mutex_unlock(xt_mutex_
xtPublic int xt_p_mutex_destroy(xt_mutex_type *mutex)
{
- ASSERT_NS(mutex->mu_init == 12345);
- mutex->mu_init = 89898;
+ //ASSERT_NS(mutex->mu_init == 12345);
+ mutex->mu_init = 11111;
#ifdef XT_THREAD_LOCK_INFO
xt_thread_lock_info_free(&mutex->mu_lock_info);
#endif
=== modified file 'storage/pbxt/src/restart_xt.cc'
--- a/storage/pbxt/src/restart_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/restart_xt.cc 2009-11-27 15:37:02 +0000
@@ -34,12 +34,16 @@
#include "ha_pbxt.h"
+#ifdef DRIZZLED
+#include <drizzled/data_home.h>
+using drizzled::plugin::Registry;
+#endif
+
#include "xactlog_xt.h"
#include "database_xt.h"
#include "util_xt.h"
#include "strutil_xt.h"
#include "filesys_xt.h"
-#include "restart_xt.h"
#include "myxt_xt.h"
#include "trace_xt.h"
@@ -57,13 +61,27 @@
//#define PRINTF xt_ftracef
//#define PRINTF xt_trace
-void xt_print_bytes(xtWord1 *buf, u_int len)
+/*
+ * -----------------------------------------------------------------------
+ * GLOBALS
+ */
+
+xtPublic int pbxt_recovery_state;
+
+/*
+ * -----------------------------------------------------------------------
+ * UTILITIES
+ */
+
+#ifdef TRACE_RECORD_DATA
+static void xt_print_bytes(xtWord1 *buf, u_int len)
{
for (u_int i=0; i<len; i++) {
PRINTF("%02x ", (u_int) *buf);
buf++;
}
}
+#endif
void xt_print_log_record(xtLogID log, xtLogOffset offset, XTXactLogBufferDPtr record)
{
@@ -252,7 +270,7 @@ void xt_print_log_record(xtLogID log, xt
rec_type = "DELETE";
break;
case XT_LOG_ENT_DELETE_FL:
- rec_type = "DELETE-FL-BG";
+ rec_type = "DELETE-FL";
break;
case XT_LOG_ENT_UPDATE_BG:
rec_type = "UPDATE-BG";
@@ -320,6 +338,11 @@ void xt_print_log_record(xtLogID log, xt
case XT_LOG_ENT_END_OF_LOG:
rec_type = "END OF LOG";
break;
+ case XT_LOG_ENT_PREPARE:
+ rec_type = "PREPARE";
+ xn_id = XT_GET_DISK_4(record->xp.xp_xact_id_4);
+ xn_set = TRUE;
+ break;
}
if (log)
@@ -327,6 +350,8 @@ void xt_print_log_record(xtLogID log, xt
PRINTF("%s ", rec_type);
if (type)
PRINTF("op=%lu tab=%lu %s=%lu ", (u_long) op_no, (u_long) tab_id, type, (u_long) rec_id);
+ else if (tab_id)
+ PRINTF("tab=%lu ", (u_long) tab_id);
if (row_id)
PRINTF("row=%lu ", (u_long) row_id);
if (log_id)
@@ -459,6 +484,7 @@ static xtBool xres_open_table(XTThreadPt
}
return OK;
}
+
ws->ws_tab_gone = tab_id;
return FAILED;
}
@@ -629,6 +655,7 @@ static void xres_apply_change(XTThreadPt
xtWord1 *rec_data = NULL;
XTTabRecFreeDPtr free_data;
+ ASSERT(ot->ot_thread == self);
if (tab->tab_dic.dic_key_count == 0)
check_index = FALSE;
@@ -1300,7 +1327,7 @@ static void xres_apply_operations(XTThre
* These operations are applied even though operations
* in sequence are missing.
*/
-xtBool xres_sync_operations(XTThreadPtr self, XTDatabaseHPtr db, XTWriterStatePtr ws)
+static xtBool xres_sync_operations(XTThreadPtr self, XTDatabaseHPtr db, XTWriterStatePtr ws)
{
u_int edx;
XTTableEntryPtr te_ptr;
@@ -1881,15 +1908,6 @@ xtBool XTXactRestart::xres_check_checksu
void XTXactRestart::xres_recover_progress(XTThreadPtr self, XTOpenFilePtr *of, int perc)
{
#ifdef XT_USE_GLOBAL_DB
- if (!perc) {
- char file_path[PATH_MAX];
-
- xt_strcpy(PATH_MAX, file_path, xres_db->db_main_path);
- xt_add_pbxt_file(PATH_MAX, file_path, "recovery-progress");
- *of = xt_open_file(self, file_path, XT_FS_CREATE | XT_FS_MAKE_PATH);
- xt_set_eof_file(self, *of, 0);
- }
-
if (perc > 100) {
char file_path[PATH_MAX];
@@ -1905,6 +1923,15 @@ void XTXactRestart::xres_recover_progres
else {
char number[40];
+ if (!*of) {
+ char file_path[PATH_MAX];
+
+ xt_strcpy(PATH_MAX, file_path, xres_db->db_main_path);
+ xt_add_pbxt_file(PATH_MAX, file_path, "recovery-progress");
+ *of = xt_open_file(self, file_path, XT_FS_CREATE | XT_FS_MAKE_PATH);
+ xt_set_eof_file(self, *of, 0);
+ }
+
sprintf(number, "%d", perc);
if (!xt_pwrite_file(*of, 0, strlen(number), number, &self->st_statistics.st_x, self))
xt_throw(self);
@@ -1927,10 +1954,11 @@ xtBool XTXactRestart::xres_restart(XTThr
off_t bytes_to_read;
volatile xtBool print_progress = FALSE;
volatile off_t perc_size = 0, next_goal = 0;
- int perc_complete = 1;
+ int perc_complete = 1, perc_to_write = 1;
XTOpenFilePtr progress_file = NULL;
xtBool min_ram_xn_id_set = FALSE;
u_int log_count;
+ time_t start_time;
memset(&ws, 0, sizeof(ws));
@@ -1955,12 +1983,11 @@ xtBool XTXactRestart::xres_restart(XTThr
/* Don't print anything about recovering an empty database: */
if (bytes_to_read != 0)
xt_logf(XT_NT_INFO, "PBXT: Recovering from %lu-%llu, bytes to read: %llu\n", (u_long) xres_cp_log_id, (u_llong) xres_cp_log_offset, (u_llong) bytes_to_read);
- if (bytes_to_read >= 10*1024*1024) {
- print_progress = TRUE;
- perc_size = bytes_to_read / 100;
- next_goal = perc_size;
- xres_recover_progress(self, &progress_file, 0);
- }
+
+ print_progress = FALSE;
+ start_time = time(NULL);
+ perc_size = bytes_to_read / 100;
+ next_goal = perc_size;
if (!db->db_xlog.xlog_seq_start(&ws.ws_seqread, xres_cp_log_id, xres_cp_log_offset, FALSE)) {
ok = FALSE;
@@ -1983,17 +2010,28 @@ xtBool XTXactRestart::xres_restart(XTThr
#ifdef PRINT_LOG_ON_RECOVERY
xt_print_log_record(ws.ws_seqread.xseq_rec_log_id, ws.ws_seqread.xseq_rec_log_offset, record);
#endif
- if (print_progress && bytes_read > next_goal) {
- if (((perc_complete - 1) % 25) == 0)
- xt_logf(XT_NT_INFO, "PBXT: ");
- if ((perc_complete % 25) == 0)
- xt_logf(XT_NT_INFO, "%2d\n", (int) perc_complete);
- else
- xt_logf(XT_NT_INFO, "%2d ", (int) perc_complete);
- xt_log_flush(self);
- xres_recover_progress(self, &progress_file, perc_complete);
- next_goal += perc_size;
- perc_complete++;
+ if (bytes_read >= next_goal) {
+ while (bytes_read >= next_goal) {
+ next_goal += perc_size;
+ perc_complete++;
+ }
+ if (!print_progress) {
+ if (time(NULL) - start_time > 2)
+ print_progress = TRUE;
+ }
+ if (print_progress) {
+ while (perc_to_write < perc_complete) {
+ if (((perc_to_write - 1) % 25) == 0)
+ xt_logf(XT_NT_INFO, "PBXT: ");
+ if ((perc_to_write % 25) == 0)
+ xt_logf(XT_NT_INFO, "%2d\n", (int) perc_to_write);
+ else
+ xt_logf(XT_NT_INFO, "%2d ", (int) perc_to_write);
+ xt_log_flush(self);
+ xres_recover_progress(self, &progress_file, perc_to_write);
+ perc_to_write++;
+ }
+ }
}
switch (record->xl.xl_status_1) {
case XT_LOG_ENT_HEADER:
@@ -2053,8 +2091,11 @@ xtBool XTXactRestart::xres_restart(XTThr
xact->xd_end_xn_id = xn_id;
xact->xd_flags |= XT_XN_XAC_ENDED | XT_XN_XAC_SWEEP;
xact->xd_flags &= ~XT_XN_XAC_RECOVERED; // We can expect an end record on cleanup!
+ xact->xd_flags &= ~XT_XN_XAC_PREPARED; // Prepared transactions cannot be swept!
if (record->xl.xl_status_1 == XT_LOG_ENT_COMMIT)
xact->xd_flags |= XT_XN_XAC_COMMITTED;
+ if (xt_sl_get_size(db->db_xn_xa_list) > 0)
+ xt_xn_delete_xa_data_by_xact(db, xn_id, self);
}
break;
case XT_LOG_ENT_CLEANUP:
@@ -2071,6 +2112,14 @@ xtBool XTXactRestart::xres_restart(XTThr
rec_log_id = XT_GET_DISK_4(record->xl.xl_log_id_4);
xt_dl_set_to_delete(self, db, rec_log_id);
break;
+ case XT_LOG_ENT_PREPARE:
+ xn_id = XT_GET_DISK_4(record->xp.xp_xact_id_4);
+ if ((xact = xt_xn_get_xact(db, xn_id, self))) {
+ xact->xd_flags |= XT_XN_XAC_PREPARED;
+ if (!xt_xn_store_xa_data(db, xn_id, record->xp.xp_xa_len_1, record->xp.xp_xa_data, self))
+ xt_throw(self);
+ }
+ break;
default:
xt_xres_apply_in_order(self, &ws, ws.ws_seqread.xseq_rec_log_id, ws.ws_seqread.xseq_rec_log_offset, record);
break;
@@ -2534,7 +2583,8 @@ static void xres_cp_main(XTThreadPtr sel
/* This condition means we could checkpoint: */
if (!(xt_sl_get_size(db->db_datalogs.dlc_to_delete) == 0 &&
xt_sl_get_size(db->db_datalogs.dlc_deleted) == 0 &&
- xt_comp_log_pos(log_id, log_offset, db->db_restart.xres_cp_log_id, db->db_restart.xres_cp_log_offset) <= 0))
+ xt_comp_log_pos(log_id, log_offset, db->db_restart.xres_cp_log_id, db->db_restart.xres_cp_log_offset) <= 0) &&
+ xt_sl_get_size(db->db_xn_xa_list) == 0)
break;
xres_cp_wait_for_log_writer(self, db, 400);
@@ -2654,7 +2704,7 @@ xtPublic xtBool xt_begin_checkpoint(XTDa
* until they are flushed.
*/
/* This is an alternative to the above.
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(db, self))
xt_throw(self);
*/
xt_lock_mutex_ns(&db->db_wr_lock);
@@ -2776,6 +2826,14 @@ xtPublic xtBool xt_end_checkpoint(XTData
size_t chk_size = 0;
u_int no_of_logs = 0;
+ /* As long as we have outstanding XA transactions, we may not checkpoint! */
+ if (xt_sl_get_size(db->db_xn_xa_list) > 0) {
+#ifdef DEBUG
+ printf("Checkpoint must wait\n");
+#endif
+ return OK;
+ }
+
#ifdef NEVER_CHECKPOINT
return OK;
#endif
@@ -3183,7 +3241,7 @@ xtPublic void xt_dump_xlogs(XTDatabaseHP
* D A T A B A S E R E C O V E R Y T H R E A D
*/
-extern XTDatabaseHPtr pbxt_database;
+
static XTThreadPtr xres_recovery_thread;
static void *xn_xres_run_recovery_thread(XTThreadPtr self)
@@ -3193,18 +3251,18 @@ static void *xn_xres_run_recovery_thread
if (!(mysql_thread = (THD *) myxt_create_thread()))
xt_throw(self);
- while (!xres_recovery_thread->t_quit && !ha_resolve_by_legacy_type(mysql_thread, DB_TYPE_PBXT))
- xt_sleep_milli_second(1);
+ myxt_wait_pbxt_plugin_slot_assigned(self);
if (!xres_recovery_thread->t_quit) {
- /* {GLOBAL-DB}
- * It can happen that something will just get in before this
- * thread and open/recover the database!
- */
- if (!pbxt_database) {
- try_(a) {
+ try_(a) {
+ /* {GLOBAL-DB}
+ * It can happen that something will just get in before this
+ * thread and open/recover the database!
+ */
+ if (!pbxt_database) {
xt_open_database(self, mysql_real_data_home, TRUE);
- /* This can be done at the same time by a foreground thread,
+ /* {GLOBAL-DB}
+ * This can be done at the same time as the recovery thread,
* strictly speaking I need a lock.
*/
if (!pbxt_database) {
@@ -3212,11 +3270,22 @@ static void *xn_xres_run_recovery_thread
xt_heap_reference(self, pbxt_database);
}
}
- catch_(a) {
- xt_log_and_clear_exception(self);
- }
- cont_(a);
+ else
+ xt_use_database(self, pbxt_database, XT_FOR_USER);
+
+ pbxt_recovery_state = XT_RECOVER_DONE;
+
+ /* {WAIT-FOR-SW-AFTER-RECOV}
+ * Moved to here...
+ */
+ xt_wait_for_sweeper(self, self->st_database, 0);
+
+ pbxt_recovery_state = XT_RECOVER_SWEPT;
}
+ catch_(a) {
+ xt_log_and_clear_exception(self);
+ }
+ cont_(a);
}
/*
@@ -3261,11 +3330,12 @@ xtPublic void xt_xres_start_database_rec
sprintf(name, "DB-RECOVERY-%s", xt_last_directory_of_path(mysql_real_data_home));
xt_remove_dir_char(name);
+ pbxt_recovery_state = XT_RECOVER_PENDING;
xres_recovery_thread = xt_create_daemon(self, name);
xt_run_thread(self, xres_recovery_thread, xn_xres_run_recovery_thread);
}
-xtPublic void xt_xres_wait_for_recovery(XTThreadPtr self)
+xtPublic void xt_xres_terminate_recovery(XTThreadPtr self)
{
XTThreadPtr thr_rec;
=== modified file 'storage/pbxt/src/restart_xt.h'
--- a/storage/pbxt/src/restart_xt.h 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/restart_xt.h 2009-11-24 10:55:06 +0000
@@ -37,6 +37,8 @@ struct XTOpenTable;
struct XTDatabase;
struct XTTable;
+extern int pbxt_recovery_state;
+
typedef struct XTWriterState {
struct XTDatabase *ws_db;
xtBool ws_in_recover;
@@ -132,6 +134,16 @@ void xt_print_log_record(xtLogID log, of
void xt_dump_xlogs(struct XTDatabase *db, xtLogID start_log);
void xt_xres_start_database_recovery(XTThreadPtr self);
-void xt_xres_wait_for_recovery(XTThreadPtr self);
+void xt_xres_terminate_recovery(XTThreadPtr self);
+
+#define XT_RECOVER_PENDING 0
+#define XT_RECOVER_DONE 1
+#define XT_RECOVER_SWEPT 2
+
+inline void xt_xres_wait_for_recovery(XTThreadPtr XT_UNUSED(self), int state)
+{
+ while (pbxt_recovery_state < state)
+ xt_sleep_milli_second(100);
+}
#endif
=== modified file 'storage/pbxt/src/strutil_xt.cc'
--- a/storage/pbxt/src/strutil_xt.cc 2009-10-26 11:35:42 +0000
+++ b/storage/pbxt/src/strutil_xt.cc 2009-11-24 10:55:06 +0000
@@ -21,8 +21,10 @@
* H&G2JCtL
*/
-#include "mysql_priv.h"
#include "xt_config.h"
+
+#include <stdio.h>
+#include <string.h>
#include <ctype.h>
#include "strutil_xt.h"
@@ -107,13 +109,17 @@ xtPublic void xt_2nd_last_name_of_path(s
*dest = 0;
return;
}
- /* If temporary file */
- if (!is_prefix(path, mysql_data_home) &&
+
+ /* {INVALID-OLD-TABLE-FIX}
+ * I have changed the implementation of
+ * this bug fix (see {INVALID-OLD-TABLE-FIX}).
+ if (!is_prefix(path, mysql_data_home) &&
!is_prefix(path, mysql_real_data_home))
{
*dest= 0;
return;
}
+ */
ptr = path + len - 1;
while (ptr != path && !XT_IS_DIR_CHAR(*ptr))
@@ -374,7 +380,7 @@ xtPublic void xt_int8_to_byte_size(xtInt
/* Version number must also be set in configure.in! */
xtPublic c_char *xt_get_version(void)
{
- return "1.0.08d RC";
+ return "1.0.09f RC";
}
/* Copy and URL decode! */
=== modified file 'storage/pbxt/src/systab_xt.cc'
--- a/storage/pbxt/src/systab_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/systab_xt.cc 2009-11-24 10:55:06 +0000
@@ -130,7 +130,7 @@ static int pbms_discover_handler(handler
* MYSQL UTILITIES
*/
-void xt_my_set_notnull_in_record(Field *field, char *record)
+static void xt_my_set_notnull_in_record(Field *field, char *record)
{
if (field->null_ptr)
record[(uint) (field->null_ptr - (uchar *) field->table->record[0])] &= (uchar) ~field->null_bit;
@@ -518,7 +518,7 @@ bool XTStatisticsTable::seqScanRead(xtWo
* SYSTEM TABLE SHARES
*/
-void st_path_to_table_name(size_t size, char *buffer, const char *path)
+static void st_path_to_table_name(size_t size, char *buffer, const char *path)
{
char *str;
=== modified file 'storage/pbxt/src/tabcache_xt.cc'
--- a/storage/pbxt/src/tabcache_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/tabcache_xt.cc 2009-11-27 15:37:02 +0000
@@ -590,7 +590,7 @@ xtBool XTTabCache::tc_fetch(XT_ROW_REC_F
* So there could be a deadlock if I don't flush the log!
*/
if ((self = xt_get_self())) {
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(tci_table->tab_db, self))
goto failed;
}
@@ -1150,6 +1150,8 @@ static void *tabc_fr_run_thread(XTThread
int count;
void *mysql_thread;
+ myxt_wait_pbxt_plugin_slot_assigned(self);
+
mysql_thread = myxt_create_thread();
while (!self->t_quit) {
=== modified file 'storage/pbxt/src/tabcache_xt.h'
--- a/storage/pbxt/src/tabcache_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/tabcache_xt.h 2009-11-24 10:55:06 +0000
@@ -168,7 +168,7 @@ typedef struct XTTableSeq {
#define TAB_CAC_UNLOCK(i, o) xt_xsmutex_unlock(i, o)
#elif defined(TAB_CAC_USE_PTHREAD_RW)
#define TAB_CAC_LOCK_TYPE xt_rwlock_type
-#define TAB_CAC_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define TAB_CAC_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define TAB_CAC_FREE_LOCK(s, i) xt_free_rwlock(i)
#define TAB_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(i)
#define TAB_CAC_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(i)
=== modified file 'storage/pbxt/src/table_xt.cc'
--- a/storage/pbxt/src/table_xt.cc 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/table_xt.cc 2009-11-25 15:40:51 +0000
@@ -35,7 +35,6 @@
#include <drizzled/common.h>
#include <mysys/thr_lock.h>
#include <drizzled/dtcollation.h>
-#include <drizzled/plugin/storage_engine.h>
#else
#include "mysql_priv.h"
#endif
@@ -48,7 +47,6 @@
#include "cache_xt.h"
#include "trace_xt.h"
#include "index_xt.h"
-#include "restart_xt.h"
#include "systab_xt.h"
#ifdef DEBUG
@@ -2347,7 +2345,7 @@ xtPublic void xt_flush_table(XTThreadPtr
}
-xtPublic XTOpenTablePtr tab_open_table(XTTableHPtr tab)
+static XTOpenTablePtr tab_open_table(XTTableHPtr tab)
{
volatile XTOpenTablePtr ot;
XTThreadPtr self;
@@ -2588,7 +2586,7 @@ xtPublic xtBool xt_tab_put_log_op_rec_da
return FAILED;
}
- return xt_xlog_modify_table(ot, status, op_seq, free_rec_id, rec_id, size, buffer);
+ return xt_xlog_modify_table(tab->tab_id, status, op_seq, free_rec_id, rec_id, size, buffer, ot->ot_thread);
}
xtPublic xtBool xt_tab_put_log_rec_data(XTOpenTablePtr ot, u_int status, xtRecordID free_rec_id, xtRecordID rec_id, size_t size, xtWord1 *buffer, xtOpSeqNo *op_seq)
@@ -2606,7 +2604,7 @@ xtPublic xtBool xt_tab_put_log_rec_data(
return FAILED;
}
- return xt_xlog_modify_table(ot, status, *op_seq, free_rec_id, rec_id, size, buffer);
+ return xt_xlog_modify_table(tab->tab_id, status, *op_seq, free_rec_id, rec_id, size, buffer, ot->ot_thread);
}
xtPublic xtBool xt_tab_get_rec_data(XTOpenTablePtr ot, xtRecordID rec_id, size_t size, xtWord1 *buffer)
@@ -3541,7 +3539,7 @@ xtPublic xtBool xt_tab_free_row(XTOpenTa
tab->tab_row_fnum++;
xt_unlock_mutex_ns(&tab->tab_row_lock);
- if (!xt_xlog_modify_table(ot, XT_LOG_ENT_ROW_FREED, op_seq, 0, row_id, sizeof(XTTabRowRefDRec), (xtWord1 *) &free_row))
+ if (!xt_xlog_modify_table(tab->tab_id, XT_LOG_ENT_ROW_FREED, op_seq, 0, row_id, sizeof(XTTabRowRefDRec), (xtWord1 *) &free_row, ot->ot_thread))
return FAILED;
return OK;
@@ -3791,7 +3789,7 @@ xtPublic int xt_tab_remove_record(XTOpen
xt_unlock_mutex_ns(&tab->tab_rec_lock);
free_rec->rf_rec_type_1 = old_rec_type;
- return xt_xlog_modify_table(ot, XT_LOG_ENT_REC_REMOVED_BI, op_seq, (xtRecordID) new_rec_type, rec_id, rec_size, ot->ot_row_rbuffer);
+ return xt_xlog_modify_table(tab->tab_id, XT_LOG_ENT_REC_REMOVED_BI, op_seq, (xtRecordID) new_rec_type, rec_id, rec_size, ot->ot_row_rbuffer, ot->ot_thread);
}
static xtRowID tab_new_row(XTOpenTablePtr ot, XTTableHPtr tab)
@@ -3837,7 +3835,7 @@ static xtRowID tab_new_row(XTOpenTablePt
op_seq = tab->tab_seq.ts_get_op_seq();
xt_unlock_mutex_ns(&tab->tab_row_lock);
- if (!xt_xlog_modify_table(ot, status, op_seq, next_row_id, row_id, 0, NULL))
+ if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, next_row_id, row_id, 0, NULL, ot->ot_thread))
return 0;
XT_DISABLED_TRACE(("new row tx=%d row=%d\n", (int) ot->ot_thread->st_xact_data->xd_start_xn_id, (int) row_id));
@@ -3868,7 +3866,7 @@ xtPublic xtBool xt_tab_set_row(XTOpenTab
if (!tab->tab_rows.xt_tc_write(ot->ot_row_file, row_id, 0, sizeof(XTTabRowRefDRec), (xtWord1 *) &row_buf, &op_seq, TRUE, ot->ot_thread))
return FAILED;
- return xt_xlog_modify_table(ot, status, op_seq, 0, row_id, sizeof(XTTabRowRefDRec), (xtWord1 *) &row_buf);
+ return xt_xlog_modify_table(tab->tab_id, status, op_seq, 0, row_id, sizeof(XTTabRowRefDRec), (xtWord1 *) &row_buf, ot->ot_thread);
}
xtPublic xtBool xt_tab_free_record(XTOpenTablePtr ot, u_int status, xtRecordID rec_id, xtBool clean_delete)
@@ -3937,7 +3935,7 @@ xtPublic xtBool xt_tab_free_record(XTOpe
tab->tab_rec_fnum++;
xt_unlock_mutex_ns(&tab->tab_rec_lock);
- if (!xt_xlog_modify_table(ot, status, op_seq, rec_id, rec_id, sizeof(XTactFreeRecEntryDRec) - offsetof(XTactFreeRecEntryDRec, fr_stat_id_1), &free_rec.fr_stat_id_1))
+ if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, rec_id, rec_id, sizeof(XTactFreeRecEntryDRec) - offsetof(XTactFreeRecEntryDRec, fr_stat_id_1), &free_rec.fr_stat_id_1, ot->ot_thread))
return FAILED;
}
return OK;
@@ -4016,7 +4014,7 @@ static xtBool tab_add_record(XTOpenTable
}
xt_unlock_mutex_ns(&tab->tab_rec_lock);
- if (!xt_xlog_modify_table(ot, status, op_seq, next_rec_id, rec_id, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf))
+ if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, next_rec_id, rec_id, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, ot->ot_thread))
return FAILED;
if (rec_info->ri_ext_rec) {
@@ -4932,6 +4930,12 @@ xtPublic void xt_tab_seq_exit(XTOpenTabl
#endif
#endif
+xtPublic void xt_tab_seq_repeat(XTOpenTablePtr ot)
+{
+ ot->ot_seq_rec_id--;
+ ot->ot_seq_offset -= ot->ot_table->tab_dic.dic_rec_size;
+}
+
xtPublic xtBool xt_tab_seq_next(XTOpenTablePtr ot, xtWord1 *buffer, xtBool *eof)
{
register XTTableHPtr tab = ot->ot_table;
@@ -5094,7 +5098,7 @@ static xtBool tab_exec_repair_pending(XT
return FALSE;
}
else {
- if (!xt_open_file_ns(&of, file_path, XT_FS_DEFAULT))
+ if (!xt_open_file_ns(&of, file_path, XT_FS_DEFAULT | XT_FS_MISSING_OK))
return FALSE;
}
if (!of)
@@ -5190,15 +5194,76 @@ static xtBool tab_exec_repair_pending(XT
return FALSE;
}
-xtPublic void tab_make_table_name(XTTableHPtr tab, char *table_name, size_t size)
+static void tab_make_table_name(XTTableHPtr tab, char *table_name, size_t size)
{
- char name_buf[XT_IDENTIFIER_NAME_SIZE*3+3];
+ char *nptr;
- xt_2nd_last_name_of_path(sizeof(name_buf), name_buf, tab->tab_name->ps_path);
- myxt_static_convert_file_name(name_buf, table_name, size);
- xt_strcat(size, table_name, ".");
- myxt_static_convert_file_name(xt_last_name_of_path(tab->tab_name->ps_path), name_buf, sizeof(name_buf));
- xt_strcat(size, table_name, name_buf);
+ nptr = xt_last_name_of_path(tab->tab_name->ps_path);
+ if (xt_starts_with(nptr, "#sql")) {
+ /* {INVALID-OLD-TABLE-FIX}
+ * Temporary files can have strange paths, for example
+ * ..../var/tmp/mysqld.1/#sqldaec_1_6
+ * This occurs, for example, occurs when the temp_table.test is
+ * run using the PBXT suite in MariaDB:
+ * ./mtr --suite=pbxt --do-test=temp_table
+ *
+ * Calling myxt_static_convert_file_name, with a '.', in the name
+ * causes the error:
+ * [ERROR] Invalid (old?) table or database name 'mysqld.1'
+ * To prevent this, we do not convert the temporary
+ * table names using the mysql functions.
+ *
+ * Note, this bug was found by Monty, and fixed by modifying
+ * xt_2nd_last_name_of_path(), see {INVALID-OLD-TABLE-FIX}.
+ *
+ */
+ xt_2nd_last_name_of_path(size, table_name, tab->tab_name->ps_path);
+ xt_strcat(size, table_name, ".");
+ xt_strcat(size, table_name, nptr);
+ }
+ else {
+ char name_buf[XT_TABLE_NAME_SIZE*3+3];
+ char *part_ptr;
+ size_t len;
+
+ xt_2nd_last_name_of_path(sizeof(name_buf), name_buf, tab->tab_name->ps_path);
+ myxt_static_convert_file_name(name_buf, table_name, size);
+ xt_strcat(size, table_name, ".");
+
+ /* Handle partition extensions to table names: */
+ if ((part_ptr = strstr(nptr, "#P#")))
+ xt_strncpy(sizeof(name_buf), name_buf, nptr, part_ptr - nptr);
+ else
+ xt_strcpy(sizeof(name_buf), name_buf, nptr);
+
+ len = strlen(table_name);
+ myxt_static_convert_file_name(name_buf, table_name + len, size - len);
+
+ if (part_ptr) {
+ /* Add the partition extension (which is relevant to the engine). */
+ char *sub_part_ptr;
+
+ part_ptr += 3;
+ if ((sub_part_ptr = strstr(part_ptr, "#SP#")))
+ xt_strncpy(sizeof(name_buf), name_buf, part_ptr, sub_part_ptr - part_ptr);
+ else
+ xt_strcpy(sizeof(name_buf), name_buf, part_ptr);
+
+ xt_strcat(size, table_name, " (");
+ len = strlen(table_name);
+ myxt_static_convert_file_name(name_buf, table_name + len, size - len);
+
+ if (sub_part_ptr) {
+
+ sub_part_ptr += 4;
+ xt_strcat(size, table_name, " - ");
+ len = strlen(table_name);
+ myxt_static_convert_file_name(sub_part_ptr, table_name + len, size - len);
+ }
+
+ xt_strcat(size, table_name, ")");
+ }
+ }
}
xtPublic xtBool xt_tab_is_table_repair_pending(XTTableHPtr tab)
=== modified file 'storage/pbxt/src/table_xt.h'
--- a/storage/pbxt/src/table_xt.h 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/table_xt.h 2009-11-24 10:55:06 +0000
@@ -127,7 +127,7 @@ struct XTTablePath;
#define XT_TAB_ROW_UNLOCK(i, s) xt_xsmutex_unlock(i, (s)->t_id)
#elif defined(XT_TAB_ROW_USE_PTHREAD_RW)
#define XT_TAB_ROW_LOCK_TYPE xt_rwlock_type
-#define XT_TAB_ROW_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define XT_TAB_ROW_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define XT_TAB_ROW_FREE_LOCK(s, i) xt_free_rwlock(i)
#define XT_TAB_ROW_READ_LOCK(i, s) xt_slock_rwlock_ns(i)
#define XT_TAB_ROW_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
@@ -528,13 +528,14 @@ xtBool xt_table_exists(struct XTDatab
void xt_enum_tables_init(u_int *edx);
XTTableEntryPtr xt_enum_tables_next(struct XTThread *self, struct XTDatabase *db, u_int *edx);
-void xt_enum_files_of_tables_init(struct XTDatabase *db, char *tab_name, xtTableID tab_id, XTFilesOfTablePtr ft);
+void xt_enum_files_of_tables_init(XTPathStrPtr tab_name, xtTableID tab_id, XTFilesOfTablePtr ft);
xtBool xt_enum_files_of_tables_next(XTFilesOfTablePtr ft);
xtBool xt_tab_seq_init(XTOpenTablePtr ot);
void xt_tab_seq_reset(XTOpenTablePtr ot);
void xt_tab_seq_exit(XTOpenTablePtr ot);
xtBool xt_tab_seq_next(XTOpenTablePtr ot, xtWord1 *buffer, xtBool *eof);
+void xt_tab_seq_repeat(XTOpenTablePtr ot);
xtBool xt_tab_new_record(XTOpenTablePtr ot, xtWord1 *buffer);
xtBool xt_tab_delete_record(XTOpenTablePtr ot, xtWord1 *buffer);
=== modified file 'storage/pbxt/src/thread_xt.cc'
--- a/storage/pbxt/src/thread_xt.cc 2009-10-06 15:16:01 +0000
+++ b/storage/pbxt/src/thread_xt.cc 2009-11-24 10:55:06 +0000
@@ -75,6 +75,13 @@ static xt_mutex_type thr_array_lock;
/* Global accumulated statistics: */
static XTStatisticsRec thr_statistics;
+#ifdef DEBUG
+static void break_in_assertion(c_char *expr, c_char *func, c_char *file, u_int line)
+{
+ printf("%s(%s:%d) %s\n", func, file, (int) line, expr);
+}
+#endif
+
/*
* -----------------------------------------------------------------------
* Error logging
@@ -658,6 +665,9 @@ static c_char *thr_get_err_string(int xt
case XT_ERR_FK_REF_TEMP_TABLE: str = "Foreign key may not reference temporary table"; break;
case XT_ERR_MYSQL_SHUTDOWN: str = "Cannot open table, MySQL has shutdown"; break;
case XT_ERR_MYSQL_NO_THREAD: str = "Cannot create thread, MySQL has shutdown"; break;
+ case XT_ERR_BUFFER_TOO_SMALL: str = "System backup buffer too small"; break;
+ case XT_ERR_BAD_BACKUP_FORMAT: str = "Unknown or corrupt backup format, restore aborted"; break;
+ case XT_ERR_PBXT_NOT_INSTALLED: str = "PBXT plugin is not installed"; break;
default: str = "Unknown XT error"; break;
}
return str;
@@ -862,6 +872,11 @@ xtPublic xtBool xt_exception_errno(XTExc
return FAILED;
}
+xtPublic void xt_exception_xterr(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int xt_err)
+{
+ xt_exception_error(e, self, func, file, line, xt_err, 0, thr_get_err_string(xt_err));
+}
+
/*
* -----------------------------------------------------------------------
* LOG ERRORS
@@ -887,7 +902,7 @@ xtPublic xtBool xt_assert(XTThreadPtr se
#ifdef DEBUG
//xt_set_fflush(TRUE);
//xt_dump_trace();
- printf("%s(%s:%d) %s\n", func, file, (int) line, expr);
+ break_in_assertion(expr, func, file, line);
#ifdef CRASH_ON_ASSERT
abort();
#endif
=== modified file 'storage/pbxt/src/thread_xt.h'
--- a/storage/pbxt/src/thread_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/thread_xt.h 2009-11-24 10:55:06 +0000
@@ -536,6 +536,8 @@ extern struct XTThread **xt_thr_array;
* Function prototypes
*/
+extern "C" void *thr_main(void *data);
+
void xt_get_now(char *buffer, size_t len);
xtBool xt_init_logging(void);
void xt_exit_logging(void);
@@ -583,6 +585,7 @@ void xt_register_xterr(c_char *func, c
void xt_exceptionf(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int xt_err, int sys_err, c_char *fmt, ...);
void xt_exception_error(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int xt_err, int sys_err, c_char *msg);
xtBool xt_exception_errno(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int err);
+void xt_exception_xterr(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int xt_err);
void xt_log_errno(XTThreadPtr self, c_char *func, c_char *file, u_int line, int err);
@@ -610,7 +613,7 @@ void xt_critical_wait(void);
void xt_yield(void);
void xt_sleep_milli_second(u_int t);
xtBool xt_suspend(XTThreadPtr self);
-xtBool xt_unsuspend(XTThreadPtr self, XTThreadPtr target);
+xtBool xt_unsuspend(XTThreadPtr target);
void xt_lock_thread(XTThreadPtr thread);
void xt_unlock_thread(XTThreadPtr thread);
xtBool xt_wait_thread(XTThreadPtr thread);
=== modified file 'storage/pbxt/src/util_xt.cc'
--- a/storage/pbxt/src/util_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/util_xt.cc 2009-11-24 10:55:06 +0000
@@ -150,6 +150,23 @@ xtPublic xtWord1 xt_get_checksum1(xtWord
return (xtWord1) (sum ^ (sum >> 24) ^ (sum >> 16) ^ (sum >> 8));
}
+xtPublic xtWord4 xt_get_checksum4(xtWord1 *data, size_t len)
+{
+ register xtWord4 sum = 0, g;
+ xtWord1 *chk;
+
+ chk = data + len - 1;
+ while (chk > data) {
+ sum = (sum << 4) + *chk;
+ if ((g = sum & 0xF0000000)) {
+ sum = sum ^ (g >> 24);
+ sum = sum ^ g;
+ }
+ chk--;
+ }
+ return sum;
+}
+
/*
* --------------- Data Buffer ------------------
*/
=== modified file 'storage/pbxt/src/util_xt.h'
--- a/storage/pbxt/src/util_xt.h 2009-03-26 12:18:01 +0000
+++ b/storage/pbxt/src/util_xt.h 2009-11-24 10:55:06 +0000
@@ -39,6 +39,7 @@ xtWord4 xt_file_name_to_id(char *file_na
xtBool xt_time_difference(register xtWord4 now, register xtWord4 then);
xtWord2 xt_get_checksum(xtWord1 *data, size_t len, u_int interval);
xtWord1 xt_get_checksum1(xtWord1 *data, size_t len);
+xtWord4 xt_get_checksum4(xtWord1 *data, size_t len);
typedef struct XTDataBuffer {
size_t db_size;
=== modified file 'storage/pbxt/src/xaction_xt.cc'
--- a/storage/pbxt/src/xaction_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/xaction_xt.cc 2009-11-24 10:55:06 +0000
@@ -1075,6 +1075,7 @@ xtPublic void xt_xn_init_db(XTThreadPtr
#endif
xt_spinlock_init_with_autoname(self, &db->db_xn_id_lock);
xt_spinlock_init_with_autoname(self, &db->db_xn_wait_spinlock);
+ xt_init_mutex_with_autoname(self, &db->db_xn_xa_lock);
//xt_init_mutex_with_autoname(self, &db->db_xn_wait_lock);
//xt_init_cond(self, &db->db_xn_wait_cond);
xt_init_mutex_with_autoname(self, &db->db_sw_lock);
@@ -1096,6 +1097,9 @@ xtPublic void xt_xn_init_db(XTThreadPtr
}
}
+ /* Create a sorted list for XA transactions recovered: */
+ db->db_xn_xa_list = xt_new_sortedlist(self, sizeof(XTXactXARec), 100, 50, xt_xn_xa_compare, db, NULL, FALSE, FALSE);
+
/* Initialize the data logs: */
db->db_datalogs.dlc_init(self, db);
@@ -1146,6 +1150,7 @@ xtPublic void xt_xn_exit_db(XTThreadPtr
printf("=========> MAX TXs NOT CLEAN: %lu\n", not_clean_max);
printf("=========> MAX TXs IN RAM: %lu\n", in_ram_max);
#endif
+ XTXactPreparePtr xap, xap_next;
xt_stop_sweeper(self, db); // Should be done already!
xt_stop_writer(self, db); // Should be done already!
@@ -1187,6 +1192,19 @@ xtPublic void xt_xn_exit_db(XTThreadPtr
xt_free_mutex(&db->db_sw_lock);
//xt_free_cond(&db->db_xn_wait_cond);
//xt_free_mutex(&db->db_xn_wait_lock);
+ xt_free_mutex(&db->db_xn_xa_lock);
+ for (u_int i=0; i<XT_XA_HASH_TAB_SIZE; i++) {
+ xap = db->db_xn_xa_table[i];
+ while (xap) {
+ xap_next = xap->xp_next;
+ xt_free(self, xap);
+ xap = xap_next;
+ }
+ }
+ if (db->db_xn_xa_list) {
+ xt_free_sortedlist(self, db->db_xn_xa_list);
+ db->db_xn_xa_list = NULL;
+ }
xt_spinlock_free(self, &db->db_xn_wait_spinlock);
xt_spinlock_free(self, &db->db_xn_id_lock);
#ifdef DEBUG_RAM_LIST
@@ -1428,7 +1446,7 @@ static xtBool xn_end_xact(XTThreadPtr th
wait_xn_id = thread->st_prev_xact[thread->st_last_xact];
thread->st_prev_xact[thread->st_last_xact] = xn_id;
/* This works because XT_MAX_XACT_BEHIND == 2! */
- ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == thread->st_last_xact ^ 1);
+ ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == (thread->st_last_xact ^ 1));
thread->st_last_xact ^= 1;
while (xt_xn_is_before(db->db_xn_to_clean_id, wait_xn_id) && (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND)) {
xt_critical_wait();
@@ -1548,6 +1566,149 @@ xtPublic int xt_xn_status(XTOpenTablePtr
return XT_XN_ABORTED;
}
+/* ----------------------------------------------------------------------
+ * XA Functionality
+ */
+
+xtPublic int xt_xn_xa_compare(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
+{
+ xtXactID *x = (xtXactID *) a;
+ XTXactXAPtr y = (XTXactXAPtr) b;
+
+ if (*x == y->xx_xact_id)
+ return 0;
+ if (xt_xn_is_before(*x, y->xx_xact_id))
+ return -1;
+ return 1;
+}
+
+xtPublic xtBool xt_xn_prepare(int len, xtWord1 *xa_data, XTThreadPtr thread)
+{
+ XTXactDataPtr xact;
+
+ ASSERT_NS(thread->st_xact_data);
+ if ((xact = thread->st_xact_data)) {
+ xtXactID xn_id = xact->xd_start_xn_id;
+
+ /* Only makes sense if the transaction has already been logged: */
+ if ((thread->st_xact_data->xd_flags & XT_XN_XAC_LOGGED)) {
+ if (!xt_xlog_modify_table(0, XT_LOG_ENT_PREPARE, xn_id, 0, 0, len, xa_data, thread))
+ return FAILED;
+ }
+ }
+ return OK;
+}
+
+xtPublic xtBool xt_xn_store_xa_data(XTDatabaseHPtr db, xtXactID xact_id, int len, xtWord1 *xa_data, XTThreadPtr XT_UNUSED(thread))
+{
+ XTXactPreparePtr xap;
+ u_int idx;
+ XTXactXARec xx;
+
+ if (!(xap = (XTXactPreparePtr) xt_malloc_ns(offsetof(XTXactPrepareRec, xp_xa_data) + len)))
+ return FAILED;
+ xap->xp_xact_id = xact_id;
+ xap->xp_hash = xt_get_checksum4(xa_data, len);
+ xap->xp_data_len = len;
+ memcpy(xap->xp_xa_data, xa_data, len);
+ xx.xx_xact_id = xact_id;
+ xx.xx_xa_ptr = xap;
+
+ idx = xap->xp_hash % XT_XA_HASH_TAB_SIZE;
+ xt_lock_mutex_ns(&db->db_xn_xa_lock);
+ if (!xt_sl_insert(NULL, db->db_xn_xa_list, &xact_id, &xx)) {
+ xt_unlock_mutex_ns(&db->db_xn_xa_lock);
+ xt_free_ns(xap);
+ }
+ xap->xp_next = db->db_xn_xa_table[idx];
+ db->db_xn_xa_table[idx] = xap;
+ xt_unlock_mutex_ns(&db->db_xn_xa_lock);
+ return OK;
+}
+
+xtPublic void xt_xn_delete_xa_data_by_xact(XTDatabaseHPtr db, xtXactID xact_id, XTThreadPtr thread)
+{
+ XTXactXAPtr xx;
+
+ xt_lock_mutex_ns(&db->db_xn_xa_lock);
+ if (!(xx = (XTXactXAPtr) xt_sl_find(NULL, db->db_xn_xa_list, &xact_id)))
+ return;
+ xt_xn_delete_xa_data(db, xx->xx_xa_ptr, TRUE, thread);
+}
+
+xtPublic void xt_xn_delete_xa_data(XTDatabaseHPtr db, XTXactPreparePtr xap, xtBool unlock, XTThreadPtr XT_UNUSED(thread))
+{
+ u_int idx;
+ XTXactPreparePtr xap_ptr, xap_pptr = NULL;
+
+ xt_sl_delete(NULL, db->db_xn_xa_list, &xap->xp_xact_id);
+ idx = xap->xp_hash % XT_XA_HASH_TAB_SIZE;
+ xap_ptr = db->db_xn_xa_table[idx];
+ while (xap_ptr) {
+ if (xap_ptr == xap)
+ break;
+ xap_pptr = xap_ptr;
+ xap_ptr = xap_ptr->xp_next;
+ }
+ if (xap_ptr) {
+ if (xap_pptr)
+ xap_pptr->xp_next = xap_ptr->xp_next;
+ else
+ db->db_xn_xa_table[idx] = xap_ptr->xp_next;
+ xt_free_ns(xap);
+ }
+ if (unlock)
+ xt_unlock_mutex_ns(&db->db_xn_xa_lock);
+}
+
+xtPublic XTXactPreparePtr xt_xn_find_xa_data(XTDatabaseHPtr db, int len, xtWord1 *xa_data, xtBool lock, XTThreadPtr XT_UNUSED(thread))
+{
+ xtWord4 hash;
+ XTXactPreparePtr xap;
+ u_int idx;
+
+ if (lock)
+ xt_lock_mutex_ns(&db->db_xn_xa_lock);
+ hash = xt_get_checksum4(xa_data, len);
+ idx = hash % XT_XA_HASH_TAB_SIZE;
+ xap = db->db_xn_xa_table[idx];
+ while (xap) {
+ if (xap->xp_hash == hash &&
+ xap->xp_data_len == len &&
+ memcmp(xap->xp_xa_data, xa_data, len) == 0) {
+ break;
+ }
+ xap = xap->xp_next;
+ }
+
+ return xap;
+}
+
+xtPublic XTXactPreparePtr xt_xn_enum_xa_data(XTDatabaseHPtr db, XTXactEnumXAPtr exa)
+{
+ XTXactXAPtr xx;
+
+ if (!exa->exa_locked) {
+ xt_lock_mutex_ns(&db->db_xn_xa_lock);
+ exa->exa_locked = TRUE;
+ }
+
+ if ((xx = (XTXactXAPtr) xt_sl_item_at(db->db_xn_xa_list, exa->exa_index))) {
+ exa->exa_index++;
+ return xx->xx_xa_ptr;
+ }
+
+ if (exa->exa_locked) {
+ exa->exa_locked = FALSE;
+ xt_unlock_mutex_ns(&db->db_xn_xa_lock);
+ }
+ return NULL;
+}
+
+/* ----------------------------------------------------------------------
+ * S W E E P E R F U N C T I O N S
+ */
+
xtPublic xtWord8 xt_xn_bytes_to_sweep(XTDatabaseHPtr db, XTThreadPtr thread)
{
xtXactID xn_id;
@@ -2047,7 +2208,7 @@ static xtBool xn_sw_cleanup_variation(XT
if(!tab->tab_recs.xt_tc_write_cond(self, ot->ot_rec_file, rec_id, rec_head.tr_rec_type_1, &op_seq, xn_id, row_id, stat_id, rec_type))
/* this means record was not updated by xt_tc_write_bor and doesn't need to */
break;
- if (!xt_xlog_modify_table(ot, XT_LOG_ENT_REC_CLEANED_1, op_seq, 0, rec_id, 1, &rec_head.tr_rec_type_1))
+ if (!xt_xlog_modify_table(tab->tab_id, XT_LOG_ENT_REC_CLEANED_1, op_seq, 0, rec_id, 1, &rec_head.tr_rec_type_1, self))
throw_();
xn_sw_clean_indices(self, ot, rec_id, row_id, rec_buf, ss->ss_databuf.db_data);
break;
@@ -2397,8 +2558,10 @@ static void xn_sw_main(XTThreadPtr self)
if ((xact = xt_xn_get_xact(db, db->db_xn_to_clean_id, self))) {
xtXactID xn_id;
- if (!(xact->xd_flags & XT_XN_XAC_SWEEP))
- /* Transaction has not yet ending, and ready to sweep. */
+ /* The sweep flag is set when the transaction is ready for sweeping.
+ * Prepared transactions may not be swept!
+ */
+ if (!(xact->xd_flags & XT_XN_XAC_SWEEP) || (xact->xd_flags & XT_XN_XAC_PREPARED))
goto sleep;
/* Check if we can cleanup the transaction.
@@ -2493,7 +2656,7 @@ static void xn_sw_main(XTThreadPtr self)
* we flush the log.
*/
if (now >= idle_start + 2) {
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(db, self))
xt_throw(self);
ss->ss_flush_pending = FALSE;
}
@@ -2516,7 +2679,7 @@ static void xn_sw_main(XTThreadPtr self)
}
if (ss->ss_flush_pending) {
- xt_xlog_flush_log(self);
+ xt_xlog_flush_log(db, self);
ss->ss_flush_pending = FALSE;
}
=== modified file 'storage/pbxt/src/xaction_xt.h'
--- a/storage/pbxt/src/xaction_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/xaction_xt.h 2009-11-24 10:55:06 +0000
@@ -87,6 +87,7 @@ struct XTOpenTable;
#define XT_XN_XAC_CLEANED 8 /* The transaction has been cleaned. */
#define XT_XN_XAC_RECOVERED 16 /* This transaction was detected on recovery. */
#define XT_XN_XAC_SWEEP 32 /* End ID has been set, OK to sweep. */
+#define XT_XN_XAC_PREPARED 64 /* The transaction was prepared (used only by recovery). */
#define XT_XN_VISIBLE 0 /* The transaction is committed, and the record is visible. */
#define XT_XN_NOT_VISIBLE 1 /* The transaction is committed, but not visible. */
@@ -95,6 +96,24 @@ struct XTOpenTable;
#define XT_XN_OTHER_UPDATE 4 /* The record was updated by someone else. */
#define XT_XN_REREAD 5 /* The transaction is not longer in RAM, status is unkown, retry. */
+typedef struct XTXactPrepare {
+ xtXactID xp_xact_id;
+ xtWord4 xp_hash;
+ struct XTXactPrepare *xp_next; /* Next item in hash table. */
+ int xp_data_len;
+ xtWord1 xp_xa_data[XT_MAX_XA_DATA_SIZE];
+} XTXactPrepareRec, *XTXactPreparePtr;
+
+typedef struct XTXactXA {
+ xtXactID xx_xact_id;
+ XTXactPreparePtr xx_xa_ptr;
+} XTXactXARec, *XTXactXAPtr;
+
+typedef struct XTXactEnumXA {
+ u_int exa_index;
+ xtBool exa_locked;
+} XTXactEnumXARec, *XTXactEnumXAPtr;
+
typedef struct XTXactData {
xtXactID xd_start_xn_id; /* Note: may be zero!. */
xtXactID xd_end_xn_id; /* Note: may be zero!. */
@@ -105,6 +124,7 @@ typedef struct XTXactData {
int xd_flags;
xtWord4 xd_end_time;
xtThreadID xd_thread_id;
+ xtWord4 xd_xa_hash; /* 0 if no XA transaction. */
/* A transaction may be indexed twice in the hash table.
* Once on the start sequence number, and once on the
@@ -123,7 +143,7 @@ typedef struct XTXactData {
#if defined(XT_XACT_USE_PTHREAD_RW)
#define XT_XACT_LOCK_TYPE xt_rwlock_type
-#define XT_XACT_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define XT_XACT_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define XT_XACT_FREE_LOCK(s, i) xt_free_rwlock(i)
#define XT_XACT_READ_LOCK(i, s) xt_slock_rwlock_ns(i)
#define XT_XACT_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
@@ -183,6 +203,14 @@ void xt_xn_wakeup_thread(xtThreadID th
xtXactID xt_xn_get_curr_id(struct XTDatabase *db);
xtWord8 xt_xn_bytes_to_sweep(struct XTDatabase *db, struct XTThread *thread);
+int xt_xn_xa_compare(struct XTThread *self, register const void *thunk, register const void *a, register const void *b);
+xtBool xt_xn_prepare(int len, xtWord1 *xa_data, struct XTThread *thread);
+xtBool xt_xn_store_xa_data(struct XTDatabase *db, xtXactID xn_id, int len, xtWord1 *xa_data, struct XTThread *thread);
+void xt_xn_delete_xa_data_by_xact(struct XTDatabase *db, xtXactID xact_id, struct XTThread *thread);
+void xt_xn_delete_xa_data(struct XTDatabase *db, XTXactPreparePtr xap, xtBool unlock, struct XTThread *thread);
+XTXactPreparePtr xt_xn_find_xa_data(struct XTDatabase *db, int len, xtWord1 *xa_data, xtBool lock, struct XTThread *thread);
+XTXactPreparePtr xt_xn_enum_xa_data(struct XTDatabase *db, XTXactEnumXAPtr exa);
+
XTXactDataPtr xt_xn_add_old_xact(struct XTDatabase *db, xtXactID xn_id, struct XTThread *thread);
XTXactDataPtr xt_xn_get_xact(struct XTDatabase *db, xtXactID xn_id, struct XTThread *thread);
xtBool xt_xn_delete_xact(struct XTDatabase *db, xtXactID xn_id, struct XTThread *thread);
=== modified file 'storage/pbxt/src/xactlog_xt.cc'
--- a/storage/pbxt/src/xactlog_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/xactlog_xt.cc 2009-11-24 10:55:06 +0000
@@ -1108,6 +1108,9 @@ xtBool XTDatabaseLog::xlog_append(XTThre
if ((part_size = xl_write_buf_pos % 512)) {
part_size = 512 - part_size;
xl_write_buffer[xl_write_buf_pos] = XT_LOG_ENT_END_OF_LOG;
+#ifdef HAVE_valgrind
+ memset(xl_write_buffer + xl_write_buf_pos + 1, 0x66, part_size);
+#endif
if (!xt_pwrite_file(xl_log_file, xl_write_log_offset, xl_write_buf_pos+part_size, xl_write_buffer, &thread->st_statistics.st_xlog, thread))
goto write_failed;
}
@@ -1477,9 +1480,9 @@ void XTDatabaseLog::xlog_name(size_t siz
* T H R E A D T R A N S A C T I O N B U F F E R
*/
-xtPublic xtBool xt_xlog_flush_log(XTThreadPtr thread)
+xtPublic xtBool xt_xlog_flush_log(struct XTDatabase *db, XTThreadPtr thread)
{
- return thread->st_database->db_xlog.xlog_flush(thread);
+ return db->db_xlog.xlog_flush(thread);
}
xtPublic xtBool xt_xlog_log_data(XTThreadPtr thread, size_t size, XTXactLogBufferDPtr log_entry, xtBool commit)
@@ -1488,15 +1491,14 @@ xtPublic xtBool xt_xlog_log_data(XTThrea
}
/* Allocate a record from the free list. */
-xtPublic xtBool xt_xlog_modify_table(struct XTOpenTable *ot, u_int status, xtOpSeqNo op_seq, xtRecordID free_rec_id, xtRecordID rec_id, size_t size, xtWord1 *data)
+xtPublic xtBool xt_xlog_modify_table(xtTableID tab_id, u_int status, xtOpSeqNo op_seq, xtRecordID free_rec_id, xtRecordID rec_id, size_t size, xtWord1 *data, XTThreadPtr thread)
{
XTXactLogBufferDRec log_entry;
- XTThreadPtr thread = ot->ot_thread;
- XTTableHPtr tab = ot->ot_table;
size_t len;
xtWord4 sum = 0;
int check_size = 1;
XTXactDataPtr xact = NULL;
+ xtBool commit = FALSE;
switch (status) {
case XT_LOG_ENT_REC_MODIFIED:
@@ -1505,7 +1507,7 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_DELETE:
check_size = 2;
XT_SET_DISK_4(log_entry.xu.xu_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xu.xu_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xu.xu_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xu.xu_rec_id_4, rec_id);
XT_SET_DISK_2(log_entry.xu.xu_size_2, size);
len = offsetof(XTactUpdateEntryDRec, xu_rec_type_1);
@@ -1521,7 +1523,7 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_DELETE_FL:
check_size = 2;
XT_SET_DISK_4(log_entry.xf.xf_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xf.xf_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xf.xf_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xf.xf_rec_id_4, rec_id);
XT_SET_DISK_2(log_entry.xf.xf_size_2, size);
XT_SET_DISK_4(log_entry.xf.xf_free_rec_id_4, free_rec_id);
@@ -1539,14 +1541,14 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_REC_REMOVED_EXT:
ASSERT_NS(size == 1 + XT_XACT_ID_SIZE + sizeof(XTTabRecFreeDRec));
XT_SET_DISK_4(log_entry.fr.fr_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.fr.fr_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.fr.fr_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.fr.fr_rec_id_4, rec_id);
len = offsetof(XTactFreeRecEntryDRec, fr_stat_id_1);
break;
case XT_LOG_ENT_REC_REMOVED_BI:
check_size = 2;
XT_SET_DISK_4(log_entry.rb.rb_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.rb.rb_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.rb.rb_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.rb.rb_rec_id_4, rec_id);
XT_SET_DISK_2(log_entry.rb.rb_size_2, size);
log_entry.rb.rb_new_rec_type_1 = (xtWord1) free_rec_id;
@@ -1556,42 +1558,42 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_REC_MOVED:
ASSERT_NS(size == 8);
XT_SET_DISK_4(log_entry.xw.xw_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xw.xw_rec_id_4, rec_id);
len = offsetof(XTactWriteRecEntryDRec, xw_rec_type_1);
break;
case XT_LOG_ENT_REC_CLEANED:
ASSERT_NS(size == offsetof(XTTabRecHeadDRec, tr_prev_rec_id_4) + XT_RECORD_ID_SIZE);
XT_SET_DISK_4(log_entry.xw.xw_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xw.xw_rec_id_4, rec_id);
len = offsetof(XTactWriteRecEntryDRec, xw_rec_type_1);
break;
case XT_LOG_ENT_REC_CLEANED_1:
ASSERT_NS(size == 1);
XT_SET_DISK_4(log_entry.xw.xw_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xw.xw_rec_id_4, rec_id);
len = offsetof(XTactWriteRecEntryDRec, xw_rec_type_1);
break;
case XT_LOG_ENT_REC_UNLINKED:
ASSERT_NS(size == offsetof(XTTabRecHeadDRec, tr_prev_rec_id_4) + XT_RECORD_ID_SIZE);
XT_SET_DISK_4(log_entry.xw.xw_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xw.xw_rec_id_4, rec_id);
len = offsetof(XTactWriteRecEntryDRec, xw_rec_type_1);
break;
case XT_LOG_ENT_ROW_NEW:
ASSERT_NS(size == 0);
XT_SET_DISK_4(log_entry.xa.xa_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xa.xa_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xa.xa_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xa.xa_row_id_4, rec_id);
len = offsetof(XTactRowAddedEntryDRec, xa_row_id_4) + XT_ROW_ID_SIZE;
break;
case XT_LOG_ENT_ROW_NEW_FL:
ASSERT_NS(size == 0);
XT_SET_DISK_4(log_entry.xa.xa_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xa.xa_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xa.xa_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xa.xa_row_id_4, rec_id);
XT_SET_DISK_4(log_entry.xa.xa_free_list_4, free_rec_id);
sum ^= XT_CHECKSUM4_REC(free_rec_id);
@@ -1602,10 +1604,17 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_ROW_FREED:
ASSERT_NS(size == sizeof(XTTabRowRefDRec));
XT_SET_DISK_4(log_entry.wr.wr_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.wr.wr_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.wr.wr_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.wr.wr_row_id_4, rec_id);
len = offsetof(XTactWriteRowEntryDRec, wr_ref_id_4);
break;
+ case XT_LOG_ENT_PREPARE:
+ check_size = 2;
+ XT_SET_DISK_4(log_entry.xp.xp_xact_id_4, op_seq);
+ log_entry.xp.xp_xa_len_1 = (xtWord1) size;
+ len = offsetof(XTXactPrepareEntryDRec, xp_xa_data);
+ commit = TRUE;
+ break;
default:
ASSERT_NS(FALSE);
len = 0;
@@ -1615,7 +1624,7 @@ xtPublic xtBool xt_xlog_modify_table(str
xtWord1 *dptr = data;
xtWord4 g;
- sum ^= op_seq ^ (tab->tab_id << 8) ^ XT_CHECKSUM4_REC(rec_id);
+ sum ^= op_seq ^ (tab_id << 8) ^ XT_CHECKSUM4_REC(rec_id);
if ((g = sum & 0xF0000000)) {
sum = sum ^ (g >> 24);
sum = sum ^ g;
@@ -1643,9 +1652,9 @@ xtPublic xtBool xt_xlog_modify_table(str
xt_print_log_record(0, 0, &log_entry);
#endif
if (xact)
- return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, FALSE, &xact->xd_begin_log, &xact->xd_begin_offset);
+ return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, commit, &xact->xd_begin_log, &xact->xd_begin_offset);
- return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, FALSE, NULL, NULL);
+ return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, commit, NULL, NULL);
}
/*
@@ -1905,6 +1914,7 @@ xtBool XTDatabaseLog::xlog_verify(XTXact
xtRecordID rec_id, free_rec_id;
int check_size = 1;
xtWord1 *dptr;
+ xtWord4 g;
switch (record->xh.xh_status_1) {
case XT_LOG_ENT_HEADER:
@@ -2019,13 +2029,19 @@ xtBool XTDatabaseLog::xlog_verify(XTXact
return record->xe.xe_checksum_1 == (XT_CHECKSUM_1(sum) ^ XT_CHECKSUM_1(log_id));
case XT_LOG_ENT_END_OF_LOG:
return FALSE;
+ case XT_LOG_ENT_PREPARE:
+ check_size = 2;
+ op_seq = XT_GET_DISK_4(record->xp.xp_xact_id_4);
+ tab_id = 0;
+ rec_id = 0;
+ dptr = record->xp.xp_xa_data;
+ rec_size -= offsetof(XTXactPrepareEntryDRec, xp_xa_data);
+ break;
default:
ASSERT_NS(FALSE);
return FALSE;
}
- xtWord4 g;
-
sum ^= (xtWord4) op_seq ^ ((xtWord4) tab_id << 8) ^ XT_CHECKSUM4_REC(rec_id);
if ((g = sum & 0xF0000000)) {
@@ -2193,6 +2209,14 @@ xtBool XTDatabaseLog::xlog_seq_next(XTXa
}
goto return_empty;
}
+ case XT_LOG_ENT_PREPARE:
+ check_size = 2;
+ len = offsetof(XTXactPrepareEntryDRec, xp_xa_data);
+ if (len > max_rec_len)
+ /* The size is not in the buffer: */
+ goto read_more;
+ len += (size_t) record->xp.xp_xa_len_1;
+ break;
default:
/* It is possible to land here after a crash, if the
* log was not completely written.
@@ -2231,7 +2255,7 @@ xtBool XTDatabaseLog::xlog_seq_next(XTXa
goto return_empty;
}
- /* The record is not completely in the buffer: */
+ /* The record is now completely in the buffer: */
seq->xseq_record_len = len;
*ret_entry = (XTXactLogBufferDPtr) seq->xseq_buffer;
return OK;
@@ -2428,7 +2452,7 @@ static void xlog_wr_wait_for_log_flush(X
if (reason == XT_LOG_CACHE_FULL || reason == XT_TIME_TO_WRITE || reason == XT_CHECKPOINT_REQ) {
/* Make sure that we have something to write: */
if (db->db_xlog.xlog_bytes_to_write() < 2 * 1204 * 1024)
- xt_xlog_flush_log(self);
+ xt_xlog_flush_log(db, self);
}
#ifdef TRACE_WRITER_ACTIVITY
@@ -2529,6 +2553,7 @@ static void xlog_wr_main(XTThreadPtr sel
case XT_LOG_ENT_ABORT:
case XT_LOG_ENT_CLEANUP:
case XT_LOG_ENT_OP_SYNC:
+ case XT_LOG_ENT_PREPARE:
break;
case XT_LOG_ENT_DEL_LOG:
xtLogID log_id;
=== modified file 'storage/pbxt/src/xactlog_xt.h'
--- a/storage/pbxt/src/xactlog_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/xactlog_xt.h 2009-11-24 10:55:06 +0000
@@ -160,6 +160,7 @@ typedef struct XTXLogCache {
#define XT_LOG_ENT_END_OF_LOG 37 /* This is a record that indicates the end of the log, and
* fills to the end of a 512 byte block.
*/
+#define XT_LOG_ENT_PREPARE 39 /* XA prepare log entry. */
#define XT_LOG_FILE_MAGIC 0xAE88FE12
#define XT_LOG_VERSION_NO 1
@@ -201,6 +202,14 @@ typedef struct XTXactEndEntry {
XTDiskValue4 xe_not_used_4; /* Was the end sequence number (no longer used - v1.0.04+), set to zero). */
} XTXactEndEntryDRec, *XTXactEndEntryDPtr;
+typedef struct XTXactPrepareEntry {
+ xtWord1 xp_status_1; /* XT_LOG_ENT_PREPARE */
+ XTDiskValue2 xp_checksum_2;
+ XTDiskValue4 xp_xact_id_4; /* The transaction. */
+ xtWord1 xp_xa_len_1; /* The length of the XA data. */
+ xtWord1 xp_xa_data[XT_MAX_XA_DATA_SIZE];
+} XTXactPrepareEntryDRec, *XTXactPrepareEntryDPtr;
+
typedef struct XTXactCleanupEntry {
xtWord1 xc_status_1; /* XT_LOG_ENT_CLEANUP */
xtWord1 xc_checksum_1;
@@ -344,6 +353,7 @@ typedef union XTXactLogBuffer {
XTactOpSyncEntryDRec os;
XTactExtRecEntryDRec er;
XTactNoOpEntryDRec no;
+ XTXactPrepareEntryDRec xp;
} XTXactLogBufferDRec, *XTXactLogBufferDPtr;
/* ---------------------------------------- */
@@ -453,9 +463,9 @@ private:
xtBool xlog_open_log(xtLogID log_id, off_t curr_eof, struct XTThread *thread);
} XTDatabaseLogRec, *XTDatabaseLogPtr;
-xtBool xt_xlog_flush_log(struct XTThread *thread);
+xtBool xt_xlog_flush_log(struct XTDatabase *db, struct XTThread *thread);
xtBool xt_xlog_log_data(struct XTThread *thread, size_t len, XTXactLogBufferDPtr log_entry, xtBool commit);
-xtBool xt_xlog_modify_table(struct XTOpenTable *ot, u_int status, xtOpSeqNo op_seq, xtRecordID free_list, xtRecordID address, size_t size, xtWord1 *data);
+xtBool xt_xlog_modify_table(xtTableID tab_id, u_int status, xtOpSeqNo op_seq, xtRecordID free_list, xtRecordID address, size_t size, xtWord1 *data, struct XTThread *thread);
void xt_xlog_init(struct XTThread *self, size_t cache_size);
void xt_xlog_exit(struct XTThread *self);
=== modified file 'storage/pbxt/src/xt_config.h'
--- a/storage/pbxt/src/xt_config.h 2009-08-31 11:07:44 +0000
+++ b/storage/pbxt/src/xt_config.h 2009-11-24 10:55:06 +0000
@@ -50,7 +50,9 @@ const int max_connections = 500;
/*
* Make sure we use the thread safe version of the library.
*/
+#ifndef _THREAD_SAFE // Seems to be defined by some Drizzle header
#define _THREAD_SAFE
+#endif
/*
* This causes things to be defined like stuff in inttypes.h
@@ -72,12 +74,12 @@ const int max_connections = 500;
#define XT_MAC
#endif
-#if defined(MSDOS) || defined(__WIN__)
+#if defined(MSDOS) || defined(__WIN__) || defined(_WIN64)
#define XT_WIN
#endif
#ifdef XT_WIN
-#ifdef _DEBUG
+#if defined(_DEBUG) && !defined(DEBUG)
#define DEBUG
#endif // _DEBUG
#else
@@ -101,8 +103,13 @@ const int max_connections = 500;
* Definition of which atomic operations to use:
*/
#ifdef XT_WIN
+#ifdef _WIN64
+/* 64-bit Windows atomic ops are not yet supported: */
+#define XT_NO_ATOMICS
+#else
/* MS Studio style embedded assembler for x86 */
#define XT_ATOMIC_WIN32_X86
+#endif
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
/* Use GNU style embedded assembler for x86 */
#define XT_ATOMIC_GNUC_X86
@@ -115,4 +122,10 @@ const int max_connections = 500;
#define XT_NO_ATOMICS
#endif
+#ifndef DRIZZLED
+#if MYSQL_VERSION_ID >= 50404
+#define MYSQL_SUPPORTS_BACKUP
+#endif
+#endif
+
#endif
=== modified file 'storage/pbxt/src/xt_defs.h'
--- a/storage/pbxt/src/xt_defs.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/xt_defs.h 2009-11-24 10:55:06 +0000
@@ -379,6 +379,19 @@ typedef struct XTPathStr {
*/
//#define XT_IMPLEMENT_NO_ACTION
+/* Define this value if online-backup should be supported.
+ * Note that, online backup is currently only supported
+ * by MySQL 6.0.9 or later
+ */
+#define XT_ENABLE_ONLINE_BACKUP
+
+/* Define this switch if you don't want to use atomic
+ * synchronisation.
+ */
+#ifndef XT_NO_ATOMICS
+//#define XT_NO_ATOMICS
+#endif
+
/* ----------------------------------------------------------------------
* GLOBAL CONSTANTS
*/
@@ -406,6 +419,8 @@ typedef struct XTPathStr {
#define XT_ADD_PTR(p, l) ((void *) ((char *) (p) + (l)))
+#define XT_MAX_XA_DATA_SIZE (3*4 + 128) /* Corresponds to the maximum size of struct xid_t in handler.h. */
+
/* ----------------------------------------------------------------------
* DEFINES DEPENDENT ON CONSTANTS
*/
@@ -744,6 +759,7 @@ extern xtBool pbxt_crash_debug;
#define MYSQL_PLUGIN_VAR_HEADER DRIZZLE_PLUGIN_VAR_HEADER
#define MYSQL_SYSVAR_STR DRIZZLE_SYSVAR_STR
#define MYSQL_SYSVAR_INT DRIZZLE_SYSVAR_INT
+#define MYSQL_SYSVAR_BOOL DRIZZLE_SYSVAR_BOOL
#define MYSQL_SYSVAR DRIZZLE_SYSVAR
#define MYSQL_STORAGE_ENGINE_PLUGIN DRIZZLE_STORAGE_ENGINE_PLUGIN
#define MYSQL_INFORMATION_SCHEMA_PLUGIN DRIZZLE_INFORMATION_SCHEMA_PLUGIN
@@ -752,9 +768,8 @@ extern xtBool pbxt_crash_debug;
#define mx_tmp_use_all_columns(x, y) (x)->use_all_columns(y)
#define mx_tmp_restore_column_map(x, y) (x)->restore_column_map(y)
-#define MX_BIT_FAST_TEST_AND_SET(x, y) bitmap_test_and_set(x, y)
-#define MX_TABLE_TYPES_T handler::Table_flags
+#define MX_TABLE_TYPES_T Cursor::Table_flags
#define MX_UINT8_T uint8_t
#define MX_ULONG_T uint32_t
#define MX_ULONGLONG_T uint64_t
@@ -762,6 +777,10 @@ extern xtBool pbxt_crash_debug;
#define MX_CHARSET_INFO struct charset_info_st
#define MX_CONST_CHARSET_INFO const struct charset_info_st
#define MX_CONST const
+#define MX_BITMAP MyBitmap
+#define MX_BIT_SIZE() numOfBitsInMap()
+#define MX_BIT_SET(x, y) (x)->setBit(y)
+#define MX_BIT_FAST_TEST_AND_SET(x, y) (x)->testAndSet(y)
#define my_bool bool
#define int16 int16_t
@@ -771,6 +790,7 @@ extern xtBool pbxt_crash_debug;
#define uchar unsigned char
#define longlong int64_t
#define ulonglong uint64_t
+#define handler Cursor
#define HAVE_LONG_LONG
@@ -823,10 +843,13 @@ extern xtBool pbxt_crash_debug;
class PBXTStorageEngine;
typedef PBXTStorageEngine handlerton;
+class Session;
+
+extern "C" void session_mark_transaction_to_rollback(Session *session, bool all);
#else // DRIZZLED
/* The MySQL case: */
-#if MYSQL_VERSION_ID >= 60008
+#if MYSQL_VERSION_ID >= 50404
#define STRUCT_TABLE struct TABLE
#else
#define STRUCT_TABLE struct st_table
@@ -844,13 +867,13 @@ typedef PBXTStorageEngine handlerton;
#define MX_CHARSET_INFO CHARSET_INFO
#define MX_CONST_CHARSET_INFO struct charset_info_st
#define MX_CONST
+#define MX_BITMAP MY_BITMAP
+#define MX_BIT_SIZE() n_bits
+#define MX_BIT_SET(x, y) bitmap_set_bit(x, y)
#endif // DRIZZLED
-#define MX_BITMAP MY_BITMAP
-#define MX_BIT_SIZE() n_bits
#define MX_BIT_IS_SUBSET(x, y) bitmap_is_subset(x, y)
-#define MX_BIT_SET(x, y) bitmap_set_bit(x, y)
#ifndef XT_SCAN_CORE_DEFINED
#define XT_SCAN_CORE_DEFINED
=== modified file 'storage/pbxt/src/xt_errno.h'
--- a/storage/pbxt/src/xt_errno.h 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/xt_errno.h 2009-11-24 10:55:06 +0000
@@ -119,6 +119,9 @@
#define XT_ERR_FK_REF_TEMP_TABLE -95
#define XT_ERR_MYSQL_SHUTDOWN -98
#define XT_ERR_MYSQL_NO_THREAD -99
+#define XT_ERR_BUFFER_TOO_SMALL -100
+#define XT_ERR_BAD_BACKUP_FORMAT -101
+#define XT_ERR_PBXT_NOT_INSTALLED -102
#ifdef XT_WIN
#define XT_ENOMEM ERROR_NOT_ENOUGH_MEMORY
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2774)
by knielsen@knielsen-hq.org 02 Dec '09
by knielsen@knielsen-hq.org 02 Dec '09
02 Dec '09
#At lp:maria
2774 knielsen(a)knielsen-hq.org 2009-12-02 [merge]
Merge PBXT 1.0.09f RC3 into MariaDB.
added:
storage/pbxt/src/backup_xt.cc
storage/pbxt/src/backup_xt.h
modified:
sql/handler.cc
storage/pbxt/ChangeLog
storage/pbxt/src/Makefile.am
storage/pbxt/src/cache_xt.cc
storage/pbxt/src/cache_xt.h
storage/pbxt/src/database_xt.cc
storage/pbxt/src/database_xt.h
storage/pbxt/src/datadic_xt.cc
storage/pbxt/src/datalog_xt.cc
storage/pbxt/src/discover_xt.cc
storage/pbxt/src/filesys_xt.cc
storage/pbxt/src/filesys_xt.h
storage/pbxt/src/ha_pbxt.cc
storage/pbxt/src/ha_pbxt.h
storage/pbxt/src/ha_xtsys.h
storage/pbxt/src/heap_xt.cc
storage/pbxt/src/index_xt.cc
storage/pbxt/src/lock_xt.cc
storage/pbxt/src/locklist_xt.h
storage/pbxt/src/memory_xt.cc
storage/pbxt/src/myxt_xt.cc
storage/pbxt/src/myxt_xt.h
storage/pbxt/src/pbms.h
storage/pbxt/src/pbms_enabled.cc
storage/pbxt/src/pbms_enabled.h
storage/pbxt/src/pthread_xt.cc
storage/pbxt/src/restart_xt.cc
storage/pbxt/src/restart_xt.h
storage/pbxt/src/strutil_xt.cc
storage/pbxt/src/systab_xt.cc
storage/pbxt/src/tabcache_xt.cc
storage/pbxt/src/tabcache_xt.h
storage/pbxt/src/table_xt.cc
storage/pbxt/src/table_xt.h
storage/pbxt/src/thread_xt.cc
storage/pbxt/src/thread_xt.h
storage/pbxt/src/util_xt.cc
storage/pbxt/src/util_xt.h
storage/pbxt/src/xaction_xt.cc
storage/pbxt/src/xaction_xt.h
storage/pbxt/src/xactlog_xt.cc
storage/pbxt/src/xactlog_xt.h
storage/pbxt/src/xt_config.h
storage/pbxt/src/xt_defs.h
storage/pbxt/src/xt_errno.h
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2009-11-16 20:49:51 +0000
+++ b/sql/handler.cc 2009-12-02 11:50:40 +0000
@@ -1584,16 +1584,6 @@ int ha_recover(HASH *commit_list)
if (info.commit_list)
sql_print_information("Starting crash recovery...");
-#ifndef WILL_BE_DELETED_LATER
- /*
- for now, only InnoDB supports 2pc. It means we can always safely
- rollback all pending transactions, without risking inconsistent data
- */
- DBUG_ASSERT(total_ha_2pc == (ulong) opt_bin_log+1); // only InnoDB and binlog
- tc_heuristic_recover= TC_HEURISTIC_RECOVER_ROLLBACK; // forcing ROLLBACK
- info.dry_run=FALSE;
-#endif
-
for (info.len= MAX_XID_LIST_SIZE ;
info.list==0 && info.len > MIN_XID_LIST_SIZE; info.len/=2)
{
=== modified file 'storage/pbxt/ChangeLog'
--- a/storage/pbxt/ChangeLog 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/ChangeLog 2009-12-01 09:50:46 +0000
@@ -1,6 +1,58 @@
PBXT Release Notes
==================
+------- 1.0.09f RC3 - 2009-11-30
+
+RN291: Fixed bug #489088: On shutdown MySQL reports: [Warning] Plugin 'PBXT' will be forced to shutdown.
+
+RN290: Fixed bug #345524: pbxt does not compile on 64 bit windows. Currently atomic operations are not supported on this platform.
+
+RN286: Fixed a bug introduced in RN281, which could cause an index scan to hang. The original change was to prevent a warning in Valgrind.
+
+RN285: Merged changes required to compile with Drizzle.
+
+RN284: Fixed bug that cause the error "[ERROR] Invalid (old?) table or database name 'mysqld.1'", when running temp_table.test under MariaDB (thanks to Monty for his initial bug fix). Added a fix for partition table names as well.
+
+RN283: Added win_inttypes.h to the distribution. This file is only required for the Windows build.
+
+RN282: Fixed bug #451101: jump or move depends on uninitialised value in myxt_get_key_length
+
+RN281: Fixed bug #451080: Uninitialised memory write in XTDatabaseLog::xlog_append
+
+RN280: Fixed bug #451085: jump or move depends on uninitialised value in my_type_to_string
+
+RN279: Fixed bug #441000: xtstat crashes with segmentation fault on startup if max_pbxt_threads exceeded.
+
+------- 1.0.09e RC3 - 2009-11-20
+
+RN278: Fixed compile error with MySQL 5.1.41.
+
+------- 1.0.09d RC3 - 2009-09-30
+
+RN277: Added r/o flag to pbxt_max_threads server variable (this fix is related to bug #430637)
+
+RN276: Added test case for replication on tables w/o PKs (see bug #430716)
+
+RN275: Fixed bug #430600: 'Failed to read auto-increment value from storage engine' error.
+
+RN274: Fixed bug #431240: This report is public edit xtstat fails if no PBXT table has been created. xtstat now accepts --database=information_schema or --database=pbxt. Depending on this setting PBXT will either use the information_schema.pbxt_statistics or the pbxt.statistics table. If information_schema is used, then the statistics are displayed even when no PBXT table exists. Recovery activity is also displayed, unless pbxt_support_xa=1, in which case MySQL will wait for PBXT recovery to complete before allowing connections.
+
+RN273: Fixed bug #430633: XA_RBDEADLOCK is not returned on XA END after the transacting ended with a deadlock.
+
+RN272: Fixed bug #430596: Backup/restore does not work well even on a basic PBXT table with auto-increment.
+
+------- 1.0.09c RC3 - 2009-09-16
+
+RN271: Windows build update: now you can simply put the pbxt directory under <mysql-root>/storage and build the PBXT engine as a part of the source tree. The engine will be linked statically. Be sure to specify the WITH_PBXT_STORAGE_ENGINE option when running win\configure.js
+
+RN270: Correctly disabled PBMS so that this version now compiles under Windows. If PBMS_ENABLED is defined, PBXT will not compile under Windows becaause of a getpid() call in pbms.h.
+
+------- 1.0.09 RC3 - 2009-09-09
+
+RN269: Implemented online backup. A native online backup driver now performs BACKUP and RESTORE DATABASE operations for PBXT. NOTE: This feature is only supported by MySQL 6.0.9 or later.
+
+RN268: Implemented XA support. PBXT now supports all XA related MySQL statements. The variable pbxt_support_xa determines if XA support is enabled. Note: due to MySQL bug #47134, enabling XA support could lead to a crash.
+
------- 1.0.08d RC2 - 2009-09-02
RN267: Fixed a bug that caused MySQL to crash on shutdown, after an incorrect command line parameter was given. The crash occurred because the background recovery task was not cleaned up before the PBXT engine was de-initialized.
=== modified file 'storage/pbxt/src/Makefile.am'
--- a/storage/pbxt/src/Makefile.am 2009-10-07 07:40:56 +0000
+++ b/storage/pbxt/src/Makefile.am 2009-11-24 10:55:06 +0000
@@ -22,7 +22,7 @@ noinst_HEADERS = bsearch_xt.h cache_xt.
pbms_enabled.h sortedlist_xt.h strutil_xt.h \
tabcache_xt.h table_xt.h trace_xt.h thread_xt.h \
util_xt.h xaction_xt.h xactlog_xt.h lock_xt.h \
- systab_xt.h ha_xtsys.h discover_xt.h \
+ systab_xt.h ha_xtsys.h discover_xt.h backup_xt.h \
pbms.h xt_config.h xt_defs.h xt_errno.h locklist_xt.h
EXTRA_LTLIBRARIES = libpbxt.la
@@ -32,7 +32,7 @@ libpbxt_la_SOURCES = bsearch_xt.cc cache
memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \
sortedlist_xt.cc strutil_xt.cc \
tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \
- systab_xt.cc ha_xtsys.cc discover_xt.cc \
+ systab_xt.cc ha_xtsys.cc discover_xt.cc backup_xt.cc \
util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc
libpbxt_la_LDFLAGS = -module
=== added file 'storage/pbxt/src/backup_xt.cc'
--- a/storage/pbxt/src/backup_xt.cc 1970-01-01 00:00:00 +0000
+++ b/storage/pbxt/src/backup_xt.cc 2009-11-24 10:55:06 +0000
@@ -0,0 +1,802 @@
+/* Copyright (c) 2009 PrimeBase Technologies GmbH
+ *
+ * PrimeBase XT
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * 2009-09-07 Paul McCullagh
+ *
+ * H&G2JCtL
+ */
+
+#include "xt_config.h"
+
+#ifdef MYSQL_SUPPORTS_BACKUP
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <ctype.h>
+
+#include "mysql_priv.h"
+#include <backup/api_types.h>
+#include <backup/backup_engine.h>
+#include <backup/backup_aux.h> // for build_table_list()
+#include <hash.h>
+
+#include "ha_pbxt.h"
+
+#include "backup_xt.h"
+#include "pthread_xt.h"
+#include "filesys_xt.h"
+#include "database_xt.h"
+#include "strutil_xt.h"
+#include "memory_xt.h"
+#include "trace_xt.h"
+#include "myxt_xt.h"
+
+#ifdef OK
+#undef OK
+#endif
+
+#ifdef byte
+#undef byte
+#endif
+
+#ifdef DEBUG
+//#define TRACE_BACKUP_CALLS
+//#define TEST_SMALL_BLOCK 100000
+#endif
+
+using backup::byte;
+using backup::result_t;
+using backup::version_t;
+using backup::Table_list;
+using backup::Table_ref;
+using backup::Buffer;
+
+#ifdef TRACE_BACKUP_CALLS
+#define XT_TRACE_CALL() ha_trace_function(__FUNC__, NULL)
+#else
+#define XT_TRACE_CALL()
+#endif
+
+#define XT_RESTORE_BATCH_SIZE 10000
+
+#define BUP_STATE_BEFORE_LOCK 0
+#define BUP_STATE_AFTER_LOCK 1
+
+#define BUP_STANDARD_VAR_RECORD 1
+#define BUP_RECORD_BLOCK_4_START 2 // Part of a record, with a 4 byte total length, and 4 byte data length
+#define BUP_RECORD_BLOCK_4 3 // Part of a record, with a 4 byte length
+#define BUP_RECORD_BLOCK_4_END 4 // Last part of a record with a 4 byte length
+
+/*
+ * -----------------------------------------------------------------------
+ * UTILITIES
+ */
+
+#ifdef TRACE_BACKUP_CALLS
+static void ha_trace_function(const char *function, char *table)
+{
+ char func_buf[50], *ptr;
+ XTThreadPtr thread = xt_get_self();
+
+ if ((ptr = strchr(function, '('))) {
+ ptr--;
+ while (ptr > function) {
+ if (!(isalnum(*ptr) || *ptr == '_'))
+ break;
+ ptr--;
+ }
+ ptr++;
+ xt_strcpy(50, func_buf, ptr);
+ if ((ptr = strchr(func_buf, '(')))
+ *ptr = 0;
+ }
+ else
+ xt_strcpy(50, func_buf, function);
+ if (table)
+ printf("%s %s (%s)\n", thread ? thread->t_name : "-unknown-", func_buf, table);
+ else
+ printf("%s %s\n", thread ? thread->t_name : "-unknown-", func_buf);
+}
+#endif
+
+/*
+ * -----------------------------------------------------------------------
+ * BACKUP DRIVER
+ */
+
+class PBXTBackupDriver: public Backup_driver
+{
+ public:
+ PBXTBackupDriver(const Table_list &);
+ virtual ~PBXTBackupDriver();
+
+ virtual size_t size();
+ virtual size_t init_size();
+ virtual result_t begin(const size_t);
+ virtual result_t end();
+ virtual result_t get_data(Buffer &);
+ virtual result_t prelock();
+ virtual result_t lock();
+ virtual result_t unlock();
+ virtual result_t cancel();
+ virtual void free();
+ void lock_tables_TL_READ_NO_INSERT();
+
+ private:
+ XTThreadPtr bd_thread;
+ int bd_state;
+ u_int bd_table_no;
+ XTOpenTablePtr bd_ot;
+ xtWord1 *bd_row_buf;
+
+ /* Non-zero if we last returned only part of
+ * a row.
+ */
+ xtWord1 *db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *size, xtWord4 row_len);
+ xtWord1 *db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *size, xtWord4 total_len, xtWord4 row_len);
+
+ xtWord4 bd_row_offset;
+ xtWord4 bd_row_size;
+};
+
+
+PBXTBackupDriver::PBXTBackupDriver(const Table_list &tables):
+Backup_driver(tables),
+bd_state(BUP_STATE_BEFORE_LOCK),
+bd_table_no(0),
+bd_ot(NULL),
+bd_row_buf(NULL),
+bd_row_offset(0),
+bd_row_size(0)
+{
+}
+
+PBXTBackupDriver::~PBXTBackupDriver()
+{
+}
+
+/** Estimates total size of backup. @todo improve it */
+size_t PBXTBackupDriver::size()
+{
+ XT_TRACE_CALL();
+ return UNKNOWN_SIZE;
+}
+
+/** Estimates size of backup before lock. @todo improve it */
+size_t PBXTBackupDriver::init_size()
+{
+ XT_TRACE_CALL();
+ return 0;
+}
+
+result_t PBXTBackupDriver::begin(const size_t)
+{
+ THD *thd = current_thd;
+ XTExceptionRec e;
+
+ XT_TRACE_CALL();
+
+ if (!(bd_thread = xt_ha_set_current_thread(thd, &e))) {
+ xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
+ return backup::ERROR;
+ }
+
+ return backup::OK;
+}
+
+result_t PBXTBackupDriver::end()
+{
+ XT_TRACE_CALL();
+ if (bd_ot) {
+ xt_tab_seq_exit(bd_ot);
+ xt_db_return_table_to_pool_ns(bd_ot);
+ bd_ot = NULL;
+ }
+ if (bd_thread->st_xact_data) {
+ if (!xt_xn_commit(bd_thread))
+ return backup::ERROR;
+ }
+ return backup::OK;
+}
+
+xtWord1 *PBXTBackupDriver::db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *ret_size, xtWord4 row_len)
+{
+ register size_t size = *ret_size;
+
+ *buffer = bup_type; // Record type identifier.
+ buffer++;
+ size--;
+ memcpy(buffer, bd_ot->ot_row_wbuffer, row_len);
+ buffer += row_len;
+ size -= row_len;
+ *ret_size = size;
+ return buffer;
+}
+
+xtWord1 *PBXTBackupDriver::db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *ret_size, xtWord4 total_len, xtWord4 row_len)
+{
+ register size_t size = *ret_size;
+
+ *buffer = bup_type; // Record type identifier.
+ buffer++;
+ size--;
+ if (bup_type == BUP_RECORD_BLOCK_4_START) {
+ XT_SET_DISK_4(buffer, total_len);
+ buffer += 4;
+ size -= 4;
+ }
+ XT_SET_DISK_4(buffer, row_len);
+ buffer += 4;
+ size -= 4;
+ memcpy(buffer, bd_ot->ot_row_wbuffer+bd_row_offset, row_len);
+ buffer += row_len;
+ size -= row_len;
+ bd_row_size -= row_len;
+ bd_row_offset += row_len;
+ *ret_size = size;
+ return buffer;
+}
+
+result_t PBXTBackupDriver::get_data(Buffer &buf)
+{
+ xtBool eof = FALSE;
+ size_t size;
+ xtWord4 row_len;
+ xtWord1 *buffer;
+
+ XT_TRACE_CALL();
+
+ if (bd_state == BUP_STATE_BEFORE_LOCK) {
+ buf.table_num = 0;
+ buf.size = 0;
+ buf.last = FALSE;
+ return backup::READY;
+ }
+
+ /* Open the backup table: */
+ if (!bd_ot) {
+ XTThreadPtr self = bd_thread;
+ XTTableHPtr tab;
+ char path[PATH_MAX];
+
+ if (bd_table_no == m_tables.count()) {
+ buf.size = 0;
+ buf.table_num = 0;
+ buf.last = TRUE;
+ return backup::DONE;
+ }
+
+ m_tables[bd_table_no].internal_name(path, sizeof(path));
+ bd_table_no++;
+ try_(a) {
+ xt_ha_open_database_of_table(self, (XTPathStrPtr) path);
+ tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE, NULL);
+ pushr_(xt_heap_release, tab);
+ if (!(bd_ot = xt_db_open_table_using_tab(tab, bd_thread)))
+ xt_throw(self);
+ freer_(); // xt_heap_release(tab)
+
+ /* Prepare the seqential scan: */
+ xt_tab_seq_exit(bd_ot);
+ if (!xt_tab_seq_init(bd_ot))
+ xt_throw(self);
+
+ if (bd_row_buf) {
+ xt_free(self, bd_row_buf);
+ bd_row_buf = NULL;
+ }
+ bd_row_buf = (xtWord1 *) xt_malloc(self, bd_ot->ot_table->tab_dic.dic_mysql_buf_size);
+ bd_ot->ot_cols_req = bd_ot->ot_table->tab_dic.dic_no_of_cols;
+ }
+ catch_(a) {
+ ;
+ }
+ cont_(a);
+
+ if (!bd_ot)
+ goto failed;
+ }
+
+ buf.table_num = bd_table_no;
+#ifdef TEST_SMALL_BLOCK
+ buf.size = TEST_SMALL_BLOCK;
+#endif
+ size = buf.size;
+ buffer = (xtWord1 *) buf.data;
+ ASSERT_NS(size > 9);
+
+ /* First check of a record was partically written
+ * last time.
+ */
+ write_row:
+ if (bd_row_size > 0) {
+ row_len = bd_row_size;
+ if (bd_row_offset == 0) {
+ if (row_len+1 > size) {
+ ASSERT_NS(size > 9);
+ row_len = size - 9;
+ buffer = db_write_block(buffer, BUP_RECORD_BLOCK_4_START, &size, bd_row_size, row_len);
+ goto done;
+ }
+ buffer = db_write_block(buffer, BUP_STANDARD_VAR_RECORD, &size, row_len);
+ bd_row_size = 0;
+ }
+ else {
+ if (row_len+5 > size) {
+ row_len = size - 5;
+ buffer = db_write_block(buffer, BUP_RECORD_BLOCK_4, &size, 0, row_len);
+ goto done;
+ }
+ buffer = db_write_block(buffer, BUP_RECORD_BLOCK_4_END, &size, 0, row_len);
+ }
+ }
+
+ /* Now continue with the sequential scan. */
+ while (size > 1) {
+ if (!xt_tab_seq_next(bd_ot, bd_row_buf, &eof))
+ goto failed;
+ if (eof) {
+ /* We will go the next table, on the next call. */
+ xt_tab_seq_exit(bd_ot);
+ xt_db_return_table_to_pool_ns(bd_ot);
+ bd_ot = NULL;
+ break;
+ }
+ if (!(row_len = myxt_store_row_data(bd_ot, 0, (char *) bd_row_buf)))
+ goto failed;
+ if (row_len+1 > size) {
+ /* Does not fit: */
+ bd_row_offset = 0;
+ bd_row_size = row_len;
+ /* Only add part of the row, if there is still
+ * quite a bit of space left:
+ */
+ if (size >= (32 * 1024))
+ goto write_row;
+ break;
+ }
+ buffer = db_write_block(buffer, BUP_STANDARD_VAR_RECORD, &size, row_len);
+ }
+
+ done:
+ buf.size = buf.size - size;
+ /* This indicates wnd of data for a table! */
+ buf.last = eof;
+
+ return backup::OK;
+
+ failed:
+ xt_log_and_clear_exception(bd_thread);
+ return backup::ERROR;
+}
+
+result_t PBXTBackupDriver::prelock()
+{
+ XT_TRACE_CALL();
+ return backup::READY;
+}
+
+result_t PBXTBackupDriver::lock()
+{
+ XT_TRACE_CALL();
+ bd_thread->st_xact_mode = XT_XACT_COMMITTED_READ;
+ bd_thread->st_ignore_fkeys = FALSE;
+ bd_thread->st_auto_commit = FALSE;
+ bd_thread->st_table_trans = FALSE;
+ bd_thread->st_abort_trans = FALSE;
+ bd_thread->st_stat_ended = FALSE;
+ bd_thread->st_stat_trans = FALSE;
+ bd_thread->st_is_update = FALSE;
+ if (!xt_xn_begin(bd_thread))
+ return backup::ERROR;
+ bd_state = BUP_STATE_AFTER_LOCK;
+ return backup::OK;
+}
+
+result_t PBXTBackupDriver::unlock()
+{
+ XT_TRACE_CALL();
+ return backup::OK;
+}
+
+result_t PBXTBackupDriver::cancel()
+{
+ XT_TRACE_CALL();
+ return backup::OK; // free() will be called and suffice
+}
+
+void PBXTBackupDriver::free()
+{
+ XT_TRACE_CALL();
+ if (bd_ot) {
+ xt_tab_seq_exit(bd_ot);
+ xt_db_return_table_to_pool_ns(bd_ot);
+ bd_ot = NULL;
+ }
+ if (bd_row_buf) {
+ xt_free_ns(bd_row_buf);
+ bd_row_buf = NULL;
+ }
+ if (bd_thread->st_xact_data)
+ xt_xn_rollback(bd_thread);
+ delete this;
+}
+
+void PBXTBackupDriver::lock_tables_TL_READ_NO_INSERT()
+{
+ XT_TRACE_CALL();
+}
+
+/*
+ * -----------------------------------------------------------------------
+ * BACKUP DRIVER
+ */
+
+class PBXTRestoreDriver: public Restore_driver
+{
+ public:
+ PBXTRestoreDriver(const Table_list &tables);
+ virtual ~PBXTRestoreDriver();
+
+ virtual result_t begin(const size_t);
+ virtual result_t end();
+ virtual result_t send_data(Buffer &buf);
+ virtual result_t cancel();
+ virtual void free();
+
+ private:
+ XTThreadPtr rd_thread;
+ u_int rd_table_no;
+ XTOpenTablePtr rd_ot;
+ STRUCT_TABLE *rd_my_table;
+ xtWord1 *rb_row_buf;
+ u_int rb_col_cnt;
+ u_int rb_insert_count;
+
+ /* Long rows are accumulated here: */
+ xtWord4 rb_row_len;
+ xtWord4 rb_data_size;
+ xtWord1 *rb_row_data;
+};
+
+PBXTRestoreDriver::PBXTRestoreDriver(const Table_list &tables):
+Restore_driver(tables),
+rd_thread(NULL),
+rd_table_no(0),
+rd_ot(NULL),
+rb_row_buf(NULL),
+rb_row_len(0),
+rb_data_size(0),
+rb_row_data(NULL)
+{
+}
+
+PBXTRestoreDriver::~PBXTRestoreDriver()
+{
+}
+
+result_t PBXTRestoreDriver::begin(const size_t)
+{
+ THD *thd = current_thd;
+ XTExceptionRec e;
+
+ XT_TRACE_CALL();
+
+ if (!(rd_thread = xt_ha_set_current_thread(thd, &e))) {
+ xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
+ return backup::ERROR;
+ }
+
+ return backup::OK;
+}
+
+result_t PBXTRestoreDriver::end()
+{
+ XT_TRACE_CALL();
+ if (rd_ot) {
+ xt_db_return_table_to_pool_ns(rd_ot);
+ rd_ot = NULL;
+ }
+ //if (rb_row_buf) {
+ // xt_free_ns(rb_row_buf);
+ // rb_row_buf = NULL;
+ //}
+ if (rb_row_data) {
+ xt_free_ns(rb_row_data);
+ rb_row_data = NULL;
+ }
+ if (rd_thread->st_xact_data) {
+ if (!xt_xn_commit(rd_thread))
+ return backup::ERROR;
+ }
+ return backup::OK;
+}
+
+
+result_t PBXTRestoreDriver::send_data(Buffer &buf)
+{
+ size_t size;
+ xtWord1 type;
+ xtWord1 *buffer;
+ xtWord4 row_len;
+ xtWord1 *rec_data;
+
+ XT_TRACE_CALL();
+
+ if (buf.table_num != rd_table_no) {
+ XTThreadPtr self = rd_thread;
+ XTTableHPtr tab;
+ char path[PATH_MAX];
+
+ if (rd_ot) {
+ xt_db_return_table_to_pool_ns(rd_ot);
+ rd_ot = NULL;
+ }
+
+ if (rd_thread->st_xact_data) {
+ if (!xt_xn_commit(rd_thread))
+ goto failed;
+ }
+ if (!xt_xn_begin(rd_thread))
+ goto failed;
+ rb_insert_count = 0;
+
+ rd_table_no = buf.table_num;
+ m_tables[rd_table_no-1].internal_name(path, sizeof(path));
+ try_(a) {
+ xt_ha_open_database_of_table(self, (XTPathStrPtr) path);
+ tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE, NULL);
+ pushr_(xt_heap_release, tab);
+ if (!(rd_ot = xt_db_open_table_using_tab(tab, rd_thread)))
+ xt_throw(self);
+ freer_(); // xt_heap_release(tab)
+
+ rd_my_table = rd_ot->ot_table->tab_dic.dic_my_table;
+ if (rd_my_table->found_next_number_field) {
+ rd_my_table->in_use = current_thd;
+ rd_my_table->next_number_field = rd_my_table->found_next_number_field;
+ rd_my_table->mark_columns_used_by_index_no_reset(rd_my_table->s->next_number_index, rd_my_table->read_set);
+ }
+
+ /* This is safe because only one thread can restore a table at
+ * a time!
+ */
+ rb_row_buf = (xtWord1 *) rd_my_table->record[0];
+ //if (rb_row_buf) {
+ // xt_free(self, rb_row_buf);
+ // rb_row_buf = NULL;
+ //}
+ //rb_row_buf = (xtWord1 *) xt_malloc(self, rd_ot->ot_table->tab_dic.dic_mysql_buf_size);
+
+ rb_col_cnt = rd_ot->ot_table->tab_dic.dic_no_of_cols;
+
+ }
+ catch_(a) {
+ ;
+ }
+ cont_(a);
+
+ if (!rd_ot)
+ goto failed;
+ }
+
+ buffer = (xtWord1 *) buf.data;
+ size = buf.size;
+
+ while (size > 0) {
+ type = *buffer;
+ switch (type) {
+ case BUP_STANDARD_VAR_RECORD:
+ rec_data = buffer + 1;
+ break;
+ case BUP_RECORD_BLOCK_4_START:
+ buffer++;
+ row_len = XT_GET_DISK_4(buffer);
+ buffer += 4;
+ if (rb_data_size < row_len) {
+ if (!xt_realloc_ns((void **) &rb_row_data, row_len))
+ goto failed;
+ rb_data_size = row_len;
+ }
+ row_len = XT_GET_DISK_4(buffer);
+ buffer += 4;
+ ASSERT_NS(row_len <= rb_data_size);
+ if (row_len > rb_data_size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ memcpy(rb_row_data, buffer, row_len);
+ rb_row_len = row_len;
+ buffer += row_len;
+ if (row_len + 9 > size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ size -= row_len + 9;
+ continue;
+ case BUP_RECORD_BLOCK_4:
+ buffer++;
+ row_len = XT_GET_DISK_4(buffer);
+ buffer += 4;
+ ASSERT_NS(rb_row_len + row_len <= rb_data_size);
+ if (rb_row_len + row_len > rb_data_size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ memcpy(rb_row_data + rb_row_len, buffer, row_len);
+ rb_row_len += row_len;
+ buffer += row_len;
+ if (row_len + 5 > size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ size -= row_len + 5;
+ continue;
+ case BUP_RECORD_BLOCK_4_END:
+ buffer++;
+ row_len = XT_GET_DISK_4(buffer);
+ buffer += 4;
+ ASSERT_NS(rb_row_len + row_len <= rb_data_size);
+ if (rb_row_len + row_len > rb_data_size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ memcpy(rb_row_data + rb_row_len, buffer, row_len);
+ buffer += row_len;
+ if (row_len + 5 > size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ size -= row_len + 5;
+ rec_data = rb_row_data;
+ break;
+ default:
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+
+ if (!(row_len = myxt_load_row_data(rd_ot, rec_data, rb_row_buf, rb_col_cnt)))
+ goto failed;
+
+ if (rd_ot->ot_table->tab_dic.dic_my_table->found_next_number_field)
+ ha_set_auto_increment(rd_ot, rd_ot->ot_table->tab_dic.dic_my_table->found_next_number_field);
+
+ if (!xt_tab_new_record(rd_ot, rb_row_buf))
+ goto failed;
+
+ if (type == BUP_STANDARD_VAR_RECORD) {
+ buffer += row_len+1;
+ if (row_len + 1 > size) {
+ xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
+ goto failed;
+ }
+ size -= row_len + 1;
+ }
+
+ rb_insert_count++;
+ if (rb_insert_count == XT_RESTORE_BATCH_SIZE) {
+ if (!xt_xn_commit(rd_thread))
+ goto failed;
+ if (!xt_xn_begin(rd_thread))
+ goto failed;
+ rb_insert_count = 0;
+ }
+ }
+
+ return backup::OK;
+
+ failed:
+ xt_log_and_clear_exception(rd_thread);
+ return backup::ERROR;
+}
+
+
+result_t PBXTRestoreDriver::cancel()
+{
+ XT_TRACE_CALL();
+ /* Nothing to do in cancel(); free() will suffice */
+ return backup::OK;
+}
+
+void PBXTRestoreDriver::free()
+{
+ XT_TRACE_CALL();
+ if (rd_ot) {
+ xt_db_return_table_to_pool_ns(rd_ot);
+ rd_ot = NULL;
+ }
+ //if (rb_row_buf) {
+ // xt_free_ns(rb_row_buf);
+ // rb_row_buf = NULL;
+ //}
+ if (rb_row_data) {
+ xt_free_ns(rb_row_data);
+ rb_row_data = NULL;
+ }
+ if (rd_thread->st_xact_data)
+ xt_xn_rollback(rd_thread);
+ delete this;
+}
+
+/*
+ * -----------------------------------------------------------------------
+ * BACKUP ENGINE FACTORY
+ */
+
+#define PBXT_BACKUP_VERSION 1
+
+
+class PBXTBackupEngine: public Backup_engine
+{
+ public:
+ PBXTBackupEngine() { };
+
+ virtual version_t version() const {
+ return PBXT_BACKUP_VERSION;
+ };
+
+ virtual result_t get_backup(const uint32, const Table_list &, Backup_driver* &);
+
+ virtual result_t get_restore(const version_t, const uint32, const Table_list &,Restore_driver* &);
+
+ virtual void free()
+ {
+ delete this;
+ }
+};
+
+result_t PBXTBackupEngine::get_backup(const u_int count, const Table_list &tables, Backup_driver* &drv)
+{
+ PBXTBackupDriver *ptr = new PBXTBackupDriver(tables);
+
+ if (!ptr)
+ return backup::ERROR;
+ drv = ptr;
+ return backup::OK;
+}
+
+result_t PBXTBackupEngine::get_restore(const version_t ver, const uint32,
+ const Table_list &tables, Restore_driver* &drv)
+{
+ if (ver > PBXT_BACKUP_VERSION)
+ {
+ return backup::ERROR;
+ }
+
+ PBXTRestoreDriver *ptr = new PBXTRestoreDriver(tables);
+
+ if (!ptr)
+ return backup::ERROR;
+ drv = (Restore_driver *) ptr;
+ return backup::OK;
+}
+
+
+Backup_result_t pbxt_backup_engine(handlerton *self, Backup_engine* &be)
+{
+ be = new PBXTBackupEngine();
+
+ if (!be)
+ return backup::ERROR;
+
+ return backup::OK;
+}
+
+#endif
=== added file 'storage/pbxt/src/backup_xt.h'
--- a/storage/pbxt/src/backup_xt.h 1970-01-01 00:00:00 +0000
+++ b/storage/pbxt/src/backup_xt.h 2009-11-24 10:55:06 +0000
@@ -0,0 +1,34 @@
+/* Copyright (c) 2009 PrimeBase Technologies GmbH
+ *
+ * PrimeBase XT
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * 2009-09-07 Paul McCullagh
+ *
+ * H&G2JCtL
+ */
+
+#ifndef __backup_xt_h__
+#define __backup_xt_h__
+
+#include "xt_defs.h"
+
+#ifdef MYSQL_SUPPORTS_BACKUP
+
+Backup_result_t pbxt_backup_engine(handlerton *self, Backup_engine* &be);
+
+#endif
+#endif
=== modified file 'storage/pbxt/src/cache_xt.cc'
--- a/storage/pbxt/src/cache_xt.cc 2009-10-30 18:50:56 +0000
+++ b/storage/pbxt/src/cache_xt.cc 2009-11-24 10:55:06 +0000
@@ -73,7 +73,7 @@
#define IDX_CAC_UNLOCK(i, o) xt_xsmutex_unlock(&(i)->cs_lock, (o)->t_id)
#elif defined(IDX_CAC_USE_PTHREAD_RW)
#define IDX_CAC_LOCK_TYPE xt_rwlock_type
-#define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock(s, &(i)->cs_lock)
+#define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, &(i)->cs_lock)
#define IDX_CAC_FREE_LOCK(s, i) xt_free_rwlock(&(i)->cs_lock)
#define IDX_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(&(i)->cs_lock)
#define IDX_CAC_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(&(i)->cs_lock)
@@ -94,8 +94,12 @@
#define IDX_CAC_UNLOCK(i, s) xt_spinxslock_unlock(&(i)->cs_lock, (s)->t_id)
#endif
+#ifdef XT_NO_ATOMICS
+#define ID_HANDLE_USE_PTHREAD_RW
+#else
#define ID_HANDLE_USE_SPINLOCK
//#define ID_HANDLE_USE_PTHREAD_RW
+#endif
#if defined(ID_HANDLE_USE_PTHREAD_RW)
#define ID_HANDLE_LOCK_TYPE xt_mutex_type
@@ -374,7 +378,7 @@ xtPublic void xt_ind_release_handle(XTIn
{
DcHandleSlotPtr hs;
XTIndBlockPtr block = NULL;
- u_int hash_idx = 0;
+ u_int hash_idx = 0;
DcSegmentPtr seg = NULL;
XTIndBlockPtr xblock;
@@ -1379,7 +1383,7 @@ xtPublic xtBool xt_ind_fetch(XTOpenTable
ASSERT_NS(iref->ir_xlock == 2);
#endif
if (!(block = ind_cac_fetch(ot, ind, address, &seg, TRUE)))
- return 0;
+ return FAILED;
branch_size = XT_GET_DISK_2(((XTIdxBranchDPtr) block->cb_data)->tb_size_2);
if (XT_GET_INDEX_BLOCK_LEN(branch_size) < 2 || XT_GET_INDEX_BLOCK_LEN(branch_size) > XT_INDEX_PAGE_SIZE) {
=== modified file 'storage/pbxt/src/cache_xt.h'
--- a/storage/pbxt/src/cache_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/cache_xt.h 2009-11-24 10:55:06 +0000
@@ -62,7 +62,7 @@ struct XTIdxReadBuffer;
#define XT_IPAGE_UNLOCK(i, x) xt_atomicrwlock_unlock(i, x)
#elif defined(XT_IPAGE_USE_PTHREAD_RW)
#define XT_IPAGE_LOCK_TYPE xt_rwlock_type
-#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_free_rwlock(i)
#define XT_IPAGE_READ_LOCK(i) xt_slock_rwlock_ns(i)
#define XT_IPAGE_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
=== modified file 'storage/pbxt/src/database_xt.cc'
--- a/storage/pbxt/src/database_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/database_xt.cc 2009-11-24 10:55:06 +0000
@@ -54,6 +54,8 @@
* GLOBALS
*/
+xtPublic XTDatabaseHPtr pbxt_database = NULL; // The global open database
+
xtPublic xtLogOffset xt_db_log_file_threshold;
xtPublic size_t xt_db_log_buffer_size;
xtPublic size_t xt_db_transaction_buffer_size;
@@ -505,6 +507,15 @@ xtPublic XTDatabaseHPtr xt_get_database(
* all index entries that are not visible have
* been removed.
*
+ * REASON WHY WE SET ROWID ON RECOVERY:
+ * The row ID is set on recovery because the
+ * change to the index may be lost after a crash.
+ * The change to the index is done by the sweeper, and
+ * there is no record of this change in the log.
+ * The sweeper will not "re-sweep" all transations
+ * that are recovered. As a result, this upadte
+ * of the index by the sweeper may be lost.
+ *
* {OPEN-DB-SWEEPER-WAIT}
* This has been moved to after the release of the open
* database lock because:
@@ -518,9 +529,12 @@ xtPublic XTDatabaseHPtr xt_get_database(
* - To open the database it needs the open database
* lock.
*/
+ /*
+ * This has been moved, see: {WAIT-FOR-SW-AFTER-RECOV}
pushr_(xt_heap_release, db);
xt_wait_for_sweeper(self, db, 0);
popr_();
+ */
return db;
}
=== modified file 'storage/pbxt/src/database_xt.h'
--- a/storage/pbxt/src/database_xt.h 2009-04-02 10:03:14 +0000
+++ b/storage/pbxt/src/database_xt.h 2009-11-24 10:55:06 +0000
@@ -105,6 +105,8 @@ typedef struct XTTablePath {
#define XT_THREAD_IDLE 1
#define XT_THREAD_INERR 2
+#define XT_XA_HASH_TAB_SIZE 223
+
typedef struct XTDatabase : public XTHeap {
char *db_name; /* The name of the database, last component of the path! */
char *db_main_path;
@@ -131,6 +133,9 @@ typedef struct XTDatabase : public XTHea
u_int db_stat_sweep_waits; /* STATISTICS: count the sweeper waits. */
XTDatabaseLogRec db_xlog; /* The transaction log for this database. */
XTXactRestartRec db_restart; /* Database recovery stuff. */
+ xt_mutex_type db_xn_xa_lock;
+ XTXactPreparePtr db_xn_xa_table[XT_XA_HASH_TAB_SIZE];
+ XTSortedListPtr db_xn_xa_list; /* The "wait-for" list, of transactions waiting for other transactions. */
XTSortedListPtr db_xn_wait_for; /* The "wait-for" list, of transactions waiting for other transactions. */
u_int db_xn_call_start; /* Start of the post wait calls. */
@@ -198,6 +203,7 @@ void xt_check_database(XTThreadPtr se
void xt_add_pbxt_file(size_t size, char *path, const char *file);
void xt_add_location_file(size_t size, char *path);
+void xt_add_pbxt_dir(size_t size, char *path);
void xt_add_system_dir(size_t size, char *path);
void xt_add_data_dir(size_t size, char *path);
@@ -244,4 +250,6 @@ inline void xt_xlog_check_long_writer(XT
}
}
+extern XTDatabaseHPtr pbxt_database; // The global open database
+
#endif
=== modified file 'storage/pbxt/src/datadic_xt.cc'
--- a/storage/pbxt/src/datadic_xt.cc 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/datadic_xt.cc 2009-11-24 10:55:06 +0000
@@ -35,7 +35,7 @@
#ifdef DEBUG
#ifdef DRIZZLED
-#include <drizzled/common_includes.h>
+//#include <drizzled/common_includes.h>
#else
#include "mysql_priv.h"
#endif
@@ -437,11 +437,6 @@ class XTTokenizer {
XTToken *nextToken(XTThreadPtr self, c_char *keyword, XTToken *tk);
};
-void ri_free_token(XTThreadPtr XT_UNUSED(self), XTToken *tk)
-{
- delete tk;
-}
-
XTToken *XTTokenizer::newToken(XTThreadPtr self, u_int type, char *start, char *end)
{
if (!tkn_current) {
=== modified file 'storage/pbxt/src/datalog_xt.cc'
--- a/storage/pbxt/src/datalog_xt.cc 2009-09-04 07:29:34 +0000
+++ b/storage/pbxt/src/datalog_xt.cc 2009-11-24 10:55:06 +0000
@@ -410,7 +410,7 @@ static void dl_recover_log(XTThreadPtr s
ASSERT_NS(seq_read.sl_log_eof == seq_read.sl_rec_log_offset);
data_log->dlf_log_eof = seq_read.sl_rec_log_offset;
- if ((size_t) data_log->dlf_log_eof < sizeof(XTXactLogHeaderDRec)) {
+ if (data_log->dlf_log_eof < (off_t) sizeof(XTXactLogHeaderDRec)) {
data_log->dlf_log_eof = sizeof(XTXactLogHeaderDRec);
if (!dl_create_log_header(data_log, seq_read.sl_log_file, self))
xt_throw(self);
@@ -1162,7 +1162,7 @@ xtBool XTDataLogBuffer::dlb_close_log(XT
/* When I use 'thread' instead of 'self', this means
* that I will not throw an error.
*/
-xtBool XTDataLogBuffer::dlb_get_log_offset(xtLogID *log_id, xtLogOffset *out_offset, size_t req_size, struct XTThread *thread)
+xtBool XTDataLogBuffer::dlb_get_log_offset(xtLogID *log_id, xtLogOffset *out_offset, size_t XT_UNUSED(req_size), struct XTThread *thread)
{
/* Note, I am allowing a log to grow beyond the threshold.
* The amount depends on the maximum extended record size.
@@ -1757,7 +1757,7 @@ static xtBool dl_collect_garbage(XTThrea
freer_(); // xt_unlock_mutex(&db->db_co_dlog_lock)
/* Flush the transaction log. */
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(db, self))
xt_throw(self);
xt_lock_mutex_ns(&db->db_datalogs.dlc_head_lock);
@@ -1891,7 +1891,7 @@ static xtBool dl_collect_garbage(XTThrea
freer_(); // xt_unlock_mutex(&db->db_co_dlog_lock)
/* Flush the transaction log. */
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(db, self))
xt_throw(self);
/* Save state in source log header. */
=== modified file 'storage/pbxt/src/discover_xt.cc'
--- a/storage/pbxt/src/discover_xt.cc 2009-11-16 20:49:51 +0000
+++ b/storage/pbxt/src/discover_xt.cc 2009-12-02 11:50:40 +0000
@@ -31,6 +31,9 @@
#include <drizzled/session.h>
#include <drizzled/server_includes.h>
#include <drizzled/sql_base.h>
+#include <drizzled/statement/alter_table.h>
+#include <algorithm>
+#include <sstream>
#endif
#include "strutil_xt.h"
@@ -39,18 +42,273 @@
#include "ha_xtsys.h"
#ifndef DRIZZLED
-#if MYSQL_VERSION_ID > 60005
+#if MYSQL_VERSION_ID >= 50404
#define DOT_STR(x) x.str
#else
#define DOT_STR(x) x
#endif
#endif
-#ifndef DRIZZLED
+//#ifndef DRIZZLED
#define LOCK_OPEN_HACK_REQUIRED
-#endif // DRIZZLED
+//#endif // DRIZZLED
#ifdef LOCK_OPEN_HACK_REQUIRED
+#ifdef DRIZZLED
+
+using namespace drizzled;
+using namespace std;
+
+#define mysql_create_table_no_lock hacked_mysql_create_table_no_lock
+
+namespace drizzled {
+
+int rea_create_table(Session *session, const char *path,
+ const char *db, const char *table_name,
+ message::Table *table_proto,
+ HA_CREATE_INFO *create_info,
+ List<CreateField> &create_field,
+ uint32_t key_count,KEY *key_info);
+}
+
+static uint32_t build_tmptable_filename(Session* session,
+ char *buff, size_t bufflen)
+{
+ uint32_t length;
+ ostringstream path_str, post_tmpdir_str;
+ string tmp;
+
+ path_str << drizzle_tmpdir;
+ post_tmpdir_str << "/" << TMP_FILE_PREFIX << current_pid;
+ post_tmpdir_str << session->thread_id << session->tmp_table++;
+ tmp= post_tmpdir_str.str();
+
+ transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
+
+ path_str << tmp;
+
+ if (bufflen < path_str.str().length())
+ length= 0;
+ else
+ length= unpack_filename(buff, path_str.str().c_str());
+
+ return length;
+}
+
+static bool mysql_create_table_no_lock(Session *session,
+ const char *db, const char *table_name,
+ HA_CREATE_INFO *create_info,
+ message::Table *table_proto,
+ AlterInfo *alter_info,
+ bool internal_tmp_table,
+ uint32_t select_field_count)
+{
+ char path[FN_REFLEN];
+ uint32_t path_length;
+ uint db_options, key_count;
+ KEY *key_info_buffer;
+ Cursor *file;
+ bool error= true;
+ /* Check for duplicate fields and check type of table to create */
+ if (!alter_info->create_list.elements)
+ {
+ my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
+ MYF(0));
+ return true;
+ }
+ assert(strcmp(table_name,table_proto->name().c_str())==0);
+ if (check_engine(session, table_name, create_info))
+ return true;
+ db_options= create_info->table_options;
+ if (create_info->row_type == ROW_TYPE_DYNAMIC)
+ db_options|=HA_OPTION_PACK_RECORD;
+
+ /*if (!(file= create_info->db_type->getCursor((TableShare*) 0, session->mem_root)))
+ {
+ my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Cursor));
+ return true;
+ }*/
+
+ /* PMC - Done to avoid getting the partition handler by mistake! */
+ if (!(file= new (session->mem_root) ha_xtsys(pbxt_hton, NULL)))
+ {
+ my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Cursor));
+ return true;
+ }
+
+ set_table_default_charset(create_info, (char*) db);
+
+ if (mysql_prepare_create_table(session,
+ create_info,
+ table_proto,
+ alter_info,
+ internal_tmp_table,
+ &db_options, file,
+ &key_info_buffer, &key_count,
+ select_field_count))
+ goto err;
+
+ /* Check if table exists */
+ if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ {
+ path_length= build_tmptable_filename(session, path, sizeof(path));
+ }
+ else
+ {
+ #ifdef FN_DEVCHAR
+ /* check if the table name contains FN_DEVCHAR when defined */
+ if (strchr(table_name, FN_DEVCHAR))
+ {
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name);
+ return true;
+ }
+#endif
+ path_length= build_table_filename(path, sizeof(path), db, table_name, internal_tmp_table);
+ }
+
+ /* Check if table already exists */
+ if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
+ session->find_temporary_table(db, table_name))
+ {
+ if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
+ {
+ create_info->table_existed= 1; // Mark that table existed
+ push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ table_name);
+ error= 0;
+ goto err;
+ }
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
+ goto err;
+ }
+
+ //pthread_mutex_lock(&LOCK_open); /* CREATE TABLE (some confussion on naming, double check) */
+ if (!internal_tmp_table && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ if (plugin::StorageEngine::getTableDefinition(*session,
+ path,
+ db,
+ table_name,
+ internal_tmp_table) == EEXIST)
+ {
+ if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
+ {
+ error= false;
+ push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ table_name);
+ create_info->table_existed= 1; // Mark that table existed
+ }
+ else
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
+
+ goto unlock_and_end;
+ }
+ /*
+ * We don't assert here, but check the result, because the table could be
+ * in the table definition cache and in the same time the .frm could be
+ * missing from the disk, in case of manual intervention which deletes
+ * the .frm file. The user has to use FLUSH TABLES; to clear the cache.
+ * Then she could create the table. This case is pretty obscure and
+ * therefore we don't introduce a new error message only for it.
+ * */
+ if (TableShare::getShare(db, table_name))
+ {
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
+ goto unlock_and_end;
+ }
+ }
+ /*
+ * Check that table with given name does not already
+ * exist in any storage engine. In such a case it should
+ * be discovered and the error ER_TABLE_EXISTS_ERROR be returned
+ * unless user specified CREATE TABLE IF EXISTS
+ * The LOCK_open mutex has been locked to make sure no
+ * one else is attempting to discover the table. Since
+ * it's not on disk as a frm file, no one could be using it!
+ * */
+ if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ bool create_if_not_exists =
+ create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS;
+
+ char table_path[FN_REFLEN];
+ uint32_t table_path_length;
+
+ table_path_length= build_table_filename(table_path, sizeof(table_path),
+ db, table_name, false);
+
+ int retcode= plugin::StorageEngine::getTableDefinition(*session,
+ table_path,
+ db,
+ table_name,
+ false);
+ switch (retcode)
+ {
+ case ENOENT:
+ /* Normal case, no table exists. we can go and create it */
+ break;
+ case EEXIST:
+ if (create_if_not_exists)
+ {
+ error= false;
+ push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ table_name);
+ create_info->table_existed= 1; // Mark that table existed
+ goto unlock_and_end;
+ }
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
+ goto unlock_and_end;
+ default:
+ my_error(retcode, MYF(0),table_name);
+ goto unlock_and_end;
+ }
+ }
+
+ session->set_proc_info("creating table");
+ create_info->table_existed= 0; // Mark that table is created
+
+ create_info->table_options=db_options;
+
+ if (rea_create_table(session, path, db, table_name,
+ table_proto,
+ create_info, alter_info->create_list,
+ key_count, key_info_buffer))
+ goto unlock_and_end;
+
+ if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ {
+ /* Open table and put in temporary table list */
+ if (!(session->open_temporary_table(path, db, table_name, 1, OTM_OPEN)))
+ {
+ (void) session->rm_temporary_table(create_info->db_type, path);
+ goto unlock_and_end;
+ }
+ }
+
+ /*
+ * Don't write statement if:
+ * - It is an internal temporary table,
+ * - Row-based logging is used and it we are creating a temporary table, or
+ * - The binary log is not open.
+ * Otherwise, the statement shall be binlogged.
+ * */
+ if (!internal_tmp_table &&
+ ((!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
+ write_bin_log(session, session->query, session->query_length);
+ error= false;
+unlock_and_end:
+ //pthread_mutex_unlock(&LOCK_open);
+
+err:
+ session->set_proc_info("After create");
+ delete file;
+ return(error);
+}
+
+#else // MySQL case
///////////////////////////////
/*
* Unfortunately I cannot use the standard mysql_create_table_no_lock() because it will lock "LOCK_open"
@@ -1229,13 +1487,13 @@ static bool mysql_create_table_no_lock(T
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
/* Open table and put in temporary table list */
-#if MYSQL_VERSION_ID > 60005
+#if MYSQL_VERSION_ID >= 50404
if (!(open_temporary_table(thd, path, db, table_name, 1, OTM_OPEN)))
#else
if (!(open_temporary_table(thd, path, db, table_name, 1)))
#endif
{
-#if MYSQL_VERSION_ID > 60005
+#if MYSQL_VERSION_ID >= 50404
(void) rm_temporary_table(create_info->db_type, path, false);
#else
(void) rm_temporary_table(create_info->db_type, path);
@@ -1252,11 +1510,21 @@ static bool mysql_create_table_no_lock(T
- The binary log is not open.
Otherwise, the statement shall be binlogged.
*/
+ /* PBXT 1.0.09e
+ * Firstly we had a compile problem with MySQL 5.1.42 and
+ * the write_bin_log() call below:
+ * discover_xt.cc:1259: error: argument of type 'char* (Statement::)()' does not match 'const char*'
+ *
+ * And secondly, we should no write the BINLOG anyway because this is
+ * an internal PBXT system table.
+ *
+ * So I am just commenting out the code altogether.
if (!internal_tmp_table &&
(!thd->current_stmt_binlog_row_based ||
(thd->current_stmt_binlog_row_based &&
!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
- write_bin_log(thd, TRUE, thd->query(), thd->query_length());
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ */
error= FALSE;
unlock_and_end:
pthread_mutex_unlock(&LOCK_open);
@@ -1279,37 +1547,51 @@ warn:
////// END OF CUT AND PASTES FROM sql_table.cc ////////
////////////////////////////////////////////////////////
+#endif // DRIZZLED
#endif // LOCK_OPEN_HACK_REQUIRED
//------------------------------
int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *XT_UNUSED(keys), xtBool skip_existing)
{
#ifdef DRIZZLED
- drizzled::message::Table table_proto;
+#define MYLEX_CREATE_INFO create_info
+#else
+#define MYLEX_CREATE_INFO mylex.create_info
+#endif
+
+#ifdef DRIZZLED
+ drizzled::statement::AlterTable *stmt = new drizzled::statement::AlterTable(thd);
+ HA_CREATE_INFO create_info;
+ //AlterInfo alter_info;
+ drizzled::message::Table table_proto;
static const char *ext = ".dfe";
static const int ext_len = 4;
+
+ table_proto.mutable_engine()->mutable_name()->assign("PBXT");
#else
static const char *ext = ".frm";
static const int ext_len = 4;
#endif
int err = 1;
- //HA_CREATE_INFO create_info = {0};
- //Alter_info alter_info;
char field_length_buffer[12], *field_length_ptr;
LEX *save_lex= thd->lex, mylex;
-
- memset(&mylex.create_info, 0, sizeof(HA_CREATE_INFO));
+
+ memset(&MYLEX_CREATE_INFO, 0, sizeof(HA_CREATE_INFO));
thd->lex = &mylex;
- lex_start(thd);
+ lex_start(thd);
+#ifdef DRIZZLED
+ mylex.statement = stmt;
+#endif
/* setup the create info */
- mylex.create_info.db_type = hton;
+ MYLEX_CREATE_INFO.db_type = hton;
+
#ifndef DRIZZLED
mylex.create_info.frm_only = 1;
#endif
- mylex.create_info.default_table_charset = system_charset_info;
+ MYLEX_CREATE_INFO.default_table_charset = system_charset_info;
/* setup the column info. */
while (info->field_name) {
@@ -1335,7 +1617,7 @@ int xt_create_table_frm(handlerton *hton
#else
if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,
info->field_flags,
-#if MYSQL_VERSION_ID > 60005
+#if MYSQL_VERSION_ID >= 50404
HA_SM_DISK,
COLUMN_FORMAT_TYPE_FIXED,
#endif
@@ -1369,7 +1651,7 @@ int xt_create_table_frm(handlerton *hton
table_proto.set_name(name);
table_proto.set_type(drizzled::message::Table::STANDARD);
- if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &table_proto, &mylex.alter_info, 1, 0, false))
+ if (mysql_create_table_no_lock(thd, db, name, &create_info, &table_proto, &stmt->alter_info, 1, 0))
goto error;
#else
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0))
=== modified file 'storage/pbxt/src/filesys_xt.cc'
--- a/storage/pbxt/src/filesys_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/filesys_xt.cc 2009-11-24 10:55:06 +0000
@@ -56,6 +56,8 @@
//#define DEBUG_TRACE_FILES
//#define INJECT_WRITE_REMAP_ERROR
/* This is required to make testing on the Mac faster: */
+/* It turns of full file sync. */
+#define DEBUG_FAST_MAC
#endif
#ifdef DEBUG_TRACE_FILES
@@ -63,10 +65,6 @@
#define PRINTF xt_trace
#endif
-#if defined(XT_MAC) && defined(F_FULLFSYNC)
-#undef F_FULLFSYNC
-#endif
-
#ifdef INJECT_WRITE_REMAP_ERROR
#define INJECT_REMAP_FILE_SIZE 1000000
#define INJECT_REMAP_FILE_TYPE "xtd"
@@ -883,7 +881,7 @@ xtPublic xtBool xt_flush_file(XTOpenFile
* fsync didn't really flush index pages to disk. fcntl(F_FULLFSYNC) is considered more effective
* in such case.
*/
-#ifdef F_FULLFSYNC
+#if defined(F_FULLFSYNC) && !defined(DEBUG_FAST_MAC)
if (fcntl(of->of_filedes, F_FULLFSYNC, 0) == -1) {
xt_register_ferrno(XT_REG_CONTEXT, errno, xt_file_path(of));
goto failed;
=== modified file 'storage/pbxt/src/filesys_xt.h'
--- a/storage/pbxt/src/filesys_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/filesys_xt.h 2009-11-24 10:55:06 +0000
@@ -102,7 +102,7 @@ xtBool xt_fs_rename(struct XTThread *s
#define FILE_MAP_UNLOCK(i, o) xt_xsmutex_unlock(i, o)
#elif defined(FILE_MAP_USE_PTHREAD_RW)
#define FILE_MAP_LOCK_TYPE xt_rwlock_type
-#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_free_rwlock(i)
#define FILE_MAP_READ_LOCK(i, o) xt_slock_rwlock_ns(i)
#define FILE_MAP_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(i)
=== modified file 'storage/pbxt/src/ha_pbxt.cc'
--- a/storage/pbxt/src/ha_pbxt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/ha_pbxt.cc 2009-11-27 15:37:02 +0000
@@ -35,6 +35,7 @@
#include <stdlib.h>
#include <time.h>
+#include <ctype.h>
#ifdef DRIZZLED
#include <drizzled/common.h>
@@ -42,14 +43,21 @@
#include <mysys/my_alloc.h>
#include <mysys/hash.h>
#include <drizzled/field.h>
-#include <drizzled/current_session.h>
+#include <drizzled/session.h>
#include <drizzled/data_home.h>
#include <drizzled/error.h>
#include <drizzled/table.h>
#include <drizzled/field/timestamp.h>
#include <drizzled/server_includes.h>
+#include <drizzled/plugin/info_schema_table.h>
extern "C" char **session_query(Session *session);
#define my_strdup(a,b) strdup(a)
+
+using drizzled::plugin::Registry;
+using drizzled::plugin::ColumnInfo;
+using drizzled::plugin::InfoSchemaTable;
+using drizzled::plugin::InfoSchemaMethods;
+
#else
#include "mysql_priv.h"
#include <mysql/plugin.h>
@@ -71,7 +79,7 @@ extern "C" char **session_query(Session
#include "tabcache_xt.h"
#include "systab_xt.h"
#include "xaction_xt.h"
-#include "restart_xt.h"
+#include "backup_xt.h"
#ifdef DEBUG
//#define XT_USE_SYS_PAR_DEBUG_SIZES
@@ -101,6 +109,10 @@ static void pbxt_drop_database(handlert
static int pbxt_close_connection(handlerton *hton, THD* thd);
static int pbxt_commit(handlerton *hton, THD *thd, bool all);
static int pbxt_rollback(handlerton *hton, THD *thd, bool all);
+static int pbxt_prepare(handlerton *hton, THD *thd, bool all);
+static int pbxt_recover(handlerton *hton, XID *xid_list, uint len);
+static int pbxt_commit_by_xid(handlerton *hton, XID *xid);
+static int pbxt_rollback_by_xid(handlerton *hton, XID *xid);
#endif
static void ha_aquire_exclusive_use(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);
static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share);
@@ -123,7 +135,9 @@ static void ha_close_open_tables(XTThre
#ifdef PBXT_HANDLER_TRACE
#define PBXT_ALLOW_PRINTING
-#define XT_TRACE_CALL() do { XTThreadPtr s = xt_get_self(); printf("%s %s\n", s ? s->t_name : "-unknown-", __FUNC__); } while (0)
+#define XT_TRACE_CALL() ha_trace_function(__FUNC__, NULL)
+#define XT_TRACE_METHOD() ha_trace_function(__FUNC__, pb_share->sh_table_path->ps_path)
+
#ifdef PBXT_TRACE_RETURN
#define XT_RETURN(x) do { printf("%d\n", (int) (x)); return (x); } while (0)
#define XT_RETURN_VOID do { printf("out\n"); return; } while (0)
@@ -135,6 +149,7 @@ static void ha_close_open_tables(XTThre
#else
#define XT_TRACE_CALL()
+#define XT_TRACE_METHOD()
#define XT_RETURN(x) return (x)
#define XT_RETURN_VOID return
@@ -165,10 +180,10 @@ xtBool pbxt_crash_debug = TRUE;
xtBool pbxt_crash_debug = FALSE;
#endif
+
/* Variables for pbxt share methods */
static xt_mutex_type pbxt_database_mutex; // Prevent a database from being opened while it is being dropped
static XTHashTabPtr pbxt_share_tables; // Hash used to track open tables
-XTDatabaseHPtr pbxt_database = NULL; // The global open database
static char *pbxt_index_cache_size;
static char *pbxt_record_cache_size;
static char *pbxt_log_cache_size;
@@ -180,6 +195,12 @@ static char *pbxt_data_log_threshold;
static char *pbxt_data_file_grow_size;
static char *pbxt_row_file_grow_size;
static int pbxt_max_threads;
+static my_bool pbxt_support_xa;
+
+#ifndef DRIZZLED
+// drizzle complains it's not used
+static XTXactEnumXARec pbxt_xa_enum;
+#endif
#ifdef DEBUG
#define XT_SHARE_LOCK_WAIT 5000
@@ -259,6 +280,33 @@ static HAVarParamsRec vp_row_file_grow_s
//#define XT_AUTO_INCREMENT_DEF 1
#endif
+#ifdef PBXT_HANDLER_TRACE
+static void ha_trace_function(const char *function, char *table)
+{
+ char func_buf[50], *ptr;
+ XTThreadPtr thread = xt_get_self();
+
+ if ((ptr = strchr(function, '('))) {
+ ptr--;
+ while (ptr > function) {
+ if (!(isalnum(*ptr) || *ptr == '_'))
+ break;
+ ptr--;
+ }
+ ptr++;
+ xt_strcpy(50, func_buf, ptr);
+ if ((ptr = strchr(func_buf, '(')))
+ *ptr = 0;
+ }
+ else
+ xt_strcpy(50, func_buf, function);
+ if (table)
+ printf("%s %s (%s)\n", thread ? thread->t_name : "-unknown-", func_buf, table);
+ else
+ printf("%s %s\n", thread ? thread->t_name : "-unknown-", func_buf);
+}
+#endif
+
/*
* -----------------------------------------------------------------------
* SHARED TABLE DATA
@@ -584,6 +632,9 @@ xtPublic XTThreadPtr xt_ha_thd_to_self(T
/* The first bit is 1. */
static u_int ha_get_max_bit(MX_BITMAP *map)
{
+#ifdef DRIZZLED
+ return map->getFirstSet();
+#else
my_bitmap_map *data_ptr = map->bitmap;
my_bitmap_map *end_ptr = map->last_word_ptr;
my_bitmap_map b;
@@ -612,6 +663,7 @@ static u_int ha_get_max_bit(MX_BITMAP *m
cnt -= 32;
}
return 0;
+#endif
}
/*
@@ -684,9 +736,10 @@ xtPublic int xt_ha_pbxt_to_mysql_error(i
return(-1); // Unknown error
}
-xtPublic int xt_ha_pbxt_thread_error_for_mysql(THD *XT_UNUSED(thd), const XTThreadPtr self, int ignore_dup_key)
+xtPublic int xt_ha_pbxt_thread_error_for_mysql(THD *thd, const XTThreadPtr self, int ignore_dup_key)
{
- int xt_err = self->t_exception.e_xt_err;
+ int xt_err = self->t_exception.e_xt_err;
+ xtBool dup_key = FALSE;
XT_PRINT2(self, "xt_ha_pbxt_thread_error_for_mysql xt_err=%d auto commit=%d\n", (int) xt_err, (int) self->st_auto_commit);
switch (xt_err) {
@@ -725,6 +778,7 @@ xtPublic int xt_ha_pbxt_thread_error_for
/* If we are in auto-commit mode (and we are not ignoring
* duplicate keys) then rollback the transaction automatically.
*/
+ dup_key = TRUE;
if (!ignore_dup_key && self->st_auto_commit)
goto abort_transaction;
break;
@@ -790,26 +844,20 @@ xtPublic int xt_ha_pbxt_thread_error_for
/* Locks are held on tables.
* Only rollback after locks are released.
*/
- self->st_auto_commit = TRUE;
+ /* I do not think this is required, because
+ * I tell mysql to rollback below,
+ * besides it is a hack!
+ self->st_auto_commit = TRUE;
+ */
self->st_abort_trans = TRUE;
}
-#ifdef xxxx
-/* DBUG_ASSERT(thd->transaction.stmt.ha_list == NULL ||
- trans == &thd->transaction.stmt); in handler.cc now
- * fails, and I don't know if this function can be called anymore! */
- /* Cause any other DBs to do a rollback as well... */
- if (thd) {
- /*
- * GOTCHA:
- * This is a BUG in MySQL. I cannot rollback a transaction if
- * pb_mysql_thd->in_sub_stmt! But I must....?!
- */
-#ifdef MYSQL_SERVER
- if (!thd->in_sub_stmt)
- ha_rollback(thd);
-#endif
+ /* Only tell MySQL to rollback if we automatically rollback.
+ * Note: calling this with (thd, FALSE), cause sp.test to fail.
+ */
+ if (!dup_key) {
+ if (thd)
+ thd_mark_transaction_to_rollback(thd, TRUE);
}
-#endif
}
break;
}
@@ -908,7 +956,11 @@ static void pbxt_call_init(XTThreadPtr s
xt_db_data_file_grow_size = (size_t) data_file_grow_size;
xt_db_row_file_grow_size = (size_t) row_file_grow_size;
+#ifdef DRIZZLED
+ pbxt_ignore_case = TRUE;
+#else
pbxt_ignore_case = lower_case_table_names != 0;
+#endif
if (pbxt_ignore_case)
pbxt_share_tables = xt_new_hashtable(self, ha_hash_comp_ci, ha_hash_ci, ha_hash_free, TRUE, FALSE);
else
@@ -968,7 +1020,7 @@ static void pbxt_call_exit(XTThreadPtr s
*/
static void ha_exit(XTThreadPtr self)
{
- xt_xres_wait_for_recovery(self);
+ xt_xres_terminate_recovery(self);
/* Wrap things up... */
xt_unuse_database(self, self); /* Just in case the main thread has a database in use (for testing)? */
@@ -1024,7 +1076,7 @@ static bool pbxt_show_status(handlerton
cont_(a);
if (!not_ok) {
- if (stat_print(thd, "PBXT", 4, "", 0, strbuf.sb_cstring, strbuf.sb_len))
+ if (stat_print(thd, "PBXT", 4, "", 0, strbuf.sb_cstring, (uint) strbuf.sb_len))
not_ok = TRUE;
}
xt_sb_set_size(self, &strbuf, 0);
@@ -1038,14 +1090,14 @@ static bool pbxt_show_status(handlerton
* return 1 on error, else 0.
*/
#ifdef DRIZZLED
-static int pbxt_init(PluginRegistry ®istry)
+static int pbxt_init(Registry ®istry)
#else
static int pbxt_init(void *p)
#endif
{
int init_err = 0;
- XT_TRACE_CALL();
+ XT_PRINT0(NULL, "pbxt_init\n");
if (sizeof(xtWordPS) != sizeof(void *)) {
printf("PBXT: This won't work, I require that sizeof(xtWordPS) == sizeof(void *)!\n");
@@ -1076,11 +1128,27 @@ static int pbxt_init(void *p)
pbxt_hton->close_connection = pbxt_close_connection; /* close_connection, cleanup thread related data. */
pbxt_hton->commit = pbxt_commit; /* commit */
pbxt_hton->rollback = pbxt_rollback; /* rollback */
+ if (pbxt_support_xa) {
+ pbxt_hton->prepare = pbxt_prepare;
+ pbxt_hton->recover = pbxt_recover;
+ pbxt_hton->commit_by_xid = pbxt_commit_by_xid;
+ pbxt_hton->rollback_by_xid = pbxt_rollback_by_xid;
+ }
+ else {
+ pbxt_hton->prepare = NULL;
+ pbxt_hton->recover = NULL;
+ pbxt_hton->commit_by_xid = NULL;
+ pbxt_hton->rollback_by_xid = NULL;
+ }
pbxt_hton->create = pbxt_create_handler; /* Create a new handler */
pbxt_hton->drop_database = pbxt_drop_database; /* Drop a database */
pbxt_hton->panic = pbxt_panic; /* Panic call */
pbxt_hton->show_status = pbxt_show_status;
pbxt_hton->flags = HTON_NO_FLAGS; /* HTON_CAN_RECREATE - Without this flags TRUNCATE uses delete_all_rows() */
+ pbxt_hton->slot = (uint)-1; /* assign invald value, so we know when it's inited later */
+#if defined(MYSQL_SUPPORTS_BACKUP) && defined(XT_ENABLE_ONLINE_BACKUP)
+ pbxt_hton->get_backup_engine = pbxt_backup_engine;
+#endif
#endif
if (!xt_init_logging()) /* Initialize logging */
goto error_1;
@@ -1160,8 +1228,10 @@ static int pbxt_init(void *p)
* Only real problem, 2 threads try to load the same
* plugin at the same time.
*/
+#if MYSQL_VERSION_ID < 60014
myxt_mutex_unlock(&LOCK_plugin);
#endif
+#endif
/* Can't do this here yet, because I need a THD! */
try_(b) {
@@ -1195,8 +1265,10 @@ static int pbxt_init(void *p)
if (thd)
myxt_destroy_thread(thd, FALSE);
#ifndef DRIZZLED
+#if MYSQL_VERSION_ID < 60014
myxt_mutex_lock(&LOCK_plugin);
#endif
+#endif
}
#endif
}
@@ -1262,7 +1334,7 @@ static int pbxt_init(void *p)
}
#ifdef DRIZZLED
-static int pbxt_end(PluginRegistry ®istry)
+static int pbxt_end(Registry ®istry)
#else
static int pbxt_end(void *)
#endif
@@ -1378,7 +1450,7 @@ static int pbxt_commit(handlerton *hton,
* transaction (!all && !self->st_auto_commit).
*/
if (all || self->st_auto_commit) {
- XT_PRINT0(self, "xt_xn_commit\n");
+ XT_PRINT0(self, "xt_xn_commit in pbxt_commit\n");
if (!xt_xn_commit(self))
err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
@@ -1402,7 +1474,7 @@ static int pbxt_rollback(handlerton *hto
XTThreadPtr self;
if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) {
- XT_PRINT1(self, "pbxt_rollback all=%d\n", all);
+ XT_PRINT1(self, "pbxt_rollback all=%d in pbxt_commit\n", all);
if (self->st_xact_data) {
/* There are no table locks, rollback immediately in all cases
@@ -1431,7 +1503,7 @@ static int pbxt_rollback(handlerton *hto
}
#ifdef DRIZZLED
-handler *PBXTStorageEngine::create(TABLE_SHARE *table, MEM_ROOT *mem_root)
+Cursor *PBXTStorageEngine::create(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
PBXTStorageEngine * const hton = this;
#else
@@ -1446,6 +1518,182 @@ static handler *pbxt_create_handler(hand
/*
* -----------------------------------------------------------------------
+ * 2-PHASE COMMIT
+ *
+ */
+
+#ifndef DRIZZLED
+
+static int pbxt_prepare(handlerton *hton, THD *thd, bool all)
+{
+ int err = 0;
+ XTThreadPtr self;
+
+ XT_TRACE_CALL();
+ if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) {
+ XT_PRINT1(self, "pbxt_commit all=%d\n", all);
+
+ if (self->st_xact_data) {
+ /* There are no table locks, commit immediately in all cases
+ * except when this is a statement commit with an explicit
+ * transaction (!all && !self->st_auto_commit).
+ */
+ if (all) {
+ XID xid;
+
+ XT_PRINT0(self, "xt_xn_prepare in pbxt_prepare\n");
+ thd_get_xid(thd, (MYSQL_XID*) &xid);
+
+ if (!xt_xn_prepare(xid.length(), (xtWord1 *) &xid, self))
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
+ }
+ }
+ }
+ return err;
+}
+
+static XTThreadPtr ha_temp_open_global_database(handlerton *hton, THD **ret_thd, int *temp_thread, char *thread_name, int *err)
+{
+ THD *thd;
+ XTThreadPtr self = NULL;
+
+ *temp_thread = 0;
+ if ((thd = current_thd))
+ self = (XTThreadPtr) *thd_ha_data(thd, hton);
+ else {
+ //thd = (THD *) myxt_create_thread();
+ //*temp_thread |= 2;
+ }
+
+ if (!self) {
+ XTExceptionRec e;
+
+ if (!(self = xt_create_thread(thread_name, FALSE, TRUE, &e))) {
+ *err = xt_ha_pbxt_to_mysql_error(e.e_xt_err);
+ xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
+ return NULL;
+ }
+ *temp_thread |= 1;
+ }
+
+ xt_xres_wait_for_recovery(self, XT_RECOVER_DONE);
+
+ try_(a) {
+ xt_open_database(self, mysql_real_data_home, TRUE);
+ }
+ catch_(a) {
+ *err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
+ if ((*temp_thread & 1))
+ xt_free_thread(self);
+ if (*temp_thread & 2)
+ myxt_destroy_thread(thd, FALSE);
+ self = NULL;
+ }
+ cont_(a);
+
+ *ret_thd = thd;
+ return self;
+}
+
+static void ha_temp_close_database(XTThreadPtr self, THD *thd, int temp_thread)
+{
+ xt_unuse_database(self, self);
+ if (temp_thread & 1)
+ xt_free_thread(self);
+ if (temp_thread & 2)
+ myxt_destroy_thread(thd, TRUE);
+}
+
+/* Return all prepared transactions, found during recovery.
+ * This function returns a count. If len is returned, the
+ * function will be called again.
+ */
+static int pbxt_recover(handlerton *hton, XID *xid_list, uint len)
+{
+ xtBool temp_thread;
+ XTThreadPtr self;
+ XTDatabaseHPtr db;
+ uint count = 0;
+ XTXactPreparePtr xap;
+ int err;
+ THD *thd;
+
+ if (!(self = ha_temp_open_global_database(hton, &thd, &temp_thread, "TempForRecover", &err)))
+ return 0;
+
+ db = self->st_database;
+
+ for (count=0; count<len; count++) {
+ xap = xt_xn_enum_xa_data(db, &pbxt_xa_enum);
+ if (!xap)
+ break;
+ memcpy(&xid_list[count], xap->xp_xa_data, xap->xp_data_len);
+ }
+
+ ha_temp_close_database(self, thd, temp_thread);
+ return (int) count;
+}
+
+static int pbxt_commit_by_xid(handlerton *hton, XID *xid)
+{
+ xtBool temp_thread;
+ XTThreadPtr self;
+ XTDatabaseHPtr db;
+ int err = 0;
+ XTXactPreparePtr xap;
+ THD *thd;
+
+ XT_TRACE_CALL();
+
+ if (!(self = ha_temp_open_global_database(hton, &thd, &temp_thread, "TempForCommitXA", &err)))
+ return err;
+ db = self->st_database;
+
+ if ((xap = xt_xn_find_xa_data(db, xid->length(), (xtWord1 *) xid, TRUE, self))) {
+ if ((self->st_xact_data = xt_xn_get_xact(db, xap->xp_xact_id, self))) {
+ self->st_xact_data->xd_flags &= ~XT_XN_XAC_PREPARED; // Prepared transactions cannot be swept!
+ if (!xt_xn_commit(self))
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
+ }
+ xt_xn_delete_xa_data(db, xap, TRUE, self);
+ }
+
+ ha_temp_close_database(self, thd, temp_thread);
+ return 0;
+}
+
+static int pbxt_rollback_by_xid(handlerton *hton, XID *xid)
+{
+ int temp_thread;
+ XTThreadPtr self;
+ XTDatabaseHPtr db;
+ int err = 0;
+ XTXactPreparePtr xap;
+ THD *thd;
+
+ XT_TRACE_CALL();
+
+ if (!(self = ha_temp_open_global_database(hton, &thd, &temp_thread, "TempForRollbackXA", &err)))
+ return err;
+ db = self->st_database;
+
+ if ((xap = xt_xn_find_xa_data(db, xid->length(), (xtWord1 *) xid, TRUE, self))) {
+ if ((self->st_xact_data = xt_xn_get_xact(db, xap->xp_xact_id, self))) {
+ self->st_xact_data->xd_flags &= ~XT_XN_XAC_PREPARED; // Prepared transactions cannot be swept!
+ if (!xt_xn_rollback(self))
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
+ }
+ xt_xn_delete_xa_data(db, xap, TRUE, self);
+ }
+
+ ha_temp_close_database(self, thd, temp_thread);
+ return 0;
+}
+
+#endif
+
+/*
+ * -----------------------------------------------------------------------
* HANDLER LOCKING FUNCTIONS
*
* These functions are used get a lock on all handles of a particular table.
@@ -1497,7 +1745,7 @@ static void ha_aquire_exclusive_use(XTTh
ha_pbxt *handler;
time_t end_time = time(NULL) + XT_SHARE_LOCK_TIMEOUT / 1000;
- XT_PRINT1(self, "ha_aquire_exclusive_use %s PBXT X lock\n", share->sh_table_path->ps_path);
+ XT_PRINT1(self, "ha_aquire_exclusive_use (%s) PBXT X lock\n", share->sh_table_path->ps_path);
/* GOTCHA: It is possible to hang here, if you hold
* onto the sh_ex_mutex lock, before we really
* have the exclusive lock (i.e. before all
@@ -1578,7 +1826,7 @@ static void ha_release_exclusive_use(XTT
static void ha_release_exclusive_use(XTThreadPtr XT_UNUSED(self), XTSharePtr share)
#endif
{
- XT_PRINT1(self, "ha_release_exclusive_use %s PBXT X UNLOCK\n", share->sh_table_path->ps_path);
+ XT_PRINT1(self, "ha_release_exclusive_use (%s) PBXT X UNLOCK\n", share->sh_table_path->ps_path);
xt_lock_mutex_ns((xt_mutex_type *) share->sh_ex_mutex);
share->sh_table_lock = FALSE;
xt_broadcast_cond_ns((xt_cond_type *) share->sh_ex_cond);
@@ -1589,7 +1837,7 @@ static xtBool ha_wait_for_shared_use(ha_
{
time_t end_time = time(NULL) + XT_SHARE_LOCK_TIMEOUT / 1000;
- XT_PRINT1(xt_get_self(), "ha_wait_for_shared_use %s share lock wait...\n", share->sh_table_path->ps_path);
+ XT_PRINT1(xt_get_self(), "ha_wait_for_shared_use (%s) share lock wait...\n", share->sh_table_path->ps_path);
mine->pb_ex_in_use = 0;
xt_lock_mutex_ns((xt_mutex_type *) share->sh_ex_mutex);
while (share->sh_table_lock) {
@@ -1667,14 +1915,38 @@ xtPublic int ha_pbxt::reopen()
*
*/
-int pbxt_statistics_fill_table(THD *thd, TABLE_LIST *tables, COND *cond)
+static int pbxt_statistics_fill_table(THD *thd, TABLE_LIST *tables, COND *cond)
{
- XTThreadPtr self;
+ XTThreadPtr self = NULL;
int err = 0;
+ if (!pbxt_hton) {
+ /* Can't do if PBXT is not loaded! */
+ XTExceptionRec e;
+
+ xt_exception_xterr(&e, XT_CONTEXT, XT_ERR_PBXT_NOT_INSTALLED);
+ xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
+ /* Just return an empty set: */
+ return 0;
+ }
+
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
+
+
try_(a) {
+ /* If the thread has no open database, and the global
+ * database is already open, then open
+ * the database. Otherwise the statement will be
+ * executed without an open database, which means
+ * that the related statistics will be missing.
+ *
+ * This includes all background threads.
+ */
+ if (!self->st_database && pbxt_database) {
+ xt_ha_open_database_of_table(self, (XTPathStrPtr) NULL);
+ }
+
err = myxt_statistics_fill_table(self, thd, tables, cond, system_charset_info);
}
catch_(a) {
@@ -1684,6 +1956,24 @@ int pbxt_statistics_fill_table(THD *thd,
return err;
}
+#ifdef DRIZZLED
+ColumnInfo pbxt_statistics_fields_info[]=
+{
+ ColumnInfo("ID", 4, MYSQL_TYPE_LONG, 0, 0, "The ID of the statistic", SKIP_OPEN_TABLE),
+ ColumnInfo("Name", 40, MYSQL_TYPE_STRING, 0, 0, "The name of the statistic", SKIP_OPEN_TABLE),
+ ColumnInfo("Value", 8, MYSQL_TYPE_LONGLONG, 0, 0, "The accumulated value", SKIP_OPEN_TABLE),
+ ColumnInfo()
+};
+
+class PBXTStatisticsMethods : public InfoSchemaMethods
+{
+public:
+ int fillTable(Session *session, TableList *tables, COND *cond)
+ {
+ return pbxt_statistics_fill_table(session, tables, cond);
+ }
+};
+#else
ST_FIELD_INFO pbxt_statistics_fields_info[]=
{
{ "ID", 4, MYSQL_TYPE_LONG, 0, 0, "The ID of the statistic", SKIP_OPEN_TABLE},
@@ -1691,24 +1981,28 @@ ST_FIELD_INFO pbxt_statistics_fields_inf
{ "Value", 8, MYSQL_TYPE_LONGLONG, 0, 0, "The accumulated value", SKIP_OPEN_TABLE},
{ 0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
+#endif
#ifdef DRIZZLED
static InfoSchemaTable *pbxt_statistics_table;
-
-int pbxt_init_statitics(PluginRegistry ®istry)
+static PBXTStatisticsMethods pbxt_statistics_methods;
+static int pbxt_init_statistics(Registry ®istry)
#else
-int pbxt_init_statitics(void *p)
+static int pbxt_init_statistics(void *p)
#endif
{
#ifdef DRIZZLED
- pbxt_statistics_table = (InfoSchemaTable *)xt_calloc_ns(sizeof(InfoSchemaTable));
- pbxt_statistics_table->table_name= "PBXT_STATISTICS";
+ //pbxt_statistics_table = (InfoSchemaTable *)xt_calloc_ns(sizeof(InfoSchemaTable));
+ //pbxt_statistics_table->table_name= "PBXT_STATISTICS";
+ pbxt_statistics_table = new InfoSchemaTable("PBXT_STATISTICS");
+ pbxt_statistics_table->setColumnInfo(pbxt_statistics_fields_info);
+ pbxt_statistics_table->setInfoSchemaMethods(&pbxt_statistics_methods);
registry.add(pbxt_statistics_table);
#else
ST_SCHEMA_TABLE *pbxt_statistics_table = (ST_SCHEMA_TABLE *) p;
-#endif
pbxt_statistics_table->fields_info = pbxt_statistics_fields_info;
pbxt_statistics_table->fill_table = pbxt_statistics_fill_table;
+#endif
#if defined(XT_WIN) && defined(XT_COREDUMP)
void register_crash_filter();
@@ -1721,14 +2015,14 @@ int pbxt_init_statitics(void *p)
}
#ifdef DRIZZLED
-int pbxt_exit_statitics(PluginRegistry ®istry)
+static int pbxt_exit_statistics(Registry ®istry)
#else
-int pbxt_exit_statitics(void *XT_UNUSED(p))
+static int pbxt_exit_statistics(void *XT_UNUSED(p))
#endif
{
#ifdef DRIZZLED
registry.remove(pbxt_statistics_table);
- xt_free_ns(pbxt_statistics_table);
+ delete pbxt_statistics_table;
#endif
return(0);
}
@@ -1758,7 +2052,11 @@ ha_pbxt::ha_pbxt(handlerton *hton, TABLE
* exist for the storage engine. This is also used by the default rename_table and
* delete_table method in handler.cc.
*/
+#ifdef DRIZZLED
+const char **PBXTStorageEngine::bas_ext() const
+#else
const char **ha_pbxt::bas_ext() const
+#endif
{
return pbxt_extensions;
}
@@ -1800,11 +2098,13 @@ MX_TABLE_TYPES_T ha_pbxt::table_flags()
* purposes!
HA_NOT_EXACT_COUNT |
*/
+#ifndef DRIZZLED
/*
* This basically means we have a file with the name of
* database table (which we do).
*/
HA_FILE_BASED |
+#endif
/*
* Not sure what this does (but MyISAM and InnoDB have it)?!
* Could it mean that we support the handler functions.
@@ -1971,7 +2271,7 @@ int ha_pbxt::open(const char *table_path
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
- XT_PRINT1(self, "ha_pbxt::open %s\n", table_path);
+ XT_PRINT1(self, "open (%s)\n", table_path);
pb_ex_in_use = 1;
try_(a) {
@@ -2049,7 +2349,7 @@ int ha_pbxt::close(void)
}
}
- XT_PRINT1(self, "ha_pbxt::close %s\n", pb_share && pb_share->sh_table_path->ps_path ? pb_share->sh_table_path->ps_path : "unknown");
+ XT_PRINT1(self, "close (%s)\n", pb_share && pb_share->sh_table_path->ps_path ? pb_share->sh_table_path->ps_path : "unknown");
if (self) {
try_(a) {
@@ -2125,9 +2425,10 @@ void ha_pbxt::init_auto_increment(xtWord
if (!TS(table)->next_number_key_offset) {
// Autoincrement at key-start
err = index_last(table->record[1]);
- if (!err)
+ if (!err && !table->next_number_field->is_null(TS(table)->rec_buff_length)) {
/* {PRE-INC} */
nr = (xtWord8) table->next_number_field->val_int_offset(TS(table)->rec_buff_length);
+ }
}
else {
/* Do an index scan to find the largest value! */
@@ -2180,8 +2481,10 @@ void ha_pbxt::init_auto_increment(xtWord
table->next_number_field = tmp_fie;
table->in_use = tmp_thd;
- if (xn_started)
+ if (xn_started) {
+ XT_PRINT0(self, "xt_xn_commit in init_auto_increment\n");
xt_xn_commit(self);
+ }
}
xt_spinlock_unlock(&tab->tab_ainc_lock);
}
@@ -2228,13 +2531,13 @@ void ha_pbxt::get_auto_increment(MX_ULON
* insert into t1 values (-1);
* insert into t1 values (NULL);
*/
-void ha_pbxt::set_auto_increment(Field *nr)
+xtPublic void ha_set_auto_increment(XTOpenTablePtr ot, Field *nr)
{
register XTTableHPtr tab;
MX_ULONGLONG_T nr_int_val;
nr_int_val = nr->val_int();
- tab = pb_open_tab->ot_table;
+ tab = ot->ot_table;
if (nr->cmp((const unsigned char *)&tab->tab_auto_inc) > 0) {
xt_spinlock_lock(&tab->tab_ainc_lock);
@@ -2260,9 +2563,9 @@ void ha_pbxt::set_auto_increment(Field *
#else
tab->tab_dic.dic_min_auto_inc = nr_int_val + 100;
#endif
- pb_open_tab->ot_thread = xt_get_self();
- if (!xt_tab_write_min_auto_inc(pb_open_tab))
- xt_log_and_clear_exception(pb_open_tab->ot_thread);
+ ot->ot_thread = xt_get_self();
+ if (!xt_tab_write_min_auto_inc(ot))
+ xt_log_and_clear_exception(ot->ot_thread);
}
}
}
@@ -2305,7 +2608,7 @@ int ha_pbxt::write_row(byte *buf)
ASSERT_NS(pb_ex_in_use);
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::write_row %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(pb_open_tab->ot_thread, "write_row (%s)\n", pb_share->sh_table_path->ps_path);
XT_DISABLED_TRACE(("INSERT tx=%d val=%d\n", (int) pb_open_tab->ot_thread->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(&buf[1])));
//statistic_increment(ha_write_count,&LOCK_status);
#ifdef PBMS_ENABLED
@@ -2350,7 +2653,7 @@ int ha_pbxt::write_row(byte *buf)
err = update_err;
goto done;
}
- set_auto_increment(table->next_number_field);
+ ha_set_auto_increment(pb_open_tab, table->next_number_field);
}
if (!xt_tab_new_record(pb_open_tab, (xtWord1 *) buf)) {
@@ -2423,7 +2726,7 @@ int ha_pbxt::update_row(const byte * old
ASSERT_NS(pb_ex_in_use);
- XT_PRINT1(self, "ha_pbxt::update_row %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(self, "update_row (%s)\n", pb_share->sh_table_path->ps_path);
XT_DISABLED_TRACE(("UPDATE tx=%d val=%d\n", (int) self->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(&new_data[1])));
//statistic_increment(ha_update_count,&LOCK_status);
@@ -2472,7 +2775,7 @@ int ha_pbxt::update_row(const byte * old
old_map = mx_tmp_use_all_columns(table, table->read_set);
nr = table->found_next_number_field->val_int();
- set_auto_increment(table->found_next_number_field);
+ ha_set_auto_increment(pb_open_tab, table->found_next_number_field);
mx_tmp_restore_column_map(table, old_map);
}
@@ -2504,7 +2807,7 @@ int ha_pbxt::delete_row(const byte * buf
ASSERT_NS(pb_ex_in_use);
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::delete_row %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(pb_open_tab->ot_thread, "delete_row (%s)\n", pb_share->sh_table_path->ps_path);
XT_DISABLED_TRACE(("DELETE tx=%d val=%d\n", (int) pb_open_tab->ot_thread->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(&buf[1])));
//statistic_increment(ha_delete_count,&LOCK_status);
@@ -2829,7 +3132,8 @@ int ha_pbxt::xt_index_prev_read(XTOpenTa
int ha_pbxt::index_init(uint idx, bool XT_UNUSED(sorted))
{
- XTIndexPtr ind;
+ XTIndexPtr ind;
+ XTThreadPtr thread = pb_open_tab->ot_thread;
/* select count(*) from smalltab_PBXT;
* ignores the error below, and continues to
@@ -2851,6 +3155,15 @@ int ha_pbxt::index_init(uint idx, bool X
printf("index_init %s index %d cols req=%d/%d read_bits=%X write_bits=%X index_bits=%X\n", pb_open_tab->ot_table->tab_name->ps_path, (int) idx, pb_open_tab->ot_cols_req, pb_open_tab->ot_cols_req, (int) *table->read_set->bitmap, (int) *table->write_set->bitmap, (int) *ind->mi_col_map.bitmap);
#endif
+ /* Start a statement based transaction as soon
+ * as a read is done for a modify type statement!
+ * Previously, this was done too late!
+ */
+ if (!thread->st_stat_trans) {
+ trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
+ XT_PRINT0(thread, "ha_pbxt::update_row trans_register_ha all=FALSE\n");
+ thread->st_stat_trans = TRUE;
+ }
}
else {
pb_open_tab->ot_cols_req = ha_get_max_bit(table->read_set);
@@ -2901,7 +3214,7 @@ int ha_pbxt::index_init(uint idx, bool X
#endif
}
- xt_xlog_check_long_writer(pb_open_tab->ot_thread);
+ xt_xlog_check_long_writer(thread);
pb_open_tab->ot_thread->st_statistics.st_scan_index++;
return 0;
@@ -2911,7 +3224,7 @@ int ha_pbxt::index_end()
{
int err = 0;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
XTThreadPtr thread = pb_open_tab->ot_thread;
@@ -2991,7 +3304,7 @@ int ha_pbxt::index_read_xt(byte * buf, u
ASSERT_NS(pb_ex_in_use);
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::index_read_xt %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(pb_open_tab->ot_thread, "index_read_xt (%s)\n", pb_share->sh_table_path->ps_path);
XT_DISABLED_TRACE(("search tx=%d val=%d update=%d\n", (int) pb_open_tab->ot_thread->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(key), pb_modified));
ind = (XTIndexPtr) pb_share->sh_dic_keys[idx];
@@ -3072,7 +3385,7 @@ int ha_pbxt::index_next(byte * buf)
int err = 0;
XTIndexPtr ind;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_next_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3114,7 +3427,7 @@ int ha_pbxt::index_next_same(byte * buf,
XTIndexPtr ind;
XTIdxSearchKeyRec search_key;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_next_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3154,7 +3467,7 @@ int ha_pbxt::index_prev(byte * buf)
int err = 0;
XTIndexPtr ind;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_prev_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3188,7 +3501,7 @@ int ha_pbxt::index_first(byte * buf)
XTIndexPtr ind;
XTIdxSearchKeyRec search_key;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_first_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3228,7 +3541,7 @@ int ha_pbxt::index_last(byte * buf)
XTIndexPtr ind;
XTIdxSearchKeyRec search_key;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
//statistic_increment(ha_read_last_count,&LOCK_status);
ASSERT_NS(pb_ex_in_use);
@@ -3275,10 +3588,11 @@ int ha_pbxt::index_last(byte * buf)
*/
int ha_pbxt::rnd_init(bool scan)
{
- int err = 0;
+ int err = 0;
+ XTThreadPtr thread = pb_open_tab->ot_thread;
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::rnd_init %s\n", pb_share->sh_table_path->ps_path);
- XT_DISABLED_TRACE(("seq scan tx=%d\n", (int) pb_open_tab->ot_thread->st_xact_data->xd_start_xn_id));
+ XT_PRINT1(thread, "rnd_init (%s)\n", pb_share->sh_table_path->ps_path);
+ XT_DISABLED_TRACE(("seq scan tx=%d\n", (int) thread->st_xact_data->xd_start_xn_id));
/* Call xt_tab_seq_exit() to make sure the resources used by the previous
* scan are freed. In particular make sure cache page ref count is decremented.
@@ -3296,8 +3610,18 @@ int ha_pbxt::rnd_init(bool scan)
xt_tab_seq_exit(pb_open_tab);
/* The number of columns required: */
- if (pb_open_tab->ot_is_modify)
+ if (pb_open_tab->ot_is_modify) {
pb_open_tab->ot_cols_req = table->read_set->MX_BIT_SIZE();
+ /* Start a statement based transaction as soon
+ * as a read is done for a modify type statement!
+ * Previously, this was done too late!
+ */
+ if (!thread->st_stat_trans) {
+ trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
+ XT_PRINT0(thread, "ha_pbxt::update_row trans_register_ha all=FALSE\n");
+ thread->st_stat_trans = TRUE;
+ }
+ }
else {
pb_open_tab->ot_cols_req = ha_get_max_bit(table->read_set);
@@ -3322,14 +3646,14 @@ int ha_pbxt::rnd_init(bool scan)
else
xt_tab_seq_reset(pb_open_tab);
- xt_xlog_check_long_writer(pb_open_tab->ot_thread);
+ xt_xlog_check_long_writer(thread);
return err;
}
int ha_pbxt::rnd_end()
{
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
/*
* make permanent the lock for the last scanned row
@@ -3358,7 +3682,7 @@ int ha_pbxt::rnd_next(byte *buf)
int err = 0;
xtBool eof;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
ASSERT_NS(pb_ex_in_use);
//statistic_increment(ha_read_rnd_next_count, &LOCK_status);
xt_xlog_check_long_writer(pb_open_tab->ot_thread);
@@ -3393,7 +3717,7 @@ int ha_pbxt::rnd_next(byte *buf)
*/
void ha_pbxt::position(const byte *XT_UNUSED(record))
{
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
ASSERT_NS(pb_ex_in_use);
/*
* I changed this from using little endian to big endian.
@@ -3429,10 +3753,10 @@ int ha_pbxt::rnd_pos(byte * buf, byte *p
{
int err = 0;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
ASSERT_NS(pb_ex_in_use);
//statistic_increment(ha_read_rnd_count, &LOCK_status);
- XT_PRINT1(pb_open_tab->ot_thread, "ha_pbxt::rnd_pos %s\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(pb_open_tab->ot_thread, "rnd_pos (%s)\n", pb_share->sh_table_path->ps_path);
pb_open_tab->ot_curr_rec_id = mi_uint4korr((xtWord1 *) pos);
switch (xt_tab_dirty_read_record(pb_open_tab, (xtWord1 *) buf)) {
@@ -3509,7 +3833,7 @@ int ha_pbxt::info(uint flag)
XTOpenTablePtr ot;
int in_use;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
if (!(in_use = pb_ex_in_use)) {
pb_ex_in_use = 1;
@@ -3535,7 +3859,7 @@ int ha_pbxt::info(uint flag)
stats.index_file_length = xt_ind_node_to_offset(ot->ot_table, ot->ot_table->tab_ind_eof);
stats.delete_length = ot->ot_table->tab_rec_fnum * ot->ot_rec_size;
//check_time = info.check_time;
- stats.mean_rec_length = ot->ot_rec_size;
+ stats.mean_rec_length = (ulong) ot->ot_rec_size;
}
if (flag & HA_STATUS_CONST) {
@@ -3551,7 +3875,9 @@ int ha_pbxt::info(uint flag)
stats.block_size = XT_INDEX_PAGE_SIZE;
if (share->tmp_table == NO_TMP_TABLE)
-#if MYSQL_VERSION_ID > 60005
+#ifdef DRIZZLED
+#define WHICH_MUTEX mutex
+#elif MYSQL_VERSION_ID >= 50404
#define WHICH_MUTEX LOCK_ha_data
#else
#define WHICH_MUTEX mutex
@@ -3559,19 +3885,15 @@ int ha_pbxt::info(uint flag)
#ifdef SAFE_MUTEX
-#if MYSQL_VERSION_ID < 60000
+#if MYSQL_VERSION_ID < 50404
#if MYSQL_VERSION_ID < 50123
safe_mutex_lock(&share->mutex,__FILE__,__LINE__);
#else
safe_mutex_lock(&share->mutex,0,__FILE__,__LINE__);
#endif
#else
-#if MYSQL_VERSION_ID < 60004
- safe_mutex_lock(&share->mutex,__FILE__,__LINE__);
-#else
safe_mutex_lock(&share->WHICH_MUTEX,0,__FILE__,__LINE__);
#endif
-#endif
#else // SAFE_MUTEX
@@ -3675,7 +3997,7 @@ int ha_pbxt::extra(enum ha_extra_functio
{
int err = 0;
- XT_PRINT2(xt_get_self(), "ha_pbxt::extra %s operation=%d\n", pb_share->sh_table_path->ps_path, operation);
+ XT_PRINT2(xt_get_self(), "ha_pbxt::extra (%s) operation=%d\n", pb_share->sh_table_path->ps_path, operation);
switch (operation) {
case HA_EXTRA_RESET_STATE:
@@ -3771,14 +4093,14 @@ int ha_pbxt::extra(enum ha_extra_functio
*/
int ha_pbxt::reset(void)
{
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
extra(HA_EXTRA_RESET_STATE);
XT_RETURN(0);
}
void ha_pbxt::unlock_row()
{
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
if (pb_open_tab)
pb_open_tab->ot_table->tab_locks.xt_remove_temp_lock(pb_open_tab, FALSE);
}
@@ -3802,7 +4124,7 @@ int ha_pbxt::delete_all_rows()
XTDDTable *tab_def = NULL;
char path[PATH_MAX];
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
if (thd_sql_command(thd) != SQLCOM_TRUNCATE) {
/* Just like InnoDB we only handle TRUNCATE TABLE
@@ -3906,7 +4228,7 @@ int ha_pbxt::analyze(THD *thd, HA_CHECK_
xtXactID clean_xn_id = 0;
uint cnt = 10;
- XT_TRACE_CALL();
+ XT_TRACE_METHOD();
if (!pb_open_tab) {
if ((err = reopen()))
@@ -4056,7 +4378,7 @@ xtPublic int ha_pbxt::external_lock(THD
ASSERT_NS(pb_ex_in_use);
*/
- XT_PRINT1(self, "ha_pbxt::EXTERNAL_LOCK %s lock_type=UNLOCK\n", pb_share->sh_table_path->ps_path);
+ XT_PRINT1(self, "EXTERNAL_LOCK (%s) lock_type=UNLOCK\n", pb_share->sh_table_path->ps_path);
/* Make any temporary locks on this table permanent.
*
@@ -4189,10 +4511,9 @@ xtPublic int ha_pbxt::external_lock(THD
xt_broadcast_cond_ns((xt_cond_type *) pb_share->sh_ex_cond);
}
else {
- XT_PRINT2(self, "ha_pbxt::EXTERNAL_LOCK %s lock_type=%d\n", pb_share->sh_table_path->ps_path, lock_type);
+ XT_PRINT2(self, "ha_pbxt::EXTERNAL_LOCK (%s) lock_type=%d\n", pb_share->sh_table_path->ps_path, lock_type);
if (pb_lock_table) {
-
pb_ex_in_use = 1;
try_(a) {
if (!pb_table_locked)
@@ -4243,14 +4564,18 @@ xtPublic int ha_pbxt::external_lock(THD
if ((pb_open_tab->ot_for_update = (lock_type == F_WRLCK))) {
switch ((int) thd_sql_command(thd)) {
case SQLCOM_DELETE:
+#ifndef DRIZZLED
case SQLCOM_DELETE_MULTI:
+#endif
/* turn DELETE IGNORE into normal DELETE. The IGNORE option causes problems because
* when a record is deleted we add an xlog record which we cannot "rollback" later
* when we find that an FK-constraint has failed.
*/
thd->lex->ignore = false;
case SQLCOM_UPDATE:
+#ifndef DRIZZLED
case SQLCOM_UPDATE_MULTI:
+#endif
case SQLCOM_REPLACE:
case SQLCOM_REPLACE_SELECT:
case SQLCOM_INSERT:
@@ -4265,7 +4590,9 @@ xtPublic int ha_pbxt::external_lock(THD
case SQLCOM_DROP_TABLE:
case SQLCOM_DROP_INDEX:
case SQLCOM_LOAD:
+#ifndef DRIZZLED
case SQLCOM_REPAIR:
+#endif
case SQLCOM_OPTIMIZE:
self->st_stat_modify = TRUE;
break;
@@ -4316,11 +4643,16 @@ xtPublic int ha_pbxt::external_lock(THD
self->st_xact_mode = thd_tx_isolation(thd) <= ISO_READ_COMMITTED ? XT_XACT_COMMITTED_READ : XT_XACT_REPEATABLE_READ;
self->st_ignore_fkeys = (thd_test_options(thd,OPTION_NO_FOREIGN_KEY_CHECKS)) != 0;
self->st_auto_commit = (thd_test_options(thd, (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) == 0;
+#ifdef DRIZZLED
+ self->st_table_trans = FALSE;
+#else
self->st_table_trans = thd_sql_command(thd) == SQLCOM_LOCK_TABLES;
+#endif
self->st_abort_trans = FALSE;
self->st_stat_ended = FALSE;
self->st_stat_trans = FALSE;
XT_PRINT0(self, "xt_xn_begin\n");
+ xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT);
if (!xt_xn_begin(self)) {
err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
pb_ex_in_use = 0;
@@ -4404,7 +4736,7 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
- XT_PRINT2(self, "ha_pbxt::start_stmt %s lock_type=%d\n", pb_share->sh_table_path->ps_path, (int) lock_type);
+ XT_PRINT2(self, "ha_pbxt::start_stmt (%s) lock_type=%d\n", pb_share->sh_table_path->ps_path, (int) lock_type);
if (!pb_open_tab) {
if ((err = reopen()))
@@ -4430,12 +4762,12 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
/* This section handles "auto-commit"... */
if (self->st_xact_data && self->st_auto_commit && self->st_table_trans) {
if (self->st_abort_trans) {
- XT_PRINT0(self, "xt_xn_rollback\n");
+ XT_PRINT0(self, "xt_xn_rollback in start_stmt\n");
if (!xt_xn_rollback(self))
err = xt_ha_pbxt_thread_error_for_mysql(pb_mysql_thd, self, pb_ignore_dup_key);
}
else {
- XT_PRINT0(self, "xt_xn_commit\n");
+ XT_PRINT0(self, "xt_xn_commit in start_stmt\n");
if (!xt_xn_commit(self))
err = xt_ha_pbxt_thread_error_for_mysql(pb_mysql_thd, self, pb_ignore_dup_key);
}
@@ -4466,9 +4798,11 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
if (pb_open_tab->ot_for_update) {
switch ((int) thd_sql_command(thd)) {
case SQLCOM_UPDATE:
- case SQLCOM_UPDATE_MULTI:
case SQLCOM_DELETE:
+#ifndef DRIZZLED
+ case SQLCOM_UPDATE_MULTI:
case SQLCOM_DELETE_MULTI:
+#endif
case SQLCOM_REPLACE:
case SQLCOM_REPLACE_SELECT:
case SQLCOM_INSERT:
@@ -4483,14 +4817,15 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
case SQLCOM_DROP_TABLE:
case SQLCOM_DROP_INDEX:
case SQLCOM_LOAD:
+#ifndef DRIZZLED
case SQLCOM_REPAIR:
+#endif
case SQLCOM_OPTIMIZE:
self->st_stat_modify = TRUE;
break;
}
}
-
/* (***) This is required at this level!
* No matter how often it is called, it is still the start of a
* statement. We need to make sure statements that are NOT mistaken
@@ -4516,6 +4851,7 @@ int ha_pbxt::start_stmt(THD *thd, thr_lo
self->st_stat_ended = FALSE;
self->st_stat_trans = FALSE;
XT_PRINT0(self, "xt_xn_begin\n");
+ xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT);
if (!xt_xn_begin(self)) {
err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
goto complete;
@@ -4673,7 +5009,9 @@ THR_LOCK_DATA **ha_pbxt::store_lock(THD
*
*/
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE) &&
+#ifndef DRIZZLED
!(thd_in_lock_tables(thd) && thd_sql_command(thd) == SQLCOM_LOCK_TABLES) &&
+#endif
!thd_tablespace_op(thd) &&
thd_sql_command(thd) != SQLCOM_TRUNCATE &&
thd_sql_command(thd) != SQLCOM_OPTIMIZE &&
@@ -4691,22 +5029,23 @@ THR_LOCK_DATA **ha_pbxt::store_lock(THD
* Stewart: removed SQLCOM_CALL, not sure of implications.
*/
- if (lock_type == TL_READ_NO_INSERT &&
- (!thd_in_lock_tables(thd)
+ if (lock_type == TL_READ_NO_INSERT
#ifndef DRIZZLED
+ && (!thd_in_lock_tables(thd)
|| thd_sql_command(thd) == SQLCOM_CALL
+ )
#endif
- ))
+ )
{
lock_type = TL_READ;
}
- XT_PRINT3(xt_get_self(), "ha_pbxt::store_lock %s %d->%d\n", pb_share->sh_table_path->ps_path, pb_lock.type, lock_type);
+ XT_PRINT3(xt_get_self(), "store_lock (%s) %d->%d\n", pb_share->sh_table_path->ps_path, pb_lock.type, lock_type);
pb_lock.type = lock_type;
}
#ifdef PBXT_HANDLER_TRACE
else {
- XT_PRINT3(xt_get_self(), "ha_pbxt::store_lock %s %d->%d (ignore/unlock)\n", pb_share->sh_table_path->ps_path, lock_type, lock_type);
+ XT_PRINT3(xt_get_self(), "store_lock (%s) %d->%d (ignore/unlock)\n", pb_share->sh_table_path->ps_path, lock_type, lock_type);
}
#endif
*to++= &pb_lock;
@@ -4723,15 +5062,23 @@ THR_LOCK_DATA **ha_pbxt::store_lock(THD
* during create if the table_flag HA_DROP_BEFORE_CREATE was specified for
* the storage engine.
*/
+#ifdef DRIZZLED
+int PBXTStorageEngine::doDropTable(Session &, std::string table_path_str)
+#else
int ha_pbxt::delete_table(const char *table_path)
+#endif
{
THD *thd = current_thd;
int err = 0;
XTThreadPtr self = NULL;
XTSharePtr share;
+#ifdef DRIZZLED
+ const char *table_path = table_path_str.c_str();
+#endif
+
STAT_TRACE(self, *thd_query(thd));
- XT_PRINT1(self, "ha_pbxt::delete_table %s\n", table_path);
+ XT_PRINT1(self, "delete_table (%s)\n", table_path);
if (XTSystemTableShare::isSystemTable(table_path))
return delete_system_table(table_path);
@@ -4795,7 +5142,7 @@ int ha_pbxt::delete_table(const char *ta
#endif
}
catch_(a) {
- err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
#ifdef DRIZZLED
if (err == HA_ERR_NO_SUCH_TABLE)
err = ENOENT;
@@ -4819,7 +5166,11 @@ int ha_pbxt::delete_table(const char *ta
return err;
}
+#ifdef DRIZZLED
+int PBXTStorageEngine::delete_system_table(const char *table_path)
+#else
int ha_pbxt::delete_system_table(const char *table_path)
+#endif
{
THD *thd = current_thd;
XTExceptionRec e;
@@ -4857,7 +5208,13 @@ int ha_pbxt::delete_system_table(const c
* This function can be used to move a table from one database to
* another.
*/
+#ifdef DRIZZLED
+int PBXTStorageEngine::doRenameTable(Session *,
+ const char *from,
+ const char *to)
+#else
int ha_pbxt::rename_table(const char *from, const char *to)
+#endif
{
THD *thd = current_thd;
int err = 0;
@@ -4865,15 +5222,13 @@ int ha_pbxt::rename_table(const char *fr
XTSharePtr share;
XTDatabaseHPtr to_db;
- XT_TRACE_CALL();
-
if (XTSystemTableShare::isSystemTable(from))
return rename_system_table(from, to);
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
- XT_PRINT2(self, "ha_pbxt::rename_table %s -> %s\n", from, to);
+ XT_PRINT2(self, "rename_table (%s -> %s)\n", from, to);
#ifdef PBMS_ENABLED
PBMSResultRec result;
@@ -4929,7 +5284,7 @@ int ha_pbxt::rename_table(const char *fr
#endif
}
catch_(a) {
- err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
}
cont_(a);
@@ -4940,7 +5295,11 @@ int ha_pbxt::rename_table(const char *fr
XT_RETURN(err);
}
+#ifdef DRIZZLED
+int PBXTStorageEngine::rename_system_table(const char *XT_UNUSED(from), const char *XT_UNUSED(to))
+#else
int ha_pbxt::rename_system_table(const char *XT_UNUSED(from), const char *XT_UNUSED(to))
+#endif
{
return ER_NOT_SUPPORTED_YET;
}
@@ -5029,7 +5388,15 @@ ha_rows ha_pbxt::records_in_range(uint i
* Called from handle.cc by ha_create_table().
*/
+#ifdef DRIZZLED
+int PBXTStorageEngine::doCreateTable(Session *,
+ const char *table_path,
+ Table &table_arg,
+ HA_CREATE_INFO &create_info,
+ drizzled::message::Table &XT_UNUSED(proto))
+#else
int ha_pbxt::create(const char *table_path, TABLE *table_arg, HA_CREATE_INFO *create_info)
+#endif
{
THD *thd = current_thd;
int err = 0;
@@ -5037,37 +5404,61 @@ int ha_pbxt::create(const char *table_pa
XTDDTable *tab_def = NULL;
XTDictionaryRec dic;
- memset(&dic, 0, sizeof(dic));
+ if ((strcmp(table_path, "./pbxt/location") == 0) || (strcmp(table_path, "./pbxt/statistics") == 0))
+ return 0;
- XT_TRACE_CALL();
+ memset(&dic, 0, sizeof(dic));
if (!(self = ha_set_current_thread(thd, &err)))
return xt_ha_pbxt_to_mysql_error(err);
+#ifdef DRIZZLED
+ XT_PRINT2(self, "create (%s) %s\n", table_path, (create_info.options & HA_LEX_CREATE_TMP_TABLE) ? "temporary" : "");
+#else
+ XT_PRINT2(self, "create (%s) %s\n", table_path, (create_info->options & HA_LEX_CREATE_TMP_TABLE) ? "temporary" : "");
+#endif
STAT_TRACE(self, *thd_query(thd));
- XT_PRINT1(self, "ha_pbxt::create %s\n", table_path);
try_(a) {
xt_ha_open_database_of_table(self, (XTPathStrPtr) table_path);
+#ifdef DRIZZLED
+ for (uint i=0; i<TS(&table_arg)->keys; i++) {
+ if (table_arg.key_info[i].key_length > XT_INDEX_MAX_KEY_SIZE)
+ xt_throw_sulxterr(XT_CONTEXT, XT_ERR_KEY_TOO_LARGE, table_arg.key_info[i].name, (u_long) XT_INDEX_MAX_KEY_SIZE);
+ }
+#else
for (uint i=0; i<TS(table_arg)->keys; i++) {
if (table_arg->key_info[i].key_length > XT_INDEX_MAX_KEY_SIZE)
xt_throw_sulxterr(XT_CONTEXT, XT_ERR_KEY_TOO_LARGE, table_arg->key_info[i].name, (u_long) XT_INDEX_MAX_KEY_SIZE);
}
+#endif
/* ($) auto_increment_value will be zero if
* AUTO_INCREMENT is not used. Otherwise
* Query was ALTER TABLE ... AUTO_INCREMENT = x; or
* CREATE TABLE ... AUTO_INCREMENT = x;
*/
+#ifdef DRIZZLED
+ tab_def = xt_ri_create_table(self, true, (XTPathStrPtr) table_path, *thd_query(thd), myxt_create_table_from_table(self, &table_arg));
+ tab_def->checkForeignKeys(self, create_info.options & HA_LEX_CREATE_TMP_TABLE);
+#else
tab_def = xt_ri_create_table(self, true, (XTPathStrPtr) table_path, *thd_query(thd), myxt_create_table_from_table(self, table_arg));
tab_def->checkForeignKeys(self, create_info->options & HA_LEX_CREATE_TMP_TABLE);
+#endif
dic.dic_table = tab_def;
+#ifdef DRIZZLED
+ dic.dic_my_table = &table_arg;
+ dic.dic_tab_flags = (create_info.options & HA_LEX_CREATE_TMP_TABLE) ? XT_TAB_FLAGS_TEMP_TAB : 0;
+ dic.dic_min_auto_inc = (xtWord8) create_info.auto_increment_value; /* ($) */
+ dic.dic_def_ave_row_size = table_arg.s->getAvgRowLength();
+#else
dic.dic_my_table = table_arg;
dic.dic_tab_flags = (create_info->options & HA_LEX_CREATE_TMP_TABLE) ? XT_TAB_FLAGS_TEMP_TAB : 0;
dic.dic_min_auto_inc = (xtWord8) create_info->auto_increment_value; /* ($) */
dic.dic_def_ave_row_size = (xtWord8) table_arg->s->avg_row_length;
+#endif
myxt_setup_dictionary(self, &dic);
/*
@@ -5089,7 +5480,7 @@ int ha_pbxt::create(const char *table_pa
if (tab_def)
tab_def->finalize(self);
dic.dic_table = NULL;
- err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key);
+ err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE);
}
cont_(a);
@@ -5161,7 +5552,7 @@ bool ha_pbxt::get_error_message(int XT_U
if (!self->t_exception.e_xt_err)
return FALSE;
- buf->copy(self->t_exception.e_err_msg, strlen(self->t_exception.e_err_msg), system_charset_info);
+ buf->copy(self->t_exception.e_err_msg, (uint32) strlen(self->t_exception.e_err_msg), system_charset_info);
return TRUE;
}
@@ -5421,16 +5812,31 @@ static MYSQL_SYSVAR_INT(sweeper_priority
#ifdef DRIZZLED
static MYSQL_SYSVAR_INT(max_threads, pbxt_max_threads,
- PLUGIN_VAR_OPCMDARG,
+ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"The maximum number of threads used by PBXT",
NULL, NULL, 500, 20, 20000, 1);
#else
static MYSQL_SYSVAR_INT(max_threads, pbxt_max_threads,
- PLUGIN_VAR_OPCMDARG,
+ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"The maximum number of threads used by PBXT, 0 = set according to MySQL max_connections.",
NULL, NULL, 0, 0, 20000, 1);
#endif
+#ifndef DEBUG
+static MYSQL_SYSVAR_BOOL(support_xa, pbxt_support_xa,
+ PLUGIN_VAR_OPCMDARG,
+ "Enable PBXT support for the XA two-phase commit, default is enabled",
+ NULL, NULL, TRUE);
+#else
+static MYSQL_SYSVAR_BOOL(support_xa, pbxt_support_xa,
+ PLUGIN_VAR_OPCMDARG,
+ "Enable PBXT support for the XA two-phase commit, default is disabled (due to assertion failure in MySQL)",
+ /* The problem is, in MySQL an assertion fails in debug mode:
+ * Assertion failed: (total_ha_2pc == (ulong) opt_bin_log+1), function ha_recover, file handler.cc, line 1557.
+ */
+ NULL, NULL, FALSE);
+#endif
+
static struct st_mysql_sys_var* pbxt_system_variables[] = {
MYSQL_SYSVAR(index_cache_size),
MYSQL_SYSVAR(record_cache_size),
@@ -5448,6 +5854,7 @@ static struct st_mysql_sys_var* pbxt_sys
MYSQL_SYSVAR(offline_log_function),
MYSQL_SYSVAR(sweeper_priority),
MYSQL_SYSVAR(max_threads),
+ MYSQL_SYSVAR(support_xa),
NULL
};
#endif
@@ -5494,8 +5901,8 @@ mysql_declare_plugin(pbxt)
"Paul McCullagh, PrimeBase Technologies GmbH",
"PBXT internal system statitics",
PLUGIN_LICENSE_GPL,
- pbxt_init_statitics, /* plugin init */
- pbxt_exit_statitics, /* plugin deinit */
+ pbxt_init_statistics, /* plugin init */
+ pbxt_exit_statistics, /* plugin deinit */
#ifndef DRIZZLED
0x0005,
#endif
=== modified file 'storage/pbxt/src/ha_pbxt.h'
--- a/storage/pbxt/src/ha_pbxt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/ha_pbxt.h 2009-11-24 10:55:06 +0000
@@ -27,9 +27,9 @@
#ifdef DRIZZLED
#include <drizzled/common.h>
-#include <drizzled/handler.h>
-#include <drizzled/plugin/storage_engine.h>
#include <mysys/thr_lock.h>
+#include <drizzled/cursor.h>
+
#else
#include "mysql_priv.h"
#endif
@@ -53,17 +53,31 @@ class ha_pbxt;
#ifdef DRIZZLED
-class PBXTStorageEngine : public StorageEngine {
+class PBXTStorageEngine : public drizzled::plugin::StorageEngine
+{
+
+ int delete_system_table(const char *table_path);
+ int rename_system_table(const char * from, const char * to);
+
public:
PBXTStorageEngine(std::string name_arg)
- : StorageEngine(name_arg, HTON_NO_FLAGS) {}
+ : drizzled::plugin::StorageEngine(name_arg, HTON_NO_FLAGS) {}
+
+ void operator delete(void *) {}
+ void operator delete[] (void *) {}
/* override */ int close_connection(Session *);
/* override */ int commit(Session *, bool);
/* override */ int rollback(Session *, bool);
- /* override */ handler *create(TABLE_SHARE *, MEM_ROOT *);
+ /* override */ Cursor *create(TABLE_SHARE *, MEM_ROOT *);
/* override */ void drop_database(char *);
/* override */ bool show_status(Session *, stat_print_fn *, enum ha_stat_type);
+ /* override */ const char **bas_ext() const;
+ /* override */ int doCreateTable(Session *session, const char *table_name,
+ Table &table_arg, HA_CREATE_INFO
+ &create_info, drizzled::message::Table &proto);
+ /* override */ int doRenameTable(Session *, const char *from, const char *to);
+ /* override */ int doDropTable(Session &session, std::string table_path);
};
typedef PBXTStorageEngine handlerton;
@@ -139,9 +153,9 @@ class ha_pbxt: public handler
* don't implement this method unless you really have indexes.
*/
const char *index_type(uint inx) { (void) inx; return "BTREE"; }
-
+#ifndef DRIZZLED
const char **bas_ext() const;
-
+#endif
MX_UINT8_T table_cache_type();
/*
@@ -241,11 +255,13 @@ class ha_pbxt: public handler
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
int check(THD* thd, HA_CHECK_OPT* check_opt);
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
- int delete_table(const char *from);
+#ifndef DRIZZLED
int delete_system_table(const char *table_path);
- int rename_table(const char * from, const char * to);
+ int delete_table(const char *from);
int rename_system_table(const char * from, const char * to);
+ int rename_table(const char * from, const char * to);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); //required
+#endif
void update_create_info(HA_CREATE_INFO *create_info);
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); //required
@@ -277,6 +293,7 @@ struct XTThread *xt_ha_thd_to_self(THD*
int xt_ha_pbxt_to_mysql_error(int xt_err);
int xt_ha_pbxt_thread_error_for_mysql(THD *thd, const XTThreadPtr self, int ignore_dup_key);
void xt_ha_all_threads_close_database(XTThreadPtr self, XTDatabase *db);
+void ha_set_auto_increment(XTOpenTablePtr ot, Field *nr);
/*
* These hooks are suppossed to only be used by InnoDB:
=== modified file 'storage/pbxt/src/ha_xtsys.h'
--- a/storage/pbxt/src/ha_xtsys.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/ha_xtsys.h 2009-11-24 10:55:06 +0000
@@ -30,8 +30,9 @@
#ifdef DRIZZLED
#include <drizzled/common.h>
-#include <drizzled/handler.h>
+#include <drizzled/handler_structs.h>
#include <drizzled/current_session.h>
+#include <drizzled/cursor.h>
#else
#include "mysql_priv.h"
#endif
=== modified file 'storage/pbxt/src/heap_xt.cc'
--- a/storage/pbxt/src/heap_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/heap_xt.cc 2009-11-24 10:55:06 +0000
@@ -73,7 +73,7 @@ xtPublic void xt_check_heap(XTThreadPtr
}
#ifdef DEBUG_MEMORY
-xtPublic void xt_mm_heap_reference(XTThreadPtr self, XTHeapPtr hp, u_int line, c_char *file)
+xtPublic void xt_mm_heap_reference(XTThreadPtr XT_UNUSED(self), XTHeapPtr hp, u_int line, c_char *file)
#else
xtPublic void xt_heap_reference(XTThreadPtr, XTHeapPtr hp)
#endif
=== modified file 'storage/pbxt/src/index_xt.cc'
--- a/storage/pbxt/src/index_xt.cc 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/index_xt.cc 2009-11-24 10:55:06 +0000
@@ -829,14 +829,25 @@ static void idx_next_branch_item(XTTable
result->sr_item.i_item_offset += result->sr_item.i_item_size + result->sr_item.i_node_ref_size;
bitem = branch->tb_data + result->sr_item.i_item_offset;
- if (ind->mi_fix_key)
- ilen = result->sr_item.i_item_size;
+ if (result->sr_item.i_item_offset < result->sr_item.i_total_size) {
+ if (ind->mi_fix_key)
+ ilen = result->sr_item.i_item_size;
+ else {
+ ilen = myxt_get_key_length(ind, bitem) + XT_RECORD_REF_SIZE;
+ result->sr_item.i_item_size = ilen;
+ }
+ xt_get_res_record_ref(bitem + ilen - XT_RECORD_REF_SIZE, result); /* (Only valid if i_item_offset < i_total_size) */
+ }
else {
- ilen = myxt_get_key_length(ind, bitem) + XT_RECORD_REF_SIZE;
- result->sr_item.i_item_size = ilen;
+ result->sr_item.i_item_size = 0;
+ result->sr_rec_id = 0;
+ result->sr_row_id = 0;
}
- xt_get_res_record_ref(bitem + ilen - XT_RECORD_REF_SIZE, result); /* (Only valid if i_item_offset < i_total_size) */
- result->sr_branch = IDX_GET_NODE_REF(tab, bitem, result->sr_item.i_node_ref_size);
+ if (result->sr_item.i_node_ref_size)
+ /* IDX_GET_NODE_REF() loads the branch reference to the LEFT of the item. */
+ result->sr_branch = IDX_GET_NODE_REF(tab, bitem, result->sr_item.i_node_ref_size);
+ else
+ result->sr_branch = 0;
}
xtPublic void xt_prev_branch_item_fix(XTTableHPtr XT_UNUSED(tab), XTIndexPtr XT_UNUSED(ind), XTIdxBranchDPtr branch, register XTIdxResultRec *result)
@@ -3987,7 +3998,7 @@ xtPublic xtBool xt_flush_indices(XTOpenT
* here.
*/
if (!(tab->tab_dic.dic_tab_flags & XT_TAB_FLAGS_TEMP_TAB)) {
- if (!xt_xlog_flush_log(ot->ot_thread))
+ if (!xt_xlog_flush_log(tab->tab_db, ot->ot_thread))
goto failed_2;
if (!il->il_flush(ot))
goto failed_2;
=== modified file 'storage/pbxt/src/lock_xt.cc'
--- a/storage/pbxt/src/lock_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/lock_xt.cc 2009-11-24 10:55:06 +0000
@@ -1246,7 +1246,7 @@ xtPublic void xt_spinlock_init(XTThreadP
(void) self;
spl->spl_lock = 0;
#ifdef XT_NO_ATOMICS
- xt_init_mutex(self, &spl->spl_mutex);
+ xt_init_mutex_with_autoname(self, &spl->spl_mutex);
#endif
#ifdef DEBUG
spl->spl_locker = 0;
=== modified file 'storage/pbxt/src/locklist_xt.h'
--- a/storage/pbxt/src/locklist_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/locklist_xt.h 2009-11-27 15:37:02 +0000
@@ -24,11 +24,16 @@
#ifndef __xt_locklist_h__
#define __xt_locklist_h__
+/*
+ * XT_THREAD_LOCK_INFO and DEBUG_LOCKING code must be updated to avoid calls to xt_get_self() as it can be called before hton->slot is
+ * assigned by MySQL which is used by xt_get_self()
+ */
+
#ifdef DEBUG
-#define XT_THREAD_LOCK_INFO
+//#define XT_THREAD_LOCK_INFO
#ifndef XT_WIN
/* We need DEBUG_LOCKING in order to enable pthread function wrappers */
-#define DEBUG_LOCKING
+//#define DEBUG_LOCKING
#endif
#endif
=== modified file 'storage/pbxt/src/memory_xt.cc'
--- a/storage/pbxt/src/memory_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/memory_xt.cc 2009-11-25 15:06:47 +0000
@@ -34,7 +34,7 @@
#include "trace_xt.h"
#ifdef DEBUG
-//#define RECORD_MM
+#define RECORD_MM
#endif
#ifdef DEBUG
@@ -367,9 +367,8 @@ static long mm_find_pointer(void *ptr)
return(-1);
}
-static long mm_add_pointer(void *ptr, u_int id)
+static long mm_add_pointer(void *ptr, u_int XT_UNUSED(id))
{
-#pragma unused(id)
register int i, n, guess;
if (mm_nr_in_use == mm_total_allocated) {
=== modified file 'storage/pbxt/src/myxt_xt.cc'
--- a/storage/pbxt/src/myxt_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/myxt_xt.cc 2009-12-01 09:50:46 +0000
@@ -36,7 +36,7 @@
#include <drizzled/current_session.h>
#include <drizzled/sql_lex.h>
#include <drizzled/session.h>
-extern "C" struct charset_info_st *session_charset(Session *session);
+//extern "C" struct charset_info_st *session_charset(Session *session);
extern pthread_key_t THR_Session;
#else
#include "mysql_priv.h"
@@ -171,7 +171,9 @@ xtPublic u_int myxt_create_key_from_key(
for (u_int i=0; i<ind->mi_seg_count && (int) k_length > 0; i++, old += keyseg->length, keyseg++)
{
+#ifndef DRIZZLED
enum ha_base_keytype type = (enum ha_base_keytype) keyseg->type;
+#endif
u_int length = keyseg->length < k_length ? keyseg->length : k_length;
u_int char_length;
xtWord1 *pos;
@@ -192,14 +194,18 @@ xtPublic u_int myxt_create_key_from_key(
pos = old;
if (keyseg->flag & HA_SPACE_PACK) {
uchar *end = pos + length;
+#ifndef DRIZZLED
if (type != HA_KEYTYPE_NUM) {
+#endif
while (end > pos && end[-1] == ' ')
end--;
+#ifndef DRIZZLED
}
else {
while (pos < end && pos[0] == ' ')
pos++;
}
+#endif
k_length -= length;
length = (u_int) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
@@ -276,6 +282,7 @@ xtPublic u_int myxt_create_key_from_row(
char_length= ((cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : length);
pos = record + keyseg->start;
+#ifndef DRIZZLED
if (type == HA_KEYTYPE_BIT)
{
if (keyseg->bit_length)
@@ -289,17 +296,22 @@ xtPublic u_int myxt_create_key_from_row(
key+= length;
continue;
}
+#endif
if (keyseg->flag & HA_SPACE_PACK)
{
end = pos + length;
+#ifndef DRIZZLED
if (type != HA_KEYTYPE_NUM) {
+#endif
while (end > pos && end[-1] == ' ')
end--;
+#ifndef DRIZZLED
}
else {
while (pos < end && pos[0] == ' ')
pos++;
}
+#endif
length = (u_int) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
@@ -333,6 +345,7 @@ xtPublic u_int myxt_create_key_from_row(
if (keyseg->flag & HA_SWAP_KEY)
{ /* Numerical column */
#ifdef HAVE_ISNAN
+#ifndef DRIZZLED
if (type == HA_KEYTYPE_FLOAT)
{
float nr;
@@ -345,7 +358,9 @@ xtPublic u_int myxt_create_key_from_row(
continue;
}
}
- else if (type == HA_KEYTYPE_DOUBLE) {
+ else
+#endif
+ if (type == HA_KEYTYPE_DOUBLE) {
double nr;
float8get(nr,pos);
@@ -414,6 +429,7 @@ xtPublic u_int myxt_create_foreign_key_f
char_length= ((cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : length);
pos = record + keyseg->start;
+#ifndef DRIZZLED
if (type == HA_KEYTYPE_BIT)
{
if (keyseg->bit_length)
@@ -427,17 +443,22 @@ xtPublic u_int myxt_create_foreign_key_f
key+= length;
continue;
}
+#endif
if (keyseg->flag & HA_SPACE_PACK)
{
end = pos + length;
+#ifndef DRIZZLED
if (type != HA_KEYTYPE_NUM) {
+#endif
while (end > pos && end[-1] == ' ')
end--;
+#ifndef DRIZZLED
}
else {
while (pos < end && pos[0] == ' ')
pos++;
}
+#endif
length = (u_int) (end-pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
@@ -471,6 +492,7 @@ xtPublic u_int myxt_create_foreign_key_f
if (keyseg->flag & HA_SWAP_KEY)
{ /* Numerical column */
#ifdef HAVE_ISNAN
+#ifndef DRIZZLED
if (type == HA_KEYTYPE_FLOAT)
{
float nr;
@@ -483,7 +505,9 @@ xtPublic u_int myxt_create_foreign_key_f
continue;
}
}
- else if (type == HA_KEYTYPE_DOUBLE) {
+ else
+#endif
+ if (type == HA_KEYTYPE_DOUBLE) {
double nr;
float8get(nr,pos);
@@ -622,7 +646,6 @@ static char *mx_get_length_and_data(Fiel
case MYSQL_TYPE_SET:
case MYSQL_TYPE_GEOMETRY:
#else
- case DRIZZLE_TYPE_TINY:
case DRIZZLE_TYPE_LONG:
case DRIZZLE_TYPE_DOUBLE:
case DRIZZLE_TYPE_NULL:
@@ -740,7 +763,6 @@ static void mx_set_length_and_data(Field
case MYSQL_TYPE_SET:
case MYSQL_TYPE_GEOMETRY:
#else
- case DRIZZLE_TYPE_TINY:
case DRIZZLE_TYPE_LONG:
case DRIZZLE_TYPE_DOUBLE:
case DRIZZLE_TYPE_NULL:
@@ -825,6 +847,7 @@ xtPublic xtBool myxt_create_row_from_key
}
record[keyseg->null_pos] &= ~keyseg->null_bit;
}
+#ifndef DRIZZLED
if (keyseg->type == HA_KEYTYPE_BIT)
{
uint length = keyseg->length;
@@ -845,6 +868,7 @@ xtPublic xtBool myxt_create_row_from_key
key+= length;
continue;
}
+#endif
if (keyseg->flag & HA_SPACE_PACK)
{
uint length;
@@ -854,16 +878,20 @@ xtPublic xtBool myxt_create_row_from_key
goto err;
#endif
pos = record+keyseg->start;
+#ifndef DRIZZLED
if (keyseg->type != (int) HA_KEYTYPE_NUM)
{
+#endif
memcpy(pos,key,(size_t) length);
bfill(pos+length,keyseg->length-length,' ');
+#ifndef DRIZZLED
}
else
{
bfill(pos,keyseg->length-length,' ');
memcpy(pos+keyseg->length-length,key,(size_t) length);
}
+#endif
key+=length;
continue;
}
@@ -945,7 +973,7 @@ xtPublic xtBool myxt_create_row_from_key
static int my_compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
my_bool part_key, my_bool skip_end_space)
{
- uint length= min(a_length,b_length);
+ uint length= a_length < b_length ? a_length : b_length;
uchar *end= a+ length;
int flag;
@@ -1023,6 +1051,7 @@ xtPublic u_int myxt_get_key_length(XTInd
get_key_pack_length(seg_len, pack_len, key_data);
key_data += seg_len;
break;
+#ifndef DRIZZLED
case HA_KEYTYPE_NUM: {
/* Numeric key */
if (keyseg->flag & HA_SPACE_PACK)
@@ -1035,15 +1064,16 @@ xtPublic u_int myxt_get_key_length(XTInd
case HA_KEYTYPE_INT8:
case HA_KEYTYPE_SHORT_INT:
case HA_KEYTYPE_USHORT_INT:
+ case HA_KEYTYPE_INT24:
+ case HA_KEYTYPE_FLOAT:
+ case HA_KEYTYPE_BIT:
+#endif
case HA_KEYTYPE_LONG_INT:
case HA_KEYTYPE_ULONG_INT:
- case HA_KEYTYPE_INT24:
case HA_KEYTYPE_UINT24:
- case HA_KEYTYPE_FLOAT:
case HA_KEYTYPE_DOUBLE:
case HA_KEYTYPE_LONGLONG:
case HA_KEYTYPE_ULONGLONG:
- case HA_KEYTYPE_BIT:
key_data += keyseg->length;
break;
case HA_KEYTYPE_END:
@@ -1190,6 +1220,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += b_length;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_INT8:
{
int i_1 = (int) *((signed char *) a);
@@ -1218,6 +1249,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#endif
case HA_KEYTYPE_LONG_INT: {
int32 l_1 = sint4korr(a);
int32 l_2 = sint4korr(b);
@@ -1236,6 +1268,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_INT24: {
int32 l_1 = sint3korr(a);
int32 l_2 = sint3korr(b);
@@ -1245,6 +1278,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#endif
case HA_KEYTYPE_UINT24: {
int32 l_1 = uint3korr(a);
int32 l_2 = uint3korr(b);
@@ -1254,6 +1288,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_FLOAT: {
float f_1, f_2;
@@ -1270,6 +1305,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#endif
case HA_KEYTYPE_DOUBLE: {
double d_1, d_2;
@@ -1286,6 +1322,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += keyseg->length;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_NUM: {
/* Numeric key */
if (keyseg->flag & HA_SPACE_PACK) {
@@ -1339,6 +1376,7 @@ xtPublic int myxt_compare_key(XTIndexPtr
b += b_length;
break;
}
+#endif
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG: {
longlong ll_a = sint8korr(a);
@@ -1359,9 +1397,11 @@ xtPublic int myxt_compare_key(XTIndexPtr
break;
}
#endif
+#ifndef DRIZZLED
case HA_KEYTYPE_BIT:
/* TODO: What here? */
break;
+#endif
case HA_KEYTYPE_END: /* Ready */
goto end;
}
@@ -1410,16 +1450,19 @@ xtPublic u_int myxt_key_seg_length(XTInd
key_length = has_null + a_length + pack_len;
break;
}
+#ifndef DRIZZLED
case HA_KEYTYPE_INT8:
case HA_KEYTYPE_SHORT_INT:
case HA_KEYTYPE_USHORT_INT:
+ case HA_KEYTYPE_INT24:
+ case HA_KEYTYPE_FLOAT:
+#endif
case HA_KEYTYPE_LONG_INT:
case HA_KEYTYPE_ULONG_INT:
- case HA_KEYTYPE_INT24:
case HA_KEYTYPE_UINT24:
- case HA_KEYTYPE_FLOAT:
case HA_KEYTYPE_DOUBLE:
break;
+#ifndef DRIZZLED
case HA_KEYTYPE_NUM: {
/* Numeric key */
if (keyseg->flag & HA_SPACE_PACK) {
@@ -1428,14 +1471,17 @@ xtPublic u_int myxt_key_seg_length(XTInd
}
break;
}
+#endif
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
case HA_KEYTYPE_ULONGLONG:
break;
#endif
+#ifndef DRIZZLED
case HA_KEYTYPE_BIT:
/* TODO: What here? */
break;
+#endif
case HA_KEYTYPE_END: /* Ready */
break;
}
@@ -1486,7 +1532,7 @@ xtPublic xtWord4 myxt_store_row_length(X
return row_size;
}
-static xtWord4 mx_store_row(XTOpenTablePtr ot, xtWord4 row_size, char *rec_buff)
+xtPublic xtWord4 myxt_store_row_data(XTOpenTablePtr ot, xtWord4 row_size, char *rec_buff)
{
TABLE *table = ot->ot_table->tab_dic.dic_my_table;
char *sdata;
@@ -1614,8 +1660,9 @@ xtPublic size_t myxt_load_row_length(XTO
}
/* Unload from PBXT variable length format to the MySQL row format. */
-xtPublic xtBool myxt_load_row(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt)
+xtPublic xtWord4 myxt_load_row_data(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt)
{
+ xtWord1 *input_buf = source_buf;
TABLE *table;
xtWord4 len;
Field *curr_field;
@@ -1624,7 +1671,7 @@ xtPublic xtBool myxt_load_row(XTOpenTabl
if (!(table = ot->ot_table->tab_dic.dic_my_table)) {
xt_register_taberr(XT_REG_CONTEXT, XT_ERR_NO_DICTIONARY, ot->ot_table->tab_name);
- return FAILED;
+ return 0;
}
/* According to the InnoDB implementation:
@@ -1657,7 +1704,7 @@ xtPublic xtBool myxt_load_row(XTOpenTabl
default: // Length byte
if (*source_buf > 240) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_RECORD_FORMAT);
- return FAILED;
+ return 0;
}
len = *source_buf;
source_buf++;
@@ -1671,7 +1718,12 @@ xtPublic xtBool myxt_load_row(XTOpenTabl
source_buf += len;
}
- return OK;
+ return (xtWord4) (source_buf - input_buf);
+}
+
+xtPublic xtBool myxt_load_row(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt)
+{
+ return myxt_load_row_data(ot, source_buf, dest_buff, col_cnt) != 0;
}
xtPublic xtBool myxt_find_column(XTOpenTablePtr ot, u_int *col_idx, const char *col_name)
@@ -1784,7 +1836,7 @@ xtPublic xtBool myxt_store_row(XTOpenTab
else {
xtWord4 row_size;
- if (!(row_size = mx_store_row(ot, XT_REC_EXT_HEADER_SIZE, rec_buff)))
+ if (!(row_size = myxt_store_row_data(ot, XT_REC_EXT_HEADER_SIZE, rec_buff)))
return FAILED;
if (row_size - XT_REC_FIX_EXT_HEADER_DIFF <= ot->ot_rec_size) {
rec_info->ri_fix_rec_buf = (XTTabRecFixDPtr) &ot->ot_row_wbuffer[XT_REC_FIX_EXT_HEADER_DIFF];
@@ -1951,7 +2003,7 @@ static TABLE *my_open_table(XTThreadPtr
#ifdef DRIZZLED
share->init(db_name, 0, name, path);
- if ((error = open_table_def(thd, share)) ||
+ if ((error = open_table_def(*thd, share)) ||
(error = open_table_from_share(thd, share, "", 0, (uint32_t) READ_ALL, 0, table, OTM_OPEN)))
{
xt_free(self, table);
@@ -1995,7 +2047,7 @@ static TABLE *my_open_table(XTThreadPtr
return NULL;
}
-#if MYSQL_VERSION_ID >= 60003
+#if MYSQL_VERSION_ID >= 50404
if ((error = open_table_from_share(thd, share, "", 0, (uint) READ_ALL, 0, table, OTM_OPEN)))
#else
if ((error = open_table_from_share(thd, share, "", 0, (uint) READ_ALL, 0, table, FALSE)))
@@ -2145,7 +2197,10 @@ static XTIndexPtr my_create_index(XTThre
if (options & HA_OPTION_PACK_KEYS ||
(index->flags & (HA_PACK_KEY | HA_BINARY_PACK_KEY | HA_SPACE_PACK_USED)))
{
- if (key_part->length > 8 && (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_NUM ||
+ if (key_part->length > 8 && (type == HA_KEYTYPE_TEXT ||
+#ifndef DRIZZLED
+ type == HA_KEYTYPE_NUM ||
+#endif
(type == HA_KEYTYPE_BINARY && !field->zero_pack())))
{
/* No blobs here */
@@ -2213,8 +2268,12 @@ static XTIndexPtr my_create_index(XTThre
else if (field->type() == MYSQL_TYPE_ENUM) {
switch (seg->length) {
case 2:
+#ifdef DRIZZLED
+ ASSERT_NS(FALSE);
+#else
seg->type = HA_KEYTYPE_USHORT_INT;
break;
+#endif
case 3:
seg->type = HA_KEYTYPE_UINT24;
break;
@@ -2675,7 +2734,11 @@ xtPublic xtBool myxt_load_dictionary(XTT
if (!(my_tab = my_open_table(self, db, tab_path)))
return FAILED;
dic->dic_my_table = my_tab;
+#ifdef DRIZZLED
+ dic->dic_def_ave_row_size = (xtWord8) my_tab->s->getAvgRowLength();
+#else
dic->dic_def_ave_row_size = (xtWord8) my_tab->s->avg_row_length;
+#endif
myxt_setup_dictionary(self, dic);
dic->dic_keys = (XTIndexPtr *) xt_calloc(self, sizeof(XTIndexPtr) * TS(my_tab)->keys);
for (uint i=0; i<TS(my_tab)->keys; i++)
@@ -2805,8 +2868,10 @@ static void ha_create_dd_index(XTThreadP
static char *my_type_to_string(XTThreadPtr self, Field *field, TABLE *XT_UNUSED(my_tab))
{
- char buffer[MAX_FIELD_WIDTH + 400], *ptr;
+ char buffer[MAX_FIELD_WIDTH + 400];
+ const char *ptr;
String type((char *) buffer, sizeof(buffer), system_charset_info);
+ xtWord4 len;
/* GOTCHA:
* - Above sets the string length to the same as the buffer,
@@ -2817,10 +2882,17 @@ static char *my_type_to_string(XTThreadP
*/
type.length(0);
field->sql_type(type);
- ptr = type.c_ptr();
+ ptr = type.ptr();
+ len = type.length();
+
+ if (len >= sizeof(buffer))
+ len = sizeof(buffer)-1;
+
if (ptr != buffer)
- xt_strcpy(sizeof(buffer), buffer, ptr);
+ xt_strcpy(sizeof(buffer), buffer, ptr);
+ buffer[len] = 0;
+
if (field->has_charset()) {
/* Always include the charset so that we can compare types
* for FK/PK releations.
@@ -2877,6 +2949,10 @@ xtPublic XTDDTable *myxt_create_table_fr
xtPublic void myxt_static_convert_identifier(XTThreadPtr XT_UNUSED(self), MX_CHARSET_INFO *cs, char *from, char *to, size_t to_len)
{
+#ifdef DRIZZLED
+ ((void *)cs);
+ xt_strcpy(to_len, to, from);
+#else
uint errors;
/*
@@ -2888,11 +2964,16 @@ xtPublic void myxt_static_convert_identi
xt_strcpy(to_len, to, from);
else
strconvert(cs, from, &my_charset_utf8_general_ci, to, to_len, &errors);
+#endif
}
// cs == current_thd->charset()
xtPublic char *myxt_convert_identifier(XTThreadPtr self, MX_CHARSET_INFO *cs, char *from)
{
+#ifdef DRIZZLED
+ char *to = xt_dup_string(self, from);
+ ((void *)cs);
+#else
uint errors;
u_int len;
char *to;
@@ -2904,6 +2985,7 @@ xtPublic char *myxt_convert_identifier(X
to = (char *) xt_malloc(self, len);
strconvert(cs, from, &my_charset_utf8_general_ci, to, len, &errors);
}
+#endif
return to;
}
@@ -2954,11 +3036,19 @@ xtPublic MX_CHARSET_INFO *myxt_getcharse
THD *thd = current_thd;
if (thd)
- return thd_charset(thd);
+ return (MX_CHARSET_INFO *)thd_charset(thd);
}
- return &my_charset_utf8_general_ci;
+ return (MX_CHARSET_INFO *)&my_charset_utf8_general_ci;
}
+#ifdef DBUG_OFF
+//typedef struct st_plugin_int *plugin_ref;
+#define REF_MYSQL_PLUGIN(x) (x)
+#else
+//typedef struct st_plugin_int **plugin_ref;
+#define REF_MYSQL_PLUGIN(x) (*(x))
+#endif
+
xtPublic void *myxt_create_thread()
{
#ifdef DRIZZLED
@@ -3011,12 +3101,22 @@ xtPublic void *myxt_create_thread()
return NULL;
}
- if (!(new_thd = new THD())) {
+ if (!(new_thd = new THD)) {
my_thread_end();
xt_register_error(XT_REG_CONTEXT, XT_ERR_MYSQL_ERROR, 0, "Unable to create MySQL thread (THD)");
return NULL;
}
+ /*
+ * If PBXT is the default storage engine, then creating any THD objects will add extra
+ * 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.
+ */
+ LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(new_thd->variables.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--;
+ }
new_thd->thread_stack = (char *) &new_thd;
new_thd->store_globals();
lex_start(new_thd);
@@ -3052,6 +3152,17 @@ xtPublic void myxt_destroy_thread(void *
close_thread_tables(thd);
#endif
+ /*
+ * In myxt_create_thread we decremented plugin ref-count to avoid dead-locking.
+ * Here we need to increment ref-count to avoid assertion failures.
+ */
+ if (thd->variables.table_plugin) {
+ LEX_STRING& plugin_name = REF_MYSQL_PLUGIN(thd->variables.table_plugin)->name;
+ if ((plugin_name.length == 4) && (strncmp(plugin_name.str, "PBXT", plugin_name.length) == 0)) {
+ REF_MYSQL_PLUGIN(thd->variables.table_plugin)->ref_count++;
+ }
+ }
+
delete thd;
/* Remember that we don't have a THD */
@@ -3128,11 +3239,12 @@ xtPublic int myxt_statistics_fill_table(
const char *stat_name;
u_llong stat_value;
XTStatisticsRec statistics;
+ XTDatabaseHPtr db = self->st_database;
xt_gather_statistics(&statistics);
for (u_int rec_id=0; !err && rec_id<XT_STAT_CURRENT_MAX; rec_id++) {
stat_name = xt_get_stat_meta_data(rec_id)->sm_name;
- stat_value = xt_get_statistic(&statistics, self->st_database, rec_id);
+ stat_value = xt_get_statistic(&statistics, db, rec_id);
col=0;
mx_put_u_llong(table, col++, rec_id+1);
@@ -3213,19 +3325,31 @@ static void myxt_bitmap_init(XTThreadPtr
my_bitmap_map *buf;
uint size_in_bytes = (((n_bits) + 31) / 32) * 4;
- buf = (my_bitmap_map *) xt_malloc(self, size_in_bytes);
+ buf = (my_bitmap_map *) xt_malloc(self, size_in_bytes);
+
+#ifdef DRIZZLED
+ map->init(buf, n_bits);
+#else
map->bitmap= buf;
map->n_bits= n_bits;
create_last_word_mask(map);
bitmap_clear_all(map);
+#endif
}
static void myxt_bitmap_free(XTThreadPtr self, MX_BITMAP *map)
{
+#ifdef DRIZZLED
+ my_bitmap_map *buf = map->getBitmap();
+ if (buf)
+ xt_free(self, buf);
+ map->setBitmap(NULL);
+#else
if (map->bitmap) {
xt_free(self, map->bitmap);
map->bitmap = NULL;
}
+#endif
}
/*
@@ -3269,3 +3393,29 @@ XTDDColumn *XTDDColumnFactory::createFro
return col;
}
+/*
+ * -----------------------------------------------------------------------
+ * utilities
+ */
+
+/*
+ * MySQL (not sure about Drizzle) first calls hton->init and then assigns the plugin a thread slot
+ * which is used by xt_get_self(). This is a problem as pbxt_init() starts a number of daemon threads
+ * which could try to use the slot before it is assigned. This code waits till slot is inited.
+ * We cannot directly check hton->slot as in some versions of MySQL it can be 0 before init which is a
+ * valid value.
+ */
+extern ulong total_ha;
+
+xtPublic void myxt_wait_pbxt_plugin_slot_assigned(XTThread *self)
+{
+#ifdef DRIZZLED
+ static LEX_STRING plugin_name = { C_STRING_WITH_LEN("PBXT") };
+
+ while (!self->t_quit && !Registry::singleton().find(&plugin_name))
+ xt_sleep_milli_second(1);
+#else
+ while(!self->t_quit && (pbxt_hton->slot >= total_ha))
+ xt_sleep_milli_second(1);
+#endif
+}
=== modified file 'storage/pbxt/src/myxt_xt.h'
--- a/storage/pbxt/src/myxt_xt.h 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/myxt_xt.h 2009-11-27 15:37:02 +0000
@@ -52,8 +52,10 @@ void myxt_set_default_row_from_key(XTOp
void myxt_print_key(XTIndexPtr ind, xtWord1 *key_value);
xtWord4 myxt_store_row_length(XTOpenTablePtr ot, char *rec_buff);
+xtWord4 myxt_store_row_data(XTOpenTablePtr ot, xtWord4 row_size, char *rec_buff);
xtBool myxt_store_row(XTOpenTablePtr ot, XTTabRecInfoPtr rec_info, char *rec_buff);
size_t myxt_load_row_length(XTOpenTablePtr ot, size_t buffer_size, xtWord1 *source_buf, u_int *ret_col_cnt);
+xtWord4 myxt_load_row_data(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt);
xtBool myxt_load_row(XTOpenTablePtr ot, xtWord1 *source_buf, xtWord1 *dest_buff, u_int col_cnt);
xtBool myxt_find_column(XTOpenTablePtr ot, u_int *col_idx, const char *col_name);
void myxt_get_column_name(XTOpenTablePtr ot, u_int col_idx, u_int len, char *col_name);
@@ -93,4 +95,6 @@ public:
static XTDDColumn *createFromMySQLField(XTThread *self, STRUCT_TABLE *, Field *);
};
+void myxt_wait_pbxt_plugin_slot_assigned(XTThread *self);
+
#endif
=== modified file 'storage/pbxt/src/pbms.h'
--- a/storage/pbxt/src/pbms.h 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/pbms.h 2009-11-24 10:55:06 +0000
@@ -344,16 +344,16 @@ public:
int couldBeURL(char *blob_url, int size)
{
if (blob_url && (size < PBMS_BLOB_URL_SIZE)) {
- char buffer[PBMS_BLOB_URL_SIZE+1];
- u_int32_t db_id = 0;
- u_int32_t tab_id = 0;
- u_int64_t blob_id = 0;
- u_int64_t blob_ref_id = 0;
- u_int64_t blob_size = 0;
- u_int32_t auth_code = 0;
- u_int32_t server_id = 0;
- char type, junk[5];
- int scanned;
+ char buffer[PBMS_BLOB_URL_SIZE+1];
+ unsigned long db_id = 0;
+ unsigned long tab_id = 0;
+ unsigned long long blob_id = 0;
+ unsigned long long blob_ref_id = 0;
+ unsigned long long blob_size = 0;
+ unsigned long auth_code = 0;
+ unsigned long server_id = 0;
+ char type, junk[5];
+ int scanned;
junk[0] = 0;
if (blob_url[size]) { // There is no guarantee that the URL will be null terminated.
@@ -364,12 +364,12 @@ public:
scanned = sscanf(blob_url, URL_FMT"%4s", &db_id, &type, &tab_id, &blob_id, &auth_code, &server_id, &blob_ref_id, &blob_size, junk);
if (scanned != 8) {// If junk is found at the end this will also result in an invalid URL.
- printf("Bad URL \"%s\": scanned = %d, junk: %d, %d, %d, %d\n", blob_url, scanned, junk[0], junk[1], junk[2], junk[3]);
+ printf("Bad URL \"%s\": scanned = %d, junk: %d, %d, %d, %d\n", blob_url, scanned, junk[0], junk[1], junk[2], junk[3]);
return 0;
}
if (junk[0] || (type != '~' && type != '_')) {
- printf("Bad URL \"%s\": scanned = %d, junk: %d, %d, %d, %d\n", blob_url, scanned, junk[0], junk[1], junk[2], junk[3]);
+ printf("Bad URL \"%s\": scanned = %d, junk: %d, %d, %d, %d\n", blob_url, scanned, junk[0], junk[1], junk[2], junk[3]);
return 0;
}
=== modified file 'storage/pbxt/src/pbms_enabled.cc'
--- a/storage/pbxt/src/pbms_enabled.cc 2009-10-06 15:16:01 +0000
+++ b/storage/pbxt/src/pbms_enabled.cc 2009-11-24 10:55:06 +0000
@@ -29,15 +29,10 @@
*
*/
-/*
- The following two lines backported by psergey. Remove them when we merge from PBXT again.
-*/
#include "xt_config.h"
-#ifdef PBMS_ENABLED
-#define PBMS_API pbms_enabled_api
+#ifdef PBMS_ENABLED
-#include "pbms_enabled.h"
#ifdef DRIZZLED
#include <sys/stat.h>
#include <drizzled/common_includes.h>
@@ -47,11 +42,15 @@
#include <mysql/plugin.h>
#define session_alloc(sess, size) thd_alloc(sess, size);
#define current_session current_thd
-#endif
+#endif
-#define GET_BLOB_FIELD(t, i) (Field_blob *)(t->field[t->s->blob_field[i]])
-#define DB_NAME(f) (f->table->s->db.str)
-#define TAB_NAME(f) (*(f->table_name))
+#define GET_BLOB_FIELD(t, i) (Field_blob *)(t->field[t->s->blob_field[i]])
+#define DB_NAME(f) (f->table->s->db.str)
+#define TAB_NAME(f) (*(f->table_name))
+
+#define PBMS_API pbms_enabled_api
+
+#include "pbms_enabled.h"
static PBMS_API pbms_api;
@@ -242,4 +241,4 @@ void pbms_completed(TABLE *table, bool o
return ;
}
-#endif
\ No newline at end of file
+#endif // PBMS_ENABLED
=== modified file 'storage/pbxt/src/pbms_enabled.h'
--- a/storage/pbxt/src/pbms_enabled.h 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/pbms_enabled.h 2009-11-24 10:55:06 +0000
@@ -35,13 +35,6 @@
#include "pbms.h"
-#ifdef DRIZZLED
-#include <drizzled/server_includes.h>
-#define TABLE Table
-#else
-#include <mysql_priv.h>
-#endif
-
/*
* pbms_initialize() should be called from the engines plugIn's 'init()' function.
* The engine_name is the name of your engine, "PBXT" or "InnoDB" for example.
=== modified file 'storage/pbxt/src/pthread_xt.cc'
--- a/storage/pbxt/src/pthread_xt.cc 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/pthread_xt.cc 2009-11-24 10:55:06 +0000
@@ -578,8 +578,8 @@ xtPublic int xt_p_mutex_unlock(xt_mutex_
xtPublic int xt_p_mutex_destroy(xt_mutex_type *mutex)
{
- ASSERT_NS(mutex->mu_init == 12345);
- mutex->mu_init = 89898;
+ //ASSERT_NS(mutex->mu_init == 12345);
+ mutex->mu_init = 11111;
#ifdef XT_THREAD_LOCK_INFO
xt_thread_lock_info_free(&mutex->mu_lock_info);
#endif
=== modified file 'storage/pbxt/src/restart_xt.cc'
--- a/storage/pbxt/src/restart_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/restart_xt.cc 2009-11-27 15:37:02 +0000
@@ -34,12 +34,16 @@
#include "ha_pbxt.h"
+#ifdef DRIZZLED
+#include <drizzled/data_home.h>
+using drizzled::plugin::Registry;
+#endif
+
#include "xactlog_xt.h"
#include "database_xt.h"
#include "util_xt.h"
#include "strutil_xt.h"
#include "filesys_xt.h"
-#include "restart_xt.h"
#include "myxt_xt.h"
#include "trace_xt.h"
@@ -57,13 +61,27 @@
//#define PRINTF xt_ftracef
//#define PRINTF xt_trace
-void xt_print_bytes(xtWord1 *buf, u_int len)
+/*
+ * -----------------------------------------------------------------------
+ * GLOBALS
+ */
+
+xtPublic int pbxt_recovery_state;
+
+/*
+ * -----------------------------------------------------------------------
+ * UTILITIES
+ */
+
+#ifdef TRACE_RECORD_DATA
+static void xt_print_bytes(xtWord1 *buf, u_int len)
{
for (u_int i=0; i<len; i++) {
PRINTF("%02x ", (u_int) *buf);
buf++;
}
}
+#endif
void xt_print_log_record(xtLogID log, xtLogOffset offset, XTXactLogBufferDPtr record)
{
@@ -252,7 +270,7 @@ void xt_print_log_record(xtLogID log, xt
rec_type = "DELETE";
break;
case XT_LOG_ENT_DELETE_FL:
- rec_type = "DELETE-FL-BG";
+ rec_type = "DELETE-FL";
break;
case XT_LOG_ENT_UPDATE_BG:
rec_type = "UPDATE-BG";
@@ -320,6 +338,11 @@ void xt_print_log_record(xtLogID log, xt
case XT_LOG_ENT_END_OF_LOG:
rec_type = "END OF LOG";
break;
+ case XT_LOG_ENT_PREPARE:
+ rec_type = "PREPARE";
+ xn_id = XT_GET_DISK_4(record->xp.xp_xact_id_4);
+ xn_set = TRUE;
+ break;
}
if (log)
@@ -327,6 +350,8 @@ void xt_print_log_record(xtLogID log, xt
PRINTF("%s ", rec_type);
if (type)
PRINTF("op=%lu tab=%lu %s=%lu ", (u_long) op_no, (u_long) tab_id, type, (u_long) rec_id);
+ else if (tab_id)
+ PRINTF("tab=%lu ", (u_long) tab_id);
if (row_id)
PRINTF("row=%lu ", (u_long) row_id);
if (log_id)
@@ -459,6 +484,7 @@ static xtBool xres_open_table(XTThreadPt
}
return OK;
}
+
ws->ws_tab_gone = tab_id;
return FAILED;
}
@@ -629,6 +655,7 @@ static void xres_apply_change(XTThreadPt
xtWord1 *rec_data = NULL;
XTTabRecFreeDPtr free_data;
+ ASSERT(ot->ot_thread == self);
if (tab->tab_dic.dic_key_count == 0)
check_index = FALSE;
@@ -1300,7 +1327,7 @@ static void xres_apply_operations(XTThre
* These operations are applied even though operations
* in sequence are missing.
*/
-xtBool xres_sync_operations(XTThreadPtr self, XTDatabaseHPtr db, XTWriterStatePtr ws)
+static xtBool xres_sync_operations(XTThreadPtr self, XTDatabaseHPtr db, XTWriterStatePtr ws)
{
u_int edx;
XTTableEntryPtr te_ptr;
@@ -1881,15 +1908,6 @@ xtBool XTXactRestart::xres_check_checksu
void XTXactRestart::xres_recover_progress(XTThreadPtr self, XTOpenFilePtr *of, int perc)
{
#ifdef XT_USE_GLOBAL_DB
- if (!perc) {
- char file_path[PATH_MAX];
-
- xt_strcpy(PATH_MAX, file_path, xres_db->db_main_path);
- xt_add_pbxt_file(PATH_MAX, file_path, "recovery-progress");
- *of = xt_open_file(self, file_path, XT_FS_CREATE | XT_FS_MAKE_PATH);
- xt_set_eof_file(self, *of, 0);
- }
-
if (perc > 100) {
char file_path[PATH_MAX];
@@ -1905,6 +1923,15 @@ void XTXactRestart::xres_recover_progres
else {
char number[40];
+ if (!*of) {
+ char file_path[PATH_MAX];
+
+ xt_strcpy(PATH_MAX, file_path, xres_db->db_main_path);
+ xt_add_pbxt_file(PATH_MAX, file_path, "recovery-progress");
+ *of = xt_open_file(self, file_path, XT_FS_CREATE | XT_FS_MAKE_PATH);
+ xt_set_eof_file(self, *of, 0);
+ }
+
sprintf(number, "%d", perc);
if (!xt_pwrite_file(*of, 0, strlen(number), number, &self->st_statistics.st_x, self))
xt_throw(self);
@@ -1927,10 +1954,11 @@ xtBool XTXactRestart::xres_restart(XTThr
off_t bytes_to_read;
volatile xtBool print_progress = FALSE;
volatile off_t perc_size = 0, next_goal = 0;
- int perc_complete = 1;
+ int perc_complete = 1, perc_to_write = 1;
XTOpenFilePtr progress_file = NULL;
xtBool min_ram_xn_id_set = FALSE;
u_int log_count;
+ time_t start_time;
memset(&ws, 0, sizeof(ws));
@@ -1955,12 +1983,11 @@ xtBool XTXactRestart::xres_restart(XTThr
/* Don't print anything about recovering an empty database: */
if (bytes_to_read != 0)
xt_logf(XT_NT_INFO, "PBXT: Recovering from %lu-%llu, bytes to read: %llu\n", (u_long) xres_cp_log_id, (u_llong) xres_cp_log_offset, (u_llong) bytes_to_read);
- if (bytes_to_read >= 10*1024*1024) {
- print_progress = TRUE;
- perc_size = bytes_to_read / 100;
- next_goal = perc_size;
- xres_recover_progress(self, &progress_file, 0);
- }
+
+ print_progress = FALSE;
+ start_time = time(NULL);
+ perc_size = bytes_to_read / 100;
+ next_goal = perc_size;
if (!db->db_xlog.xlog_seq_start(&ws.ws_seqread, xres_cp_log_id, xres_cp_log_offset, FALSE)) {
ok = FALSE;
@@ -1983,17 +2010,28 @@ xtBool XTXactRestart::xres_restart(XTThr
#ifdef PRINT_LOG_ON_RECOVERY
xt_print_log_record(ws.ws_seqread.xseq_rec_log_id, ws.ws_seqread.xseq_rec_log_offset, record);
#endif
- if (print_progress && bytes_read > next_goal) {
- if (((perc_complete - 1) % 25) == 0)
- xt_logf(XT_NT_INFO, "PBXT: ");
- if ((perc_complete % 25) == 0)
- xt_logf(XT_NT_INFO, "%2d\n", (int) perc_complete);
- else
- xt_logf(XT_NT_INFO, "%2d ", (int) perc_complete);
- xt_log_flush(self);
- xres_recover_progress(self, &progress_file, perc_complete);
- next_goal += perc_size;
- perc_complete++;
+ if (bytes_read >= next_goal) {
+ while (bytes_read >= next_goal) {
+ next_goal += perc_size;
+ perc_complete++;
+ }
+ if (!print_progress) {
+ if (time(NULL) - start_time > 2)
+ print_progress = TRUE;
+ }
+ if (print_progress) {
+ while (perc_to_write < perc_complete) {
+ if (((perc_to_write - 1) % 25) == 0)
+ xt_logf(XT_NT_INFO, "PBXT: ");
+ if ((perc_to_write % 25) == 0)
+ xt_logf(XT_NT_INFO, "%2d\n", (int) perc_to_write);
+ else
+ xt_logf(XT_NT_INFO, "%2d ", (int) perc_to_write);
+ xt_log_flush(self);
+ xres_recover_progress(self, &progress_file, perc_to_write);
+ perc_to_write++;
+ }
+ }
}
switch (record->xl.xl_status_1) {
case XT_LOG_ENT_HEADER:
@@ -2053,8 +2091,11 @@ xtBool XTXactRestart::xres_restart(XTThr
xact->xd_end_xn_id = xn_id;
xact->xd_flags |= XT_XN_XAC_ENDED | XT_XN_XAC_SWEEP;
xact->xd_flags &= ~XT_XN_XAC_RECOVERED; // We can expect an end record on cleanup!
+ xact->xd_flags &= ~XT_XN_XAC_PREPARED; // Prepared transactions cannot be swept!
if (record->xl.xl_status_1 == XT_LOG_ENT_COMMIT)
xact->xd_flags |= XT_XN_XAC_COMMITTED;
+ if (xt_sl_get_size(db->db_xn_xa_list) > 0)
+ xt_xn_delete_xa_data_by_xact(db, xn_id, self);
}
break;
case XT_LOG_ENT_CLEANUP:
@@ -2071,6 +2112,14 @@ xtBool XTXactRestart::xres_restart(XTThr
rec_log_id = XT_GET_DISK_4(record->xl.xl_log_id_4);
xt_dl_set_to_delete(self, db, rec_log_id);
break;
+ case XT_LOG_ENT_PREPARE:
+ xn_id = XT_GET_DISK_4(record->xp.xp_xact_id_4);
+ if ((xact = xt_xn_get_xact(db, xn_id, self))) {
+ xact->xd_flags |= XT_XN_XAC_PREPARED;
+ if (!xt_xn_store_xa_data(db, xn_id, record->xp.xp_xa_len_1, record->xp.xp_xa_data, self))
+ xt_throw(self);
+ }
+ break;
default:
xt_xres_apply_in_order(self, &ws, ws.ws_seqread.xseq_rec_log_id, ws.ws_seqread.xseq_rec_log_offset, record);
break;
@@ -2534,7 +2583,8 @@ static void xres_cp_main(XTThreadPtr sel
/* This condition means we could checkpoint: */
if (!(xt_sl_get_size(db->db_datalogs.dlc_to_delete) == 0 &&
xt_sl_get_size(db->db_datalogs.dlc_deleted) == 0 &&
- xt_comp_log_pos(log_id, log_offset, db->db_restart.xres_cp_log_id, db->db_restart.xres_cp_log_offset) <= 0))
+ xt_comp_log_pos(log_id, log_offset, db->db_restart.xres_cp_log_id, db->db_restart.xres_cp_log_offset) <= 0) &&
+ xt_sl_get_size(db->db_xn_xa_list) == 0)
break;
xres_cp_wait_for_log_writer(self, db, 400);
@@ -2654,7 +2704,7 @@ xtPublic xtBool xt_begin_checkpoint(XTDa
* until they are flushed.
*/
/* This is an alternative to the above.
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(db, self))
xt_throw(self);
*/
xt_lock_mutex_ns(&db->db_wr_lock);
@@ -2776,6 +2826,14 @@ xtPublic xtBool xt_end_checkpoint(XTData
size_t chk_size = 0;
u_int no_of_logs = 0;
+ /* As long as we have outstanding XA transactions, we may not checkpoint! */
+ if (xt_sl_get_size(db->db_xn_xa_list) > 0) {
+#ifdef DEBUG
+ printf("Checkpoint must wait\n");
+#endif
+ return OK;
+ }
+
#ifdef NEVER_CHECKPOINT
return OK;
#endif
@@ -3183,7 +3241,7 @@ xtPublic void xt_dump_xlogs(XTDatabaseHP
* D A T A B A S E R E C O V E R Y T H R E A D
*/
-extern XTDatabaseHPtr pbxt_database;
+
static XTThreadPtr xres_recovery_thread;
static void *xn_xres_run_recovery_thread(XTThreadPtr self)
@@ -3193,18 +3251,18 @@ static void *xn_xres_run_recovery_thread
if (!(mysql_thread = (THD *) myxt_create_thread()))
xt_throw(self);
- while (!xres_recovery_thread->t_quit && !ha_resolve_by_legacy_type(mysql_thread, DB_TYPE_PBXT))
- xt_sleep_milli_second(1);
+ myxt_wait_pbxt_plugin_slot_assigned(self);
if (!xres_recovery_thread->t_quit) {
- /* {GLOBAL-DB}
- * It can happen that something will just get in before this
- * thread and open/recover the database!
- */
- if (!pbxt_database) {
- try_(a) {
+ try_(a) {
+ /* {GLOBAL-DB}
+ * It can happen that something will just get in before this
+ * thread and open/recover the database!
+ */
+ if (!pbxt_database) {
xt_open_database(self, mysql_real_data_home, TRUE);
- /* This can be done at the same time by a foreground thread,
+ /* {GLOBAL-DB}
+ * This can be done at the same time as the recovery thread,
* strictly speaking I need a lock.
*/
if (!pbxt_database) {
@@ -3212,11 +3270,22 @@ static void *xn_xres_run_recovery_thread
xt_heap_reference(self, pbxt_database);
}
}
- catch_(a) {
- xt_log_and_clear_exception(self);
- }
- cont_(a);
+ else
+ xt_use_database(self, pbxt_database, XT_FOR_USER);
+
+ pbxt_recovery_state = XT_RECOVER_DONE;
+
+ /* {WAIT-FOR-SW-AFTER-RECOV}
+ * Moved to here...
+ */
+ xt_wait_for_sweeper(self, self->st_database, 0);
+
+ pbxt_recovery_state = XT_RECOVER_SWEPT;
}
+ catch_(a) {
+ xt_log_and_clear_exception(self);
+ }
+ cont_(a);
}
/*
@@ -3261,11 +3330,12 @@ xtPublic void xt_xres_start_database_rec
sprintf(name, "DB-RECOVERY-%s", xt_last_directory_of_path(mysql_real_data_home));
xt_remove_dir_char(name);
+ pbxt_recovery_state = XT_RECOVER_PENDING;
xres_recovery_thread = xt_create_daemon(self, name);
xt_run_thread(self, xres_recovery_thread, xn_xres_run_recovery_thread);
}
-xtPublic void xt_xres_wait_for_recovery(XTThreadPtr self)
+xtPublic void xt_xres_terminate_recovery(XTThreadPtr self)
{
XTThreadPtr thr_rec;
=== modified file 'storage/pbxt/src/restart_xt.h'
--- a/storage/pbxt/src/restart_xt.h 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/restart_xt.h 2009-11-24 10:55:06 +0000
@@ -37,6 +37,8 @@ struct XTOpenTable;
struct XTDatabase;
struct XTTable;
+extern int pbxt_recovery_state;
+
typedef struct XTWriterState {
struct XTDatabase *ws_db;
xtBool ws_in_recover;
@@ -132,6 +134,16 @@ void xt_print_log_record(xtLogID log, of
void xt_dump_xlogs(struct XTDatabase *db, xtLogID start_log);
void xt_xres_start_database_recovery(XTThreadPtr self);
-void xt_xres_wait_for_recovery(XTThreadPtr self);
+void xt_xres_terminate_recovery(XTThreadPtr self);
+
+#define XT_RECOVER_PENDING 0
+#define XT_RECOVER_DONE 1
+#define XT_RECOVER_SWEPT 2
+
+inline void xt_xres_wait_for_recovery(XTThreadPtr XT_UNUSED(self), int state)
+{
+ while (pbxt_recovery_state < state)
+ xt_sleep_milli_second(100);
+}
#endif
=== modified file 'storage/pbxt/src/strutil_xt.cc'
--- a/storage/pbxt/src/strutil_xt.cc 2009-10-26 11:35:42 +0000
+++ b/storage/pbxt/src/strutil_xt.cc 2009-11-24 10:55:06 +0000
@@ -21,8 +21,10 @@
* H&G2JCtL
*/
-#include "mysql_priv.h"
#include "xt_config.h"
+
+#include <stdio.h>
+#include <string.h>
#include <ctype.h>
#include "strutil_xt.h"
@@ -107,13 +109,17 @@ xtPublic void xt_2nd_last_name_of_path(s
*dest = 0;
return;
}
- /* If temporary file */
- if (!is_prefix(path, mysql_data_home) &&
+
+ /* {INVALID-OLD-TABLE-FIX}
+ * I have changed the implementation of
+ * this bug fix (see {INVALID-OLD-TABLE-FIX}).
+ if (!is_prefix(path, mysql_data_home) &&
!is_prefix(path, mysql_real_data_home))
{
*dest= 0;
return;
}
+ */
ptr = path + len - 1;
while (ptr != path && !XT_IS_DIR_CHAR(*ptr))
@@ -374,7 +380,7 @@ xtPublic void xt_int8_to_byte_size(xtInt
/* Version number must also be set in configure.in! */
xtPublic c_char *xt_get_version(void)
{
- return "1.0.08d RC";
+ return "1.0.09f RC";
}
/* Copy and URL decode! */
=== modified file 'storage/pbxt/src/systab_xt.cc'
--- a/storage/pbxt/src/systab_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/systab_xt.cc 2009-11-24 10:55:06 +0000
@@ -130,7 +130,7 @@ static int pbms_discover_handler(handler
* MYSQL UTILITIES
*/
-void xt_my_set_notnull_in_record(Field *field, char *record)
+static void xt_my_set_notnull_in_record(Field *field, char *record)
{
if (field->null_ptr)
record[(uint) (field->null_ptr - (uchar *) field->table->record[0])] &= (uchar) ~field->null_bit;
@@ -518,7 +518,7 @@ bool XTStatisticsTable::seqScanRead(xtWo
* SYSTEM TABLE SHARES
*/
-void st_path_to_table_name(size_t size, char *buffer, const char *path)
+static void st_path_to_table_name(size_t size, char *buffer, const char *path)
{
char *str;
=== modified file 'storage/pbxt/src/tabcache_xt.cc'
--- a/storage/pbxt/src/tabcache_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/tabcache_xt.cc 2009-11-27 15:37:02 +0000
@@ -590,7 +590,7 @@ xtBool XTTabCache::tc_fetch(XT_ROW_REC_F
* So there could be a deadlock if I don't flush the log!
*/
if ((self = xt_get_self())) {
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(tci_table->tab_db, self))
goto failed;
}
@@ -1150,6 +1150,8 @@ static void *tabc_fr_run_thread(XTThread
int count;
void *mysql_thread;
+ myxt_wait_pbxt_plugin_slot_assigned(self);
+
mysql_thread = myxt_create_thread();
while (!self->t_quit) {
=== modified file 'storage/pbxt/src/tabcache_xt.h'
--- a/storage/pbxt/src/tabcache_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/tabcache_xt.h 2009-11-24 10:55:06 +0000
@@ -168,7 +168,7 @@ typedef struct XTTableSeq {
#define TAB_CAC_UNLOCK(i, o) xt_xsmutex_unlock(i, o)
#elif defined(TAB_CAC_USE_PTHREAD_RW)
#define TAB_CAC_LOCK_TYPE xt_rwlock_type
-#define TAB_CAC_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define TAB_CAC_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define TAB_CAC_FREE_LOCK(s, i) xt_free_rwlock(i)
#define TAB_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(i)
#define TAB_CAC_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(i)
=== modified file 'storage/pbxt/src/table_xt.cc'
--- a/storage/pbxt/src/table_xt.cc 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/table_xt.cc 2009-11-25 15:40:51 +0000
@@ -35,7 +35,6 @@
#include <drizzled/common.h>
#include <mysys/thr_lock.h>
#include <drizzled/dtcollation.h>
-#include <drizzled/plugin/storage_engine.h>
#else
#include "mysql_priv.h"
#endif
@@ -48,7 +47,6 @@
#include "cache_xt.h"
#include "trace_xt.h"
#include "index_xt.h"
-#include "restart_xt.h"
#include "systab_xt.h"
#ifdef DEBUG
@@ -2347,7 +2345,7 @@ xtPublic void xt_flush_table(XTThreadPtr
}
-xtPublic XTOpenTablePtr tab_open_table(XTTableHPtr tab)
+static XTOpenTablePtr tab_open_table(XTTableHPtr tab)
{
volatile XTOpenTablePtr ot;
XTThreadPtr self;
@@ -2588,7 +2586,7 @@ xtPublic xtBool xt_tab_put_log_op_rec_da
return FAILED;
}
- return xt_xlog_modify_table(ot, status, op_seq, free_rec_id, rec_id, size, buffer);
+ return xt_xlog_modify_table(tab->tab_id, status, op_seq, free_rec_id, rec_id, size, buffer, ot->ot_thread);
}
xtPublic xtBool xt_tab_put_log_rec_data(XTOpenTablePtr ot, u_int status, xtRecordID free_rec_id, xtRecordID rec_id, size_t size, xtWord1 *buffer, xtOpSeqNo *op_seq)
@@ -2606,7 +2604,7 @@ xtPublic xtBool xt_tab_put_log_rec_data(
return FAILED;
}
- return xt_xlog_modify_table(ot, status, *op_seq, free_rec_id, rec_id, size, buffer);
+ return xt_xlog_modify_table(tab->tab_id, status, *op_seq, free_rec_id, rec_id, size, buffer, ot->ot_thread);
}
xtPublic xtBool xt_tab_get_rec_data(XTOpenTablePtr ot, xtRecordID rec_id, size_t size, xtWord1 *buffer)
@@ -3541,7 +3539,7 @@ xtPublic xtBool xt_tab_free_row(XTOpenTa
tab->tab_row_fnum++;
xt_unlock_mutex_ns(&tab->tab_row_lock);
- if (!xt_xlog_modify_table(ot, XT_LOG_ENT_ROW_FREED, op_seq, 0, row_id, sizeof(XTTabRowRefDRec), (xtWord1 *) &free_row))
+ if (!xt_xlog_modify_table(tab->tab_id, XT_LOG_ENT_ROW_FREED, op_seq, 0, row_id, sizeof(XTTabRowRefDRec), (xtWord1 *) &free_row, ot->ot_thread))
return FAILED;
return OK;
@@ -3791,7 +3789,7 @@ xtPublic int xt_tab_remove_record(XTOpen
xt_unlock_mutex_ns(&tab->tab_rec_lock);
free_rec->rf_rec_type_1 = old_rec_type;
- return xt_xlog_modify_table(ot, XT_LOG_ENT_REC_REMOVED_BI, op_seq, (xtRecordID) new_rec_type, rec_id, rec_size, ot->ot_row_rbuffer);
+ return xt_xlog_modify_table(tab->tab_id, XT_LOG_ENT_REC_REMOVED_BI, op_seq, (xtRecordID) new_rec_type, rec_id, rec_size, ot->ot_row_rbuffer, ot->ot_thread);
}
static xtRowID tab_new_row(XTOpenTablePtr ot, XTTableHPtr tab)
@@ -3837,7 +3835,7 @@ static xtRowID tab_new_row(XTOpenTablePt
op_seq = tab->tab_seq.ts_get_op_seq();
xt_unlock_mutex_ns(&tab->tab_row_lock);
- if (!xt_xlog_modify_table(ot, status, op_seq, next_row_id, row_id, 0, NULL))
+ if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, next_row_id, row_id, 0, NULL, ot->ot_thread))
return 0;
XT_DISABLED_TRACE(("new row tx=%d row=%d\n", (int) ot->ot_thread->st_xact_data->xd_start_xn_id, (int) row_id));
@@ -3868,7 +3866,7 @@ xtPublic xtBool xt_tab_set_row(XTOpenTab
if (!tab->tab_rows.xt_tc_write(ot->ot_row_file, row_id, 0, sizeof(XTTabRowRefDRec), (xtWord1 *) &row_buf, &op_seq, TRUE, ot->ot_thread))
return FAILED;
- return xt_xlog_modify_table(ot, status, op_seq, 0, row_id, sizeof(XTTabRowRefDRec), (xtWord1 *) &row_buf);
+ return xt_xlog_modify_table(tab->tab_id, status, op_seq, 0, row_id, sizeof(XTTabRowRefDRec), (xtWord1 *) &row_buf, ot->ot_thread);
}
xtPublic xtBool xt_tab_free_record(XTOpenTablePtr ot, u_int status, xtRecordID rec_id, xtBool clean_delete)
@@ -3937,7 +3935,7 @@ xtPublic xtBool xt_tab_free_record(XTOpe
tab->tab_rec_fnum++;
xt_unlock_mutex_ns(&tab->tab_rec_lock);
- if (!xt_xlog_modify_table(ot, status, op_seq, rec_id, rec_id, sizeof(XTactFreeRecEntryDRec) - offsetof(XTactFreeRecEntryDRec, fr_stat_id_1), &free_rec.fr_stat_id_1))
+ if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, rec_id, rec_id, sizeof(XTactFreeRecEntryDRec) - offsetof(XTactFreeRecEntryDRec, fr_stat_id_1), &free_rec.fr_stat_id_1, ot->ot_thread))
return FAILED;
}
return OK;
@@ -4016,7 +4014,7 @@ static xtBool tab_add_record(XTOpenTable
}
xt_unlock_mutex_ns(&tab->tab_rec_lock);
- if (!xt_xlog_modify_table(ot, status, op_seq, next_rec_id, rec_id, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf))
+ if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, next_rec_id, rec_id, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, ot->ot_thread))
return FAILED;
if (rec_info->ri_ext_rec) {
@@ -4932,6 +4930,12 @@ xtPublic void xt_tab_seq_exit(XTOpenTabl
#endif
#endif
+xtPublic void xt_tab_seq_repeat(XTOpenTablePtr ot)
+{
+ ot->ot_seq_rec_id--;
+ ot->ot_seq_offset -= ot->ot_table->tab_dic.dic_rec_size;
+}
+
xtPublic xtBool xt_tab_seq_next(XTOpenTablePtr ot, xtWord1 *buffer, xtBool *eof)
{
register XTTableHPtr tab = ot->ot_table;
@@ -5094,7 +5098,7 @@ static xtBool tab_exec_repair_pending(XT
return FALSE;
}
else {
- if (!xt_open_file_ns(&of, file_path, XT_FS_DEFAULT))
+ if (!xt_open_file_ns(&of, file_path, XT_FS_DEFAULT | XT_FS_MISSING_OK))
return FALSE;
}
if (!of)
@@ -5190,15 +5194,76 @@ static xtBool tab_exec_repair_pending(XT
return FALSE;
}
-xtPublic void tab_make_table_name(XTTableHPtr tab, char *table_name, size_t size)
+static void tab_make_table_name(XTTableHPtr tab, char *table_name, size_t size)
{
- char name_buf[XT_IDENTIFIER_NAME_SIZE*3+3];
+ char *nptr;
- xt_2nd_last_name_of_path(sizeof(name_buf), name_buf, tab->tab_name->ps_path);
- myxt_static_convert_file_name(name_buf, table_name, size);
- xt_strcat(size, table_name, ".");
- myxt_static_convert_file_name(xt_last_name_of_path(tab->tab_name->ps_path), name_buf, sizeof(name_buf));
- xt_strcat(size, table_name, name_buf);
+ nptr = xt_last_name_of_path(tab->tab_name->ps_path);
+ if (xt_starts_with(nptr, "#sql")) {
+ /* {INVALID-OLD-TABLE-FIX}
+ * Temporary files can have strange paths, for example
+ * ..../var/tmp/mysqld.1/#sqldaec_1_6
+ * This occurs, for example, occurs when the temp_table.test is
+ * run using the PBXT suite in MariaDB:
+ * ./mtr --suite=pbxt --do-test=temp_table
+ *
+ * Calling myxt_static_convert_file_name, with a '.', in the name
+ * causes the error:
+ * [ERROR] Invalid (old?) table or database name 'mysqld.1'
+ * To prevent this, we do not convert the temporary
+ * table names using the mysql functions.
+ *
+ * Note, this bug was found by Monty, and fixed by modifying
+ * xt_2nd_last_name_of_path(), see {INVALID-OLD-TABLE-FIX}.
+ *
+ */
+ xt_2nd_last_name_of_path(size, table_name, tab->tab_name->ps_path);
+ xt_strcat(size, table_name, ".");
+ xt_strcat(size, table_name, nptr);
+ }
+ else {
+ char name_buf[XT_TABLE_NAME_SIZE*3+3];
+ char *part_ptr;
+ size_t len;
+
+ xt_2nd_last_name_of_path(sizeof(name_buf), name_buf, tab->tab_name->ps_path);
+ myxt_static_convert_file_name(name_buf, table_name, size);
+ xt_strcat(size, table_name, ".");
+
+ /* Handle partition extensions to table names: */
+ if ((part_ptr = strstr(nptr, "#P#")))
+ xt_strncpy(sizeof(name_buf), name_buf, nptr, part_ptr - nptr);
+ else
+ xt_strcpy(sizeof(name_buf), name_buf, nptr);
+
+ len = strlen(table_name);
+ myxt_static_convert_file_name(name_buf, table_name + len, size - len);
+
+ if (part_ptr) {
+ /* Add the partition extension (which is relevant to the engine). */
+ char *sub_part_ptr;
+
+ part_ptr += 3;
+ if ((sub_part_ptr = strstr(part_ptr, "#SP#")))
+ xt_strncpy(sizeof(name_buf), name_buf, part_ptr, sub_part_ptr - part_ptr);
+ else
+ xt_strcpy(sizeof(name_buf), name_buf, part_ptr);
+
+ xt_strcat(size, table_name, " (");
+ len = strlen(table_name);
+ myxt_static_convert_file_name(name_buf, table_name + len, size - len);
+
+ if (sub_part_ptr) {
+
+ sub_part_ptr += 4;
+ xt_strcat(size, table_name, " - ");
+ len = strlen(table_name);
+ myxt_static_convert_file_name(sub_part_ptr, table_name + len, size - len);
+ }
+
+ xt_strcat(size, table_name, ")");
+ }
+ }
}
xtPublic xtBool xt_tab_is_table_repair_pending(XTTableHPtr tab)
=== modified file 'storage/pbxt/src/table_xt.h'
--- a/storage/pbxt/src/table_xt.h 2009-08-18 07:46:53 +0000
+++ b/storage/pbxt/src/table_xt.h 2009-11-24 10:55:06 +0000
@@ -127,7 +127,7 @@ struct XTTablePath;
#define XT_TAB_ROW_UNLOCK(i, s) xt_xsmutex_unlock(i, (s)->t_id)
#elif defined(XT_TAB_ROW_USE_PTHREAD_RW)
#define XT_TAB_ROW_LOCK_TYPE xt_rwlock_type
-#define XT_TAB_ROW_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define XT_TAB_ROW_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define XT_TAB_ROW_FREE_LOCK(s, i) xt_free_rwlock(i)
#define XT_TAB_ROW_READ_LOCK(i, s) xt_slock_rwlock_ns(i)
#define XT_TAB_ROW_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
@@ -528,13 +528,14 @@ xtBool xt_table_exists(struct XTDatab
void xt_enum_tables_init(u_int *edx);
XTTableEntryPtr xt_enum_tables_next(struct XTThread *self, struct XTDatabase *db, u_int *edx);
-void xt_enum_files_of_tables_init(struct XTDatabase *db, char *tab_name, xtTableID tab_id, XTFilesOfTablePtr ft);
+void xt_enum_files_of_tables_init(XTPathStrPtr tab_name, xtTableID tab_id, XTFilesOfTablePtr ft);
xtBool xt_enum_files_of_tables_next(XTFilesOfTablePtr ft);
xtBool xt_tab_seq_init(XTOpenTablePtr ot);
void xt_tab_seq_reset(XTOpenTablePtr ot);
void xt_tab_seq_exit(XTOpenTablePtr ot);
xtBool xt_tab_seq_next(XTOpenTablePtr ot, xtWord1 *buffer, xtBool *eof);
+void xt_tab_seq_repeat(XTOpenTablePtr ot);
xtBool xt_tab_new_record(XTOpenTablePtr ot, xtWord1 *buffer);
xtBool xt_tab_delete_record(XTOpenTablePtr ot, xtWord1 *buffer);
=== modified file 'storage/pbxt/src/thread_xt.cc'
--- a/storage/pbxt/src/thread_xt.cc 2009-10-06 15:16:01 +0000
+++ b/storage/pbxt/src/thread_xt.cc 2009-11-24 10:55:06 +0000
@@ -75,6 +75,13 @@ static xt_mutex_type thr_array_lock;
/* Global accumulated statistics: */
static XTStatisticsRec thr_statistics;
+#ifdef DEBUG
+static void break_in_assertion(c_char *expr, c_char *func, c_char *file, u_int line)
+{
+ printf("%s(%s:%d) %s\n", func, file, (int) line, expr);
+}
+#endif
+
/*
* -----------------------------------------------------------------------
* Error logging
@@ -658,6 +665,9 @@ static c_char *thr_get_err_string(int xt
case XT_ERR_FK_REF_TEMP_TABLE: str = "Foreign key may not reference temporary table"; break;
case XT_ERR_MYSQL_SHUTDOWN: str = "Cannot open table, MySQL has shutdown"; break;
case XT_ERR_MYSQL_NO_THREAD: str = "Cannot create thread, MySQL has shutdown"; break;
+ case XT_ERR_BUFFER_TOO_SMALL: str = "System backup buffer too small"; break;
+ case XT_ERR_BAD_BACKUP_FORMAT: str = "Unknown or corrupt backup format, restore aborted"; break;
+ case XT_ERR_PBXT_NOT_INSTALLED: str = "PBXT plugin is not installed"; break;
default: str = "Unknown XT error"; break;
}
return str;
@@ -862,6 +872,11 @@ xtPublic xtBool xt_exception_errno(XTExc
return FAILED;
}
+xtPublic void xt_exception_xterr(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int xt_err)
+{
+ xt_exception_error(e, self, func, file, line, xt_err, 0, thr_get_err_string(xt_err));
+}
+
/*
* -----------------------------------------------------------------------
* LOG ERRORS
@@ -887,7 +902,7 @@ xtPublic xtBool xt_assert(XTThreadPtr se
#ifdef DEBUG
//xt_set_fflush(TRUE);
//xt_dump_trace();
- printf("%s(%s:%d) %s\n", func, file, (int) line, expr);
+ break_in_assertion(expr, func, file, line);
#ifdef CRASH_ON_ASSERT
abort();
#endif
=== modified file 'storage/pbxt/src/thread_xt.h'
--- a/storage/pbxt/src/thread_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/thread_xt.h 2009-11-24 10:55:06 +0000
@@ -536,6 +536,8 @@ extern struct XTThread **xt_thr_array;
* Function prototypes
*/
+extern "C" void *thr_main(void *data);
+
void xt_get_now(char *buffer, size_t len);
xtBool xt_init_logging(void);
void xt_exit_logging(void);
@@ -583,6 +585,7 @@ void xt_register_xterr(c_char *func, c
void xt_exceptionf(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int xt_err, int sys_err, c_char *fmt, ...);
void xt_exception_error(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int xt_err, int sys_err, c_char *msg);
xtBool xt_exception_errno(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int err);
+void xt_exception_xterr(XTExceptionPtr e, XTThreadPtr self, c_char *func, c_char *file, u_int line, int xt_err);
void xt_log_errno(XTThreadPtr self, c_char *func, c_char *file, u_int line, int err);
@@ -610,7 +613,7 @@ void xt_critical_wait(void);
void xt_yield(void);
void xt_sleep_milli_second(u_int t);
xtBool xt_suspend(XTThreadPtr self);
-xtBool xt_unsuspend(XTThreadPtr self, XTThreadPtr target);
+xtBool xt_unsuspend(XTThreadPtr target);
void xt_lock_thread(XTThreadPtr thread);
void xt_unlock_thread(XTThreadPtr thread);
xtBool xt_wait_thread(XTThreadPtr thread);
=== modified file 'storage/pbxt/src/util_xt.cc'
--- a/storage/pbxt/src/util_xt.cc 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/util_xt.cc 2009-11-24 10:55:06 +0000
@@ -150,6 +150,23 @@ xtPublic xtWord1 xt_get_checksum1(xtWord
return (xtWord1) (sum ^ (sum >> 24) ^ (sum >> 16) ^ (sum >> 8));
}
+xtPublic xtWord4 xt_get_checksum4(xtWord1 *data, size_t len)
+{
+ register xtWord4 sum = 0, g;
+ xtWord1 *chk;
+
+ chk = data + len - 1;
+ while (chk > data) {
+ sum = (sum << 4) + *chk;
+ if ((g = sum & 0xF0000000)) {
+ sum = sum ^ (g >> 24);
+ sum = sum ^ g;
+ }
+ chk--;
+ }
+ return sum;
+}
+
/*
* --------------- Data Buffer ------------------
*/
=== modified file 'storage/pbxt/src/util_xt.h'
--- a/storage/pbxt/src/util_xt.h 2009-03-26 12:18:01 +0000
+++ b/storage/pbxt/src/util_xt.h 2009-11-24 10:55:06 +0000
@@ -39,6 +39,7 @@ xtWord4 xt_file_name_to_id(char *file_na
xtBool xt_time_difference(register xtWord4 now, register xtWord4 then);
xtWord2 xt_get_checksum(xtWord1 *data, size_t len, u_int interval);
xtWord1 xt_get_checksum1(xtWord1 *data, size_t len);
+xtWord4 xt_get_checksum4(xtWord1 *data, size_t len);
typedef struct XTDataBuffer {
size_t db_size;
=== modified file 'storage/pbxt/src/xaction_xt.cc'
--- a/storage/pbxt/src/xaction_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/xaction_xt.cc 2009-11-24 10:55:06 +0000
@@ -1075,6 +1075,7 @@ xtPublic void xt_xn_init_db(XTThreadPtr
#endif
xt_spinlock_init_with_autoname(self, &db->db_xn_id_lock);
xt_spinlock_init_with_autoname(self, &db->db_xn_wait_spinlock);
+ xt_init_mutex_with_autoname(self, &db->db_xn_xa_lock);
//xt_init_mutex_with_autoname(self, &db->db_xn_wait_lock);
//xt_init_cond(self, &db->db_xn_wait_cond);
xt_init_mutex_with_autoname(self, &db->db_sw_lock);
@@ -1096,6 +1097,9 @@ xtPublic void xt_xn_init_db(XTThreadPtr
}
}
+ /* Create a sorted list for XA transactions recovered: */
+ db->db_xn_xa_list = xt_new_sortedlist(self, sizeof(XTXactXARec), 100, 50, xt_xn_xa_compare, db, NULL, FALSE, FALSE);
+
/* Initialize the data logs: */
db->db_datalogs.dlc_init(self, db);
@@ -1146,6 +1150,7 @@ xtPublic void xt_xn_exit_db(XTThreadPtr
printf("=========> MAX TXs NOT CLEAN: %lu\n", not_clean_max);
printf("=========> MAX TXs IN RAM: %lu\n", in_ram_max);
#endif
+ XTXactPreparePtr xap, xap_next;
xt_stop_sweeper(self, db); // Should be done already!
xt_stop_writer(self, db); // Should be done already!
@@ -1187,6 +1192,19 @@ xtPublic void xt_xn_exit_db(XTThreadPtr
xt_free_mutex(&db->db_sw_lock);
//xt_free_cond(&db->db_xn_wait_cond);
//xt_free_mutex(&db->db_xn_wait_lock);
+ xt_free_mutex(&db->db_xn_xa_lock);
+ for (u_int i=0; i<XT_XA_HASH_TAB_SIZE; i++) {
+ xap = db->db_xn_xa_table[i];
+ while (xap) {
+ xap_next = xap->xp_next;
+ xt_free(self, xap);
+ xap = xap_next;
+ }
+ }
+ if (db->db_xn_xa_list) {
+ xt_free_sortedlist(self, db->db_xn_xa_list);
+ db->db_xn_xa_list = NULL;
+ }
xt_spinlock_free(self, &db->db_xn_wait_spinlock);
xt_spinlock_free(self, &db->db_xn_id_lock);
#ifdef DEBUG_RAM_LIST
@@ -1428,7 +1446,7 @@ static xtBool xn_end_xact(XTThreadPtr th
wait_xn_id = thread->st_prev_xact[thread->st_last_xact];
thread->st_prev_xact[thread->st_last_xact] = xn_id;
/* This works because XT_MAX_XACT_BEHIND == 2! */
- ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == thread->st_last_xact ^ 1);
+ ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == (thread->st_last_xact ^ 1));
thread->st_last_xact ^= 1;
while (xt_xn_is_before(db->db_xn_to_clean_id, wait_xn_id) && (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND)) {
xt_critical_wait();
@@ -1548,6 +1566,149 @@ xtPublic int xt_xn_status(XTOpenTablePtr
return XT_XN_ABORTED;
}
+/* ----------------------------------------------------------------------
+ * XA Functionality
+ */
+
+xtPublic int xt_xn_xa_compare(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
+{
+ xtXactID *x = (xtXactID *) a;
+ XTXactXAPtr y = (XTXactXAPtr) b;
+
+ if (*x == y->xx_xact_id)
+ return 0;
+ if (xt_xn_is_before(*x, y->xx_xact_id))
+ return -1;
+ return 1;
+}
+
+xtPublic xtBool xt_xn_prepare(int len, xtWord1 *xa_data, XTThreadPtr thread)
+{
+ XTXactDataPtr xact;
+
+ ASSERT_NS(thread->st_xact_data);
+ if ((xact = thread->st_xact_data)) {
+ xtXactID xn_id = xact->xd_start_xn_id;
+
+ /* Only makes sense if the transaction has already been logged: */
+ if ((thread->st_xact_data->xd_flags & XT_XN_XAC_LOGGED)) {
+ if (!xt_xlog_modify_table(0, XT_LOG_ENT_PREPARE, xn_id, 0, 0, len, xa_data, thread))
+ return FAILED;
+ }
+ }
+ return OK;
+}
+
+xtPublic xtBool xt_xn_store_xa_data(XTDatabaseHPtr db, xtXactID xact_id, int len, xtWord1 *xa_data, XTThreadPtr XT_UNUSED(thread))
+{
+ XTXactPreparePtr xap;
+ u_int idx;
+ XTXactXARec xx;
+
+ if (!(xap = (XTXactPreparePtr) xt_malloc_ns(offsetof(XTXactPrepareRec, xp_xa_data) + len)))
+ return FAILED;
+ xap->xp_xact_id = xact_id;
+ xap->xp_hash = xt_get_checksum4(xa_data, len);
+ xap->xp_data_len = len;
+ memcpy(xap->xp_xa_data, xa_data, len);
+ xx.xx_xact_id = xact_id;
+ xx.xx_xa_ptr = xap;
+
+ idx = xap->xp_hash % XT_XA_HASH_TAB_SIZE;
+ xt_lock_mutex_ns(&db->db_xn_xa_lock);
+ if (!xt_sl_insert(NULL, db->db_xn_xa_list, &xact_id, &xx)) {
+ xt_unlock_mutex_ns(&db->db_xn_xa_lock);
+ xt_free_ns(xap);
+ }
+ xap->xp_next = db->db_xn_xa_table[idx];
+ db->db_xn_xa_table[idx] = xap;
+ xt_unlock_mutex_ns(&db->db_xn_xa_lock);
+ return OK;
+}
+
+xtPublic void xt_xn_delete_xa_data_by_xact(XTDatabaseHPtr db, xtXactID xact_id, XTThreadPtr thread)
+{
+ XTXactXAPtr xx;
+
+ xt_lock_mutex_ns(&db->db_xn_xa_lock);
+ if (!(xx = (XTXactXAPtr) xt_sl_find(NULL, db->db_xn_xa_list, &xact_id)))
+ return;
+ xt_xn_delete_xa_data(db, xx->xx_xa_ptr, TRUE, thread);
+}
+
+xtPublic void xt_xn_delete_xa_data(XTDatabaseHPtr db, XTXactPreparePtr xap, xtBool unlock, XTThreadPtr XT_UNUSED(thread))
+{
+ u_int idx;
+ XTXactPreparePtr xap_ptr, xap_pptr = NULL;
+
+ xt_sl_delete(NULL, db->db_xn_xa_list, &xap->xp_xact_id);
+ idx = xap->xp_hash % XT_XA_HASH_TAB_SIZE;
+ xap_ptr = db->db_xn_xa_table[idx];
+ while (xap_ptr) {
+ if (xap_ptr == xap)
+ break;
+ xap_pptr = xap_ptr;
+ xap_ptr = xap_ptr->xp_next;
+ }
+ if (xap_ptr) {
+ if (xap_pptr)
+ xap_pptr->xp_next = xap_ptr->xp_next;
+ else
+ db->db_xn_xa_table[idx] = xap_ptr->xp_next;
+ xt_free_ns(xap);
+ }
+ if (unlock)
+ xt_unlock_mutex_ns(&db->db_xn_xa_lock);
+}
+
+xtPublic XTXactPreparePtr xt_xn_find_xa_data(XTDatabaseHPtr db, int len, xtWord1 *xa_data, xtBool lock, XTThreadPtr XT_UNUSED(thread))
+{
+ xtWord4 hash;
+ XTXactPreparePtr xap;
+ u_int idx;
+
+ if (lock)
+ xt_lock_mutex_ns(&db->db_xn_xa_lock);
+ hash = xt_get_checksum4(xa_data, len);
+ idx = hash % XT_XA_HASH_TAB_SIZE;
+ xap = db->db_xn_xa_table[idx];
+ while (xap) {
+ if (xap->xp_hash == hash &&
+ xap->xp_data_len == len &&
+ memcmp(xap->xp_xa_data, xa_data, len) == 0) {
+ break;
+ }
+ xap = xap->xp_next;
+ }
+
+ return xap;
+}
+
+xtPublic XTXactPreparePtr xt_xn_enum_xa_data(XTDatabaseHPtr db, XTXactEnumXAPtr exa)
+{
+ XTXactXAPtr xx;
+
+ if (!exa->exa_locked) {
+ xt_lock_mutex_ns(&db->db_xn_xa_lock);
+ exa->exa_locked = TRUE;
+ }
+
+ if ((xx = (XTXactXAPtr) xt_sl_item_at(db->db_xn_xa_list, exa->exa_index))) {
+ exa->exa_index++;
+ return xx->xx_xa_ptr;
+ }
+
+ if (exa->exa_locked) {
+ exa->exa_locked = FALSE;
+ xt_unlock_mutex_ns(&db->db_xn_xa_lock);
+ }
+ return NULL;
+}
+
+/* ----------------------------------------------------------------------
+ * S W E E P E R F U N C T I O N S
+ */
+
xtPublic xtWord8 xt_xn_bytes_to_sweep(XTDatabaseHPtr db, XTThreadPtr thread)
{
xtXactID xn_id;
@@ -2047,7 +2208,7 @@ static xtBool xn_sw_cleanup_variation(XT
if(!tab->tab_recs.xt_tc_write_cond(self, ot->ot_rec_file, rec_id, rec_head.tr_rec_type_1, &op_seq, xn_id, row_id, stat_id, rec_type))
/* this means record was not updated by xt_tc_write_bor and doesn't need to */
break;
- if (!xt_xlog_modify_table(ot, XT_LOG_ENT_REC_CLEANED_1, op_seq, 0, rec_id, 1, &rec_head.tr_rec_type_1))
+ if (!xt_xlog_modify_table(tab->tab_id, XT_LOG_ENT_REC_CLEANED_1, op_seq, 0, rec_id, 1, &rec_head.tr_rec_type_1, self))
throw_();
xn_sw_clean_indices(self, ot, rec_id, row_id, rec_buf, ss->ss_databuf.db_data);
break;
@@ -2397,8 +2558,10 @@ static void xn_sw_main(XTThreadPtr self)
if ((xact = xt_xn_get_xact(db, db->db_xn_to_clean_id, self))) {
xtXactID xn_id;
- if (!(xact->xd_flags & XT_XN_XAC_SWEEP))
- /* Transaction has not yet ending, and ready to sweep. */
+ /* The sweep flag is set when the transaction is ready for sweeping.
+ * Prepared transactions may not be swept!
+ */
+ if (!(xact->xd_flags & XT_XN_XAC_SWEEP) || (xact->xd_flags & XT_XN_XAC_PREPARED))
goto sleep;
/* Check if we can cleanup the transaction.
@@ -2493,7 +2656,7 @@ static void xn_sw_main(XTThreadPtr self)
* we flush the log.
*/
if (now >= idle_start + 2) {
- if (!xt_xlog_flush_log(self))
+ if (!xt_xlog_flush_log(db, self))
xt_throw(self);
ss->ss_flush_pending = FALSE;
}
@@ -2516,7 +2679,7 @@ static void xn_sw_main(XTThreadPtr self)
}
if (ss->ss_flush_pending) {
- xt_xlog_flush_log(self);
+ xt_xlog_flush_log(db, self);
ss->ss_flush_pending = FALSE;
}
=== modified file 'storage/pbxt/src/xaction_xt.h'
--- a/storage/pbxt/src/xaction_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/xaction_xt.h 2009-11-24 10:55:06 +0000
@@ -87,6 +87,7 @@ struct XTOpenTable;
#define XT_XN_XAC_CLEANED 8 /* The transaction has been cleaned. */
#define XT_XN_XAC_RECOVERED 16 /* This transaction was detected on recovery. */
#define XT_XN_XAC_SWEEP 32 /* End ID has been set, OK to sweep. */
+#define XT_XN_XAC_PREPARED 64 /* The transaction was prepared (used only by recovery). */
#define XT_XN_VISIBLE 0 /* The transaction is committed, and the record is visible. */
#define XT_XN_NOT_VISIBLE 1 /* The transaction is committed, but not visible. */
@@ -95,6 +96,24 @@ struct XTOpenTable;
#define XT_XN_OTHER_UPDATE 4 /* The record was updated by someone else. */
#define XT_XN_REREAD 5 /* The transaction is not longer in RAM, status is unkown, retry. */
+typedef struct XTXactPrepare {
+ xtXactID xp_xact_id;
+ xtWord4 xp_hash;
+ struct XTXactPrepare *xp_next; /* Next item in hash table. */
+ int xp_data_len;
+ xtWord1 xp_xa_data[XT_MAX_XA_DATA_SIZE];
+} XTXactPrepareRec, *XTXactPreparePtr;
+
+typedef struct XTXactXA {
+ xtXactID xx_xact_id;
+ XTXactPreparePtr xx_xa_ptr;
+} XTXactXARec, *XTXactXAPtr;
+
+typedef struct XTXactEnumXA {
+ u_int exa_index;
+ xtBool exa_locked;
+} XTXactEnumXARec, *XTXactEnumXAPtr;
+
typedef struct XTXactData {
xtXactID xd_start_xn_id; /* Note: may be zero!. */
xtXactID xd_end_xn_id; /* Note: may be zero!. */
@@ -105,6 +124,7 @@ typedef struct XTXactData {
int xd_flags;
xtWord4 xd_end_time;
xtThreadID xd_thread_id;
+ xtWord4 xd_xa_hash; /* 0 if no XA transaction. */
/* A transaction may be indexed twice in the hash table.
* Once on the start sequence number, and once on the
@@ -123,7 +143,7 @@ typedef struct XTXactData {
#if defined(XT_XACT_USE_PTHREAD_RW)
#define XT_XACT_LOCK_TYPE xt_rwlock_type
-#define XT_XACT_INIT_LOCK(s, i) xt_init_rwlock(s, i)
+#define XT_XACT_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define XT_XACT_FREE_LOCK(s, i) xt_free_rwlock(i)
#define XT_XACT_READ_LOCK(i, s) xt_slock_rwlock_ns(i)
#define XT_XACT_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
@@ -183,6 +203,14 @@ void xt_xn_wakeup_thread(xtThreadID th
xtXactID xt_xn_get_curr_id(struct XTDatabase *db);
xtWord8 xt_xn_bytes_to_sweep(struct XTDatabase *db, struct XTThread *thread);
+int xt_xn_xa_compare(struct XTThread *self, register const void *thunk, register const void *a, register const void *b);
+xtBool xt_xn_prepare(int len, xtWord1 *xa_data, struct XTThread *thread);
+xtBool xt_xn_store_xa_data(struct XTDatabase *db, xtXactID xn_id, int len, xtWord1 *xa_data, struct XTThread *thread);
+void xt_xn_delete_xa_data_by_xact(struct XTDatabase *db, xtXactID xact_id, struct XTThread *thread);
+void xt_xn_delete_xa_data(struct XTDatabase *db, XTXactPreparePtr xap, xtBool unlock, struct XTThread *thread);
+XTXactPreparePtr xt_xn_find_xa_data(struct XTDatabase *db, int len, xtWord1 *xa_data, xtBool lock, struct XTThread *thread);
+XTXactPreparePtr xt_xn_enum_xa_data(struct XTDatabase *db, XTXactEnumXAPtr exa);
+
XTXactDataPtr xt_xn_add_old_xact(struct XTDatabase *db, xtXactID xn_id, struct XTThread *thread);
XTXactDataPtr xt_xn_get_xact(struct XTDatabase *db, xtXactID xn_id, struct XTThread *thread);
xtBool xt_xn_delete_xact(struct XTDatabase *db, xtXactID xn_id, struct XTThread *thread);
=== modified file 'storage/pbxt/src/xactlog_xt.cc'
--- a/storage/pbxt/src/xactlog_xt.cc 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/xactlog_xt.cc 2009-11-24 10:55:06 +0000
@@ -1108,6 +1108,9 @@ xtBool XTDatabaseLog::xlog_append(XTThre
if ((part_size = xl_write_buf_pos % 512)) {
part_size = 512 - part_size;
xl_write_buffer[xl_write_buf_pos] = XT_LOG_ENT_END_OF_LOG;
+#ifdef HAVE_valgrind
+ memset(xl_write_buffer + xl_write_buf_pos + 1, 0x66, part_size);
+#endif
if (!xt_pwrite_file(xl_log_file, xl_write_log_offset, xl_write_buf_pos+part_size, xl_write_buffer, &thread->st_statistics.st_xlog, thread))
goto write_failed;
}
@@ -1477,9 +1480,9 @@ void XTDatabaseLog::xlog_name(size_t siz
* T H R E A D T R A N S A C T I O N B U F F E R
*/
-xtPublic xtBool xt_xlog_flush_log(XTThreadPtr thread)
+xtPublic xtBool xt_xlog_flush_log(struct XTDatabase *db, XTThreadPtr thread)
{
- return thread->st_database->db_xlog.xlog_flush(thread);
+ return db->db_xlog.xlog_flush(thread);
}
xtPublic xtBool xt_xlog_log_data(XTThreadPtr thread, size_t size, XTXactLogBufferDPtr log_entry, xtBool commit)
@@ -1488,15 +1491,14 @@ xtPublic xtBool xt_xlog_log_data(XTThrea
}
/* Allocate a record from the free list. */
-xtPublic xtBool xt_xlog_modify_table(struct XTOpenTable *ot, u_int status, xtOpSeqNo op_seq, xtRecordID free_rec_id, xtRecordID rec_id, size_t size, xtWord1 *data)
+xtPublic xtBool xt_xlog_modify_table(xtTableID tab_id, u_int status, xtOpSeqNo op_seq, xtRecordID free_rec_id, xtRecordID rec_id, size_t size, xtWord1 *data, XTThreadPtr thread)
{
XTXactLogBufferDRec log_entry;
- XTThreadPtr thread = ot->ot_thread;
- XTTableHPtr tab = ot->ot_table;
size_t len;
xtWord4 sum = 0;
int check_size = 1;
XTXactDataPtr xact = NULL;
+ xtBool commit = FALSE;
switch (status) {
case XT_LOG_ENT_REC_MODIFIED:
@@ -1505,7 +1507,7 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_DELETE:
check_size = 2;
XT_SET_DISK_4(log_entry.xu.xu_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xu.xu_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xu.xu_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xu.xu_rec_id_4, rec_id);
XT_SET_DISK_2(log_entry.xu.xu_size_2, size);
len = offsetof(XTactUpdateEntryDRec, xu_rec_type_1);
@@ -1521,7 +1523,7 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_DELETE_FL:
check_size = 2;
XT_SET_DISK_4(log_entry.xf.xf_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xf.xf_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xf.xf_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xf.xf_rec_id_4, rec_id);
XT_SET_DISK_2(log_entry.xf.xf_size_2, size);
XT_SET_DISK_4(log_entry.xf.xf_free_rec_id_4, free_rec_id);
@@ -1539,14 +1541,14 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_REC_REMOVED_EXT:
ASSERT_NS(size == 1 + XT_XACT_ID_SIZE + sizeof(XTTabRecFreeDRec));
XT_SET_DISK_4(log_entry.fr.fr_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.fr.fr_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.fr.fr_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.fr.fr_rec_id_4, rec_id);
len = offsetof(XTactFreeRecEntryDRec, fr_stat_id_1);
break;
case XT_LOG_ENT_REC_REMOVED_BI:
check_size = 2;
XT_SET_DISK_4(log_entry.rb.rb_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.rb.rb_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.rb.rb_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.rb.rb_rec_id_4, rec_id);
XT_SET_DISK_2(log_entry.rb.rb_size_2, size);
log_entry.rb.rb_new_rec_type_1 = (xtWord1) free_rec_id;
@@ -1556,42 +1558,42 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_REC_MOVED:
ASSERT_NS(size == 8);
XT_SET_DISK_4(log_entry.xw.xw_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xw.xw_rec_id_4, rec_id);
len = offsetof(XTactWriteRecEntryDRec, xw_rec_type_1);
break;
case XT_LOG_ENT_REC_CLEANED:
ASSERT_NS(size == offsetof(XTTabRecHeadDRec, tr_prev_rec_id_4) + XT_RECORD_ID_SIZE);
XT_SET_DISK_4(log_entry.xw.xw_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xw.xw_rec_id_4, rec_id);
len = offsetof(XTactWriteRecEntryDRec, xw_rec_type_1);
break;
case XT_LOG_ENT_REC_CLEANED_1:
ASSERT_NS(size == 1);
XT_SET_DISK_4(log_entry.xw.xw_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xw.xw_rec_id_4, rec_id);
len = offsetof(XTactWriteRecEntryDRec, xw_rec_type_1);
break;
case XT_LOG_ENT_REC_UNLINKED:
ASSERT_NS(size == offsetof(XTTabRecHeadDRec, tr_prev_rec_id_4) + XT_RECORD_ID_SIZE);
XT_SET_DISK_4(log_entry.xw.xw_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xw.xw_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xw.xw_rec_id_4, rec_id);
len = offsetof(XTactWriteRecEntryDRec, xw_rec_type_1);
break;
case XT_LOG_ENT_ROW_NEW:
ASSERT_NS(size == 0);
XT_SET_DISK_4(log_entry.xa.xa_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xa.xa_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xa.xa_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xa.xa_row_id_4, rec_id);
len = offsetof(XTactRowAddedEntryDRec, xa_row_id_4) + XT_ROW_ID_SIZE;
break;
case XT_LOG_ENT_ROW_NEW_FL:
ASSERT_NS(size == 0);
XT_SET_DISK_4(log_entry.xa.xa_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.xa.xa_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.xa.xa_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.xa.xa_row_id_4, rec_id);
XT_SET_DISK_4(log_entry.xa.xa_free_list_4, free_rec_id);
sum ^= XT_CHECKSUM4_REC(free_rec_id);
@@ -1602,10 +1604,17 @@ xtPublic xtBool xt_xlog_modify_table(str
case XT_LOG_ENT_ROW_FREED:
ASSERT_NS(size == sizeof(XTTabRowRefDRec));
XT_SET_DISK_4(log_entry.wr.wr_op_seq_4, op_seq);
- XT_SET_DISK_4(log_entry.wr.wr_tab_id_4, tab->tab_id);
+ XT_SET_DISK_4(log_entry.wr.wr_tab_id_4, tab_id);
XT_SET_DISK_4(log_entry.wr.wr_row_id_4, rec_id);
len = offsetof(XTactWriteRowEntryDRec, wr_ref_id_4);
break;
+ case XT_LOG_ENT_PREPARE:
+ check_size = 2;
+ XT_SET_DISK_4(log_entry.xp.xp_xact_id_4, op_seq);
+ log_entry.xp.xp_xa_len_1 = (xtWord1) size;
+ len = offsetof(XTXactPrepareEntryDRec, xp_xa_data);
+ commit = TRUE;
+ break;
default:
ASSERT_NS(FALSE);
len = 0;
@@ -1615,7 +1624,7 @@ xtPublic xtBool xt_xlog_modify_table(str
xtWord1 *dptr = data;
xtWord4 g;
- sum ^= op_seq ^ (tab->tab_id << 8) ^ XT_CHECKSUM4_REC(rec_id);
+ sum ^= op_seq ^ (tab_id << 8) ^ XT_CHECKSUM4_REC(rec_id);
if ((g = sum & 0xF0000000)) {
sum = sum ^ (g >> 24);
sum = sum ^ g;
@@ -1643,9 +1652,9 @@ xtPublic xtBool xt_xlog_modify_table(str
xt_print_log_record(0, 0, &log_entry);
#endif
if (xact)
- return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, FALSE, &xact->xd_begin_log, &xact->xd_begin_offset);
+ return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, commit, &xact->xd_begin_log, &xact->xd_begin_offset);
- return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, FALSE, NULL, NULL);
+ return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, commit, NULL, NULL);
}
/*
@@ -1905,6 +1914,7 @@ xtBool XTDatabaseLog::xlog_verify(XTXact
xtRecordID rec_id, free_rec_id;
int check_size = 1;
xtWord1 *dptr;
+ xtWord4 g;
switch (record->xh.xh_status_1) {
case XT_LOG_ENT_HEADER:
@@ -2019,13 +2029,19 @@ xtBool XTDatabaseLog::xlog_verify(XTXact
return record->xe.xe_checksum_1 == (XT_CHECKSUM_1(sum) ^ XT_CHECKSUM_1(log_id));
case XT_LOG_ENT_END_OF_LOG:
return FALSE;
+ case XT_LOG_ENT_PREPARE:
+ check_size = 2;
+ op_seq = XT_GET_DISK_4(record->xp.xp_xact_id_4);
+ tab_id = 0;
+ rec_id = 0;
+ dptr = record->xp.xp_xa_data;
+ rec_size -= offsetof(XTXactPrepareEntryDRec, xp_xa_data);
+ break;
default:
ASSERT_NS(FALSE);
return FALSE;
}
- xtWord4 g;
-
sum ^= (xtWord4) op_seq ^ ((xtWord4) tab_id << 8) ^ XT_CHECKSUM4_REC(rec_id);
if ((g = sum & 0xF0000000)) {
@@ -2193,6 +2209,14 @@ xtBool XTDatabaseLog::xlog_seq_next(XTXa
}
goto return_empty;
}
+ case XT_LOG_ENT_PREPARE:
+ check_size = 2;
+ len = offsetof(XTXactPrepareEntryDRec, xp_xa_data);
+ if (len > max_rec_len)
+ /* The size is not in the buffer: */
+ goto read_more;
+ len += (size_t) record->xp.xp_xa_len_1;
+ break;
default:
/* It is possible to land here after a crash, if the
* log was not completely written.
@@ -2231,7 +2255,7 @@ xtBool XTDatabaseLog::xlog_seq_next(XTXa
goto return_empty;
}
- /* The record is not completely in the buffer: */
+ /* The record is now completely in the buffer: */
seq->xseq_record_len = len;
*ret_entry = (XTXactLogBufferDPtr) seq->xseq_buffer;
return OK;
@@ -2428,7 +2452,7 @@ static void xlog_wr_wait_for_log_flush(X
if (reason == XT_LOG_CACHE_FULL || reason == XT_TIME_TO_WRITE || reason == XT_CHECKPOINT_REQ) {
/* Make sure that we have something to write: */
if (db->db_xlog.xlog_bytes_to_write() < 2 * 1204 * 1024)
- xt_xlog_flush_log(self);
+ xt_xlog_flush_log(db, self);
}
#ifdef TRACE_WRITER_ACTIVITY
@@ -2529,6 +2553,7 @@ static void xlog_wr_main(XTThreadPtr sel
case XT_LOG_ENT_ABORT:
case XT_LOG_ENT_CLEANUP:
case XT_LOG_ENT_OP_SYNC:
+ case XT_LOG_ENT_PREPARE:
break;
case XT_LOG_ENT_DEL_LOG:
xtLogID log_id;
=== modified file 'storage/pbxt/src/xactlog_xt.h'
--- a/storage/pbxt/src/xactlog_xt.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/xactlog_xt.h 2009-11-24 10:55:06 +0000
@@ -160,6 +160,7 @@ typedef struct XTXLogCache {
#define XT_LOG_ENT_END_OF_LOG 37 /* This is a record that indicates the end of the log, and
* fills to the end of a 512 byte block.
*/
+#define XT_LOG_ENT_PREPARE 39 /* XA prepare log entry. */
#define XT_LOG_FILE_MAGIC 0xAE88FE12
#define XT_LOG_VERSION_NO 1
@@ -201,6 +202,14 @@ typedef struct XTXactEndEntry {
XTDiskValue4 xe_not_used_4; /* Was the end sequence number (no longer used - v1.0.04+), set to zero). */
} XTXactEndEntryDRec, *XTXactEndEntryDPtr;
+typedef struct XTXactPrepareEntry {
+ xtWord1 xp_status_1; /* XT_LOG_ENT_PREPARE */
+ XTDiskValue2 xp_checksum_2;
+ XTDiskValue4 xp_xact_id_4; /* The transaction. */
+ xtWord1 xp_xa_len_1; /* The length of the XA data. */
+ xtWord1 xp_xa_data[XT_MAX_XA_DATA_SIZE];
+} XTXactPrepareEntryDRec, *XTXactPrepareEntryDPtr;
+
typedef struct XTXactCleanupEntry {
xtWord1 xc_status_1; /* XT_LOG_ENT_CLEANUP */
xtWord1 xc_checksum_1;
@@ -344,6 +353,7 @@ typedef union XTXactLogBuffer {
XTactOpSyncEntryDRec os;
XTactExtRecEntryDRec er;
XTactNoOpEntryDRec no;
+ XTXactPrepareEntryDRec xp;
} XTXactLogBufferDRec, *XTXactLogBufferDPtr;
/* ---------------------------------------- */
@@ -453,9 +463,9 @@ private:
xtBool xlog_open_log(xtLogID log_id, off_t curr_eof, struct XTThread *thread);
} XTDatabaseLogRec, *XTDatabaseLogPtr;
-xtBool xt_xlog_flush_log(struct XTThread *thread);
+xtBool xt_xlog_flush_log(struct XTDatabase *db, struct XTThread *thread);
xtBool xt_xlog_log_data(struct XTThread *thread, size_t len, XTXactLogBufferDPtr log_entry, xtBool commit);
-xtBool xt_xlog_modify_table(struct XTOpenTable *ot, u_int status, xtOpSeqNo op_seq, xtRecordID free_list, xtRecordID address, size_t size, xtWord1 *data);
+xtBool xt_xlog_modify_table(xtTableID tab_id, u_int status, xtOpSeqNo op_seq, xtRecordID free_list, xtRecordID address, size_t size, xtWord1 *data, struct XTThread *thread);
void xt_xlog_init(struct XTThread *self, size_t cache_size);
void xt_xlog_exit(struct XTThread *self);
=== modified file 'storage/pbxt/src/xt_config.h'
--- a/storage/pbxt/src/xt_config.h 2009-08-31 11:07:44 +0000
+++ b/storage/pbxt/src/xt_config.h 2009-11-24 10:55:06 +0000
@@ -50,7 +50,9 @@ const int max_connections = 500;
/*
* Make sure we use the thread safe version of the library.
*/
+#ifndef _THREAD_SAFE // Seems to be defined by some Drizzle header
#define _THREAD_SAFE
+#endif
/*
* This causes things to be defined like stuff in inttypes.h
@@ -72,12 +74,12 @@ const int max_connections = 500;
#define XT_MAC
#endif
-#if defined(MSDOS) || defined(__WIN__)
+#if defined(MSDOS) || defined(__WIN__) || defined(_WIN64)
#define XT_WIN
#endif
#ifdef XT_WIN
-#ifdef _DEBUG
+#if defined(_DEBUG) && !defined(DEBUG)
#define DEBUG
#endif // _DEBUG
#else
@@ -101,8 +103,13 @@ const int max_connections = 500;
* Definition of which atomic operations to use:
*/
#ifdef XT_WIN
+#ifdef _WIN64
+/* 64-bit Windows atomic ops are not yet supported: */
+#define XT_NO_ATOMICS
+#else
/* MS Studio style embedded assembler for x86 */
#define XT_ATOMIC_WIN32_X86
+#endif
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
/* Use GNU style embedded assembler for x86 */
#define XT_ATOMIC_GNUC_X86
@@ -115,4 +122,10 @@ const int max_connections = 500;
#define XT_NO_ATOMICS
#endif
+#ifndef DRIZZLED
+#if MYSQL_VERSION_ID >= 50404
+#define MYSQL_SUPPORTS_BACKUP
+#endif
+#endif
+
#endif
=== modified file 'storage/pbxt/src/xt_defs.h'
--- a/storage/pbxt/src/xt_defs.h 2009-08-17 11:12:36 +0000
+++ b/storage/pbxt/src/xt_defs.h 2009-11-24 10:55:06 +0000
@@ -379,6 +379,19 @@ typedef struct XTPathStr {
*/
//#define XT_IMPLEMENT_NO_ACTION
+/* Define this value if online-backup should be supported.
+ * Note that, online backup is currently only supported
+ * by MySQL 6.0.9 or later
+ */
+#define XT_ENABLE_ONLINE_BACKUP
+
+/* Define this switch if you don't want to use atomic
+ * synchronisation.
+ */
+#ifndef XT_NO_ATOMICS
+//#define XT_NO_ATOMICS
+#endif
+
/* ----------------------------------------------------------------------
* GLOBAL CONSTANTS
*/
@@ -406,6 +419,8 @@ typedef struct XTPathStr {
#define XT_ADD_PTR(p, l) ((void *) ((char *) (p) + (l)))
+#define XT_MAX_XA_DATA_SIZE (3*4 + 128) /* Corresponds to the maximum size of struct xid_t in handler.h. */
+
/* ----------------------------------------------------------------------
* DEFINES DEPENDENT ON CONSTANTS
*/
@@ -744,6 +759,7 @@ extern xtBool pbxt_crash_debug;
#define MYSQL_PLUGIN_VAR_HEADER DRIZZLE_PLUGIN_VAR_HEADER
#define MYSQL_SYSVAR_STR DRIZZLE_SYSVAR_STR
#define MYSQL_SYSVAR_INT DRIZZLE_SYSVAR_INT
+#define MYSQL_SYSVAR_BOOL DRIZZLE_SYSVAR_BOOL
#define MYSQL_SYSVAR DRIZZLE_SYSVAR
#define MYSQL_STORAGE_ENGINE_PLUGIN DRIZZLE_STORAGE_ENGINE_PLUGIN
#define MYSQL_INFORMATION_SCHEMA_PLUGIN DRIZZLE_INFORMATION_SCHEMA_PLUGIN
@@ -752,9 +768,8 @@ extern xtBool pbxt_crash_debug;
#define mx_tmp_use_all_columns(x, y) (x)->use_all_columns(y)
#define mx_tmp_restore_column_map(x, y) (x)->restore_column_map(y)
-#define MX_BIT_FAST_TEST_AND_SET(x, y) bitmap_test_and_set(x, y)
-#define MX_TABLE_TYPES_T handler::Table_flags
+#define MX_TABLE_TYPES_T Cursor::Table_flags
#define MX_UINT8_T uint8_t
#define MX_ULONG_T uint32_t
#define MX_ULONGLONG_T uint64_t
@@ -762,6 +777,10 @@ extern xtBool pbxt_crash_debug;
#define MX_CHARSET_INFO struct charset_info_st
#define MX_CONST_CHARSET_INFO const struct charset_info_st
#define MX_CONST const
+#define MX_BITMAP MyBitmap
+#define MX_BIT_SIZE() numOfBitsInMap()
+#define MX_BIT_SET(x, y) (x)->setBit(y)
+#define MX_BIT_FAST_TEST_AND_SET(x, y) (x)->testAndSet(y)
#define my_bool bool
#define int16 int16_t
@@ -771,6 +790,7 @@ extern xtBool pbxt_crash_debug;
#define uchar unsigned char
#define longlong int64_t
#define ulonglong uint64_t
+#define handler Cursor
#define HAVE_LONG_LONG
@@ -823,10 +843,13 @@ extern xtBool pbxt_crash_debug;
class PBXTStorageEngine;
typedef PBXTStorageEngine handlerton;
+class Session;
+
+extern "C" void session_mark_transaction_to_rollback(Session *session, bool all);
#else // DRIZZLED
/* The MySQL case: */
-#if MYSQL_VERSION_ID >= 60008
+#if MYSQL_VERSION_ID >= 50404
#define STRUCT_TABLE struct TABLE
#else
#define STRUCT_TABLE struct st_table
@@ -844,13 +867,13 @@ typedef PBXTStorageEngine handlerton;
#define MX_CHARSET_INFO CHARSET_INFO
#define MX_CONST_CHARSET_INFO struct charset_info_st
#define MX_CONST
+#define MX_BITMAP MY_BITMAP
+#define MX_BIT_SIZE() n_bits
+#define MX_BIT_SET(x, y) bitmap_set_bit(x, y)
#endif // DRIZZLED
-#define MX_BITMAP MY_BITMAP
-#define MX_BIT_SIZE() n_bits
#define MX_BIT_IS_SUBSET(x, y) bitmap_is_subset(x, y)
-#define MX_BIT_SET(x, y) bitmap_set_bit(x, y)
#ifndef XT_SCAN_CORE_DEFINED
#define XT_SCAN_CORE_DEFINED
=== modified file 'storage/pbxt/src/xt_errno.h'
--- a/storage/pbxt/src/xt_errno.h 2009-09-03 06:15:03 +0000
+++ b/storage/pbxt/src/xt_errno.h 2009-11-24 10:55:06 +0000
@@ -119,6 +119,9 @@
#define XT_ERR_FK_REF_TEMP_TABLE -95
#define XT_ERR_MYSQL_SHUTDOWN -98
#define XT_ERR_MYSQL_NO_THREAD -99
+#define XT_ERR_BUFFER_TOO_SMALL -100
+#define XT_ERR_BAD_BACKUP_FORMAT -101
+#define XT_ERR_PBXT_NOT_INSTALLED -102
#ifdef XT_WIN
#define XT_ENOMEM ERROR_NOT_ENOUGH_MEMORY
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 02 Dec '09
by worklog-noreply@askmonty.org 02 Dec '09
02 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-row-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 02 Dec '09
by worklog-noreply@askmonty.org 02 Dec '09
02 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-row-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 02 Dec '09
by worklog-noreply@askmonty.org 02 Dec '09
02 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-row-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 02 Dec '09
by worklog-noreply@askmonty.org 02 Dec '09
02 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-row-events options set.
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
[ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 02 Dec '09
by worklog-noreply@askmonty.org 02 Dec '09
02 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-row-events options set.
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
[ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 02 Dec '09
by worklog-noreply@askmonty.org 02 Dec '09
02 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-row-events options set.
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
[ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2774: Fixed link problem when compiling without uca
by noreply@launchpad.net 01 Dec '09
by noreply@launchpad.net 01 Dec '09
01 Dec '09
------------------------------------------------------------
revno: 2774
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mariadb-5.1
timestamp: Tue 2009-12-01 18:09:02 +0200
message:
Fixed link problem when compiling without uca
modified:
cmd-line-utils/readline/config_readline.h
strings/ctype-uca.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 2773: Automerge Daniel's README fixes.
by noreply@launchpad.net 01 Dec '09
by noreply@launchpad.net 01 Dec '09
01 Dec '09
Merge authors:
Daniel Bartholomew (dbart)
Related merge proposals:
https://code.launchpad.net/~dbart/maria/maria-5.1-docmods/+merge/14679
proposed by: Daniel Bartholomew (dbart)
------------------------------------------------------------
revno: 2773 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Tue 2009-12-01 08:42:58 +0100
message:
Automerge Daniel's README fixes.
modified:
README
--
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 2772: Merge free documentation from MySQL 5.1.41 source tarball into MariaDB.
by noreply@launchpad.net 01 Dec '09
by noreply@launchpad.net 01 Dec '09
01 Dec '09
Merge authors:
Kristian Nielsen (knielsen)
------------------------------------------------------------
revno: 2772 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Tue 2009-12-01 08:38:15 +0100
message:
Merge free documentation from MySQL 5.1.41 source tarball into MariaDB.
modified:
Docs/INSTALL-BINARY
INSTALL-SOURCE
INSTALL-WIN-SOURCE
man/comp_err.1
man/innochecksum.1
man/make_win_bin_dist.1
man/msql2mysql.1
man/my_print_defaults.1
man/myisam_ftdump.1
man/myisamchk.1
man/myisamlog.1
man/myisampack.1
man/mysql-stress-test.pl.1
man/mysql-test-run.pl.1
man/mysql.1
man/mysql.server.1
man/mysql_client_test.1
man/mysql_config.1
man/mysql_convert_table_format.1
man/mysql_find_rows.1
man/mysql_fix_extensions.1
man/mysql_fix_privilege_tables.1
man/mysql_install_db.1
man/mysql_secure_installation.1
man/mysql_setpermission.1
man/mysql_tzinfo_to_sql.1
man/mysql_upgrade.1
man/mysql_waitpid.1
man/mysql_zap.1
man/mysqlaccess.1
man/mysqladmin.1
man/mysqlbinlog.1
man/mysqlbug.1
man/mysqlcheck.1
man/mysqld.8
man/mysqld_multi.1
man/mysqld_safe.1
man/mysqldump.1
man/mysqldumpslow.1
man/mysqlhotcopy.1
man/mysqlimport.1
man/mysqlmanager.8
man/mysqlshow.1
man/mysqlslap.1
man/mysqltest.1
man/ndbd.8
man/ndbd_redo_log_reader.1
man/ndbmtd.8
man/perror.1
man/replace.1
man/resolve_stack_dump.1
man/resolveip.1
scripts/fill_help_tables.sql
support-files/MacOSX/ReadMe.txt
The size of the diff (15484 lines) is larger than your specified limit of 5000 lines
--
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 2771: Merge MySQL 5.1.41 into MariaDB trunk, including a number of after-merge fixes.
by noreply@launchpad.net 01 Dec '09
by noreply@launchpad.net 01 Dec '09
01 Dec '09
Merge authors:
<Dao-Gang.Qu(a)sun.com>
<Li-Bing.Song(a)sun.com>
Alexander Barkov <bar(a)mysql.com>
Alexander Nozdrin <alik(a)sun.com>
Alexey Botchkov <holyfoot(a)mysql.com>...
------------------------------------------------------------
revno: 2771 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Mon 2009-11-30 22:37:27 +0100
message:
Merge MySQL 5.1.41 into MariaDB trunk, including a number of after-merge fixes.
Also merge charset patch.
removed:
mysql-test/include/have_dynamic_loading.inc
mysys/mf_strip.c
storage/innodb_plugin/README
storage/innodb_plugin/handler/handler0vars.h
storage/innodb_plugin/handler/win_delay_loader.cc
storage/innodb_plugin/win-plugin/
storage/innodb_plugin/win-plugin/README
storage/innodb_plugin/win-plugin/win-plugin.diff
added:
mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test
mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test
mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test
mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test
mysql-test/include/have_case_insensitive_fs.inc
mysql-test/include/have_debug_sync.inc
mysql-test/include/have_dynamic_loading.inc
mysql-test/include/have_mysql_upgrade.inc
mysql-test/include/have_not_innodb_plugin.inc
mysql-test/include/not_windows_embedded.inc
mysql-test/lib/v1/incompatible.tests
mysql-test/r/bug46760.result
mysql-test/r/case_insensitive_fs.require
mysql-test/r/debug_sync.result
mysql-test/r/grant_lowercase_fs.result
mysql-test/r/have_debug_sync.require
mysql-test/r/innodb_bug44369.result
mysql-test/r/innodb_bug46000.result
mysql-test/r/innodb_bug47777.result
mysql-test/r/locale.result
mysql-test/r/lowercase_mixed_tmpdir_innodb.result
mysql-test/r/not_true.require
mysql-test/r/partition_innodb_builtin.result
mysql-test/r/partition_innodb_plugin.result
mysql-test/r/partition_open_files_limit.result
mysql-test/r/sp-bugs.result
mysql-test/r/subselect4.result
mysql-test/std_data/binlog_transaction.000001
mysql-test/std_data/latin1.xml
mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result
mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result
mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result
mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result
mysql-test/suite/binlog/r/binlog_stm_do_db.result
mysql-test/suite/binlog/std_data/update-full-row.binlog
mysql-test/suite/binlog/std_data/update-partial-row.binlog
mysql-test/suite/binlog/std_data/write-full-row.binlog
mysql-test/suite/binlog/std_data/write-partial-row.binlog
mysql-test/suite/binlog/t/binlog_delete_and_flush_index.test
mysql-test/suite/binlog/t/binlog_mixed_failure_mixing_engines.test
mysql-test/suite/binlog/t/binlog_row_failure_mixing_engines.test
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test
mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
mysql-test/suite/binlog/t/binlog_stm_do_db.test
mysql-test/suite/federated/federated_debug-master.opt
mysql-test/suite/federated/federated_debug.result
mysql-test/suite/federated/federated_debug.test
mysql-test/suite/innodb/r/innodb-consistent.result
mysql-test/suite/innodb/r/innodb_bug44571.result
mysql-test/suite/innodb/t/innodb-consistent-master.opt
mysql-test/suite/innodb/t/innodb-consistent.test
mysql-test/suite/innodb/t/innodb_bug44571.test
mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result
mysql-test/suite/rpl/r/rpl_mysql_upgrade.result
mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result
mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock-slave.opt
mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test
mysql-test/t/bug46760-master.opt
mysql-test/t/bug46760.test
mysql-test/t/debug_sync.test
mysql-test/t/grant_lowercase_fs.test
mysql-test/t/innodb_bug44369.test
mysql-test/t/innodb_bug46000.test
mysql-test/t/innodb_bug47777.test
mysql-test/t/locale.test
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh
mysql-test/t/lowercase_mixed_tmpdir_innodb.test
mysql-test/t/partition_innodb_builtin.test
mysql-test/t/partition_innodb_plugin.test
mysql-test/t/partition_open_files_limit-master.opt
mysql-test/t/partition_open_files_limit.test
mysql-test/t/sp-bugs.test
mysql-test/t/status-master.opt
mysql-test/t/subselect4.test
sql/debug_sync.cc
sql/debug_sync.h
storage/innodb_plugin/mysql-test/innodb-consistent-master.opt
storage/innodb_plugin/mysql-test/innodb-consistent.result
storage/innodb_plugin/mysql-test/innodb-consistent.test
storage/innodb_plugin/mysql-test/innodb_bug44369.result
storage/innodb_plugin/mysql-test/innodb_bug44369.test
storage/innodb_plugin/mysql-test/innodb_bug44571.result
storage/innodb_plugin/mysql-test/innodb_bug44571.test
storage/innodb_plugin/mysql-test/innodb_bug46000.result
storage/innodb_plugin/mysql-test/innodb_bug46000.test
storage/innodb_plugin/revert_gen.sh
storage/innodb_plugin/scripts/export.sh
storage/innodb_plugin/ut/ut0auxconf_have_gcc_atomics.c
renamed:
mysql-test/r/bug40113.result => mysql-test/r/innodb_lock_wait_timeout_1.result
mysql-test/t/bug40113-master.opt => mysql-test/t/innodb_lock_wait_timeout_1-master.opt
mysql-test/t/bug40113.test => mysql-test/t/innodb_lock_wait_timeout_1.test
modified:
.bzrignore
CMakeLists.txt
Makefile.am
client/mysql.cc
client/mysql_upgrade.c
client/mysqlbinlog.cc
client/mysqlcheck.c
client/mysqlimport.c
client/mysqlslap.c
client/mysqltest.cc
cmd-line-utils/readline/config_readline.h
cmd-line-utils/readline/display.c
configure.in
extra/yassl/include/yassl_int.hpp
extra/yassl/taocrypt/src/random.cpp
include/m_ctype.h
include/my_dbug.h
include/my_sys.h
include/myisamchk.h
include/mysql.h
include/mysql.h.pp
include/violite.h
libmysql/libmysql.c
libmysql/libmysql.def
libmysqld/CMakeLists.txt
libmysqld/Makefile.am
libmysqld/lib_sql.cc
libmysqld/libmysqld.c
libmysqld/libmysqld.def
mysql-test/collections/README.experimental
mysql-test/collections/default.experimental
mysql-test/extra/binlog_tests/binlog.test
mysql-test/extra/binlog_tests/drop_temp_table.test
mysql-test/extra/rpl_tests/rpl_auto_increment.test
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
mysql-test/extra/rpl_tests/rpl_failed_optimize.test
mysql-test/extra/rpl_tests/rpl_loaddata.test
mysql-test/extra/rpl_tests/rpl_row_sp006.test
mysql-test/extra/rpl_tests/rpl_stm_000001.test
mysql-test/include/check-warnings.test
mysql-test/include/concurrent.inc
mysql-test/include/have_example_plugin.inc
mysql-test/include/have_simple_parser.inc
mysql-test/include/have_udf.inc
mysql-test/include/mix1.inc
mysql-test/include/mtr_warnings.sql
mysql-test/lib/My/ConfigFactory.pm
mysql-test/lib/My/Platform.pm
mysql-test/lib/My/SafeProcess/safe_kill_win.cc
mysql-test/lib/My/SafeProcess/safe_process_win.cc
mysql-test/lib/mtr_cases.pm
mysql-test/lib/mtr_report.pm
mysql-test/lib/v1/mtr_cases.pl
mysql-test/mysql-stress-test.pl
mysql-test/mysql-test-run.pl
mysql-test/r/almost_full.result
mysql-test/r/alter_table.result
mysql-test/r/analyse.result
mysql-test/r/archive.result
mysql-test/r/bug46080.result
mysql-test/r/create.result
mysql-test/r/ctype_ldml.result
mysql-test/r/ctype_uca.result
mysql-test/r/delete.result
mysql-test/r/distinct.result
mysql-test/r/explain.result
mysql-test/r/func_group.result
mysql-test/r/func_in.result
mysql-test/r/func_str.result
mysql-test/r/gis-rtree.result
mysql-test/r/gis.result
mysql-test/r/grant.result
mysql-test/r/grant3.result
mysql-test/r/group_min_max.result
mysql-test/r/information_schema_db.result
mysql-test/r/innodb-autoinc.result
mysql-test/r/innodb-index.result
mysql-test/r/innodb_file_format.result
mysql-test/r/innodb_mysql.result
mysql-test/r/insert_select.result
mysql-test/r/join.result
mysql-test/r/lowercase_fs_off.result
mysql-test/r/lowercase_table3.result
mysql-test/r/myisam.result
mysql-test/r/myisam_crash_before_flush_keys.result
mysql-test/r/mysqlbinlog.result
mysql-test/r/mysqltest.result
mysql-test/r/olap.result
mysql-test/r/order_by.result
mysql-test/r/partition.result
mysql-test/r/partition_csv.result
mysql-test/r/partition_innodb.result
mysql-test/r/partition_pruning.result
mysql-test/r/ps_grant.result
mysql-test/r/query_cache.result
mysql-test/r/range.result
mysql-test/r/select.result
mysql-test/r/sp-error.result
mysql-test/r/sp.result
mysql-test/r/subselect.result
mysql-test/r/subselect3.result
mysql-test/r/system_mysql_db.result
mysql-test/r/trigger_notembedded.result
mysql-test/r/type_bit.result
mysql-test/r/type_newdecimal.result
mysql-test/r/udf.result
mysql-test/r/update.result
mysql-test/r/upgrade.result
mysql-test/r/view_grant.result
mysql-test/r/warnings.result
mysql-test/r/windows.result
mysql-test/r/xa.result
mysql-test/std_data/Index.xml
mysql-test/suite/binlog/r/binlog_killed_simulate.result
mysql-test/suite/binlog/r/binlog_row_binlog.result
mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
mysql-test/suite/binlog/r/binlog_stm_binlog.result
mysql-test/suite/binlog/r/binlog_stm_blackhole.result
mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test
mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
mysql-test/suite/federated/my.cnf
mysql-test/suite/funcs_1/r/is_columns_mysql.result
mysql-test/suite/funcs_1/r/is_statistics.result
mysql-test/suite/innodb/r/innodb-zip.result
mysql-test/suite/innodb/t/innodb-zip.test
mysql-test/suite/innodb/t/innodb_information_schema.test
mysql-test/suite/parts/inc/partition_auto_increment.inc
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
mysql-test/suite/parts/r/partition_auto_increment_maria.result
mysql-test/suite/parts/r/partition_auto_increment_memory.result
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
mysql-test/suite/parts/r/partition_recover_myisam.result
mysql-test/suite/parts/t/partition_auto_increment_archive.test
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test
mysql-test/suite/parts/t/partition_recover_myisam.test
mysql-test/suite/pbxt/r/func_group.result
mysql-test/suite/pbxt/r/grant.result
mysql-test/suite/pbxt/r/group_min_max.result
mysql-test/suite/pbxt/r/join_nested.result
mysql-test/suite/pbxt/r/negation_elimination.result
mysql-test/suite/pbxt/r/ps_grant.result
mysql-test/suite/pbxt/r/skip_grants.result
mysql-test/suite/pbxt/r/subselect.result
mysql-test/suite/pbxt/r/view_grant.result
mysql-test/suite/pbxt/t/grant.test
mysql-test/suite/pbxt/t/ps_grant.test
mysql-test/suite/pbxt/t/subselect.test
mysql-test/suite/rpl/r/rpl_auto_increment.result
mysql-test/suite/rpl/r/rpl_bug33931.result
mysql-test/suite/rpl/r/rpl_do_grant.result
mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
mysql-test/suite/rpl/r/rpl_idempotency.result
mysql-test/suite/rpl/r/rpl_init_slave_errors.result
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
mysql-test/suite/rpl/r/rpl_loaddata.result
mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
mysql-test/suite/rpl/r/rpl_loaddata_map.result
mysql-test/suite/rpl/r/rpl_loaddatalocal.result
mysql-test/suite/rpl/r/rpl_log_pos.result
mysql-test/suite/rpl/r/rpl_packet.result
mysql-test/suite/rpl/r/rpl_row_create_table.result
mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
mysql-test/suite/rpl/r/rpl_stm_log.result
mysql-test/suite/rpl/r/rpl_temporary_errors.result
mysql-test/suite/rpl/t/disabled.def
mysql-test/suite/rpl/t/rpl_bug33931.test
mysql-test/suite/rpl/t/rpl_do_grant.test
mysql-test/suite/rpl/t/rpl_drop_temp.test
mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
mysql-test/suite/rpl/t/rpl_idempotency.test
mysql-test/suite/rpl/t/rpl_init_slave_errors.test
mysql-test/suite/rpl/t/rpl_loaddatalocal.test
mysql-test/suite/rpl/t/rpl_log_pos.test
mysql-test/suite/rpl/t/rpl_packet.test
mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
mysql-test/suite/rpl/t/rpl_temporary_errors.test
mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
mysql-test/t/almost_full.test
mysql-test/t/alter_table.test
mysql-test/t/analyse.test
mysql-test/t/archive.test
mysql-test/t/bug46080.test
mysql-test/t/create.test
mysql-test/t/ctype_ldml.test
mysql-test/t/ctype_uca.test
mysql-test/t/delete.test
mysql-test/t/disabled.def
mysql-test/t/distinct.test
mysql-test/t/explain.test
mysql-test/t/flush_read_lock_kill.test
mysql-test/t/func_group.test
mysql-test/t/func_in.test
mysql-test/t/func_str.test
mysql-test/t/gis-rtree.test
mysql-test/t/gis.test
mysql-test/t/grant3.test
mysql-test/t/information_schema_db.test
mysql-test/t/innodb-autoinc.test
mysql-test/t/innodb-index.test
mysql-test/t/innodb_bug39438.test
mysql-test/t/innodb_file_format.test
mysql-test/t/innodb_mysql.test
mysql-test/t/insert_select.test
mysql-test/t/join.test
mysql-test/t/kill.test
mysql-test/t/lowercase_fs_off.test
mysql-test/t/lowercase_table3.test
mysql-test/t/myisam-system.test
mysql-test/t/myisam.test
mysql-test/t/myisam_crash_before_flush_keys.test
mysql-test/t/mysqlbinlog.test
mysql-test/t/mysqltest.test
mysql-test/t/named_pipe.test
mysql-test/t/olap.test
mysql-test/t/order_by.test
mysql-test/t/partition.test
mysql-test/t/partition_csv.test
mysql-test/t/partition_innodb.test
mysql-test/t/plugin.test
mysql-test/t/plugin_load.test
mysql-test/t/ps_not_windows.test
mysql-test/t/query_cache.test
mysql-test/t/range.test
mysql-test/t/select.test
mysql-test/t/sp-error.test
mysql-test/t/sp.test
mysql-test/t/subselect.test
mysql-test/t/subselect3.test
mysql-test/t/type_bit.test
mysql-test/t/type_newdecimal.test
mysql-test/t/udf.test
mysql-test/t/update.test
mysql-test/t/upgrade.test
mysql-test/t/view_grant.test
mysql-test/t/warnings.test
mysql-test/t/windows.test
mysql-test/t/xa.test
mysql-test/valgrind.supp
mysys/CMakeLists.txt
mysys/Makefile.am
mysys/charset-def.c
mysys/hash.c
mysys/mf_keycache.c
mysys/my_copy.c
mysys/my_getopt.c
mysys/my_largepage.c
mysys/my_static.c
mysys/my_thr_init.c
mysys/my_wincond.c
mysys/thr_lock.c
mysys/typelib.c
regex/CMakeLists.txt
scripts/make_win_bin_dist
scripts/mysql_system_tables.sql
scripts/mysql_system_tables_fix.sql
sql-common/client.c
sql-common/my_time.c
sql/CMakeLists.txt
sql/Makefile.am
sql/event_data_objects.cc
sql/events.cc
sql/field.cc
sql/field.h
sql/ha_ndbcluster.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_partition.cc
sql/ha_partition.h
sql/handler.cc
sql/handler.h
sql/item.cc
sql/item.h
sql/item_cmpfunc.cc
sql/item_cmpfunc.h
sql/item_func.cc
sql/item_func.h
sql/item_geofunc.cc
sql/item_strfunc.cc
sql/item_subselect.cc
sql/item_sum.cc
sql/item_timefunc.cc
sql/item_xmlfunc.cc
sql/log.cc
sql/log_event.cc
sql/log_event.h
sql/log_event_old.cc
sql/my_decimal.h
sql/mysql_priv.h
sql/mysqld.cc
sql/opt_range.cc
sql/opt_sum.cc
sql/partition_info.cc
sql/records.cc
sql/repl_failsafe.cc
sql/rpl_filter.cc
sql/set_var.cc
sql/set_var.h
sql/share/errmsg.txt
sql/slave.cc
sql/slave.h
sql/sp.cc
sql/sp_head.cc
sql/sql_acl.cc
sql/sql_base.cc
sql/sql_binlog.cc
sql/sql_cache.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_db.cc
sql/sql_delete.cc
sql/sql_handler.cc
sql/sql_insert.cc
sql/sql_lex.h
sql/sql_load.cc
sql/sql_locale.cc
sql/sql_parse.cc
sql/sql_partition.cc
sql/sql_plugin.cc
sql/sql_prepare.cc
sql/sql_rename.cc
sql/sql_repl.cc
sql/sql_select.cc
sql/sql_select.h
sql/sql_show.cc
sql/sql_table.cc
sql/sql_tablespace.cc
sql/sql_trigger.cc
sql/sql_udf.cc
sql/sql_update.cc
sql/sql_view.cc
sql/sql_yacc.yy
sql/structs.h
sql/table.cc
sql/table.h
sql/time.cc
sql/udf_example.c
sql/unireg.cc
storage/archive/ha_archive.cc
storage/blackhole/ha_blackhole.cc
storage/csv/ha_tina.cc
storage/federatedx/ha_federatedx.cc
storage/heap/hp_write.c
storage/innobase/dict/dict0dict.c
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.h
storage/innobase/os/os0proc.c
storage/innobase/row/row0mysql.c
storage/innodb_plugin/CMakeLists.txt
storage/innodb_plugin/ChangeLog
storage/innodb_plugin/Makefile.am
storage/innodb_plugin/btr/btr0btr.c
storage/innodb_plugin/btr/btr0sea.c
storage/innodb_plugin/buf/buf0buf.c
storage/innodb_plugin/buf/buf0flu.c
storage/innodb_plugin/buf/buf0lru.c
storage/innodb_plugin/buf/buf0rea.c
storage/innodb_plugin/dict/dict0crea.c
storage/innodb_plugin/dict/dict0dict.c
storage/innodb_plugin/fil/fil0fil.c
storage/innodb_plugin/fsp/fsp0fsp.c
storage/innodb_plugin/handler/ha_innodb.cc
storage/innodb_plugin/handler/ha_innodb.h
storage/innodb_plugin/handler/handler0alter.cc
storage/innodb_plugin/include/buf0buf.h
storage/innodb_plugin/include/buf0buf.ic
storage/innodb_plugin/include/buf0lru.h
storage/innodb_plugin/include/buf0rea.h
storage/innodb_plugin/include/buf0types.h
storage/innodb_plugin/include/dict0crea.h
storage/innodb_plugin/include/dict0dict.h
storage/innodb_plugin/include/dict0mem.h
storage/innodb_plugin/include/fsp0fsp.h
storage/innodb_plugin/include/lock0lock.h
storage/innodb_plugin/include/log0log.h
storage/innodb_plugin/include/log0log.ic
storage/innodb_plugin/include/log0recv.h
storage/innodb_plugin/include/mtr0mtr.h
storage/innodb_plugin/include/os0file.h
storage/innodb_plugin/include/os0sync.h
storage/innodb_plugin/include/page0page.h
storage/innodb_plugin/include/page0page.ic
storage/innodb_plugin/include/page0zip.h
storage/innodb_plugin/include/rem0cmp.h
storage/innodb_plugin/include/rem0rec.ic
storage/innodb_plugin/include/row0ins.h
storage/innodb_plugin/include/row0mysql.h
storage/innodb_plugin/include/srv0srv.h
storage/innodb_plugin/include/trx0rec.h
storage/innodb_plugin/include/trx0rec.ic
storage/innodb_plugin/include/trx0roll.h
storage/innodb_plugin/include/trx0sys.ic
storage/innodb_plugin/include/trx0trx.h
storage/innodb_plugin/include/univ.i
storage/innodb_plugin/include/ut0auxconf.h
storage/innodb_plugin/include/ut0byte.h
storage/innodb_plugin/include/ut0byte.ic
storage/innodb_plugin/include/ut0ut.h
storage/innodb_plugin/lock/lock0lock.c
storage/innodb_plugin/log/log0log.c
storage/innodb_plugin/log/log0recv.c
storage/innodb_plugin/mem/mem0mem.c
storage/innodb_plugin/mtr/mtr0mtr.c
storage/innodb_plugin/mysql-test/innodb-analyze.test
storage/innodb_plugin/mysql-test/innodb-zip.result
storage/innodb_plugin/mysql-test/innodb-zip.test
storage/innodb_plugin/mysql-test/innodb_bug34300.test
storage/innodb_plugin/mysql-test/innodb_bug36169.test
storage/innodb_plugin/mysql-test/innodb_bug36172.test
storage/innodb_plugin/mysql-test/innodb_file_format.result
storage/innodb_plugin/mysql-test/innodb_file_format.test
storage/innodb_plugin/os/os0file.c
storage/innodb_plugin/os/os0proc.c
storage/innodb_plugin/page/page0cur.c
storage/innodb_plugin/page/page0page.c
storage/innodb_plugin/page/page0zip.c
storage/innodb_plugin/plug.in.disabled
storage/innodb_plugin/rem/rem0cmp.c
storage/innodb_plugin/row/row0ins.c
storage/innodb_plugin/row/row0merge.c
storage/innodb_plugin/row/row0mysql.c
storage/innodb_plugin/srv/srv0srv.c
storage/innodb_plugin/srv/srv0start.c
storage/innodb_plugin/sync/sync0rw.c
storage/innodb_plugin/sync/sync0sync.c
storage/innodb_plugin/thr/thr0loc.c
storage/innodb_plugin/trx/trx0rec.c
storage/innodb_plugin/trx/trx0roll.c
storage/innodb_plugin/trx/trx0trx.c
storage/innodb_plugin/ut/ut0auxconf_atomic_pthread_t_solaris.c
storage/innodb_plugin/ut/ut0ut.c
storage/maria/ha_maria.cc
storage/myisam/ha_myisam.cc
storage/myisam/mi_check.c
storage/myisam/mi_search.c
storage/myisam/mi_write.c
storage/myisam/myisamchk.c
storage/myisam/sort.c
storage/myisammrg/myrg_open.c
storage/mysql_storage_engine.cmake
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
storage/ndb/src/kernel/blocks/suma/Suma.cpp
storage/pbxt/src/discover_xt.cc
storage/xtradb/dict/dict0dict.c
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.h
storage/xtradb/handler/handler0alter.cc
strings/ctype-mb.c
strings/ctype-simple.c
strings/ctype-uca.c
strings/ctype-ucs2.c
support-files/binary-configure.sh
tests/mysql_client_test.c
unittest/mysys/Makefile.am
vio/vio.c
vio/vio_priv.h
vio/viosocket.c
vio/viosslfactories.c
mysql-test/r/innodb_lock_wait_timeout_1.result
mysql-test/t/innodb_lock_wait_timeout_1.test
The size of the diff (41758 lines) is larger than your specified limit of 5000 lines
--
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 2770: Fixes after comments from last push:
by noreply@launchpad.net 01 Dec '09
by noreply@launchpad.net 01 Dec '09
01 Dec '09
------------------------------------------------------------
revno: 2770
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Mon 2009-11-30 15:36:06 +0200
message:
Fixes after comments from last push:
- Removed some not needed casts
- Change plugin.h to be 'binary compatible' with old versions
- Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change
- Made some fixes suggested by Kristian to make things more portable and future safe (when it comes to strict aliasing)
modified:
include/ft_global.h
include/mysql/plugin.h
include/mysql/plugin.h.pp
mysql-test/t/information_schema.test
sql/sp_head.cc
sql/sql_select.cc
sql/table.cc
storage/maria/ma_ft_boolean_search.c
storage/maria/ma_ft_nlq_search.c
storage/maria/ma_ft_parser.c
storage/maria/ma_ftdefs.h
storage/maria/maria_ftdump.c
storage/myisam/ft_boolean_search.c
storage/myisam/ft_nlq_search.c
storage/myisam/ft_parser.c
storage/myisam/myisam_ftdump.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 2769: Automatic merge
by noreply@launchpad.net 01 Dec '09
by noreply@launchpad.net 01 Dec '09
01 Dec '09
Merge authors:
Michael Widenius (monty)
------------------------------------------------------------
revno: 2769 [merge]
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Mon 2009-11-30 13:13:02 +0200
message:
Automatic merge
modified:
.bzrignore
BUILD/compile-pentium
client/mysql_upgrade.c
cmd-line-utils/readline/config_readline.h
cmd-line-utils/readline/display.c
cmd-line-utils/readline/history.c
cmd-line-utils/readline/rlmbutil.h
cmd-line-utils/readline/text.c
cmd-line-utils/readline/xmalloc.c
configure.in
include/mysql/plugin.h
include/mysql/plugin.h.pp
libmysql/libmysql.c
mysql-test/t/information_schema.test
mysql-test/t/not_partition.test
mysys/lf_hash.c
mysys/my_redel.c
regex/engine.c
regex/engine.ih
sql/log_event.cc
sql/mysqld.cc
sql/scheduler.cc
sql/sp_head.cc
sql/sql_base.cc
sql/sql_builtin.cc.in
sql/sql_class.cc
sql/sql_class.h
sql/sql_insert.cc
sql/sql_parse.cc
sql/sql_select.cc
sql/sql_show.cc
sql/table.cc
storage/maria/ha_maria.cc
storage/maria/lockman.c
storage/maria/ma_check.c
storage/maria/ma_check_standalone.h
storage/maria/ma_ft_boolean_search.c
storage/maria/ma_ft_nlq_search.c
storage/maria/ma_ft_parser.c
storage/maria/ma_ftdefs.h
storage/maria/ma_sort.c
storage/maria/ma_state.c
storage/maria/maria_def.h
storage/maria/maria_ftdump.c
storage/maria/trnman.c
storage/myisam/ft_boolean_search.c
storage/myisam/ft_nlq_search.c
storage/myisam/ft_parser.c
storage/myisam/ft_stopwords.c
storage/myisam/ftdefs.h
storage/myisam/ha_myisam.cc
storage/myisam/mi_check.c
storage/myisam/myisam_ftdump.c
storage/myisam/myisamchk.c
storage/myisam/myisamdef.h
storage/myisam/myisamlog.c
storage/myisam/sort.c
storage/xtradb/fil/fil0fil.c
storage/xtradb/trx/trx0i_s.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] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2774)
by Michael Widenius 01 Dec '09
by Michael Widenius 01 Dec '09
01 Dec '09
#At lp:maria based on revid:knielsen@knielsen-hq.org-20091201074258-sbl29hdqa39h6tgz
2774 Michael Widenius 2009-12-01
Fixed link problem when compiling without uca
modified:
cmd-line-utils/readline/config_readline.h
strings/ctype-uca.c
per-file messages:
cmd-line-utils/readline/config_readline.h
Add back defines needed for linux to get rid of compiler warnings, but hide them for now until we have a solution for compile failure on MacOSX
strings/ctype-uca.c
Always define UCA contraction functions used by ctype-mb.c
=== modified file 'cmd-line-utils/readline/config_readline.h'
--- a/cmd-line-utils/readline/config_readline.h 2009-11-30 21:37:27 +0000
+++ b/cmd-line-utils/readline/config_readline.h 2009-12-01 16:09:02 +0000
@@ -7,6 +7,13 @@
# include <config.h>
#endif
+#ifdef NOT_YET /* causes problem on MacOSX */
+/* to get wcwidth() defined */
+#define _XOPEN_SOURCE 600
+#define _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_
+#endif
+
/*
Ultrix botches type-ahead when switching from canonical to
non-canonical mode, at least through version 4.3
=== modified file 'strings/ctype-uca.c'
--- a/strings/ctype-uca.c 2009-11-30 12:42:24 +0000
+++ b/strings/ctype-uca.c 2009-12-01 16:09:02 +0000
@@ -36,6 +36,12 @@
#include "m_string.h"
#include "m_ctype.h"
+
+#define MY_UCA_CNT_FLAG_SIZE 4096
+#define MY_UCA_CNT_FLAG_MASK 4095
+#define MY_UCA_CNT_HEAD 1
+#define MY_UCA_CNT_TAIL 2
+
#ifdef HAVE_UCA_COLLATIONS
#define MY_UCA_NPAGES 256
@@ -6756,16 +6762,6 @@ typedef struct my_uca_scanner_handler_st
static uint16 nochar[]= {0,0};
-
-#define MY_UCA_CNT_FLAG_SIZE 4096
-#define MY_UCA_CNT_FLAG_MASK 4095
-
-#define MY_UCA_CNT_HEAD 1
-#define MY_UCA_CNT_TAIL 2
-
-
-
-
/********** Helper functions to handle contraction ************/
@@ -6836,85 +6832,6 @@ my_uca_alloc_contractions(CHARSET_INFO *
return 0;
}
-
-/**
- Check if UCA data has contractions (public version)
-
- @cs Pointer to CHARSET_INFO data
- @retval 0 - no contraction, 1 - have contractions.
-*/
-
-my_bool
-my_uca_have_contractions(CHARSET_INFO *cs)
-{
- return cs->contractions != NULL;
-}
-
-
-/**
- Check if a character can be contraction head
-
- @cs Pointer to CHARSET_INFO data
- @wc Code point
-
- @retval 0 - cannot be contraction head
- @retval 1 - can be contraction head
-*/
-
-my_bool
-my_uca_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc)
-{
- return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_HEAD;
-}
-
-
-/**
- Check if a character can be contraction tail
-
- @cs Pointer to CHARSET_INFO data
- @wc Code point
-
- @retval 0 - cannot be contraction tail
- @retval 1 - can be contraction tail
-*/
-
-my_bool
-my_uca_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc)
-{
- return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_TAIL;
-}
-
-
-/**
- Find a contraction and return its weight array
-
- @cs Pointer to CHARSET data
- @wc1 First character
- @wc2 Second character
-
- @return Weight array
- @retval NULL - no contraction found
- @retval ptr - contraction weight array
-*/
-
-uint16 *
-my_uca_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
-{
- MY_CONTRACTIONS *list= cs->contractions;
- MY_CONTRACTION *c, *last;
- for (c= list->item, last= &list->item[list->nitems]; c < last; c++)
- {
- if (c->ch[0] == wc1 && c->ch[1] == wc2)
- {
- return c->weight;
- }
- }
- return NULL;
-}
-
-
-
-
#ifdef HAVE_CHARSET_ucs2
/*
Initialize collation weight scanner
@@ -9607,3 +9524,78 @@ CHARSET_INFO my_charset_utf8_croatian_uc
#endif /* HAVE_CHARSET_utf8 */
#endif /* HAVE_UCA_COLLATIONS */
+
+/**
+ Check if UCA data has contractions (public version)
+
+ @cs Pointer to CHARSET_INFO data
+ @retval 0 - no contraction, 1 - have contractions.
+*/
+
+my_bool
+my_uca_have_contractions(CHARSET_INFO *cs)
+{
+ return cs->contractions != NULL;
+}
+
+/**
+ Check if a character can be contraction head
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Code point
+
+ @retval 0 - cannot be contraction head
+ @retval 1 - can be contraction head
+*/
+
+my_bool
+my_uca_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_HEAD;
+}
+
+
+/**
+ Check if a character can be contraction tail
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Code point
+
+ @retval 0 - cannot be contraction tail
+ @retval 1 - can be contraction tail
+*/
+
+my_bool
+my_uca_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_TAIL;
+}
+
+
+/**
+ Find a contraction and return its weight array
+
+ @cs Pointer to CHARSET data
+ @wc1 First character
+ @wc2 Second character
+
+ @return Weight array
+ @retval NULL - no contraction found
+ @retval ptr - contraction weight array
+*/
+
+uint16 *
+my_uca_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
+{
+ MY_CONTRACTIONS *list= cs->contractions;
+ MY_CONTRACTION *c, *last;
+ for (c= list->item, last= &list->item[list->nitems]; c < last; c++)
+ {
+ if (c->ch[0] == wc1 && c->ch[1] == wc2)
+ {
+ return c->weight;
+ }
+ }
+ return NULL;
+}
+
1
0
[Maria-developers] Updated (by Guest): Provide key cache statistics (58)
by worklog-noreply@askmonty.org 01 Dec '09
by worklog-noreply@askmonty.org 01 Dec '09
01 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Provide key cache statistics
CREATION DATE..: Thu, 22 Oct 2009, 12:28
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 58 (http://askmonty.org/worklog/?tid=58)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Monty - Fri, 27 Nov 2009, 12:36)=-=-
High Level Description modified.
--- /tmp/wklog.58.old.15108 2009-11-27 10:36:13.000000000 +0000
+++ /tmp/wklog.58.new.15108 2009-11-27 10:36:13.000000000 +0000
@@ -1,8 +1,7 @@
-Provide the key cache
-statistics available for the default cache (key blocks used,
-unflushed, etc.) for all named caches.
+Provide the same key cache statistics for all MyISAM key caches as we provide
+for the default key cache.
-Monty answers in an email:
+Background: Monty answers in an email to customer:
This is a much simpler task and something that is important to get
done. We would have to introduce a 'show keycache statistics' command
@@ -11,3 +10,44 @@
The raw coding is probably 1-2 days, but on top if this we need
testing, a test environment and building of biniaries for you.
Henrik/Bo and Igor will come back to you with a more exact estimate.
+
+-----------------
+Currently we have:
+
+show status like "key%";
++------------------------+-------+
+| Variable_name | Value |
++------------------------+-------+
+| Key_blocks_not_flushed | 0 |
+| Key_blocks_unused | 13389 |
+| Key_blocks_used | 7 |
+| Key_read_requests | 22 |
+| Key_reads | 7 |
+| Key_write_requests | 0 |
+| Key_writes | 0 |
++------------------------+-------+
+
+Sergei suggested we introduce for each new key cache a set of variables prefixed
+with the keycache name:
+
+show status like "keycache1.%";
+Which should show:
+
++----------------------------------+-------+
+| Variable_name | Value |
++----------------------------------+-------+
+| keycache1.Key_blocks_not_flushed | 0 |
+| keycache1.Key_blocks_unused | 13389 |
+| keycache1.Key_blocks_used | 7 |
+| keycache1.Key_read_requests | 22 |
+| keycache1.Key_reads | 7 |
+| keycache1.Key_write_requests | 0 |
+| keycache1.Key_writes | 0 |
++----------------------------------+-------+
+
+The task would thus to be to automatically introduce new variables when we
+create a new key cache and automatically remove these variables when the cache
+is deleted.
+
+The other option would be to add an information schema where we populate the
+information schema with data from all existing key caches.
DESCRIPTION:
Provide the same key cache statistics for all MyISAM key caches as we provide
for the default key cache.
Background: Monty answers in an email to customer:
This is a much simpler task and something that is important to get
done. We would have to introduce a 'show keycache statistics' command
that would iterate over all keycaches and provide the statistics.
The raw coding is probably 1-2 days, but on top if this we need
testing, a test environment and building of biniaries for you.
Henrik/Bo and Igor will come back to you with a more exact estimate.
-----------------
Currently we have:
show status like "key%";
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 13389 |
| Key_blocks_used | 7 |
| Key_read_requests | 22 |
| Key_reads | 7 |
| Key_write_requests | 0 |
| Key_writes | 0 |
+------------------------+-------+
Sergei suggested we introduce for each new key cache a set of variables prefixed
with the keycache name:
show status like "keycache1.%";
Which should show:
+----------------------------------+-------+
| Variable_name | Value |
+----------------------------------+-------+
| keycache1.Key_blocks_not_flushed | 0 |
| keycache1.Key_blocks_unused | 13389 |
| keycache1.Key_blocks_used | 7 |
| keycache1.Key_read_requests | 22 |
| keycache1.Key_reads | 7 |
| keycache1.Key_write_requests | 0 |
| keycache1.Key_writes | 0 |
+----------------------------------+-------+
The task would thus to be to automatically introduce new variables when we
create a new key cache and automatically remove these variables when the cache
is deleted.
The other option would be to add an information schema where we populate the
information schema with data from all existing key caches.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
01 Dec '09
Hi guys,
I'm working on this problem:
https://bugs.launchpad.net/pbxt/+bug/489091
Unfortunately I cannot rperoduce plan diffs on the latest
lp:~maria-captains/maria/5.1-merge. Is there a way to get access to any
of your machines where it is reproducible.
Thanks,
Vladimir
2
1
Hi!
I noticed that although 5.1.39 release is done and published, it's not on
launchpad: when one goes to https://launchpad.net/maria/, one
- sees 5.1.38 binaries offered for download on the right of the page
- "Series and milestones" chart doesn't list either 5.1.38 or 5.1.39.
This may cause some confusion. Is there any reason that we don't put releases
on Launchpad?
BR
Sergey
--
Sergey Petrunia, Software Developer
Monty Program AB, http://askmonty.org
Blog: http://s.petrunia.net/blog
5
6
Bo suggested me to publish my last WL#40 status report on the dev list.
Meaning to get a feedback (critical notes, tips, suggestions, etc) I
rewrote the report to make it more readable and included some thoughts
for discussion.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WL40. Add a mysqlbinlog option to filter updates to certain tables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Selected option : "2.5 Extend Query Events With Tables Info".
1. Extending Query Events With Tables Info
2. Example of the Extended Query Event Binary Format
3. Adding binlog-with-tables-info Option
4. How Tables Info is Formed
4.1. CREATE TABLE statement
4.2. RENAME TABLE Statement
5. TODO: Is Tables Info Enough?
6. TODO: How Renames are to be filtered?
7. Other TODO's
1. Extending Query Events With Tables Info
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reason: to do filtering based on "*-table" options we need to have a
list of all tables refered to by the query described by Query event.
The Query event binary format is extended with a tables info, i.e. the list of
tables involved in the query execution. More precisely, two following fields are
added to the Query event header:
* Query length (2 bytes). (Reason: in usual format, Query event doesn't include
this field because the query is considered to extent to the end of the event
what is not the case for the extended format).
* Tables info length (2 bytes). Length of tables info contained in the data
part of the event.
and the following data is added to the Query event data part:
* Tables info (tables_info_len bytes). List of 4-tuples
(db_len, db, table_name_len, table_name) for each table involved in the
execution of the query described by this event.
db_len may be zero meaning that this is the default db.
Note. In the extended format the default db is written without trailing zero
which is redundant since its length is already known from the event header.
2. Example of the Extended Query Event Binary Format
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
************************
QUERY_EVENT [2]
************************
00000294 | 2F A1 00 4B | time_when = 1258332463
00000298 | 02 | event_type = 2
00000299 | 64 00 00 00 | server_id = 100
0000029D | 75 00 00 00 | event_len = 117
000002A1 | 09 03 00 00 | log_pos = 00000309
000002A5 | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
000002A7 | 01 00 00 00 | proxy_id = 1
000002AB | C9 00 00 00 | exec_time = 201
000002AF | 04 | dbase_len = 4
000002B0 | 00 00 | error_code = 0
000002B2 | 1A 00 | status_vars_len = 26
000002B4 | 2B 00 | query_len = 43 (*)
000002B6 | 08 00 | tables_info_len = 8 (*)
------------------------
Status Variables
------------------------
000002B8 | 00 | FLAGS2:
000002B9 | 00 40 00 00 | 0x00004000
000002BD | 01 | SQL_MODE:
000002BE | 00 00 00 00 | 0x0000000000000000
000002C2 | 00 00 00 00 |
000002C6 | 06 | CATALOG_NZ:
000002C7 | 03 | catalog_len = 3
000002C8 | 73 74 64 | catalog = "std"
000002CB | 04 | CHARSET_CODE:
000002CC | 08 00 | charset_client = 8
000002CE | 08 00 | collation_connect = 8
000002D0 | 08 00 | collation_server = 8
------------------------
000002D2 | 74 65 73 74 | dbase = "test" (**)
000002D6 | 52 45 4E 41 | query = "RENAME TABLE t1 TO tmp, t2 TO t1, tmp TO t2"
000002DA | 4D 45 20 54 |
000002DE | 41 42 4C 45 |
000002E2 | 20 74 31 20 |
000002E6 | 54 4F 20 74 |
000002EA | 6D 70 2C 20 |
000002EE | 74 32 20 54 |
000002F2 | 4F 20 74 31 |
000002F6 | 2C 20 74 6D |
000002FA | 70 20 54 4F |
000002FE | 20 74 32 |
------------------------
Tables info (*)
------------------------
00000301 | 00 | dbase_len = 0 (***)
00000302 | 02 | table_len = 2
00000303 | 74 31 | table_str = "t1"
00000305 | 00 | dbase_len = 0 (***)
00000306 | 02 | table_len = 2
00000307 | 74 32 | table_str = "t2"
************************
(*) - Added to the new Query event binary format.
(**) - Modified: in the new Query event binary format database name does
not contain trailing zero.
(***) - Database length = 0 means that it is the default database.
3. Adding binlog-with-tables-info Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New --binlog-with-tables-info option is added. When set, all Query events are
to be written to the extended format (with tables info). Reasons for adding
the option:
* Adding tables info leads binary log to grow in size what is superfluous
if filtering within mysqlbinlog is not supposed to be used.
* If the current implementation of the extended format will appear to have
bugs switching off this option will guarantee that replication will work
as before that.
The option is defined as GLOBAL and read-only. Reason:
* The Query events format used in the binary log can be recognized only
by its length contained in the Format description event at the beginning
of the binary log. Because of that, two different Query event formats
can not be mixed within one binary log.
4. How Tables Info is Formed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Forming tables info for some types of statement is not quite straightforward.
Below is two examples of those "not-straightforward" cases.
4.1. CREATE TABLE statement
~~~~~~~~~~~~~~~~~~~~~~~~~~~
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] t (...)
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] t LIKE t1
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] t SELECT (t1, ..., tn)
Implementation of forming tables info in this case is based on the following
rules of binlogging CREATE TABLE statements:
SBR. The original CREATE TABLE statement is always binlogged as is.
In this case
tables_info = { t }, { t, t1 }, or { t, t1, ..., tn }
respectively.
RBR. In case of RBR we have the following specifics of binlogging CREATE
TABLE statement:
* temporary tables are not binlogged;
* CREATE TABLE t LIKE t1 with temporary t1 is transformed to the
ordinary CREATE TABLE (...);
* CREATE TABLE SELECT is always transformed to the ordinary
CREATE TABLE (...) (with possible subsequent INSERT statements).
So for RBR tables info is formed as follows:
IF t is temporary
// the statement will not be binlogged
tables_info = empty
IF CREATE TABLE t (...)
// the statement will be binlogged as is
tables_ info = {t}
IF CREATE TABLE t LIKE t1
IF t1 is temporary
// the statement will be binlogged as CREATE TABLE t (...)
tables_info = {t}
ELSE
// the statement will be binlogged as is
tables_info = {t, t1}
IF CREATE TABLE t SELECT (t1, ..., tn)
// the statement will be binlogged as CREATE TABLE (...)
tables_info = {t}
Note. In case of RBR, CREATE TABLE SELECT is binlogged as the following
sequence of events:
BEGIN: Query event
CREATE TABLE: Query event
INSERT's: Write row events
COMMIT Query event
BEGIN and COMMIT in this case are supplied with the same tables_info = {t}
as the CREATE TABLE statement. Also INSERT's are preceded by the Table map
event refering to the same table t. So filtering of all this events
(including BEGIN and COMMIT) will be based on the same tables info and
either all of them will pass the filter or all of them will be filtered out.
4.2. RENAME TABLE Statement
~~~~~~~~~~~~~~~~~~~~~~~~~~~
RENAME TABLE tl TO s1, ..., tn TO sn
For this type of statements tables info is formed, roughly speaking, of tables
standing left to "TO", i.e. t1, ..., tn. But including all t1, ..., tn is not
always correct. Consider renaming t1 <-> t2:
RENAME TABLE t1 TO tmp, t2 TO t1, tmp TO t2
Setting tables_info = ( t1, t2, tmp } is not good: mysqlbinlog being executed
with do-tables = { t1, t2 } will filter this statement away because tmp does
not belong to do-tables. So before adding ti to the tables_info we have to
check that ti != sj for all j < i. See tables_info in the example of Section 2.
5. TODO: Is Tables Info Enough?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assume we run mysqlbinlog with ignore_tables = { t1 } for the following
sequence of statements:
(1) CREATE TABLE t1 (...);
...
(2) CREATE TABLE t2 LIKE t1;
...
(3) INSERT INTO t2 VALUES ...;
...
In this case:
(1) will be filtered away - directly stated by the ignore rules;
(2) will be filtered away - can not be executed because refers to t1
(3) will be left - though can not be executed
It is not good to have erroneous statements in mysqlbinlog output.
We can overcome this in two ways:
1. To explain to the user that in those cases, to avoid erroneous
statements, he/she should add t2 to the ignore_tables list as well.
2. To make the filtering bit clever. E.g., additionally to tables info,
we may extend the Query event format with a Statement type field
(BTW, see also WL#41 "Add a mysqlbinlog option to filter certain kinds
of statements"). In this case, when filtering, if we reject a "CREATE
TABLE t ..." statement because its LIKE or SELECT part refers to an
ignored table, we add table t to the ignore_tables list ourself.
6. TODO: How Renames are to be filtered?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the RENAME TABLE statement. If we have do_tables = { t } and
t is renamed to s:
(1) RENAME TABLE t TO s;
<smth for s>
what the filter should do? Should we consider t and s to be the same
table with different names so that <smth for s> is not to be filtered
away (in this case during filtering process we should add s to the
do_tables list - like we do it in the case of CREATE TABLE)? Or should
we treat do- ignore-table rules as talking about *table names* so that
--do-table=t means "do only table with name t" - then we filter
<smth for s> away because it refers to the table with another name s?
Note that in the last case if we rename s back to t:
(2) RENAME TABLE s TO t;
<smth for t>
the RENAME statement will be filtered away (it renames a table which
does not belong to the do_tables list) while <smth for t> will pass
the filter and its subsequent execution will result with error (we
can resolve this by creating a rename_list during the filtering process
to trace all renamings specified by the processed events - similar
to what is described in Section 4.2).
Note. With the second treatment of renaming, we can do the following
(looks like attractive but not sure is usefull :)
<smth for t>
RENAME TABLE t TO s
<smth for s that can be filtered away>
RENAME TABLE s TO t
<smth for t>
7. Other TODO's
~~~~~~~~~~~~~~~
* Continue with forming tables_info for different types of query.
* Filtering algorithm and *-table options for mysqlbinlog.
Should it be "clever" or "stupid" (see Sections 5 & 6) ?
* Add Statement type field to the Query event format (?)
Needed for "clever' filtering and for WL#41
* Other stuff (testing, documenting, etc)
2
1
01 Dec '09
Hi all,
after reviewing some MariaDB related bugs on bugs.launchpad.net/maria
it occurred to me, that there is no link between the bug state "Fix
Committed"
and the corresponding patch, which fixed the issue.
Is there a way to link a bzr patch/push to a launchpad bug report?
If not, where can I do a feature request about it?
Best regards,
Hakan
--
Hakan Küçükyılmaz, QA/Benchmark Engineer, Stuttgart/Germany
Monty Program Ab, http://askmonty.org/
Skype: hakank_ Phone: +49 171 1919839
5
5
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2773)
by knielsen@knielsen-hq.org 01 Dec '09
by knielsen@knielsen-hq.org 01 Dec '09
01 Dec '09
#At lp:maria
2773 knielsen(a)knielsen-hq.org 2009-12-01 [merge]
Automerge Daniel's README fixes.
modified:
README
=== modified file 'README'
--- a/README 2009-10-23 16:48:54 +0000
+++ b/README 2009-11-03 04:59:48 +0000
@@ -1,60 +1,57 @@
-This is a release of MariaDB, a branch of MySQL.
+This is a release of MariaDB.
-MariaDB is a drop-in replacement of MySQL, with more features, less
-bugs and better performance.
+MariaDB is designed as a drop-in replacement of MySQL(R) with more
+features, new storage engines, fewer bugs, and better performance.
-MariaDB is brought to you by many of the original developers of MySQL,
-that now work for Monty Program Ab, and by many people in the
+MariaDB is brought to you by many of the original developers of MySQL
+who now work for Monty Program Ab, and by many people in the
community.
-MySQL, which is the base of MariaDB, is brought to you by Sun.
+MySQL, which is the base of MariaDB, is a product and trademark of Sun
+Microsystems, Inc. For a list of developers and other contributors,
+see the Credits appendix. You can also do 'SHOW authors' to get a
+list of active contributors.
-License information can be found in these files:
-- For GPL (free) distributions, see the COPYING file and
- the EXCEPTIONS-CLIENT file.
-
-A description of the MariaDB project can be found at:
+A description of the MariaDB project and a manual can be found at:
http://askmonty.org/wiki/index.php/MariaDB
-
-GPLv2 Disclaimer
-For the avoidance of doubt, except that if any license choice
-other than GPL or LGPL is available it will apply instead, Sun
-elects to use only the General Public License version 2 (GPLv2)
-at this time for any software where a choice of GPL license versions
-is made available with the language indicating that GPLv2 or any
-later version may be used, or where a choice of which version of
-the GPL is applied is otherwise unspecified.
-
-The differences between MariaDB and MySQL can be found at:
http://askmonty.org/wiki/index.php/MariaDB_versus_MySQL
+http://askmonty.org/wiki/index.php/Manual:Contents
-Documentation about MySQL can be found at:
-http://dev.mysql.com/doc
-
-For further information about MySQL documentation, see:
-- The current MySQL documentation:
+As MariaDB is a full replacement of MySQL, the MySQL manual at
+http://dev.mysql.com/doc is generally applicable.
-Some manual sections of special interest:
+More help is available from the Maria Discuss mailing list
+https://launchpad.net/~maria-discuss
+and the #maria IRC channel on Freenode.
+***************************************************************************
+NOTE:
-- For a list of developers and other contributors, see the Credits
- appendix.
+MariaDB is specifically available only under version 2 of the GNU
+General Public License (GPLv2). (I.e. Without the "any later version"
+clause.) This is inherited from MySQL. Please see the README file in
+the MySQL distribution for more information.
-A local copy of the MySQL Reference Manual can be found in the Docs
-directory in GNU Info format. You can also browse the manual online or
-download it in any of several formats from
-http://dev.mysql.com/doc
+License information can be found in the COPYING file and the
+EXCEPTIONS-CLIENT file.
-************************************************************
+***************************************************************************
IMPORTANT:
-Bug or error reports regarding MariaDB should be sent to
+Bug and/or error reports regarding MariaDB should be submitted at
https://bugs.launchpad.net/maria
-Bugs in the MySQL code can also be sent to http://bugs.mysql.com
+
+Bugs in the MySQL code can also be submitted at http://bugs.mysql.com
+
***************************************************************************
+
+
+
+
+***************************************************************************
%%The following software may be included in this product:
Fred Fish's Dbug Library
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2772)
by knielsen@knielsen-hq.org 01 Dec '09
by knielsen@knielsen-hq.org 01 Dec '09
01 Dec '09
#At lp:maria
2772 knielsen(a)knielsen-hq.org 2009-12-01 [merge]
Merge free documentation from MySQL 5.1.41 source tarball into MariaDB.
modified:
Docs/INSTALL-BINARY
INSTALL-SOURCE
INSTALL-WIN-SOURCE
man/comp_err.1
man/innochecksum.1
man/make_win_bin_dist.1
man/msql2mysql.1
man/my_print_defaults.1
man/myisam_ftdump.1
man/myisamchk.1
man/myisamlog.1
man/myisampack.1
man/mysql-stress-test.pl.1
man/mysql-test-run.pl.1
man/mysql.1
man/mysql.server.1
man/mysql_client_test.1
man/mysql_config.1
man/mysql_convert_table_format.1
man/mysql_find_rows.1
man/mysql_fix_extensions.1
man/mysql_fix_privilege_tables.1
man/mysql_install_db.1
man/mysql_secure_installation.1
man/mysql_setpermission.1
man/mysql_tzinfo_to_sql.1
man/mysql_upgrade.1
man/mysql_waitpid.1
man/mysql_zap.1
man/mysqlaccess.1
man/mysqladmin.1
man/mysqlbinlog.1
man/mysqlbug.1
man/mysqlcheck.1
man/mysqld.8
man/mysqld_multi.1
man/mysqld_safe.1
man/mysqldump.1
man/mysqldumpslow.1
man/mysqlhotcopy.1
man/mysqlimport.1
man/mysqlmanager.8
man/mysqlshow.1
man/mysqlslap.1
man/mysqltest.1
man/ndbd.8
man/ndbd_redo_log_reader.1
man/ndbmtd.8
man/perror.1
man/replace.1
man/resolve_stack_dump.1
man/resolveip.1
scripts/fill_help_tables.sql
support-files/MacOSX/ReadMe.txt
=== modified file 'Docs/INSTALL-BINARY'
--- a/Docs/INSTALL-BINARY 2009-10-23 16:48:54 +0000
+++ b/Docs/INSTALL-BINARY 2009-12-01 07:38:15 +0000
@@ -3,7 +3,7 @@ describe how to install MariaDB; However
also applies.
-2.9. Installing MariaDB from tar.gz Packages on Other Unix-Like Systems
+2.2. Installing MariaDB from Generic Binaries on Unix/Linux
This section covers the installation of MariaDB binary distributions
that are provided for various platforms in the form of compressed
@@ -22,11 +22,13 @@ also applies.
* A reasonable tar to unpack the distribution. GNU tar is known
to work. Some operating systems come with a preinstalled
version of tar that is known to have problems. For example,
- the tar provided with early versions of Mac OS X, SunOS 4.x
- and Solaris 8 and earlier are known to have problems with long
- file names. On Mac OS X, you can use the preinstalled gnutar
- program. On other systems with a deficient tar, you should
- install GNU tar first.
+ the tar provided with early versions of Mac OS X, SunOS 4.x,
+ Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
+ are known to have problems with long file names. On Mac OS X,
+ you can use the preinstalled gnutar program. On Solaris 10 and
+ OpenSolaris you can use the preinstalled gtar. On other
+ systems with a deficient tar, you should install GNU tar
+ first.
If you run into problems and need to file a bug report,
please report them to: http://bugs.launchpad.net/maria
@@ -52,7 +54,7 @@ shell> bin/mysqld_safe --user=mysql &
Note
This procedure does not set up any passwords for MariaDB accounts.
- After following the procedure, proceed to Section 2.11,
+ After following the procedure, proceed to Section 2.13,
"Post-Installation Setup and Testing."
A more detailed version of the preceding description for
@@ -147,7 +149,7 @@ shell> chown -R mysql data
machine, you can copy support-files/mysql.server to the
location where your system has its startup files. More
information can be found in the support-files/mysql.server
- script itself and in Section 2.11.2.2, "Starting and Stopping
+ script itself and in Section 2.13.1.2, "Starting and Stopping
MariaDB Automatically."
10. You can set up new accounts using the bin/mysql_setpermission
script if you install the DBI and DBD::mysql Perl modules. See
@@ -186,5 +188,5 @@ Note
The accounts that are listed in the MariaDB grant tables initially
have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
+ passwords for them using the instructions in Section 2.13,
"Post-Installation Setup and Testing."
=== modified file 'INSTALL-SOURCE'
--- a/INSTALL-SOURCE 2009-09-16 12:03:18 +0000
+++ b/INSTALL-SOURCE 2009-12-01 07:24:05 +0000
@@ -5,9 +5,8 @@ Chapter 2. Installing and Upgrading MySQ
of the procedure follows and later sections provide the details.
If you plan to upgrade an existing version of MySQL to a newer
version rather than install MySQL for the first time, see Section
- 2.12.1, "Upgrading MySQL," for information about upgrade
- procedures and about issues that you should consider before
- upgrading.
+ 2.4.1, "Upgrading MySQL," for information about upgrade procedures
+ and about issues that you should consider before upgrading.
If you are interested in migrating to MySQL from another database
system, you may wish to read Section A.8, "MySQL 5.1 FAQ ---
@@ -15,96 +14,61 @@ Chapter 2. Installing and Upgrading MySQ
concerning migration issues.
1. Determine whether MySQL runs and is supported on your
- platform. Please note that not all platforms are equally
- suitable for running MySQL, and that not all platforms on
- which MySQL is known to run are officially supported by Sun
- Microsystems, Inc.:
-
- + For MySQL Enterprise Server, the officially supported
- platforms are listed at
- http://www.mysql.com/support/supportedplatforms.html.
-
- + MySQL Community Server runs on the platforms listed at
- Section 2.1.1, "Operating Systems Supported by MySQL
- Community Server."
-
- 2. Choose which distribution to install. Several versions of
- MySQL are available, and most are available in several
- distribution formats. You can choose from pre-packaged
- distributions containing binary (precompiled) programs or
- source code. When in doubt, use a binary distribution. We also
- provide public access to our current source tree for those who
- want to see our most recent developments and help us test new
- code. To determine which version and type of distribution you
- should use, see Section 2.1.2, "Choosing Which MySQL
- Distribution to Install."
-
- 3. Download the distribution that you want to install. For
- instructions, see Section 2.1.3, "How to Get MySQL." To verify
- the integrity of the distribution, use the instructions in
- Section 2.1.4, "Verifying Package Integrity Using MD5
+ platform.
+ Please note that not all platforms are equally suitable for
+ running MySQL, and that not all platforms on which MySQL is
+ known to run are officially supported by Sun Microsystems,
+ Inc.:
+
+ 2. Choose which distribution to install.
+ Several versions of MySQL are available, and most are
+ available in several distribution formats. You can choose from
+ pre-packaged distributions containing binary (precompiled)
+ programs or source code. When in doubt, use a binary
+ distribution. We also provide public access to our current
+ source tree for those who want to see our most recent
+ developments and help us test new code. To determine which
+ version and type of distribution you should use, see Section
+ 2.1.2, "Choosing Which MySQL Distribution to Install."
+
+ 3. Download the distribution that you want to install.
+ For instructions, see Section 2.1.3, "How to Get MySQL." To
+ verify the integrity of the distribution, use the instructions
+ in Section 2.1.4, "Verifying Package Integrity Using MD5
Checksums or GnuPG."
- 4. Install the distribution. To install MySQL from a binary
- distribution, use the instructions in Section 2.2, "Standard
- MySQL Installation Using a Binary Distribution." To install
- MySQL from a source distribution or from the current
- development source tree, use the instructions in Section 2.10,
- "MySQL Installation Using a Source Distribution."
- If you encounter installation difficulties, see Section 2.13,
- "Operating System-Specific Notes," for information on solving
- problems for particular platforms.
-
- 5. Perform any necessary post-installation setup. After
- installing MySQL, read Section 2.11, "Post-Installation Setup
- and Testing." This section contains important information
- about making sure the MySQL server is working properly. It
- also describes how to secure the initial MySQL user accounts,
- which have no passwords until you assign passwords. The
- section applies whether you install MySQL using a binary or
- source distribution.
+ 4. Install the distribution.
+ To install MySQL from a binary distribution, use the
+ instructions in Section 2.2, "Installing MySQL from Generic
+ Binaries on Unix/Linux."
+ To install MySQL from a source distribution or from the
+ current development source tree, use the instructions in
+ Section 2.3, "MySQL Installation Using a Source Distribution."
+
+ 5. Perform any necessary post-installation setup.
+ After installing MySQL, read Section 2.13, "Post-Installation
+ Setup and Testing." This section contains important
+ information about making sure the MySQL server is working
+ properly. It also describes how to secure the initial MySQL
+ user accounts, which have no passwords until you assign
+ passwords. The section applies whether you install MySQL using
+ a binary or source distribution.
6. If you want to run the MySQL benchmark scripts, Perl support
for MySQL must be available. See Section 2.15, "Perl
Installation Notes."
-2.1. General Installation Issues
-
- The MySQL installation procedure depends on whether you will
- install MySQL Enterprise Server or MySQL Community Server. The set
- of applicable platforms depends on which distribution you will
- install:
-
- * For MySQL Enterprise Server, the officially supported
- platforms are listed at
- http://www.mysql.com/support/supportedplatforms.html.
-
- * MySQL Community Server runs on the platforms listed at Section
- 2.1.1, "Operating Systems Supported by MySQL Community
- Server."
-
- For MySQL Enterprise Server, install the main distribution plus
- any service packs or hotfixes that you wish to apply using the
- Enterprise Installer. For platforms that do not yet have an
- Enterprise Installer, use the Community Server instructions.
-
- For MySQL Community Server, install the main distribution plus any
- hotfixes and updates:
-
- * Download a binary release, or download a source release and
- build MySQL yourself from the source code.
-
- * Retrieve MySQL from the Bazaar tree and build it from source.
- The Bazaar tree contains the latest developer code.
+2.1. General Installation Guidance
The immediately following sections contain the information
necessary to choose, download, and verify your distribution. The
instructions in later sections of the chapter describe how to
install the distribution that you choose. For binary
- distributions, see the instructions at Section 2.2, "Standard
- MySQL Installation Using a Binary Distribution." To build MySQL
- from source, use the instructions at Section 2.10, "MySQL
- Installation Using a Source Distribution."
+ distributions, see the instructions at Section 2.2, "Installing
+ MySQL from Generic Binaries on Unix/Linux" or the corresponding
+ section for your platform if available. To build MySQL from
+ source, use the instructions in Section 2.3, "MySQL Installation
+ Using a Source Distribution."
2.1.1. Operating Systems Supported by MySQL Community Server
@@ -129,58 +93,31 @@ Important
MySQL has been reported to compile successfully on the following
combinations of operating system and thread package.
- * AIX 4.x, 5.x with native threads. See Section 2.13.5.3,
- "IBM-AIX notes."
-
- * Amiga.
+ * AIX 4.x, 5.x with native threads. See Section 2.12,
+ "Installing MySQL on AIX." AIX 5.3 should be upgraded to
+ technology level 7 (5300-07).
- * FreeBSD 5.x and up with native threads.
+ * FreeBSD 5.x and up with native threads. See Section 2.10,
+ "Installing MySQL on FreeBSD."
- * HP-UX 11.x with the native threads. See Section 2.13.5.2,
- "HP-UX Version 11.x Notes."
+ * HP-UX 11.x with the native threads. See Section 2.11,
+ "Installing MySQL on HP-UX."
* Linux, builds on all fairly recent Linux distributions with
- glibc 2.3. See Section 2.13.1, "Linux Notes."
-
- * Mac OS X. See Section 2.13.2, "Mac OS X Notes."
-
- * NetBSD 1.3/1.4 Intel and NetBSD 1.3 Alpha. See Section
- 2.13.4.2, "NetBSD Notes."
+ glibc 2.3. See Section 2.6, "Installing MySQL on Linux."
- * Novell NetWare 6.0 and 6.5. See Section 2.8, "Installing MySQL
- on NetWare."
+ * Mac OS X. See Section 2.7, "Installing MySQL on Mac OS X."
- * OpenBSD 2.5 and with native threads. OpenBSD earlier than 2.5
- with the MIT-pthreads package. See Section 2.13.4.3, "OpenBSD
- 2.5 Notes."
-
- * SCO OpenServer 5.0.X with a recent port of the FSU Pthreads
- package. See Section 2.13.5.8, "SCO UNIX and OpenServer 5.0.x
- Notes."
-
- * SCO Openserver 6.0.x. See Section 2.13.5.9, "SCO OpenServer
- 6.0.x Notes."
-
- * SCO UnixWare 7.1.x. See Section 2.13.5.10, "SCO UnixWare 7.1.x
- and OpenUNIX 8.0.0 Notes."
-
- * SGI Irix 6.x with native threads. See Section 2.13.5.7, "SGI
- Irix Notes."
-
- * Solaris 2.5 and above with native threads on SPARC and x86.
- See Section 2.13.3, "Solaris Notes."
-
- * Tru64 Unix. See Section 2.13.5.5, "Alpha-DEC-UNIX Notes
- (Tru64)."
+ * Solaris 2.8 on SPARC and x86, including support for native
+ threads. See Section 2.8.1, "Solaris Notes."
* Windows 2000, Windows XP, Windows Vista, Windows Server 2003,
- and Windows Server 2008. See Section 2.3, "Installing MySQL on
+ and Windows Server 2008. See Section 2.5, "Installing MySQL on
Windows."
MySQL has also been known to run on other systems in the past. See
- Section 2.13, "Operating System-Specific Notes." Some porting
- effort might be required for current versions of MySQL on these
- systems.
+ Section 2.1, "General Installation Guidance." Some porting effort
+ might be required for current versions of MySQL on these systems.
Not all platforms are equally well-suited for running MySQL. How
well a certain platform is suited for a high-load mission-critical
@@ -208,8 +145,8 @@ Important
* General file system stability and performance.
* Table size. If your tables are large, performance is affected
- by the ability of the file system to deal with large files at
- all and to deal with them efficiently.
+ by the ability of the file system to deal with large files and
+ dealing with them efficiently.
* Our level of expertise here at Sun Microsystems, Inc. with the
platform. If we know a platform well, we enable
@@ -240,7 +177,7 @@ Important
development process, multiple release series co-exist, each at a
different stage of maturity:
- * MySQL 5.4 and 6.0 are the current development release series.
+ * MySQL 5.5 is the current development release series.
* MySQL 5.1 is the current General Availability (Production)
release series. New releases are issued for bugfixes only; no
@@ -255,9 +192,9 @@ Important
has ended.
Extended support for MySQL 4.1 remains available. According to
the MySQL Lifecycle Policy
- (http://www.mysql.com/company/legal/lifecycle/#policy) only
- Security and Severity Level 1 issues are still being fixed for
- MySQL 4.1.
+ (http://www.mysql.com/about/legal/lifecycle/) only Security
+ and Severity Level 1 issues are still being fixed for MySQL
+ 4.1.
We do not believe in a complete code freeze because this prevents
us from making bugfixes and other fixes that must be done. By
@@ -367,13 +304,13 @@ Important
* The MySQL benchmark suite
This suite runs a range of common queries. It is also a test
to determine whether the latest batch of optimizations
- actually made the code faster. See Section 7.1.4, "The MySQL
+ actually made the code faster. See Section 7.1.3, "The MySQL
Benchmark Suite."
* The crash-me test
This test tries to determine what features the database
supports and what its capabilities and limitations are. See
- Section 7.1.4, "The MySQL Benchmark Suite."
+ Section 7.1.3, "The MySQL Benchmark Suite."
We also test the newest MySQL version in our internal production
environment, on at least one machine. We have more than 100GB of
@@ -492,21 +429,6 @@ Important
as soon as possible. (We would like other companies to do
this, too!)
-2.1.2.4. MySQL Binaries Compiled by Sun Microsystems, Inc.
-
- Sun Microsystems, Inc. provides a set of binary distributions of
- MySQL. In addition to binaries provided in platform-specific
- package formats, we offer binary distributions for a number of
- platforms in the form of compressed tar files (.tar.gz files). See
- Section 2.2, "Standard MySQL Installation Using a Binary
- Distribution." For Windows distributions, see Section 2.3,
- "Installing MySQL on Windows."
-
- If you want to compile a debug version of MySQL from a source
- distribution, you should add --with-debug or --with-debug=full to
- the configure command used to configure the distribution and
- remove any -fomit-frame-pointer options.
-
2.1.3. How to Get MySQL
Check our downloads page at http://dev.mysql.com/downloads/ for
@@ -553,8 +475,8 @@ Important
shell> md5sum package_name
Example:
-shell> md5sum mysql-standard-5.1.39-linux-i686.tar.gz
-aaab65abbec64d5e907dcd41b8699945 mysql-standard-5.1.39-linux-i686.ta
+shell> md5sum mysql-standard-5.1.41-linux-i686.tar.gz
+aaab65abbec64d5e907dcd41b8699945 mysql-standard-5.1.41-linux-i686.ta
r.gz
You should verify that the resulting checksum (the string of
@@ -728,8 +650,8 @@ pg-signature.html
signature, which also is available from the download page. The
signature file has the same name as the distribution file with an
.asc extension, as shown by the examples in the following table.
- Distribution file mysql-standard-5.1.39-linux-i686.tar.gz
- Signature file mysql-standard-5.1.39-linux-i686.tar.gz.asc
+ Distribution file mysql-standard-5.1.41-linux-i686.tar.gz
+ Signature file mysql-standard-5.1.41-linux-i686.tar.gz.asc
Make sure that both files are stored in the same directory and
then run the following command to verify the signature for the
@@ -737,7 +659,7 @@ pg-signature.html
shell> gpg --verify package_name.asc
Example:
-shell> gpg --verify mysql-standard-5.1.39-linux-i686.tar.gz.asc
+shell> gpg --verify mysql-standard-5.1.41-linux-i686.tar.gz.asc
gpg: Signature made Tue 12 Jul 2005 23:35:41 EST using DSA key ID 507
2E1F5
gpg: Good signature from "MySQL Package signing key (www.mysql.com) <
@@ -757,8 +679,8 @@ build(a)mysql.com>"
shell> rpm --checksig package_name.rpm
Example:
-shell> rpm --checksig MySQL-server-5.1.39-0.glibc23.i386.rpm
-MySQL-server-5.1.39-0.glibc23.i386.rpm: md5 gpg OK
+shell> rpm --checksig MySQL-server-5.1.41-0.glibc23.i386.rpm
+MySQL-server-5.1.41-0.glibc23.i386.rpm: md5 gpg OK
Note
@@ -786,22 +708,6 @@ shell> rpm --import mysql_pubkey.asc
Sun Microsystems, Inc. A distribution provided by another vendor
might use a layout different from those shown here.
- For MySQL 5.1 on Windows, the default installation directory is
- C:\Program Files\MySQL\MySQL Server 5.1. (Some Windows users
- prefer to install in C:\mysql, the directory that formerly was
- used as the default. However, the layout of the subdirectories
- remains the same.) The installation directory has the following
- subdirectories.
- Directory Contents of Directory
- bin Client programs and the mysqld server
- data Log files, databases
- Docs Manual in CHM format
- examples Example programs and scripts
- include Include (header) files
- lib Libraries
- scripts Utility scripts
- share Error message files
-
Installations created from our Linux RPM distributions result in
files under the following system directories.
Directory Contents of Directory
@@ -863,8100 +769,7171 @@ shell> rpm --import mysql_pubkey.asc
distribution by executing the scripts/make_binary_distribution
script from the top directory of the source distribution.
-2.2. Standard MySQL Installation Using a Binary Distribution
+2.2. Installing MySQL from Generic Binaries on Unix/Linux
- The next several sections cover the installation of MySQL on
- platforms where we offer packages using the native packaging
- format of the respective platform. (This is also known as
- performing a "binary install.") However, binary distributions of
- MySQL are available for many other platforms as well. See Section
- 2.9, "Installing MySQL from tar.gz Packages on Other Unix-Like
- Systems," for generic installation instructions for these packages
- that apply to all platforms.
-
- See Section 2.1, "General Installation Issues," for more
- information on what other binary distributions are available and
- how to obtain them.
-
-2.3. Installing MySQL on Windows
-
- A native Windows distribution of MySQL has been available since
- version 3.21 and represents a sizable percentage of the daily
- downloads of MySQL. This section describes the process for
- installing MySQL on Windows.
+ This section covers the installation of MySQL binary distributions
+ that are provided for various platforms in the form of compressed
+ tar files (files with a .tar.gz extension). See Section 2.2,
+ "Installing MySQL from Generic Binaries on Unix/Linux," for a
+ detailed list.
-Note
+ To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
- If you are upgrading MySQL from an existing installation older
- than MySQL 4.1.5, you must first perform the procedure described
- in Section 2.3.14, "Upgrading MySQL on Windows."
+ Sun Microsystems, Inc. provides a set of binary distributions of
+ MySQL. In addition to binaries provided in platform-specific
+ package formats, we offer binary distributions for a number of
+ platforms in the form of compressed tar files (.tar.gz files). For
+ Windows distributions, see Section 2.5, "Installing MySQL on
+ Windows."
- To run MySQL on Windows, you need the following:
+ If you want to compile a debug version of MySQL from a source
+ distribution, you should add --with-debug or --with-debug=full to
+ the configure command used to configure the distribution and
+ remove any -fomit-frame-pointer options.
- * A Windows operating system such as Windows 2000, Windows XP,
- Windows Vista, Windows Server 2003, or Windows Server 2008.
- Both 32-bit and 64-bit versions are supported.
- A Windows operating system permits you to run the MySQL server
- as a service. See Section 2.3.11, "Starting MySQL as a Windows
- Service."
- Generally, you should install MySQL on Windows using an
- account that has administrator rights. Otherwise, you may
- encounter problems with certain operations such as editing the
- PATH environment variable or accessing the Service Control
- Manager. Once installed, MySQL does not need to be executed
- using a user with Administrator privileges.
+ MySQL tar file binary distributions have names of the form
+ mysql-VERSION-OS.tar.gz, where VERSION is a number (for example,
+ 5.1.41), and OS indicates the type of operating system for which
+ the distribution is intended (for example, pc-linux-i686).
- * TCP/IP protocol support.
+ In addition to these generic packages, we also offer binaries in
+ platform-specific package formats for selected platforms. See the
+ platform specific sections for more information, for more
+ information on how to install these.
- * Enough space on the hard drive to unpack, install, and create
- the databases in accordance with your requirements (generally
- a minimum of 200 megabytes is recommended.)
+ You need the following tools to install a MySQL tar file binary
+ distribution:
- For a list of limitations within the Windows version of MySQL, see
- Section D.7.3, "Windows Platform Limitations."
+ * GNU gunzip to uncompress the distribution.
- There may also be other requirements, depending on how you plan to
- use MySQL:
+ * A reasonable tar to unpack the distribution. GNU tar is known
+ to work. Some operating systems come with a preinstalled
+ version of tar that is known to have problems. For example,
+ the tar provided with early versions of Mac OS X, SunOS 4.x,
+ Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
+ are known to have problems with long file names. On Mac OS X,
+ you can use the preinstalled gnutar program. On Solaris 10 and
+ OpenSolaris you can use the preinstalled gtar. On other
+ systems with a deficient tar, you should install GNU tar
+ first.
- * If you plan to connect to the MySQL server via ODBC, you need
- a Connector/ODBC driver. See Section 21.1, "MySQL
- Connector/ODBC."
+ If you run into problems and need to file a bug report, please use
+ the instructions in Section 1.6, "How to Report Bugs or Problems."
- * If you plan to use MySQL server with ADO.NET applications, you
- need the Connector/NET driver. See Section 21.2, "MySQL
- Connector/NET."
+ The basic commands that you must execute to install and use a
+ MySQL binary distribution are:
+shell> groupadd mysql
+shell> useradd -g mysql mysql
+shell> cd /usr/local
+shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
+shell> ln -s full-path-to-mysql-VERSION-OS mysql
+shell> cd mysql
+shell> chown -R mysql .
+shell> chgrp -R mysql .
+shell> scripts/mysql_install_db --user=mysql
+shell> chown -R root .
+shell> chown -R mysql data
+shell> bin/mysqld_safe --user=mysql &
- * If you need tables with a size larger than 4GB, install MySQL
- on an NTFS or newer file system. Don't forget to use MAX_ROWS
- and AVG_ROW_LENGTH when you create tables. See Section
- 12.1.17, "CREATE TABLE Syntax."
+Note
- MySQL for Windows is available in several distribution formats:
+ This procedure does not set up any passwords for MySQL accounts.
+ After following the procedure, proceed to Section 2.13,
+ "Post-Installation Setup and Testing."
- * Binary distributions are available that contain a setup
- program that installs everything you need so that you can
- start the server immediately. Another binary distribution
- format contains an archive that you simply unpack in the
- installation location and then configure yourself. For
- details, see Section 2.3.1, "Choosing An Installation
- Package."
+ A more detailed version of the preceding description for
+ installing a binary distribution follows:
- * The source distribution contains all the code and support
- files for building the executables using the Visual Studio
- compiler system.
+ 1. Add a login user and group for mysqld to run as:
+shell> groupadd mysql
+shell> useradd -g mysql mysql
+ These commands add the mysql group and the mysql user. The
+ syntax for useradd and groupadd may differ slightly on
+ different versions of Unix, or they may have different names
+ such as adduser and addgroup.
+ You might want to call the user and group something else
+ instead of mysql. If so, substitute the appropriate name in
+ the following steps.
- Generally speaking, you should use a binary distribution that
- includes an installer. It is simpler to use than the others, and
- you need no additional tools to get MySQL up and running. The
- installer for the Windows version of MySQL, combined with a GUI
- Configuration Wizard, automatically installs MySQL, creates an
- option file, starts the server, and secures the default user
- accounts.
+ 2. Pick the directory under which you want to unpack the
+ distribution and change location into it. In the following
+ example, we unpack the distribution under /usr/local. (The
+ instructions, therefore, assume that you have permission to
+ create files and directories in /usr/local. If that directory
+ is protected, you must perform the installation as root.)
+shell> cd /usr/local
-Caution
+ 3. Obtain a distribution file using the instructions in Section
+ 2.1.3, "How to Get MySQL." For a given release, binary
+ distributions for all platforms are built from the same MySQL
+ source distribution.
- Using virus scanning software such as Norton/Symantec Anti-Virus
- on directories containing MySQL data and temporary tables can
- cause issues, both in terms of the performance of MySQL and the
- virus-scanning software mis-identifying the contents of the files
- as containing spam. This is because of the fingerprinting
- mechanism used by the virus scanning software, and the way in
- which MySQL rapidly updates different files, which may be
- identified as a potential security risk.
-
- After installing MySQL Server, it is recommended that you disable
- virus scanning on the main directory (datadir) being used to store
- your MySQL table data. There is usually a system built into the
- virus scanning software to allow certain directories to be
- specifically ignored during virus scanning.
-
- In addition, by default, MySQL creates temporary files in the
- standard Windows temporary directory. To prevent the temporary
- files also being scanned, you should configure a separate
- temporary directory for MySQL temporary files and add this to the
- virus scanning exclusion list. To do this, add a configuration
- option for the tmpdir parameter to your my.ini configuration file.
- For more information, see Section 2.3.7, "Creating an Option
- File."
-
- The following section describes how to install MySQL on Windows
- using a binary distribution. To use an installation package that
- does not include an installer, follow the procedure described in
- Section 2.3.5, "Installing MySQL from a Noinstall Zip Archive." To
- install using a source distribution, see Section 2.10.6,
- "Installing MySQL from Source on Windows."
+ 4. Unpack the distribution, which creates the installation
+ directory. Then create a symbolic link to that directory:
+shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
+shell> ln -s full-path-to-mysql-VERSION-OS mysql
+ The tar command creates a directory named mysql-VERSION-OS.
+ The ln command makes a symbolic link to that directory. This
+ lets you refer more easily to the installation directory as
+ /usr/local/mysql.
+ With GNU tar, no separate invocation of gunzip is necessary.
+ You can replace the first line with the following alternative
+ command to uncompress and extract the distribution:
+shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
- MySQL distributions for Windows can be downloaded from
- http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
- MySQL."
+ 5. Change location into the installation directory:
+shell> cd mysql
+ You will find several files and subdirectories in the mysql
+ directory. The most important for installation purposes are
+ the bin and scripts subdirectories:
-2.3.1. Choosing An Installation Package
+ + The bin directory contains client programs and the
+ server. You should add the full path name of this
+ directory to your PATH environment variable so that your
+ shell finds the MySQL programs properly. See Section
+ 2.14, "Environment Variables."
- For MySQL 5.1, there are three installation packages to choose
- from when installing MySQL on Windows:
+ + The scripts directory contains the mysql_install_db
+ script used to initialize the mysql database containing
+ the grant tables that store the server access
+ permissions.
- * The Essentials Package: This package has a file name similar
- to mysql-essential-5.1.39-win32.msi and contains the minimum
- set of files needed to install MySQL on Windows, including the
- Configuration Wizard. This package does not include optional
- components such as the embedded server and benchmark suite.
-
- * The Complete Package: This package has a file name similar to
- mysql-5.1.39-win32.zip and contains all files needed for a
- complete Windows installation, including the Configuration
- Wizard. This package includes optional components such as the
- embedded server and benchmark suite.
+ 6. Ensure that the distribution contents are accessible to mysql.
+ If you unpacked the distribution as mysql, no further action
+ is required. If you unpacked the distribution as root, its
+ contents will be owned by root. Change its ownership to mysql
+ by executing the following commands as root in the
+ installation directory:
+shell> chown -R mysql .
+shell> chgrp -R mysql .
+ The first command changes the owner attribute of the files to
+ the mysql user. The second changes the group attribute to the
+ mysql group.
- * The Noinstall Archive: This package has a file name similar to
- mysql-noinstall-5.1.39-win32.zip and contains all the files
- found in the Complete install package, with the exception of
- the Configuration Wizard. This package does not include an
- automated installer, and must be manually installed and
- configured.
-
- The Essentials package is recommended for most users. It is
- provided as an .msi file for use with the Windows Installer. The
- Complete and Noinstall distributions are packaged as Zip archives.
- To use them, you must have a tool that can unpack .zip files.
+ 7. If you have not installed MySQL before, you must create the
+ MySQL data directory and initialize the grant tables:
+shell> scripts/mysql_install_db --user=mysql
+ If you run the command as root, include the --user option as
+ shown. If you run the command while logged in as that user,
+ you can omit the --user option.
+ The command should create the data directory and its contents
+ with mysql as the owner.
+ After creating or updating the grant tables, you need to
+ restart the server manually.
- Your choice of install package affects the installation process
- you must follow. If you choose to install either the Essentials or
- Complete install packages, see Section 2.3.2, "Installing MySQL
- with the Automated Installer." If you choose to install MySQL from
- the Noinstall archive, see Section 2.3.5, "Installing MySQL from a
- Noinstall Zip Archive."
-
-2.3.2. Installing MySQL with the Automated Installer
-
- New MySQL users can use the MySQL Installation Wizard and MySQL
- Configuration Wizard to install MySQL on Windows. These are
- designed to install and configure MySQL in such a way that new
- users can immediately get started using MySQL.
+ 8. Most of the MySQL installation can be owned by root if you
+ like. The exception is that the data directory must be owned
+ by mysql. To accomplish this, run the following commands as
+ root in the installation directory:
+shell> chown -R root .
+shell> chown -R mysql data
- The MySQL Installation Wizard and MySQL Configuration Wizard are
- available in the Essentials and Complete install packages. They
- are recommended for most standard MySQL installations. Exceptions
- include users who need to install multiple instances of MySQL on a
- single server host and advanced users who want complete control of
- server configuration.
+ 9. If you want MySQL to start automatically when you boot your
+ machine, you can copy support-files/mysql.server to the
+ location where your system has its startup files. More
+ information can be found in the support-files/mysql.server
+ script itself and in Section 2.13.1.2, "Starting and Stopping
+ MySQL Automatically."
+ 10. You can set up new accounts using the bin/mysql_setpermission
+ script if you install the DBI and DBD::mysql Perl modules. See
+ Section 4.6.14, "mysql_setpermission --- Interactively Set
+ Permissions in Grant Tables." For Perl module installation
+ instructions, see Section 2.15, "Perl Installation Notes."
+ 11. If you would like to use mysqlaccess and have the MySQL
+ distribution in some nonstandard location, you must change the
+ location where mysqlaccess expects to find the mysql client.
+ Edit the bin/mysqlaccess script at approximately line 18.
+ Search for a line that looks like this:
+$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable
+ Change the path to reflect the location where mysql actually
+ is stored on your system. If you do not do this, a Broken pipe
+ error will occur when you run mysqlaccess.
-2.3.3. Using the MySQL Installation Wizard
+ After everything has been unpacked and installed, you should test
+ your distribution. To start the MySQL server, use the following
+ command:
+shell> bin/mysqld_safe --user=mysql &
- MySQL Installation Wizard is an installer for the MySQL server
- that uses the latest installer technologies for Microsoft Windows.
- The MySQL Installation Wizard, in combination with the MySQL
- Configuration Wizard, allows a user to install and configure a
- MySQL server that is ready for use immediately after installation.
+ If you run the command as root, you must use the --user option as
+ shown. The value of the option is the name of the login account
+ that you created in the first step to use for running the server.
+ If you run the command while logged in as mysql, you can omit the
+ --user option.
- The MySQL Installation Wizard is the standard installer for all
- MySQL server distributions, version 4.1.5 and higher. Users of
- previous versions of MySQL need to shut down and remove their
- existing MySQL installations manually before installing MySQL with
- the MySQL Installation Wizard. See Section 2.3.3.6, "Upgrading
- MySQL with the Installation Wizard," for more information on
- upgrading from a previous version.
+ If the command fails immediately and prints mysqld ended, you can
+ find some information in the host_name.err file in the data
+ directory.
- Microsoft has included an improved version of their Microsoft
- Windows Installer (MSI) in the recent versions of Windows. MSI has
- become the de-facto standard for application installations on
- Windows 2000, Windows XP, and Windows Server 2003. The MySQL
- Installation Wizard makes use of this technology to provide a
- smoother and more flexible installation process.
+ More information about mysqld_safe is given in Section 4.3.2,
+ "mysqld_safe --- MySQL Server Startup Script."
- The Microsoft Windows Installer Engine was updated with the
- release of Windows XP; those using a previous version of Windows
- can reference this Microsoft Knowledge Base article
- (http://support.microsoft.com/default.aspx?scid=kb;EN-US;292539)
- for information on upgrading to the latest version of the Windows
- Installer Engine.
+Note
- In addition, Microsoft has introduced the WiX (Windows Installer
- XML) toolkit recently. This is the first highly acknowledged Open
- Source project from Microsoft. We have switched to WiX because it
- is an Open Source project and it allows us to handle the complete
- Windows installation process in a flexible manner using scripts.
+ The accounts that are listed in the MySQL grant tables initially
+ have no passwords. After starting the server, you should set up
+ passwords for them using the instructions in Section 2.13,
+ "Post-Installation Setup and Testing."
- Improving the MySQL Installation Wizard depends on the support and
- feedback of users like you. If you find that the MySQL
- Installation Wizard is lacking some feature important to you, or
- if you discover a bug, please report it in our bugs database using
- the instructions given in Section 1.6, "How to Report Bugs or
- Problems."
+2.3. MySQL Installation Using a Source Distribution
-2.3.3.1. Downloading and Starting the MySQL Installation Wizard
+ Before you proceed with an installation from source, first check
+ whether our binary is available for your platform and whether it
+ works for you. We put a great deal of effort into ensuring that
+ our binaries are built with the best possible options.
- The MySQL installation packages can be downloaded from
- http://dev.mysql.com/downloads/. If the package you download is
- contained within a Zip archive, you need to extract the archive
- first.
-
-Note
+ To obtain a source distribution for MySQL, Section 2.1.3, "How to
+ Get MySQL." If you want to build MySQL from source on Windows, see
+ Section 2.5.10, "Installing MySQL from Source on Windows."
- If you are installing on Windows Vista it is best to open a
- network port before beginning the installation. To do this, first
- ensure that you are logged in as an Administrator, go to the
- Control Panel, and double click the Windows Firewall icon. Choose
- the Allow a program through Windows Firewall option and click the
- Add port button. Enter MySQL into the Name text box and 3306 (or
- the port of your choice) into the Port number text box. Also
- ensure that the TCP protocol radio button is selected. If you
- wish, you can also limit access to the MySQL server by choosing
- the Change scope button. Confirm your choices by clicking the OK
- button. If you do not open a port prior to installation, you
- cannot configure the MySQL server immediately after installation.
- Additionally, when running the MySQL Installation Wizard on
- Windows Vista, ensure that you are logged in as a user with
- administrative rights.
+ MySQL source distributions are provided as compressed tar archives
+ and have names of the form mysql-VERSION.tar.gz, where VERSION is
+ a number like 5.1.41.
- The process for starting the wizard depends on the contents of the
- installation package you download. If there is a setup.exe file
- present, double-click it to start the installation process. If
- there is an .msi file present, double-click it to start the
- installation process.
+ You need the following tools to build and install MySQL from
+ source:
-2.3.3.2. Choosing an Install Type
+ * GNU gunzip to uncompress the distribution.
- There are three installation types available: Typical, Complete,
- and Custom.
+ * A reasonable tar to unpack the distribution. GNU tar is known
+ to work. Some operating systems come with a preinstalled
+ version of tar that is known to have problems. For example,
+ the tar provided with early versions of Mac OS X, SunOS 4.x,
+ Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
+ are known to have problems with long file names. On Mac OS X,
+ you can use the preinstalled gnutar program. On Solaris 10 and
+ OpenSolaris you can use the preinstalled gtar. On other
+ systems with a deficient tar, you should install GNU tar
+ first.
- The Typical installation type installs the MySQL server, the mysql
- command-line client, and the command-line utilities. The
- command-line clients and utilities include mysqldump, myisamchk,
- and several other tools to help you manage the MySQL server.
+ * A working ANSI C++ compiler. gcc 2.95.2 or later, SGI C++, and
+ SunPro C++ are some of the compilers that are known to work.
+ libg++ is not needed when using gcc. gcc 2.7.x has a bug that
+ makes it impossible to compile some perfectly legal C++ files,
+ such as sql/sql_base.cc. If you have only gcc 2.7.x, you must
+ upgrade your gcc to be able to compile MySQL. gcc 2.8.1 is
+ also known to have problems on some platforms, so it should be
+ avoided if a newer compiler exists for the platform. gcc
+ 2.95.2 or later is recommended.
- The Complete installation type installs all components included in
- the installation package. The full installation package includes
- components such as the embedded server library, the benchmark
- suite, support scripts, and documentation.
+ * A good make program. GNU make is always recommended and is
+ sometimes required. (BSD make fails, and vendor-provided make
+ implementations may fail as well.) If you have problems, use
+ GNU make 3.75 or newer.
- The Custom installation type gives you complete control over which
- packages you wish to install and the installation path that is
- used. See Section 2.3.3.3, "The Custom Install Dialog," for more
- information on performing a custom install.
+ * libtool 1.5.24 or later is also recommended.
- If you choose the Typical or Complete installation types and click
- the Next button, you advance to the confirmation screen to verify
- your choices and begin the installation. If you choose the Custom
- installation type and click the Next button, you advance to the
- custom installation dialog, described in Section 2.3.3.3, "The
- Custom Install Dialog."
+ If you are using a version of gcc recent enough to understand the
+ -fno-exceptions option, it is very important that you use this
+ option. Otherwise, you may compile a binary that crashes randomly.
+ Also use -felide-constructors and -fno-rtti along with
+ -fno-exceptions. When in doubt, do the following:
+CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
+ -fno-exceptions -fno-rtti" ./configure \
+ --prefix=/usr/local/mysql --enable-assembler \
+ --with-mysqld-ldflags=-all-static
-2.3.3.3. The Custom Install Dialog
+ On most systems, this gives you a fast and stable binary.
- If you wish to change the installation path or the specific
- components that are installed by the MySQL Installation Wizard,
- choose the Custom installation type.
+ If you run into problems and need to file a bug report, please use
+ the instructions in Section 1.6, "How to Report Bugs or Problems."
- A tree view on the left side of the custom install dialog lists
- all available components. Components that are not installed have a
- red X icon; components that are installed have a gray icon. To
- change whether a component is installed, click on that component's
- icon and choose a new option from the drop-down list that appears.
+2.3.1. Source Installation Overview
- You can change the default installation path by clicking the
- Change... button to the right of the displayed installation path.
+ The basic commands that you must execute to install a MySQL source
+ distribution are:
+shell> groupadd mysql
+shell> useradd -g mysql mysql
+shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
+shell> cd mysql-VERSION
+shell> ./configure --prefix=/usr/local/mysql
+shell> make
+shell> make install
+shell> cp support-files/my-medium.cnf /etc/my.cnf
+shell> cd /usr/local/mysql
+shell> chown -R mysql .
+shell> chgrp -R mysql .
+shell> bin/mysql_install_db --user=mysql
+shell> chown -R root .
+shell> chown -R mysql var
+shell> bin/mysqld_safe --user=mysql &
- After choosing your installation components and installation path,
- click the Next button to advance to the confirmation dialog.
+ If you start from a source RPM, do the following:
+shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
-2.3.3.4. The Confirmation Dialog
+ This makes a binary RPM that you can install. For older versions
+ of RPM, you may have to replace the command rpmbuild with rpm
+ instead.
- Once you choose an installation type and optionally choose your
- installation components, you advance to the confirmation dialog.
- Your installation type and installation path are displayed for you
- to review.
+Note
- To install MySQL if you are satisfied with your settings, click
- the Install button. To change your settings, click the Back
- button. To exit the MySQL Installation Wizard without installing
- MySQL, click the Cancel button.
+ This procedure does not set up any passwords for MySQL accounts.
+ After following the procedure, proceed to Section 2.13,
+ "Post-Installation Setup and Testing," for post-installation setup
+ and testing.
- After installation is complete, you have the option of registering
- with the MySQL web site. Registration gives you access to post in
- the MySQL forums at forums.mysql.com (http://forums.mysql.com)
- along with the ability to report bugs at bugs.mysql.com
- (http://bugs.mysql.com) and to subscribe to our newsletter. The
- final screen of the installer provides a summary of the
- installation and gives you the option to launch the MySQL
- Configuration Wizard, which you can use to create a configuration
- file, install the MySQL service, and configure security settings.
+ A more detailed version of the preceding description for
+ installing MySQL from a source distribution follows:
-2.3.3.5. Changes Made by MySQL Installation Wizard
+ 1. Add a login user and group for mysqld to run as:
+shell> groupadd mysql
+shell> useradd -g mysql mysql
+ These commands add the mysql group and the mysql user. The
+ syntax for useradd and groupadd may differ slightly on
+ different versions of Unix, or they may have different names
+ such as adduser and addgroup.
+ You might want to call the user and group something else
+ instead of mysql. If so, substitute the appropriate name in
+ the following steps.
- Once you click the Install button, the MySQL Installation Wizard
- begins the installation process and makes certain changes to your
- system which are described in the sections that follow.
+ 2. Perform the following steps as the mysql user, except as
+ noted.
- Changes to the Registry
+ 3. Pick the directory under which you want to unpack the
+ distribution and change location into it.
- The MySQL Installation Wizard creates one Windows registry key in
- a typical install situation, located in
- HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.
+ 4. Obtain a distribution file using the instructions in Section
+ 2.1.3, "How to Get MySQL."
- The MySQL Installation Wizard creates a key named after the major
- version of the server that is being installed, such as MySQL
- Server 5.1. It contains two string values, Location and Version.
- The Location string contains the path to the installation
- directory. In a default installation it contains C:\Program
- Files\MySQL\MySQL Server 5.1\. The Version string contains the
- release number. For example, for an installation of MySQL Server
- 5.1.39, the key contains a value of 5.1.39.
+ 5. Unpack the distribution into the current directory:
+shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
+ This command creates a directory named mysql-VERSION.
+ With GNU tar, no separate invocation of gunzip is necessary.
+ You can use the following alternative command to uncompress
+ and extract the distribution:
+shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
- These registry keys are used to help external tools identify the
- installed location of the MySQL server, preventing a complete scan
- of the hard-disk to determine the installation path of the MySQL
- server. The registry keys are not required to run the server, and
- if you install MySQL using the noinstall Zip archive, the registry
- keys are not created.
+ 6. Change location into the top-level directory of the unpacked
+ distribution:
+shell> cd mysql-VERSION
+ Note that currently you must configure and build MySQL from
+ this top-level directory. You cannot build it in a different
+ directory.
- Changes to the Start Menu
+ 7. Configure the release and compile everything:
+shell> ./configure --prefix=/usr/local/mysql
+shell> make
+ When you run configure, you might want to specify other
+ options. Run ./configure --help for a list of options. Section
+ 2.3.2, "Typical configure Options," discusses some of the more
+ useful options.
+ If configure fails and you are going to send mail to a MySQL
+ mailing list to ask for assistance, please include any lines
+ from config.log that you think can help solve the problem.
+ Also include the last couple of lines of output from
+ configure. To file a bug report, please use the instructions
+ in Section 1.6, "How to Report Bugs or Problems."
+ If the compile fails, see Section 2.3.4, "Dealing with
+ Problems Compiling MySQL," for help.
- The MySQL Installation Wizard creates a new entry in the Windows
- Start menu under a common MySQL menu heading named after the major
- version of MySQL that you have installed. For example, if you
- install MySQL 5.1, the MySQL Installation Wizard creates a MySQL
- Server 5.1 section in the Start menu.
+ 8. Install the distribution:
+shell> make install
+ You might need to run this command as root.
+ If you want to set up an option file, use one of those present
+ in the support-files directory as a template. For example:
+shell> cp support-files/my-medium.cnf /etc/my.cnf
+ You might need to run this command as root.
+ If you want to configure support for InnoDB tables, you should
+ edit the /etc/my.cnf file, remove the # character before the
+ option lines that start with innodb_..., and modify the option
+ values to be what you want. See Section 4.2.3.3, "Using Option
+ Files," and Section 13.6.2, "InnoDB Configuration."
- The following entries are created within the new Start menu
- section:
+ 9. Change location into the installation directory:
+shell> cd /usr/local/mysql
+ 10. If you ran the make install command as root, the installed
+ files will be owned by root. Ensure that the installation is
+ accessible to mysql by executing the following commands as
+ root in the installation directory:
+shell> chown -R mysql .
+shell> chgrp -R mysql .
+ The first command changes the owner attribute of the files to
+ the mysql user. The second changes the group attribute to the
+ mysql group.
+ 11. If you have not installed MySQL before, you must create the
+ MySQL data directory and initialize the grant tables:
+shell> bin/mysql_install_db --user=mysql
+ If you run the command as root, include the --user option as
+ shown. If you run the command while logged in as mysql, you
+ can omit the --user option.
+ The command should create the data directory and its contents
+ with mysql as the owner.
+ After using mysql_install_db to create the grant tables for
+ MySQL, you must restart the server manually. The mysqld_safe
+ command to do this is shown in a later step.
+ 12. Most of the MySQL installation can be owned by root if you
+ like. The exception is that the data directory must be owned
+ by mysql. To accomplish this, run the following commands as
+ root in the installation directory:
+shell> chown -R root .
+shell> chown -R mysql var
+ 13. If you want MySQL to start automatically when you boot your
+ machine, you can copy support-files/mysql.server to the
+ location where your system has its startup files. More
+ information can be found in the support-files/mysql.server
+ script itself; see also Section 2.13.1.2, "Starting and
+ Stopping MySQL Automatically."
+ 14. You can set up new accounts using the bin/mysql_setpermission
+ script if you install the DBI and DBD::mysql Perl modules. See
+ Section 4.6.14, "mysql_setpermission --- Interactively Set
+ Permissions in Grant Tables." For Perl module installation
+ instructions, see Section 2.15, "Perl Installation Notes."
- * MySQL Command Line Client: This is a shortcut to the mysql
- command-line client and is configured to connect as the root
- user. The shortcut prompts for a root user password when you
- connect.
+ After everything has been installed, you should test your
+ distribution. To start the MySQL server, use the following
+ command:
+shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
- * MySQL Server Instance Config Wizard: This is a shortcut to the
- MySQL Configuration Wizard. Use this shortcut to configure a
- newly installed server, or to reconfigure an existing server.
+ If you run the command as root, you should use the --user option
+ as shown. The value of the option is the name of the login account
+ that you created in the first step to use for running the server.
+ If you run the command while logged in as that user, you can omit
+ the --user option.
- * MySQL Documentation: This is a link to the MySQL server
- documentation that is stored locally in the MySQL server
- installation directory. This option is not available when the
- MySQL server is installed using the Essentials installation
- package.
-
- Changes to the File System
-
- The MySQL Installation Wizard by default installs the MySQL 5.1
- server to C:\Program Files\MySQL\MySQL Server 5.1, where Program
- Files is the default location for applications in your system, and
- 5.1 is the major version of your MySQL server. This is the
- recommended location for the MySQL server, replacing the former
- default location C:\mysql.
+ If the command fails immediately and prints mysqld ended, you can
+ find some information in the host_name.err file in the data
+ directory.
- By default, all MySQL applications are stored in a common
- directory at C:\Program Files\MySQL, where Program Files is the
- default location for applications in your Windows installation. A
- typical MySQL installation on a developer machine might look like
- this:
-C:\Program Files\MySQL\MySQL Server 5.1
-C:\Program Files\MySQL\MySQL Workbench 5.1 OSS
+ More information about mysqld_safe is given in Section 4.3.2,
+ "mysqld_safe --- MySQL Server Startup Script."
- This approach makes it easier to manage and maintain all MySQL
- applications installed on a particular system.
+Note
- In MySQL 5.1.23 and earlier, the default location for the data
- files used by MySQL is located within the corresponding MySQL
- Server installation directory. For MySQL 5.1.24 and later, the
- default location of the data directory is the AppData directory
- configured for the user that installed the MySQL application.
+ The accounts that are listed in the MySQL grant tables initially
+ have no passwords. After starting the server, you should set up
+ passwords for them using the instructions in Section 2.13,
+ "Post-Installation Setup and Testing."
-2.3.3.6. Upgrading MySQL with the Installation Wizard
+2.3.2. Typical configure Options
- The MySQL Installation Wizard can perform server upgrades
- automatically using the upgrade capabilities of MSI. That means
- you do not need to remove a previous installation manually before
- installing a new release. The installer automatically shuts down
- and removes the previous MySQL service before installing the new
- version.
+ The configure script gives you a great deal of control over how
+ you configure a MySQL source distribution. Typically you do this
+ using options on the configure command line. You can also affect
+ configure using certain environment variables. See Section 2.14,
+ "Environment Variables." For a full list of options supported by
+ configure, run this command:
+shell> ./configure --help
- Automatic upgrades are available only when upgrading between
- installations that have the same major and minor version numbers.
- For example, you can upgrade automatically from MySQL 4.1.5 to
- MySQL 4.1.6, but not from MySQL 5.0 to MySQL 5.1.
+ A list of the available configure options is provided in the table
+ below.
- See Section 2.3.14, "Upgrading MySQL on Windows."
+ Table 2.1. Build (configure) Reference
+ Formats Description Default Introduced Removed
+ --bindir=DIR User executables EPREFIX/bin
+ --build=BUILD Configure for building on BUILD guessed
+ --cache-file=FILE Cache test results in FILE disabled
+ -C Alias for `--cache-file=config.cache'
+ --config-cache
+ --datadir=DIR Read-only architecture-independent data PREFIX/share
-2.3.4. MySQL Server Instance Configuration Wizard
+ --disable-FEATURE Do not include FEATURE
+ --disable-dependency-tracking Disable dependency tracking
+ --disable-grant-options Disable GRANT options
+ --disable-largefile Omit support for large files
+ --disable-libtool-lock Disable libtool lock
+ --disable-thread-safe-client Compile the client without threads
+ 5.1.7
+ --enable-FEATURE Enable FEATURE
+ --enable-assembler Use assembler versions of some string functions
+ if available
+ --enable-debug-sync Compile in Debug Sync facility 5.1.41
+ --enable-dependency-tracking Do not reject slow dependency
+ extractors
+ --enable-fast-install Optimize for fast installation yes
+ --enable-local-infile Enable LOAD DATA LOCAL INFILE disabled
+ --enable-shared Build shared libraries yes
+ --enable-static Build static libraries yes
+ --enable-thread-safe-client Compile the client with threads
+ --exec-prefix=EPREFIX Install architecture-dependent files in
+ EPREFIX
+ -h Display this help and exit
+ --help
+ --help=short Display options specific to this package
+ --help=recursive Display the short help of all the included
+ packages
+ --host=HOST Cross-compile to build programs to run on HOST
+ --includedir=DIR C header files PREFIX/include
+ --infodir=DIR Info documentation PREFIX/info
+ --libdir=DIR Object code libraries EPREFIX/lib
+ --libexecdir=DIR Program executables EPREFIX/libexec
+ --localstatedir=DIR Modifiable single-machine data PREFIX/var
+ --mandir=DIR man documentation PREFIX/man
+ -n Do not create output files
+ --no-create
+ --oldincludedir=DIR C header files for non-gcc /usr/include
+ --prefix=PREFIX Install architecture-independent files in PREFIX
- The MySQL Server Instance Configuration Wizard helps automate the
- process of configuring your server. It creates a custom MySQL
- configuration file (my.ini or my.cnf) by asking you a series of
- questions and then applying your responses to a template to
- generate the configuration file that is tuned to your
- installation.
+ --program-prefix=PREFIX Prepend PREFIX to installed program names
- The MySQL Server Instance Configuration Wizard is included with
- the MySQL 5.1 server. The MySQL Server Instance Configuration
- Wizard is only available for Windows.
-
-2.3.4.1. Starting the MySQL Server Instance Configuration Wizard
-
- The MySQL Server Instance Configuration Wizard is normally started
- as part of the installation process. You should only need to run
- the MySQL Server Instance Configuration Wizard again when you need
- to change the configuration parameters of your server.
+ --program-suffix=SUFFIX Append SUFFIX to installed program names
- If you chose not to open a port prior to installing MySQL on
- Windows Vista, you can choose to use the MySQL Server
- Configuration Wizard after installation. However, you must open a
- port in the Windows Firewall. To do this see the instructions
- given in Section 2.3.3.1, "Downloading and Starting the MySQL
- Installation Wizard." Rather than opening a port, you also have
- the option of adding MySQL as a program that bypasses the Windows
- Firewall. One or the other option is sufficient --- you need not
- do both. Additionally, when running the MySQL Server Configuration
- Wizard on Windows Vista ensure that you are logged in as a user
- with administrative rights.
- MySQL Server Instance Configuration Wizard
-
- You can launch the MySQL Configuration Wizard by clicking the
- MySQL Server Instance Config Wizard entry in the MySQL section of
- the Windows Start menu.
+ --program-transform-name=PROGRAM run sed PROGRAM on installed
+ program names
+ -q Do not print `checking...' messages
+ --quiet
+ --sbindir=DIR System admin executables EPREFIX/sbin
+ --sharedstatedir=DIR Modifiable architecture-independent data
+ PREFIX/com
+ --srcdir=DIR Find the sources in DIR configure directory or ..
+ --sysconfdir=DIR Read-only single-machine data PREFIX/etc
+ --target=TARGET Configure for building compilers for TARGET
+ -V Display version information and exit
+ --version
+ --with-PACKAGE Use PACKAGE
+ --with-archive-storage-engine Enable the Archive Storage Engine no
- Alternatively, you can navigate to the bin directory of your MySQL
- installation and launch the MySQLInstanceConfig.exe file directly.
+ --with-atomic-ops Implement atomic operations using pthread
+ rwlocks or atomic CPU instructions for multi-processor 5.1.12
+ --with-berkeley-db Use BerkeleyDB located in DIR no
+ --with-berkeley-db-includes Find Berkeley DB headers in DIR
+ --with-berkeley-db-libs Find Berkeley DB libraries in DIR
+ --with-big-tables Support tables with more than 4 G rows even on
+ 32 bit platforms
+ --with-blackhole-storage-engine Enable the Blackhole Storage
+ Engine no
+ --with-charset Default character set
+ --with-client-ldflags Extra linking arguments for clients
+ --with-collation Default collation
+ --with-comment Comment about compilation environment
+ --with-csv-storage-engine Enable the CSV Storage Engine yes
+ --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS
+ X/Darwin
+ --with-debug Add debug code 5.1.7
+ --with-debug=full Add debug code (adds memory checker, very slow)
- The MySQL Server Instance Configuration Wizard places the my.ini
- file in the installation directory for the MySQL server. This
- helps associate configuration files with particular server
- instances.
+ --with-embedded-privilege-control Build parts to check user's
+ privileges (only affects embedded library)
+ --with-embedded-server Build the embedded server
+ --with-error-inject Enable error injection in MySQL Server
+ 5.1.11
+ --with-example-storage-engine Enable the Example Storage Engine no
- To ensure that the MySQL server knows where to look for the my.ini
- file, an argument similar to this is passed to the MySQL server as
- part of the service installation:
---defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
+ --with-extra-charsets Use charsets in addition to default
+ --with-fast-mutexes Compile with fast mutexes enabled 5.1.5
+ --with-federated-storage-engine Enable federated storage engine no
+ 5.1.3 5.1.9
+ --with-gnu-ld Assume the C compiler uses GNU ld no
+ --with-innodb Enable innobase storage engine no 5.1.3 5.1.9
+ --with-lib-ccflags Extra CC options for libraries
+ --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
+ --with-low-memory Try to use less memory to compile to avoid
+ memory limitations
+ --with-machine-type Set the machine type, like "powerpc"
+ --with-max-indexes=N Sets the maximum number of indexes per table
+ 64
+ --with-mysqld-ldflags Extra linking arguments for mysqld
+ --with-mysqld-libs Extra libraries to link with for mysqld
+ --with-mysqld-user What user the mysqld daemon shall be run as
- Here, C:\Program Files\MySQL\MySQL Server 5.1 is replaced with the
- installation path to the MySQL Server. The --defaults-file option
- instructs the MySQL server to read the specified file for
- configuration options when it starts.
+ --with-mysqlmanager Build the mysqlmanager binary Build if server
+ is built
+ --with-named-curses-libs Use specified curses libraries
+ --with-named-thread-libs Use specified thread libraries
+ --with-ndb-ccflags Extra CC options for ndb compile
+ --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi
+ documentation
+ --with-ndb-port Port for NDB Cluster management server
+ --with-ndb-port-base Port for NDB Cluster management server
+ --with-ndb-sci=DIR Provide MySQL with a custom location of sci
+ library
+ --with-ndb-test Include the NDB Cluster ndbapi test programs
+ --with-ndbcluster Include the NDB Cluster table handler no
+ --with-openssl=DIR Include the OpenSSL support
+ --with-openssl-includes Find OpenSSL headers in DIR
+ --with-openssl-libs Find OpenSSL libraries in DIR
+ --with-other-libc=DIR Link against libc and other standard
+ libraries installed in the specified nonstandard location
+ --with-pic Try to use only PIC/non-PIC objects Use both
+ --with-plugin-PLUGIN Forces the named plugin to be linked into
+ mysqld statically 5.1.11
+ --with-plugins Plugins to include in mysqld none 5.1.11
+ --with-pstack Use the pstack backtrace library
+ --with-pthread Force use of pthread library
+ --with-row-based-replication Include row-based replication 5.1.5
+ 5.1.6
+ --with-server-suffix Append value to the version string
+ --with-ssl=DIR Include SSL support 5.1.11
+ --with-system-type Set the system type, like "sun-solaris10"
+ --with-tags Include additional configurations automatic
+ --with-tcp-port Which port to use for MySQL services 3306
+ --with-unix-socket-path Where to put the unix-domain socket
+ --with-yassl Include the yaSSL support
+ --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom
+ location of compression library
+ --without-PACKAGE Do not use PACKAGE
+ --without-bench Skip building of the benchmark suite
+ --without-debug Build a production version without debugging code
- Apart from making changes to the my.ini file by running the MySQL
- Server Instance Configuration Wizard again, you can modify it by
- opening it with a text editor and making any necessary changes.
- You can also modify the server configuration with the MySQL
- Administrator (http://www.mysql.com/products/administrator/)
- utility. For more information about server configuration, see
- Section 5.1.2, "Server Command Options."
+ --without-docs Skip building of the documentation
+ --without-extra-tools Skip building utilities in the tools
+ directory
+ --without-geometry Do not build geometry-related parts
+ --without-libedit Use system libedit instead of bundled copy
+ --without-man Skip building of the man pages
+ --without-ndb-binlog Disable ndb binlog 5.1.6
+ --without-ndb-debug Disable special ndb debug features
+ --without-plugin-PLUGIN Exclude PLUGIN 5.1.11
+ --without-query-cache Do not build query cache
+ --without-readline Use system readline instead of bundled copy
- MySQL clients and utilities such as the mysql and mysqldump
- command-line clients are not able to locate the my.ini file
- located in the server installation directory. To configure the
- client and utility applications, create a new my.ini file in the
- Windows installation directory (for example, C:\WINDOWS).
+ --without-row-based-replication Don't include row-based
+ replication 5.1.7 5.1.14
+ --without-server Only build the client
+ --without-uca Skip building of the national Unicode collations
- Under Windows Server 2003, Windows Server 2000, Windows XP, and
- Windows Vista MySQL Server Instance Configuration Wizard will
- configure MySQL to work as a Windows service. To start and stop
- MySQL you use the Services application that is supplied as part of
- the Windows Administrator Tools.
-
-2.3.4.2. Choosing a Maintenance Option
-
- If the MySQL Server Instance Configuration Wizard detects an
- existing configuration file, you have the option of either
- reconfiguring your existing server, or removing the server
- instance by deleting the configuration file and stopping and
- removing the MySQL service.
+ Some of the configure options available are described here. For
+ options that may be of use if you have difficulties building
+ MySQL, see Section 2.3.4, "Dealing with Problems Compiling MySQL."
- To reconfigure an existing server, choose the Re-configure
- Instance option and click the Next button. Any existing
- configuration file is not overwritten, but renamed (within the
- same directory) using a timestamp (Windows) or sequential number
- (Linux). To remove the existing server instance, choose the Remove
- Instance option and click the Next button.
+ * To compile just the MySQL client libraries and client programs
+ and not the server, use the --without-server option:
+shell> ./configure --without-server
+ If you have no C++ compiler, some client programs such as
+ mysql cannot be compiled because they require C++.. In this
+ case, you can remove the code in configure that tests for the
+ C++ compiler and then run ./configure with the
+ --without-server option. The compile step should still try to
+ build all clients, but you can ignore any warnings about files
+ such as mysql.cc. (If make stops, try make -k to tell it to
+ continue with the rest of the build even if errors occur.)
- If you choose the Remove Instance option, you advance to a
- confirmation window. Click the Execute button. The MySQL Server
- Configuration Wizard stops and removes the MySQL service, and then
- deletes the configuration file. The server installation and its
- data folder are not removed.
+ * If you want to build the embedded MySQL library (libmysqld.a),
+ use the --with-embedded-server option.
- If you choose the Re-configure Instance option, you advance to the
- Configuration Type dialog where you can choose the type of
- installation that you wish to configure.
-
-2.3.4.3. Choosing a Configuration Type
-
- When you start the MySQL Server Instance Configuration Wizard for
- a new MySQL installation, or choose the Re-configure Instance
- option for an existing installation, you advance to the
- Configuration Type dialog.
- MySQL Server Instance Configuration Wizard: Configuration Type
-
- There are two configuration types available: Detailed
- Configuration and Standard Configuration. The Standard
- Configuration option is intended for new users who want to get
- started with MySQL quickly without having to make many decisions
- about server configuration. The Detailed Configuration option is
- intended for advanced users who want more fine-grained control
- over server configuration.
-
- If you are new to MySQL and need a server configured as a
- single-user developer machine, the Standard Configuration should
- suit your needs. Choosing the Standard Configuration option causes
- the MySQL Configuration Wizard to set all configuration options
- automatically with the exception of Service Options and Security
- Options.
+ * If you don't want your log files and database directories
+ located under /usr/local/var, use a configure command
+ something like one of these:
+shell> ./configure --prefix=/usr/local/mysql
+shell> ./configure --prefix=/usr/local \
+ --localstatedir=/usr/local/mysql/data
+ The first command changes the installation prefix so that
+ everything is installed under /usr/local/mysql rather than the
+ default of /usr/local. The second command preserves the
+ default installation prefix, but overrides the default
+ location for database directories (normally /usr/local/var)
+ and changes it to /usr/local/mysql/data.
+ You can also specify the installation directory and data
+ directory locations at server startup time by using the
+ --basedir and --datadir options. These can be given on the
+ command line or in an MySQL option file, although it is more
+ common to use an option file. See Section 4.2.3.3, "Using
+ Option Files."
- The Standard Configuration sets options that may be incompatible
- with systems where there are existing MySQL installations. If you
- have an existing MySQL installation on your system in addition to
- the installation you wish to configure, the Detailed Configuration
- option is recommended.
+ * This option specifies the port number on which the server
+ listens for TCP/IP connections. The default is port 3306. To
+ listen on a different port, use a configure command like this:
+shell> ./configure --with-tcp-port=3307
- To complete the Standard Configuration, please refer to the
- sections on Service Options and Security Options in Section
- 2.3.4.10, "The Service Options Dialog," and Section 2.3.4.11, "The
- Security Options Dialog," respectively.
+ * If you are using Unix and you want the MySQL socket file
+ location to be somewhere other than the default location
+ (normally in the directory /tmp or /var/run), use a configure
+ command like this:
+shell> ./configure \
+ --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
+ The socket file name must be an absolute path name. You can
+ also change the location of mysql.sock at server startup by
+ using a MySQL option file. See Section B.5.4.5, "How to
+ Protect or Change the MySQL Unix Socket File."
-2.3.4.4. The Server Type Dialog
+ * If you want to compile statically linked programs (for
+ example, to make a binary distribution, to get better
+ performance, or to work around problems with some Red Hat
+ Linux distributions), run configure like this:
+shell> ./configure --with-client-ldflags=-all-static \
+ --with-mysqld-ldflags=-all-static
- There are three different server types available to choose from.
- The server type that you choose affects the decisions that the
- MySQL Server Instance Configuration Wizard makes with regard to
- memory, disk, and processor usage.
- MySQL Server Instance Configuration Wizard: Server Type
+ * If you are using gcc and don't have libg++ or libstdc++
+ installed, you can tell configure to use gcc as your C++
+ compiler:
+shell> CC=gcc CXX=gcc ./configure
+ When you use gcc as your C++ compiler, it does not attempt to
+ link in libg++ or libstdc++. This may be a good thing to do
+ even if you have those libraries installed. Some versions of
+ them have caused strange problems for MySQL users in the past.
+ The following list indicates some compilers and environment
+ variable settings that are commonly used with each one.
- * Developer Machine: Choose this option for a typical desktop
- workstation where MySQL is intended only for personal use. It
- is assumed that many other desktop applications are running.
- The MySQL server is configured to use minimal system
- resources.
+ + gcc 2.7.2:
+CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
- * Server Machine: Choose this option for a server machine where
- the MySQL server is running alongside other server
- applications such as FTP, email, and Web servers. The MySQL
- server is configured to use a moderate portion of the system
- resources.
+ + gcc 2.95.2:
+CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
+-felide-constructors -fno-exceptions -fno-rtti"
- * Dedicated MySQL Server Machine: Choose this option for a
- server machine that is intended to run only the MySQL server.
- It is assumed that no other applications are running. The
- MySQL server is configured to use all available system
- resources.
+ + pgcc 2.90.29 or newer:
+CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
+CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
+-felide-constructors -fno-exceptions -fno-rtti"
+ In most cases, you can get a reasonably optimized MySQL binary
+ by using the options from the preceding list and adding the
+ following options to the configure line:
+--prefix=/usr/local/mysql --enable-assembler \
+--with-mysqld-ldflags=-all-static
+ The full configure line would, in other words, be something
+ like the following for all recent gcc versions:
+CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
+-felide-constructors -fno-exceptions -fno-rtti" ./configure \
+--prefix=/usr/local/mysql --enable-assembler \
+--with-mysqld-ldflags=-all-static
+ The binaries we provide on the MySQL Web site at
+ http://dev.mysql.com/downloads/ are all compiled with full
+ optimization and should be perfect for most users. See Section
+ 2.2, "Installing MySQL from Generic Binaries on Unix/Linux."
+ There are some configuration settings you can tweak to build
+ an even faster binary, but these are only for advanced users.
+ See Section 7.5.1, "How Compiling and Linking Affects the
+ Speed of MySQL."
+ If the build fails and produces errors about your compiler or
+ linker not being able to create the shared library
+ libmysqlclient.so.N (where N is a version number), you can
+ work around this problem by giving the --disable-shared option
+ to configure. In this case, configure does not build a shared
+ libmysqlclient.so.N library.
-Note
+ * By default, MySQL uses the latin1 (cp1252 West European)
+ character set. To change the default set, use the
+ --with-charset option:
+shell> ./configure --with-charset=CHARSET
+ CHARSET may be one of binary, armscii8, ascii, big5, cp1250,
+ cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8,
+ eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8,
+ keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce,
+ macroman, sjis, swe7, tis620, ucs2, ujis, utf8. See Section
+ 9.2, "The Character Set Used for Data and Sorting."
+ (Additional character sets might be available. Check the
+ output from ./configure --help for the current list.)
+ The default collation may also be specified. MySQL uses the
+ latin1_swedish_ci collation by default. To change this, use
+ the --with-collation option:
+shell> ./configure --with-collation=COLLATION
+ To change both the character set and the collation, use both
+ the --with-charset and --with-collation options. The collation
+ must be a legal collation for the character set. (Use the SHOW
+ COLLATION statement to determine which collations are
+ available for each character set.)
+ With the configure option --with-extra-charsets=LIST, you can
+ define which additional character sets should be compiled into
+ the server. LIST is one of the following:
- By selecting one of the preconfigured configurations, the values
- and settings of various options in your my.cnf or my.ini will be
- altered accordingly. The default values and options as described
- in the reference manual may therefore be different to the options
- and values that were created during the execution of the
- configuration wizard.
+ + A list of character set names separated by spaces
-2.3.4.5. The Database Usage Dialog
+ + complex to include all character sets that can't be
+ dynamically loaded
- The Database Usage dialog allows you to indicate the storage
- engines that you expect to use when creating MySQL tables. The
- option you choose determines whether the InnoDB storage engine is
- available and what percentage of the server resources are
- available to InnoDB.
- MySQL Server Instance Configuration Wizard: Usage Dialog
+ + all to include all character sets into the binaries
+ Clients that want to convert characters between the server and
+ the client should use the SET NAMES statement. See Section
+ 5.1.5, "Session System Variables," and Section 9.1.4,
+ "Connection Character Sets and Collations."
- * Multifunctional Database: This option enables both the InnoDB
- and MyISAM storage engines and divides resources evenly
- between the two. This option is recommended for users who use
- both storage engines on a regular basis.
+ * To configure MySQL with debugging code, use the --with-debug
+ option:
+shell> ./configure --with-debug
+ This causes a safe memory allocator to be included that can
+ find some errors and that provides output about what is
+ happening. See MySQL Internals: Porting
+ (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
+ As of MySQL 5.1.12, using --with-debug to configure MySQL with
+ debugging support enables you to use the
+ --debug="d,parser_debug" option when you start the server.
+ This causes the Bison parser that is used to process SQL
+ statements to dump a parser trace to the server's standard
+ error output. Typically, this output is written to the error
+ log.
- * Transactional Database Only: This option enables both the
- InnoDB and MyISAM storage engines, but dedicates most server
- resources to the InnoDB storage engine. This option is
- recommended for users who use InnoDB almost exclusively and
- make only minimal use of MyISAM.
+ * To cause the Debug Sync facility to be compiled into the
+ server, use the --enable-debug-sync option. This facility is
+ used for testing and debugging. When compiled in, Debug Sync
+ is disabled by default. To enable it, start mysqld with the
+ --debug-sync-timeout=N option, where N is a timeout value
+ greater than 0. (The default value is 0, which disables Debug
+ Sync.) N becomes the default timeout for individual
+ synchronization points.
+ Debug Sync is also compiled in if you configure with the
+ --with-debug option (which implies --enable-debug-sync),
+ unless you also use the --disable-debug-sync option.
+ For a description of the Debug Sync facility and how to use
+ synchronization points, see MySQL Internals: Test
+ Synchronization
+ (http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronizat
+ ion).
+ The --enable-debug-sync and --disable-debug-sync options were
+ added in MySQL 5.1.41.
- * Non-Transactional Database Only: This option disables the
- InnoDB storage engine completely and dedicates all server
- resources to the MyISAM storage engine. This option is
- recommended for users who do not use InnoDB.
+ * If your client programs are using threads, you must compile a
+ thread-safe version of the MySQL client library with the
+ --enable-thread-safe-client configure option. This creates a
+ libmysqlclient_r library with which you should link your
+ threaded applications. See Section 21.9.16.2, "How to Make a
+ Threaded Client."
- The Configuration Wizard uses a template to generate the server
- configuration file. The Database Usage dialog sets one of the
- following option strings:
-Multifunctional Database: MIXED
-Transactional Database Only: INNODB
-Non-Transactional Database Only: MYISAM
+ * Some features require that the server be built with
+ compression library support, such as the COMPRESS() and
+ UNCOMPRESS() functions, and compression of the client/server
+ protocol. The --with-zlib-dir=no|bundled|DIR option provides
+ control over compression library support. The value no
+ explicitly disables compression support. bundled causes the
+ zlib library bundled in the MySQL sources to be used. A DIR
+ path name specifies the directory in which to find the
+ compression library sources.
- When these options are processed through the default template
- (my-template.ini) the result is:
-Multifunctional Database:
-default-storage-engine=InnoDB
-_myisam_pct=50
+ * It is possible to build MySQL with large table support using
+ the --with-big-tables option.
+ This option causes the variables that store table row counts
+ to be declared as unsigned long long rather than unsigned
+ long. This enables tables to hold up to approximately
+ 1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows.
+ Previously it was necessary to pass -DBIG_TABLES to the
+ compiler manually in order to enable this feature.
-Transactional Database Only:
-default-storage-engine=InnoDB
-_myisam_pct=5
+ * Run configure with the --disable-grant-options option to cause
+ the --bootstrap, --skip-grant-tables, and --init-file options
+ for mysqld to be disabled. For Windows, the configure.js
+ script recognizes the DISABLE_GRANT_OPTIONS flag, which has
+ the same effect. The capability is available as of MySQL
+ 5.1.15.
-Non-Transactional Database Only:
-default-storage-engine=MyISAM
-_myisam_pct=100
-skip-innodb
+ * This option allows MySQL Community Server features to be
+ enabled. Additional options may be required for individual
+ features, such as --enable-profiling to enable statement
+ profiling. This option was added in MySQL 5.1.24. It is
+ enabled by default as of MySQL 5.1.28; to disable it, use
+ --disable-community-features.
- The _myisam_pct value is used to calculate the percentage of
- resources dedicated to MyISAM. The remaining resources are
- allocated to InnoDB.
+ * When given with --enable-community-features, the
+ --enable-profiling option enables the statement profiling
+ capability exposed by the SHOW PROFILE and SHOW PROFILES
+ statements. (See Section 12.5.5.33, "SHOW PROFILES Syntax.")
+ This option was added in MySQL 5.1.24. It is enabled by
+ default as of MySQL 5.1.28; to disable it, use
+ --disable-profiling.
-2.3.4.6. The InnoDB Tablespace Dialog
+ * See Section 2.1, "General Installation Guidance," for options
+ that pertain to particular operating systems.
- Some users may want to locate the InnoDB tablespace files in a
- different location than the MySQL server data directory. Placing
- the tablespace files in a separate location can be desirable if
- your system has a higher capacity or higher performance storage
- device available, such as a RAID storage system.
- MySQL Server Instance Configuration Wizard: InnoDB Data Tablespace
+ * See Section 5.5.7.2, "Using SSL Connections," for options that
+ pertain to configuring MySQL to support secure (encrypted)
+ connections.
- To change the default location for the InnoDB tablespace files,
- choose a new drive from the drop-down list of drive letters and
- choose a new path from the drop-down list of paths. To create a
- custom path, click the ... button.
-
- If you are modifying the configuration of an existing server, you
- must click the Modify button before you change the path. In this
- situation you must move the existing tablespace files to the new
- location manually before starting the server.
-
-2.3.4.7. The Concurrent Connections Dialog
-
- To prevent the server from running out of resources, it is
- important to limit the number of concurrent connections to the
- MySQL server that can be established. The Concurrent Connections
- dialog allows you to choose the expected usage of your server, and
- sets the limit for concurrent connections accordingly. It is also
- possible to set the concurrent connection limit manually.
- MySQL Server Instance Configuration Wizard: Connections
-
- * Decision Support (DSS)/OLAP: Choose this option if your server
- does not require a large number of concurrent connections. The
- maximum number of connections is set at 100, with an average
- of 20 concurrent connections assumed.
-
- * Online Transaction Processing (OLTP): Choose this option if
- your server requires a large number of concurrent connections.
- The maximum number of connections is set at 500.
+ * Several configure options apply to plugin selection and
+ building:
+--with-plugins=PLUGIN[,PLUGIN]...
+--with-plugins=GROUP
+--with-plugin-PLUGIN
+--without-plugin-PLUGIN
+ PLUGIN is an individual plugin name such as csv or archive.
+ As shorthand, GROUP is a configuration group name such as none
+ (select no plugins) or all (select all plugins).
+ You can build a plugin as static (compiled into the server) or
+ dynamic (built as a dynamic library that must be installed
+ using the INSTALL PLUGIN statement before it can be used).
+ Some plugins might not support static or dynamic build.
+ configure --help shows the following information pertaining to
+ plugins:
- * Manual Setting: Choose this option to set the maximum number
- of concurrent connections to the server manually. Choose the
- number of concurrent connections from the drop-down box
- provided, or enter the maximum number of connections into the
- drop-down box if the number you desire is not listed.
+ + The plugin-related options
-2.3.4.8. The Networking and Strict Mode Options Dialog
+ + The names of all available plugins
- Use the Networking Options dialog to enable or disable TCP/IP
- networking and to configure the port number that is used to
- connect to the MySQL server.
- MySQL Server Instance Configuration Wizard: Network Configuration
+ + For each plugin, a description of its purpose, which
+ build types it supports (static or dynamic), and which
+ plugin groups it is a part of.
+ --with-plugins can take a list of one or more plugin names
+ separated by commas, or a plugin group name. The named plugins
+ are configured to be built as static plugins.
+ --with-plugin-PLUGIN configures the given plugin to be built
+ as a static plugin.
+ --without-plugin-PLUGIN disables the given plugin from being
+ built.
+ If a plugin is named both with a --with and --without option,
+ the result is undefined.
+ For any plugin that is not explicitly selected or disabled, it
+ is selected to be built dynamically if it supports dynamic
+ build, and not built if it does not support dynamic build.
+ (Thus, in the case that no plugin options are given, all
+ plugins that support dynamic build are selected to be built as
+ dynamic plugins. Plugins that do not support dynamic build are
+ not built.)
- TCP/IP networking is enabled by default. To disable TCP/IP
- networking, uncheck the box next to the Enable TCP/IP Networking
- option.
+2.3.3. Installing from the Development Source Tree
- Port 3306 is used by default. To change the port used to access
- MySQL, choose a new port number from the drop-down box or type a
- new port number directly into the drop-down box. If the port
- number you choose is in use, you are prompted to confirm your
- choice of port number.
+Caution
- Set the Server SQL Mode to either enable or disable strict mode.
- Enabling strict mode (default) makes MySQL behave more like other
- database management systems. If you run applications that rely on
- MySQL's old "forgiving" behavior, make sure to either adapt those
- applications or to disable strict mode. For more information about
- strict mode, see Section 5.1.8, "Server SQL Modes."
+ You should read this section only if you are interested in helping
+ us test our new code. If you just want to get MySQL up and running
+ on your system, you should use a standard release distribution
+ (either a binary or source distribution).
-2.3.4.9. The Character Set Dialog
+ To obtain the most recent development source tree, you must have
+ Bazaar installed. You can obtain Bazaar from the Bazaar VCS
+ Website (http://bazaar-vcs.org) Bazaar is supported by any
+ platform that supports Python, and is therefore compatible with
+ any Linux, Unix, Windows or Mac OS X host. Instructions for
+ downloading and installing Bazaar on the different platforms are
+ available on the Bazaar website.
- The MySQL server supports multiple character sets and it is
- possible to set a default server character set that is applied to
- all tables, columns, and databases unless overridden. Use the
- Character Set dialog to change the default character set of the
- MySQL server.
- MySQL Server Instance Configuration Wizard: Character Set
+ All MySQL projects are hosted on Launchpad
+ (http://launchpad.net/) MySQL projects, including MySQL server,
+ MySQL Workbench, and others are available from the Sun/MySQL
+ Engineering (http://launchpad.net/~mysql) page. For the
+ repositories related only to MySQL server, see the MySQL Server
+ (http://launchpad.net/mysql-server) page.
- * Standard Character Set: Choose this option if you want to use
- latin1 as the default server character set. latin1 is used for
- English and many Western European languages.
+ To build under Unix/Linux, you must have the following tools
+ installed:
- * Best Support For Multilingualism: Choose this option if you
- want to use utf8 as the default server character set. This is
- a Unicode character set that can store characters from many
- different languages.
+ * GNU make, available from http://www.gnu.org/software/make/.
+ Although some platforms come with their own make
+ implementations, it is highly recommended that you use GNU
+ make. It may already be available on your system as gmake.
- * Manual Selected Default Character Set / Collation: Choose this
- option if you want to pick the server's default character set
- manually. Choose the desired character set from the provided
- drop-down list.
+ * autoconf 2.58 (or newer), available from
+ http://www.gnu.org/software/autoconf/.
-2.3.4.10. The Service Options Dialog
+ * automake 1.8.1, available from
+ http://www.gnu.org/software/automake/.
- On Windows platforms, the MySQL server can be installed as a
- Windows service. When installed this way, the MySQL server can be
- started automatically during system startup, and even restarted
- automatically by Windows in the event of a service failure.
+ * libtool 1.5, available from
+ http://www.gnu.org/software/libtool/.
- The MySQL Server Instance Configuration Wizard installs the MySQL
- server as a service by default, using the service name MySQL. If
- you do not wish to install the service, uncheck the box next to
- the Install As Windows Service option. You can change the service
- name by picking a new service name from the drop-down box provided
- or by entering a new service name into the drop-down box.
+ * m4, available from http://www.gnu.org/software/m4/.
-Note
+ * bison, available from http://www.gnu.org/software/bison/. You
+ should use the latest version of bison where possible. Version
+ 1.75 and version 2.1 are known to work. There have been
+ reported problems with bison 1.875. If you experience
+ problems, upgrade to a later, rather than earlier, version.
+ Versions of bison older than 1.75 may report this error:
+sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
+ The maximum table size is not actually exceeded; the error is
+ caused by bugs in older versions of bison.
- Service names can include any legal character except forward (/)
- or backward (\) slashes, and must be less than 256 characters
- long.
+ To build under Windows you must have Microsoft Visual C++ 2005
+ Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio
+ 2005 (8.0) compiler system.
-Warning
+ Once the necessary tools are installed, you must create a local
+ branch of the MySQL source code on your machine:
- If you are installing multiple versions of MySQL onto the same
- machine, you must choose a different service name for each version
- that you install. If you do not choose a different service for
- each installed version then the service manager information will
- be inconsistent and this will cause problems when you try to
- uninstall a previous version.
+ 1. To obtain a copy of the MySQL source code, you must create a
+ new Bazaar branch. If you do not already have a Bazaar
+ repository directory set up, you need to initialize a new
+ directory:
+shell> mkdir mysql-server
+shell> bzr init-repo --trees mysql-server
- If you have already installed multiple versions using the same
- service name, you must manually edit the contents of the
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters
- within the Windows registry to update the association of the
- service name with the correct server version.
+ 2. Once you have an initialized directory, you can branch from
+ the public MySQL server repositories to create a local source
+ tree. To create a branch of a specific version:
+shell> cd mysql-server
+shell> bzr branch lp:mysql-server/5.1 mysql-5.1
- Typically, when installing multiple versions you create a service
- name based on the version information. For example, you might
- install MySQL 5.x as mysql5, or specific versions such as MySQL
- 5.1.30 as mysql50130.
+ 3. The initial download will take some time to complete,
+ depending on the speed of your connection. Please be patient.
+ Once you have downloaded the first tree, additional trees
+ should take significantly less time to download.
- To install the MySQL server as a service but not have it started
- automatically at startup, uncheck the box next to the Launch the
- MySQL Server Automatically option.
+ 4. When building from the Bazaar branch, you may want to create a
+ copy of your active branch so that you can make configuration
+ and other changes without affecting the original branch
+ contents. You can achieve this by branching from the original
+ branch:
+shell> bzr branch mysql-5.1 mysql-5.1-build
-2.3.4.11. The Security Options Dialog
+ 5. To obtain changes made after you have set up the branch
+ initially, update it using the pull option periodically. Use
+ this command in the top-level directory of the local copy:
+shell> bzr pull
+ You can examine the changeset comments for the tree by using
+ the log option to bzr:
+shell> bzr log
+ You can also browse changesets, comments, and source code
+ online. To browse this information for MySQL 5.1, go to the
+ Launchpad MySQL Server (http://launchpad.net/mysql-server)
+ page.
+ If you see diffs (changes) or code that you have a question
+ about, do not hesitate to send email to the MySQL internals
+ mailing list. See Section 1.5.1, "MySQL Mailing Lists." Also,
+ if you think you have a better idea on how to do something,
+ send an email message to the list with a patch.
+
+ After you have the local branch, you can build MySQL server from
+ the source code. On Windows, the build process is different from
+ Unix/Linux: see Section 2.5.10, "Installing MySQL from Source on
+ Windows."
- It is strongly recommended that you set a root password for your
- MySQL server, and the MySQL Server Instance Configuration Wizard
- requires by default that you do so. If you do not wish to set a
- root password, uncheck the box next to the Modify Security
- Settings option.
- MySQL Server Instance Configuration Wizard: Security
+ On Unix/Linux, use the autoconf system to create the configure
+ script so that you can configure the build environment before
+ building. The following example shows the typical commands
+ required to build MySQL from a source tree.
- To set the root password, enter the desired password into both the
- New root password and Confirm boxes. If you are reconfiguring an
- existing server, you need to enter the existing root password into
- the Current root password box.
+ 1. Change location to the top-level directory of the source tree;
+ replace mysql-5.1 with the appropriate directory name.
+shell> cd mysql-5.1
- To prevent root logins from across the network, check the box next
- to the Root may only connect from localhost option. This increases
- the security of your root account.
+ 2. Prepare the source tree for configuration.
+ Prior to MySQL 5.1.12, you must separately configure the
+ InnoDB storage engine. Run the following command from the main
+ source directory:
+shell> (cd storage/innobase; autoreconf --force --install)
+ You can omit the previous command for MySQL 5.1.12 and later,
+ or if you do not require InnoDB support.
+ Prepare the remainder of the source tree:
+shell> autoreconf --force --install
+ As an alternative to the preceding autoreconf command, you can
+ use BUILD/autorun.sh, which acts as a shortcut for the
+ following sequence of commands:
+shell> aclocal; autoheader
+shell> libtoolize --automake --force
+shell> automake --force --add-missing; autoconf
+ If you get some strange errors during this stage, verify that
+ you have the correct version of libtool installed.
- To create an anonymous user account, check the box next to the
- Create An Anonymous Account option. Creating an anonymous account
- can decrease server security and cause login and permission
- difficulties. For this reason, it is not recommended.
+ 3. Configure the source tree and compile MySQL:
+shell> ./configure # Add your favorite options here
+shell> make
+ For a description of some configure options, see Section
+ 2.3.2, "Typical configure Options."
+ A collection of our standard configuration scripts is located
+ in the BUILD/ subdirectory. For example, you may find it more
+ convenient to use the BUILD/compile-pentium-debug script than
+ the preceding set of shell commands. To compile on a different
+ architecture, modify the script by removing flags that are
+ Pentium-specific, or use another script that may be more
+ appropriate. These scripts are provided on an "as-is" basis.
+ They are not officially maintained and their contents may
+ change from release to release.
-2.3.4.12. The Confirmation Dialog
+ 4. When the build is done, run make install. Be careful with this
+ on a production machine; the command may overwrite your live
+ release installation. If you already have MySQL installed and
+ do not want to overwrite it, run ./configure with values for
+ the --prefix, --with-tcp-port, and --with-unix-socket-path
+ options different from those used for your production server.
- The final dialog in the MySQL Server Instance Configuration Wizard
- is the Confirmation Dialog. To start the configuration process,
- click the Execute button. To return to a previous dialog, click
- the Back button. To exit the MySQL Server Instance Configuration
- Wizard without configuring the server, click the Cancel button.
- MySQL Server Instance Configuration Wizard: Confirmation
+ 5. Play hard with your new installation and try to make the new
+ features crash. Start by running make test. See Section
+ 22.1.2, "MySQL Test Suite."
- After you click the Execute button, the MySQL Server Instance
- Configuration Wizard performs a series of tasks and displays the
- progress onscreen as the tasks are performed.
+ 6. If you have gotten to the make stage, but the distribution
+ does not compile, please enter the problem into our bugs
+ database using the instructions given in Section 1.6, "How to
+ Report Bugs or Problems." If you have installed the latest
+ versions of the required GNU tools, and they crash trying to
+ process our configuration files, please report that also.
+ However, if you get a command not found error or a similar
+ problem for aclocal, configure, or other required tools, do
+ not report it. Instead, make sure that all the required tools
+ are installed and that your PATH variable is set correctly so
+ that your shell can find them.
- The MySQL Server Instance Configuration Wizard first determines
- configuration file options based on your choices using a template
- prepared by MySQL developers and engineers. This template is named
- my-template.ini and is located in your server installation
- directory.
+2.3.4. Dealing with Problems Compiling MySQL
- The MySQL Configuration Wizard then writes these options to the
- corresponding configuration file.
+ All MySQL programs compile cleanly for us with no warnings on
+ Solaris or Linux using gcc. On other systems, warnings may occur
+ due to differences in system include files. See Section 2.3.5,
+ "MIT-pthreads Notes," for warnings that may occur when using
+ MIT-pthreads. For other problems, check the following list.
- If you chose to create a service for the MySQL server, the MySQL
- Server Instance Configuration Wizard creates and starts the
- service. If you are reconfiguring an existing service, the MySQL
- Server Instance Configuration Wizard restarts the service to apply
- your configuration changes.
-
- If you chose to set a root password, the MySQL Configuration
- Wizard connects to the server, sets your new root password, and
- applies any other security settings you may have selected.
-
- After the MySQL Server Instance Configuration Wizard has completed
- its tasks, it displays a summary. Click the Finish button to exit
- the MySQL Server Configuration Wizard.
+ The solution to many problems involves reconfiguring. If you do
+ need to reconfigure, take note of the following:
-2.3.5. Installing MySQL from a Noinstall Zip Archive
+ * If configure is run after it has previously been run, it may
+ use information that was gathered during its previous
+ invocation. This information is stored in config.cache. When
+ configure starts up, it looks for that file and reads its
+ contents if it exists, on the assumption that the information
+ is still correct. That assumption is invalid when you
+ reconfigure.
- Users who are installing from the Noinstall package can use the
- instructions in this section to manually install MySQL. The
- process for installing MySQL from a Zip archive is as follows:
+ * Each time you run configure, you must run make again to
+ recompile. However, you may want to remove old object files
+ from previous builds first because they were compiled using
+ different configuration options.
- 1. Extract the archive to the desired install directory
+ To prevent old configuration information or object files from
+ being used, run these commands before re-running configure:
+shell> rm config.cache
+shell> make clean
- 2. Create an option file
+ Alternatively, you can run make distclean.
- 3. Choose a MySQL server type
+ The following list describes some of the problems when compiling
+ MySQL that have been found to occur most often:
- 4. Start the MySQL server
+ * If you get errors such as the ones shown here when compiling
+ sql_yacc.cc, you probably have run out of memory or swap
+ space:
+Internal compiler error: program cc1plus got fatal signal 11
+Out of virtual memory
+Virtual memory exhausted
+ The problem is that gcc requires a huge amount of memory to
+ compile sql_yacc.cc with inline functions. Try running
+ configure with the --with-low-memory option:
+shell> ./configure --with-low-memory
+ This option causes -fno-inline to be added to the compile line
+ if you are using gcc and -O0 if you are using something else.
+ You should try the --with-low-memory option even if you have
+ so much memory and swap space that you think you can't
+ possibly have run out. This problem has been observed to occur
+ even on systems with generous hardware configurations, and the
+ --with-low-memory option usually fixes it.
- 5. Secure the default user accounts
+ * By default, configure picks c++ as the compiler name and GNU
+ c++ links with -lg++. If you are using gcc, that behavior can
+ cause problems during configuration such as this:
+configure: error: installation or configuration problem:
+C++ compiler cannot create executables.
+ You might also observe problems during compilation related to
+ g++, libg++, or libstdc++.
+ One cause of these problems is that you may not have g++, or
+ you may have g++ but not libg++, or libstdc++. Take a look at
+ the config.log file. It should contain the exact reason why
+ your C++ compiler didn't work. To work around these problems,
+ you can use gcc as your C++ compiler. Try setting the
+ environment variable CXX to "gcc -O3". For example:
+shell> CXX="gcc -O3" ./configure
+ This works because gcc compiles C++ source files as well as
+ g++ does, but does not link in libg++ or libstdc++ by default.
+ Another way to fix these problems is to install g++, libg++,
+ and libstdc++. However, do not use libg++ or libstdc++ with
+ MySQL because this only increases the binary size of mysqld
+ without providing any benefits. Some versions of these
+ libraries have also caused strange problems for MySQL users in
+ the past.
- This process is described in the sections that follow.
+ * If your compile fails with errors such as any of the
+ following, you must upgrade your version of make to GNU make:
+making all in mit-pthreads
+make: Fatal error in reader: Makefile, line 18:
+Badly formed macro assignment
+ Or:
+make: file `Makefile' line 18: Must be a separator (:
+ Or:
+pthread.h: No such file or directory
+ Solaris and FreeBSD are known to have troublesome make
+ programs.
+ GNU make 3.75 is known to work.
-2.3.6. Extracting the Install Archive
+ * If you want to define flags to be used by your C or C++
+ compilers, do so by adding the flags to the CFLAGS and
+ CXXFLAGS environment variables. You can also specify the
+ compiler names this way using CC and CXX. For example:
+shell> CC=gcc
+shell> CFLAGS=-O3
+shell> CXX=gcc
+shell> CXXFLAGS=-O3
+shell> export CC CFLAGS CXX CXXFLAGS
+ See Section 2.2, "Installing MySQL from Generic Binaries on
+ Unix/Linux," for a list of flag definitions that have been
+ found to be useful on various systems.
- To install MySQL manually, do the following:
+ * If you get errors such as those shown here when compiling
+ mysqld, configure did not correctly detect the type of the
+ last argument to accept(), getsockname(), or getpeername():
+cxx: Error: mysqld.cc, line 645: In this statement, the referenced
+ type of the pointer value ''length'' is ''unsigned long'',
+ which is not compatible with ''int''.
+new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
+ To fix this, edit the config.h file (which is generated by
+ configure). Look for these lines:
+/* Define as the base type of the last arg to accept */
+#define SOCKET_SIZE_TYPE XXX
+ Change XXX to size_t or int, depending on your operating
+ system. (You must do this each time you run configure because
+ configure regenerates config.h.)
- 1. If you are upgrading from a previous version please refer to
- Section 2.3.14, "Upgrading MySQL on Windows," before beginning
- the upgrade process.
+ * The sql_yacc.cc file is generated from sql_yacc.yy. Normally,
+ the build process does not need to create sql_yacc.cc because
+ MySQL comes with a pre-generated copy. However, if you do need
+ to re-create it, you might encounter this error:
+"sql_yacc.yy", line xxx fatal: default action causes potential...
+ This is a sign that your version of yacc is deficient. You
+ probably need to install bison (the GNU version of yacc) and
+ use that instead.
- 2. Make sure that you are logged in as a user with administrator
- privileges.
+ * On Debian Linux 3.0, you need to install gawk instead of the
+ default mawk.
- 3. Choose an installation location. Traditionally, the MySQL
- server is installed in C:\mysql. The MySQL Installation Wizard
- installs MySQL under C:\Program Files\MySQL. If you do not
- install MySQL at C:\mysql, you must specify the path to the
- install directory during startup or in an option file. See
- Section 2.3.7, "Creating an Option File."
+ * If you need to debug mysqld or a MySQL client, run configure
+ with the --with-debug option, and then recompile and link your
+ clients with the new client library. See MySQL Internals:
+ Porting (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
- 4. Extract the install archive to the chosen installation
- location using your preferred Zip archive tool. Some tools may
- extract the archive to a folder within your chosen
- installation location. If this occurs, you can move the
- contents of the subfolder into the chosen installation
- location.
+ * If you get a compilation error on Linux (for example, SuSE
+ Linux 8.1 or Red Hat Linux 7.3) similar to the following one,
+ you probably do not have g++ installed:
+libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
+incompatible pointer type
+libmysql.c:1329: too few arguments to function `gethostbyname_r'
+libmysql.c:1329: warning: assignment makes pointer from integer
+without a cast
+make[2]: *** [libmysql.lo] Error 1
+ By default, the configure script attempts to determine the
+ correct number of arguments by using g++ (the GNU C++
+ compiler). This test yields incorrect results if g++ is not
+ installed. There are two ways to work around this problem:
-2.3.7. Creating an Option File
+ + Make sure that the GNU C++ g++ is installed. On some
+ Linux distributions, the required package is called gpp;
+ on others, it is named gcc-c++.
- If you need to specify startup options when you run the server,
- you can indicate them on the command line or place them in an
- option file. For options that are used every time the server
- starts, you may find it most convenient to use an option file to
- specify your MySQL configuration. This is particularly true under
- the following circumstances:
+ + Use gcc as your C++ compiler by setting the CXX
+ environment variable to gcc:
+export CXX="gcc"
+ You must run configure again after making either of those
+ changes.
- * The installation or data directory locations are different
- from the default locations (C:\Program Files\MySQL\MySQL
- Server 5.1 and C:\Program Files\MySQL\MySQL Server 5.1\data).
+2.3.5. MIT-pthreads Notes
- * You need to tune the server settings, such as memory, cache,
- or InnoDB configuration information.
+ This section describes some of the issues involved in using
+ MIT-pthreads.
- When the MySQL server starts on Windows, it looks for options in
- two files: the my.ini file in the Windows directory, and the
- C:\my.cnf file. The Windows directory typically is named something
- like C:\WINDOWS. You can determine its exact location from the
- value of the WINDIR environment variable using the following
- command:
-C:\> echo %WINDIR%
+ On Linux, you should not use MIT-pthreads. Use the installed
+ LinuxThreads implementation instead. See Section 2.6, "Installing
+ MySQL on Linux."
- MySQL looks for options first in the my.ini file, and then in the
- my.cnf file. However, to avoid confusion, it is best if you use
- only one file. If your PC uses a boot loader where C: is not the
- boot drive, your only option is to use the my.ini file. Whichever
- option file you use, it must be a plain text file.
+ If your system does not provide native thread support, you should
+ build MySQL using the MIT-pthreads package. This includes older
+ FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some
+ others. See Section 2.1, "General Installation Guidance."
- You can also make use of the example option files included with
- your MySQL distribution; see Section 4.2.3.3.2, "Preconfigured
- Option Files."
+ MIT-pthreads is not part of the MySQL 5.1 source distribution. If
+ you require this package, you need to download it separately from
+ http://dev.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.t
+ ar.gz
- An option file can be created and modified with any text editor,
- such as Notepad. For example, if MySQL is installed in E:\mysql
- and the data directory is in E:\mydata\data, you can create an
- option file containing a [mysqld] section to specify values for
- the basedir and datadir options:
-[mysqld]
-# set basedir to your installation path
-basedir=E:/mysql
-# set datadir to the location of your data directory
-datadir=E:/mydata/data
+ After downloading, extract this source archive into the top level
+ of the MySQL source directory. It creates a new subdirectory named
+ mit-pthreads.
- Note that Windows path names are specified in option files using
- (forward) slashes rather than backslashes. If you do use
- backslashes, you must double them:
-[mysqld]
-# set basedir to your installation path
-basedir=E:\\mysql
-# set datadir to the location of your data directory
-datadir=E:\\mydata\\data
+ * On most systems, you can force MIT-pthreads to be used by
+ running configure with the --with-mit-threads option:
+shell> ./configure --with-mit-threads
+ Building in a nonsource directory is not supported when using
+ MIT-pthreads because we want to minimize our changes to this
+ code.
- MySQL Enterprise For expert advice on the start-up options
- appropriate to your circumstances, subscribe to the MySQL
- Enterprise Monitor. For more information, see
- http://www.mysql.com/products/enterprise/advisors.html.
+ * The checks that determine whether to use MIT-pthreads occur
+ only during the part of the configuration process that deals
+ with the server code. If you have configured the distribution
+ using --without-server to build only the client code, clients
+ do not know whether MIT-pthreads is being used and use Unix
+ socket file connections by default. Because Unix socket files
+ do not work under MIT-pthreads on some platforms, this means
+ you need to use -h or --host with a value other than localhost
+ when you run client programs.
- In MySQL 5.1.23 and earlier, the MySQL installer places the data
- directory directly under the directory where you install MySQL. On
- MySQL 5.1.24 and later, the data directory is located within the
- AppData directory for the user running MySQL.
+ * When MySQL is compiled using MIT-pthreads, system locking is
+ disabled by default for performance reasons. You can tell the
+ server to use system locking with the --external-locking
+ option. This is needed only if you want to be able to run two
+ MySQL servers against the same data files, but that is not
+ recommended, anyway.
- If you would like to use a data directory in a different location,
- you should copy the entire contents of the data directory to the
- new location. For example, if you want to use E:\mydata as the
- data directory instead, you must do two things:
+ * Sometimes the pthread bind() command fails to bind to a socket
+ without any error message (at least on Solaris). The result is
+ that all connections to the server fail. For example:
+shell> mysqladmin version
+mysqladmin: connect to server at '' failed;
+error: 'Can't connect to mysql server on localhost (146)'
+ The solution to this problem is to kill the mysqld server and
+ restart it. This has happened to us only when we have forcibly
+ stopped the server and restarted it immediately.
- 1. Move the entire data directory and all of its contents from
- the default location (for example C:\Program Files\MySQL\MySQL
- Server 5.1\data) to E:\mydata.
+ * With MIT-pthreads, the sleep() system call isn't interruptible
+ with SIGINT (break). This is noticeable only when you run
+ mysqladmin --sleep. You must wait for the sleep() call to
+ terminate before the interrupt is served and the process
+ stops.
- 2. Use a --datadir option to specify the new data directory
- location each time you start the server.
+ * When linking, you might receive warning messages like these
+ (at least on Solaris); they can be ignored:
+ld: warning: symbol `_iob' has differing sizes:
+ (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
+file /usr/lib/libc.so value=0x140);
+ /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
+ld: warning: symbol `__iob' has differing sizes:
+ (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
+file /usr/lib/libc.so value=0x140);
+ /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
-2.3.8. Selecting a MySQL Server Type
+ * Some other warnings also can be ignored:
+implicit declaration of function `int strtoll(...)'
+implicit declaration of function `int strtoul(...)'
- The following table shows the available servers for Windows in
- MySQL 5.1.20 and earlier.
- Binary Description
- mysqld-nt Optimized binary with named-pipe support
- mysqld Optimized binary without named-pipe support
- mysqld-debug Like mysqld-nt, but compiled with full debugging and
- automatic memory allocation checking
+ * We have not been able to make readline work with MIT-pthreads.
+ (This is not necessary, but may be of interest to some.)
- The following table shows the available servers for Windows in
- MySQL 5.1.21 and later.
- Binary Description
- mysqld Optimized binary with named-pipe support
- mysqld-debug Like mysqld, but compiled with full debugging and
- automatic memory allocation checking
+2.4. Upgrading or Downgrading MySQL
- All of the preceding binaries are optimized for modern Intel
- processors, but should work on any Intel i386-class or higher
- processor.
+2.4.1. Upgrading MySQL
- Each of the servers in a distribution support the same set of
- storage engines. The SHOW ENGINES statement displays which engines
- a given server supports.
-
- All Windows MySQL 5.1 servers have support for symbolic linking of
- database directories.
+ As a general rule, to upgrade from one release series to another,
+ you should go to the next series rather than skipping a series. To
+ upgrade from a release series previous to MySQL 5.0, upgrade to
+ each successive release series in turn until you have reached
+ MySQL 5.0, and then proceed with the upgrade to MySQL 5.1. For
+ example, if you currently are running MySQL 4.0 and wish to
+ upgrade to a newer series, upgrade to MySQL 4.1 first before
+ upgrading to 5.0, and so forth. For information on upgrading to
+ MySQL 5.0, see the MySQL 5.0 Reference Manual; for earlier
+ releases, see the MySQL 3.23, 4.0, 4.1 Reference Manual.
- MySQL supports TCP/IP on all Windows platforms. MySQL servers on
- Windows support named pipes as indicated in the following list.
- However, the default is to use TCP/IP regardless of platform.
- (Named pipes are slower than TCP/IP in many Windows
- configurations.)
+ If you perform a binary (in-place) upgrade without dumping and
+ reloading tables, you cannot upgrade directly from MySQL 4.1 to
+ 5.1. This occurs due to an incompatible change in the MyISAM table
+ index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
+ repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
+ Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
+ and check and repair your tables.
- Use of named pipes is subject to these conditions:
+ To upgrade from MySQL 5.0 to 5.1, use the items in the following
+ checklist as a guide:
- * Named pipes are enabled only if you start the server with the
- --enable-named-pipe option. It is necessary to use this option
- explicitly because some users have experienced problems with
- shutting down the MySQL server when named pipes were used.
+ * Before any upgrade, back up your databases, including the
+ mysql database that contains the grant tables. See Section
+ 6.1, "Database Backup Methods."
- * For MySQL 5.1.20 and earlier, named-pipe connections are
- allowed only by the mysqld-nt and mysqld-debug servers. For
- MySQL 5.1.21 and later, the mysqld and mysqld-debug servers
- both contain support for named-pipe connections.
+ * Read all the notes in Section 2.4.1.1, "Upgrading from MySQL
+ 5.0 to 5.1." These notes enable you to identify upgrade issues
+ that apply to your current MySQL installation. Some
+ incompatibilities discussed in that section require your
+ attention before upgrading. Others should be dealt with after
+ upgrading.
-Note
+ * Read Appendix C, "MySQL Change History" as well, which
+ provides information about features that are new in MySQL 5.1
+ or differ from those found in MySQL 5.0.
- Most of the examples in this manual use mysqld as the server name.
- If you choose to use a different server, such as mysqld-nt or
- mysqld-debug, make the appropriate substitutions in the commands
- that are shown in the examples.
+ * After you upgrade to a new version of MySQL, run mysql_upgrade
+ (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
+ Upgrade"). This program checks your tables, and attempts to
+ repair them if necessary. It also updates your grant tables to
+ make sure that they have the current structure so that you can
+ take advantage of any new capabilities. (Some releases of
+ MySQL introduce changes to the structure of the grant tables
+ to add new privileges or features.)
-2.3.9. Starting the Server for the First Time
+ * If you are running MySQL Server on Windows, see Section 2.5.7,
+ "Upgrading MySQL on Windows."
- This section gives a general overview of starting the MySQL
- server. The following sections provide more specific information
- for starting the MySQL server from the command line or as a
- Windows service.
+ * If you are using replication, see Section 16.3.3, "Upgrading a
+ Replication Setup," for information on upgrading your
+ replication setup.
- The information here applies primarily if you installed MySQL
- using the Noinstall version, or if you wish to configure and test
- MySQL manually rather than with the GUI tools.
+ * If you are upgrading an installation originally produced by
+ installing multiple RPM packages, it is best to upgrade all
+ the packages, not just some. For example, if you previously
+ installed the server and client RPMs, do not upgrade just the
+ server RPM.
- The examples in these sections assume that MySQL is installed
- under the default location of C:\Program Files\MySQL\MySQL Server
- 5.1. Adjust the path names shown in the examples if you have MySQL
- installed in a different location.
+ * As of MySQL 5.1.9, the mysqld-max server is included in binary
+ distributions. There is no separate MySQL-Max distribution. As
+ of MySQL 5.1.12, there is no mysqld-max server at all in
+ binary distributions. They contain a server that includes the
+ features previously included in mysqld-max.
- Clients have two options. They can use TCP/IP, or they can use a
- named pipe if the server supports named-pipe connections.
+ * If you have created a user-defined function (UDF) with a given
+ name and upgrade MySQL to a version that implements a new
+ built-in function with the same name, the UDF becomes
+ inaccessible. To correct this, use DROP FUNCTION to drop the
+ UDF, and then use CREATE FUNCTION to re-create the UDF with a
+ different nonconflicting name. The same is true if the new
+ version of MySQL implements a built-in function with the same
+ name as an existing stored function. See Section 8.2.4,
+ "Function Name Parsing and Resolution," for the rules
+ describing how the server interprets references to different
+ kinds of functions.
- MySQL for Windows also supports shared-memory connections if the
- server is started with the --shared-memory option. Clients can
- connect through shared memory by using the --protocol=MEMORY
- option.
+ You can always move the MySQL format files and data files between
+ different versions on systems with the same architecture as long
+ as you stay within versions for the same release series of MySQL.
- For information about which server binary to run, see Section
- 2.3.8, "Selecting a MySQL Server Type."
+ If you are cautious about using new versions, you can always
+ rename your old mysqld before installing a newer one. For example,
+ if you are using MySQL 5.0.13 and want to upgrade to 5.1.10,
+ rename your current server from mysqld to mysqld-5.0.13. If your
+ new mysqld then does something unexpected, you can simply shut it
+ down and restart with your old mysqld.
- Testing is best done from a command prompt in a console window (or
- "DOS window"). In this way you can have the server display status
- messages in the window where they are easy to see. If something is
- wrong with your configuration, these messages make it easier for
- you to identify and fix any problems.
+ If, after an upgrade, you experience problems with recompiled
+ client programs, such as Commands out of sync or unexpected core
+ dumps, you probably have used old header or library files when
+ compiling your programs. In this case, you should check the date
+ for your mysql.h file and libmysqlclient.a library to verify that
+ they are from the new MySQL distribution. If not, recompile your
+ programs with the new headers and libraries.
- To start the server, enter this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
+ If problems occur, such as that the new mysqld server does not
+ start or that you cannot connect without a password, verify that
+ you do not have an old my.cnf file from your previous
+ installation. You can check this with the --print-defaults option
+ (for example, mysqld --print-defaults). If this command displays
+ anything other than the program name, you have an active my.cnf
+ file that affects server or client operation.
- For a server that includes InnoDB support, you should see the
- messages similar to those following as it starts (the path names
- and sizes may differ):
-InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
-InnoDB: a new database to be created!
-InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
-InnoDB: Database physically writes the file full: wait...
-InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat
-ed
-InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
-InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat
-ed
-InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
-InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat
-ed
-InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
-InnoDB: Doublewrite buffer not found: creating new
-InnoDB: Doublewrite buffer created
-InnoDB: creating foreign key constraint system tables
-InnoDB: foreign key constraint system tables created
-011024 10:58:25 InnoDB: Started
+ If your MySQL installation contains a large amount of data that
+ might take a long time to convert after an in-place upgrade, you
+ might find it useful to create a "dummy" database instance for
+ assessing what conversions might be needed and the work involved
+ to perform them. Make a copy of your MySQL instance that contains
+ a full copy of the mysql database, plus all other databases
+ without data. Run your upgrade procedure on this dummy instance to
+ see what actions might be needed so that you can better evaluate
+ the work involved when performing actual data conversion on your
+ original database instance.
- When the server finishes its startup sequence, you should see
- something like this, which indicates that the server is ready to
- service client connections:
-mysqld: ready for connections
-Version: '5.1.39' socket: '' port: 3306
+ It is a good idea to rebuild and reinstall the Perl DBD::mysql
+ module whenever you install a new release of MySQL. The same
+ applies to other MySQL interfaces as well, such as PHP mysql
+ extensions and the Python MySQLdb module.
- The server continues to write to the console any further
- diagnostic output it produces. You can open a new console window
- in which to run client programs.
+2.4.1.1. Upgrading from MySQL 5.0 to 5.1
- If you omit the --console option, the server writes diagnostic
- output to the error log in the data directory (C:\Program
- Files\MySQL\MySQL Server 5.1\data by default). The error log is
- the file with the .err extension.
+ After upgrading a 5.0 installation to 5.0.10 or above, it is
+ necessary to upgrade your grant tables. Otherwise, creating stored
+ procedures and functions might not work. To perform this upgrade,
+ run mysql_upgrade.
Note
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ It is good practice to back up your data before installing any new
+ version of software. Although MySQL works very hard to ensure a
+ high level of quality, you should protect your data by making a
+ backup.
-2.3.10. Starting MySQL from the Windows Command Line
+ To upgrade to 5.1 from any previous version, MySQL recommends that
+ you dump your tables with mysqldump before upgrading and reload
+ the dump file after upgrading.
- The MySQL server can be started manually from the command line.
- This can be done on any version of Windows.
+ If you perform a binary (in-place) upgrade without dumping and
+ reloading tables, you cannot upgrade directly from MySQL 4.1 to
+ 5.1. This occurs due to an incompatible change in the MyISAM table
+ index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
+ repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
+ Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
+ and check and repair your tables.
- To start the mysqld server from the command line, you should start
- a console window (or "DOS window") and enter this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
+ In general, you should do the following when upgrading from MySQL
+ 5.0 to 5.1:
- The path to mysqld may vary depending on the install location of
- MySQL on your system.
+ * Read all the items in the following sections to see whether
+ any of them might affect your applications:
- You can stop the MySQL server by executing this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
- shutdown
+ + Section 2.4.1, "Upgrading MySQL," has general update
+ information.
-Note
+ + The items in the change lists found later in this section
+ enable you to identify upgrade issues that apply to your
+ current MySQL installation.
- If the MySQL root user account has a password, you need to invoke
- mysqladmin with the -p option and supply the password when
- prompted.
+ + The MySQL 5.1 change history describes significant new
+ features you can use in 5.1 or that differ from those
+ found in MySQL 5.0. Some of these changes may result in
+ incompatibilities. See Section C.1, "Changes in Release
+ 5.1.x (Production)."
- This command invokes the MySQL administrative utility mysqladmin
- to connect to the server and tell it to shut down. The command
- connects as the MySQL root user, which is the default
- administrative account in the MySQL grant system. Note that users
- in the MySQL grant system are wholly independent from any login
- users under Windows.
+ * Note particularly any changes that are marked Known issue or
+ Incompatible change. These incompatibilities with earlier
+ versions of MySQL may require your attention before you
+ upgrade.
+ Our aim is to avoid these changes, but occasionally they are
+ necessary to correct problems that would be worse than an
+ incompatibility between releases. If any upgrade issue
+ applicable to your installation involves an incompatibility
+ that requires special handling, follow the instructions given
+ in the incompatibility description. Often this will involve a
+ dump and reload, or use of a statement such as CHECK TABLE or
+ REPAIR TABLE.
+ For dump and reload instructions, see Section 2.4.4,
+ "Rebuilding or Repairing Tables or Indexes." Any procedure
+ that involves REPAIR TABLE with the USE_FRM option must be
+ done before upgrading. Use of this statement with a version of
+ MySQL different from the one used to create the table (that
+ is, using it after upgrading) may damage the table. See
+ Section 12.5.2.6, "REPAIR TABLE Syntax."
- If mysqld doesn't start, check the error log to see whether the
- server wrote any messages there to indicate the cause of the
- problem. The error log is located in the C:\Program
- Files\MySQL\MySQL Server 5.1\data directory. It is the file with a
- suffix of .err. You can also try to start the server as mysqld
- --console; in this case, you may get some useful information on
- the screen that may help solve the problem.
+ * After you upgrade to a new version of MySQL, run mysql_upgrade
+ (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
+ Upgrade"). This program checks your tables, and attempts to
+ repair them if necessary. It also updates your grant tables to
+ make sure that they have the current structure so that you can
+ take advantage of any new capabilities. (Some releases of
+ MySQL introduce changes to the structure of the grant tables
+ to add new privileges or features.)
- The last option is to start mysqld with the --standalone and
- --debug options. In this case, mysqld writes a log file
- C:\mysqld.trace that should contain the reason why mysqld doesn't
- start. See MySQL Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
-
- Use mysqld --verbose --help to display all the options that mysqld
- supports.
-
-2.3.11. Starting MySQL as a Windows Service
-
- On Windows, the recommended way to run MySQL is to install it as a
- Windows service, whereby MySQL starts and stops automatically when
- Windows starts and stops. A MySQL server installed as a service
- can also be controlled from the command line using NET commands,
- or with the graphical Services utility. Generally, to install
- MySQL as a Windows service you should be logged in using an
- account that has administrator rights.
+ * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
+ Be Rebuilt," to see whether changes to table formats or to
+ character sets or collations were made between your current
+ version of MySQL and the version to which you are upgrading.
+ If so and these changes result in an incompatibility between
+ MySQL versions, you will need to upgrade the affected tables
+ using the instructions in Section 2.4.4, "Rebuilding or
+ Repairing Tables or Indexes."
- The Services utility (the Windows Service Control Manager) can be
- found in the Windows Control Panel (under Administrative Tools on
- Windows 2000, XP, Vista and Server 2003). To avoid conflicts, it
- is advisable to close the Services utility while performing server
- installation or removal operations from the command line.
+ * If you are running MySQL Server on Windows, see Section 2.5.7,
+ "Upgrading MySQL on Windows."
- Before installing MySQL as a Windows service, you should first
- stop the current server if it is running by using the following
- command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
- -u root shutdown
+ * If you are using replication, see Section 16.3.3, "Upgrading a
+ Replication Setup," for information on upgrading your
+ replication setup.
-Note
+ If your MySQL installation contains a large amount of data that
+ might take a long time to convert after an in-place upgrade, you
+ might find it useful to create a "dummy" database instance for
+ assessing what conversions might be needed and the work involved
+ to perform them. Make a copy of your MySQL instance that contains
+ a full copy of the mysql database, plus all other databases
+ without data. Run your upgrade procedure on this dummy instance to
+ see what actions might be needed so that you can better evaluate
+ the work involved when performing actual data conversion on your
+ original database instance.
- If the MySQL root user account has a password, you need to invoke
- mysqladmin with the -p option and supply the password when
- prompted.
+ MySQL Enterprise MySQL Enterprise subscribers will find more
+ information about upgrading in the Knowledge Base articles found
+ at Upgrading
+ (https://kb.mysql.com/search.php?cat=search&category=41) Access
+ to the MySQL Knowledge Base collection of articles is one of the
+ advantages of subscribing to MySQL Enterprise. For more
+ information, see
+ http://www.mysql.com/products/enterprise/advisors.html.
- This command invokes the MySQL administrative utility mysqladmin
- to connect to the server and tell it to shut down. The command
- connects as the MySQL root user, which is the default
- administrative account in the MySQL grant system. Note that users
- in the MySQL grant system are wholly independent from any login
- users under Windows.
+ The following lists describe changes that may affect applications
+ and that you should watch out for when upgrading to MySQL 5.1.
- Install the server as a service using this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
+ Configuration Changes:
- The service-installation command does not start the server.
- Instructions for that are given later in this section.
+ * Before MySQL 5.1.11, to build MySQL from source with SSL
+ support enabled, you would invoke configure with either the
+ --with-openssl or --with-yassl option. In MySQL 5.1.11, those
+ options both have been replaced by the --with-ssl option. By
+ default, --with-ssl causes the bundled yaSSL library to be
+ used. To select OpenSSL instead, give the option as
+ --with-ssl=path, where path is the directory where the OpenSSL
+ header files and libraries are located.
- To make it easier to invoke MySQL programs, you can add the path
- name of the MySQL bin directory to your Windows system PATH
- environment variable:
+ Server Changes:
- * On the Windows desktop, right-click on the My Computer icon,
- and select Properties.
+ * Known issue: After a binary upgrade to MySQL 5.1 from a MySQL
+ 5.0 installation that contains ARCHIVE tables, accessing those
+ tables will cause the server to crash, even if you have run
+ mysql_upgrade or CHECK TABLE ... FOR UPGRADE. To work around
+ this problem, use mysqldump to dump all ARCHIVE tables before
+ upgrading, and reload them into MySQL 5.1 after upgrading.
+
+ * Known issue: The fix for
+ Bug#23491: http://bugs.mysql.com/23491 introduced a problem
+ with SHOW CREATE VIEW, which is used by mysqldump. This causes
+ an incompatibility when upgrading from versions affected by
+ that bug fix (MySQL 5.0.40 through 5.0.43, MySQL 5.1.18
+ through 5.1.19): If you use mysqldump before upgrading from an
+ affected version and reload the data after upgrading to a
+ higher version, you must drop and recreate your views.
- * Next select the Advanced tab from the System Properties menu
- that appears, and click the Environment Variables button.
+ * Known issue: Dumps performed by using mysqldump to generate a
+ dump file before the upgrade and reloading the file after
+ upgrading are subject to the following problem:
+ Before MySQL 5.0.40, mysqldump displays SPATIAL index
+ definitions using prefix lengths for the indexed columns.
+ These prefix lengths are accepted in MySQL 5.0, but not as of
+ MySQL 5.1. If you use mysqldump from versions of MySQL older
+ than 5.0.40, any table containing SPATIAL indexes will cause
+ an error when the dump file is reloaded into MySQL 5.1 or
+ higher.
+ For example, a table definition might look like this when
+ dumped in MySQL 5.0:
+CREATE TABLE `t` (
+ `g` geometry NOT NULL,
+ SPATIAL KEY `g` (`g`(32))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ The SPATIAL index definition will not be accepted in MySQL
+ 5.1. To work around this, edit the dump file to remove the
+ prefix:
+CREATE TABLE `t` (
+ `g` geometry NOT NULL,
+ SPATIAL KEY `g` (`g`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ Dump files can be large, so it may be preferable to dump table
+ definitions and data separately to make it easier to edit the
+ definitions:
+shell> mysqldump --no-data other_args > definitions.sql
+shell> mysqldump --no-create-info other_args > data.sql
+ Then edit definitions.sql before reloading definitions.sql and
+ data.sql, in that order.
+ If you upgrade to a version of MySQL 5.0 higher than 5.0.40
+ before upgrading to MySQL 5.1, this problem does not occur.
- * Under System Variables, select Path, and then click the Edit
- button. The Edit System Variable dialogue should appear.
+ * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR
+ UPGRADE statement did not check for incompatible collation
+ changes made in MySQL 5.1.24. (This also affects mysqlcheck
+ and mysql_upgrade, which cause that statement to be executed.)
+ Prior to the fix made in 5.1.30, a binary upgrade (performed
+ without dumping tables with mysqldump before the upgrade and
+ reloading the dump file after the upgrade) would corrupt
+ tables. After the fix, CHECK TABLE ... FOR UPGRADE properly
+ detects the problem and warns about tables that need repair.
+ However, the fix is not backward compatible and can result in
+ a downgrading problem under these circumstances:
- * Place your cursor at the end of the text appearing in the
- space marked Variable Value. (Use the End key to ensure that
- your cursor is positioned at the very end of the text in this
- space.) Then enter the complete path name of your MySQL bin
- directory (for example, C:\Program Files\MySQL\MySQL Server
- 5.1\bin), Note that there should be a semicolon separating
- this path from any values present in this field. Dismiss this
- dialogue, and each dialogue in turn, by clicking OK until all
- of the dialogues that were opened have been dismissed. You
- should now be able to invoke any MySQL executable program by
- typing its name at the DOS prompt from any directory on the
- system, without having to supply the path. This includes the
- servers, the mysql client, and all MySQL command-line
- utilities such as mysqladmin and mysqldump.
- You should not add the MySQL bin directory to your Windows
- PATH if you are running multiple MySQL servers on the same
- machine.
+ 1. Perform a binary upgrade to a version of MySQL that
+ includes the fix.
-Warning
+ 2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or
+ mysql_upgrade) to upgrade tables.
- You must exercise great care when editing your system PATH by
- hand; accidental deletion or modification of any portion of the
- existing PATH value can leave you with a malfunctioning or even
- unusable system.
+ 3. Perform a binary downgrade to a version of MySQL that
+ does not include the fix.
+ The solution is to dump tables with mysqldump before the
+ downgrade and reload the dump file after the downgrade.
+ Alternatively, drop and recreate affected indexes.
- The following additional arguments can be used in MySQL 5.1 when
- installing the service:
+ * Known issue: MySQL introduces encoding for table names that
+ have non-ASCII characters (see Section 8.2.3, "Mapping of
+ Identifiers to File Names"). After a binary upgrade from MySQL
+ 5.0 to 5.1 or higher, the server recognizes names that have
+ non-ASCII characters and adds a #mysql50# prefix to them.
+ As of MySQL 5.1.31, mysql_upgrade encodes these names by
+ executing the following command:
+mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table
+-names
+ Prior to MySQL 5.1.31, mysql_upgrade does not execute this
+ command, so you should execute it manually if you have
+ database or table names that contain nonalphanumeric
+ characters.
+ Prior to MySQL 5.1.23, the mysqlcheck command does not perform
+ the name encoding for views. To work around this problem, drop
+ each affected view and recreate it.
+ mysqlcheck cannot fix names that contain literal instances of
+ the @ character that is used for encoding special characters.
+ If you have databases or tables that contain this character,
+ use mysqldump to dump them before upgrading to MySQL 5.1, and
+ then reload the dump file after upgrading.
- * You can specify a service name immediately following the
- --install option. The default service name is MySQL.
+ * Known issue: When upgrading from MySQL 5.0 to versions of 5.1
+ prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which
+ runs mysqlcheck) to upgrade tables fails for names that must
+ be written as quoted identifiers. To work around this problem,
+ rename each affected table to a name that does not require
+ quoting:
+RENAME TABLE `tab``le_a` TO table_a;
+RENAME TABLE `table b` TO table_b;
+ After renaming the tables, run the mysql_upgrade program. Then
+ rename the tables back to their original names:
+RENAME TABLE table_a TO `tab``le_a`;
+RENAME TABLE table_b TO `table b`;
- * If a service name is given, it can be followed by a single
- option. By convention, this should be
- --defaults-file=file_name to specify the name of an option
- file from which the server should read options when it starts.
- The use of a single option other than --defaults-file is
- possible but discouraged. --defaults-file is more flexible
- because it enables you to specify multiple startup options for
- the server by placing them in the named option file.
+ * Known issue: In connection with view creation, the server
+ created arc directories inside database directories and
+ maintained useless copies of .frm files there. Creation and
+ renaming procedures of those copies as well as creation of arc
+ directories has been discontinued in MySQL 5.1.29.
+ This change does cause a problem when downgrading to older
+ server versions which manifests itself under these
+ circumstances:
- * You can also specify a --local-service option following the
- service name. This causes the server to run using the
- LocalService Windows account that has limited system
- privileges. This account is available only for Windows XP or
- newer. If both --defaults-file and --local-service are given
- following the service name, they can be in any order.
+ 1. Create a view v_orig in MySQL 5.1.29 or higher.
- For a MySQL server that is installed as a Windows service, the
- following rules determine the service name and option files that
- the server uses:
+ 2. Rename the view to v_new and then back to v_orig.
- * If the service-installation command specifies no service name
- or the default service name (MySQL) following the --install
- option, the server uses the a service name of MySQL and reads
- options from the [mysqld] group in the standard option files.
+ 3. Downgrade to an older 5.1.x server and run mysql_upgrade.
- * If the service-installation command specifies a service name
- other than MySQL following the --install option, the server
- uses that service name. It reads options from the [mysqld]
- group and the group that has the same name as the service in
- the standard option files. This allows you to use the [mysqld]
- group for options that should be used by all MySQL services,
- and an option group with the service name for use by the
- server installed with that service name.
+ 4. Try to rename v_orig to v_new again. This operation
+ fails.
+ As a workaround to avoid this problem, use either of these
+ approaches:
- * If the service-installation command specifies a
- --defaults-file option after the service name, the server
- reads options only from the [mysqld] group of the named file
- and ignores the standard option files.
+ + Dump your data using mysqldump before downgrading and
+ reload the dump file after downgrading.
- As a more complex example, consider the following command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
- --install MySQL --defaults-file=C:\my-opts.cnf
+ + Instead of renaming a view after the downgrade, drop it
+ and recreate it.
- Here, the default service name (MySQL) is given after the
- --install option. If no --defaults-file option had been given,
- this command would have the effect of causing the server to read
- the [mysqld] group from the standard option files. However,
- because the --defaults-file option is present, the server reads
- options from the [mysqld] option group, and only from the named
- file.
+ * Incompatible change: Character set or collation changes were
+ made in MySQL 5.1.21, 5.1.23, and 5.1.24 that may require
+ table indexes to be rebuilt. For details, see Section 2.4.3,
+ "Checking Whether Tables or Indexes Must Be Rebuilt."
- You can also specify options as Start parameters in the Windows
- Services utility before you start the MySQL service.
+ * Incompatible change: MySQL 5.1 implements support for a plugin
+ API that allows the loading and unloading of components at
+ runtime, without restarting the server. Section 22.2, "The
+ MySQL Plugin Interface." The plugin API requires the
+ mysql.plugin table. After upgrading from an older version of
+ MySQL, you should run the mysql_upgrade command to create this
+ table. See Section 4.4.8, "mysql_upgrade --- Check Tables for
+ MySQL Upgrade."
+ Plugins are installed in the directory named by the plugin_dir
+ system variable. This variable also controls the location from
+ which the server loads user-defined functions (UDFs), which is
+ a change from earlier versions of MySQL. That is, all UDF
+ library files now must be installed in the plugin directory.
+ When upgrading from an older version of MySQL, you must
+ migrate your UDF files to the plugin directory.
- Once a MySQL server has been installed as a service, Windows
- starts the service automatically whenever Windows starts. The
- service also can be started immediately from the Services utility,
- or by using a NET START MySQL command. The NET command is not case
- sensitive.
+ * Incompatible change: The table_cache system variable has been
+ renamed to table_open_cache. Any scripts that refer to
+ table_cache must be updated to use the new name.
- When run as a service, mysqld has no access to a console window,
- so no messages can be seen there. If mysqld does not start, check
- the error log to see whether the server wrote any messages there
- to indicate the cause of the problem. The error log is located in
- the MySQL data directory (for example, C:\Program
- Files\MySQL\MySQL Server 5.1\data). It is the file with a suffix
- of .err.
+ * Incompatible change: In MySQL 5.1.36, options for loading
+ plugins such as pluggable storage engines were changed from
+ boolean to tristate format. The implementations overlap, but
+ if you previously used options of the form --plugin_name=0 or
+ --plugin_name=1, you should instead use --plugin_name=OFF or
+ --plugin_name=ON, respectively. For details, see Section
+ 5.1.3, "Server Options for Loading Plugins."
- When a MySQL server has been installed as a service, and the
- service is running, Windows stops the service automatically when
- Windows shuts down. The server also can be stopped manually by
- using the Services utility, the NET STOP MySQL command, or the
- mysqladmin shutdown command.
+ * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE
+ statement was changed such that assigning NULL to a NOT NULL
+ column caused an error even when strict SQL mode was not
+ enabled. The original behavior before MySQL 5.1.24 was that
+ such assignments caused an error only in strict SQL mode, and
+ otherwise set the column to the implicit default value for the
+ column data type and generated a warning. (For information
+ about implicit default values, see Section 10.1.4, "Data Type
+ Default Values.")
+ The change caused compatibility problems for applications that
+ relied on the original behavior. It also caused replication
+ problems between servers that had the original behavior and
+ those that did not, for applications that assigned NULL to NOT
+ NULL columns in UPDATE statements without strict SQL mode
+ enabled. The change was reverted in MySQL 5.1.32 so that
+ UPDATE again had the original behavior. Problems can still
+ occur if you replicate between servers that have the modified
+ UPDATE behavior and those that do not.
- You also have the choice of installing the server as a manual
- service if you do not wish for the service to be started
- automatically during the boot process. To do this, use the
- --install-manual option rather than the --install option:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install-m
-anual
+ * Incompatible change: As of MySQL 5.1.29, the default binary
+ logging mode has been changed from MIXED to STATEMENT for
+ compatibility with MySQL 5.0.
- To remove a server that is installed as a service, first stop it
- if it is running by executing NET STOP MySQL. Then use the
- --remove option to remove it:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove
+ * Incompatible change: In MySQL 5.1.25, a change was made to the
+ way that the server handles prepared statements. This affects
+ prepared statements processed at the SQL level (using the
+ PREPARE statement) and those processed using the binary
+ client-server protocol (using the mysql_stmt_prepare() C API
+ function).
+ Previously, changes to metadata of tables or views referred to
+ in a prepared statement could cause a server crash when the
+ statement was next executed, or perhaps an error at execute
+ time with a crash occurring later. For example, this could
+ happen after dropping a table and recreating it with a
+ different definition.
+ Now metadata changes to tables or views referred to by
+ prepared statements are detected and cause automatic
+ repreparation of the statement when it is next executed.
+ Metadata changes occur for DDL statements such as those that
+ create, drop, alter, rename, or truncate tables, or that
+ analyze, optimize, or repair tables. Repreparation also occurs
+ after referenced tables or views are flushed from the table
+ definition cache, either implicitly to make room for new
+ entries in the cache, or explicitly due to FLUSH TABLES.
+ Repreparation is automatic, but to the extent that it occurs,
+ performance of prepared statements is diminished.
+ Table content changes (for example, with INSERT or UPDATE) do
+ not cause repreparation, nor do SELECT statements.
+ An incompatibility with previous versions of MySQL is that a
+ prepared statement may now return a different set of columns
+ or different column types from one execution to the next. For
+ example, if the prepared statement is SELECT * FROM t1,
+ altering t1 to contain a different number of columns causes
+ the next execution to return a number of columns different
+ from the previous execution.
+ Older versions of the client library cannot handle this change
+ in behavior. For applications that use prepared statements
+ with the new server, an upgrade to the new client library is
+ strongly recommended.
+ Along with this change to statement repreparation, the default
+ value of the table_definition_cache system variable has been
+ increased from 128 to 256. The purpose of this increase is to
+ lessen the chance that prepared statements will need
+ repreparation due to referred-to tables/views having been
+ flushed from the cache to make room for new entries.
+ A new status variable, Com_stmt_reprepare, has been introduced
+ to track the number of repreparations.
- If mysqld is not running as a service, you can start it from the
- command line. For instructions, see Section 2.3.10, "Starting
- MySQL from the Windows Command Line."
+ * Incompatible change: As of MySQL 5.1.23, within a stored
+ routine, it is no longer allowable to declare a cursor for a
+ SHOW or DESCRIBE statement. This happened to work in some
+ instances, but is no longer supported. In many cases, a
+ workaround for this change is to use the cursor with a SELECT
+ query to read from an INFORMATION_SCHEMA table that produces
+ the same information as the SHOW statement.
- Please see Section 2.3.13, "Troubleshooting a MySQL Installation
- Under Windows," if you encounter difficulties during installation.
+ * Incompatible change: SHOW CREATE VIEW displays view
+ definitions using an AS alias_name clause for each column. If
+ a column is created from an expression, the default alias is
+ the expression text, which can be quite long. As of MySQL
+ 5.1.23, aliases for column names in CREATE VIEW statements are
+ checked against the maximum column length of 64 characters
+ (not the maximum alias length of 256 characters). As a result,
+ views created from the output of SHOW CREATE VIEW fail if any
+ column alias exceeds 64 characters. This can cause problems
+ for replication or loading dump files. For additional
+ information and workarounds, see Section D.4, "Restrictions on
+ Views."
-2.3.12. Testing The MySQL Installation
+ * Incompatible change: Several issues were identified for stored
+ programs (stored procedures and functions, triggers, and
+ events) and views containing non-ASCII symbols. These issues
+ involved conversion errors due to incomplete character set
+ information when translating these objects to and from stored
+ format.
+ To address these problems, the representation for these
+ objects was changed in MySQL 5.1.21. However, the fixes affect
+ all stored programs and views. (For example, you will see
+ warnings about "no creation context.") To avoid warnings from
+ the server about the use of old definitions from any release
+ prior to 5.1.21, you should dump stored programs and views
+ with mysqldump after upgrading to 5.1.21 or higher, and then
+ reload them to recreate them with new definitions. Invoke
+ mysqldump with a --default-character-set option that names the
+ non-ASCII character set that was used for the definitions when
+ the objects were originally defined.
- You can test whether the MySQL server is working by executing any
- of the following commands:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow"
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -u root
-mysql
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" version
- status proc
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test
+ * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports
+ error logging to syslog on systems that support the logger
+ command. The new --syslog and --skip-syslog options can be
+ used instead of the --log-error option to control logging
+ behavior, as described in Section 4.3.2, "mysqld_safe ---
+ MySQL Server Startup Script."
+ In 5.1.21 and up, the default is --skip-syslog, which is
+ compatible with the default behavior of writing an error log
+ file for releases prior to 5.1.20.
+ In 5.1.20 only, the following conditions apply: 1) The default
+ is to use syslog, which is not compatible with releases prior
+ to 5.1.20. 2) Logging to syslog may fail to operate correctly
+ in some cases. For these reasons, avoid using MySQL 5.1.20.
- If mysqld is slow to respond to TCP/IP connections from client
- programs, there is probably a problem with your DNS. In this case,
- start mysqld with the --skip-name-resolve option and use only
- localhost and IP numbers in the Host column of the MySQL grant
- tables.
+ * Incompatible change: As of MySQL 5.1.18, the plugin interface
+ and its handling of system variables was changed. Command-line
+ options such as --skip-innodb now cause an error if InnoDB is
+ not built-in or plugin-loaded. You should use
+ --loose-skip-innodb if you do not want any error even if
+ InnoDB is not available. The --loose prefix modifier should be
+ used for all command-line options where you are uncertain
+ whether the plugin exists and when you want the operation to
+ proceed even if the option is necessarily ignored due to the
+ absence of the plugin. (For a desecription of how --loose
+ works, see Section 4.2.3.1, "Using Options on the Command
+ Line.")
- You can force a MySQL client to use a named-pipe connection rather
- than TCP/IP by specifying the --pipe or --protocol=PIPE option, or
- by specifying . (period) as the host name. Use the --socket option
- to specify the name of the pipe if you do not want to use the
- default pipe name.
+ * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back
+ only the last statement on a transaction timeout. A new
+ option, --innodb_rollback_on_timeout, causes InnoDB to abort
+ and roll back the entire transaction if a transaction timeout
+ occurs (the same behavior as in MySQL 4.1).
- Note that if you have set a password for the root account, deleted
- the anonymous account, or created a new user account, then you
- must use the appropriate -u and -p options with the commands shown
- above in order to connect with the MySQL Server. See Section
- 4.2.2, "Connecting to the MySQL Server."
+ * Incompatible change: As of MySQL 5.1.15, the following
+ conditions apply to enabling the read_only system variable:
- For more information about mysqlshow, see Section 4.5.6,
- "mysqlshow --- Display Database, Table, and Column Information."
+ + If you attempt to enable read_only while you have any
+ explicit locks (acquired with LOCK TABLES or have a
+ pending transaction, an error will occur.
-2.3.13. Troubleshooting a MySQL Installation Under Windows
+ + If other clients hold explicit table locks or have
+ pending transactions, the attempt to enable read_only
+ blocks until the locks are released and the transactions
+ end. While the attempt to enable read_only is pending,
+ requests by other clients for table locks or to begin
+ transactions also block until read_only has been set.
- When installing and running MySQL for the first time, you may
- encounter certain errors that prevent the MySQL server from
- starting. The purpose of this section is to help you diagnose and
- correct some of these errors.
+ + read_only can be enabled while you hold a global read
+ lock (acquired with FLUSH TABLES WITH READ LOCK) because
+ that does not involve table locks.
+ Previously, the attempt to enable read_only would return
+ immediately even if explicit locks or transactions were
+ pending, so some data changes could occur for statements
+ executing in the server at the same time.
- Your first resource when troubleshooting server issues is the
- error log. The MySQL server uses the error log to record
- information relevant to the error that prevents the server from
- starting. The error log is located in the data directory specified
- in your my.ini file. The default data directory location is
- C:\Program Files\MySQL\MySQL Server 5.1\data. See Section 5.2.2,
- "The Error Log."
+ * Incompatible change: The number of function names affected by
+ IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from
+ about 200 to about 30. (For details about IGNORE_SPACE, see
+ Section 8.2.4, "Function Name Parsing and Resolution.") This
+ change improves the consistency of parser operation. However,
+ it also introduces the possibility of incompatibility for old
+ SQL code that relies on the following conditions:
- Another source of information regarding possible errors is the
- console messages displayed when the MySQL service is starting. Use
- the NET START MySQL command from the command line after installing
- mysqld as a service to see any error messages regarding the
- starting of the MySQL server as a service. See Section 2.3.11,
- "Starting MySQL as a Windows Service."
+ + IGNORE_SPACE is disabled.
- The following examples show other common error messages you may
- encounter when installing MySQL and starting the server for the
- first time:
+ + The presence or absence of whitespace following a
+ function name is used to distinguish between a built-in
+ function and stored function that have the same name (for
+ example, PI() versus PI ()).
+ For functions that are no longer affected by IGNORE_SPACE as
+ of MySQL 5.1.13, that strategy no longer works. Either of the
+ following approaches can be used if you have code that is
+ subject to the preceding incompatibility:
- * If the MySQL server cannot find the mysql privileges database
- or other critical files, you may see these messages:
-System error 1067 has occurred.
-Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't
-exist
- These messages often occur when the MySQL base or data
- directories are installed in different locations than the
- default locations (C:\Program Files\MySQL\MySQL Server 5.1 and
- C:\Program Files\MySQL\MySQL Server 5.1\data, respectively).
- This situation may occur when MySQL is upgraded and installed
- to a new location, but the configuration file is not updated
- to reflect the new location. In addition, there may be old and
- new configuration files that conflict. Be sure to delete or
- rename any old configuration files when upgrading MySQL.
- If you have installed MySQL to a directory other than
- C:\Program Files\MySQL\MySQL Server 5.1, you need to ensure
- that the MySQL server is aware of this through the use of a
- configuration (my.ini) file. The my.ini file needs to be
- located in your Windows directory, typically C:\WINDOWS. You
- can determine its exact location from the value of the WINDIR
- environment variable by issuing the following command from the
- command prompt:
-C:\> echo %WINDIR%
- An option file can be created and modified with any text
- editor, such as Notepad. For example, if MySQL is installed in
- E:\mysql and the data directory is D:\MySQLdata, you can
- create the option file and set up a [mysqld] section to
- specify values for the basedir and datadir options:
-[mysqld]
-# set basedir to your installation path
-basedir=E:/mysql
-# set datadir to the location of your data directory
-datadir=D:/MySQLdata
- Note that Windows path names are specified in option files
- using (forward) slashes rather than backslashes. If you do use
- backslashes, you must double them:
-[mysqld]
-# set basedir to your installation path
-basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1
-# set datadir to the location of your data directory
-datadir=D:\\MySQLdata
- If you change the datadir value in your MySQL configuration
- file, you must move the contents of the existing MySQL data
- directory before restarting the MySQL server.
- See Section 2.3.7, "Creating an Option File."
-
- * If you reinstall or upgrade MySQL without first stopping and
- removing the existing MySQL service and install MySQL using
- the MySQL Configuration Wizard, you may see this error:
-Error: Cannot create Windows service for MySql. Error: 0
- This occurs when the Configuration Wizard tries to install the
- service and finds an existing service with the same name.
- One solution to this problem is to choose a service name other
- than mysql when using the configuration wizard. This allows
- the new service to be installed correctly, but leaves the
- outdated service in place. Although this is harmless, it is
- best to remove old services that are no longer in use.
- To permanently remove the old mysql service, execute the
- following command as a user with administrative privileges, on
- the command-line:
-C:\> sc delete mysql
-[SC] DeleteService SUCCESS
- If the sc utility is not available for your version of
- Windows, download the delsrv utility from
- http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi
- sting/delsrv-o.asp and use the delsrv mysql syntax.
-
-2.3.14. Upgrading MySQL on Windows
-
- This section lists some of the steps you should take when
- upgrading MySQL on Windows.
-
- 1. Review Section 2.12.1, "Upgrading MySQL," for additional
- information on upgrading MySQL that is not specific to
- Windows.
-
- 2. You should always back up your current MySQL installation
- before performing an upgrade. See Section 6.1, "Database
- Backups."
-
- 3. Download the latest Windows distribution of MySQL from
- http://dev.mysql.com/downloads/.
-
- 4. Before upgrading MySQL, you must stop the server. If the
- server is installed as a service, stop the service with the
- following command from the command prompt:
-C:\> NET STOP MySQL
- If you are not running the MySQL server as a service, use the
- following command to stop it:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
- shutdown
-
-Note
- If the MySQL root user account has a password, you need to
- invoke mysqladmin with the -p option and supply the password
- when prompted.
-
- 5. When upgrading to MySQL 5.1 from a version previous to 4.1.5,
- or when upgrading from a version of MySQL installed from a Zip
- archive to a version of MySQL installed with the MySQL
- Installation Wizard, you must manually remove the previous
- installation and MySQL service (if the server is installed as
- a service).
- To remove the MySQL service, use the following command:
-C:\> C:\mysql\bin\mysqld --remove
- If you do not remove the existing service, the MySQL
- Installation Wizard may fail to properly install the new MySQL
- service.
-
- 6. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change
- in the default location of the data directory from a directory
- within the MySQL installation to the AppData folder means that
- you must manually copy the data files from your old
- installation to the new location.
-
- 7. If you are using the MySQL Installation Wizard, start the
- wizard as described in Section 2.3.3, "Using the MySQL
- Installation Wizard."
-
- 8. If you are installing MySQL from a Zip archive, extract the
- archive. You may either overwrite your existing MySQL
- installation (usually located at C:\mysql), or install it into
- a different directory, such as C:\mysql5. Overwriting the
- existing installation is recommended.
-
- 9. If you were running MySQL as a Windows service and you had to
- remove the service earlier in this procedure, reinstall the
- service. (See Section 2.3.11, "Starting MySQL as a Windows
- Service.")
- 10. Restart the server. For example, use NET START MySQL if you
- run MySQL as a service, or invoke mysqld directly otherwise.
- 11. If you encounter errors, see Section 2.3.13, "Troubleshooting
- a MySQL Installation Under Windows."
-
-2.3.15. MySQL on Windows Compared to MySQL on Unix
-
- MySQL for Windows has proven itself to be very stable. The Windows
- version of MySQL has the same features as the corresponding Unix
- version, with the following exceptions:
-
- * Limited number of ports
- Windows systems have about 4,000 ports available for client
- connections, and after a connection on a port closes, it takes
- two to four minutes before the port can be reused. In
- situations where clients connect to and disconnect from the
- server at a high rate, it is possible for all available ports
- to be used up before closed ports become available again. If
- this happens, the MySQL server appears to be unresponsive even
- though it is running. Note that ports may be used by other
- applications running on the machine as well, in which case the
- number of ports available to MySQL is lower.
- For more information about this problem, see
- http://support.microsoft.com/default.aspx?scid=kb;en-us;196271
- .
-
- * Concurrent reads
- MySQL depends on the pread() and pwrite() system calls to be
- able to mix INSERT and SELECT. Currently, we use mutexes to
- emulate pread() and pwrite(). We intend to replace the file
- level interface with a virtual interface in the future so that
- we can use the readfile()/writefile() interface to get more
- speed. The current implementation limits the number of open
- files that MySQL 5.1 can use to 2,048, which means that you
- cannot run as many concurrent threads on Windows as on Unix.
-
- * Blocking read
- MySQL uses a blocking read for each connection. That has the
- following implications if named-pipe connections are enabled:
-
- + A connection is not disconnected automatically after
- eight hours, as happens with the Unix version of MySQL.
-
- + If a connection hangs, it is not possible to break it
- without killing MySQL.
-
- + mysqladmin kill does not work on a sleeping connection.
-
- + mysqladmin shutdown cannot abort as long as there are
- sleeping connections.
- We plan to fix this problem in the future.
-
- * ALTER TABLE
- While you are executing an ALTER TABLE statement, the table is
- locked from being used by other threads. This has to do with
- the fact that on Windows, you can't delete a file that is in
- use by another thread. In the future, we may find some way to
- work around this problem.
-
- * DROP TABLE
- DROP TABLE on a table that is in use by a MERGE table does not
- work on Windows because the MERGE handler does the table
- mapping hidden from the upper layer of MySQL. Because Windows
- does not allow dropping files that are open, you first must
- flush all MERGE tables (with FLUSH TABLES) or drop the MERGE
- table before dropping the table.
-
- * DATA DIRECTORY and INDEX DIRECTORY
- The DATA DIRECTORY and INDEX DIRECTORY options for CREATE
- TABLE are ignored on Windows, because Windows doesn't support
- symbolic links. These options also are ignored on systems that
- have a nonfunctional realpath() call.
-
- * DROP DATABASE
- You cannot drop a database that is in use by some thread.
-
- * Case-insensitive names
- File names are not case sensitive on Windows, so MySQL
- database and table names are also not case sensitive on
- Windows. The only restriction is that database and table names
- must be specified using the same case throughout a given
- statement. See Section 8.2.2, "Identifier Case Sensitivity."
-
- * Directory and file names
- On Windows, MySQL Server supports only directory and file
- names that are compatible with the current ANSI code pages.
- For example, the following Japanese directory name will not
- work in the Western locale (code page 1252):
-datadir="C:/维基百科关于中文维基百科"
- The same limitation applies to directory and file names
- referred to in SQL statements, such as the data file path name
- in LOAD DATA INFILE.
-
- * The "\" path name separator character
- Path name components in Windows are separated by the "\"
- character, which is also the escape character in MySQL. If you
- are using LOAD DATA INFILE or SELECT ... INTO OUTFILE, use
- Unix-style file names with "/" characters:
-mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;
-mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
- Alternatively, you must double the "\" character:
-mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;
-mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;
-
- * Problems with pipes
- Pipes do not work reliably from the Windows command-line
- prompt. If the pipe includes the character ^Z / CHAR(24),
- Windows thinks that it has encountered end-of-file and aborts
- the program.
- This is mainly a problem when you try to apply a binary log as
- follows:
-C:\> mysqlbinlog binary_log_file | mysql --user=root
- If you have a problem applying the log and suspect that it is
- because of a ^Z / CHAR(24) character, you can use the
- following workaround:
-C:\> mysqlbinlog binary_log_file --result-file=/tmp/bin.sql
-C:\> mysql --user=root --execute "source /tmp/bin.sql"
- The latter command also can be used to reliably read in any
- SQL file that may contain binary data.
-
- * Access denied for user error
- If MySQL cannot resolve your host name properly, you may get
- the following error when you attempt to run a MySQL client
- program to connect to a server running on the same machine:
-Access denied for user 'some_user'@'unknown'
-to database 'mysql'
- To fix this problem, you should create a file named
- \windows\hosts containing the following information:
-127.0.0.1 localhost
-
- Here are some open issues for anyone who might want to help us
- improve MySQL on Windows:
-
- * Add macros to use the faster thread-safe increment/decrement
- methods provided by Windows.
-
-2.4. Installing MySQL from RPM Packages on Linux
-
- The recommended way to install MySQL on RPM-based Linux
- distributions is by using the RPM packages. The RPMs that we
- provide to the community should work on all versions of Linux that
- support RPM packages and use glibc 2.3. To obtain RPM packages,
- see Section 2.1.3, "How to Get MySQL."
-
- For non-RPM Linux distributions, you can install MySQL using a
- .tar.gz package. See Section 2.9, "Installing MySQL from tar.gz
- Packages on Other Unix-Like Systems."
-
- We do provide some platform-specific RPMs; the difference between
- a platform-specific RPM and a generic RPM is that a
- platform-specific RPM is built on the targeted platform and is
- linked dynamically whereas a generic RPM is linked statically with
- LinuxThreads.
-
-Note
-
- RPM distributions of MySQL often are provided by other vendors. Be
- aware that they may differ in features and capabilities from those
- built by us, and that the instructions in this manual do not
- necessarily apply to installing them. The vendor's instructions
- should be consulted instead.
-
- If you have problems with an RPM file (for example, if you receive
- the error Sorry, the host 'xxxx' could not be looked up), see
- Section 2.13.1.2, "Linux Binary Distribution Notes."
-
- In most cases, you need to install only the MySQL-server and
- MySQL-client packages to get a functional MySQL installation. The
- other packages are not required for a standard installation.
-
- RPMs for MySQL Cluster. Beginning with MySQL 5.1.24, standard
- MySQL server RPMs built by MySQL no longer provide support for the
- NDBCLUSTER storage engine. MySQL Cluster users wanting to upgrade
- MySQL 5.1.23 or earlier installations from RPMs built by MySQL
- should upgrade to MySQL Cluster NDB 6.2 or MySQL Cluster NDB 6.3;
- RPMs that should work with most Linux distributions are available
- for both of these release series.
-
-Important
-
- When upgrading a MySQL Cluster RPM installation, you must upgrade
- all installed RPMs, including the Server and Client RPMs.
-
- For more information about installing MySQL Cluster from RPMs, see
- Section 17.2.2, "MySQL Cluster Multi-Computer Installation."
-
- For upgrades, if your installation was originally produced by
- installing multiple RPM packages, it is best to upgrade all the
- packages, not just some. For example, if you previously installed
- the server and client RPMs, do not upgrade just the server RPM.
-
- If you get a dependency failure when trying to install MySQL
- packages (for example, error: removing these packages would break
- dependencies: libmysqlclient.so.10 is needed by ...), you should
- also install the MySQL-shared-compat package, which includes both
- the shared libraries for backward compatibility
- (libmysqlclient.so.12 for MySQL 4.0 and libmysqlclient.so.10 for
- MySQL 3.23).
-
- Some Linux distributions still ship with MySQL 3.23 and they
- usually link applications dynamically to save disk space. If these
- shared libraries are in a separate package (for example,
- MySQL-shared), it is sufficient to simply leave this package
- installed and just upgrade the MySQL server and client packages
- (which are statically linked and do not depend on the shared
- libraries). For distributions that include the shared libraries in
- the same package as the MySQL server (for example, Red Hat Linux),
- you could either install our 3.23 MySQL-shared RPM, or use the
- MySQL-shared-compat package instead. (Do not install both.)
-
- The RPM packages shown in the following list are available. The
- names shown here use a suffix of .glibc23.i386.rpm, but particular
- packages can have different suffixes, as described later.
-
- * MySQL-server-VERSION.glibc23.i386.rpm
- The MySQL server. You need this unless you only want to
- connect to a MySQL server running on another machine.
-
- * MySQL-client-VERSION.glibc23.i386.rpm
- The standard MySQL client programs. You probably always want
- to install this package.
-
- * MySQL-devel-VERSION.glibc23.i386.rpm
- The libraries and include files that are needed if you want to
- compile other MySQL clients, such as the Perl modules.
-
- * MySQL-debuginfo-VERSION.glibc23.i386.rpm
- This package contains debugging information. debuginfo RPMs
- are never needed to use MySQL software; this is true both for
- the server and for client programs. However, they contain
- additional information that might be needed by a debugger to
- analyze a crash.
-
- * MySQL-shared-VERSION.glibc23.i386.rpm
- This package contains the shared libraries
- (libmysqlclient.so*) that certain languages and applications
- need to dynamically load and use MySQL. It contains
- single-threaded and thread-safe libraries. If you install this
- package, do not install the MySQL-shared-compat package.
-
- * MySQL-shared-compat-VERSION.glibc23.i386.rpm
- This package includes the shared libraries for MySQL 3.23,
- 4.0, and so on, up to the current release. It contains
- single-threaded and thread-safe libraries. Install this
- package instead of MySQL-shared if you have applications
- installed that are dynamically linked against older versions
- of MySQL but you want to upgrade to the current version
- without breaking the library dependencies.
-
- * MySQL-embedded-VERSION.glibc23.i386.rpm
- The embedded MySQL server library.
-
- * MySQL-ndb-management-VERSION.glibc23.i386.rpm,
- MySQL-ndb-storage-VERSION.glibc23.i386.rpm,
- MySQL-ndb-tools-VERSION.glibc23.i386.rpm,
- MySQL-ndb-extra-VERSION.glibc23.i386.rpm
- Packages that contain additional files for MySQL Cluster
- installations.
-
-Note
- The MySQL-ndb-tools RPM requires a working installation of
- perl. Prior to MySQL 5.1.18, the DBI and HTML::Template
- packages were also required. See Section 2.15, "Perl
- Installation Notes," and Section 17.6.21, "ndb_size.pl ---
- NDBCLUSTER Size Requirement Estimator," for more information.
-
- * MySQL-test-VERSION.glibc23.i386.rpm
- This package includes the MySQL test suite.
-
- * MySQL-VERSION.src.rpm
- This contains the source code for all of the previous
- packages. It can also be used to rebuild the RPMs on other
- architectures (for example, Alpha or SPARC).
-
- The suffix of RPM package names (following the VERSION value) has
- the following syntax:
-.PLATFORM.CPU.rpm
-
- The PLATFORM and CPU values indicate the type of system for which
- the package is built. PLATFORM indicates the platform and CPU
- indicates the processor type or family.
-
- All packages are dynamically linked against glibc 2.3. The
- PLATFORM value indicates whether the package is platform
- independent or intended for a specific platform, as shown in the
- following table.
- glibc23 Platform independent, should run on any Linux distribution
- that supports glibc 2.3
- rhel3, rhel4 Red Hat Enterprise Linux 3 or 4
- sles9, sles10 SuSE Linux Enterprise Server 9 or 10
-
- In MySQL 5.1, only glibc23 packages are available currently.
-
- The CPU value indicates the processor type or family for which the
- package is built.
- i386 x86 processor, 386 and up
- i586 x86 processor, Pentium and up
- x86_64 64-bit x86 processor
- ia64 Itanium (IA-64) processor
-
- To see all files in an RPM package (for example, a MySQL-server
- RPM), run a command like this:
-shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm
-
- To perform a standard minimal installation, install the server and
- client RPMs:
-shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm
-shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
-
- To install only the client programs, install just the client RPM:
-shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
-
- RPM provides a feature to verify the integrity and authenticity of
- packages before installing them. If you would like to learn more
- about this feature, see Section 2.1.4, "Verifying Package
- Integrity Using MD5 Checksums or GnuPG."
-
- The server RPM places data under the /var/lib/mysql directory. The
- RPM also creates a login account for a user named mysql (if one
- does not exist) to use for running the MySQL server, and creates
- the appropriate entries in /etc/init.d/ to start the server
- automatically at boot time. (This means that if you have performed
- a previous installation and have made changes to its startup
- script, you may want to make a copy of the script so that you
- don't lose it when you install a newer RPM.) See Section 2.11.2.2,
- "Starting and Stopping MySQL Automatically," for more information
- on how MySQL can be started automatically on system startup.
-
- If you want to install the MySQL RPM on older Linux distributions
- that do not support initialization scripts in /etc/init.d
- (directly or via a symlink), you should create a symbolic link
- that points to the location where your initialization scripts
- actually are installed. For example, if that location is
- /etc/rc.d/init.d, use these commands before installing the RPM to
- create /etc/init.d as a symbolic link that points there:
-shell> cd /etc
-shell> ln -s rc.d/init.d .
-
- However, all current major Linux distributions should support the
- new directory layout that uses /etc/init.d, because it is required
- for LSB (Linux Standard Base) compliance.
-
- If the RPM files that you install include MySQL-server, the mysqld
- server should be up and running after installation. You should be
- able to start using MySQL.
-
- If something goes wrong, you can find more information in the
- binary installation section. See Section 2.9, "Installing MySQL
- from tar.gz Packages on Other Unix-Like Systems."
-
-Note
-
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
-
- During RPM installation, a user named mysql and a group named
- mysql are created on the system. This is done using the useradd,
- groupadd, and usermod commands. Those commands require appropriate
- administrative privileges, which is ensured for locally managed
- users and groups (as listed in the /etc/passwd and /etc/group
- files) by the RPM installation process being run by root.
-
- For nonlocal user management (LDAP, NIS, and so forth), the
- administrative tools may require additional authentication (such
- as a password), and will fail if the installing user does not
- provide this authentication. Even if they fail, the RPM
- installation will not abort but succeed, and this is intentional.
- If they failed, some of the intended transfer of ownership may be
- missing, and it is recommended that the system administrator then
- manually ensures some appropriate user andgroup exists and
- manually transfers ownership following the actions in the RPM spec
- file.
-
-2.5. Installing MySQL on Mac OS X
-
- You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
- using a Mac OS X binary package in PKG format instead of the
- binary tarball distribution. Please note that older versions of
- Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this
- package.
-
- The package is located inside a disk image (.dmg) file that you
- first need to mount by double-clicking its icon in the Finder. It
- should then mount the image and display its contents.
-
- To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
-
-Note
-
- Before proceeding with the installation, be sure to shut down all
- running MySQL server instances by either using the MySQL Manager
- Application (on Mac OS X Server) or via mysqladmin shutdown on the
- command line.
-
- To actually install the MySQL PKG file, double-click on the
- package icon. This launches the Mac OS X Package Installer, which
- guides you through the installation of MySQL.
-
- Due to a bug in the Mac OS X package installer, you may see this
- error message in the destination disk selection dialog:
-You cannot install this software on this disk. (null)
+ + If a stored function has a name that conflicts with a
+ built-in function, refer to the stored function with a
+ schema name qualifier, regardless of whether whitespace
+ is present. For example, write schema_name.PI() or
+ schema_name.PI ().
- If this error occurs, simply click the Go Back button once to
- return to the previous screen. Then click Continue to advance to
- the destination disk selection again, and you should be able to
- choose the destination disk correctly. We have reported this bug
- to Apple and it is investigating this problem.
-
- The Mac OS X PKG of MySQL installs itself into
- /usr/local/mysql-VERSION and also installs a symbolic link,
- /usr/local/mysql, that points to the new location. If a directory
- named /usr/local/mysql exists, it is renamed to
- /usr/local/mysql.bak first. Additionally, the installer creates
- the grant tables in the mysql database by executing
- mysql_install_db.
-
- The installation layout is similar to that of a tar file binary
- distribution; all MySQL binaries are located in the directory
- /usr/local/mysql/bin. The MySQL socket file is created as
- /tmp/mysql.sock by default. See Section 2.1.5, "Installation
- Layouts."
-
- MySQL installation requires a Mac OS X user account named mysql. A
- user account with this name should exist by default on Mac OS X
- 10.2 and up.
+ + Alternatively, rename the stored function to use a
+ nonconflicting name and change invocations of the
+ function to use the new name.
- If you are running Mac OS X Server, a version of MySQL should
- already be installed. The following table shows the versions of
- MySQL that ship with Mac OS X Server versions.
- Mac OS X Server Version MySQL Version
- 10.2-10.2.2 3.23.51
- 10.2.3-10.2.6 3.23.53
- 10.3 4.0.14
- 10.3.2 4.0.16
- 10.4.0 4.1.10a
+ * Incompatible change: For utf8 columns, the full-text parser
+ incorrectly considered several nonword punctuation and
+ whitespace characters as word characters, causing some
+ searches to return incorrect results. The fix involves a
+ change to the full-text parser in MySQL 5.1.12, so as of
+ 5.1.12, any tables that have FULLTEXT indexes on utf8 columns
+ must be repaired with REPAIR TABLE:
+REPAIR TABLE tbl_name QUICK;
- This manual section covers the installation of the official MySQL
- Mac OS X PKG only. Make sure to read Apple's help information
- about installing MySQL: Run the "Help View" application, select
- "Mac OS X Server" help, do a search for "MySQL," and read the item
- entitled "Installing MySQL."
-
- If you previously used Marc Liyanage's MySQL packages for Mac OS X
- from http://www.entropy.ch, you can simply follow the update
- instructions for packages using the binary installation layout as
- given on his pages.
-
- If you are upgrading from Marc's 3.23.x versions or from the Mac
- OS X Server version of MySQL to the official MySQL PKG, you also
- need to convert the existing MySQL privilege tables to the current
- format, because some new security privileges have been added. See
- Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL Upgrade."
-
- If you want MySQL to start automatically during system startup,
- you also need to install the MySQL Startup Item. It is part of the
- Mac OS X installation disk images as a separate installation
- package. Simply double-click the MySQLStartupItem.pkg icon and
- follow the instructions to install it. The Startup Item need be
- installed only once. There is no need to install it each time you
- upgrade the MySQL package later.
+ * Incompatible change: Storage engines can be pluggable at
+ runtime, so the distinction between disabled and invalid
+ storage engines no longer applies. As of MySQL 5.1.12, this
+ affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in
+ Section 5.1.8, "Server SQL Modes."
- The Startup Item for MySQL is installed into
- /Library/StartupItems/MySQLCOM. (Before MySQL 4.1.2, the location
- was /Library/StartupItems/MySQL, but that collided with the MySQL
- Startup Item installed by Mac OS X Server.) Startup Item
- installation adds a variable MYSQLCOM=-YES- to the system
- configuration file /etc/hostconfig. If you want to disable the
- automatic startup of MySQL, simply change this variable to
- MYSQLCOM=-NO-.
-
- On Mac OS X Server, the default MySQL installation uses the
- variable MYSQL in the /etc/hostconfig file. The MySQL Startup Item
- installer disables this variable by setting it to MYSQL=-NO-. This
- avoids boot time conflicts with the MYSQLCOM variable used by the
- MySQL Startup Item. However, it does not shut down a running MySQL
- server. You should do that yourself.
+ * Incompatible change: The structure of FULLTEXT indexes has
+ been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or
+ greater, any tables that have FULLTEXT indexes must be
+ repaired with REPAIR TABLE:
+REPAIR TABLE tbl_name QUICK;
- After the installation, you can start up MySQL by running the
- following commands in a terminal window. You must have
- administrator privileges to perform this task.
+ * Incompatible change: In MySQL 5.1.6, when log tables were
+ implemented, the default log destination for the general query
+ and slow query log was TABLE. As of MySQL 5.1.21, this default
+ has been changed to FILE, which is compatible with MySQL 5.0,
+ but incompatible with earlier releases of MySQL 5.1. If you
+ are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging
+ option changes should be necessary. However, if you are
+ upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and
+ were using TABLE logging, use the --log-output=TABLE option
+ explicitly to preserve your server's table-logging behavior.
- If you have installed the Startup Item, use this command:
-shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
-(Enter your password, if necessary)
-(Press Control-D or enter "exit" to exit the shell)
+ * Incompatible change: For ENUM columns that had enumeration
+ values containing commas, the commas were mapped to 0xff
+ internally. However, this rendered the commas
+ indistinguishable from true 0xff characters in the values.
+ This no longer occurs. However, the fix requires that you dump
+ and reload any tables that have ENUM columns containing true
+ 0xff in their values: Dump the tables using mysqldump with the
+ current server before upgrading from a version of MySQL 5.1
+ older than 5.1.15 to version 5.1.15 or newer.
- If you don't use the Startup Item, enter the following command
- sequence:
-shell> cd /usr/local/mysql
-shell> sudo ./bin/mysqld_safe
-(Enter your password, if necessary)
-(Press Control-Z)
-shell> bg
-(Press Control-D or enter "exit" to exit the shell)
+ * As of MySQL 5.1.12, the lc_time_names system variable
+ specifies the locale that controls the language used to
+ display day and month names and abbreviations. This variable
+ affects the output from the DATE_FORMAT(), DAYNAME() and
+ MONTHNAME() functions. See Section 9.8, "MySQL Server Locale
+ Support."
- You should be able to connect to the MySQL server, for example, by
- running /usr/local/mysql/bin/mysql.
+ * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes
+ mysqld-max if it exists. Instead, it invokes mysqld unless a
+ --mysqld or --mysqld-version option is given to specify
+ another server explicitly. If you previously relied on the
+ implicit invocation of mysqld-max, you should use an
+ appropriate option now. As of MySQL 5.1.12, there is no longer
+ any separate mysqld-max server, so no change should be
+ necessary.
-Note
+ SQL Changes:
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ * Known issue: Prior to MySQL 5.1.17, the parser accepted
+ invalid code in SQL condition handlers, leading to server
+ crashes or unexpected execution behavior in stored programs.
+ Specifically, the parser allowed a condition handler to refer
+ to labels for blocks that enclose the handler declaration.
+ This was incorrect because block label scope does not include
+ the code for handlers declared within the labeled block.
+ As of 5.1.17, the parser rejects this invalid construct, but
+ if you perform a binary upgrade (without dumping and reloading
+ your databases), existing handlers that contain the construct
+ still are invalid and should be rewritten even if they appear
+ to function as you expect.
+ To find affected handlers, use mysqldump to dump all stored
+ procedures and functions, triggers, and events. Then attempt
+ to reload them into an upgraded server. Handlers that contain
+ illegal label references will be rejected.
+ For more information about condition handlers and writing them
+ to avoid invalid jumps, see Section 12.8.4.2, "DECLARE for
+ Handlers."
- You might want to add aliases to your shell's resource file to
- make it easier to access commonly used programs such as mysql and
- mysqladmin from the command line. The syntax for bash is:
-alias mysql=/usr/local/mysql/bin/mysql
-alias mysqladmin=/usr/local/mysql/bin/mysqladmin
+ * Incompatible change: The parser accepted statements that
+ contained /* ... */ that were not properly closed with */,
+ such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that
+ contain unclosed /*-comments now are rejected with a syntax
+ error.
+ This fix has the potential to cause incompatibilities. Because
+ of Bug#26302: http://bugs.mysql.com/26302, which caused the
+ trailing */ to be truncated from comments in views, stored
+ routines, triggers, and events, it is possible that objects of
+ those types may have been stored with definitions that now
+ will be rejected as syntactically invalid. Such objects should
+ be dropped and re-created so that their definitions do not
+ contain truncated comments.
- For tcsh, use:
-alias mysql /usr/local/mysql/bin/mysql
-alias mysqladmin /usr/local/mysql/bin/mysqladmin
+ * Incompatible change: Multiple-table DELETE statements
+ containing ambiguous aliases could have unintended side
+ effects such as deleting rows from the wrong table. Example:
+DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
+ As of MySQL 5.1.23, alias declarations can be declared only in
+ the table_references part. Elsewhere in the statement, alias
+ references are allowed but not alias declarations. Statements
+ containing aliases that are no longer allowed must be
+ rewritten.
- Even better, add /usr/local/mysql/bin to your PATH environment
- variable. You can do this by modifying the appropriate startup
- file for your shell. For more information, see Section 4.2.1,
- "Invoking MySQL Programs."
-
- If you are upgrading an existing installation, note that
- installing a new MySQL PKG does not remove the directory of an
- older installation. Unfortunately, the Mac OS X Installer does not
- yet offer the functionality required to properly upgrade
- previously installed packages.
-
- To use your existing databases with the new installation, you'll
- need to copy the contents of the old data directory to the new
- data directory. Make sure that neither the old server nor the new
- one is running when you do this. After you have copied over the
- MySQL database files from the previous installation and have
- successfully started the new server, you should consider removing
- the old installation files to save disk space. Additionally, you
- should also remove older versions of the Package Receipt
- directories located in /Library/Receipts/mysql-VERSION.pkg.
+ * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is
+ still accepted as a synonym for the ENGINE = engine_name table
+ option but generates a warning. You should note that this
+ option is not available in MySQL 5.1.7, and is removed
+ altogether as of MySQL 5.4 and produces a syntax error.
+ TYPE has been deprecated since MySQL 4.0.
-2.6. Installing MySQL on Solaris
+ * Incompatible change: The namespace for triggers changed in
+ MySQL 5.0.10. Previously, trigger names had to be unique per
+ table. Now they must be unique within the schema (database).
+ An implication of this change is that DROP TRIGGER syntax now
+ uses a schema name instead of a table name (schema name is
+ optional and, if omitted, the current schema will be used).
+ When upgrading from a version of MySQL 5 older than 5.0.10 to
+ MySQL 5.0.10 or newer, you must drop all triggers and
+ re-create them or DROP TRIGGER will not work after the
+ upgrade. Here is a suggested procedure for doing this:
- To obtain a binary MySQL distribution for Solaris in tarball or
- PKG format, http://dev.mysql.com/downloads/mysql/5.1.html.
+ 1. Upgrade to MySQL 5.0.10 or later to be able to access
+ trigger information in the INFORMATION_SCHEMA.TRIGGERS
+ table. (This should work even for pre-5.0.10 triggers.)
- If you install MySQL using a binary tarball distribution on
- Solaris, you may run into trouble even before you get the MySQL
- distribution unpacked, as the Solaris tar cannot handle long file
- names. This means that you may see errors when you try to unpack
- MySQL.
+ 2. Dump all trigger definitions using the following SELECT
+ statement:
+SELECT CONCAT('CREATE TRIGGER ', t.TRIGGER_SCHEMA, '.', t.TRIGGER_NAM
+E,
+ ' ', t.ACTION_TIMING, ' ', t.EVENT_MANIPULATION, ' ON '
+,
+ t.EVENT_OBJECT_SCHEMA, '.', t.EVENT_OBJECT_TABLE,
+ ' FOR EACH ROW ', t.ACTION_STATEMENT, '//' )
+INTO OUTFILE '/tmp/triggers.sql'
+FROM INFORMATION_SCHEMA.TRIGGERS AS t;
+ The statement uses INTO OUTFILE, so you must have the
+ FILE privilege. The file will be created on the server
+ host. Use a different file name if you like. To be 100%
+ safe, inspect the trigger definitions in the triggers.sql
+ file, and perhaps make a backup of the file.
- If this occurs, you must use GNU tar (gtar) to unpack the
- distribution.
+ 3. Stop the server and drop all triggers by removing all
+ .TRG files in your database directories. Change location
+ to your data directory and issue this command:
+shell> rm */*.TRG
- You can install MySQL on Solaris using a binary package in PKG
- format instead of the binary tarball distribution. Before
- installing using the binary PKG format, you should create the
- mysql user and group, for example:
-groupadd mysql
-useradd -g mysql mysql
+ 4. Start the server and re-create all triggers using the
+ triggers.sql file:
+mysql> delimiter // ;
+mysql> source /tmp/triggers.sql //
- Some basic PKG-handling commands follow:
+ 5. Check that all triggers were successfully created using
+ the SHOW TRIGGERS statement.
- * To add a package:
-pkgadd -d package_name.pkg
+ * Incompatible change: MySQL 5.1.6 introduces the TRIGGER
+ privilege. Previously, the SUPER privilege was needed to
+ create or drop triggers. Now those operations require the
+ TRIGGER privilege. This is a security improvement because you
+ no longer need to grant users the SUPER privilege to enable
+ them to create triggers. However, the requirement that the
+ account named in a trigger's DEFINER clause must have the
+ SUPER privilege has changed to a requirement for the TRIGGER
+ privilege. When upgrading from a previous version of MySQL 5.0
+ or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant
+ tables by running mysql_upgrade. This will assign the TRIGGER
+ privilege to all accounts that had the SUPER privilege. If you
+ fail to update the grant tables, triggers may fail when
+ activated. After updating the grant tables, you can revoke the
+ SUPER privilege from those accounts that no longer otherwise
+ require it.
- * To remove a package:
-pkgrm package_name
+ * Some keywords may be reserved in MySQL 5.1 that were not
+ reserved in MySQL 5.0. See Section 8.3, "Reserved Words."
- * To get a full list of installed packages:
-pkginfo
+ * The BACKUP TABLE, and RESTORE TABLE statements are deprecated.
+ mysqldump or mysqlhotcopy can be used as alternatives.
- * To get detailed information for a package:
-pkginfo -l package_name
+ * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER
+ statements are deprecated. See Section 12.6.2.2, "LOAD DATA
+ FROM MASTER Syntax," for recommended alternatives.
- * To list the files belonging to a package:
-pkgchk -v package_name
+ * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are
+ used for the plugin API are new. So is the WITH PARSER clause
+ for FULLTEXT index creation that associates a parser plugin
+ with a full-text index. Section 22.2, "The MySQL Plugin
+ Interface."
- * To get packaging information for an arbitrary file:
-pkgchk -l -p file_name
+ C API Changes:
- For additional information about installing MySQL on Solaris, see
- Section 2.13.3, "Solaris Notes."
+ * Incompatible change: As of MySQL 5.1.7, the
+ mysql_stmt_attr_get() C API function returns a boolean rather
+ than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH.
+ (Bug#16144: http://bugs.mysql.com/16144)
-2.7. Installing MySQL on i5/OS
+2.4.2. Downgrading MySQL
- The i5/OS POWER MySQL package was created in cooperation with IBM.
- MySQL works within the Portable Application Solution Environment
- (PASE) on the System i series of hardware and will also provide
- database services for the Zend Core for i5/OS.
+ This section describes what you should do to downgrade to an older
+ MySQL version in the unlikely case that the previous version
+ worked better than the new one.
- MySQL for i5/OS is provided as a save file (.savf) package that
- can be downloaded and installed directly without any additional
- installation steps required.
+ If you are downgrading within the same release series (for
+ example, from 5.0.13 to 5.0.12) the general rule is that you just
+ have to install the new binaries on top of the old ones. There is
+ no need to do anything with the databases. As always, however, it
+ is always a good idea to make a backup.
- MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS
- PASE must be installed for MySQL to operate. You must be able to
- login as a user in *SECOFR class.
+ The following items form a checklist of things you should do
+ whenever you perform a downgrade:
- You should the installation notes and tips for i5/OS before
- starting installation. See i5/OS Installation Notes.
+ * Read the upgrading section for the release series from which
+ you are downgrading to be sure that it does not have any
+ features you really need. See Section 2.4.1, "Upgrading
+ MySQL."
-Note
+ * If there is a downgrading section for that version, you should
+ read that as well.
- The installation package will use an existing configuration if you
- have previously installed MySQL (which is identified by looking
- for the file /etc/my.cnf). The values for the data directory
- (DATADIR) and owner of the MySQL files (USRPRF) specified during
- the installation will be ignored, and the values determined from
- the /etc/my.cnf will be used instead.
+ * To see which new features were added between the version to
+ which you are downgrading and your current version, see the
+ change logs (Appendix C, "MySQL Change History").
- If you want to change these parameters during a new install, you
- should temporarily rename /etc/my.cnf, install MySQL using the new
- parameters you want to use, and then merge your previous
- /etc/my.cnf configuration settings with the new /etc/my.cnf file
- that is created during installation.
+ * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
+ Be Rebuilt," to see whether changes to table formats or to
+ character sets or collations were made between your current
+ version of MySQL and the version to which you are downgrading.
+ If so and these changes result in an incompatibility between
+ MySQL versions, you will need to downgrade the affected tables
+ using the instructions in Section 2.4.4, "Rebuilding or
+ Repairing Tables or Indexes."
- To install MySQL on i5/OS, follow these steps:
+ In most cases, you can move the MySQL format files and data files
+ between different versions on the same architecture as long as you
+ stay within versions for the same release series of MySQL.
- 1. Create a user profile MYSQL. The MYSQL user profile will own
- all the MySQL files and databases and be the active user used
- when the MySQL server is running. The profile should be
- disabled so that you cannot log in as the MySQL user. To
- create a user profile, use CRTUSRPRF:
-CRTUSRPRF USRPRF(MYSQL) STATUS(*DISABLED) TEXT('MySQL user id')
+ If you downgrade from one release series to another, there may be
+ incompatibilities in table storage formats. In this case, use
+ mysqldump to dump your tables before downgrading. After
+ downgrading, reload the dump file using mysql or mysqlimport to
+ re-create your tables. For examples, see Section 2.4.5, "Copying
+ MySQL Databases to Another Machine."
- 2. On the System i machine, create a save file that will be used
- to receive the downloaded installation save file. The file
- should be located within the General Purpose Library (QGPL):
-CRTSAVF FILE(QGPL/MYSQLINST)
+ A typical symptom of a downward-incompatible table format change
+ when you downgrade is that you cannot open tables. In that case,
+ use the following procedure:
- 3. Download the MySQL installation save file in 32-bit
- (mysql-5.0.42-i5os-power-32bit.savf) or 64-bit
- (mysql-5.0.42-i5os-power-64bit.savf) from MySQL Downloads
- (http://dev.mysql.com/downloads)
+ 1. Stop the older MySQL server that you are downgrading to.
- 4. You need to FTP the downloaded .savf file directly into the
- QGPL/MYSQLINST file on the System i server. You can do this
- through FTP using the following steps after logging in to the
- System i machine:
-ftp> bin
-ftp> cd qgpl
-ftp> put mysql-5.0.42-i5os-power.savf mysqlinst
+ 2. Restart the newer MySQL server you are downgrading from.
- 5. Log into the System i server using a user in the *SECOFR
- class, such as the QSECOFR user ID.
+ 3. Dump any tables that were inaccessible to the older server by
+ using mysqldump to create a dump file.
- 6. You need to restore the installation library stored in the
- .savf save file:
-RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST)
+ 4. Stop the newer MySQL server and restart the older one.
- 7. You need to execute the installation command,
- MYSQLINST/INSMYSQL. You can specify three parameter settings
- during installation:
+ 5. Reload the dump file into the older server. Your tables should
+ be accessible.
- + DIR('/opt/mysql') sets the installation location for the
- MySQL files. The directory will be created if it does not
- already exist.
-
- + DATADIR('/QOpenSys/mysal/data') sets the location of the
- directory that will be used to store the database files
- and binary logs. The default setting is
- /QOpenSys/mysql/data. Note that if the installer detects
- an existing installation (due to the existence of
- /etc/my.cnf), then this parameter will be ignored.
+ It might also be the case that the structure of the system tables
+ in the mysql database has changed and that downgrading introduces
+ some loss of functionality or requires some adjustments. Here are
+ some examples:
- + USRPRF(MYSQL) sets the user profile that will own the
- files that are installed. The profile will be created if
- it does not already exist.
- MySQL can be installed anywhere, for this example we will
- assume MySQL has been installed into /opt/mysql. The MYSQL
- user profile that was created earlier in this sequence should
- be used for the profile:
-MYSQLINST/INSMYSQL DIR('/opt/mysql') DATADIR('/opt/mysqldata') USRPRF
-(MYSQL)
- If you are updating an installation over an existing MySQL
- installation, you should use the same parameter values that
- were used when MySQL was originally installed.
- The installation copies all the necessary files into a
- directory matching the package version (for example
- mysql-5.0.42-i5os-power-32bit), sets the ownership on those
- files, sets up the MySQL environment and creates the MySQL
- configuration file (in /etc/my.cnf) completing all the steps
- in a typical binary installation process automatically. If
- this is a new installation of MySQL, or if the installer
- detects that this is a new version (because the /etc/my.cnf
- file does not exist), then the initial core MySQL databases
- will also be created during installation.
+ * Trigger creation requires the TRIGGER privilege as of MySQL
+ 5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is
+ required instead. If you downgrade from MySQL 5.1 to 5.0, you
+ will need to give the SUPER privilege to those accounts that
+ had the TRIGGER privilege in 5.1.
- 8. Once the installation has completed, you can delete the
- installation file:
-DLTLIB LIB(MYSQLINST)
+ * Triggers were added in MySQL 5.0, so if you downgrade from 5.0
+ to 4.1, you cannot use triggers at all.
- To start MySQL:
+2.4.2.1. Downgrading to MySQL 5.0
- 1. Log into the System i server using a user within the *SECOFR
- class, such as the QSECOFR user ID.
+ When downgrading to MySQL 5.0 from MySQL 5.1, you should keep in
+ mind the following issues relating to features found in MySQL 5.1,
+ but not in MySQL 5.0:
-Note
- You should start mysqld_safe using a user that in the PASE
- environment has the id=0 (the equivalent of the standard Unix
- root user). If you do not use a user with this ID then the
- system will be unable to change the user when executing mysqld
- as set using --user option. If this happens, mysqld may be
- unable to read the files located within the MySQL data
- directory and the execution will fail.
+ * Partitioning. MySQL 5.0 does not support user-defined
+ partitioning. If a table was created as a partitioned table in
+ 5.1 (or if an table created in a previous version of MySQL was
+ altered to include partitions after an upgrade to 5.1), the
+ table is accessible after downgrade only if you do one of the
+ following:
- 2. Enter the PASE environment using call qp2term.
+ + Export the table using mysqldump and then drop it in
+ MySQL 5.1; import the table again following the downgrade
+ to MySQL 5.0.
- 3. Start the MySQL server by changing to the installation
- directory and running mysqld_safe, specifying the user name
- used to install the server. The installer conveniently
- installs a symbolic link to the installation directory
- (mysql-5.0.42-i5os-power-32bit) as /opt/mysql/mysql:
-> cd /opt/mysql/mysql
-> bin/mysqld_safe --user=mysql &
- You should see a message similar to the following:
-Starting mysqld daemon with databases »
- from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data
+ + Prior to the downgrade, remove the table's partitioning
+ using ALTER TABLE table_name REMOVE PARTITIONING.
- If you are having problems starting MySQL server, see Section
- 2.11.2.3, "Starting and Troubleshooting the MySQL Server."
+ * Event Scheduler. MySQL 5.0 does not support scheduled events.
+ If your databases contain scheduled event definitions, you
+ should prevent them from being dumped when you use mysqldump
+ by using the --skip-events option. (See Section 4.5.4,
+ "mysqldump --- A Database Backup Program.")
- To stop MySQL:
+ * Stored routines. MySQL 5.1.21 added a number of new columns
+ to the mysql.proc table in which stored routine definitions
+ are stored. If you are downgrading from MySQL 5.1.21 or later
+ to MySQL 5.0, you cannot import the MySQL 5.1 routine
+ definitions into MySQL 5.0.46 or earlier using the dump of
+ mysql.proc created by mysqldump (such as when using the
+ --all-databases option). Instead, you should run mysqldump
+ --routines prior to performing the downgrade and run the
+ stored routines DDL statements following the downgrade.
+ See Bug#11986: http://bugs.mysql.com/11986,
+ Bug#30029: http://bugs.mysql.com/30029, and
+ Bug#30660: http://bugs.mysql.com/30660, for more information.
- 1. Log into the System i server using the *SECOFR class, such as
- the QSECOFR user ID.
+ * Triggers. Trigger creation requires the TRIGGER privilege as
+ of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and
+ SUPER is required instead. If you downgrade from MySQL 5.1 to
+ 5.0, you will need to give the SUPER privilege to those
+ accounts that had the TRIGGER privilege in 5.1.
- 2. Enter the PASE environment using call qp2term.
+2.4.3. Checking Whether Tables or Indexes Must Be Rebuilt
- 3. Stop the MySQL server by changing into the installation
- directory and running mysqladmin, specifying the user name
- used to install the server:
-> cd /opt/mysql/mysql
-> bin/mysqladmin -u root shutdown
- If the session that you started and stopped MySQL are the
- same, you may get the log output from mysqld:
- STOPPING server from pid file »
- /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.R
-CHLAND.IBM.COM.pid
- 070718 10:34:20 mysqld ended
- If the sessions used to start and stop MySQL are different,
- you will not receive any confirmation of the shutdown.
+ A binary upgrade or downgrade is one that installs one version of
+ MySQL "in place" over an existing version, without dumping and
+ reloading tables:
- Note and tips
+ 1. Stop the server for the existing version if it is running.
- * A problem has been identified with the installation process on
- DBCS systems. If you are having problems install MySQL on a
- DBCS system, you need to change your job's coded character set
- identifier (CSSID) to 37 (EBCDIC) before executing the install
- command, INSMYSQL. To do this, determine your existing CSSID
- (using DSPJOB and selecting option 2), execute CHGJOB
- CSSID(37), run INSMYSQL to install MySQL and then execute
- CHGJOB again with your original CSSID.
+ 2. Install a different version of MySQL. This is an upgrade if
+ the new version is higher than the original version, a
+ downgrade if the version is lower.
- * If you want to use the Perl scripts that are included with
- MySQL, you need to download the iSeries Tools for Developers
- (5799-PTL). See
- http://www-03.ibm.com/servers/enable/site/porting/tools/.
+ 3. Start the server for the new version.
-2.8. Installing MySQL on NetWare
+ In many cases, the tables from the previous version of MySQL can
+ be used without problem by the new version. However, sometimes
+ changes occur that require tables or table indexes to be rebuilt,
+ as described in this section. If you have tables that are affected
+ by any of the issues described here, rebuild the tables or indexes
+ as necessary using the instructions given in Section 2.4.4,
+ "Rebuilding or Repairing Tables or Indexes."
- Porting MySQL to NetWare was an effort spearheaded by Novell.
- Novell customers should be pleased to note that NetWare 6.5 ships
- with bundled MySQL binaries, complete with an automatic commercial
- use license for all servers running that version of NetWare.
-
- MySQL for NetWare is compiled using a combination of Metrowerks
- CodeWarrior for NetWare and special cross-compilation versions of
- the GNU autotools.
+ Table Incompatibilities
- The latest binary packages for NetWare can be obtained at
- http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
- MySQL."
+ After a binary upgrade to MySQL 5.1 from a MySQL 5.0 installation
+ that contains ARCHIVE tables, accessing those tables causes the
+ server to crash, even if you have run mysql_upgrade or CHECK TABLE
+ ... FOR UPGRADE. To work around this problem, use mysqldump to
+ dump all ARCHIVE tables before upgrading, and reload them into
+ MySQL 5.1 after upgrading. The same problem occurs for binary
+ downgrades from MySQL 5.1 to 5.0.
+
+ Index Incompatibilities
+
+ If you perform a binary upgrade without dumping and reloading
+ tables, you cannot upgrade directly from MySQL 4.1 to 5.1 or
+ higher. This occurs due to an incompatible change in the MyISAM
+ table index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
+ repair all MyISAM tables. Then upgrade from MySQL 5.0 to 5.1 and
+ check and repair your tables.
+
+ Modifications to the handling of character sets or collations
+ might change the character sort order, which causes the ordering
+ of entries in any index that uses an affected character set or
+ collation to be incorrect. Such changes result in several possible
+ problems:
- To host MySQL, the NetWare server must meet these requirements:
+ * Comparison results that differ from previous results
- * The latest Support Pack of NetWare 6.5
- (http://support.novell.com/filefinder/18197/index.html) must
- be installed.
+ * Inability to find some index values due to misordered index
+ entries
- * The system must meet Novell's minimum requirements to run the
- respective version of NetWare.
+ * Misordered ORDER BY results
- * MySQL data and the program binaries must be installed on an
- NSS volume; traditional volumes are not supported.
+ * Tables that CHECK TABLE reports as being in need of repair
- To install MySQL for NetWare, use the following procedure:
+ The solution to these problems is to rebuild any indexes that use
+ an affected character set or collation, either by dropping and
+ re-creating the indexes, or by dumping and reloading the entire
+ table. For information about rebuilding indexes, see Section
+ 2.4.4, "Rebuilding or Repairing Tables or Indexes."
- 1. If you are upgrading from a prior installation, stop the MySQL
- server. This is done from the server console, using the
- following command:
-SERVER: mysqladmin -u root shutdown
+ To check whether a table has indexes that must be rebuilt, consult
+ the following list. It indicates which versions of MySQL
+ introduced character set or collation changes that require indexes
+ to be rebuilt. Each entry indicates the version in which the
+ change occurred and the character sets or collations that the
+ change affects. If the change is associated with a particular bug
+ report, the bug number is given.
-Note
- If the MySQL root user account has a password, you need to
- invoke mysqladmin with the -p option and supply the password
- when prompted.
+ The list applies both for binary upgrades and downgrades. For
+ example, Bug#27877: http://bugs.mysql.com/27877 was fixed in MySQL
+ 5.1.24 and 5.4.0, so it applies to upgrades from versions older
+ than 5.1.24 to 5.1.24 or newer, and to downgrades from 5.1.24 or
+ newer to versions older than 5.1.24.
- 2. Log on to the target server from a client machine with access
- to the location where you are installing MySQL.
+ In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify
+ tables for which index rebuilding is required. (It will report:
+ Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or
+ dump/reload to fix it!) In these cases, you can also use
+ mysqlcheck --check-upgrade or mysql_upgrade, which execute CHECK
+ TABLE. However, the use of CHECK TABLE applies only after
+ upgrades, not downgrades. Also, CHECK TABLE is not applicable to
+ all storage engines. For details about which storage engines CHECK
+ TABLE supports, see Section 12.5.2.3, "CHECK TABLE Syntax."
- 3. Extract the binary package Zip file onto the server. Be sure
- to allow the paths in the Zip file to be used. It is safe to
- simply extract the file to SYS:\.
- If you are upgrading from a prior installation, you may need
- to copy the data directory (for example, SYS:MYSQL\DATA), as
- well as my.cnf, if you have customized it. You can then delete
- the old copy of MySQL.
-
- 4. You might want to rename the directory to something more
- consistent and easy to use. The examples in this manual use
- SYS:MYSQL to refer to the installation directory.
- Note that MySQL installation on NetWare does not detect if a
- version of MySQL is already installed outside the NetWare
- release. Therefore, if you have installed the latest MySQL
- version from the Web (for example, MySQL 4.1 or later) in
- SYS:\MYSQL, you must rename the folder before upgrading the
- NetWare server; otherwise, files in SYS:\MySQL are overwritten
- by the MySQL version present in NetWare Support Pack.
-
- 5. At the server console, add a search path for the directory
- containing the MySQL NLMs. For example:
-SERVER: SEARCH ADD SYS:MYSQL\BIN
-
- 6. Initialize the data directory and the grant tables, if
- necessary, by executing mysql_install_db at the server
- console.
-
- 7. Start the MySQL server using mysqld_safe at the server
- console.
-
- 8. To finish the installation, you should also add the following
- commands to autoexec.ncf. For example, if your MySQL
- installation is in SYS:MYSQL and you want MySQL to start
- automatically, you could add these lines:
-#Starts the MySQL 5.1.x database server
-SEARCH ADD SYS:MYSQL\BIN
-MYSQLD_SAFE
- If you are running MySQL on NetWare 6.0, we strongly suggest
- that you use the --skip-external-locking option on the command
- line:
-#Starts the MySQL 5.1.x database server
-SEARCH ADD SYS:MYSQL\BIN
-MYSQLD_SAFE --skip-external-locking
- It is also necessary to use CHECK TABLE and REPAIR TABLE
- instead of myisamchk, because myisamchk makes use of external
- locking. External locking is known to have problems on NetWare
- 6.0; the problem has been eliminated in NetWare 6.5. Note that
- the use of MySQL on Netware 6.0 is not officially supported.
- mysqld_safe on NetWare provides a screen presence. When you
- unload (shut down) the mysqld_safe NLM, the screen does not go
- away by default. Instead, it prompts for user input:
-*<NLM has terminated; Press any key to close the screen>*
- If you want NetWare to close the screen automatically instead,
- use the --autoclose option to mysqld_safe. For example:
-#Starts the MySQL 5.1.x database server
-SEARCH ADD SYS:MYSQL\BIN
-MYSQLD_SAFE --autoclose
- The behavior of mysqld_safe on NetWare is described further in
- Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
-
- 9. When installing MySQL, either for the first time or upgrading
- from a previous version, download and install the latest and
- appropriate Perl module and PHP extensions for NetWare:
-
- + Perl:
- http://forge.novell.com/modules/xfcontent/downloads.php/p
- erl/Modules/
-
- + PHP:
- http://forge.novell.com/modules/xfcontent/downloads.php/p
- hp/Modules/
-
- If there was an existing installation of MySQL on the NetWare
- server, be sure to check for existing MySQL startup commands in
- autoexec.ncf, and edit or delete them as necessary.
+ Changes that cause index rebuilding to be necessary:
-Note
+ * MySQL 5.0.48, 5.1.21 (Bug#29461: http://bugs.mysql.com/29461)
+ Affects indexes for columns that use any of these character
+ sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
+ Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
+ as of MySQL 5.1.29, 5.4.0 (see
+ Bug#39585: http://bugs.mysql.com/39585)
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ * MySQL 5.0.48, 5.1.23 (Bug#27562: http://bugs.mysql.com/27562)
+ Affects indexes that use the ascii_general_ci collation for
+ columns that contain any of these characters: '`' GRAVE
+ ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
+ RIGHT SQUARE BRACKET, '~' TILDE
+ Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
+ as of MySQL 5.1.29, 5.4.0 (see
+ Bug#39585: http://bugs.mysql.com/39585)
-2.9. Installing MySQL from tar.gz Packages on Other Unix-Like Systems
+ * MySQL 5.1.24, 5.4.0 (Bug#27877: http://bugs.mysql.com/27877)
+ Affects indexes that use the utf8_general_ci or
+ ucs2_general_ci collation for columns that contain 'ß' LATIN
+ SMALL LETTER SHARP S (German).
+ Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
+ as of MySQL 5.1.30, 5.4.0 (see
+ Bug#40053: http://bugs.mysql.com/40053)
- This section covers the installation of MySQL binary distributions
- that are provided for various platforms in the form of compressed
- tar files (files with a .tar.gz extension). See Section 2.1.2.4,
- "MySQL Binaries Compiled by Sun Microsystems, Inc.," for a
- detailed list.
+2.4.4. Rebuilding or Repairing Tables or Indexes
- To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
+ This section describes how to rebuild a table. This can be
+ necessitated by changes to MySQL such as how data types are
+ handled or changes to character set handling. For example, an
+ error in a collation might have been corrected, necessitating a
+ table rebuild to rebuild the indexes for character columns that
+ use the collation. It might also be that a table repair or upgrade
+ should be done as indicated by a table check operation such as
+ that performed by CHECK TABLE, mysqlcheck, or mysql_upgrade.
- MySQL tar file binary distributions have names of the form
- mysql-VERSION-OS.tar.gz, where VERSION is a number (for example,
- 5.1.39), and OS indicates the type of operating system for which
- the distribution is intended (for example, pc-linux-i686).
+ Methods for rebuilding a table include dumping and reloading it,
+ or using ALTER TABLE or REPAIR TABLE.
- In addition to these generic packages, we also offer binaries in
- platform-specific package formats for selected platforms. See
- Section 2.2, "Standard MySQL Installation Using a Binary
- Distribution," for more information on how to install these.
+Note
- You need the following tools to install a MySQL tar file binary
- distribution:
+ If you are rebuilding tables because a different version of MySQL
+ will not handle them after a binary (in-place) upgrade or
+ downgrade, you must use the dump-and-reload method. Dump the
+ tables before upgrading or downgrading (using your original
+ version of MySQL), and reload the tables after upgrading or
+ downgrading (after installing the new version).
- * GNU gunzip to uncompress the distribution.
+ If you use the dump-and-reload method of rebuilding tables only
+ for the purpose of rebuilding indexes, you can perform the dump
+ either before or after upgrading or downgrading. Reloading still
+ must be done afterward.
- * A reasonable tar to unpack the distribution. GNU tar is known
- to work. Some operating systems come with a preinstalled
- version of tar that is known to have problems. For example,
- the tar provided with early versions of Mac OS X, SunOS 4.x
- and Solaris 8 and earlier are known to have problems with long
- file names. On Mac OS X, you can use the preinstalled gnutar
- program. On other systems with a deficient tar, you should
- install GNU tar first.
+ To re-create a table by dumping and reloading it, use mysqldump to
+ create a dump file and mysql to reload the file:
+shell> mysqldump db_name t1 > dump.sql
+shell> mysql db_name < dump.sql
- If you run into problems and need to file a bug report, please use
- the instructions in Section 1.6, "How to Report Bugs or Problems."
+ To recreate all the tables in a single database, specify the
+ database name without any following table name:
+shell> mysqldump db_name > dump.sql
+shell> mysql db_name < dump.sql
- The basic commands that you must execute to install and use a
- MySQL binary distribution are:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
-shell> cd /usr/local
-shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
-shell> ln -s full-path-to-mysql-VERSION-OS mysql
-shell> cd mysql
-shell> chown -R mysql .
-shell> chgrp -R mysql .
-shell> scripts/mysql_install_db --user=mysql
-shell> chown -R root .
-shell> chown -R mysql data
-shell> bin/mysqld_safe --user=mysql &
+ To recreate all tables in all databases, use the --all-databases
+ option:
+shell> mysqldump --all-databases > dump.sql
+shell> mysql < dump.sql
-Note
+ To rebuild a table with ALTER TABLE, use a "null" alteration; that
+ is, an ALTER TABLE statement that "changes" the table to use the
+ storage engine that it already has. For example, if t1 is a MyISAM
+ table, use this statement:
+mysql> ALTER TABLE t1 ENGINE = MyISAM;
- This procedure does not set up any passwords for MySQL accounts.
- After following the procedure, proceed to Section 2.11,
- "Post-Installation Setup and Testing."
+ If you are not sure which storage engine to specify in the ALTER
+ TABLE statement, use SHOW CREATE TABLE to display the table
+ definition.
- A more detailed version of the preceding description for
- installing a binary distribution follows:
+ If you must rebuild a table because a table checking operation
+ indicates that the table is corrupt or needs an upgrade, you can
+ use REPAIR TABLE if that statement supports the table's storage
+ engine. For example, to repair a MyISAM table, use this statement:
+mysql> REPAIR TABLE t1;
- 1. Add a login user and group for mysqld to run as:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
- These commands add the mysql group and the mysql user. The
- syntax for useradd and groupadd may differ slightly on
- different versions of Unix, or they may have different names
- such as adduser and addgroup.
- You might want to call the user and group something else
- instead of mysql. If so, substitute the appropriate name in
- the following steps.
+ For storage engines such as InnoDB that REPAIR TABLE does not
+ support, use mysqldump to create a dump file and mysql to reload
+ the file, as described earlier.
- 2. Pick the directory under which you want to unpack the
- distribution and change location into it. In the following
- example, we unpack the distribution under /usr/local. (The
- instructions, therefore, assume that you have permission to
- create files and directories in /usr/local. If that directory
- is protected, you must perform the installation as root.)
-shell> cd /usr/local
+ For specifics about which storage engines REPAIR TABLE supports,
+ see Section 12.5.2.6, "REPAIR TABLE Syntax."
- 3. Obtain a distribution file using the instructions in Section
- 2.1.3, "How to Get MySQL." For a given release, binary
- distributions for all platforms are built from the same MySQL
- source distribution.
+ mysqlcheck --repair provides command-line access to the REPAIR
+ TABLE statement. This can be a more convenient means of repairing
+ tables because you can use the --databases or --all-databases
+ option to repair all tables in specific databases or all
+ databases, respectively:
+shell> mysqlcheck --repair --databases db_name ...
+shell> mysqlcheck --repair --all-databases
- 4. Unpack the distribution, which creates the installation
- directory. Then create a symbolic link to that directory:
-shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
-shell> ln -s full-path-to-mysql-VERSION-OS mysql
- The tar command creates a directory named mysql-VERSION-OS.
- The ln command makes a symbolic link to that directory. This
- lets you refer more easily to the installation directory as
- /usr/local/mysql.
- With GNU tar, no separate invocation of gunzip is necessary.
- You can replace the first line with the following alternative
- command to uncompress and extract the distribution:
-shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
+2.4.5. Copying MySQL Databases to Another Machine
- 5. Change location into the installation directory:
-shell> cd mysql
- You will find several files and subdirectories in the mysql
- directory. The most important for installation purposes are
- the bin and scripts subdirectories:
+ You can copy the .frm, .MYI, and .MYD files for MyISAM tables
+ between different architectures that support the same
+ floating-point format. (MySQL takes care of any byte-swapping
+ issues.) See Section 13.5, "The MyISAM Storage Engine."
- + The bin directory contains client programs and the
- server. You should add the full path name of this
- directory to your PATH environment variable so that your
- shell finds the MySQL programs properly. See Section
- 2.14, "Environment Variables."
+ In cases where you need to transfer databases between different
+ architectures, you can use mysqldump to create a file containing
+ SQL statements. You can then transfer the file to the other
+ machine and feed it as input to the mysql client.
- + The scripts directory contains the mysql_install_db
- script used to initialize the mysql database containing
- the grant tables that store the server access
- permissions.
+ Use mysqldump --help to see what options are available.
- 6. Ensure that the distribution contents are accessible to mysql.
- If you unpacked the distribution as mysql, no further action
- is required. If you unpacked the distribution as root, its
- contents will be owned by root. Change its ownership to mysql
- by executing the following commands as root in the
- installation directory:
-shell> chown -R mysql .
-shell> chgrp -R mysql .
- The first command changes the owner attribute of the files to
- the mysql user. The second changes the group attribute to the
- mysql group.
+ The easiest (although not the fastest) way to move a database
+ between two machines is to run the following commands on the
+ machine on which the database is located:
+shell> mysqladmin -h 'other_hostname' create db_name
+shell> mysqldump db_name | mysql -h 'other_hostname' db_name
- 7. If you have not installed MySQL before, you must create the
- MySQL data directory and initialize the grant tables:
-shell> scripts/mysql_install_db --user=mysql
- If you run the command as root, include the --user option as
- shown. If you run the command while logged in as that user,
- you can omit the --user option.
- The command should create the data directory and its contents
- with mysql as the owner.
- After creating or updating the grant tables, you need to
- restart the server manually.
+ If you want to copy a database from a remote machine over a slow
+ network, you can use these commands:
+shell> mysqladmin create db_name
+shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na
+me
- 8. Most of the MySQL installation can be owned by root if you
- like. The exception is that the data directory must be owned
- by mysql. To accomplish this, run the following commands as
- root in the installation directory:
-shell> chown -R root .
-shell> chown -R mysql data
+ You can also store the dump in a file, transfer the file to the
+ target machine, and then load the file into the database there.
+ For example, you can dump a database to a compressed file on the
+ source machine like this:
+shell> mysqldump --quick db_name | gzip > db_name.gz
- 9. If you want MySQL to start automatically when you boot your
- machine, you can copy support-files/mysql.server to the
- location where your system has its startup files. More
- information can be found in the support-files/mysql.server
- script itself and in Section 2.11.2.2, "Starting and Stopping
- MySQL Automatically."
- 10. You can set up new accounts using the bin/mysql_setpermission
- script if you install the DBI and DBD::mysql Perl modules. See
- Section 4.6.14, "mysql_setpermission --- Interactively Set
- Permissions in Grant Tables." For Perl module installation
- instructions, see Section 2.15, "Perl Installation Notes."
- 11. If you would like to use mysqlaccess and have the MySQL
- distribution in some nonstandard location, you must change the
- location where mysqlaccess expects to find the mysql client.
- Edit the bin/mysqlaccess script at approximately line 18.
- Search for a line that looks like this:
-$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable
- Change the path to reflect the location where mysql actually
- is stored on your system. If you do not do this, a Broken pipe
- error will occur when you run mysqlaccess.
+ Transfer the file containing the database contents to the target
+ machine and run these commands there:
+shell> mysqladmin create db_name
+shell> gunzip < db_name.gz | mysql db_name
- After everything has been unpacked and installed, you should test
- your distribution. To start the MySQL server, use the following
- command:
-shell> bin/mysqld_safe --user=mysql &
+ You can also use mysqldump and mysqlimport to transfer the
+ database. For large tables, this is much faster than simply using
+ mysqldump. In the following commands, DUMPDIR represents the full
+ path name of the directory you use to store the output from
+ mysqldump.
- If you run the command as root, you must use the --user option as
- shown. The value of the option is the name of the login account
- that you created in the first step to use for running the server.
- If you run the command while logged in as mysql, you can omit the
- --user option.
+ First, create the directory for the output files and dump the
+ database:
+shell> mkdir DUMPDIR
+shell> mysqldump --tab=DUMPDIR db_name
- If the command fails immediately and prints mysqld ended, you can
- find some information in the host_name.err file in the data
- directory.
+ Then transfer the files in the DUMPDIR directory to some
+ corresponding directory on the target machine and load the files
+ into MySQL there:
+shell> mysqladmin create db_name # create database
+shell> cat DUMPDIR/*.sql | mysql db_name # create tables in databas
+e
+shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables
- More information about mysqld_safe is given in Section 4.3.2,
- "mysqld_safe --- MySQL Server Startup Script."
+ Do not forget to copy the mysql database because that is where the
+ grant tables are stored. You might have to run commands as the
+ MySQL root user on the new machine until you have the mysql
+ database in place.
-Note
+ After you import the mysql database on the new machine, execute
+ mysqladmin flush-privileges so that the server reloads the grant
+ table information.
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+2.5. Installing MySQL on Windows
-2.10. MySQL Installation Using a Source Distribution
+ This section describes the process for installing MySQL on
+ Windows.
- Before you proceed with an installation from source, first check
- whether our binary is available for your platform and whether it
- works for you. We put a great deal of effort into ensuring that
- our binaries are built with the best possible options.
+ To run MySQL on Windows, you need the following:
- To obtain a source distribution for MySQL, Section 2.1.3, "How to
- Get MySQL." If you want to build MySQL from source on Windows, see
- Section 2.10.6, "Installing MySQL from Source on Windows."
+ * A Windows operating system such as Windows 2000, Windows XP,
+ Windows Vista, Windows Server 2003, or Windows Server 2008.
+ Both 32-bit and 64-bit versions are supported.
+ In addition to running MySQL as a standard application, you
+ can also run the MySQL server as a Windows service. By using a
+ service you can monitor and control the operation of the
+ server through the standard Windows service management tools.
+ For more information, see Section 2.5.5.6, "Starting MySQL as
+ a Windows Service."
+ Generally, you should install MySQL on Windows using an
+ account that has administrator rights. Otherwise, you may
+ encounter problems with certain operations such as editing the
+ PATH environment variable or accessing the Service Control
+ Manager. Once installed, MySQL does not need to be executed
+ using a user with Administrator privileges.
- MySQL source distributions are provided as compressed tar archives
- and have names of the form mysql-VERSION.tar.gz, where VERSION is
- a number like 5.1.39.
+ * TCP/IP protocol support.
- You need the following tools to build and install MySQL from
- source:
+ * Enough space on the hard drive to unpack, install, and create
+ the databases in accordance with your requirements (generally
+ a minimum of 200 megabytes is recommended.)
- * GNU gunzip to uncompress the distribution.
+ For a list of limitations within the Windows version of MySQL, see
+ Section D.7.3, "Windows Platform Limitations."
- * A reasonable tar to unpack the distribution. GNU tar is known
- to work. Some operating systems come with a preinstalled
- version of tar that is known to have problems. For example,
- the tar provided with early versions of Mac OS X, SunOS 4.x
- and Solaris 8 and earlier are known to have problems with long
- file names. On Mac OS X, you can use the preinstalled gnutar
- program. On other systems with a deficient tar, you should
- install GNU tar first.
+ In addition to the MySQL Server package, you may need or want
+ additional components to use MySQL with your application or
+ development environment. These include, but are not limited to:
- * A working ANSI C++ compiler. gcc 2.95.2 or later, SGI C++, and
- SunPro C++ are some of the compilers that are known to work.
- libg++ is not needed when using gcc. gcc 2.7.x has a bug that
- makes it impossible to compile some perfectly legal C++ files,
- such as sql/sql_base.cc. If you have only gcc 2.7.x, you must
- upgrade your gcc to be able to compile MySQL. gcc 2.8.1 is
- also known to have problems on some platforms, so it should be
- avoided if a newer compiler exists for the platform. gcc
- 2.95.2 or later is recommended.
+ * If you plan to connect to the MySQL server via ODBC, you need
+ a Connector/ODBC driver. For more information, including
+ installation and configuration instructions, see Section 21.1,
+ "MySQL Connector/ODBC."
+
+ * If you plan to use MySQL server with .NET applications, you
+ need the Connector/NET driver. For more information, including
+ installation and configuration instructions, see Section 21.2,
+ "MySQL Connector/NET."
- * A good make program. GNU make is always recommended and is
- sometimes required. (BSD make fails, and vendor-provided make
- implementations may fail as well.) If you have problems, use
- GNU make 3.75 or newer.
+ MySQL distributions for Windows can be downloaded from
+ http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
+ MySQL."
- * libtool 1.5.24 or later is also recommended.
+ MySQL for Windows is available in several distribution formats,
+ detailed below. Generally speaking, you should use a binary
+ distribution that includes an installer. It is simpler to use than
+ the others, and you need no additional tools to get MySQL up and
+ running. The installer for the Windows version of MySQL, combined
+ with a GUI Config Wizard, automatically installs MySQL, creates an
+ option file, starts the server, and secures the default user
+ accounts.
- If you are using a version of gcc recent enough to understand the
- -fno-exceptions option, it is very important that you use this
- option. Otherwise, you may compile a binary that crashes randomly.
- Also use -felide-constructors and -fno-rtti along with
- -fno-exceptions. When in doubt, do the following:
-CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
- -fno-exceptions -fno-rtti" ./configure \
- --prefix=/usr/local/mysql --enable-assembler \
- --with-mysqld-ldflags=-all-static
+ * Binary installer distribution. The installable distribution
+ comes packaged as a Microsoft Windows Installer (MSI) package
+ that you can install manually or automatically on your
+ systems. Two formats are available, an essentials package that
+ contains all the files you need to install and configure
+ MySQL, but no additional components, and a complete package
+ that includes MySQL, configuration tools, benchmarks and other
+ components. For more information on the specific differences,
+ see Section 2.5.2, "Choosing An Installation Package"
+ For instructions on installing MySQL using one of the MSI
+ installation packages, see Section 2.5.3, "Installing MySQL
+ with the MSI Package."
+
+ * Standard binary distribution format packaged as a Zip file
+ containing all of the necessary files that you unpack into
+ your chosen location. This package contains all of the files
+ in the full Windows MSI Installer package, but does not
+ including an installation program.
+ For instructions on installing MySQL using the Zip file, see
+ Section 2.5.5, "Installing MySQL from a noinstall Zip
+ Archive."
- On most systems, this gives you a fast and stable binary.
+ * The source distribution contains all the code and support
+ files for building the executables using the Visual Studio
+ compiler system.
+ For instructions on building MySQL from source on Windows, see
+ Section 2.5.10, "Installing MySQL from Source on Windows."
- If you run into problems and need to file a bug report, please use
- the instructions in Section 1.6, "How to Report Bugs or Problems."
+ MySQL on Windows considerations:
-2.10.1. Source Installation Overview
+ * Large Table Support
+ If you need tables with a size larger than 4GB, install MySQL
+ on an NTFS or newer file system. Don't forget to use MAX_ROWS
+ and AVG_ROW_LENGTH when you create tables. See Section
+ 12.1.17, "CREATE TABLE Syntax."
- The basic commands that you must execute to install a MySQL source
- distribution are:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
-shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
-shell> cd mysql-VERSION
-shell> ./configure --prefix=/usr/local/mysql
-shell> make
-shell> make install
-shell> cp support-files/my-medium.cnf /etc/my.cnf
-shell> cd /usr/local/mysql
-shell> chown -R mysql .
-shell> chgrp -R mysql .
-shell> bin/mysql_install_db --user=mysql
-shell> chown -R root .
-shell> chown -R mysql var
-shell> bin/mysqld_safe --user=mysql &
+ * MySQL and Virus Checking Software
+ Using virus scanning software such as Norton/Symantec
+ Anti-Virus on directories containing MySQL data and temporary
+ tables can cause issues, both in terms of the performance of
+ MySQL and the virus-scanning software mis-identifying the
+ contents of the files as containing spam. This is because of
+ the fingerprinting mechanism used by the virus scanning
+ software, and the way in which MySQL rapidly updates different
+ files, which may be identified as a potential security risk.
+ After installing MySQL Server, it is recommended that you
+ disable virus scanning on the main directory (datadir) being
+ used to store your MySQL table data. There is usually a system
+ built into the virus scanning software to allow certain
+ directories to be specifically ignored during virus scanning.
+ In addition, by default, MySQL creates temporary files in the
+ standard Windows temporary directory. To prevent the temporary
+ files also being scanned, you should configure a separate
+ temporary directory for MySQL temporary files and add this to
+ the virus scanning exclusion list. To do this, add a
+ configuration option for the tmpdir parameter to your my.ini
+ configuration file. For more information, see Section 2.5.5.2,
+ "Creating an Option File."
- If you start from a source RPM, do the following:
-shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
+2.5.1. Windows Installation Layout
- This makes a binary RPM that you can install. For older versions
- of RPM, you may have to replace the command rpmbuild with rpm
- instead.
+ For MySQL 5.1 on Windows, the default installation directory is
+ C:\Program Files\MySQL\MySQL Server 5.1. Some Windows users prefer
+ to install in C:\mysql, the directory that formerly was used as
+ the default. However, the layout of the subdirectories remains the
+ same.
+
+ For MySQL 5.1.23 and earlier, all of the files are located within
+ this parent directory, using the following structure:
+
+ Table 2.2. Installation Layout for Windows using MySQL 5.1.23 and
+ earlier
+ Directory Contents of Directory
+ bin Client programs and the mysqld server
+ data Log files, databases
+ Docs Manual in CHM format
+ examples Example programs and scripts
+ include Include (header) files
+ lib Libraries
+ scripts Utility scripts
+ share Error message files
-Note
+ For MySQL 5.1.24 and later, the default location of data directory
+ was changed. The remainder of the directory structure remains the
+ same:
- This procedure does not set up any passwords for MySQL accounts.
- After following the procedure, proceed to Section 2.11,
- "Post-Installation Setup and Testing," for post-installation setup
- and testing.
+ Table 2.3. Installation Layout for Windows using MySQL 5.1.24 and
+ later
+ Directory Contents of Directory
+ bin Client programs and the mysqld server
+ C:\Documents and Settings\All Users\Application Data\MySQL Log
+ files, databases
+ Docs Manual in CHM format
+ examples Example programs and scripts
+ include Include (header) files
+ lib Libraries
+ scripts Utility scripts
+ share Error message files
- A more detailed version of the preceding description for
- installing MySQL from a source distribution follows:
+2.5.2. Choosing An Installation Package
- 1. Add a login user and group for mysqld to run as:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
- These commands add the mysql group and the mysql user. The
- syntax for useradd and groupadd may differ slightly on
- different versions of Unix, or they may have different names
- such as adduser and addgroup.
- You might want to call the user and group something else
- instead of mysql. If so, substitute the appropriate name in
- the following steps.
+ For MySQL 5.1, there are three installation packages to choose
+ from when installing MySQL on Windows:
+ Packaging
+ Feature Essentials Complete Zip (No-install)
+ Installer Yes Yes No
+ Directory-only
+ MySQL Server Instance Config Wizard Yes Yes No
+ Test Suite No Yes Yes
+ MySQL Server Yes Yes Yes
+ MySQL Client Programs Yes Yes Yes
+ C Headers/Libraries Yes Yes Yes
+ Embedded Server No Optional Yes
+ Scripts and Examples No Optional Yes
+
+ In the above table:
+
+ * Yes indiciates that the component is installed by default.
+
+ * No indicates that the component is not installed or included.
+
+ * Optional indicates that the component is included with the
+ package, but not installed unless explicitly requested using
+ the Custom installation mode.
+
+ The workflow for installing using the MSI installer is shown
+ below:
- 2. Perform the following steps as the mysql user, except as
- noted.
+ Figure 2.1. Installation Workflow for Windows using MSI
+ Installation Workflow for Windows using MSI
- 3. Pick the directory under which you want to unpack the
- distribution and change location into it.
+ The workflow for installing using the MSI installer is shown
+ below:
- 4. Obtain a distribution file using the instructions in Section
- 2.1.3, "How to Get MySQL."
+ Figure 2.2. Installation Workflow for Windows using Zip
+ Installation Workflow for Windows using Zip
- 5. Unpack the distribution into the current directory:
-shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
- This command creates a directory named mysql-VERSION.
- With GNU tar, no separate invocation of gunzip is necessary.
- You can use the following alternative command to uncompress
- and extract the distribution:
-shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
+Note
- 6. Change location into the top-level directory of the unpacked
- distribution:
-shell> cd mysql-VERSION
- Note that currently you must configure and build MySQL from
- this top-level directory. You cannot build it in a different
- directory.
+ For the Essentials and Complete packages in the MSI installer, you
+ can select individual components to be installed by using the
+ Custom mode, including disable the components confiurated for
+ installation by default.
+
+ Full details on the components are suggested uses are provided
+ below for reference:
+
+ * Windows Essentials --- this package has a file name similar to
+ mysql-essential-5.1.41-win32.msi and is supplied as a
+ Microsoft Installer (MSI) package. The package includes the
+ minimum set of files needed to install MySQL on Windows,
+ including the MySQL Server Instance Config Wizard. This
+ package does not include optional components such as the
+ embedded server, developer headers and libraries or benchmark
+ suite.
+ To install using this package, see Section 2.5.3, "Installing
+ MySQL with the MSI Package."
+
+ * Windows MSI Installer (Complete) --- this package has a file
+ name similar to mysql-5.1.41-win32.zip and contains all files
+ needed for a complete Windows installation, including the
+ MySQL Server Instance Config Wizard. This package includes
+ optional components such as the embedded server and benchmark
+ suite.
+ To install using this package, see Section 2.5.3, "Installing
+ MySQL with the MSI Package."
- 7. Configure the release and compile everything:
-shell> ./configure --prefix=/usr/local/mysql
-shell> make
- When you run configure, you might want to specify other
- options. Run ./configure --help for a list of options. Section
- 2.10.2, "Typical configure Options," discusses some of the
- more useful options.
- If configure fails and you are going to send mail to a MySQL
- mailing list to ask for assistance, please include any lines
- from config.log that you think can help solve the problem.
- Also include the last couple of lines of output from
- configure. To file a bug report, please use the instructions
- in Section 1.6, "How to Report Bugs or Problems."
- If the compile fails, see Section 2.10.4, "Dealing with
- Problems Compiling MySQL," for help.
+ * Without installer --- this package has a file name similar to
+ mysql-noinstall-5.1.41-win32.zip and contains all the files
+ found in the Complete install package, with the exception of
+ the MySQL Server Instance Config Wizard. This package does not
+ include an automated installer, and must be manually installed
+ and configured.
+
+ The Essentials package is recommended for most users. Both the
+ Essentials and Complete distributions are available as an .msi
+ file for use with the Windows Installer. The Noinstall
+ distribution is packaged as Zip archives. To use Zip archives, you
+ must have a tool that can unpack .zip files.
+
+ When using the MSI installers you can automate the installation
+ process. For more information, see Section 2.5.3.2, "Installing
+ MySQL Automatically using MSI." To automate the creation of a
+ MySQL instance, see Section 2.5.4.13, "Creating an Instance from
+ the Command Line."
- 8. Install the distribution:
-shell> make install
- You might need to run this command as root.
- If you want to set up an option file, use one of those present
- in the support-files directory as a template. For example:
-shell> cp support-files/my-medium.cnf /etc/my.cnf
- You might need to run this command as root.
- If you want to configure support for InnoDB tables, you should
- edit the /etc/my.cnf file, remove the # character before the
- option lines that start with innodb_..., and modify the option
- values to be what you want. See Section 4.2.3.3, "Using Option
- Files," and Section 13.6.2, "InnoDB Configuration."
+ Your choice of install package affects the installation process
+ you must follow. If you choose to install either the Essentials or
+ Complete install packages, see Section 2.5.3, "Installing MySQL
+ with the MSI Package." If you choose to install MySQL from the
+ Noinstall archive, see Section 2.5.5, "Installing MySQL from a
+ noinstall Zip Archive."
- 9. Change location into the installation directory:
-shell> cd /usr/local/mysql
- 10. If you ran the make install command as root, the installed
- files will be owned by root. Ensure that the installation is
- accessible to mysql by executing the following commands as
- root in the installation directory:
-shell> chown -R mysql .
-shell> chgrp -R mysql .
- The first command changes the owner attribute of the files to
- the mysql user. The second changes the group attribute to the
- mysql group.
- 11. If you have not installed MySQL before, you must create the
- MySQL data directory and initialize the grant tables:
-shell> bin/mysql_install_db --user=mysql
- If you run the command as root, include the --user option as
- shown. If you run the command while logged in as mysql, you
- can omit the --user option.
- The command should create the data directory and its contents
- with mysql as the owner.
- After using mysql_install_db to create the grant tables for
- MySQL, you must restart the server manually. The mysqld_safe
- command to do this is shown in a later step.
- 12. Most of the MySQL installation can be owned by root if you
- like. The exception is that the data directory must be owned
- by mysql. To accomplish this, run the following commands as
- root in the installation directory:
-shell> chown -R root .
-shell> chown -R mysql var
- 13. If you want MySQL to start automatically when you boot your
- machine, you can copy support-files/mysql.server to the
- location where your system has its startup files. More
- information can be found in the support-files/mysql.server
- script itself; see also Section 2.11.2.2, "Starting and
- Stopping MySQL Automatically."
- 14. You can set up new accounts using the bin/mysql_setpermission
- script if you install the DBI and DBD::mysql Perl modules. See
- Section 4.6.14, "mysql_setpermission --- Interactively Set
- Permissions in Grant Tables." For Perl module installation
- instructions, see Section 2.15, "Perl Installation Notes."
+2.5.3. Installing MySQL with the MSI Package
+
+ The MSI package are designed to install and configure MySQL in
+ such a way that you can immediately get started using MySQL.
+
+ The MySQL Installation Wizard and MySQL Config Wizard are
+ available in the Essentials and Complete install packages. They
+ are recommended for most standard MySQL installations. Exceptions
+ include users who need to install multiple instances of MySQL on a
+ single server host and advanced users who want complete control of
+ server configuration.
- After everything has been installed, you should test your
- distribution. To start the MySQL server, use the following
- command:
-shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
+ * For information on installing using the GUI MSI installer
+ process, see Section 2.5.3, "Installing MySQL with the MSI
+ Package."
- If you run the command as root, you should use the --user option
- as shown. The value of the option is the name of the login account
- that you created in the first step to use for running the server.
- If you run the command while logged in as that user, you can omit
- the --user option.
+ * For information on installing using the command line using the
+ MSI package, see Section 2.5.3.2, "Installing MySQL
+ Automatically using MSI."
+
+ * If you have previously installed MySQL using the MSI package
+ and want to remove MySQL, see Section 2.5.3.3, "Removing MySQL
+ Installed from the MSI Package."
- If the command fails immediately and prints mysqld ended, you can
- find some information in the host_name.err file in the data
- directory.
+ The workflow sequence for using the installer is shown in the
+ figure below:
- More information about mysqld_safe is given in Section 4.3.2,
- "mysqld_safe --- MySQL Server Startup Script."
+ Figure 2.3. Installation Workflow for Windows using MSI Installer
+ Installation Workflow for Windows using MSI Installer
Note
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ Microsoft Windows XP and later include a firewall which
+ specifically blocks ports. If you plan on using MySQL through a
+ network port then you should open and create an exception for this
+ port before performing the installation. To check and if necessary
+ add an exception to the firewall settings:
-2.10.2. Typical configure Options
+ 1. First ensure that you are logged in as an Administrator or a
+ user with Administrator privileges.
- The configure script gives you a great deal of control over how
- you configure a MySQL source distribution. Typically you do this
- using options on the configure command line. You can also affect
- configure using certain environment variables. See Section 2.14,
- "Environment Variables." For a full list of options supported by
- configure, run this command:
-shell> ./configure --help
+ 2. Go to the Control Panel, and double click the Windows Firewall
+ icon.
- A list of the available configure options is provided in the table
- below.
+ 3. Choose the Allow a program through Windows Firewall option and
+ click the Add port button.
- Table 2.1. Build (configure) Reference
- Formats Description Default Introduced Removed
- --bindir=DIR User executables EPREFIX/bin
- --build=BUILD Configure for building on BUILD guessed
- --cache-file=FILE Cache test results in FILE disabled
- -C Alias for `--cache-file=config.cache'
- --config-cache
- --datadir=DIR Read-only architecture-independent data PREFIX/share
+ 4. Enter MySQL into the Name text box and 3306 (or the port of
+ your choice) into the Port number text box.
- --disable-FEATURE Do not include FEATURE
- --disable-dependency-tracking Disable dependency tracking
- --disable-grant-options Disable GRANT options
- --disable-largefile Omit support for large files
- --disable-libtool-lock Disable libtool lock
- --disable-thread-safe-client Compile the client without threads
- 5.1.7
- --enable-FEATURE Enable FEATURE
- --enable-assembler Use assembler versions of some string functions
- if available
- --enable-dependency-tracking Do not reject slow dependency
- extractors
- --enable-fast-install Optimize for fast installation yes
- --enable-local-infile Enable LOAD DATA LOCAL INFILE disabled
- --enable-shared Build shared libraries yes
- --enable-static Build static libraries yes
- --enable-thread-safe-client Compile the client with threads
- --exec-prefix=EPREFIX Install architecture-dependent files in
- EPREFIX
- -h Display this help and exit
- --help
- --help=short Display options specific to this package
- --help=recursive Display the short help of all the included
- packages
- --host=HOST Cross-compile to build programs to run on HOST
- --includedir=DIR C header files PREFIX/include
- --infodir=DIR Info documentation PREFIX/info
- --libdir=DIR Object code libraries EPREFIX/lib
- --libexecdir=DIR Program executables EPREFIX/libexec
- --localstatedir=DIR Modifiable single-machine data PREFIX/var
- --mandir=DIR man documentation PREFIX/man
- -n Do not create output files
- --no-create
- --oldincludedir=DIR C header files for non-gcc /usr/include
- --prefix=PREFIX Install architecture-independent files in PREFIX
+ 5. Also ensure that the TCP protocol radio button is selected.
- --program-prefix=PREFIX Prepend PREFIX to installed program names
+ 6. If you wish, you can also limit access to the MySQL server by
+ choosing the Change scope button.
- --program-suffix=SUFFIX Append SUFFIX to installed program names
+ 7. Confirm your choices by clicking the OK button.
- --program-transform-name=PROGRAM run sed PROGRAM on installed
- program names
- -q Do not print `checking...' messages
- --quiet
- --sbindir=DIR System admin executables EPREFIX/sbin
- --sharedstatedir=DIR Modifiable architecture-independent data
- PREFIX/com
- --srcdir=DIR Find the sources in DIR configure directory or ..
- --sysconfdir=DIR Read-only single-machine data PREFIX/etc
- --target=TARGET Configure for building compilers for TARGET
- -V Display version information and exit
- --version
- --with-PACKAGE Use PACKAGE
- --with-archive-storage-engine Enable the Archive Storage Engine no
+ Additionally, when running the MySQL Installation Wizard on
+ Windows Vista, ensure that you are logged in as a user with
+ administrative rights.
- --with-atomic-ops Implement atomic operations using pthread
- rwlocks or atomic CPU instructions for multi-processor 5.1.12
- --with-berkeley-db Use BerkeleyDB located in DIR no
- --with-berkeley-db-includes Find Berkeley DB headers in DIR
- --with-berkeley-db-libs Find Berkeley DB libraries in DIR
- --with-big-tables Support tables with more than 4 G rows even on
- 32 bit platforms
- --with-blackhole-storage-engine Enable the Blackhole Storage
- Engine no
- --with-charset Default character set
- --with-client-ldflags Extra linking arguments for clients
- --with-collation Default collation
- --with-comment Comment about compilation environment
- --with-csv-storage-engine Enable the CSV Storage Engine yes
- --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS
- X/Darwin
- --with-debug Add debug code 5.1.7
- --with-debug=full Add debug code (adds memory checker, very slow)
+Note
- --with-embedded-privilege-control Build parts to check user's
- privileges (only affects embedded library)
- --with-embedded-server Build the embedded server
- --with-error-inject Enable error injection in MySQL Server
- 5.1.11
- --with-example-storage-engine Enable the Example Storage Engine no
+ When using Windows Vista, you may want to disable User Account
+ Control (UAC) before performing the installation. If you do not do
+ so, then MySQL may be identified as a security risk, which will
+ mean that you need to enable MySQL. You can disable the security
+ checking by following these instructions:
- --with-extra-charsets Use charsets in addition to default
- --with-fast-mutexes Compile with fast mutexes enabled 5.1.5
- --with-federated-storage-engine Enable federated storage engine no
- 5.1.3 5.1.9
- --with-gnu-ld Assume the C compiler uses GNU ld no
- --with-innodb Enable innobase storage engine no 5.1.3 5.1.9
- --with-lib-ccflags Extra CC options for libraries
- --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
- --with-low-memory Try to use less memory to compile to avoid
- memory limitations
- --with-machine-type Set the machine type, like "powerpc"
- --with-max-indexes=N Sets the maximum number of indexes per table
- 64
- --with-mysqld-ldflags Extra linking arguments for mysqld
- --with-mysqld-libs Extra libraries to link with for mysqld
- --with-mysqld-user What user the mysqld daemon shall be run as
+ 1. Open Control Panel.
- --with-mysqlmanager Build the mysqlmanager binary Build if server
- is built
- --with-named-curses-libs Use specified curses libraries
- --with-named-thread-libs Use specified thread libraries
- --with-ndb-ccflags Extra CC options for ndb compile
- --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi
- documentation
- --with-ndb-port Port for NDB Cluster management server
- --with-ndb-port-base Port for NDB Cluster management server
- --with-ndb-sci=DIR Provide MySQL with a custom location of sci
- library
- --with-ndb-test Include the NDB Cluster ndbapi test programs
- --with-ndbcluster Include the NDB Cluster table handler no
- --with-openssl=DIR Include the OpenSSL support
- --with-openssl-includes Find OpenSSL headers in DIR
- --with-openssl-libs Find OpenSSL libraries in DIR
- --with-other-libc=DIR Link against libc and other standard
- libraries installed in the specified nonstandard location
- --with-pic Try to use only PIC/non-PIC objects Use both
- --with-plugin-PLUGIN Forces the named plugin to be linked into
- mysqld statically 5.1.11
- --with-plugins Plugins to include in mysqld none 5.1.11
- --with-pstack Use the pstack backtrace library
- --with-pthread Force use of pthread library
- --with-row-based-replication Include row-based replication 5.1.5
- 5.1.6
- --with-server-suffix Append value to the version string
- --with-ssl=DIR Include SSL support 5.1.11
- --with-system-type Set the system type, like "sun-solaris10"
- --with-tags Include additional configurations automatic
- --with-tcp-port Which port to use for MySQL services 3306
- --with-unix-socket-path Where to put the unix-domain socket
- --with-yassl Include the yaSSL support
- --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom
- location of compression library
- --without-PACKAGE Do not use PACKAGE
- --without-bench Skip building of the benchmark suite
- --without-debug Build a production version without debugging code
+ 2. Under the User Accounts and Family Safety, select Add or
+ remove user accounts.
- --without-docs Skip building of the documentation
- --without-extra-tools Skip building utilities in the tools
- directory
- --without-geometry Do not build geometry-related parts
- --without-libedit Use system libedit instead of bundled copy
- --without-man Skip building of the man pages
- --without-ndb-binlog Disable ndb binlog 5.1.6
- --without-ndb-debug Disable special ndb debug features
- --without-plugin-PLUGIN Exclude PLUGIN 5.1.11
- --without-query-cache Do not build query cache
- --without-readline Use system readline instead of bundled copy
+ 3. Click on the Got to the main User Accounts page link.
- --without-row-based-replication Don't include row-based
- replication 5.1.7 5.1.14
- --without-server Only build the client
- --without-uca Skip building of the national Unicode collations
+ 4. Click on Turn User Account Control on or off. You may be
+ prompted to provide permission to change this setting. Click
+ Continue.
- Some of the configure options available are described here. For
- options that may be of use if you have difficulties building
- MySQL, see Section 2.10.4, "Dealing with Problems Compiling
- MySQL."
+ 5. Deselect or unceck the checkbox next to Use User Account
+ Control (UAC) to help protect your computer. Click OK to save
+ the setting.
- * To compile just the MySQL client libraries and client programs
- and not the server, use the --without-server option:
-shell> ./configure --without-server
- If you have no C++ compiler, some client programs such as
- mysql cannot be compiled because they require C++.. In this
- case, you can remove the code in configure that tests for the
- C++ compiler and then run ./configure with the
- --without-server option. The compile step should still try to
- build all clients, but you can ignore any warnings about files
- such as mysql.cc. (If make stops, try make -k to tell it to
- continue with the rest of the build even if errors occur.)
+ You will need to restart to complete the process. Click Restart
+ Now to reboot the machine and apply the changes. You can then
+ follow the instructions below for installing Windows.
- * If you want to build the embedded MySQL library (libmysqld.a),
- use the --with-embedded-server option.
+2.5.3.1. Using the MySQL Installation Wizard
- * If you don't want your log files and database directories
- located under /usr/local/var, use a configure command
- something like one of these:
-shell> ./configure --prefix=/usr/local/mysql
-shell> ./configure --prefix=/usr/local \
- --localstatedir=/usr/local/mysql/data
- The first command changes the installation prefix so that
- everything is installed under /usr/local/mysql rather than the
- default of /usr/local. The second command preserves the
- default installation prefix, but overrides the default
- location for database directories (normally /usr/local/var)
- and changes it to /usr/local/mysql/data.
- You can also specify the installation directory and data
- directory locations at server startup time by using the
- --basedir and --datadir options. These can be given on the
- command line or in an MySQL option file, although it is more
- common to use an option file. See Section 4.2.3.3, "Using
- Option Files."
+ MySQL Installation Wizard is an installer for the MySQL server
+ that uses the latest installer technologies for Microsoft Windows.
+ The MySQL Installation Wizard, in combination with the MySQL
+ Config Wizard, allows a user to install and configure a MySQL
+ server that is ready for use immediately after installation.
- * If you are using Unix and you want the MySQL socket file
- location to be somewhere other than the default location
- (normally in the directory /tmp or /var/run), use a configure
- command like this:
-shell> ./configure \
- --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
- The socket file name must be an absolute path name. You can
- also change the location of mysql.sock at server startup by
- using a MySQL option file. See Section B.1.4.5, "How to
- Protect or Change the MySQL Unix Socket File."
+ The MySQL Installation Wizard uses the standard Microsoft
+ Installer Engine (MSI) system is the standard installer for all
+ MySQL server distributions, version 4.1.5 and higher. Users of
+ previous versions of MySQL need to shut down and remove their
+ existing MySQL installations manually before installing MySQL with
+ the MySQL Installation Wizard. See Section 2.5.3.1.6, "Upgrading
+ MySQL with the Installation Wizard," for more information on
+ upgrading from a previous version.
- * If you want to compile statically linked programs (for
- example, to make a binary distribution, to get better
- performance, or to work around problems with some Red Hat
- Linux distributions), run configure like this:
-shell> ./configure --with-client-ldflags=-all-static \
- --with-mysqld-ldflags=-all-static
+ If you are upgrading an installation from MySQL 5.1.31 or earlier
+ to MySQL 5.1.32 or later, read the notes provided in Section
+ 2.5.3.1.6, "Upgrading MySQL with the Installation Wizard."
- * If you are using gcc and don't have libg++ or libstdc++
- installed, you can tell configure to use gcc as your C++
- compiler:
-shell> CC=gcc CXX=gcc ./configure
- When you use gcc as your C++ compiler, it does not attempt to
- link in libg++ or libstdc++. This may be a good thing to do
- even if you have those libraries installed. Some versions of
- them have caused strange problems for MySQL users in the past.
- The following list indicates some compilers and environment
- variable settings that are commonly used with each one.
+ The Microsoft Windows Installer Engine was updated with the
+ release of Windows XP; those using a previous version of Windows
+ can reference this Microsoft Knowledge Base article
+ (http://support.microsoft.com/default.aspx?scid=kb;EN-US;292539)
+ for information on upgrading to the latest version of the Windows
+ Installer Engine.
- + gcc 2.7.2:
-CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
+ In addition, Microsoft has introduced the WiX (Windows Installer
+ XML) toolkit. This is the first highly acknowledged Open Source
+ project from Microsoft. We have switched to WiX because it is an
+ Open Source project and it allows us to handle the complete
+ Windows installation process in a flexible manner using scripts.
- + gcc 2.95.2:
-CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
--felide-constructors -fno-exceptions -fno-rtti"
+ Improving the MySQL Installation Wizard depends on the support and
+ feedback of users like you. If you find that the MySQL
+ Installation Wizard is lacking some feature important to you, or
+ if you discover a bug, please report it in our bugs database using
+ the instructions given in Section 1.6, "How to Report Bugs or
+ Problems."
- + pgcc 2.90.29 or newer:
-CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
-CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
--felide-constructors -fno-exceptions -fno-rtti"
- In most cases, you can get a reasonably optimized MySQL binary
- by using the options from the preceding list and adding the
- following options to the configure line:
---prefix=/usr/local/mysql --enable-assembler \
---with-mysqld-ldflags=-all-static
- The full configure line would, in other words, be something
- like the following for all recent gcc versions:
-CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
--felide-constructors -fno-exceptions -fno-rtti" ./configure \
---prefix=/usr/local/mysql --enable-assembler \
---with-mysqld-ldflags=-all-static
- The binaries we provide on the MySQL Web site at
- http://dev.mysql.com/downloads/ are all compiled with full
- optimization and should be perfect for most users. See Section
- 2.1.2.4, "MySQL Binaries Compiled by Sun Microsystems, Inc.."
- There are some configuration settings you can tweak to build
- an even faster binary, but these are only for advanced users.
- See Section 7.5.1, "How Compiling and Linking Affects the
- Speed of MySQL."
- If the build fails and produces errors about your compiler or
- linker not being able to create the shared library
- libmysqlclient.so.N (where N is a version number), you can
- work around this problem by giving the --disable-shared option
- to configure. In this case, configure does not build a shared
- libmysqlclient.so.N library.
+2.5.3.1.1. Downloading and Starting the MySQL Installation Wizard
- * By default, MySQL uses the latin1 (cp1252 West European)
- character set. To change the default set, use the
- --with-charset option:
-shell> ./configure --with-charset=CHARSET
- CHARSET may be one of binary, armscii8, ascii, big5, cp1250,
- cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8,
- eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8,
- keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce,
- macroman, sjis, swe7, tis620, ucs2, ujis, utf8. See Section
- 9.2, "The Character Set Used for Data and Sorting."
- (Additional character sets might be available. Check the
- output from ./configure --help for the current list.)
- The default collation may also be specified. MySQL uses the
- latin1_swedish_ci collation by default. To change this, use
- the --with-collation option:
-shell> ./configure --with-collation=COLLATION
- To change both the character set and the collation, use both
- the --with-charset and --with-collation options. The collation
- must be a legal collation for the character set. (Use the SHOW
- COLLATION statement to determine which collations are
- available for each character set.)
- With the configure option --with-extra-charsets=LIST, you can
- define which additional character sets should be compiled into
- the server. LIST is one of the following:
+ The MySQL installation packages can be downloaded from
+ http://dev.mysql.com/downloads/. If the package you download is
+ contained within a Zip archive, you need to extract the archive
+ first.
- + A list of character set names separated by spaces
+ The process for starting the wizard depends on the contents of the
+ installation package you download. If there is a setup.exe file
+ present, double-click it to start the installation process. If
+ there is an .msi file present, double-click it to start the
+ installation process.
- + complex to include all character sets that can't be
- dynamically loaded
+2.5.3.1.2. Choosing an Install Type
- + all to include all character sets into the binaries
- Clients that want to convert characters between the server and
- the client should use the SET NAMES statement. See Section
- 5.1.5, "Session System Variables," and Section 9.1.4,
- "Connection Character Sets and Collations."
+ There are three installation types available: Typical, Complete,
+ and Custom.
- * To configure MySQL with debugging code, use the --with-debug
- option:
-shell> ./configure --with-debug
- This causes a safe memory allocator to be included that can
- find some errors and that provides output about what is
- happening. See MySQL Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
- As of MySQL 5.1.12, using --with-debug to configure MySQL with
- debugging support enables you to use the
- --debug="d,parser_debug" option when you start the server.
- This causes the Bison parser that is used to process SQL
- statements to dump a parser trace to the server's standard
- error output. Typically, this output is written to the error
- log.
+ The Typical installation type installs the MySQL server, the mysql
+ command-line client, and the command-line utilities. The
+ command-line clients and utilities include mysqldump, myisamchk,
+ and several other tools to help you manage the MySQL server.
- * If your client programs are using threads, you must compile a
- thread-safe version of the MySQL client library with the
- --enable-thread-safe-client configure option. This creates a
- libmysqlclient_r library with which you should link your
- threaded applications. See Section 21.10.17, "How to Make a
- Threaded Client."
+ The Complete installation type installs all components included in
+ the installation package. The full installation package includes
+ components such as the embedded server library, the benchmark
+ suite, support scripts, and documentation.
- * Some features require that the server be built with
- compression library support, such as the COMPRESS() and
- UNCOMPRESS() functions, and compression of the client/server
- protocol. The --with-zlib-dir=no|bundled|DIR option provides
- control for compression library support. The value no
- explicitly disables compression support. bundled causes the
- zlib library bundled in the MySQL sources to be used. A DIR
- path name specifies where to find the compression library
- sources.
+ The Custom installation type gives you complete control over which
+ packages you wish to install and the installation path that is
+ used. See Section 2.5.3.1.3, "The Custom Install Dialog," for more
+ information on performing a custom install.
- * It is possible to build MySQL with large table support using
- the --with-big-tables option.
- This option causes the variables that store table row counts
- to be declared as unsigned long long rather than unsigned
- long. This enables tables to hold up to approximately
- 1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows.
- Previously it was necessary to pass -DBIG_TABLES to the
- compiler manually in order to enable this feature.
+ If you choose the Typical or Complete installation types and click
+ the Next button, you advance to the confirmation screen to verify
+ your choices and begin the installation. If you choose the Custom
+ installation type and click the Next button, you advance to the
+ custom installation dialog, described in Section 2.5.3.1.3, "The
+ Custom Install Dialog."
- * Run configure with the --disable-grant-options option to cause
- the --bootstrap, --skip-grant-tables, and --init-file options
- for mysqld to be disabled. For Windows, the configure.js
- script recognizes the DISABLE_GRANT_OPTIONS flag, which has
- the same effect. The capability is available as of MySQL
- 5.1.15.
+2.5.3.1.3. The Custom Install Dialog
- * This option allows MySQL Community Server features to be
- enabled. Additional options may be required for individual
- features, such as --enable-profiling to enable statement
- profiling. This option was added in MySQL 5.1.24. It is
- enabled by default as of MySQL 5.1.28; to disable it, use
- --disable-community-features.
+ If you wish to change the installation path or the specific
+ components that are installed by the MySQL Installation Wizard,
+ choose the Custom installation type.
- * When given with --enable-community-features, the
- --enable-profiling option enables the statement profiling
- capability exposed by the SHOW PROFILE and SHOW PROFILES
- statements. (See Section 12.5.5.33, "SHOW PROFILES Syntax.")
- This option was added in MySQL 5.1.24. It is enabled by
- default as of MySQL 5.1.28; to disable it, use
- --disable-profiling.
+ A tree view on the left side of the custom install dialog lists
+ all available components. Components that are not installed have a
+ red X icon; components that are installed have a gray icon. To
+ change whether a component is installed, click on that component's
+ icon and choose a new option from the drop-down list that appears.
- * See Section 2.13, "Operating System-Specific Notes," for
- options that pertain to particular operating systems.
+ You can change the default installation path by clicking the
+ Change... button to the right of the displayed installation path.
- * See Section 5.5.7.2, "Using SSL Connections," for options that
- pertain to configuring MySQL to support secure (encrypted)
- connections.
+ After choosing your installation components and installation path,
+ click the Next button to advance to the confirmation dialog.
- * Several configure options apply to plugin selection and
- building:
---with-plugins=PLUGIN[,PLUGIN]...
---with-plugins=GROUP
---with-plugin-PLUGIN
---without-plugin-PLUGIN
- PLUGIN is an individual plugin name such as csv or archive.
- As shorthand, GROUP is a configuration group name such as none
- (select no plugins) or all (select all plugins).
- You can build a plugin as static (compiled into the server) or
- dynamic (built as a dynamic library that must be installed
- using the INSTALL PLUGIN statement before it can be used).
- Some plugins might not support static or dynamic build.
- configure --help shows the following information pertaining to
- plugins:
+2.5.3.1.4. The Confirmation Dialog
- + The plugin-related options
+ Once you choose an installation type and optionally choose your
+ installation components, you advance to the confirmation dialog.
+ Your installation type and installation path are displayed for you
+ to review.
- + The names of all available plugins
+ To install MySQL if you are satisfied with your settings, click
+ the Install button. To change your settings, click the Back
+ button. To exit the MySQL Installation Wizard without installing
+ MySQL, click the Cancel button.
- + For each plugin, a description of its purpose, which
- build types it supports (static or dynamic), and which
- plugin groups it is a part of.
- --with-plugins can take a list of one or more plugin names
- separated by commas, or a plugin group name. The named plugins
- are configured to be built as static plugins.
- --with-plugin-PLUGIN configures the given plugin to be built
- as a static plugin.
- --without-plugin-PLUGIN disables the given plugin from being
- built.
- If a plugin is named both with a --with and --without option,
- the result is undefined.
- For any plugin that is not explicitly selected or disabled, it
- is selected to be built dynamically if it supports dynamic
- build, and not built if it does not support dynamic build.
- (Thus, in the case that no plugin options are given, all
- plugins that support dynamic build are selected to be built as
- dynamic plugins. Plugins that do not support dynamic build are
- not built.)
+ After installation is complete, you have the option of registering
+ with the MySQL web site. Registration gives you access to post in
+ the MySQL forums at forums.mysql.com (http://forums.mysql.com)
+ along with the ability to report bugs at bugs.mysql.com
+ (http://bugs.mysql.com) and to subscribe to our newsletter. The
+ final screen of the installer provides a summary of the
+ installation and gives you the option to launch the MySQL Config
+ Wizard, which you can use to create a configuration file, install
+ the MySQL service, and configure security settings.
-2.10.3. Installing from the Development Source Tree
+2.5.3.1.5. Changes Made by MySQL Installation Wizard
-Caution
+ Once you click the Install button, the MySQL Installation Wizard
+ begins the installation process and makes certain changes to your
+ system which are described in the sections that follow.
- You should read this section only if you are interested in helping
- us test our new code. If you just want to get MySQL up and running
- on your system, you should use a standard release distribution
- (either a binary or source distribution).
+ Changes to the Registry
- To obtain the most recent development source tree, you first need
- to download and install Bazaar. You can obtain Bazaar from the
- Bazaar VCS Website (http://bazaar-vcs.org) Bazaar is supported by
- any platform that supports Python, and is therefore compatible
- with any Linux, Unix, Windows or Mac OS X host. Instructions for
- downloading and installing Bazaar on the different platforms are
- available on the Bazaar website.
+ The MySQL Installation Wizard creates one Windows registry key in
+ a typical install situation, located in
+ HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.
- All MySQL projects are hosted on Launchpad
- (http://launchpad.net/) MySQL projects, including MySQL server,
- MySQL Workbench and others are available from the Sun/MySQL
- Engineering (http://launchpad.net/~mysql) page. For the
- repositories related only to MySQL server, see the MySQL Server
- (http://launchpad.net/mysql-server) page.
+ The MySQL Installation Wizard creates a key named after the major
+ version of the server that is being installed, such as MySQL
+ Server 5.1. It contains two string values, Location and Version.
+ The Location string contains the path to the installation
+ directory. In a default installation it contains C:\Program
+ Files\MySQL\MySQL Server 5.1\. The Version string contains the
+ release number. For example, for an installation of MySQL Server
+ 5.1.41, the key contains a value of 5.1.41.
- To build under Unix/Linux, you must have the following tools
- installed:
+ These registry keys are used to help external tools identify the
+ installed location of the MySQL server, preventing a complete scan
+ of the hard-disk to determine the installation path of the MySQL
+ server. The registry keys are not required to run the server, and
+ if you install MySQL using the noinstall Zip archive, the registry
+ keys are not created.
+
+ Changes to the Start Menu
+
+ The MySQL Installation Wizard creates a new entry in the Windows
+ Start menu under a common MySQL menu heading named after the major
+ version of MySQL that you have installed. For example, if you
+ install MySQL 5.1, the MySQL Installation Wizard creates a MySQL
+ Server 5.1 section in the Start menu.
- * GNU make, available from http://www.gnu.org/software/make/.
- Although some platforms come with their own make
- implementations, it is highly recommended that you use GNU
- make. It may already be available on your system as gmake.
+ The following entries are created within the new Start menu
+ section:
- * autoconf 2.58 (or newer), available from
- http://www.gnu.org/software/autoconf/.
+ * MySQL Command Line Client: This is a shortcut to the mysql
+ command-line client and is configured to connect as the root
+ user. The shortcut prompts for a root user password when you
+ connect.
- * automake 1.8.1, available from
- http://www.gnu.org/software/automake/.
+ * MySQL Server Instance Config Wizard: This is a shortcut to the
+ MySQL Config Wizard. Use this shortcut to configure a newly
+ installed server, or to reconfigure an existing server.
- * libtool 1.5, available from
- http://www.gnu.org/software/libtool/.
+ * MySQL Documentation: This is a link to the MySQL server
+ documentation that is stored locally in the MySQL server
+ installation directory. This option is not available when the
+ MySQL server is installed using the Essentials installation
+ package.
- * m4, available from http://www.gnu.org/software/m4/.
+ Changes to the File System
- * bison, available from http://www.gnu.org/software/bison/. You
- should use the latest version of bison where possible. Version
- 1.75 and version 2.1 are known to work. There have been
- reported problems with bison 1.875. If you experience
- problems, upgrade to a later, rather than earlier, version.
- Versions of bison older than 1.75 may report this error:
-sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
- The maximum table size is not actually exceeded; the error is
- caused by bugs in older versions of bison.
+ The MySQL Installation Wizard by default installs the MySQL 5.1
+ server to C:\Program Files\MySQL\MySQL Server 5.1, where Program
+ Files is the default location for applications in your system, and
+ 5.1 is the major version of your MySQL server. This is the
+ recommended location for the MySQL server, replacing the former
+ default location C:\mysql.
- To build under Windows you will need a copy of Microsoft Visual
- C++ 2005 Express Edition, Visual Studio .Net 2003 (7.1), or Visual
- Studio 2005 (8.0) compiler system.
+ By default, all MySQL applications are stored in a common
+ directory at C:\Program Files\MySQL, where Program Files is the
+ default location for applications in your Windows installation. A
+ typical MySQL installation on a developer machine might look like
+ this:
+C:\Program Files\MySQL\MySQL Server 5.1
+C:\Program Files\MySQL\MySQL Workbench 5.1 OSS
- Once you have the necessary tools installed, you first need to
- create a local branch of the MySQL source code on your machine:
+ This approach makes it easier to manage and maintain all MySQL
+ applications installed on a particular system.
- 1. To obtain a copy of the MySQL source code, you must create a
- new Bazaar branch. If you do not already have a Bazaar
- repository directory set up, you need to initialize a new
- directory:
-shell> mkdir mysql-server
-shell> bzr init-repo --trees mysql-server
+ In MySQL 5.1.23 and earlier, the default location for the data
+ files used by MySQL is located within the corresponding MySQL
+ Server installation directory. For MySQL 5.1.24 and later, the
+ default location of the data directory is the AppData directory
+ configured for the user that installed the MySQL application.
- 2. Once you have an initialized directory, you can branch from
- the public MySQL server repositories. To create a branch of a
- specific version:
-shell> cd mysql-server
-shell> bzr branch lp:mysql-server/5.1 mysql-5.1
+2.5.3.1.6. Upgrading MySQL with the Installation Wizard
- 3. The initial download will take some time to complete,
- depending on the speed of your connection. Please be patient.
- Once you have downloaded the first tree, additional trees
- should take significantly less time to download.
+ The MySQL Installation Wizard can perform server upgrades
+ automatically using the upgrade capabilities of MSI. That means
+ you do not need to remove a previous installation manually before
+ installing a new release. The installer automatically shuts down
+ and removes the previous MySQL service before installing the new
+ version.
- 4. When building from the Bazaar branch, you may want to create a
- copy of your active branch so that you can make configuration
- and other changes without affecting the original branch
- contents. You can achieve this by branching from the original
- branch:
-shell> bzr branch mysql-5.1 mysql-5.1-build
+ Automatic upgrades are available only when upgrading between
+ installations that have the same major and minor version numbers.
+ For example, you can upgrade automatically from MySQL 5.1.34 to
+ MySQL 5.1.37, but not from MySQL 5.0 to MySQL 5.1.
- Once you have the local branch, you can start to build MySQL
- server from the source code. On Windows, the build process is
- different from Unix/Linux. To continue building MySQL on Windows,
- see Section 2.10.6, "Installing MySQL from Source on Windows."
-
- On Unix/Linux you need to use the autoconf system to create the
- configure script so that you can configure the build environment
- before building.
-
- 1. The following example shows the typical commands required to
- configure a source tree. The first cd command changes location
- into the top-level directory of the tree; replace mysql-5.1
- with the appropriate directory name.
+ In MySQL 5.1.32 and later, the EXE version of the MSI installer
+ packages were removed. When upgrading an existing MySQL
+ installation from the old EXE based installer to the MSI based
+ installer, please keep the following notes in mind:
+
+ * The MSI installer will not identify an existing installation
+ that was installed using the old EXE installer. This means
+ that the installer will not stop the existing server, or
+ detect that the existing password is required before
+ installing the new version. To work around this:
+
+ 1. Stop the current server manually using net stop or
+ mysqladmin shutdown.
+
+ 2. Remove the existing installation manually by using the
+ Add/Remove Programs control panel. This will keep the
+ existing configuration and data files, as these are not
+ removed automatically.
+
+ 3. Install the new version of MySQL using the MSI installer.
+ When running the installation, skip updating the security
+ by deselecting the checkbox on the security screen.
+
+ 4. Complete the installation, and then start the server
+ again. You should be able to login with your existing
+ user and password credentials.
+
+ * You can only upgrade the version and release using the MSI
+ installer. For example, you can upgrade an open source
+ installation with an open source installer. You cannot upgrade
+ an open source installation using the enterprise installer.
+
+ See Section 2.5.7, "Upgrading MySQL on Windows."
+
+2.5.3.2. Installing MySQL Automatically using MSI
+
+ The Microsoft Installer (MSI) supports a both a quiet and a
+ passive mode that can be used to install MySQL automatically
+ without requireing intervention. You can use this either in
+ scripts to automatically install MySQL or through a terminal
+ connection such as Telnet where you do not have access to the
+ standard Windows user interface. The MSI packages can also be used
+ in combination with Microsoft's Group Policy system (part of
+ Windows Server 2003 and Windows Server 2008) to install MySQL
+ across multiple machines.
+
+ To install MySQL from one of the MSI packages automatically from
+ the command line (or within a script), you need to use the
+ msiexec.exe tool. For example, to perform a quiet installation
+ (which shows no dialog boxes or progress):
+shell> msiexec /i /quiet mysql-5.1.39.msi
+
+ The /i indicates that you want to perform an installation. The
+ /quiet option indicates that you want no interactive elements.
+
+ To provide a dialog box showing the progress during installation,
+ and the dialog boxes providing information on the installation and
+ registration of MySQL, use /passive mode instead of /quiet:
+shell> msiexec /i /passive mysql-5.1.39.msi
+
+ Regardless of the mode of the installation, installing the package
+ in this manner performs a 'Typical' installation, and installs the
+ default components into the standard location.
+
+ You can also use this method to uninstall MySQL by using the
+ /uninstall or /x options:
+shell> msiexec /x /quiet mysql-5.1.39.msi
+
+ To install MySQL and configure a MySQL instance from the command
+ line, see Section 2.5.4.13, "Creating an Instance from the Command
+ Line."
+
+ For information on using MSI packages to install software
+ automatically using Group Policy, see How to use Group Policy to
+ remotely install software in Windows Server 2003
+ (http://support.microsoft.com/kb/816102)
-Note
- For MySQL 5.1.12 and earlier, you must separately configure
- the INNODB storage engine. You can do this by running the
- following command from the main source directory:
-shell> (cd storage/innobase; autoreconf --force --install)
-shell> cd mysql-5.1
-shell> autoreconf --force --install
-shell> ./configure # Add your favorite options here
-shell> make
- Or you can use BUILD/autorun.sh as a shortcut for the
- following sequence of commands:
-shell> aclocal; autoheader
-shell> libtoolize --automake --force
-shell> automake --force --add-missing; autoconf
- The command line that changes directory into the
- storage/innobase directory is used to configure the InnoDB
- storage engine. You can omit this lines if you do not require
- InnoDB support.
+2.5.3.3. Removing MySQL Installed from the MSI Package
-Note
- Beginning with MySQL 5.1, code specific to storage engines has
- been moved under a storage directory. For example, InnoDB code
- is now found in storage/innobase and NDBCLUSTER code is in
- storage/ndb.
- If you get some strange errors during this stage, verify that
- you have the correct version of the libtool installed.
- A collection of our standard configuration scripts is located
- in the BUILD/ subdirectory. For example, you may find it more
- convenient to use the BUILD/compile-pentium-debug script than
- the preceding set of shell commands. To compile on a different
- architecture, modify the script by removing flags that are
- Pentium-specific, or use another script that may be more
- appropriate. These scripts are provided on an "as-is" basis.
- They are not officially maintained and their contents may
- change from release to release.
+ To uninstall a MySQL where you have used the MSI packages, you
+ must use the Add/Remove Programs tool within Control Panel. To do
+ this:
- 2. When the build is done, run make install. Be careful with this
- on a production machine; the command may overwrite your live
- release installation. If you have another installation of
- MySQL, run ./configure with different values for the --prefix,
- --with-tcp-port, and --with-unix-socket-path options than
- those used for your production server.
+ 1. Right click on the start menu and choose Control Panel.
- 3. Play hard with your new installation and try to make the new
- features crash. Start by running make test. See Section
- 22.1.2, "MySQL Test Suite."
+ 2. If the Control Panel is set to category mode (you will see
+ Pick a category at the top of the Control Panel window),
+ double click on Add or Remove Programs. If the Control is set
+ to classic mode, doubgle click on the Add or Remove Programs
+ icon.
+
+ 3. Find MySQL in the list of installed software. MySQL Server is
+ installed against major version numbers (MySQL 5.0, MySQL 5.1,
+ etc.). Select the version that you want to remove and click
+ Remove.
+
+ 4. You will be prompted to confirm the removal. Click Yes to
+ remove MySQL.
+
+ When MySQL is removed using this method, only the installed
+ components are removed. Any database information (including the
+ tables and data), import or export files, log files, and binary
+ logs produced during execution are kept in their configured
+ location.
- 4. If you have gotten to the make stage, but the distribution
- does not compile, please enter the problem into our bugs
- database using the instructions given in Section 1.6, "How to
- Report Bugs or Problems." If you have installed the latest
- versions of the required GNU tools, and they crash trying to
- process our configuration files, please report that also.
- However, if you execute aclocal and get a command not found
- error or a similar problem, do not report it. Instead, make
- sure that all the necessary tools are installed and that your
- PATH variable is set correctly so that your shell can find
- them.
+2.5.4. MySQL Server Instance Config Wizard
- 5. After initially copying the repository with bzr to obtain the
- source tree, you should use pull option to periodically update
- your local copy. To do this any time after you have set up the
- repository, use this command:
-shell> bzr pull
+ The MySQL Server Instance Config Wizard helps automate the process
+ of configuring your server. It creates a custom MySQL
+ configuration file (my.ini or my.cnf) by asking you a series of
+ questions and then applying your responses to a template to
+ generate the configuration file that is tuned to your
+ installation.
- 6. You can examine the changeset comments for the tree by using
- the log option to bzr:
-shell> bzr log
- You can also browse changesets, comments, and source code
- online. To browse this information for MySQL 5.1, go to
- http://launchpad.net/mysql-server/.
- If you see diffs or code that you have a question about, do
- not hesitate to send email to the MySQL internals mailing
- list. See Section 1.5.1, "MySQL Mailing Lists." Also, if you
- think you have a better idea on how to do something, send an
- email message to the list with a patch.
+ The complete and essential MSI installation packages include the
+ MySQL Server Instance Config Wizard in the MySQL 5.1 server. The
+ MySQL Server Instance Config Wizard is only available for Windows.
+
+ The workflow sequence for using the MySQL Server Instance Config
+ Wizard is shown in the figure below:
+
+ Figure 2.4. MySQL Server Instance Config Wizard Workflow
+ MySQL Server Instance Config Wizard Workflow
+
+2.5.4.1. Starting the MySQL Server Instance Config Wizard
+
+ The MySQL Server Instance Config Wizard is normally started as
+ part of the installation process. You should only need to run the
+ MySQL Server Instance Config Wizard again when you need to change
+ the configuration parameters of your server.
-2.10.4. Dealing with Problems Compiling MySQL
+ If you chose not to open a port prior to installing MySQL on
+ Windows Vista, you can choose to use the MySQL Server Instance
+ Config Wizard after installation. However, you must open a port in
+ the Windows Firewall. To do this see the instructions given in
+ Section 2.5.3.1.1, "Downloading and Starting the MySQL
+ Installation Wizard." Rather than opening a port, you also have
+ the option of adding MySQL as a program that bypasses the Windows
+ Firewall. One or the other option is sufficient --- you need not
+ do both. Additionally, when running the MySQL Server Config Wizard
+ on Windows Vista ensure that you are logged in as a user with
+ administrative rights.
+ MySQL Server Instance Config Wizard
- All MySQL programs compile cleanly for us with no warnings on
- Solaris or Linux using gcc. On other systems, warnings may occur
- due to differences in system include files. See Section 2.10.5,
- "MIT-pthreads Notes," for warnings that may occur when using
- MIT-pthreads. For other problems, check the following list.
+ You can launch the MySQL Config Wizard by clicking the MySQL
+ Server Instance Config Wizard entry in the MySQL section of the
+ Windows Start menu.
- The solution to many problems involves reconfiguring. If you do
- need to reconfigure, take note of the following:
+ Alternatively, you can navigate to the bin directory of your MySQL
+ installation and launch the MySQLInstanceConfig.exe file directly.
- * If configure is run after it has previously been run, it may
- use information that was gathered during its previous
- invocation. This information is stored in config.cache. When
- configure starts up, it looks for that file and reads its
- contents if it exists, on the assumption that the information
- is still correct. That assumption is invalid when you
- reconfigure.
+ The MySQL Server Instance Config Wizard places the my.ini file in
+ the installation directory for the MySQL server. This helps
+ associate configuration files with particular server instances.
- * Each time you run configure, you must run make again to
- recompile. However, you may want to remove old object files
- from previous builds first because they were compiled using
- different configuration options.
+ To ensure that the MySQL server knows where to look for the my.ini
+ file, an argument similar to this is passed to the MySQL server as
+ part of the service installation:
+--defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
- To prevent old configuration information or object files from
- being used, run these commands before re-running configure:
-shell> rm config.cache
-shell> make clean
+ Here, C:\Program Files\MySQL\MySQL Server 5.1 is replaced with the
+ installation path to the MySQL Server. The --defaults-file option
+ instructs the MySQL server to read the specified file for
+ configuration options when it starts.
- Alternatively, you can run make distclean.
+ Apart from making changes to the my.ini file by running the MySQL
+ Server Instance Config Wizard again, you can modify it by opening
+ it with a text editor and making any necessary changes. You can
+ also modify the server configuration with the MySQL Administrator
+ (http://www.mysql.com/products/administrator/) utility. For more
+ information about server configuration, see Section 5.1.2, "Server
+ Command Options."
- The following list describes some of the problems when compiling
- MySQL that have been found to occur most often:
+ MySQL clients and utilities such as the mysql and mysqldump
+ command-line clients are not able to locate the my.ini file
+ located in the server installation directory. To configure the
+ client and utility applications, create a new my.ini file in the
+ Windows installation directory (for example, C:\WINDOWS).
- * If you get errors such as the ones shown here when compiling
- sql_yacc.cc, you probably have run out of memory or swap
- space:
-Internal compiler error: program cc1plus got fatal signal 11
-Out of virtual memory
-Virtual memory exhausted
- The problem is that gcc requires a huge amount of memory to
- compile sql_yacc.cc with inline functions. Try running
- configure with the --with-low-memory option:
-shell> ./configure --with-low-memory
- This option causes -fno-inline to be added to the compile line
- if you are using gcc and -O0 if you are using something else.
- You should try the --with-low-memory option even if you have
- so much memory and swap space that you think you can't
- possibly have run out. This problem has been observed to occur
- even on systems with generous hardware configurations, and the
- --with-low-memory option usually fixes it.
+ Under Windows Server 2003, Windows Server 2000, Windows XP, and
+ Windows Vista MySQL Server Instance Config Wizard will configure
+ MySQL to work as a Windows service. To start and stop MySQL you
+ use the Services application that is supplied as part of the
+ Windows Administrator Tools.
+
+2.5.4.2. Choosing a Maintenance Option
+
+ If the MySQL Server Instance Config Wizard detects an existing
+ configuration file, you have the option of either reconfiguring
+ your existing server, or removing the server instance by deleting
+ the configuration file and stopping and removing the MySQL
+ service.
- * By default, configure picks c++ as the compiler name and GNU
- c++ links with -lg++. If you are using gcc, that behavior can
- cause problems during configuration such as this:
-configure: error: installation or configuration problem:
-C++ compiler cannot create executables.
- You might also observe problems during compilation related to
- g++, libg++, or libstdc++.
- One cause of these problems is that you may not have g++, or
- you may have g++ but not libg++, or libstdc++. Take a look at
- the config.log file. It should contain the exact reason why
- your C++ compiler didn't work. To work around these problems,
- you can use gcc as your C++ compiler. Try setting the
- environment variable CXX to "gcc -O3". For example:
-shell> CXX="gcc -O3" ./configure
- This works because gcc compiles C++ source files as well as
- g++ does, but does not link in libg++ or libstdc++ by default.
- Another way to fix these problems is to install g++, libg++,
- and libstdc++. However, do not use libg++ or libstdc++ with
- MySQL because this only increases the binary size of mysqld
- without providing any benefits. Some versions of these
- libraries have also caused strange problems for MySQL users in
- the past.
+ To reconfigure an existing server, choose the Re-configure
+ Instance option and click the Next button. Any existing
+ configuration file is not overwritten, but renamed (within the
+ same directory) using a timestamp (Windows) or sequential number
+ (Linux). To remove the existing server instance, choose the Remove
+ Instance option and click the Next button.
- * If your compile fails with errors such as any of the
- following, you must upgrade your version of make to GNU make:
-making all in mit-pthreads
-make: Fatal error in reader: Makefile, line 18:
-Badly formed macro assignment
- Or:
-make: file `Makefile' line 18: Must be a separator (:
- Or:
-pthread.h: No such file or directory
- Solaris and FreeBSD are known to have troublesome make
- programs.
- GNU make 3.75 is known to work.
+ If you choose the Remove Instance option, you advance to a
+ confirmation window. Click the Execute button. The MySQL Server
+ Config Wizard stops and removes the MySQL service, and then
+ deletes the configuration file. The server installation and its
+ data folder are not removed.
- * If you want to define flags to be used by your C or C++
- compilers, do so by adding the flags to the CFLAGS and
- CXXFLAGS environment variables. You can also specify the
- compiler names this way using CC and CXX. For example:
-shell> CC=gcc
-shell> CFLAGS=-O3
-shell> CXX=gcc
-shell> CXXFLAGS=-O3
-shell> export CC CFLAGS CXX CXXFLAGS
- See Section 2.1.2.4, "MySQL Binaries Compiled by Sun
- Microsystems, Inc.," for a list of flag definitions that have
- been found to be useful on various systems.
+ If you choose the Re-configure Instance option, you advance to the
+ Configuration Type dialog where you can choose the type of
+ installation that you wish to configure.
- * If you get errors such as those shown here when compiling
- mysqld, configure did not correctly detect the type of the
- last argument to accept(), getsockname(), or getpeername():
-cxx: Error: mysqld.cc, line 645: In this statement, the referenced
- type of the pointer value ''length'' is ''unsigned long'',
- which is not compatible with ''int''.
-new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
- To fix this, edit the config.h file (which is generated by
- configure). Look for these lines:
-/* Define as the base type of the last arg to accept */
-#define SOCKET_SIZE_TYPE XXX
- Change XXX to size_t or int, depending on your operating
- system. (You must do this each time you run configure because
- configure regenerates config.h.)
+2.5.4.3. Choosing a Configuration Type
- * The sql_yacc.cc file is generated from sql_yacc.yy. Normally,
- the build process does not need to create sql_yacc.cc because
- MySQL comes with a pre-generated copy. However, if you do need
- to re-create it, you might encounter this error:
-"sql_yacc.yy", line xxx fatal: default action causes potential...
- This is a sign that your version of yacc is deficient. You
- probably need to install bison (the GNU version of yacc) and
- use that instead.
+ When you start the MySQL Server Instance Config Wizard for a new
+ MySQL installation, or choose the Re-configure Instance option for
+ an existing installation, you advance to the Configuration Type
+ dialog.
+ MySQL Server Instance Config Wizard: Configuration Type
- * On Debian Linux 3.0, you need to install gawk instead of the
- default mawk.
+ There are two configuration types available: Detailed
+ Configuration and Standard Configuration. The Standard
+ Configuration option is intended for new users who want to get
+ started with MySQL quickly without having to make many decisions
+ about server configuration. The Detailed Configuration option is
+ intended for advanced users who want more fine-grained control
+ over server configuration.
- * If you need to debug mysqld or a MySQL client, run configure
- with the --with-debug option, and then recompile and link your
- clients with the new client library. See MySQL Internals:
- Porting (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
+ If you are new to MySQL and need a server configured as a
+ single-user developer machine, the Standard Configuration should
+ suit your needs. Choosing the Standard Configuration option causes
+ the MySQL Config Wizard to set all configuration options
+ automatically with the exception of Service Options and Security
+ Options.
- * If you get a compilation error on Linux (for example, SuSE
- Linux 8.1 or Red Hat Linux 7.3) similar to the following one,
- you probably do not have g++ installed:
-libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
-incompatible pointer type
-libmysql.c:1329: too few arguments to function `gethostbyname_r'
-libmysql.c:1329: warning: assignment makes pointer from integer
-without a cast
-make[2]: *** [libmysql.lo] Error 1
- By default, the configure script attempts to determine the
- correct number of arguments by using g++ (the GNU C++
- compiler). This test yields incorrect results if g++ is not
- installed. There are two ways to work around this problem:
+ The Standard Configuration sets options that may be incompatible
+ with systems where there are existing MySQL installations. If you
+ have an existing MySQL installation on your system in addition to
+ the installation you wish to configure, the Detailed Configuration
+ option is recommended.
- + Make sure that the GNU C++ g++ is installed. On some
- Linux distributions, the required package is called gpp;
- on others, it is named gcc-c++.
+ To complete the Standard Configuration, please refer to the
+ sections on Service Options and Security Options in Section
+ 2.5.4.10, "The Service Options Dialog," and Section 2.5.4.11, "The
+ Security Options Dialog," respectively.
- + Use gcc as your C++ compiler by setting the CXX
- environment variable to gcc:
-export CXX="gcc"
- You must run configure again after making either of those
- changes.
+2.5.4.4. The Server Type Dialog
-2.10.5. MIT-pthreads Notes
+ There are three different server types available to choose from.
+ The server type that you choose affects the decisions that the
+ MySQL Server Instance Config Wizard makes with regard to memory,
+ disk, and processor usage.
+ MySQL Server Instance Config Wizard: Server Type
- This section describes some of the issues involved in using
- MIT-pthreads.
+ * Developer Machine: Choose this option for a typical desktop
+ workstation where MySQL is intended only for personal use. It
+ is assumed that many other desktop applications are running.
+ The MySQL server is configured to use minimal system
+ resources.
- On Linux, you should not use MIT-pthreads. Use the installed
- LinuxThreads implementation instead. See Section 2.13.1, "Linux
- Notes."
+ * Server Machine: Choose this option for a server machine where
+ the MySQL server is running alongside other server
+ applications such as FTP, email, and Web servers. The MySQL
+ server is configured to use a moderate portion of the system
+ resources.
- If your system does not provide native thread support, you should
- build MySQL using the MIT-pthreads package. This includes older
- FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some
- others. See Section 2.1.1, "Operating Systems Supported by MySQL
- Community Server."
+ * Dedicated MySQL Server Machine: Choose this option for a
+ server machine that is intended to run only the MySQL server.
+ It is assumed that no other applications are running. The
+ MySQL server is configured to use all available system
+ resources.
- MIT-pthreads is not part of the MySQL 5.1 source distribution. If
- you require this package, you need to download it separately from
- http://dev.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.t
- ar.gz
+Note
- After downloading, extract this source archive into the top level
- of the MySQL source directory. It creates a new subdirectory named
- mit-pthreads.
+ By selecting one of the preconfigured configurations, the values
+ and settings of various options in your my.cnf or my.ini will be
+ altered accordingly. The default values and options as described
+ in the reference manual may therefore be different to the options
+ and values that were created during the execution of the Config
+ Wizard.
- * On most systems, you can force MIT-pthreads to be used by
- running configure with the --with-mit-threads option:
-shell> ./configure --with-mit-threads
- Building in a nonsource directory is not supported when using
- MIT-pthreads because we want to minimize our changes to this
- code.
+2.5.4.5. The Database Usage Dialog
- * The checks that determine whether to use MIT-pthreads occur
- only during the part of the configuration process that deals
- with the server code. If you have configured the distribution
- using --without-server to build only the client code, clients
- do not know whether MIT-pthreads is being used and use Unix
- socket file connections by default. Because Unix socket files
- do not work under MIT-pthreads on some platforms, this means
- you need to use -h or --host with a value other than localhost
- when you run client programs.
+ The Database Usage dialog allows you to indicate the storage
+ engines that you expect to use when creating MySQL tables. The
+ option you choose determines whether the InnoDB storage engine is
+ available and what percentage of the server resources are
+ available to InnoDB.
+ MySQL Server Instance Config Wizard: Usage Dialog
- * When MySQL is compiled using MIT-pthreads, system locking is
- disabled by default for performance reasons. You can tell the
- server to use system locking with the --external-locking
- option. This is needed only if you want to be able to run two
- MySQL servers against the same data files, but that is not
- recommended, anyway.
+ * Multifunctional Database: This option enables both the InnoDB
+ and MyISAM storage engines and divides resources evenly
+ between the two. This option is recommended for users who use
+ both storage engines on a regular basis.
- * Sometimes the pthread bind() command fails to bind to a socket
- without any error message (at least on Solaris). The result is
- that all connections to the server fail. For example:
-shell> mysqladmin version
-mysqladmin: connect to server at '' failed;
-error: 'Can't connect to mysql server on localhost (146)'
- The solution to this problem is to kill the mysqld server and
- restart it. This has happened to us only when we have forcibly
- stopped the server and restarted it immediately.
+ * Transactional Database Only: This option enables both the
+ InnoDB and MyISAM storage engines, but dedicates most server
+ resources to the InnoDB storage engine. This option is
+ recommended for users who use InnoDB almost exclusively and
+ make only minimal use of MyISAM.
- * With MIT-pthreads, the sleep() system call isn't interruptible
- with SIGINT (break). This is noticeable only when you run
- mysqladmin --sleep. You must wait for the sleep() call to
- terminate before the interrupt is served and the process
- stops.
+ * Non-Transactional Database Only: This option disables the
+ InnoDB storage engine completely and dedicates all server
+ resources to the MyISAM storage engine. This option is
+ recommended for users who do not use InnoDB.
- * When linking, you might receive warning messages like these
- (at least on Solaris); they can be ignored:
-ld: warning: symbol `_iob' has differing sizes:
- (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
-file /usr/lib/libc.so value=0x140);
- /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
-ld: warning: symbol `__iob' has differing sizes:
- (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
-file /usr/lib/libc.so value=0x140);
- /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
+ The Config Wizard uses a template to generate the server
+ configuration file. The Database Usage dialog sets one of the
+ following option strings:
+Multifunctional Database: MIXED
+Transactional Database Only: INNODB
+Non-Transactional Database Only: MYISAM
- * Some other warnings also can be ignored:
-implicit declaration of function `int strtoll(...)'
-implicit declaration of function `int strtoul(...)'
+ When these options are processed through the default template
+ (my-template.ini) the result is:
+Multifunctional Database:
+default-storage-engine=InnoDB
+_myisam_pct=50
- * We have not been able to make readline work with MIT-pthreads.
- (This is not necessary, but may be of interest to some.)
+Transactional Database Only:
+default-storage-engine=InnoDB
+_myisam_pct=5
-2.10.6. Installing MySQL from Source on Windows
+Non-Transactional Database Only:
+default-storage-engine=MyISAM
+_myisam_pct=100
+skip-innodb
- These instructions describe how to build binaries from source for
- MySQL 5.1 on Windows. Instructions are provided for building
- binaries from a standard source distribution or from the Bazaar
- tree that contains the latest development source.
+ The _myisam_pct value is used to calculate the percentage of
+ resources dedicated to MyISAM. The remaining resources are
+ allocated to InnoDB.
-Note
+2.5.4.6. The InnoDB Tablespace Dialog
- The instructions here are strictly for users who want to test
- MySQL on Microsoft Windows from the latest source distribution or
- from the Bazaar tree. For production use, we do not advise using a
- MySQL server built by yourself from source. Normally, it is best
- to use precompiled binary distributions of MySQL that are built
- specifically for optimal performance on Windows by Sun
- Microsystems, Inc. Instructions for installing binary
- distributions are available in Section 2.3, "Installing MySQL on
- Windows."
+ Some users may want to locate the InnoDB tablespace files in a
+ different location than the MySQL server data directory. Placing
+ the tablespace files in a separate location can be desirable if
+ your system has a higher capacity or higher performance storage
+ device available, such as a RAID storage system.
+ MySQL Server Instance Config Wizard: InnoDB Data Tablespace
- To build MySQL on Windows from source, you must satisfy the
- following system, compiler, and resource requirements:
+ To change the default location for the InnoDB tablespace files,
+ choose a new drive from the drop-down list of drive letters and
+ choose a new path from the drop-down list of paths. To create a
+ custom path, click the ... button.
- * Windows 2000, Windows XP, or newer version.
- Windows Vista is supported when using Visual Studio 2005
- provided you have installed the following updates:
+ If you are modifying the configuration of an existing server, you
+ must click the Modify button before you change the path. In this
+ situation you must move the existing tablespace files to the new
+ location manually before starting the server.
- + Microsoft Visual Studio 2005 Professional Edition - ENU
- Service Pack 1 (KB926601)
- (http://support.microsoft.com/?kbid=926601)
+2.5.4.7. The Concurrent Connections Dialog
- + Security Update for Microsoft Visual Studio 2005
- Professional Edition - ENU (KB937061)
- (http://support.microsoft.com/?kbid=937061)
+ To prevent the server from running out of resources, it is
+ important to limit the number of concurrent connections to the
+ MySQL server that can be established. The Concurrent Connections
+ dialog allows you to choose the expected usage of your server, and
+ sets the limit for concurrent connections accordingly. It is also
+ possible to set the concurrent connection limit manually.
+ MySQL Server Instance Config Wizard: Connections
- + Update for Microsoft Visual Studio 2005 Professional
- Edition - ENU (KB932232)
- (http://support.microsoft.com/?kbid=932232)
+ * Decision Support (DSS)/OLAP: Choose this option if your server
+ does not require a large number of concurrent connections. The
+ maximum number of connections is set at 100, with an average
+ of 20 concurrent connections assumed.
- * CMake, which can be downloaded from http://www.cmake.org.
- After installing, modify your path to include the cmake
- binary.
+ * Online Transaction Processing (OLTP): Choose this option if
+ your server requires a large number of concurrent connections.
+ The maximum number of connections is set at 500.
- * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net
- 2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
+ * Manual Setting: Choose this option to set the maximum number
+ of concurrent connections to the server manually. Choose the
+ number of concurrent connections from the drop-down box
+ provided, or enter the maximum number of connections into the
+ drop-down box if the number you desire is not listed.
- * If you are using Visual C++ 2005 Express Edition, you must
- also install an appropriate Platform SDK. More information and
- links to downloads for various Windows platforms is available
- from
- http://www.microsoft.com/downloads/details.aspx?familyid=0baf2
- b35-c656-4969-ace8-e4c0c0716adb.
+2.5.4.8. The Networking and Strict Mode Options Dialog
- * If you are compiling from a Bazaar tree or making changes to
- the parser, you need bison for Windows, which can be
- downloaded from
- http://gnuwin32.sourceforge.net/packages/bison.htm. Download
- the package labeled "Complete package, excluding sources".
- After installing the package, modify your path to include the
- bison binary and ensure that this binary is accessible from
- Visual Studio.
+ Use the Networking Options dialog to enable or disable TCP/IP
+ networking and to configure the port number that is used to
+ connect to the MySQL server.
+ MySQL Server Instance Config Wizard: Network Configuration
- * Cygwin might be necessary if you want to run the test script
- or package the compiled binaries and support files into a Zip
- archive. (Cygwin is needed only to test or package the
- distribution, not to build it.) Cygwin is available from
- http://cygwin.com.
+ TCP/IP networking is enabled by default. To disable TCP/IP
+ networking, uncheck the box next to the Enable TCP/IP Networking
+ option.
- * 3GB to 5GB of disk space.
+ Port 3306 is used by default. To change the port used to access
+ MySQL, choose a new port number from the drop-down box or type a
+ new port number directly into the drop-down box. If the port
+ number you choose is in use, you are prompted to confirm your
+ choice of port number.
- The exact system requirements can be found here:
- http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as
- px and
- http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx
+ Set the Server SQL Mode to either enable or disable strict mode.
+ Enabling strict mode (default) makes MySQL behave more like other
+ database management systems. If you run applications that rely on
+ MySQL's old "forgiving" behavior, make sure to either adapt those
+ applications or to disable strict mode. For more information about
+ strict mode, see Section 5.1.8, "Server SQL Modes."
- You also need a MySQL source distribution for Windows, which can
- be obtained two ways:
+2.5.4.9. The Character Set Dialog
- * Obtain a source distribution packaged by Sun Microsystems,
- Inc. These are available from http://dev.mysql.com/downloads/.
+ The MySQL server supports multiple character sets and it is
+ possible to set a default server character set that is applied to
+ all tables, columns, and databases unless overridden. Use the
+ Character Set dialog to change the default character set of the
+ MySQL server.
+ MySQL Server Instance Config Wizard: Character Set
- * Package a source distribution yourself from the latest Bazaar
- developer source tree. For instructions on pulling the latest
- source files, see Section 2.10.3, "Installing from the
- Development Source Tree."
+ * Standard Character Set: Choose this option if you want to use
+ latin1 as the default server character set. latin1 is used for
+ English and many Western European languages.
- If you find something not working as expected, or you have
- suggestions about ways to improve the current build process on
- Windows, please send a message to the win32 mailing list. See
- Section 1.5.1, "MySQL Mailing Lists."
+ * Best Support For Multilingualism: Choose this option if you
+ want to use utf8 as the default server character set. This is
+ a Unicode character set that can store characters from many
+ different languages.
-2.10.6.1. Building MySQL from Source Using CMake and Visual Studio
+ * Manual Selected Default Character Set / Collation: Choose this
+ option if you want to pick the server's default character set
+ manually. Choose the desired character set from the provided
+ drop-down list.
- You can build MySQL on Windows by using a combination of cmake and
- Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio
- 2005 (8.0) or Microsoft Visual C++ 2005 Express Edition. You must
- have the appropriate Microsoft Platform SDK installed.
+2.5.4.10. The Service Options Dialog
-Note
+ On Windows platforms, the MySQL server can be installed as a
+ Windows service. When installed this way, the MySQL server can be
+ started automatically during system startup, and even restarted
+ automatically by Windows in the event of a service failure.
- To compile from the source code on Windows you must use the
- standard source distribution (for example, mysql-5.0.45.tar.gz).
- You build from the same distribution as used to build MySQL on
- Unix, Linux and other platforms. Do not use the Windows Source
- distributions as they do not contain the necessary configuration
- script and other files.
+ The MySQL Server Instance Config Wizard installs the MySQL server
+ as a service by default, using the service name MySQL. If you do
+ not wish to install the service, uncheck the box next to the
+ Install As Windows Service option. You can change the service name
+ by picking a new service name from the drop-down box provided or
+ by entering a new service name into the drop-down box.
- Follow this procedure to build MySQL:
+Note
- 1. If you are installing from a packaged source distribution,
- create a work directory (for example, C:\workdir), and unpack
- the source distribution there using WinZip or another Windows
- tool that can read .zip files. This directory is the work
- directory in the following instructions.
+ Service names can include any legal character except forward (/)
+ or backward (\) slashes, and must be less than 256 characters
+ long.
- 2. Using a command shell, navigate to the work directory and run
- the following command:
-C:\workdir>win\configure.js options
- If you have associated the .js file extension with an
- application such as a text editor, then you may need to use
- the following command to force configure.js to be executed as
- a script:
-C:\workdir>cscript win\configure.js options
- These options are available for configure.js:
+Warning
- + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage
- engine.
+ If you are installing multiple versions of MySQL onto the same
+ machine, you must choose a different service name for each version
+ that you install. If you do not choose a different service for
+ each installed version then the service manager information will
+ be inconsistent and this will cause problems when you try to
+ uninstall a previous version.
- + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined
- partitioning.
+ If you have already installed multiple versions using the same
+ service name, you must manually edit the contents of the
+ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters
+ within the Windows registry to update the association of the
+ service name with the correct server version.
- + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage
- engine.
+ Typically, when installing multiple versions you create a service
+ name based on the version information. For example, you might
+ install MySQL 5.x as mysql5, or specific versions such as MySQL
+ 5.1.30 as mysql50130.
- + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE
- storage engine.
+ To install the MySQL server as a service but not have it started
+ automatically at startup, uncheck the box next to the Launch the
+ MySQL Server Automatically option.
- + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage
- engine.
+2.5.4.11. The Security Options Dialog
- + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
- storage engine.
+ It is strongly recommended that you set a root password for your
+ MySQL server, and the MySQL Server Instance Config Wizard requires
+ by default that you do so. If you do not wish to set a root
+ password, uncheck the box next to the Modify Security Settings
+ option.
+ MySQL Server Instance Config Wizard: Security
- + WITH_NDBCLUSTER_STORAGE_ENGINE (experimental): Enable the
- NDBCLUSTER storage engine in the MySQL server; cause
- binaries for the MySQL Cluster management and data node,
- management client, and other programs to be built.
- This option is supported only in MySQL Cluster NDB 7.0
- (NDBCLUSTER storage engine versions 6.4.0 and later)
- using the MySQL Cluster sources. It cannot be used to
- enable clustering support in other MySQL source trees or
- distributions.
+ To set the root password, enter the desired password into both the
+ New root password and Confirm boxes. If you are reconfiguring an
+ existing server, you need to enter the existing root password into
+ the Current root password box.
- + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.
+ To allow root logins from across the network, check the box next
+ to the Enable root access from remote machines option. This
+ decreases the security of your root account.
- + COMPILATION_COMMENT=comment: Server comment, default
- "Source distribution".
+ To create an anonymous user account, check the box next to the
+ Create An Anonymous Account option. Creating an anonymous account
+ can decrease server security and cause login and permission
+ difficulties. For this reason, it is not recommended.
- + MYSQL_TCP_PORT=port: Server port, default 3306.
+2.5.4.12. The Confirmation Dialog
- + DISABLE_GRANT_OPTIONS: Disables the --bootstrap,
- --skip-grant-tables, and --init-file options for mysqld.
- This option is available as of MySQL 5.1.15.
- For example (type the command on one line):
-C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE
- WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
+ The final dialog in the MySQL Server Instance Config Wizard is the
+ Confirmation Dialog. To start the configuration process, click the
+ Execute button. To return to a previous dialog, click the Back
+ button. To exit the MySQL Server Instance Config Wizard without
+ configuring the server, click the Cancel button.
+ MySQL Server Instance Config Wizard: Confirmation
- 3. From the work directory, execute the win\build-vs8.bat or
- win\build-vs71.bat file, depending on the version of Visual
- Studio you have installed. The script invokes CMake, which
- generates the mysql.sln solution file.
- You can also use win\build-vs8_x64.bat to build the 64-bit
- version of MySQL. However, you cannot build the 64-bit version
- with Visual Studio Express Edition. You must use Visual Studio
- 2005 (8.0) or higher.
+ After you click the Execute button, the MySQL Server Instance
+ Config Wizard performs a series of tasks and displays the progress
+ onscreen as the tasks are performed.
- 4. From the work directory, open the generated mysql.sln file
- with Visual Studio and select the proper configuration using
- the Configuration menu. The menu provides Debug, Release,
- RelwithDebInfo, MinRelInfo options. Then select Solution >
- Build to build the solution.
- Remember the configuration that you use in this step. It is
- important later when you run the test script because that
- script needs to know which configuration you used.
+ The MySQL Server Instance Config Wizard first determines
+ configuration file options based on your choices using a template
+ prepared by MySQL developers and engineers. This template is named
+ my-template.ini and is located in your server installation
+ directory.
- 5. Test the server. The server built using the preceding
- instructions expects that the MySQL base directory and data
- directory are C:\mysql and C:\mysql\data by default. If you
- want to test your server using the source tree root directory
- and its data directory as the base directory and data
- directory, you need to tell the server their path names. You
- can either do this on the command line with the --basedir and
- --datadir options, or by placing appropriate options in an
- option file. (See Section 4.2.3.3, "Using Option Files.") If
- you have an existing data directory elsewhere that you want to
- use, you can specify its path name instead.
- When the server is running in standalone fashion or as a
- service based on your configuration, try to connect to it from
- the mysql interactive command-line utility.
- You can also run the standard test script, mysql-test-run.pl.
- This script is written in Perl, so you'll need either Cygwin
- or ActiveState Perl to run it. You may also need to install
- the modules required by the script. To run the test script,
- change location into the mysql-test directory under the work
- directory, set the MTR_VS_CONFIG environment variable to the
- configuration you selected earlier (or use the --vs-config
- option), and invoke mysql-test-run.pl. For example (using
- Cygwin and the bash shell):
-shell> cd mysql-test
-shell> export MTR_VS_CONFIG=debug
-shell> ./mysql-test-run.pl --force --timer
-shell> ./mysql-test-run.pl --force --timer --ps-protocol
+ The MySQL Config Wizard then writes these options to the
+ corresponding configuration file.
- When you are satisfied that the programs you have built are
- working correctly, stop the server. Now you can install the
- distribution. One way to do this is to use the make_win_bin_dist
- script in the scripts directory of the MySQL source distribution
- (see Section 4.4.2, "make_win_bin_dist --- Package MySQL
- Distribution as ZIP Archive"). This is a shell script, so you must
- have Cygwin installed if you want to use it. It creates a Zip
- archive of the built executables and support files that you can
- unpack in the location at which you want to install MySQL.
+ If you chose to create a service for the MySQL server, the MySQL
+ Server Instance Config Wizard creates and starts the service. If
+ you are reconfiguring an existing service, the MySQL Server
+ Instance Config Wizard restarts the service to apply your
+ configuration changes.
+
+ If you chose to set a root password, the MySQL Config Wizard
+ connects to the server, sets your new root password, and applies
+ any other security settings you may have selected.
+
+ After the MySQL Server Instance Config Wizard has completed its
+ tasks, it displays a summary. Click the Finish button to exit the
+ MySQL Server Config Wizard.
+
+2.5.4.13. Creating an Instance from the Command Line
+
+ In addition to using the GUI interface to the MySQL Server
+ Instance Config Wizard, you can also create instances
+ automatically from the command line.
+
+ To use the MySQL Server Instance Config Wizard on the command
+ line, you need to use the MySQLInstanceConfig.exe command that is
+ installed with MySQL in the bin directory within the installation
+ directory. MySQLInstanceConfig.exe takes a number of command-line
+ arguments the set the properties that would normally be selected
+ through the GUI interface, and then creates a new configuration
+ file (my.ini) by combining these selections with a template
+ configuration file to produce the working configuration file.
+
+ The main command line options are provided in the table below.
+ Some of the options are required, while some options are optional.
+
+ Table 2.4. MySQL Server Instance Config Wizard Command Line
+ Options
+ Option Description
+ Required Parameters
+ -nPRODUCTNAME The name of the instance when installed
+ -pPATH Path of the base directory for installation. This is
+ equivalent to the directory when using the basedir configuration
+ parameter
+ -vVERSION The version tag to use for this installation
+ Action to Perform
+ -i Install an instance
+ -r Remove an instance
+ -s Stop an existing instance
+ -q Perform the operation quietly
+ -lFILENAME Sae the installation progress in a logfile
+ Config File to Use
+ -tFILENAME Path to the template config file that will be used to
+ generate the installed configuration file
+ -cFILENAME Path to a config file to be generated
+
+ The -t and -c options work together to set the configuration
+ parameters for a new instance. The -t option specifies the
+ template configuration file to use as the basic configuration,
+ which are then merged with the configuration parameters generated
+ by the MySQL Server Instance Config Wizard into the configuration
+ file specified by the -c option.
+
+ A sample template file, my-template.ini is provided in the
+ toplevel MySQL installation directory. The file contains elements
+ are replaced automatically by the MySQL Server Instance Config
+ Wizard during configuration.
+
+ If you specify a configuration file that already exists, the
+ existing configuration file will be saved in the file with the
+ original, with the date and time added. For example, the mysql.ini
+ will be copied to mysql 2009-10-27 1646.ini.bak.
+
+ The parameters that you can specify on the command line are listed
+ in the table below.
+
+ Table 2.5. MySQL Server Instance Config Wizard Parameters
+ Parameter Description
+ ServiceName=$ Specify the name of the service to be created
+ AddBinToPath={yes | no} Specifies whether to add the binary
+ directory of MySQL to the standard PATH environment variable
+ ServerType={DEVELOPMENT | SERVER | DEDICATED} Specify the server
+ type. For more information, see Section 2.5.4.4, "The Server Type
+ Dialog"
+ DatabaseType={MIXED | INNODB | MYISAM} Specify the default
+ database type. For more information, see Section 2.5.4.5, "The
+ Database Usage Dialog"
+ ConnectionUsage={DSS | OLTP} Specify the type of connection
+ support, this automates the setting for the number of concurrent
+ connections (see the ConnectionCount parameter). For more
+ information, see Section 2.5.4.7, "The Concurrent Connections
+ Dialog"
+ ConnectionCount=# Specify the number of concurrent connections to
+ support. For more information, see Section 2.5.4.4, "The Server
+ Type Dialog"
+ SkipNetworking={yes | no} Specify whether network support should
+ be supported. Specifying yes disables network access altogether
+ Port=# Specify the network port number to use for network
+ connections. For more information, see Section 2.5.4.8, "The
+ Networking and Strict Mode Options Dialog"
+ StrictMode={yes | no} Specify whether to use the strict SQL mode.
+ For more information, see Section 2.5.4.8, "The Networking and
+ Strict Mode Options Dialog"
+ Charset=$ Specify the default character set. For more information,
+ see Section 2.5.4.9, "The Character Set Dialog"
+ RootPassword=$ Specify the root password
+ RootCurrentPassword=$ Specify the current root password then
+ stopping and/or reconfiguring an existing service
- It is also possible to install MySQL by copying directories and
- files directly:
+Note
- 1. Create the directories where you want to install MySQL. For
- example, to install into C:\mysql, use these commands:
-C:\> mkdir C:\mysql
-C:\> mkdir C:\mysql\bin
-C:\> mkdir C:\mysql\data
-C:\> mkdir C:\mysql\share
-C:\> mkdir C:\mysql\scripts
- If you want to compile other clients and link them to MySQL,
- you should also create several additional directories:
-C:\> mkdir C:\mysql\include
-C:\> mkdir C:\mysql\lib
-C:\> mkdir C:\mysql\lib\debug
-C:\> mkdir C:\mysql\lib\opt
- If you want to benchmark MySQL, create this directory:
-C:\> mkdir C:\mysql\sql-bench
- Benchmarking requires Perl support. See Section 2.15, "Perl
- Installation Notes."
+ When specifying options on the command line, you can enclose the
+ entire command-line option and the value you are specifying using
+ double quotes. This enables you to use spaces in the options. For
+ example, "-cC:\mysql.ini".
+
+ The following command installs a MySQL Server 5.1 instance from
+ the directory C:\Program Files\MySQL\MySQL Server 5.1 using the
+ service name MySQL51 and setting the root password to 1234.
+shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" »
+ "-nMySQL Server 5.1" "-pC:\Program Files\MySQL\MySQL Server 5.1" -
+v5.1.39 »
+ "-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT Datab
+aseType=MIXED »
+ ConnectionUsage=DSS Port=3311 ServiceName=MySQL51 RootPassword=123
+4
+
+ In the above example, a log file will be generated in
+ mysql_install_log.txt containing the information about the
+ instance creation process. The log file generated by the above
+ example is shown below:
+Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0
+Date: 2009-10-27 17:07:21
+
+Installing service ...
+
+Product Name: MySQL Server 5.1
+Version: 5.1.39
+Installation Path: C:\Program Files\MySQL\MySQL Server 5.1\
+
+Creating configuration file C:\mytest.ini using template my-template.
+ini.
+Options:
+DEVELOPMENT
+MIXED
+DSS
+STRICTMODE
+
+Variables:
+port: 3311
+default-character-set: latin1
+basedir: "C:/Program Files/MySQL/MySQL Server 5.1/"
+datadir: "C:/Program Files/MySQL/MySQL Server 5.1/Data/"
+
+
+Creating Windows service entry.
+Service name: "MySQL51"
+Parameters: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --
+defaults-file="C:\mytest.ini" MySQL51.
+Windows service MySQL51 installed.
+
+ When using the command-line, the return values in the following
+ table indicate an error performing the specified option.
+
+ Table 2.6. Return Value from MySQL Server Instance Config Wizard
+ Value Description
+ 2 Configuration template file cannot be found
+ 3 The Windows service entry cannot be created
+ 4 Could not connect to the Service Control Manager
+ 5 The MySQL service cannot be started
+ 6 The MySQL service cannot be stopped
+ 7 The security settings cannot be applied
+ 8 The configuration file cannot be written
+ 9 The Windows service entry cannot be removed
+
+ You can perform an installation of MySQL automatically using the
+ MSI packe. For more information, see Section 2.5.3.2, "Installing
+ MySQL Automatically using MSI."
- 2. From the work directory, copy into the C:\mysql directory the
- following directories:
-C:\> cd \workdir
-C:\workdir> copy client_release\*.exe C:\mysql\bin
-C:\workdir> copy client_debug\mysqld.exe C:\mysql\bin\mysqld-debug.ex
-e
-C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
-C:\workdir> xcopy share\*.* C:\mysql\share /E
- If you want to compile other clients and link them to MySQL,
- you should also copy several libraries and header files:
-C:\workdir> copy lib_debug\mysqlclient.lib C:\mysql\lib\debug
-C:\workdir> copy lib_debug\libmysql.* C:\mysql\lib\debug
-C:\workdir> copy lib_debug\zlib.* C:\mysql\lib\debug
-C:\workdir> copy lib_release\mysqlclient.lib C:\mysql\lib\opt
-C:\workdir> copy lib_release\libmysql.* C:\mysql\lib\opt
-C:\workdir> copy lib_release\zlib.* C:\mysql\lib\opt
-C:\workdir> copy include\*.h C:\mysql\include
-C:\workdir> copy libmysql\libmysql.def C:\mysql\include
- If you want to benchmark MySQL, you should also do this:
-C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
+2.5.5. Installing MySQL from a noinstall Zip Archive
- After installation, set up and start the server in the same way as
- for binary Windows distributions. See Section 2.3, "Installing
- MySQL on Windows."
+ Users who are installing from the noinstall package can use the
+ instructions in this section to manually install MySQL. The
+ process for installing MySQL from a Zip archive is as follows:
-2.10.7. Compiling MySQL Clients on Windows
+ 1. Extract the archive to the desired install directory
- In your source files, you should include my_global.h before
- mysql.h:
-#include <my_global.h>
-#include <mysql.h>
+ 2. Create an option file
+
+ 3. Choose a MySQL server type
- my_global.h includes any other files needed for Windows
- compatibility (such as windows.h) if you compile your program on
- Windows.
+ 4. Start the MySQL server
- You can either link your code with the dynamic libmysql.lib
- library, which is just a wrapper to load in libmysql.dll on
- demand, or link with the static mysqlclient.lib library.
+ 5. Secure the default user accounts
- The MySQL client libraries are compiled as threaded libraries, so
- you should also compile your code to be multi-threaded.
+ This process is described in the sections that follow.
-2.11. Post-Installation Setup and Testing
+2.5.5.1. Extracting the Install Archive
- After installing MySQL, there are some issues that you should
- address. For example, on Unix, you should initialize the data
- directory and create the MySQL grant tables. On all platforms, an
- important security concern is that the initial accounts in the
- grant tables have no passwords. You should assign passwords to
- prevent unauthorized access to the MySQL server. Optionally, you
- can create time zone tables to enable recognition of named time
- zones.
+ To install MySQL manually, do the following:
- The following sections include post-installation procedures that
- are specific to Windows systems and to Unix systems. Another
- section, Section 2.11.2.3, "Starting and Troubleshooting the MySQL
- Server," applies to all platforms; it describes what to do if you
- have trouble getting the server to start. Section 2.11.3,
- "Securing the Initial MySQL Accounts," also applies to all
- platforms. You should follow its instructions to make sure that
- you have properly protected your MySQL accounts by assigning
- passwords to them.
+ 1. If you are upgrading from a previous version please refer to
+ Section 2.5.7, "Upgrading MySQL on Windows," before beginning
+ the upgrade process.
- When you are ready to create additional user accounts, you can
- find information on the MySQL access control system and account
- management in Section 5.4, "The MySQL Access Privilege System,"
- and Section 5.5, "MySQL User Account Management."
+ 2. Make sure that you are logged in as a user with administrator
+ privileges.
-2.11.1. Windows Post-Installation Procedures
+ 3. Choose an installation location. Traditionally, the MySQL
+ server is installed in C:\mysql. The MySQL Installation Wizard
+ installs MySQL under C:\Program Files\MySQL. If you do not
+ install MySQL at C:\mysql, you must specify the path to the
+ install directory during startup or in an option file. See
+ Section 2.5.5.2, "Creating an Option File."
- On Windows, the data directory and the grant tables do not have to
- be created. MySQL Windows distributions include the grant tables
- with a set of preinitialized accounts in the mysql database under
- the data directory. It is unnecessary to run the mysql_install_db
- script that is used on Unix. Regarding passwords, if you installed
- MySQL using the Windows Installation Wizard, you may have already
- assigned passwords to the accounts. (See Section 2.3.3, "Using the
- MySQL Installation Wizard.") Otherwise, use the
- password-assignment procedure given in Section 2.11.3, "Securing
- the Initial MySQL Accounts."
+ 4. Extract the install archive to the chosen installation
+ location using your preferred Zip archive tool. Some tools may
+ extract the archive to a folder within your chosen
+ installation location. If this occurs, you can move the
+ contents of the subfolder into the chosen installation
+ location.
- Before setting up passwords, you might want to try running some
- client programs to make sure that you can connect to the server
- and that it is operating properly. Make sure that the server is
- running (see Section 2.3.9, "Starting the Server for the First
- Time"), and then issue the following commands to verify that you
- can retrieve information from the server. The output should be
- similar to what is shown here:
-C:\> C:\mysql\bin\mysqlshow
-+--------------------+
-| Databases |
-+--------------------+
-| information_schema |
-| mysql |
-| test |
-+--------------------+
+2.5.5.2. Creating an Option File
-C:\> C:\mysql\bin\mysqlshow mysql
-Database: mysql
-+---------------------------+
-| Tables |
-+---------------------------+
-| columns_priv |
-| db |
-| event |
-| func |
-| general_log |
-| help_category |
-| help_keyword |
-| help_relation |
-| help_topic |
-| host |
-| plugin |
-| proc |
-| procs_priv |
-| servers |
-| slow_log |
-| tables_priv |
-| time_zone |
-| time_zone_leap_second |
-| time_zone_name |
-| time_zone_transition |
-| time_zone_transition_type |
-| user |
-+---------------------------+
+ If you need to specify startup options when you run the server,
+ you can indicate them on the command line or place them in an
+ option file. For options that are used every time the server
+ starts, you may find it most convenient to use an option file to
+ specify your MySQL configuration. This is particularly true under
+ the following circumstances:
+ * The installation or data directory locations are different
+ from the default locations (C:\Program Files\MySQL\MySQL
+ Server 5.1 and C:\Program Files\MySQL\MySQL Server 5.1\data).
-C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
-+------+-------+------+
-| host | db | user |
-+------+-------+------+
-| % | test% | |
-+------+-------+------+
+ * You need to tune the server settings, such as memory, cache,
+ or InnoDB configuration information.
- You may need to specify a different directory from the one shown;
- if you used the Windows Installation Wizard, then the default
- directory is C:\Program Files\MySQL\MySQL Server 5.1, and the
- mysql and mysqlshow client programs are in C:\Program
- Files\MySQL\MySQL Server 5.1\bin. See Section 2.3.3, "Using the
- MySQL Installation Wizard," for more information.
+ When the MySQL server starts on Windows, it looks for option files
+ in several locations, such as the Windows directory, C:\, and the
+ MySQL installation directory (for the full list of locations, see
+ Section 4.2.3.3, "Using Option Files"). The Windows directory
+ typically is named something like C:\WINDOWS. You can determine
+ its exact location from the value of the WINDIR environment
+ variable using the following command:
+C:\> echo %WINDIR%
- If you have already secured the initial MySQL accounts, you may
- need to use the -u and -p options to supply a user name and
- password to the mysqlshow and mysql client programs; otherwise the
- programs may fail with an error, or you may not be able to view
- all databases. For example, if you have assigned the password
- "secretpass" to the MySQL root account, then you can invoke
- mysqlshow and mysql as shown here:
-C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass
-+--------------------+
-| Databases |
-+--------------------+
-| information_schema |
-| mysql |
-| test |
-+--------------------+
+ MySQL looks for options in each location first in the my.ini file,
+ and then in the my.cnf file. However, to avoid confusion, it is
+ best if you use only one file. If your PC uses a boot loader where
+ C: is not the boot drive, your only option is to use the my.ini
+ file. Whichever option file you use, it must be a plain text file.
-C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
-Database: mysql
-+---------------------------+
-| Tables |
-+---------------------------+
-| columns_priv |
-| db |
-| event |
-| func |
-| general_log |
-| help_category |
-| help_keyword |
-| help_relation |
-| help_topic |
-| host |
-| plugin |
-| proc |
-| procs_priv |
-| servers |
-| slow_log |
-| tables_priv |
-| time_zone |
-| time_zone_leap_second |
-| time_zone_name |
-| time_zone_transition |
-| time_zone_transition_type |
-| user |
-+---------------------------+
+ You can also make use of the example option files included with
+ your MySQL distribution; see Section 4.2.3.3.2, "Preconfigured
+ Option Files."
+ An option file can be created and modified with any text editor,
+ such as Notepad. For example, if MySQL is installed in E:\mysql
+ and the data directory is in E:\mydata\data, you can create an
+ option file containing a [mysqld] section to specify values for
+ the basedir and datadir options:
+[mysqld]
+# set basedir to your installation path
+basedir=E:/mysql
+# set datadir to the location of your data directory
+datadir=E:/mydata/data
-C:\> C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User F
-ROM db" mysql
-+------+-------+------+
-| host | db | user |
-+------+-------+------+
-| % | test% | |
-+------+-------+------+
+ Note that Windows path names are specified in option files using
+ (forward) slashes rather than backslashes. If you do use
+ backslashes, double them:
+[mysqld]
+# set basedir to your installation path
+basedir=E:\\mysql
+# set datadir to the location of your data directory
+datadir=E:\\mydata\\data
- For more information about these programs, see Section 4.5.6,
- "mysqlshow --- Display Database, Table, and Column Information,"
- and Section 4.5.1, "mysql --- The MySQL Command-Line Tool."
+ The rules for use of backslash in option file values are given in
+ Section 4.2.3.3, "Using Option Files."
- If you are running a version of Windows that supports services and
- you want the MySQL server to run automatically when Windows
- starts, see Section 2.3.11, "Starting MySQL as a Windows Service."
+ MySQL Enterprise For expert advice on the start-up options
+ appropriate to your circumstances, subscribe to the MySQL
+ Enterprise Monitor. For more information, see
+ http://www.mysql.com/products/enterprise/advisors.html.
-2.11.2. Unix Post-Installation Procedures
+ In MySQL 5.1.23 and earlier, the MySQL installer places the data
+ directory directly under the directory where you install MySQL. On
+ MySQL 5.1.24 and later, the data directory is located within the
+ AppData directory for the user running MySQL.
- After installing MySQL on Unix, you need to initialize the grant
- tables, start the server, and make sure that the server works
- satisfactorily. You may also wish to arrange for the server to be
- started and stopped automatically when your system starts and
- stops. You should also assign passwords to the accounts in the
- grant tables.
+ If you would like to use a data directory in a different location,
+ you should copy the entire contents of the data directory to the
+ new location. For example, if you want to use E:\mydata as the
+ data directory instead, you must do two things:
- On Unix, the grant tables are set up by the mysql_install_db
- program. For some installation methods, this program is run for
- you automatically:
+ 1. Move the entire data directory and all of its contents from
+ the default location (for example C:\Program Files\MySQL\MySQL
+ Server 5.1\data) to E:\mydata.
- * If you install MySQL on Linux using RPM distributions, the
- server RPM runs mysql_install_db.
+ 2. Use a --datadir option to specify the new data directory
+ location each time you start the server.
- * If you install MySQL on Mac OS X using a PKG distribution, the
- installer runs mysql_install_db.
+2.5.5.3. Selecting a MySQL Server Type
- Otherwise, you'll need to run mysql_install_db yourself.
+ The following table shows the available servers for Windows in
+ MySQL 5.1.20 and earlier.
+ Binary Description
+ mysqld-nt Optimized binary with named-pipe support
+ mysqld Optimized binary without named-pipe support
+ mysqld-debug Like mysqld-nt, but compiled with full debugging and
+ automatic memory allocation checking
- The following procedure describes how to initialize the grant
- tables (if that has not previously been done) and then start the
- server. It also suggests some commands that you can use to test
- whether the server is accessible and working properly. For
- information about starting and stopping the server automatically,
- see Section 2.11.2.2, "Starting and Stopping MySQL Automatically."
+ The following table shows the available servers for Windows in
+ MySQL 5.1.21 and later.
+ Binary Description
+ mysqld Optimized binary with named-pipe support
+ mysqld-debug Like mysqld, but compiled with full debugging and
+ automatic memory allocation checking
- After you complete the procedure and have the server running, you
- should assign passwords to the accounts created by
- mysql_install_db. Instructions for doing so are given in Section
- 2.11.3, "Securing the Initial MySQL Accounts."
+ All of the preceding binaries are optimized for modern Intel
+ processors, but should work on any Intel i386-class or higher
+ processor.
- In the examples shown here, the server runs under the user ID of
- the mysql login account. This assumes that such an account exists.
- Either create the account if it does not exist, or substitute the
- name of a different existing login account that you plan to use
- for running the server.
+ Each of the servers in a distribution support the same set of
+ storage engines. The SHOW ENGINES statement displays which engines
+ a given server supports.
- 1. Change location into the top-level directory of your MySQL
- installation, represented here by BASEDIR:
-shell> cd BASEDIR
- BASEDIR is likely to be something like /usr/local/mysql or
- /usr/local. The following steps assume that you are located in
- this directory.
+ All Windows MySQL 5.1 servers have support for symbolic linking of
+ database directories.
- 2. If necessary, run the mysql_install_db program to set up the
- initial MySQL grant tables containing the privileges that
- determine how users are allowed to connect to the server.
- You'll need to do this if you used a distribution type for
- which the installation procedure doesn't run the program for
- you.
- Typically, mysql_install_db needs to be run only the first
- time you install MySQL, so you can skip this step if you are
- upgrading an existing installation, However, mysql_install_db
- does not overwrite any existing privilege tables, so it should
- be safe to run in any circumstances.
- To initialize the grant tables, use one of the following
- commands, depending on whether mysql_install_db is located in
- the bin or scripts directory:
-shell> bin/mysql_install_db --user=mysql
-shell> scripts/mysql_install_db --user=mysql
- It might be necessary to specify other options such as
- --basedir or --datadir if mysql_install_db does not use the
- correct locations for the installation directory or data
- directory. For example:
-shell> bin/mysql_install_db --user=mysql \
- --basedir=/opt/mysql/mysql \
- --datadir=/opt/mysql/mysql/data
- The mysql_install_db script creates the server's data
- directory. Under the data directory, it creates directories
- for the mysql database that holds all database privileges and
- the test database that you can use to test MySQL. The script
- also creates privilege table entries for root and
- anonymous-user accounts. The accounts have no passwords
- initially. A description of their initial privileges is given
- in Section 2.11.3, "Securing the Initial MySQL Accounts."
- Briefly, these privileges allow the MySQL root user to do
- anything, and allow anybody to create or use databases with a
- name of test or starting with test_.
- It is important to make sure that the database directories and
- files are owned by the mysql login account so that the server
- has read and write access to them when you run it later. To
- ensure this, the --user option should be used as shown if you
- run mysql_install_db as root. Otherwise, you should execute
- the script while logged in as mysql, in which case you can
- omit the --user option from the command.
- mysql_install_db creates several tables in the mysql database,
- including user, db, host, tables_priv, columns_priv, func, and
- others. See Section 5.4, "The MySQL Access Privilege System,"
- for a complete listing and description of these tables.
- If you don't want to have the test database, you can remove it
- with mysqladmin -u root drop test after starting the server.
- If you have trouble with mysql_install_db at this point, see
- Section 2.11.2.1, "Problems Running mysql_install_db."
+ MySQL supports TCP/IP on all Windows platforms. MySQL servers on
+ Windows support named pipes as indicated in the following list.
+ However, the default is to use TCP/IP regardless of platform.
+ (Named pipes are slower than TCP/IP in many Windows
+ configurations.)
- 3. Start the MySQL server:
-shell> bin/mysqld_safe --user=mysql &
- It is important that the MySQL server be run using an
- unprivileged (non-root) login account. To ensure this, the
- --user option should be used as shown if you run mysqld_safe
- as system root. Otherwise, you should execute the script while
- logged in to the system as mysql, in which case you can omit
- the --user option from the command.
- Further instructions for running MySQL as an unprivileged user
- are given in Section 5.3.5, "How to Run MySQL as a Normal
- User."
- If you neglected to create the grant tables before proceeding
- to this step, the following message appears in the error log
- file when you start the server:
-mysqld: Can't find file: 'host.frm'
- If you have other problems starting the server, see Section
- 2.11.2.3, "Starting and Troubleshooting the MySQL Server."
+ Use of named pipes is subject to these conditions:
- 4. Use mysqladmin to verify that the server is running. The
- following commands provide simple tests to check whether the
- server is up and responding to connections:
-shell> bin/mysqladmin version
-shell> bin/mysqladmin variables
- The output from mysqladmin version varies slightly depending
- on your platform and version of MySQL, but should be similar
- to that shown here:
-shell> bin/mysqladmin version
-mysqladmin Ver 14.12 Distrib 5.1.39, for pc-linux-gnu on i686
-...
+ * Named pipes are enabled only if you start the server with the
+ --enable-named-pipe option. It is necessary to use this option
+ explicitly because some users have experienced problems with
+ shutting down the MySQL server when named pipes were used.
-Server version 5.1.39
-Protocol version 10
-Connection Localhost via UNIX socket
-UNIX socket /var/lib/mysql/mysql.sock
-Uptime: 14 days 5 hours 5 min 21 sec
+ * For MySQL 5.1.20 and earlier, named-pipe connections are
+ allowed only by the mysqld-nt and mysqld-debug servers. For
+ MySQL 5.1.21 and later, the mysqld and mysqld-debug servers
+ both contain support for named-pipe connections.
-Threads: 1 Questions: 366 Slow queries: 0
-Opens: 0 Flush tables: 1 Open tables: 19
-Queries per second avg: 0.000
- To see what else you can do with mysqladmin, invoke it with
- the --help option.
+Note
- 5. Verify that you can shut down the server:
-shell> bin/mysqladmin -u root shutdown
+ Most of the examples in this manual use mysqld as the server name.
+ If you choose to use a different server, such as mysqld-nt or
+ mysqld-debug, make the appropriate substitutions in the commands
+ that are shown in the examples.
- 6. Verify that you can start the server again. Do this by using
- mysqld_safe or by invoking mysqld directly. For example:
-shell> bin/mysqld_safe --user=mysql --log &
- If mysqld_safe fails, see Section 2.11.2.3, "Starting and
- Troubleshooting the MySQL Server."
+2.5.5.4. Starting the Server for the First Time
- 7. Run some simple tests to verify that you can retrieve
- information from the server. The output should be similar to
- what is shown here:
-shell> bin/mysqlshow
-+-----------+
-| Databases |
-+-----------+
-| mysql |
-| test |
-+-----------+
+ This section gives a general overview of starting the MySQL
+ server. The following sections provide more specific information
+ for starting the MySQL server from the command line or as a
+ Windows service.
-shell> bin/mysqlshow mysql
-Database: mysql
-+---------------------------+
-| Tables |
-+---------------------------+
-| columns_priv |
-| db |
-| func |
-| help_category |
-| help_keyword |
-| help_relation |
-| help_topic |
-| host |
-| proc |
-| procs_priv |
-| tables_priv |
-| time_zone |
-| time_zone_leap_second |
-| time_zone_name |
-| time_zone_transition |
-| time_zone_transition_type |
-| user |
-+---------------------------+
+ The information here applies primarily if you installed MySQL
+ using the Noinstall version, or if you wish to configure and test
+ MySQL manually rather than with the GUI tools.
-shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
-+------+--------+------+
-| host | db | user |
-+------+--------+------+
-| % | test | |
-| % | test_% | |
-+------+--------+------+
+ The examples in these sections assume that MySQL is installed
+ under the default location of C:\Program Files\MySQL\MySQL Server
+ 5.1. Adjust the path names shown in the examples if you have MySQL
+ installed in a different location.
- 8. There is a benchmark suite in the sql-bench directory (under
- the MySQL installation directory) that you can use to compare
- how MySQL performs on different platforms. The benchmark suite
- is written in Perl. It requires the Perl DBI module that
- provides a database-independent interface to the various
- databases, and some other additional Perl modules:
-DBI
-DBD::mysql
-Data::Dumper
-Data::ShowTable
- These modules can be obtained from CPAN
- (http://www.cpan.org/) See also Section 2.15.1, "Installing
- Perl on Unix."
- The sql-bench/Results directory contains the results from many
- runs against different databases and platforms. To run all
- tests, execute these commands:
-shell> cd sql-bench
-shell> perl run-all-tests
- If you don't have the sql-bench directory, you probably
- installed MySQL using RPM files other than the source RPM.
- (The source RPM includes the sql-bench benchmark directory.)
- In this case, you must first install the benchmark suite
- before you can use it. There are separate benchmark RPM files
- named mysql-bench-VERSION.i386.rpm that contain benchmark code
- and data.
- If you have a source distribution, there are also tests in its
- tests subdirectory that you can run. For example, to run
- auto_increment.tst, execute this command from the top-level
- directory of your source distribution:
-shell> mysql -vvf test < ./tests/auto_increment.tst
- The expected result of the test can be found in the
- ./tests/auto_increment.res file.
+ Clients have two options. They can use TCP/IP, or they can use a
+ named pipe if the server supports named-pipe connections.
- 9. At this point, you should have the server running. However,
- none of the initial MySQL accounts have a password, so you
- should assign passwords using the instructions found in
- Section 2.11.3, "Securing the Initial MySQL Accounts."
+ MySQL for Windows also supports shared-memory connections if the
+ server is started with the --shared-memory option. Clients can
+ connect through shared memory by using the --protocol=MEMORY
+ option.
- The MySQL 5.1 installation procedure creates time zone tables in
- the mysql database. However, you must populate the tables manually
- using the instructions in Section 9.7, "MySQL Server Time Zone
- Support."
+ For information about which server binary to run, see Section
+ 2.5.5.3, "Selecting a MySQL Server Type."
-2.11.2.1. Problems Running mysql_install_db
+ Testing is best done from a command prompt in a console window (or
+ "DOS window"). In this way you can have the server display status
+ messages in the window where they are easy to see. If something is
+ wrong with your configuration, these messages make it easier for
+ you to identify and fix any problems.
- The purpose of the mysql_install_db script is to generate new
- MySQL privilege tables. It does not overwrite existing MySQL
- privilege tables, and it does not affect any other data.
+ To start the server, enter this command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
- If you want to re-create your privilege tables, first stop the
- mysqld server if it is running. Then rename the mysql directory
- under the data directory to save it, and then run
- mysql_install_db. Suppose that your current directory is the MySQL
- installation directory and that mysql_install_db is located in the
- bin directory and the data directory is named data. To rename the
- mysql database and re-run mysql_install_db, use these commands.
-shell> mv data/mysql data/mysql.old
-shell> bin/mysql_install_db --user=mysql
+ For a server that includes InnoDB support, you should see the
+ messages similar to those following as it starts (the path names
+ and sizes may differ):
+InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
+InnoDB: a new database to be created!
+InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
+InnoDB: Database physically writes the file full: wait...
+InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat
+ed
+InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
+InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat
+ed
+InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
+InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat
+ed
+InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
+InnoDB: Doublewrite buffer not found: creating new
+InnoDB: Doublewrite buffer created
+InnoDB: creating foreign key constraint system tables
+InnoDB: foreign key constraint system tables created
+011024 10:58:25 InnoDB: Started
- When you run mysql_install_db, you might encounter the following
- problems:
+ When the server finishes its startup sequence, you should see
+ something like this, which indicates that the server is ready to
+ service client connections:
+mysqld: ready for connections
+Version: '5.1.41' socket: '' port: 3306
- * mysql_install_db fails to install the grant tables
- You may find that mysql_install_db fails to install the grant
- tables and terminates after displaying the following messages:
-Starting mysqld daemon with databases from XXXXXX
-mysqld ended
- In this case, you should examine the error log file very
- carefully. The log should be located in the directory XXXXXX
- named by the error message and should indicate why mysqld
- didn't start. If you do not understand what happened, include
- the log when you post a bug report. See Section 1.6, "How to
- Report Bugs or Problems."
+ The server continues to write to the console any further
+ diagnostic output it produces. You can open a new console window
+ in which to run client programs.
- * There is a mysqld process running
- This indicates that the server is running, in which case the
- grant tables have probably been created already. If so, there
- is no need to run mysql_install_db at all because it needs to
- be run only once (when you install MySQL the first time).
+ If you omit the --console option, the server writes diagnostic
+ output to the error log in the data directory (C:\Program
+ Files\MySQL\MySQL Server 5.1\data by default). The error log is
+ the file with the .err extension.
- * Installing a second mysqld server does not work when one
- server is running
- This can happen when you have an existing MySQL installation,
- but want to put a new installation in a different location.
- For example, you might have a production installation, but you
- want to create a second installation for testing purposes.
- Generally the problem that occurs when you try to run a second
- server is that it tries to use a network interface that is in
- use by the first server. In this case, you should see one of
- the following error messages:
-Can't start server: Bind on TCP/IP port:
-Address already in use
-Can't start server: Bind on unix socket...
- For instructions on setting up multiple servers, see Section
- 5.6, "Running Multiple MySQL Servers on the Same Machine."
+Note
- * You do not have write access to the /tmp directory
- If you do not have write access to create temporary files or a
- Unix socket file in the default location (the /tmp directory),
- an error occurs when you run mysql_install_db or the mysqld
- server.
- You can specify different locations for the temporary
- directory and Unix socket file by executing these commands
- prior to starting mysql_install_db or mysqld, where
- some_tmp_dir is the full path name to some directory for which
- you have write permission:
-shell> TMPDIR=/some_tmp_dir/
-shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock
-shell> export TMPDIR MYSQL_UNIX_PORT
- Then you should be able to run mysql_install_db and start the
- server with these commands:
-shell> bin/mysql_install_db --user=mysql
-shell> bin/mysqld_safe --user=mysql &
- If mysql_install_db is located in the scripts directory,
- modify the first command to scripts/mysql_install_db.
- See Section B.1.4.5, "How to Protect or Change the MySQL Unix
- Socket File," and Section 2.14, "Environment Variables."
+ The accounts that are listed in the MySQL grant tables initially
+ have no passwords. After starting the server, you should set up
+ passwords for them using the instructions in Section 2.13,
+ "Post-Installation Setup and Testing."
- There are some alternatives to running the mysql_install_db script
- provided in the MySQL distribution:
+2.5.5.5. Starting MySQL from the Windows Command Line
- * If you want the initial privileges to be different from the
- standard defaults, you can modify mysql_install_db before you
- run it. However, it is preferable to use GRANT and REVOKE to
- change the privileges after the grant tables have been set up.
- In other words, you can run mysql_install_db, and then use
- mysql -u root mysql to connect to the server as the MySQL root
- user so that you can issue the necessary GRANT and REVOKE
- statements.
- If you want to install MySQL on several machines with the same
- privileges, you can put the GRANT and REVOKE statements in a
- file and execute the file as a script using mysql after
- running mysql_install_db. For example:
-shell> bin/mysql_install_db --user=mysql
-shell> bin/mysql -u root < your_script_file
- By doing this, you can avoid having to issue the statements
- manually on each machine.
+ The MySQL server can be started manually from the command line.
+ This can be done on any version of Windows.
- * It is possible to re-create the grant tables completely after
- they have previously been created. You might want to do this
- if you're just learning how to use GRANT and REVOKE and have
- made so many modifications after running mysql_install_db that
- you want to wipe out the tables and start over.
- To re-create the grant tables, remove all the .frm, .MYI, and
- .MYD files in the mysql database directory. Then run the
- mysql_install_db script again.
+ To start the mysqld server from the command line, you should start
+ a console window (or "DOS window") and enter this command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
- * You can start mysqld manually using the --skip-grant-tables
- option and add the privilege information yourself using mysql:
-shell> bin/mysqld_safe --user=mysql --skip-grant-tables &
-shell> bin/mysql mysql
- From mysql, manually execute the SQL commands contained in
- mysql_install_db. Make sure that you run mysqladmin
- flush-privileges or mysqladmin reload afterward to tell the
- server to reload the grant tables.
- Note that by not using mysql_install_db, you not only have to
- populate the grant tables manually, you also have to create
- them first.
+ The path to mysqld may vary depending on the install location of
+ MySQL on your system.
-2.11.2.2. Starting and Stopping MySQL Automatically
+ You can stop the MySQL server by executing this command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
+ shutdown
- Generally, you start the mysqld server in one of these ways:
+Note
- * Invoke mysqld directly. This works on any platform.
+ If the MySQL root user account has a password, you need to invoke
+ mysqladmin with the -p option and supply the password when
+ prompted.
- * Run the MySQL server as a Windows service. The service can be
- set to start the server automatically when Windows starts, or
- as a manual service that you start on request. For
- instructions, see Section 2.3.11, "Starting MySQL as a Windows
- Service."
+ This command invokes the MySQL administrative utility mysqladmin
+ to connect to the server and tell it to shut down. The command
+ connects as the MySQL root user, which is the default
+ administrative account in the MySQL grant system. Note that users
+ in the MySQL grant system are wholly independent from any login
+ users under Windows.
- * Invoke mysqld_safe, which tries to determine the proper
- options for mysqld and then runs it with those options. This
- script is used on Unix and Unix-like systems. See Section
- 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
+ If mysqld doesn't start, check the error log to see whether the
+ server wrote any messages there to indicate the cause of the
+ problem. The error log is located in the C:\Program
+ Files\MySQL\MySQL Server 5.1\data directory. It is the file with a
+ suffix of .err. You can also try to start the server as mysqld
+ --console; in this case, you may get some useful information on
+ the screen that may help solve the problem.
- * Invoke mysql.server. This script is used primarily at system
- startup and shutdown on systems that use System V-style run
- directories, where it usually is installed under the name
- mysql. The mysql.server script starts the server by invoking
- mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server
- Startup Script."
+ The last option is to start mysqld with the --standalone and
+ --debug options. In this case, mysqld writes a log file
+ C:\mysqld.trace that should contain the reason why mysqld doesn't
+ start. See MySQL Internals: Porting
+ (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
- * On Mac OS X, install a separate MySQL Startup Item package to
- enable the automatic startup of MySQL on system startup. The
- Startup Item starts the server by invoking mysql.server. See
- Section 2.5, "Installing MySQL on Mac OS X," for details.
+ Use mysqld --verbose --help to display all the options that mysqld
+ supports.
- The mysqld_safe and mysql.server scripts and the Mac OS X Startup
- Item can be used to start the server manually, or automatically at
- system startup time. mysql.server and the Startup Item also can be
- used to stop the server.
+2.5.5.6. Starting MySQL as a Windows Service
- To start or stop the server manually using the mysql.server
- script, invoke it with start or stop arguments:
-shell> mysql.server start
-shell> mysql.server stop
+ On Windows, the recommended way to run MySQL is to install it as a
+ Windows service, whereby MySQL starts and stops automatically when
+ Windows starts and stops. A MySQL server installed as a service
+ can also be controlled from the command line using NET commands,
+ or with the graphical Services utility. Generally, to install
+ MySQL as a Windows service you should be logged in using an
+ account that has administrator rights.
- Before mysql.server starts the server, it changes location to the
- MySQL installation directory, and then invokes mysqld_safe. If you
- want the server to run as some specific user, add an appropriate
- user option to the [mysqld] group of the /etc/my.cnf option file,
- as shown later in this section. (It is possible that you will need
- to edit mysql.server if you've installed a binary distribution of
- MySQL in a nonstandard location. Modify it to change location into
- the proper directory before it runs mysqld_safe. If you do this,
- your modified version of mysql.server may be overwritten if you
- upgrade MySQL in the future, so you should make a copy of your
- edited version that you can reinstall.)
+ The Services utility (the Windows Service Control Manager) can be
+ found in the Windows Control Panel (under Administrative Tools on
+ Windows 2000, XP, Vista and Server 2003). To avoid conflicts, it
+ is advisable to close the Services utility while performing server
+ installation or removal operations from the command line.
- mysql.server stop stops the server by sending a signal to it. You
- can also stop the server manually by executing mysqladmin
- shutdown.
+ Before installing MySQL as a Windows service, you should first
+ stop the current server if it is running by using the following
+ command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
+ -u root shutdown
- To start and stop MySQL automatically on your server, you need to
- add start and stop commands to the appropriate places in your
- /etc/rc* files.
+Note
- If you use the Linux server RPM package
- (MySQL-server-VERSION.rpm), the mysql.server script is installed
- in the /etc/init.d directory with the name mysql. You need not
- install it manually. See Section 2.4, "Installing MySQL from RPM
- Packages on Linux," for more information on the Linux RPM
- packages.
+ If the MySQL root user account has a password, you need to invoke
+ mysqladmin with the -p option and supply the password when
+ prompted.
- Some vendors provide RPM packages that install a startup script
- under a different name such as mysqld.
+ This command invokes the MySQL administrative utility mysqladmin
+ to connect to the server and tell it to shut down. The command
+ connects as the MySQL root user, which is the default
+ administrative account in the MySQL grant system. Note that users
+ in the MySQL grant system are wholly independent from any login
+ users under Windows.
- If you install MySQL from a source distribution or using a binary
- distribution format that does not install mysql.server
- automatically, you can install it manually. The script can be
- found in the support-files directory under the MySQL installation
- directory or in a MySQL source tree.
+ Install the server as a service using this command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
- To install mysql.server manually, copy it to the /etc/init.d
- directory with the name mysql, and then make it executable. Do
- this by changing location into the appropriate directory where
- mysql.server is located and executing these commands:
-shell> cp mysql.server /etc/init.d/mysql
-shell> chmod +x /etc/init.d/mysql
+ The service-installation command does not start the server.
+ Instructions for that are given later in this section.
- Older Red Hat systems use the /etc/rc.d/init.d directory rather
- than /etc/init.d. Adjust the preceding commands accordingly.
- Alternatively, first create /etc/init.d as a symbolic link that
- points to /etc/rc.d/init.d:
-shell> cd /etc
-shell> ln -s rc.d/init.d .
+ To make it easier to invoke MySQL programs, you can add the path
+ name of the MySQL bin directory to your Windows system PATH
+ environment variable:
- After installing the script, the commands needed to activate it to
- run at system startup depend on your operating system. On Linux,
- you can use chkconfig:
-shell> chkconfig --add mysql
+ * On the Windows desktop, right-click on the My Computer icon,
+ and select Properties.
- On some Linux systems, the following command also seems to be
- necessary to fully enable the mysql script:
-shell> chkconfig --level 345 mysql on
+ * Next select the Advanced tab from the System Properties menu
+ that appears, and click the Environment Variables button.
- On FreeBSD, startup scripts generally should go in
- /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in
- this directory are executed only if their basename matches the
- *.sh shell file name pattern. Any other files or directories
- present within the directory are silently ignored. In other words,
- on FreeBSD, you should install the mysql.server script as
- /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup.
+ * Under System Variables, select Path, and then click the Edit
+ button. The Edit System Variable dialogue should appear.
- As an alternative to the preceding setup, some operating systems
- also use /etc/rc.local or /etc/init.d/boot.local to start
- additional services on startup. To start up MySQL using this
- method, you could append a command like the one following to the
- appropriate startup file:
-/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
+ * Place your cursor at the end of the text appearing in the
+ space marked Variable Value. (Use the End key to ensure that
+ your cursor is positioned at the very end of the text in this
+ space.) Then enter the complete path name of your MySQL bin
+ directory (for example, C:\Program Files\MySQL\MySQL Server
+ 5.1\bin), Note that there should be a semicolon separating
+ this path from any values present in this field. Dismiss this
+ dialogue, and each dialogue in turn, by clicking OK until all
+ of the dialogues that were opened have been dismissed. You
+ should now be able to invoke any MySQL executable program by
+ typing its name at the DOS prompt from any directory on the
+ system, without having to supply the path. This includes the
+ servers, the mysql client, and all MySQL command-line
+ utilities such as mysqladmin and mysqldump.
+ You should not add the MySQL bin directory to your Windows
+ PATH if you are running multiple MySQL servers on the same
+ machine.
- For other systems, consult your operating system documentation to
- see how to install startup scripts.
+Warning
- You can add options for mysql.server in a global /etc/my.cnf file.
- A typical /etc/my.cnf file might look like this:
-[mysqld]
-datadir=/usr/local/mysql/var
-socket=/var/tmp/mysql.sock
-port=3306
-user=mysql
+ You must exercise great care when editing your system PATH by
+ hand; accidental deletion or modification of any portion of the
+ existing PATH value can leave you with a malfunctioning or even
+ unusable system.
-[mysql.server]
-basedir=/usr/local/mysql
+ The following additional arguments can be used in MySQL 5.1 when
+ installing the service:
- The mysql.server script supports the following options: basedir,
- datadir, and pid-file. If specified, they must be placed in an
- option file, not on the command line. mysql.server supports only
- start and stop as command-line arguments.
+ * You can specify a service name immediately following the
+ --install option. The default service name is MySQL.
- The following table shows which option groups the server and each
- startup script read from option files.
- Script Option Groups
- mysqld [mysqld], [server], [mysqld-major_version]
- mysqld_safe [mysqld], [server], [mysqld_safe]
- mysql.server [mysqld], [mysql.server], [server]
+ * If a service name is given, it can be followed by a single
+ option. By convention, this should be
+ --defaults-file=file_name to specify the name of an option
+ file from which the server should read options when it starts.
+ The use of a single option other than --defaults-file is
+ possible but discouraged. --defaults-file is more flexible
+ because it enables you to specify multiple startup options for
+ the server by placing them in the named option file.
- [mysqld-major_version] means that groups with names like
- [mysqld-5.0] and [mysqld-5.1] are read by servers having versions
- 5.0.x, 5.1.x, and so forth. This feature can be used to specify
- options that can be read only by servers within a given release
- series.
+ * You can also specify a --local-service option following the
+ service name. This causes the server to run using the
+ LocalService Windows account that has limited system
+ privileges. This account is available only for Windows XP or
+ newer. If both --defaults-file and --local-service are given
+ following the service name, they can be in any order.
- For backward compatibility, mysql.server also reads the
- [mysql_server] group and mysqld_safe also reads the [safe_mysqld]
- group. However, you should update your option files to use the
- [mysql.server] and [mysqld_safe] groups instead when using MySQL
- 5.1.
+ For a MySQL server that is installed as a Windows service, the
+ following rules determine the service name and option files that
+ the server uses:
- See Section 4.2.3.3, "Using Option Files."
+ * If the service-installation command specifies no service name
+ or the default service name (MySQL) following the --install
+ option, the server uses the a service name of MySQL and reads
+ options from the [mysqld] group in the standard option files.
-2.11.2.3. Starting and Troubleshooting the MySQL Server
+ * If the service-installation command specifies a service name
+ other than MySQL following the --install option, the server
+ uses that service name. It reads options from the [mysqld]
+ group and the group that has the same name as the service in
+ the standard option files. This allows you to use the [mysqld]
+ group for options that should be used by all MySQL services,
+ and an option group with the service name for use by the
+ server installed with that service name.
- This section provides troubleshooting suggestions for problems
- starting the server on Unix. If you are using Windows, see Section
- 2.3.13, "Troubleshooting a MySQL Installation Under Windows."
+ * If the service-installation command specifies a
+ --defaults-file option after the service name, the server
+ reads options only from the [mysqld] group of the named file
+ and ignores the standard option files.
- If you have problems starting the server, here are some things to
- try:
+ As a more complex example, consider the following command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
+ --install MySQL --defaults-file=C:\my-opts.cnf
- * Check the error log to see why the server does not start.
+ Here, the default service name (MySQL) is given after the
+ --install option. If no --defaults-file option had been given,
+ this command would have the effect of causing the server to read
+ the [mysqld] group from the standard option files. However,
+ because the --defaults-file option is present, the server reads
+ options from the [mysqld] option group, and only from the named
+ file.
- * Specify any special options needed by the storage engines you
- are using.
+ You can also specify options as Start parameters in the Windows
+ Services utility before you start the MySQL service.
- * Make sure that the server knows where to find the data
- directory.
+ Once a MySQL server has been installed as a service, Windows
+ starts the service automatically whenever Windows starts. The
+ service also can be started immediately from the Services utility,
+ or by using a NET START MySQL command. The NET command is not case
+ sensitive.
- * Make sure that the server can access the data directory. The
- ownership and permissions of the data directory and its
- contents must be set such that the server can read and modify
- them.
+ When run as a service, mysqld has no access to a console window,
+ so no messages can be seen there. If mysqld does not start, check
+ the error log to see whether the server wrote any messages there
+ to indicate the cause of the problem. The error log is located in
+ the MySQL data directory (for example, C:\Program
+ Files\MySQL\MySQL Server 5.1\data). It is the file with a suffix
+ of .err.
- * Verify that the network interfaces the server wants to use are
- available.
+ When a MySQL server has been installed as a service, and the
+ service is running, Windows stops the service automatically when
+ Windows shuts down. The server also can be stopped manually by
+ using the Services utility, the NET STOP MySQL command, or the
+ mysqladmin shutdown command.
- Some storage engines have options that control their behavior. You
- can create a my.cnf file and specify startup options for the
- engines that you plan to use. If you are going to use storage
- engines that support transactional tables (InnoDB, NDB), be sure
- that you have them configured the way you want before starting the
- server:
+ You also have the choice of installing the server as a manual
+ service if you do not wish for the service to be started
+ automatically during the boot process. To do this, use the
+ --install-manual option rather than the --install option:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install-m
+anual
- * If you are using InnoDB tables, see Section 13.6.2, "InnoDB
- Configuration."
+ To remove a server that is installed as a service, first stop it
+ if it is running by executing NET STOP MySQL. Then use the
+ --remove option to remove it:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove
- * If you are using MySQL Cluster, see Section 17.3, "MySQL
- Cluster Configuration."
+ If mysqld is not running as a service, you can start it from the
+ command line. For instructions, see Section 2.5.5.5, "Starting
+ MySQL from the Windows Command Line."
- MySQL Enterprise For expert advice on start-up options appropriate
- to your circumstances, subscribe to The MySQL Enterprise Monitor.
- For more information, see
- http://www.mysql.com/products/enterprise/advisors.html.
+ Please see Section 2.5.6, "Troubleshooting a MySQL Installation
+ Under Windows," if you encounter difficulties during installation.
- Storage engines will use default option values if you specify
- none, but it is recommended that you review the available options
- and specify explicit values for those for which the defaults are
- not appropriate for your installation.
+2.5.5.7. Testing The MySQL Installation
- When the mysqld server starts, it changes location to the data
- directory. This is where it expects to find databases and where it
- expects to write log files. The server also writes the pid
- (process ID) file in the data directory.
+ You can test whether the MySQL server is working by executing any
+ of the following commands:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow"
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -u root
+mysql
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" version
+ status proc
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test
- The data directory location is hardwired in when the server is
- compiled. This is where the server looks for the data directory by
- default. If the data directory is located somewhere else on your
- system, the server will not work properly. You can determine what
- the default path settings are by invoking mysqld with the
- --verbose and --help options.
+Note
- If the default locations don't match the MySQL installation layout
- on your system, you can override them by specifying options to
- mysqld or mysqld_safe on the command line or in an option file.
+ By default, mysqlshow will try to connect using the ODBC user.
+ This user is not created by default. You should specify a valid
+ user, or root with the right password to check the operation of
+ the server.
- To specify the location of the data directory explicitly, use the
- --datadir option. However, normally you can tell mysqld the
- location of the base directory under which MySQL is installed and
- it looks for the data directory there. You can do this with the
- --basedir option.
+ If mysqld is slow to respond to TCP/IP connections from client
+ programs, there is probably a problem with your DNS. In this case,
+ start mysqld with the --skip-name-resolve option and use only
+ localhost and IP numbers in the Host column of the MySQL grant
+ tables.
- To check the effect of specifying path options, invoke mysqld with
- those options followed by the --verbose and --help options. For
- example, if you change location into the directory where mysqld is
- installed and then run the following command, it shows the effect
- of starting the server with a base directory of /usr/local:
-shell> ./mysqld --basedir=/usr/local --verbose --help
+ You can force a MySQL client to use a named-pipe connection rather
+ than TCP/IP by specifying the --pipe or --protocol=PIPE option, or
+ by specifying . (period) as the host name. Use the --socket option
+ to specify the name of the pipe if you do not want to use the
+ default pipe name.
- You can specify other options such as --datadir as well, but
- --verbose and --help must be the last options.
+ Note that if you have set a password for the root account, deleted
+ the anonymous account, or created a new user account, then you
+ must use the appropriate -u and -p options with the commands shown
+ above in order to connect with the MySQL Server. See Section
+ 4.2.2, "Connecting to the MySQL Server."
- Once you determine the path settings you want, start the server
- without --verbose and --help.
+ For more information about mysqlshow, see Section 4.5.6,
+ "mysqlshow --- Display Database, Table, and Column Information."
- If mysqld is currently running, you can find out what path
- settings it is using by executing this command:
-shell> mysqladmin variables
+2.5.6. Troubleshooting a MySQL Installation Under Windows
- Or:
-shell> mysqladmin -h host_name variables
+ When installing and running MySQL for the first time, you may
+ encounter certain errors that prevent the MySQL server from
+ starting. The purpose of this section is to help you diagnose and
+ correct some of these errors.
- host_name is the name of the MySQL server host.
+ Your first resource when troubleshooting server issues is the
+ error log. The MySQL server uses the error log to record
+ information relevant to the error that prevents the server from
+ starting. The error log is located in the data directory specified
+ in your my.ini file. The default data directory location is
+ C:\Program Files\MySQL\MySQL Server 5.1\data. See Section 5.2.2,
+ "The Error Log."
- If you get Errcode 13 (which means Permission denied) when
- starting mysqld, this means that the privileges of the data
- directory or its contents do not allow the server access. In this
- case, you change the permissions for the involved files and
- directories so that the server has the right to use them. You can
- also start the server as root, but this raises security issues and
- should be avoided.
+ Another source of information regarding possible errors is the
+ console messages displayed when the MySQL service is starting. Use
+ the NET START MySQL command from the command line after installing
+ mysqld as a service to see any error messages regarding the
+ starting of the MySQL server as a service. See Section 2.5.5.6,
+ "Starting MySQL as a Windows Service."
+
+ The following examples show other common error messages you may
+ encounter when installing MySQL and starting the server for the
+ first time:
- On Unix, change location into the data directory and check the
- ownership of the data directory and its contents to make sure the
- server has access. For example, if the data directory is
- /usr/local/mysql/var, use this command:
-shell> ls -la /usr/local/mysql/var
+ * If the MySQL server cannot find the mysql privileges database
+ or other critical files, you may see these messages:
+System error 1067 has occurred.
+Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't
+exist
+ These messages often occur when the MySQL base or data
+ directories are installed in different locations than the
+ default locations (C:\Program Files\MySQL\MySQL Server 5.1 and
+ C:\Program Files\MySQL\MySQL Server 5.1\data, respectively).
+ This situation may occur when MySQL is upgraded and installed
+ to a new location, but the configuration file is not updated
+ to reflect the new location. In addition, there may be old and
+ new configuration files that conflict. Be sure to delete or
+ rename any old configuration files when upgrading MySQL.
+ If you have installed MySQL to a directory other than
+ C:\Program Files\MySQL\MySQL Server 5.1, you need to ensure
+ that the MySQL server is aware of this through the use of a
+ configuration (my.ini) file. The my.ini file needs to be
+ located in your Windows directory, typically C:\WINDOWS. You
+ can determine its exact location from the value of the WINDIR
+ environment variable by issuing the following command from the
+ command prompt:
+C:\> echo %WINDIR%
+ An option file can be created and modified with any text
+ editor, such as Notepad. For example, if MySQL is installed in
+ E:\mysql and the data directory is D:\MySQLdata, you can
+ create the option file and set up a [mysqld] section to
+ specify values for the basedir and datadir options:
+[mysqld]
+# set basedir to your installation path
+basedir=E:/mysql
+# set datadir to the location of your data directory
+datadir=D:/MySQLdata
+ Note that Windows path names are specified in option files
+ using (forward) slashes rather than backslashes. If you do use
+ backslashes, double them:
+[mysqld]
+# set basedir to your installation path
+basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1
+# set datadir to the location of your data directory
+datadir=D:\\MySQLdata
+ The rules for use of backslash in option file values are given
+ in Section 4.2.3.3, "Using Option Files."
+ If you change the datadir value in your MySQL configuration
+ file, you must move the contents of the existing MySQL data
+ directory before restarting the MySQL server.
+ See Section 2.5.5.2, "Creating an Option File."
- If the data directory or its files or subdirectories are not owned
- by the login account that you use for running the server, change
- their ownership to that account. If the account is named mysql,
- use these commands:
-shell> chown -R mysql /usr/local/mysql/var
-shell> chgrp -R mysql /usr/local/mysql/var
+ * If you reinstall or upgrade MySQL without first stopping and
+ removing the existing MySQL service and install MySQL using
+ the MySQL Config Wizard, you may see this error:
+Error: Cannot create Windows service for MySql. Error: 0
+ This occurs when the Config Wizard tries to install the
+ service and finds an existing service with the same name.
+ One solution to this problem is to choose a service name other
+ than mysql when using the configuration wizard. This allows
+ the new service to be installed correctly, but leaves the
+ outdated service in place. Although this is harmless, it is
+ best to remove old services that are no longer in use.
+ To permanently remove the old mysql service, execute the
+ following command as a user with administrative privileges, on
+ the command-line:
+C:\> sc delete mysql
+[SC] DeleteService SUCCESS
+ If the sc utility is not available for your version of
+ Windows, download the delsrv utility from
+ http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi
+ sting/delsrv-o.asp and use the delsrv mysql syntax.
- If the server fails to start up correctly, check the error log.
- Log files are located in the data directory (typically C:\Program
- Files\MySQL\MySQL Server 5.1\data on Windows,
- /usr/local/mysql/data for a Unix binary distribution, and
- /usr/local/var for a Unix source distribution). Look in the data
- directory for files with names of the form host_name.err and
- host_name.log, where host_name is the name of your server host.
- Then examine the last few lines of these files. On Unix, you can
- use tail to display them:
-shell> tail host_name.err
-shell> tail host_name.log
+2.5.7. Upgrading MySQL on Windows
- The error log should contain information that indicates why the
- server couldn't start.
+ This section lists some of the steps you should take when
+ upgrading MySQL on Windows.
- If either of the following errors occur, it means that some other
- program (perhaps another mysqld server) is using the TCP/IP port
- or Unix socket file that mysqld is trying to use:
-Can't start server: Bind on TCP/IP port: Address already in use
-Can't start server: Bind on unix socket...
+ 1. Review Section 2.4.1, "Upgrading MySQL," for additional
+ information on upgrading MySQL that is not specific to
+ Windows.
- Use ps to determine whether you have another mysqld server
- running. If so, shut down the server before starting mysqld again.
- (If another server is running, and you really want to run multiple
- servers, you can find information about how to do so in Section
- 5.6, "Running Multiple MySQL Servers on the Same Machine.")
+ 2. You should always back up your current MySQL installation
+ before performing an upgrade. See Section 6.1, "Database
+ Backup Methods."
- If no other server is running, try to execute the command telnet
- your_host_name tcp_ip_port_number. (The default MySQL port number
- is 3306.) Then press Enter a couple of times. If you don't get an
- error message like telnet: Unable to connect to remote host:
- Connection refused, some other program is using the TCP/IP port
- that mysqld is trying to use. You'll need to track down what
- program this is and disable it, or else tell mysqld to listen to a
- different port with the --port option. In this case, you'll also
- need to specify the port number for client programs when
- connecting to the server via TCP/IP.
+ 3. Download the latest Windows distribution of MySQL from
+ http://dev.mysql.com/downloads/.
- Another reason the port might be inaccessible is that you have a
- firewall running that blocks connections to it. If so, modify the
- firewall settings to allow access to the port.
+ 4. Before upgrading MySQL, you must stop the server. If the
+ server is installed as a service, stop the service with the
+ following command from the command prompt:
+C:\> NET STOP MySQL
+ If you are not running the MySQL server as a service, use the
+ following command to stop it:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
+ shutdown
- If the server starts but you can't connect to it, you should make
- sure that you have an entry in /etc/hosts that looks like this:
-127.0.0.1 localhost
+Note
+ If the MySQL root user account has a password, you need to
+ invoke mysqladmin with the -p option and supply the password
+ when prompted.
- This problem occurs only on systems that do not have a working
- thread library and for which MySQL must be configured to use
- MIT-pthreads.
+ 5. When upgrading to MySQL 5.1 from a version previous to 4.1.5,
+ or when upgrading from a version of MySQL installed from a Zip
+ archive to a version of MySQL installed with the MySQL
+ Installation Wizard, you must manually remove the previous
+ installation and MySQL service (if the server is installed as
+ a service).
+ To remove the MySQL service, use the following command:
+C:\> C:\mysql\bin\mysqld --remove
+ If you do not remove the existing service, the MySQL
+ Installation Wizard may fail to properly install the new MySQL
+ service.
- If you cannot get mysqld to start, you can try to make a trace
- file to find the problem by using the --debug option. See MySQL
- Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
+ 6. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change
+ in the default location of the data directory from a directory
+ within the MySQL installation to the AppData folder means that
+ you must manually copy the data files from your old
+ installation to the new location.
-2.11.3. Securing the Initial MySQL Accounts
+ 7. If you are using the MySQL Installation Wizard, start the
+ wizard as described in Section 2.5.3.1, "Using the MySQL
+ Installation Wizard."
- Part of the MySQL installation process is to set up the mysql
- database that contains the grant tables:
+ 8. If you are installing MySQL from a Zip archive, extract the
+ archive. You may either overwrite your existing MySQL
+ installation (usually located at C:\mysql), or install it into
+ a different directory, such as C:\mysql5. Overwriting the
+ existing installation is recommended.
- * Windows distributions contain preinitialized grant tables that
- are installed automatically.
+ 9. If you were running MySQL as a Windows service and you had to
+ remove the service earlier in this procedure, reinstall the
+ service. (See Section 2.5.5.6, "Starting MySQL as a Windows
+ Service.")
+ 10. Restart the server. For example, use NET START MySQL if you
+ run MySQL as a service, or invoke mysqld directly otherwise.
+ 11. If you encounter errors, see Section 2.5.6, "Troubleshooting a
+ MySQL Installation Under Windows."
- * On Unix, the grant tables are populated by the
- mysql_install_db program. Some installation methods run this
- program for you. Others require that you execute it manually.
- For details, see Section 2.11.2, "Unix Post-Installation
- Procedures."
+2.5.8. Windows Post-Installation Procedures
- The grant tables define the initial MySQL user accounts and their
- access privileges. These accounts are set up as follows:
+ On Windows, the data directory and the grant tables do not have to
+ be created. MySQL Windows distributions include the grant tables
+ with a set of preinitialized accounts in the mysql database under
+ the data directory. It is unnecessary to run the mysql_install_db
+ script that is used on Unix. Regarding passwords, if you installed
+ MySQL using the Windows Installation Wizard, you may have already
+ assigned passwords to the accounts. (See Section 2.5.3.1, "Using
+ the MySQL Installation Wizard.") Otherwise, use the
+ password-assignment procedure given in Section 2.13.2, "Securing
+ the Initial MySQL Accounts."
- * Accounts with the user name root are created. These are
- superuser accounts that can do anything. The initial root
- account passwords are empty, so anyone can connect to the
- MySQL server as root --- without a password --- and be granted
- all privileges.
+ Before setting up passwords, you might want to try running some
+ client programs to make sure that you can connect to the server
+ and that it is operating properly. Make sure that the server is
+ running (see Section 2.5.5.4, "Starting the Server for the First
+ Time"), and then issue the following commands to verify that you
+ can retrieve information from the server. The output should be
+ similar to what is shown here:
+C:\> C:\mysql\bin\mysqlshow
++--------------------+
+| Databases |
++--------------------+
+| information_schema |
+| mysql |
+| test |
++--------------------+
- + On Windows, one root account is created; this account
- allows connecting from the local host only. The Windows
- installer will optionally create an account allowing for
- connections from any host only if the user selects the
- Enable root access from remote machines option during
- installation.
+Note
- + On Unix, both root accounts are for connections from the
- local host. Connections must be made from the local host
- by specifying a host name of localhost for one of the
- accounts, or the actual host name or IP number for the
- other.
+ The above may not work if the correct user does not exist. If you
+ installed using the MSI packages and used the MySQL Server
+ Instance Config Wizard, then the root will haqve been created
+ automatically with the password you supplied. In this case, you
+ should use the -u and -p options where you will be prompted for
+ the password.
- * Two anonymous-user accounts are created, each with an empty
- user name. The anonymous accounts have no password, so anyone
- can use them to connect to the MySQL server.
+Note
- + On Windows, one anonymous account is for connections from
- the local host. It has no global privileges. (Before
- MySQL 5.1.16, it has all global privileges, just like the
- root accounts.) The other is for connections from any
- host and has all privileges for the test database and for
- other databases with names that start with test.
+ The list of installed databases may vary, but will always include
+ the minimum of mysql and information_schema. In most cases, the
+ test database will also be installed automatically.
+
+ If you specify the name of the database, then a list of the tables
+ within a given database will be displayed:
+C:\> C:\mysql\bin\mysqlshow mysql
+Database: mysql
++---------------------------+
+| Tables |
++---------------------------+
+| columns_priv |
+| db |
+| event |
+| func |
+| general_log |
+| help_category |
+| help_keyword |
+| help_relation |
+| help_topic |
+| host |
+| plugin |
+| proc |
+| procs_priv |
+| servers |
+| slow_log |
+| tables_priv |
+| time_zone |
+| time_zone_leap_second |
+| time_zone_name |
+| time_zone_transition |
+| time_zone_transition_type |
+| user |
++---------------------------+
- + On Unix, both anonymous accounts are for connections from
- the local host. Connections must be made from the local
- host by specifying a host name of localhost for one of
- the accounts, or the actual host name or IP number for
- the other. These accounts have all privileges for the
- test database and for other databases with names that
- start with test_.
- As noted, none of the initial accounts have passwords. This means
- that your MySQL installation is unprotected until you do something
- about it:
+C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
++------+-------+------+
+| host | db | user |
++------+-------+------+
+| % | test% | |
++------+-------+------+
- * If you want to prevent clients from connecting as anonymous
- users without a password, you should either assign a password
- to each anonymous account or else remove the accounts.
+ You may need to specify a different directory from the one shown;
+ if you used the Windows Installation Wizard, then the default
+ directory is C:\Program Files\MySQL\MySQL Server 5.1, and the
+ mysql and mysqlshow client programs are in C:\Program
+ Files\MySQL\MySQL Server 5.1\bin. See Section 2.5.3.1, "Using the
+ MySQL Installation Wizard," for more information.
- * You should assign a password to each MySQL root account.
+ If you have already secured the initial MySQL accounts, you may
+ need to use the -u and -p options to supply a user name and
+ password to the mysqlshow and mysql client programs; otherwise the
+ programs may fail with an error, or you may not be able to view
+ all databases. For example, if you have assigned the password
+ "secretpass" to the MySQL root account, then you can invoke
+ mysqlshow and mysql as shown here:
+C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass
++--------------------+
+| Databases |
++--------------------+
+| information_schema |
+| mysql |
+| test |
++--------------------+
- The following instructions describe how to set up passwords for
- the initial MySQL accounts, first for the anonymous accounts and
- then for the root accounts. Replace "newpwd" in the examples with
- the actual password that you want to use. The instructions also
- cover how to remove the anonymous accounts, should you prefer not
- to allow anonymous access at all.
+C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
+Database: mysql
++---------------------------+
+| Tables |
++---------------------------+
+| columns_priv |
+| db |
+| event |
+| func |
+| general_log |
+| help_category |
+| help_keyword |
+| help_relation |
+| help_topic |
+| host |
+| plugin |
+| proc |
+| procs_priv |
+| servers |
+| slow_log |
+| tables_priv |
+| time_zone |
+| time_zone_leap_second |
+| time_zone_name |
+| time_zone_transition |
+| time_zone_transition_type |
+| user |
++---------------------------+
- You might want to defer setting the passwords until later, so that
- you don't need to specify them while you perform additional setup
- or testing. However, be sure to set them before using your
- installation for production purposes.
- Anonymous Account Password Assignment
+C:\> C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User F
+ROM db" mysql
++------+-------+------+
+| host | db | user |
++------+-------+------+
+| % | test% | |
++------+-------+------+
- To assign passwords to the anonymous accounts, connect to the
- server as root and then use either SET PASSWORD or UPDATE. In
- either case, be sure to encrypt the password using the PASSWORD()
- function.
+ For more information about these programs, see Section 4.5.6,
+ "mysqlshow --- Display Database, Table, and Column Information,"
+ and Section 4.5.1, "mysql --- The MySQL Command-Line Tool."
- To use SET PASSWORD on Windows, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR ''@'%' = PASSWORD('newpwd');
+ If you are running a version of Windows that supports services and
+ you want the MySQL server to run automatically when Windows
+ starts, see Section 2.5.5.6, "Starting MySQL as a Windows
+ Service."
- To use SET PASSWORD on Unix, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
+2.5.9. MySQL on Windows Compared to MySQL on Unix
- In the second SET PASSWORD statement, replace host_name with the
- name of the server host. This is the name that is specified in the
- Host column of the non-localhost record for root in the user
- table. If you don't know what host name this is, issue the
- following statement before using SET PASSWORD:
-mysql> SELECT Host, User FROM mysql.user;
+ MySQL for Windows has proven itself to be very stable. The Windows
+ version of MySQL has the same features as the corresponding Unix
+ version, with the following exceptions:
- Look for the record that has root in the User column and something
- other than localhost in the Host column. Then use that Host value
- in the second SET PASSWORD statement.
+ * Limited number of ports
+ Windows systems have about 4,000 ports available for client
+ connections, and after a connection on a port closes, it takes
+ two to four minutes before the port can be reused. In
+ situations where clients connect to and disconnect from the
+ server at a high rate, it is possible for all available ports
+ to be used up before closed ports become available again. If
+ this happens, the MySQL server appears to be unresponsive even
+ though it is running. Note that ports may be used by other
+ applications running on the machine as well, in which case the
+ number of ports available to MySQL is lower.
+ For more information about this problem, see
+ http://support.microsoft.com/default.aspx?scid=kb;en-us;196271
+ .
- Anonymous Account Removal
+ * Concurrent reads
+ MySQL depends on the pread() and pwrite() system calls to be
+ able to mix INSERT and SELECT. Currently, we use mutexes to
+ emulate pread() and pwrite(). We intend to replace the file
+ level interface with a virtual interface in the future so that
+ we can use the readfile()/writefile() interface to get more
+ speed. The current implementation limits the number of open
+ files that MySQL 5.1 can use to 2,048, which means that you
+ cannot run as many concurrent threads on Windows as on Unix.
- If you prefer to remove the anonymous accounts instead, do so as
- follows:
-shell> mysql -u root
-mysql> DROP USER '';
+ * Blocking read
+ MySQL uses a blocking read for each connection. That has the
+ following implications if named-pipe connections are enabled:
- The DROP statement applies both to Windows and to Unix. On
- Windows, if you want to remove only the anonymous account that has
- the same privileges as root, do this instead:
-shell> mysql -u root
-mysql> DROP USER ''@'localhost';
+ + A connection is not disconnected automatically after
+ eight hours, as happens with the Unix version of MySQL.
- That account allows anonymous access but has full privileges, so
- removing it improves security.
+ + If a connection hangs, it is not possible to break it
+ without killing MySQL.
- root Account Password Assignment
+ + mysqladmin kill does not work on a sleeping connection.
- You can assign passwords to the root accounts in several ways. The
- following discussion demonstrates three methods:
+ + mysqladmin shutdown cannot abort as long as there are
+ sleeping connections.
+ We plan to fix this problem in the future.
- * Use the SET PASSWORD statement
+ * ALTER TABLE
+ While you are executing an ALTER TABLE statement, the table is
+ locked from being used by other threads. This has to do with
+ the fact that on Windows, you can't delete a file that is in
+ use by another thread. In the future, we may find some way to
+ work around this problem.
- * Use the mysqladmin command-line client program
+ * DATA DIRECTORY and INDEX DIRECTORY
+ The DATA DIRECTORY and INDEX DIRECTORY options for CREATE
+ TABLE are ignored on Windows, because Windows doesn't support
+ symbolic links. These options also are ignored on systems that
+ have a nonfunctional realpath() call.
- * Use the UPDATE statement
+ * DROP DATABASE
+ You cannot drop a database that is in use by another thread.
- To assign passwords using SET PASSWORD, connect to the server as
- root and issue SET PASSWORD statements. Be sure to encrypt the
- password using the PASSWORD() function.
+ * Case-insensitive names
+ File names are not case sensitive on Windows, so MySQL
+ database and table names are also not case sensitive on
+ Windows. The only restriction is that database and table names
+ must be specified using the same case throughout a given
+ statement. See Section 8.2.2, "Identifier Case Sensitivity."
- For Windows, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');
+ * Directory and file names
+ On Windows, MySQL Server supports only directory and file
+ names that are compatible with the current ANSI code pages.
+ For example, the following Japanese directory name will not
+ work in the Western locale (code page 1252):
+datadir="C:/维基百科关于中文维基百科"
+ The same limitation applies to directory and file names
+ referred to in SQL statements, such as the data file path name
+ in LOAD DATA INFILE.
- For Unix, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
+ * The "\" path name separator character
+ Path name components in Windows are separated by the "\"
+ character, which is also the escape character in MySQL. If you
+ are using LOAD DATA INFILE or SELECT ... INTO OUTFILE, use
+ Unix-style file names with "/" characters:
+mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;
+mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
+ Alternatively, you must double the "\" character:
+mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;
+mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;
- In the second SET PASSWORD statement, replace host_name with the
- name of the server host. This is the same host name that you used
- when you assigned the anonymous account passwords.
+ * Problems with pipes
+ Pipes do not work reliably from the Windows command-line
+ prompt. If the pipe includes the character ^Z / CHAR(24),
+ Windows thinks that it has encountered end-of-file and aborts
+ the program.
+ This is mainly a problem when you try to apply a binary log as
+ follows:
+C:\> mysqlbinlog binary_log_file | mysql --user=root
+ If you have a problem applying the log and suspect that it is
+ because of a ^Z / CHAR(24) character, you can use the
+ following workaround:
+C:\> mysqlbinlog binary_log_file --result-file=/tmp/bin.sql
+C:\> mysql --user=root --execute "source /tmp/bin.sql"
+ The latter command also can be used to reliably read in any
+ SQL file that may contain binary data.
- If the user table contains an account with User and Host values of
- 'root' and '127.0.0.1', use an additional SET PASSWORD statement
- to set that account's password:
-mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
+ * Access denied for user error
+ If MySQL cannot resolve your host name properly, you may get
+ the following error when you attempt to run a MySQL client
+ program to connect to a server running on the same machine:
+Access denied for user 'some_user'@'unknown'
+to database 'mysql'
+ To fix this problem, you should create a file named
+ \windows\hosts containing the following information:
+127.0.0.1 localhost
- To assign passwords to the root accounts using mysqladmin, execute
- the following commands:
-shell> mysqladmin -u root password "newpwd"
-shell> mysqladmin -u root -h host_name password "newpwd"
+ Here are some open issues for anyone who might want to help us
+ improve MySQL on Windows:
+
+ * Add macros to use the faster thread-safe increment/decrement
+ methods provided by Windows.
+
+2.5.10. Installing MySQL from Source on Windows
- These commands apply both to Windows and to Unix. In the second
- command, replace host_name with the name of the server host. The
- double quotes around the password are not always necessary, but
- you should use them if the password contains spaces or other
- characters that are special to your command interpreter.
+ These instructions describe how to build binaries from source for
+ MySQL 5.1 on Windows. Instructions are provided for building
+ binaries from a standard source distribution or from the Bazaar
+ tree that contains the latest development source.
- The mysqladmin method of setting the root account passwords does
- not set the password for the 'root'@'127.0.0.1' account. To do so,
- use SET PASSWORD as shown earlier.
+Note
- You can also use UPDATE to modify the user table directly. The
- following UPDATE statement assigns a password to all root
- accounts:
-shell> mysql -u root
-mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
- -> WHERE User = 'root';
-mysql> FLUSH PRIVILEGES;
+ The instructions here are strictly for users who want to test
+ MySQL on Microsoft Windows from the latest source distribution or
+ from the Bazaar tree. For production use, we do not advise using a
+ MySQL server built by yourself from source. Normally, it is best
+ to use precompiled binary distributions of MySQL that are built
+ specifically for optimal performance on Windows by Sun
+ Microsystems, Inc. Instructions for installing binary
+ distributions are available in Section 2.5, "Installing MySQL on
+ Windows."
- The UPDATE statement applies both to Windows and to Unix.
+ To build MySQL on Windows from source, you must satisfy the
+ following system, compiler, and resource requirements:
- After the passwords have been set, you must supply the appropriate
- password whenever you connect to the server. For example, if you
- want to use mysqladmin to shut down the server, you can do so
- using this command:
-shell> mysqladmin -u root -p shutdown
-Enter password: (enter root password here)
+ * Windows 2000, Windows XP, or newer version.
+ Windows Vista is supported when using Visual Studio 2005
+ provided you have installed the following updates:
-Note
+ + Microsoft Visual Studio 2005 Professional Edition - ENU
+ Service Pack 1 (KB926601)
+ (http://support.microsoft.com/?kbid=926601)
- If you forget your root password after setting it up, Section
- B.1.4.1, "How to Reset the Root Password," covers the procedure
- for resetting it.
+ + Security Update for Microsoft Visual Studio 2005
+ Professional Edition - ENU (KB937061)
+ (http://support.microsoft.com/?kbid=937061)
- To set up additional accounts, you can use the GRANT statement.
- For instructions, see Section 5.5.2, "Adding User Accounts."
+ + Update for Microsoft Visual Studio 2005 Professional
+ Edition - ENU (KB932232)
+ (http://support.microsoft.com/?kbid=932232)
-2.12. Upgrading or Downgrading MySQL
+ * CMake, which can be downloaded from http://www.cmake.org.
+ After installing, modify your path to include the cmake
+ binary.
-2.12.1. Upgrading MySQL
+ * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net
+ 2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
- As a general rule, to upgrade from one release series to another,
- you should go to the next series rather than skipping a series. To
- upgrade from a release series previous to MySQL 5.0, upgrade to
- each successive release series in turn until you have reached
- MySQL 5.0, and then proceed with the upgrade to MySQL 5.1. For
- example, if you currently are running MySQL 4.0 and wish to
- upgrade to a newer series, upgrade to MySQL 4.1 first before
- upgrading to 5.0, and so forth. For information on upgrading to
- MySQL 5.0, see the MySQL 5.0 Reference Manual; for earlier
- releases, see the MySQL 3.23, 4.0, 4.1 Reference Manual.
+ * If you are using Visual C++ 2005 Express Edition, you must
+ also install an appropriate Platform SDK. More information and
+ links to downloads for various Windows platforms is available
+ from
+ http://www.microsoft.com/downloads/details.aspx?familyid=0baf2
+ b35-c656-4969-ace8-e4c0c0716adb.
- To upgrade from MySQL 5.0 to 5.1, use the items in the following
- checklist as a guide:
+ * If you are compiling from a Bazaar tree or making changes to
+ the parser, you need bison for Windows, which can be
+ downloaded from
+ http://gnuwin32.sourceforge.net/packages/bison.htm. Download
+ the package labeled "Complete package, excluding sources".
+ After installing the package, modify your path to include the
+ bison binary and ensure that this binary is accessible from
+ Visual Studio.
- * Before any upgrade, back up your databases, including the
- mysql database that contains the grant tables. See Section
- 6.1, "Database Backups."
+ * Cygwin might be necessary if you want to run the test script
+ or package the compiled binaries and support files into a Zip
+ archive. (Cygwin is needed only to test or package the
+ distribution, not to build it.) Cygwin is available from
+ http://cygwin.com.
- * Read all the notes in Section 2.12.1.1, "Upgrading from MySQL
- 5.0 to 5.1." These notes enable you to identify upgrade issues
- that apply to your current MySQL installation. Some
- incompatibilities discussed in that section require your
- attention before upgrading. Others should be dealt with after
- upgrading.
+ * 3GB to 5GB of disk space.
- * Read Appendix C, "MySQL Change History" as well, which
- provides information about features that are new in MySQL 5.1
- or differ from those found in MySQL 5.0.
+ The exact system requirements for Visual Studio can be found here:
+ http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as
+ px and
+ http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx
- * After you upgrade to a new version of MySQL, run mysql_upgrade
- (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
- Upgrade"). This program checks your tables, and attempts to
- repair them if necessary. It also updates your grant tables to
- make sure that they have the current structure so that you can
- take advantage of any new capabilities. (Some releases of
- MySQL introduce changes to the structure of the grant tables
- to add new privileges or features.)
+ You also need a MySQL source distribution for Windows, which can
+ be obtained two ways:
- * If you are running MySQL Server on Windows, see Section
- 2.3.14, "Upgrading MySQL on Windows."
+ * Obtain a source distribution packaged by Sun Microsystems,
+ Inc. These are available from http://dev.mysql.com/downloads/.
- * If you are using replication, see Section 16.3.3, "Upgrading a
- Replication Setup," for information on upgrading your
- replication setup.
+ * Package a source distribution yourself from the latest Bazaar
+ developer source tree. For instructions on pulling the latest
+ source files, see Section 2.3.3, "Installing from the
+ Development Source Tree."
- * If you are upgrading an installation originally produced by
- installing multiple RPM packages, it is best to upgrade all
- the packages, not just some. For example, if you previously
- installed the server and client RPMs, do not upgrade just the
- server RPM.
+ If you find something not working as expected, or you have
+ suggestions about ways to improve the current build process on
+ Windows, please send a message to the win32 mailing list. See
+ Section 1.5.1, "MySQL Mailing Lists."
- * As of MySQL 5.1.9, the mysqld-max server is included in binary
- distributions. There is no separate MySQL-Max distribution. As
- of MySQL 5.1.12, there is no mysqld-max server at all in
- binary distributions. They contain a server that includes the
- features previously included in mysqld-max.
+2.5.10.1. Building MySQL from Source Using CMake and Visual Studio
- * If you have created a user-defined function (UDF) with a given
- name and upgrade MySQL to a version that implements a new
- built-in function with the same name, the UDF becomes
- inaccessible. To correct this, use DROP FUNCTION to drop the
- UDF, and then use CREATE FUNCTION to re-create the UDF with a
- different nonconflicting name. The same is true if the new
- version of MySQL implements a built-in function with the same
- name as an existing stored function. See Section 8.2.4,
- "Function Name Parsing and Resolution," for the rules
- describing how the server interprets references to different
- kinds of functions.
+ You can build MySQL on Windows by using a combination of cmake and
+ Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio
+ 2005 (8.0) or Microsoft Visual C++ 2005 Express Edition. You must
+ have the appropriate Microsoft Platform SDK installed.
- You can always move the MySQL format files and data files between
- different versions on systems with the same architecture as long
- as you stay within versions for the same release series of MySQL.
+Note
- If you are cautious about using new versions, you can always
- rename your old mysqld before installing a newer one. For example,
- if you are using MySQL 5.0.13 and want to upgrade to 5.1.10,
- rename your current server from mysqld to mysqld-5.0.13. If your
- new mysqld then does something unexpected, you can simply shut it
- down and restart with your old mysqld.
+ To compile from the source code on Windows you must use the
+ standard source distribution (for example, mysql-5.1.41.tar.gz).
+ You build from the same distribution as used to build MySQL on
+ Unix, Linux and other platforms. Do not use the Windows Source
+ distributions as they do not contain the necessary configuration
+ script and other files.
- If, after an upgrade, you experience problems with recompiled
- client programs, such as Commands out of sync or unexpected core
- dumps, you probably have used old header or library files when
- compiling your programs. In this case, you should check the date
- for your mysql.h file and libmysqlclient.a library to verify that
- they are from the new MySQL distribution. If not, recompile your
- programs with the new headers and libraries.
+ Follow this procedure to build MySQL:
- If problems occur, such as that the new mysqld server does not
- start or that you cannot connect without a password, verify that
- you do not have an old my.cnf file from your previous
- installation. You can check this with the --print-defaults option
- (for example, mysqld --print-defaults). If this command displays
- anything other than the program name, you have an active my.cnf
- file that affects server or client operation.
+ 1. If you are installing from a packaged source distribution,
+ create a work directory (for example, C:\workdir), and unpack
+ the source distribution there using WinZip or another Windows
+ tool that can read .zip files. This directory is the work
+ directory in the following instructions.
- If your MySQL installation contains a large amount of data that
- might take a long time to convert after an in-place upgrade, you
- might find it useful to create a "dummy" database instance for
- assessing what conversions might be needed and the work involved
- to perform them. Make a copy of your MySQL instance that contains
- a full copy of the mysql database, plus all other databases
- without data. Run your upgrade procedure on this dummy instance to
- see what actions might be needed so that you can better evaluate
- the work involved when performing actual data conversion on your
- original database instance.
+ 2. Using a command shell, navigate to the work directory and run
+ the following command:
+C:\workdir>win\configure.js options
+ If you have associated the .js file extension with an
+ application such as a text editor, then you may need to use
+ the following command to force configure.js to be executed as
+ a script:
+C:\workdir>cscript win\configure.js options
+ These options are available for configure.js:
- It is a good idea to rebuild and reinstall the Perl DBD::mysql
- module whenever you install a new release of MySQL. The same
- applies to other MySQL interfaces as well, such as PHP mysql
- extensions and the Python MySQLdb module.
+ + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage
+ engine.
-2.12.1.1. Upgrading from MySQL 5.0 to 5.1
+ + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined
+ partitioning.
- After upgrading a 5.0 installation to 5.0.10 or above, it is
- necessary to upgrade your grant tables. Otherwise, creating stored
- procedures and functions might not work. To perform this upgrade,
- run mysql_upgrade.
+ + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage
+ engine.
-Note
+ + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE
+ storage engine.
- It is good practice to back up your data before installing any new
- version of software. Although MySQL works very hard to ensure a
- high level of quality, you should protect your data by making a
- backup.
+ + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage
+ engine.
- To upgrade to 5.1 from any previous version, MySQL recommends that
- you dump your tables with mysqldump before upgrading and reload
- the dump file after upgrading.
+ + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
+ storage engine.
- In general, you should do the following when upgrading from MySQL
- 5.0 to 5.1:
+ + WITH_NDBCLUSTER_STORAGE_ENGINE (experimental): Enable the
+ NDBCLUSTER storage engine in the MySQL server; cause
+ binaries for the MySQL Cluster management and data node,
+ management client, and other programs to be built.
+ This option is supported only in MySQL Cluster NDB 7.0
+ (NDBCLUSTER storage engine versions 6.4.0 and later)
+ using the MySQL Cluster sources. It cannot be used to
+ enable clustering support in other MySQL source trees or
+ distributions.
- * Read all the items in the following sections to see whether
- any of them might affect your applications:
+ + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.
- + Section 2.12.1, "Upgrading MySQL," has general update
- information.
+ + COMPILATION_COMMENT=comment: Server comment, default
+ "Source distribution".
- + The items in the change lists found later in this section
- enable you to identify upgrade issues that apply to your
- current MySQL installation.
+ + MYSQL_TCP_PORT=port: Server port, default 3306.
+
+ + DISABLE_GRANT_OPTIONS: Disables the --bootstrap,
+ --skip-grant-tables, and --init-file options for mysqld.
+ This option is available as of MySQL 5.1.15.
+ For example (type the command on one line):
+C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE
+ WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
- + The MySQL 5.1 change history describes significant new
- features you can use in 5.1 or that differ from those
- found in MySQL 5.0. Some of these changes may result in
- incompatibilities. See Section C.1, "Changes in Release
- 5.1.x (Production)."
+ 3. From the work directory, execute the win\build-vs8.bat or
+ win\build-vs71.bat file, depending on the version of Visual
+ Studio you have installed. The script invokes CMake, which
+ generates the mysql.sln solution file.
+ You can also use win\build-vs8_x64.bat to build the 64-bit
+ version of MySQL. However, you cannot build the 64-bit version
+ with Visual Studio Express Edition. You must use Visual Studio
+ 2005 (8.0) or higher.
- * Note particularly any changes that are marked Known issue or
- Incompatible change. These incompatibilities with earlier
- versions of MySQL may require your attention before you
- upgrade.
- Our aim is to avoid these changes, but occasionally they are
- necessary to correct problems that would be worse than an
- incompatibility between releases. If any upgrade issue
- applicable to your installation involves an incompatibility
- that requires special handling, follow the instructions given
- in the incompatibility description. Often this will involve a
- dump and reload, or use of a statement such as CHECK TABLE or
- REPAIR TABLE.
- For dump and reload instructions, see Section 2.12.4,
- "Rebuilding or Repairing Tables or Indexes." Any procedure
- that involves REPAIR TABLE with the USE_FRM option must be
- done before upgrading. Use of this statement with a version of
- MySQL different from the one used to create the table (that
- is, using it after upgrading) may damage the table. See
- Section 12.5.2.6, "REPAIR TABLE Syntax."
+ 4. From the work directory, open the generated mysql.sln file
+ with Visual Studio and select the proper configuration using
+ the Configuration menu. The menu provides Debug, Release,
+ RelwithDebInfo, MinRelInfo options. Then select Solution >
+ Build to build the solution.
+ Remember the configuration that you use in this step. It is
+ important later when you run the test script because that
+ script needs to know which configuration you used.
- * After you upgrade to a new version of MySQL, run mysql_upgrade
- (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
- Upgrade"). This program checks your tables, and attempts to
- repair them if necessary. It also updates your grant tables to
- make sure that they have the current structure so that you can
- take advantage of any new capabilities. (Some releases of
- MySQL introduce changes to the structure of the grant tables
- to add new privileges or features.)
+ 5. Test the server. The server built using the preceding
+ instructions expects that the MySQL base directory and data
+ directory are C:\mysql and C:\mysql\data by default. If you
+ want to test your server using the source tree root directory
+ and its data directory as the base directory and data
+ directory, you need to tell the server their path names. You
+ can either do this on the command line with the --basedir and
+ --datadir options, or by placing appropriate options in an
+ option file. (See Section 4.2.3.3, "Using Option Files.") If
+ you have an existing data directory elsewhere that you want to
+ use, you can specify its path name instead.
+ When the server is running in standalone fashion or as a
+ service based on your configuration, try to connect to it from
+ the mysql interactive command-line utility.
+ You can also run the standard test script, mysql-test-run.pl.
+ This script is written in Perl, so you'll need either Cygwin
+ or ActiveState Perl to run it. You may also need to install
+ the modules required by the script. To run the test script,
+ change location into the mysql-test directory under the work
+ directory, set the MTR_VS_CONFIG environment variable to the
+ configuration you selected earlier (or use the --vs-config
+ option), and invoke mysql-test-run.pl. For example (using
+ Cygwin and the bash shell):
+shell> cd mysql-test
+shell> export MTR_VS_CONFIG=debug
+shell> ./mysql-test-run.pl --force --timer
+shell> ./mysql-test-run.pl --force --timer --ps-protocol
- * Check Section 2.12.3, "Checking Whether Table Indexes Must Be
- Rebuilt," to see whether changes to character sets or
- collations were made that affect your table indexes. If so,
- you will need to rebuild the affected indexes using the
- instructions in Section 2.12.4, "Rebuilding or Repairing
- Tables or Indexes."
+ When you are satisfied that the programs you have built are
+ working correctly, stop the server. Now you can install the
+ distribution. One way to do this is to use the make_win_bin_dist
+ script in the scripts directory of the MySQL source distribution
+ (see Section 4.4.2, "make_win_bin_dist --- Package MySQL
+ Distribution as ZIP Archive"). This is a shell script, so you must
+ have Cygwin installed if you want to use it. It creates a Zip
+ archive of the built executables and support files that you can
+ unpack in the location at which you want to install MySQL.
- * If you are running MySQL Server on Windows, see Section
- 2.3.14, "Upgrading MySQL on Windows."
+ It is also possible to install MySQL by copying directories and
+ files directly:
- * If you are using replication, see Section 16.3.3, "Upgrading a
- Replication Setup," for information on upgrading your
- replication setup.
+ 1. Create the directories where you want to install MySQL. For
+ example, to install into C:\mysql, use these commands:
+C:\> mkdir C:\mysql
+C:\> mkdir C:\mysql\bin
+C:\> mkdir C:\mysql\data
+C:\> mkdir C:\mysql\share
+C:\> mkdir C:\mysql\scripts
+ If you want to compile other clients and link them to MySQL,
+ you should also create several additional directories:
+C:\> mkdir C:\mysql\include
+C:\> mkdir C:\mysql\lib
+C:\> mkdir C:\mysql\lib\debug
+C:\> mkdir C:\mysql\lib\opt
+ If you want to benchmark MySQL, create this directory:
+C:\> mkdir C:\mysql\sql-bench
+ Benchmarking requires Perl support. See Section 2.15, "Perl
+ Installation Notes."
- If your MySQL installation contains a large amount of data that
- might take a long time to convert after an in-place upgrade, you
- might find it useful to create a "dummy" database instance for
- assessing what conversions might be needed and the work involved
- to perform them. Make a copy of your MySQL instance that contains
- a full copy of the mysql database, plus all other databases
- without data. Run your upgrade procedure on this dummy instance to
- see what actions might be needed so that you can better evaluate
- the work involved when performing actual data conversion on your
- original database instance.
+ 2. From the work directory, copy into the C:\mysql directory the
+ following directories:
+C:\> cd \workdir
+C:\workdir> copy client_release\*.exe C:\mysql\bin
+C:\workdir> copy client_debug\mysqld.exe C:\mysql\bin\mysqld-debug.ex
+e
+C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
+C:\workdir> xcopy share\*.* C:\mysql\share /E
+ If you want to compile other clients and link them to MySQL,
+ you should also copy several libraries and header files:
+C:\workdir> copy lib_debug\mysqlclient.lib C:\mysql\lib\debug
+C:\workdir> copy lib_debug\libmysql.* C:\mysql\lib\debug
+C:\workdir> copy lib_debug\zlib.* C:\mysql\lib\debug
+C:\workdir> copy lib_release\mysqlclient.lib C:\mysql\lib\opt
+C:\workdir> copy lib_release\libmysql.* C:\mysql\lib\opt
+C:\workdir> copy lib_release\zlib.* C:\mysql\lib\opt
+C:\workdir> copy include\*.h C:\mysql\include
+C:\workdir> copy libmysql\libmysql.def C:\mysql\include
+ If you want to benchmark MySQL, you should also do this:
+C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
- MySQL Enterprise MySQL Enterprise subscribers will find more
- information about upgrading in the Knowledge Base articles found
- at Upgrading
- (https://kb.mysql.com/search.php?cat=search&category=41) Access
- to the MySQL Knowledge Base collection of articles is one of the
- advantages of subscribing to MySQL Enterprise. For more
- information, see
- http://www.mysql.com/products/enterprise/advisors.html.
+ After installation, set up and start the server in the same way as
+ for binary Windows distributions. See Section 2.5, "Installing
+ MySQL on Windows."
- The following lists describe changes that may affect applications
- and that you should watch out for when upgrading to MySQL 5.1.
+2.5.11. Compiling MySQL Clients on Windows
- Configuration Changes:
+ In your source files, you should include my_global.h before
+ mysql.h:
+#include <my_global.h>
+#include <mysql.h>
- * Before MySQL 5.1.11, to build MySQL from source with SSL
- support enabled, you would invoke configure with either the
- --with-openssl or --with-yassl option. In MySQL 5.1.11, those
- options both have been replaced by the --with-ssl option. By
- default, --with-ssl causes the bundled yaSSL library to be
- used. To select OpenSSL instead, give the option as
- --with-ssl=path, where path is the directory where the OpenSSL
- header files and libraries are located.
+ my_global.h includes any other files needed for Windows
+ compatibility (such as windows.h) if you compile your program on
+ Windows.
- Server Changes:
+ You can either link your code with the dynamic libmysql.lib
+ library, which is just a wrapper to load in libmysql.dll on
+ demand, or link with the static mysqlclient.lib library.
- * Known issue: Dumps performed by using mysqldump to generate a
- dump file before the upgrade and reloading the file after
- upgrading are subject to the following problem:
- Before MySQL 5.0.40, mysqldump displays SPATIAL index
- definitions using prefix lengths for the indexed columns.
- These prefix lengths are accepted in MySQL 5.0, but not as of
- MySQL 5.1. If you use mysqldump from versions of MySQL older
- than 5.0.40, any table containing SPATIAL indexes will cause
- an error when the dump file is reloaded into MySQL 5.1 or
- higher.
- For example, a table definition might look like this when
- dumped in MySQL 5.0:
-CREATE TABLE `t` (
- `g` geometry NOT NULL,
- SPATIAL KEY `g` (`g`(32))
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- The SPATIAL index definition will not be accepted in MySQL
- 5.1. To work around this, edit the dump file to remove the
- prefix:
-CREATE TABLE `t` (
- `g` geometry NOT NULL,
- SPATIAL KEY `g` (`g`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- Dump files can be large, so it may be preferable to dump table
- definitions and data separately to make it easier to edit the
- definitions:
-shell> mysqldump --no-data other_args > definitions.sql
-shell> mysqldump --no-create-info other_args > data.sql
- Then edit definitions.sql before reloading definitions.sql and
- data.sql, in that order.
- If you upgrade to a version of MySQL 5.0 higher than 5.0.40
- before upgrading to MySQL 5.1, this problem does not occur.
+ The MySQL client libraries are compiled as threaded libraries, so
+ you should also compile your code to be multi-threaded.
- * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR
- UPGRADE statement did not check for incompatible collation
- changes made in MySQL 5.1.24. (This also affects mysqlcheck
- and mysql_upgrade, which cause that statement to be executed.)
- Prior to the fix made in 5.1.30, a binary upgrade (performed
- without dumping tables with mysqldump before the upgrade and
- reloading the dump file after the upgrade) would corrupt
- tables. After the fix, CHECK TABLE ... FOR UPGRADE properly
- detects the problem and warns about tables that need repair.
- However, the fix is not backward compatible and can result in
- a downgrading problem under these circumstances:
+2.6. Installing MySQL on Linux
- 1. Perform a binary upgrade to a version of MySQL that
- includes the fix.
+ The following sections covers the installation of Linux using
+ RPMs. For information on using a generic binary package using tar,
+ see Section 2.2, "Installing MySQL from Generic Binaries on
+ Unix/Linux." For information on installing from source, see
+ Section 2.3, "MySQL Installation Using a Source Distribution."
- 2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or
- mysql_upgrade) to upgrade tables.
+ mysql.server can be found in the support-files directory under the
+ MySQL installation directory or in a MySQL source tree. You can
+ install it as /etc/init.d/mysql for automatic MySQL startup and
+ shutdown. See Section 2.13.1.2, "Starting and Stopping MySQL
+ Automatically."
- 3. Perform a binary downgrade to a version of MySQL that
- does not include the fix.
- The solution is to dump tables with mysqldump before the
- downgrade and reload the dump file after the downgrade.
- Alternatively, drop and recreate affected indexes.
+2.6.1. Installing MySQL from RPM Packages on Linux
- * Known issue: MySQL introduces encoding for table names that
- have non-ASCII characters (see Section 8.2.3, "Mapping of
- Identifiers to File Names"). After a binary upgrade from MySQL
- 5.0 to 5.1 or higher, the server recognizes names that have
- non-ASCII characters and adds a #mysql50# prefix to them.
- As of MySQL 5.1.31, mysql_upgrade encodes these names by
- executing the following command:
-mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table
--names
- Prior to MySQL 5.1.31, mysql_upgrade does not execute this
- command, so you should execute it manually if you have
- database or table names that contain nonalphanumeric
- characters.
- Prior to MySQL 5.1.23, the mysqlcheck command does not perform
- the name encoding for views. To work around this problem, drop
- each affected view and recreate it.
- mysqlcheck cannot fix names that contain literal instances of
- the @ character that is used for encoding special characters.
- If you have databases or tables that contain this character,
- use mysqldump to dump them before upgrading to MySQL 5.1, and
- then reload the dump file after upgrading.
+ The recommended way to install MySQL on RPM-based Linux
+ distributions is by using the RPM packages. The RPMs that we
+ provide to the community should work on all versions of Linux that
+ support RPM packages and use glibc 2.3. To obtain RPM packages,
+ see Section 2.1.3, "How to Get MySQL."
- * Known issue: When upgrading from MySQL 5.0 to versions of 5.1
- prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which
- runs mysqlcheck) to upgrade tables fails for names that must
- be written as quoted identifiers. To work around this problem,
- rename each affected table to a name that does not require
- quoting:
-RENAME TABLE `tab``le_a` TO table_a;
-RENAME TABLE `table b` TO table_b;
- After renaming the tables, run the mysql_upgrade program. Then
- rename the tables back to their original names:
-RENAME TABLE table_a TO `tab``le_a`;
-RENAME TABLE table_b TO `table b`;
+ For non-RPM Linux distributions, you can install MySQL using a
+ .tar.gz package. See Section 2.2, "Installing MySQL from Generic
+ Binaries on Unix/Linux."
- * Known issue: In connection with view creation, the server
- created arc directories inside database directories and
- maintained useless copies of .frm files there. Creation and
- renaming procedures of those copies as well as creation of arc
- directories has been discontinued in MySQL 5.1.29.
- This change does cause a problem when downgrading to older
- server versions which manifests itself under these
- circumstances:
+ We do provide some platform-specific RPMs; the difference between
+ a platform-specific RPM and a generic RPM is that a
+ platform-specific RPM is built on the targeted platform and is
+ linked dynamically whereas a generic RPM is linked statically with
+ LinuxThreads.
- 1. Create a view v_orig in MySQL 5.1.29 or higher.
+Note
- 2. Rename the view to v_new and then back to v_orig.
+ RPM distributions of MySQL often are provided by other vendors. Be
+ aware that they may differ in features and capabilities from those
+ built by us, and that the instructions in this manual do not
+ necessarily apply to installing them. The vendor's instructions
+ should be consulted instead.
- 3. Downgrade to an older 5.1.x server and run mysql_upgrade.
+ In most cases, you need to install only the MySQL-server and
+ MySQL-client packages to get a functional MySQL installation. The
+ other packages are not required for a standard installation.
- 4. Try to rename v_orig to v_new again. This operation
- fails.
- As a workaround to avoid this problem, use either of these
- approaches:
+ RPMs for MySQL Cluster. Beginning with MySQL 5.1.24, standard
+ MySQL server RPMs built by MySQL no longer provide support for the
+ NDBCLUSTER storage engine. MySQL Cluster users wanting to upgrade
+ MySQL 5.1.23 or earlier installations from RPMs built by MySQL
+ should upgrade to MySQL Cluster NDB 6.2 or MySQL Cluster NDB 6.3;
+ RPMs that should work with most Linux distributions are available
+ for both of these release series.
- + Dump your data using mysqldump before downgrading and
- reload the dump file after downgrading.
+Important
- + Instead of renaming a view after the downgrade, drop it
- and recreate it.
+ When upgrading a MySQL Cluster RPM installation, you must upgrade
+ all installed RPMs, including the Server and Client RPMs.
- * Incompatible change: Character set or collation changes were
- made in MySQL 5.1.21, 5.1.23, and 5.1.24 that may require
- table indexes to be rebuilt. For details, see Section 2.12.3,
- "Checking Whether Table Indexes Must Be Rebuilt."
+ For more information about installing MySQL Cluster from RPMs, see
+ Section 17.2.1, "MySQL Cluster Multi-Computer Installation."
- * Incompatible change: In MySQL 5.1.36, options for loading
- plugins such as pluggable storage engines were changed from
- boolean to tristate format. The implementations overlap, but
- if you previously used options of the form --plugin_name=0 or
- --plugin_name=1, you should instead use --plugin_name=OFF or
- --plugin_name=ON, respectively. For details, see Section
- 5.1.3, "Server Options for Loading Plugins."
+ For upgrades, if your installation was originally produced by
+ installing multiple RPM packages, it is best to upgrade all the
+ packages, not just some. For example, if you previously installed
+ the server and client RPMs, do not upgrade just the server RPM.
- * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE
- statement was changed such that assigning NULL to a NOT NULL
- column caused an error even when strict SQL mode was not
- enabled. The original behavior before MySQL 5.1.24 was that
- such assignments caused an error only in strict SQL mode, and
- otherwise set the column to the implicit default value for the
- column data type and generated a warning. (For information
- about implicit default values, see Section 10.1.4, "Data Type
- Default Values.")
- The change caused compatibility problems for applications that
- relied on the original behavior. It also caused replication
- problems between servers that had the original behavior and
- those that did not, for applications that assigned NULL to NOT
- NULL columns in UPDATE statements without strict SQL mode
- enabled. The change was reverted in MySQL 5.1.32 so that
- UPDATE again had the original behavior. Problems can still
- occur if you replicate between servers that have the modified
- UPDATE behavior and those that do not.
+ The RPM packages shown in the following list are available. The
+ names shown here use a suffix of .glibc23.i386.rpm, but particular
+ packages can have different suffixes, described later.
- * Incompatible change: As of MySQL 5.1.29, the default binary
- logging mode has been changed from MIXED to STATEMENT for
- compatibility with MySQL 5.0.
+ * MySQL-server-VERSION.glibc23.i386.rpm
+ The MySQL server. You need this unless you only want to
+ connect to a MySQL server running on another machine.
- * Incompatible change: In MySQL 5.1.25, a change was made to the
- way that the server handles prepared statements. This affects
- prepared statements processed at the SQL level (using the
- PREPARE statement) and those processed using the binary
- client-server protocol (using the mysql_stmt_prepare() C API
- function).
- Previously, changes to metadata of tables or views referred to
- in a prepared statement could cause a server crash when the
- statement was next executed, or perhaps an error at execute
- time with a crash occurring later. For example, this could
- happen after dropping a table and recreating it with a
- different definition.
- Now metadata changes to tables or views referred to by
- prepared statements are detected and cause automatic
- repreparation of the statement when it is next executed.
- Metadata changes occur for DDL statements such as those that
- create, drop, alter, rename, or truncate tables, or that
- analyze, optimize, or repair tables. Repreparation also occurs
- after referenced tables or views are flushed from the table
- definition cache, either implicitly to make room for new
- entries in the cache, or explicitly due to FLUSH TABLES.
- Repreparation is automatic, but to the extent that it occurs,
- performance of prepared statements is diminished.
- Table content changes (for example, with INSERT or UPDATE) do
- not cause repreparation, nor do SELECT statements.
- An incompatibility with previous versions of MySQL is that a
- prepared statement may now return a different set of columns
- or different column types from one execution to the next. For
- example, if the prepared statement is SELECT * FROM t1,
- altering t1 to contain a different number of columns causes
- the next execution to return a number of columns different
- from the previous execution.
- Older versions of the client library cannot handle this change
- in behavior. For applications that use prepared statements
- with the new server, an upgrade to the new client library is
- strongly recommended.
- Along with this change to statement repreparation, the default
- value of the table_definition_cache system variable has been
- increased from 128 to 256. The purpose of this increase is to
- lessen the chance that prepared statements will need
- repreparation due to referred-to tables/views having been
- flushed from the cache to make room for new entries.
- A new status variable, Com_stmt_reprepare, has been introduced
- to track the number of repreparations.
+ * MySQL-client-VERSION.glibc23.i386.rpm
+ The standard MySQL client programs. You probably always want
+ to install this package.
- * Incompatible change: As of MySQL 5.1.23, within a stored
- routine, it is no longer allowable to declare a cursor for a
- SHOW or DESCRIBE statement. This happened to work in some
- instances, but is no longer supported. In many cases, a
- workaround for this change is to use the cursor with a SELECT
- query to read from an INFORMATION_SCHEMA table that produces
- the same information as the SHOW statement.
+ * MySQL-devel-VERSION.glibc23.i386.rpm
+ The libraries and include files that are needed if you want to
+ compile other MySQL clients, such as the Perl modules.
- * Incompatible change: SHOW CREATE VIEW displays view
- definitions using an AS alias_name clause for each column. If
- a column is created from an expression, the default alias is
- the expression text, which can be quite long. As of MySQL
- 5.1.23, aliases for column names in CREATE VIEW statements are
- checked against the maximum column length of 64 characters
- (not the maximum alias length of 256 characters). As a result,
- views created from the output of SHOW CREATE VIEW fail if any
- column alias exceeds 64 characters. This can cause problems
- for replication or loading dump files. For additional
- information and workarounds, see Section D.4, "Restrictions on
- Views."
+ * MySQL-debuginfo-VERSION.glibc23.i386.rpm
+ This package contains debugging information. debuginfo RPMs
+ are never needed to use MySQL software; this is true both for
+ the server and for client programs. However, they contain
+ additional information that might be needed by a debugger to
+ analyze a crash.
- * Incompatible change: MySQL 5.1 implements support for a plugin
- API that allows the loading and unloading of components at
- runtime, without restarting the server. Section 22.2, "The
- MySQL Plugin Interface." The plugin API requires the
- mysql.plugin table. After upgrading from an older version of
- MySQL, you should run the mysql_upgrade command to create this
- table. See Section 4.4.8, "mysql_upgrade --- Check Tables for
- MySQL Upgrade."
- Plugins are installed in the directory named by the plugin_dir
- system variable. This variable also controls the location from
- which the server loads user-defined functions (UDFs), which is
- a change from earlier versions of MySQL. That is, all UDF
- library files now must be installed in the plugin directory.
- When upgrading from an older version of MySQL, you must
- migrate your UDF files to the plugin directory.
+ * MySQL-shared-VERSION.glibc23.i386.rpm
+ This package contains the shared libraries
+ (libmysqlclient.so*) that certain languages and applications
+ need to dynamically load and use MySQL. It contains
+ single-threaded and thread-safe libraries. If you install this
+ package, do not install the MySQL-shared-compat package.
- * Incompatible change: The table_cache system variable has been
- renamed to table_open_cache. Any scripts that refer to
- table_cache must be updated to use the new name.
+ * MySQL-shared-compat-VERSION.glibc23.i386.rpm
+ This package includes the shared libraries for MySQL 3.23,
+ 4.0, and so on, up to the current release. It contains
+ single-threaded and thread-safe libraries. Install this
+ package instead of MySQL-shared if you have applications
+ installed that are dynamically linked against older versions
+ of MySQL but you want to upgrade to the current version
+ without breaking the library dependencies.
- * Incompatible change: Several issues were identified for stored
- programs (stored procedures and functions, triggers, and
- events) and views containing non-ASCII symbols. These issues
- involved conversion errors due to incomplete character set
- information when translating these objects to and from stored
- format.
- To address these problems, the representation for these
- objects was changed in MySQL 5.1.21. However, the fixes affect
- all stored programs and views. (For example, you will see
- warnings about "no creation context.") To avoid warnings from
- the server about the use of old definitions from any release
- prior to 5.1.21, you should dump stored programs and views
- with mysqldump after upgrading to 5.1.21 or higher, and then
- reload them to recreate them with new definitions. Invoke
- mysqldump with a --default-character-set option that names the
- non-ASCII character set that was used for the definitions when
- the objects were originally defined.
+ * MySQL-shared-compat-advanced-gpl-VERSION.glibc23.i386.rpm,
+ MySQL-shared-compat-advanced-VERSION.glibc23.i386.rpm
+ These are like the MySQL-shared-compat package, but are for
+ the "MySQL Enterprise Server - Advanced Edition" products.
+ Install these packages rather than the normal
+ MySQL-shared-compat package if you want to included shared
+ client libraries for older MySQL versions.
- * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports
- error logging to syslog on systems that support the logger
- command. The new --syslog and --skip-syslog options can be
- used instead of the --log-error option to control logging
- behavior, as described in Section 4.3.2, "mysqld_safe ---
- MySQL Server Startup Script."
- In 5.1.21 and up, the default is --skip-syslog, which is
- compatible with the default behavior of writing an error log
- file for releases prior to 5.1.20.
- In 5.1.20 only, the following conditions apply: 1) The default
- is to use syslog, which is not compatible with releases prior
- to 5.1.20. 2) Logging to syslog may fail to operate correctly
- in some cases. For these reasons, avoid using MySQL 5.1.20.
+ * MySQL-embedded-VERSION.glibc23.i386.rpm
+ The embedded MySQL server library.
- * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back
- only the last statement on a transaction timeout. A new
- option, --innodb_rollback_on_timeout, causes InnoDB to abort
- and roll back the entire transaction if a transaction timeout
- occurs (the same behavior as in MySQL 4.1).
+ * MySQL-ndb-management-VERSION.glibc23.i386.rpm,
+ MySQL-ndb-storage-VERSION.glibc23.i386.rpm,
+ MySQL-ndb-tools-VERSION.glibc23.i386.rpm,
+ MySQL-ndb-extra-VERSION.glibc23.i386.rpm
+ Packages that contain additional files for MySQL Cluster
+ installations.
+
+Note
+ The MySQL-ndb-tools RPM requires a working installation of
+ perl. Prior to MySQL 5.1.18, the DBI and HTML::Template
+ packages were also required. See Section 2.15, "Perl
+ Installation Notes," and Section 17.4.21, "ndb_size.pl ---
+ NDBCLUSTER Size Requirement Estimator," for more information.
+
+ * MySQL-test-VERSION.glibc23.i386.rpm
+ This package includes the MySQL test suite.
+
+ * MySQL-VERSION.src.rpm
+ This contains the source code for all of the previous
+ packages. It can also be used to rebuild the RPMs on other
+ architectures (for example, Alpha or SPARC).
- * Incompatible change: As of MySQL 5.1.15, the following
- conditions apply to enabling the read_only system variable:
+ The suffix of RPM package names (following the VERSION value) has
+ the following syntax:
+.PLATFORM.CPU.rpm
- + If you attempt to enable read_only while you have any
- explicit locks (acquired with LOCK TABLES or have a
- pending transaction, an error will occur.
+ The PLATFORM and CPU values indicate the type of system for which
+ the package is built. PLATFORM indicates the platform and CPU
+ indicates the processor type or family.
- + If other clients hold explicit table locks or have
- pending transactions, the attempt to enable read_only
- blocks until the locks are released and the transactions
- end. While the attempt to enable read_only is pending,
- requests by other clients for table locks or to begin
- transactions also block until read_only has been set.
+ All packages are dynamically linked against glibc 2.3. The
+ PLATFORM value indicates whether the package is platform
+ independent or intended for a specific platform, as shown in the
+ following table.
+ glibc23 Platform independent, should run on any Linux distribution
+ that supports glibc 2.3
+ rhel3, rhel4 Red Hat Enterprise Linux 3 or 4
+ sles9, sles10 SuSE Linux Enterprise Server 9 or 10
- + read_only can be enabled while you hold a global read
- lock (acquired with FLUSH TABLES WITH READ LOCK) because
- that does not involve table locks.
- Previously, the attempt to enable read_only would return
- immediately even if explicit locks or transactions were
- pending, so some data changes could occur for statements
- executing in the server at the same time.
+ In MySQL 5.1, only glibc23 packages are available currently.
- * Incompatible change: The number of function names affected by
- IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from
- about 200 to about 30. (For details about IGNORE_SPACE, see
- Section 8.2.4, "Function Name Parsing and Resolution.") This
- change improves the consistency of parser operation. However,
- it also introduces the possibility of incompatibility for old
- SQL code that relies on the following conditions:
+ The CPU value indicates the processor type or family for which the
+ package is built.
+ i386 x86 processor, 386 and up
+ i586 x86 processor, Pentium and up
+ x86_64 64-bit x86 processor
+ ia64 Itanium (IA-64) processor
- + IGNORE_SPACE is disabled.
+ To see all files in an RPM package (for example, a MySQL-server
+ RPM), run a command like this:
+shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm
- + The presence or absence of whitespace following a
- function name is used to distinguish between a built-in
- function and stored function that have the same name (for
- example, PI() versus PI ()).
- For functions that are no longer affected by IGNORE_SPACE as
- of MySQL 5.1.13, that strategy no longer works. Either of the
- following approaches can be used if you have code that is
- subject to the preceding incompatibility:
+ To perform a standard minimal installation, install the server and
+ client RPMs:
+shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm
+shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
- + If a stored function has a name that conflicts with a
- built-in function, refer to the stored function with a
- schema name qualifier, regardless of whether whitespace
- is present. For example, write schema_name.PI() or
- schema_name.PI ().
+ To install only the client programs, install just the client RPM:
+shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
- + Alternatively, rename the stored function to use a
- nonconflicting name and change invocations of the
- function to use the new name.
+ RPM provides a feature to verify the integrity and authenticity of
+ packages before installing them. If you would like to learn more
+ about this feature, see Section 2.1.4, "Verifying Package
+ Integrity Using MD5 Checksums or GnuPG."
- * Incompatible change: For utf8 columns, the full-text parser
- incorrectly considered several nonword punctuation and
- whitespace characters as word characters, causing some
- searches to return incorrect results. The fix involves a
- change to the full-text parser in MySQL 5.1.12, so as of
- 5.1.12, any tables that have FULLTEXT indexes on utf8 columns
- must be repaired with REPAIR TABLE:
-REPAIR TABLE tbl_name QUICK;
+ The server RPM places data under the /var/lib/mysql directory. The
+ RPM also creates a login account for a user named mysql (if one
+ does not exist) to use for running the MySQL server, and creates
+ the appropriate entries in /etc/init.d/ to start the server
+ automatically at boot time. (This means that if you have performed
+ a previous installation and have made changes to its startup
+ script, you may want to make a copy of the script so that you
+ don't lose it when you install a newer RPM.) See Section 2.13.1.2,
+ "Starting and Stopping MySQL Automatically," for more information
+ on how MySQL can be started automatically on system startup.
- * Incompatible change: Storage engines can be pluggable at
- runtime, so the distinction between disabled and invalid
- storage engines no longer applies. As of MySQL 5.1.12, this
- affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in
- Section 5.1.8, "Server SQL Modes."
+ If you want to install the MySQL RPM on older Linux distributions
+ that do not support initialization scripts in /etc/init.d
+ (directly or via a symlink), you should create a symbolic link
+ that points to the location where your initialization scripts
+ actually are installed. For example, if that location is
+ /etc/rc.d/init.d, use these commands before installing the RPM to
+ create /etc/init.d as a symbolic link that points there:
+shell> cd /etc
+shell> ln -s rc.d/init.d .
- * Incompatible change: The structure of FULLTEXT indexes has
- been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or
- greater, any tables that have FULLTEXT indexes must be
- repaired with REPAIR TABLE:
-REPAIR TABLE tbl_name QUICK;
+ However, all current major Linux distributions should support the
+ new directory layout that uses /etc/init.d, because it is required
+ for LSB (Linux Standard Base) compliance.
- * Incompatible change: In MySQL 5.1.6, when log tables were
- implemented, the default log destination for the general query
- and slow query log was TABLE. As of MySQL 5.1.21, this default
- has been changed to FILE, which is compatible with MySQL 5.0,
- but incompatible with earlier releases of MySQL 5.1. If you
- are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging
- option changes should be necessary. However, if you are
- upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and
- were using TABLE logging, use the --log-output=TABLE option
- explicitly to preserve your server's table-logging behavior.
+ If the RPM files that you install include MySQL-server, the mysqld
+ server should be up and running after installation. You should be
+ able to start using MySQL.
- * Incompatible change: For ENUM columns that had enumeration
- values containing commas, the commas were mapped to 0xff
- internally. However, this rendered the commas
- indistinguishable from true 0xff characters in the values.
- This no longer occurs. However, the fix requires that you dump
- and reload any tables that have ENUM columns containing true
- 0xff in their values: Dump the tables using mysqldump with the
- current server before upgrading from a version of MySQL 5.1
- older than 5.1.15 to version 5.1.15 or newer.
+ If something goes wrong, you can find more information in the
+ binary installation section. See Section 2.2, "Installing MySQL
+ from Generic Binaries on Unix/Linux."
- * As of MySQL 5.1.12, the lc_time_names system variable
- specifies the locale that controls the language used to
- display day and month names and abbreviations. This variable
- affects the output from the DATE_FORMAT(), DAYNAME() and
- MONTHNAME() functions. See Section 9.8, "MySQL Server Locale
- Support."
+Note
- * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes
- mysqld-max if it exists. Instead, it invokes mysqld unless a
- --mysqld or --mysqld-version option is given to specify
- another server explicitly. If you previously relied on the
- implicit invocation of mysqld-max, you should use an
- appropriate option now. As of MySQL 5.1.12, there is no longer
- any separate mysqld-max server, so no change should be
- necessary.
+ The accounts that are listed in the MySQL grant tables initially
+ have no passwords. After starting the server, you should set up
+ passwords for them using the instructions in Section 2.13,
+ "Post-Installation Setup and Testing."
- SQL Changes:
+ During RPM installation, a user named mysql and a group named
+ mysql are created on the system. This is done using the useradd,
+ groupadd, and usermod commands. Those commands require appropriate
+ administrative privileges, which is ensured for locally managed
+ users and groups (as listed in the /etc/passwd and /etc/group
+ files) by the RPM installation process being run by root.
- * Known issue: Prior to MySQL 5.1.17, the parser accepted
- invalid code in SQL condition handlers, leading to server
- crashes or unexpected execution behavior in stored programs.
- Specifically, the parser allowed a condition handler to refer
- to labels for blocks that enclose the handler declaration.
- This was incorrect because block label scope does not include
- the code for handlers declared within the labeled block.
- As of 5.1.17, the parser rejects this invalid construct, but
- if you perform a binary upgrade (without dumping and reloading
- your databases), existing handlers that contain the construct
- still are invalid and should be rewritten even if they appear
- to function as you expect.
- To find affected handlers, use mysqldump to dump all stored
- procedures and functions, triggers, and events. Then attempt
- to reload them into an upgraded server. Handlers that contain
- illegal label references will be rejected.
- For more information about condition handlers and writing them
- to avoid invalid jumps, see Section 12.8.4.2, "DECLARE for
- Handlers."
+ For nonlocal user management (LDAP, NIS, and so forth), the
+ administrative tools may require additional authentication (such
+ as a password), and will fail if the installing user does not
+ provide this authentication. Even if they fail, the RPM
+ installation will not abort but succeed, and this is intentional.
+ If they failed, some of the intended transfer of ownership may be
+ missing, and it is recommended that the system administrator then
+ manually ensures some appropriate user andgroup exists and
+ manually transfers ownership following the actions in the RPM spec
+ file.
- * Incompatible change: The parser accepted statements that
- contained /* ... */ that were not properly closed with */,
- such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that
- contain unclosed /*-comments now are rejected with a syntax
- error.
- This fix has the potential to cause incompatibilities. Because
- of Bug#26302: http://bugs.mysql.com/26302, which caused the
- trailing */ to be truncated from comments in views, stored
- routines, triggers, and events, it is possible that objects of
- those types may have been stored with definitions that now
- will be rejected as syntactically invalid. Such objects should
- be dropped and re-created so that their definitions do not
- contain truncated comments.
+2.7. Installing MySQL on Mac OS X
- * Incompatible change: Multiple-table DELETE statements
- containing ambiguous aliases could have unintended side
- effects such as deleting rows from the wrong table. Example:
-DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
- As of MySQL 5.1.23, alias declarations can be declared only in
- the table_references part. Elsewhere in the statement, alias
- references are allowed but not alias declarations. Statements
- containing aliases that are no longer allowed must be
- rewritten.
+ MySQL for Mac OS X is available in a number of different forms:
- * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is
- still accepted as a synonym for the ENGINE = engine_name table
- option but generates a warning. You should note that this
- option is not available in MySQL 5.1.7, and is removed
- altogether as of MySQL 6.0 and produces a syntax error.
- TYPE has been deprecated since MySQL 4.0.
+ * Native Package Installer format, which uses the native Mac OS
+ X installer to walk you through the installation of MySQL. For
+ more information, see Section 2.7.1, "Installing MySQL Using
+ the Installation Package." You can use the package installer
+ with Mac OS X 10.3 and later, and available for both PowerPC
+ and Intel architectures, and both 32-bit and 64-bit
+ architectures. There is no Universal Binary available using
+ the package installation method. The user you use to perform
+ the installation must have administrator privileges.
+
+ * Tar package format, which uses a file packaged using the Unix
+ tar and gzip commands. To use this method, you will need to
+ open a Terminal window. You do not need administrator
+ privileges using this method, as you can install the MySQL
+ server anywhere using this method. For more information on
+ using this method, you can use the generic instructions for
+ using a tarball, Section 2.2, "Installing MySQL from Generic
+ Binaries on Unix/Linux."You can use the package installer with
+ Mac OS X 10.3 and later, and available for both PowerPC and
+ Intel architectures, and both 32-bit and 64-bit architectures.
+ A Universal Binary, incorporating both Power PC and Intel
+ architectures and 32-bit and 64-bit binaries is available.
+ In addition to the core installation, the Package Installer
+ also includes Section 2.7.2, "Installing the MySQL Startup
+ Item" and Section 2.7.3, "Installing and Using the MySQL
+ Preference Pane," both of which simplify the management of
+ your installation.
+
+ * Mac OS X server includes a version of MySQL as standard. If
+ you want to use a more recent version than that supplied with
+ the Mac OS X server release, you can make use of the package
+ or tar formats. For more information on using the MySQL
+ bundled with Mac OS X, see Section 2.7.4, "Using MySQL on Mac
+ OS X Server."
- * Incompatible change: The namespace for triggers changed in
- MySQL 5.0.10. Previously, trigger names had to be unique per
- table. Now they must be unique within the schema (database).
- An implication of this change is that DROP TRIGGER syntax now
- uses a schema name instead of a table name (schema name is
- optional and, if omitted, the current schema will be used).
- When upgrading from a version of MySQL 5 older than 5.0.10 to
- MySQL 5.0.10 or newer, you must drop all triggers and
- re-create them or DROP TRIGGER will not work after the
- upgrade. Here is a suggested procedure for doing this:
+ For additional information on using MySQL on Mac OS X, see Section
+ 2.7.5, "MySQL Installation on Mac OS X Notes."
- 1. Upgrade to MySQL 5.0.10 or later to be able to access
- trigger information in the INFORMATION_SCHEMA.TRIGGERS
- table. (This should work even for pre-5.0.10 triggers.)
+2.7.1. Installing MySQL Using the Installation Package
- 2. Dump all trigger definitions using the following SELECT
- statement:
-SELECT CONCAT('CREATE TRIGGER ', t.TRIGGER_SCHEMA, '.', t.TRIGGER_NAM
-E,
- ' ', t.ACTION_TIMING, ' ', t.EVENT_MANIPULATION, ' ON '
-,
- t.EVENT_OBJECT_SCHEMA, '.', t.EVENT_OBJECT_TABLE,
- ' FOR EACH ROW ', t.ACTION_STATEMENT, '//' )
-INTO OUTFILE '/tmp/triggers.sql'
-FROM INFORMATION_SCHEMA.TRIGGERS AS t;
- The statement uses INTO OUTFILE, so you must have the
- FILE privilege. The file will be created on the server
- host. Use a different file name if you like. To be 100%
- safe, inspect the trigger definitions in the triggers.sql
- file, and perhaps make a backup of the file.
+ You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
+ using a Mac OS X binary package in PKG format instead of the
+ binary tarball distribution. Please note that older versions of
+ Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this
+ package.
- 3. Stop the server and drop all triggers by removing all
- .TRG files in your database directories. Change location
- to your data directory and issue this command:
-shell> rm */*.TRG
+ The package is located inside a disk image (.dmg) file that you
+ first need to mount by double-clicking its icon in the Finder. It
+ should then mount the image and display its contents.
- 4. Start the server and re-create all triggers using the
- triggers.sql file:
-mysql> delimiter // ;
-mysql> source /tmp/triggers.sql //
+Note
- 5. Check that all triggers were successfully created using
- the SHOW TRIGGERS statement.
+ Before proceeding with the installation, be sure to shut down all
+ running MySQL server instances by either using the MySQL Manager
+ Application (on Mac OS X Server) or via mysqladmin shutdown on the
+ command line.
- * Incompatible change: MySQL 5.1.6 introduces the TRIGGER
- privilege. Previously, the SUPER privilege was needed to
- create or drop triggers. Now those operations require the
- TRIGGER privilege. This is a security improvement because you
- no longer need to grant users the SUPER privilege to enable
- them to create triggers. However, the requirement that the
- account named in a trigger's DEFINER clause must have the
- SUPER privilege has changed to a requirement for the TRIGGER
- privilege. When upgrading from a previous version of MySQL 5.0
- or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant
- tables by running mysql_upgrade. This will assign the TRIGGER
- privilege to all accounts that had the SUPER privilege. If you
- fail to update the grant tables, triggers may fail when
- activated. After updating the grant tables, you can revoke the
- SUPER privilege from those accounts that no longer otherwise
- require it.
+ When installing from the package version, you should also install
+ the MySQL Preference Pane, which will allow you to control the
+ startup and execution of your MySQL server from System
+ Preferences. For more information, see Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+ When installing using the package installer, the files are
+ installed into a directory within /usr/local matching the name of
+ the installation version and platform. For example, the installer
+ file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
+ /usr/local/mysql-5.1.39-osx10.5-x86_64 . The installation layout
+ of the directory is as shown in the following table:
+ Directory Contents of Directory
+ bin Client programs and the mysqld server
+ data Log files, databases
+ docs Manual in Info format
+ include Include (header) files
+ lib Libraries
+ man Unix manual pages
+ mysql-test MySQL test suite
+ scripts Contains the mysql_install_db script
+ share/mysql Error message files
+ sql-bench Benchmarks
+ support-files Scripts and sample configuration files
+ /tmp/mysql.sock The location of the MySQL Unix socket
+
+ During the package installer process, a symbolic link from
+ /usr/local/mysql to the version/platform specific directory
+ created during installation will be created automatically.
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQL installer package. It will be named
+ according to the version of MySQL you have downloaded. For
+ example, if you have downloaded MySQL 5.1.39, double-click
+ mysql-5.1.39-osx10.5-x86.pkg.
+
+ 3. You will be presented with the openin installer dialog. Click
+ Continue to begihn installation.
+ MySQL Package Installer: Step 1
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. If you have downloaded the community version of MySQL, you
+ will be shown a copy of the relevent GNU General Public
+ License. Click Continue .
+
+ 6. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Package Installer: Step 4
+
+ 7. You will be asked to confirm the details of the installation,
+ including the space required for the installation. To change
+ the drive on which the startup item is installed you can click
+ either Go Back or Change Install Location.... To install the
+ startup item, click Install.
- * Some keywords are reserved in MySQL 5.1 that were not reserved
- in MySQL 5.0. See Section 8.3, "Reserved Words."
+ 8. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
- * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER
- statements are deprecated. See Section 12.6.2.2, "LOAD DATA
- FROM MASTER Syntax," for recommended alternatives.
+ Once you have completed the basic installation, you must complete
+ the post-installation steps as specifed in Section 2.13,
+ "Post-Installation Setup and Testing."
- * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are
- used for the plugin API are new. So is the WITH PARSER clause
- for FULLTEXT index creation that associates a parser plugin
- with a full-text index. Section 22.2, "The MySQL Plugin
- Interface."
+ For convenience, you may also want to install the Section 2.7.2,
+ "Installing the MySQL Startup Item" and Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+2.7.2. Installing the MySQL Startup Item
+
+ The MySQL Installation Package includes a startup item that can be
+ used to automatically startup and shutdown MySQL during boot.
+
+ To install the MySQL Startup Item:
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQLStartItem.pkg file to start the
+ installation process.
+
+ 3. You will be presented with the Install MySQL Startup Item
+ dialog.
+ MySQL Startup Item Installer: Step 1
+ Click Continue to continue the installation process.
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Startup Item Installer: Step 3
+
+ 6. You will be asked to confirm the details of the installation.
+ To change the drive on which the startup item is installed you
+ can click either Go Back or Change Install Location.... To
+ install the startup item, click Install.
+
+ 7. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
+ MySQL Startup Item Installer: Step 5
- C API Changes:
+ The Startup Item for MySQL is installed into
+ /Library/StartupItems/MySQLCOM. The Startup Item installation adds
+ a variable MYSQLCOM=-YES- to the system configuration file
+ /etc/hostconfig. If you want to disable the automatic startup of
+ MySQL, simply change this variable to MYSQLCOM=-NO-.
- * Incompatible change: As of MySQL 5.1.7, the
- mysql_stmt_attr_get() C API function returns a boolean rather
- than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH.
- (Bug#16144: http://bugs.mysql.com/16144)
+ After the installation, you can start up MySQL by running the
+ following commands in a terminal window. You must have
+ administrator privileges to perform this task.
-2.12.2. Downgrading MySQL
+ If you have installed the Startup Item, use this command to start
+ the server:
+shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
- This section describes what you should do to downgrade to an older
- MySQL version in the unlikely case that the previous version
- worked better than the new one.
+ You may be prompted for your password to complete the startup.
- If you are downgrading within the same release series (for
- example, from 5.0.13 to 5.0.12) the general rule is that you just
- have to install the new binaries on top of the old ones. There is
- no need to do anything with the databases. As always, however, it
- is always a good idea to make a backup.
+ If you have installed the Startup Item, use this command to stop
+ the server:
+shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
+
+ You may be prompted for your password to complete the shutdown.
+
+2.7.3. Installing and Using the MySQL Preference Pane
+
+ The MySQL Package installer disk image also includes a custom
+ MySQL Preference Pane that enables you to start, stop and control
+ automated startup during boot of your MySQL installation.
+
+ To install the MySQL Preference Pane:
+
+ 1. Download and open the MySQL package installer package, which
+ is provided on a disk image (.dmg). Double-click to open the
+ disk image, which includes the main MySQL installation
+ package, the MySQLStartupItem.pkg installation package, and
+ the MySQL.prefPane.
+
+ 2. Double click on MySQL.prefPane. The MySQL System Preferences
+ will open.
+
+ 3. If this is the first time you have installed the preference
+ pane, you will be asked to confirm installation and whether
+ you want to install the preference pane for all users, or only
+ the current user. To install the preference pane for all users
+ you will need administrator privileges. If necessary, you will
+ be prompted for the username and password for a user with
+ administrator privileges.
+
+ 4. If you already have the MySQL Preference Pane installed, you
+ will be asked to confirm whether you want to overwrite the
+ existing MySQL Preference Pane.
- The following items form a checklist of things you should do
- whenever you perform a downgrade:
+Note
- * Read the upgrading section for the release series from which
- you are downgrading to be sure that it does not have any
- features you really need. See Section 2.12.1, "Upgrading
- MySQL."
+ The MySQL Preference Pane only starts and stops MySQL installation
+ installed from the MySQL package installation that have been
+ installed in the default location.
+
+ Once the MySQL Preference Pane has been installed, you can control
+ your MySQL server instance using the preference pane. To use the
+ preference pane, open the System Preferences... from the Apple
+ menu. Select the MySQL preference pane by clicking on the MySQL
+ logo within the Other section of the preference panes list.
+ MySQL Preference Pane
+
+ The MySQL Preference Pane shows the current status of the MySQL
+ server, showing stopped (in red) if the server is not running and
+ running (in green) if the server has already been started. The
+ preference pane will also show the current setting for whether the
+ MySQL server has been set to start up automatically.
+
+ * To start MySQL using the preference pane:
+ Click Start MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to start
+ the MySQL server.
+
+ * To stop MySQL using the preference pane:
+ Click Stop MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to
+ shutdown the MySQL server.
+
+ * To automatically start the MySQL server when the system boots:
+ Check the checkbox next to Automatically Start MySQL Server on
+ Startup.
+
+ * To disable the automatic starting of the MySQL server when the
+ system boots:
+ Uncheck the checkbox next to Automatically Start MySQL Server
+ on Startup.
- * If there is a downgrading section for that version, you should
- read that as well.
+ You can close the System Preferences... once you have completed
+ your settings.
- * To see which new features were added between the version to
- which you are downgrading and your current version, see the
- change logs (Appendix C, "MySQL Change History").
+2.7.4. Using MySQL on Mac OS X Server
- * Check Section 2.12.3, "Checking Whether Table Indexes Must Be
- Rebuilt," to see whether changes to character sets or
- collations were made between your current version of MySQL and
- the version to which you are downgrading. If so and these
- changes affect your table indexes, you will need to rebuild
- the affected indexes using the instructions in Section 2.12.4,
- "Rebuilding or Repairing Tables or Indexes."
+ If you are running Mac OS X Server, a version of MySQL should
+ already be installed. The following table shows the versions of
+ MySQL that ship with Mac OS X Server versions.
+ Mac OS X Server Version MySQL Version
+ 10.2-10.2.2 3.23.51
+ 10.2.3-10.2.6 3.23.53
+ 10.3 4.0.14
+ 10.3.2 4.0.16
+ 10.4.0 4.1.10a
+ 10.5.0 5.0.45
+ 10.6.0 5.0.82
- In most cases, you can move the MySQL format files and data files
- between different versions on the same architecture as long as you
- stay within versions for the same release series of MySQL.
+ The installation layout of MySQL on Mac OS X Server is as shown in
+ the table below:
+ Directory Contents of Directory
+ /usr/bin Client programs
+ /var/mysql Log files, databases
+ /usr/libexec The mysqld server
+ /usr/share/man Unix manual pages
+ /usr/share/mysql/mysql-test MySQL test suite
+ /usr/share/mysql Contains the mysql_install_db script
+ /var/mysql/mysql.sock The location of the MySQL Unix socket
- If you downgrade from one release series to another, there may be
- incompatibilities in table storage formats. In this case, use
- mysqldump to dump your tables before downgrading. After
- downgrading, reload the dump file using mysql or mysqlimport to
- re-create your tables. For examples, see Section 2.12.5, "Copying
- MySQL Databases to Another Machine."
+Note
- A typical symptom of a downward-incompatible table format change
- when you downgrade is that you cannot open tables. In that case,
- use the following procedure:
+ The MySQL server bundled with Mac OS X Server does not include the
+ MySQL client libraries and header files required if you want to
+ access and use MySQL from a third-party driver, such as Perl DBI
+ or PHP. For more information on obtaining and installing MySQL
+ libraries, see Mac OS X Server version 10.5: MySQL libraries
+ available for download (http://support.apple.com/kb/TA25017)
+ Alternatively, you can ignore the bundled MySQL server and install
+ MySQL from the package or tarball installation.
+
+ For more information on managing the bundled MySQL instance in Mac
+ OS X Server 10.5, see Mac OS X Server: Web Technologies
+ Administration For Version 10.5 Leopard
+ (http://images.apple.com/server/macosx/docs/Web_Technologies_Admin
+ _v10.5.pdf). For more information on managing the bundled MySQL
+ instance in Mac OS X Server 10.6, see Mac OS X Server: Web
+ Technologies Administration Version 10.6 Snow Leopard
+ (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf)
+
+2.7.5. MySQL Installation on Mac OS X Notes
+
+ You should keep the following issues and notes in mind:
+
+ * The default location for the MySQL Unix socket is different on
+ Mac OS X and Mac OS X Server depending on the installation
+ type you chose. The default locations by installation are as
+ follows:
- 1. Stop the older MySQL server that you are downgrading to.
+ Package Installer from MySQL /tmp/mysql.sock
+ Tarball from MySQL /tmp/mysql.sock
+ MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
+ To prevent issues, you should either change the configuration
+ of the socket used within your application (for example,
+ changing php.ini), or you should configure the socket location
+ using a MySQL configuration file and the socket option. For
+ more information, see Section 5.1.2, "Server Command Options."
+
+ * You may need (or want) to create a specific mysql user to own
+ the MySQL directory and data. On Mac OS X 10.4 and lower you
+ can do this by using the Netinfo Manager application, located
+ within the Utilities folder within the Applications folder. On
+ Mac OS X 10.5 and later you can do this through the Directory
+ Utility. From Mac OS X 10.5 and later (including Mac OS X
+ Server 10.5) the mysql should already exist. For use in single
+ user mode, an entry for _mysql (note the underscore prefix)
+ should already exist within the system /etc/passwd file.
- 2. Restart the newer MySQL server you are downgrading from.
+ * Due to a bug in the Mac OS X package installer, you may see
+ this error message in the destination disk selection dialog:
+You cannot install this software on this disk. (null)
+ If this error occurs, simply click the Go Back button once to
+ return to the previous screen. Then click Continue to advance
+ to the destination disk selection again, and you should be
+ able to choose the destination disk correctly. We have
+ reported this bug to Apple and it is investigating this
+ problem.
+
+ * Because the MySQL package installer installs the MySQL
+ contents into a version and platform specific directory, you
+ can use this to upgrade and migrate your database between
+ versions. You will need to either copy the data directory from
+ the old version to the new version, or alternatively specify
+ an alternative datadir value to set location of the data
+ directory.
- 3. Dump any tables that were inaccessible to the older server by
- using mysqldump to create a dump file.
+ * You might want to add aliases to your shell's resource file to
+ make it easier to access commonly used programs such as mysql
+ and mysqladmin from the command line. The syntax for bash is:
+alias mysql=/usr/local/mysql/bin/mysql
+alias mysqladmin=/usr/local/mysql/bin/mysqladmin
+ For tcsh, use:
+alias mysql /usr/local/mysql/bin/mysql
+alias mysqladmin /usr/local/mysql/bin/mysqladmin
+ Even better, add /usr/local/mysql/bin to your PATH environment
+ variable. You can do this by modifying the appropriate startup
+ file for your shell. For more information, see Section 4.2.1,
+ "Invoking MySQL Programs."
+
+ * After you have copied over the MySQL database files from the
+ previous installation and have successfully started the new
+ server, you should consider removing the old installation
+ files to save disk space. Additionally, you should also remove
+ older versions of the Package Receipt directories located in
+ /Library/Receipts/mysql-VERSION.pkg.
- 4. Stop the newer MySQL server and restart the older one.
+2.8. Installing MySQL on Solaris
- 5. Reload the dump file into the older server. Your tables should
- be accessible.
+ To obtain a binary MySQL distribution for Solaris in tarball or
+ PKG format, http://dev.mysql.com/downloads/mysql/5.1.html.
- It might also be the case that the structure of the system tables
- in the mysql database has changed and that downgrading introduces
- some loss of functionality or requires some adjustments. Here are
- some examples:
+ If you install MySQL using a binary tarball distribution on
+ Solaris, you may run into trouble even before you get the MySQL
+ distribution unpacked, as the Solaris tar cannot handle long file
+ names. This means that you may see errors when you try to unpack
+ MySQL.
- * Trigger creation requires the TRIGGER privilege as of MySQL
- 5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is
- required instead. If you downgrade from MySQL 5.1 to 5.0, you
- will need to give the SUPER privilege to those accounts that
- had the TRIGGER privilege in 5.1.
+ If this occurs, you must use GNU tar (gtar) to unpack the
+ distribution.
- * Triggers were added in MySQL 5.0, so if you downgrade from 5.0
- to 4.1, you cannot use triggers at all.
+ You can install MySQL on Solaris using a binary package in PKG
+ format instead of the binary tarball distribution. Before
+ installing using the binary PKG format, you should create the
+ mysql user and group, for example:
+groupadd mysql
+useradd -g mysql mysql
-2.12.2.1. Downgrading to MySQL 5.0
+ Some basic PKG-handling commands follow:
- When downgrading to MySQL 5.0 from MySQL 5.1 or a later version,
- you should keep in mind the following issues relating to features
- found in MySQL 5.1 and later, but not in MySQL 5.0:
+ * To add a package:
+pkgadd -d package_name.pkg
- * Partitioning. MySQL 5.0 does not support user-defined
- partitioning. If a table was created as a partitioned table in
- 5.1 (or if an table created in a previous version of MySQL was
- altered to include partitions after an upgrade to 5.1), the
- table is accessible after downgrade only if you do one of the
- following:
+ * To remove a package:
+pkgrm package_name
- + Export the table using mysqldump and then drop it in
- MySQL 5.1; import the table again following the downgrade
- to MySQL 5.0.
+ * To get a full list of installed packages:
+pkginfo
- + Prior to the downgrade, remove the table's partitioning
- using ALTER TABLE table_name REMOVE PARTITIONING.
+ * To get detailed information for a package:
+pkginfo -l package_name
- * Event Scheduler. MySQL 5.0 does not support scheduled events.
- If your databases contain scheduled event definitions, you
- should prevent them from being dumped when you use mysqldump
- by using the --skip-events option. (See Section 4.5.4,
- "mysqldump --- A Database Backup Program.")
+ * To list the files belonging to a package:
+pkgchk -v package_name
- * Stored routines. MySQL 5.1.21 added a number of new columns
- to the mysql.proc table in which stored routine definitions
- are stored. If you are downgrading from MySQL 5.1.21 or later
- to MySQL 5.0, you cannot import the MySQL 5.1 routine
- definitions into MySQL 5.0.46 or earlier using the dump of
- mysql.proc created by mysqldump (such as when using the
- --all-databases option). Instead, you should run mysqldump
- --routines prior to performing the downgrade and run the
- stored routines DDL statements following the downgrade.
- See Bug#11986: http://bugs.mysql.com/11986,
- Bug#30029: http://bugs.mysql.com/30029, and
- Bug#30660: http://bugs.mysql.com/30660, for more information.
+ * To get packaging information for an arbitrary file:
+pkgchk -l -p file_name
- * Triggers. Trigger creation requires the TRIGGER privilege as
- of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and
- SUPER is required instead. If you downgrade from MySQL 5.1 to
- 5.0, you will need to give the SUPER privilege to those
- accounts that had the TRIGGER privilege in 5.1.
+2.8.1. Solaris Notes
-2.12.3. Checking Whether Table Indexes Must Be Rebuilt
+ For information about installing MySQL on Solaris using PKG
+ distributions, see Section 2.8, "Installing MySQL on Solaris."
- A binary upgrade or downgrade is one that installs one version of
- MySQL "in place" over an existing version, without dumping and
- reloading tables:
+ On Solaris, you may run into trouble even before you get the MySQL
+ distribution unpacked, as the Solaris tar cannot handle long file
+ names. This means that you may see errors when you try to unpack
+ MySQL.
- 1. Stop the server for the existing version if it is running.
+ If this occurs, you must use GNU tar (gtar) to unpack the
+ distribution.
- 2. Install a different version of MySQL. This is an upgrade if
- the new version is higher than the original version, a
- downgrade if the version is lower.
+ If you have an UltraSPARC system, you can get 4% better
+ performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the CFLAGS
+ and CXXFLAGS environment variables.
- 3. Start the server for the new version.
+ If you have Sun's Forte 5.0 (or newer) compiler, you can run
+ configure like this:
+CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
+CXX=CC CXXFLAGS="-noex -mt" \
+./configure --prefix=/usr/local/mysql --enable-assembler
- In many cases, the tables from the previous version of MySQL can
- be used without change by the new version. However, sometimes
- modifications are made to the handling of character sets or
- collations that change the character sort order, which causes the
- ordering of entries in any index that uses an affected character
- set or collation to be incorrect. Such changes result in several
- possible problems:
+ To create a 64-bit binary with Sun's Forte compiler, use the
+ following configuration options:
+CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
+CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
+./configure --prefix=/usr/local/mysql --enable-assembler
- * Comparison results that differ from previous results
+ To create a 64-bit Solaris binary using gcc, add -m64 to CFLAGS
+ and CXXFLAGS and remove --enable-assembler from the configure
+ line.
- * Inability to find some index values due to misordered index
- entries
+ In the MySQL benchmarks, we obtained a 4% speed increase on
+ UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
+ using gcc 3.2 with the -mcpu flag.
- * Misordered ORDER BY results
+ If you create a 64-bit mysqld binary, it is 4% slower than the
+ 32-bit binary, but can handle more threads and memory.
- * Tables that CHECK TABLE reports as being in need of repair
+ When using Solaris 10 for x86_64, you should mount any file
+ systems on which you intend to store InnoDB files with the
+ forcedirectio option. (By default mounting is done without this
+ option.) Failing to do so will cause a significant drop in
+ performance when using the InnoDB storage engine on this platform.
- The solution to these problems is to rebuild any indexes that use
- an affected character set or collation, either by dropping and
- re-creating the indexes, or by dumping and reloading the entire
- table. For information about rebuilding indexes, see Section
- 2.12.4, "Rebuilding or Repairing Tables or Indexes."
+ If you get a problem with fdatasync or sched_yield, you can fix
+ this by adding LIBS=-lrt to the configure line
- To check whether a table has indexes that must be rebuilt, consult
- the following list. It indicates which versions of MySQL
- introduced character set or collation changes that require indexes
- to be rebuilt. Each entry indicates the version in which the
- change occurred and the character sets or collations that the
- change affects. If the change is associated with a particular bug
- report, the bug number is given.
+ Solaris does not provide static versions of all system libraries
+ (libpthreads and libdl), so you cannot compile MySQL with
+ --static. If you try to do so, you get one of the following
+ errors:
+ld: fatal: library -ldl: not found
+undefined reference to `dlopen'
+cannot find -lrt
+
+ If you link your own MySQL client programs, you may see the
+ following error at runtime:
+ld.so.1: fatal: libmysqlclient.so.#:
+open failed: No such file or directory
+
+ This problem can be avoided by one of the following methods:
+
+ * Link clients with the -Wl,r/full/path/to/libmysqlclient.so
+ flag rather than with -Lpath).
- The list applies both for binary upgrades and downgrades. For
- example, Bug#29461: http://bugs.mysql.com/29461 was fixed in MySQL
- 5.0.48, so it applies to upgrades from versions older than 5.0.48
- to 5.0.48 or newer, and also to downgrades from 5.0.48 or newer to
- versions older than 5.0.48.
+ * Copy libmysqclient.so to /usr/lib.
- If you have tables with indexes that are affected, rebuild the
- indexes using the instructions given in Section 2.12.4,
- "Rebuilding or Repairing Tables or Indexes."
+ * Add the path name of the directory where libmysqlclient.so is
+ located to the LD_RUN_PATH environment variable before running
+ your client.
- In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify
- tables for which index rebuilding is required. (It will report:
- Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or
- dump/reload to fix it!) In these cases, you can also use
- mysqlcheck --check-upgrade or mysql_upgrade, which execute CHECK
- TABLE. However, the use of CHECK TABLE applies only after
- upgrades, not downgrades. Also, CHECK TABLE is not applicable to
- all storage engines. For details about which storage engines CHECK
- TABLE supports, see Section 12.5.2.3, "CHECK TABLE Syntax."
+ If you have problems with configure trying to link with -lz when
+ you don't have zlib installed, you have two options:
- Changes that cause index rebuilding to be necessary:
+ * If you want to be able to use the compressed communication
+ protocol, you need to get and install zlib from ftp.gnu.org.
- * MySQL 5.0.48 (Bug#29461: http://bugs.mysql.com/29461)
- Affects indexes for columns that use any of these character
- sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 6.0.8 (see
- Bug#39585: http://bugs.mysql.com/39585)
+ * Run configure with the --with-named-z-libs=no option when
+ building MySQL.
- * MySQL 5.0.48 (Bug#27562: http://bugs.mysql.com/27562)
- Affects indexes that use the ascii_general_ci collation for
- columns that contain any of these characters: '`' GRAVE
- ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
- RIGHT SQUARE BRACKET, '~' TILDE
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 6.0.8 (see
- Bug#39585: http://bugs.mysql.com/39585)
+ If you are using gcc and have problems with loading user-defined
+ functions (UDFs) into MySQL, try adding -lgcc to the link line for
+ the UDF.
- * MySQL 5.1.21 (Bug#29461: http://bugs.mysql.com/29461)
- Affects indexes for columns that use any of these character
- sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 6.0.8 (see
- Bug#39585: http://bugs.mysql.com/39585)
+ If you would like MySQL to start automatically, you can copy
+ support-files/mysql.server to /etc/init.d and create a symbolic
+ link to it named /etc/rc3.d/S99mysql.server.
- * MySQL 5.1.23 (Bug#27562: http://bugs.mysql.com/27562)
- Affects indexes that use the ascii_general_ci collation for
- columns that contain any of these characters: '`' GRAVE
- ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
- RIGHT SQUARE BRACKET, '~' TILDE
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 6.0.8 (see
- Bug#39585: http://bugs.mysql.com/39585)
+ If too many processes try to connect very rapidly to mysqld, you
+ should see this error in the MySQL log:
+Error in accept: Protocol error
- * MySQL 5.1.24 (Bug#27877: http://bugs.mysql.com/27877)
- Affects indexes that use the utf8_general_ci or
- ucs2_general_ci collation for columns that contain 'ß' LATIN
- SMALL LETTER SHARP S (German).
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.30, 6.0.8 (see
- Bug#40053: http://bugs.mysql.com/40053)
+ You might try starting the server with the --back_log=50 option as
+ a workaround for this. (Use -O back_log=50 before MySQL 4.)
- * * MySQL 6.0.1 (WL#3664)
- Affects indexes that use the latin2_czech_cs collation.
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.4.4, 6.0.9 (see
- Bug#40054: http://bugs.mysql.com/40054)
- MySQL 6.0.5 (Bug#33452: http://bugs.mysql.com/33452)
- Affects indexes that use the latin2_czech_cs collation.
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.4.4, 6.0.9 (see
- Bug#40054: http://bugs.mysql.com/40054)
+ To configure the generation of core files on Solaris you should
+ use the coreadm command. Because of the security implications of
+ generating a core on a setuid() application, by default, Solaris
+ does not support core files on setuid() programs. However, you can
+ modify this behavior using coreadm. If you enable setuid() core
+ files for the current user, they will be generated using the mode
+ 600 and owned by the superuser.
- * MySQL 6.0.5 (Bug#27877: http://bugs.mysql.com/27877)
- Affects indexes that use the utf8_general_ci or
- ucs2_general_ci collation for columns that contain 'ß' LATIN
- SMALL LETTER SHARP S (German).
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 6.0.8 (see
- Bug#40053: http://bugs.mysql.com/40053)
+2.9. Installing MySQL on i5/OS
- * MySQL 6.0.6 (Bug#25420: http://bugs.mysql.com/25420)
- Affects indexes for columns that use the following collations,
- if the columns contain the indicated characters:
- big5_chinese_ci: '~' TILDE or '`' GRAVE ACCENT;
- cp866_general_ci: j LATIN SMALL LETTER J; gb2312_chinese_ci:
- '~' TILDE; gbk_chinese_ci: '~' TILDE
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.4.4, 6.0.9 (see
- Bug#40054: http://bugs.mysql.com/40054)
+ The i5/OS POWER MySQL package was created in cooperation with IBM.
+ MySQL works within the Portable Application Solution Environment
+ (PASE) on the System i series of hardware and will also provide
+ database services for the Zend Core for i5/OS.
-2.12.4. Rebuilding or Repairing Tables or Indexes
+ MySQL for i5/OS is provided both as a tar file and as a save file
+ (.savf) package that can be downloaded and installed directly
+ without any additional installation steps required. To install
+ MySQL using the tar file, see Section 2.2, "Installing MySQL from
+ Generic Binaries on Unix/Linux."
- This section describes how to rebuild a table. This can be
- necessitated by changes to MySQL such as how data types are
- handled or changes to character set handling. For example, an
- error in a collation might have been corrected, necessitating a
- table rebuild to rebuild the indexes for character columns that
- use the collation. It might also be that a table repair or upgrade
- should be done as indicated by a table check operation such as
- that performed by CHECK TABLE, mysqlcheck, or mysql_upgrade.
+ MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS
+ PASE must be installed for MySQL to operate. You must be able to
+ login as a user in *SECOFR class.
- Methods for rebuilding a table include dumping and reloading it,
- or using ALTER TABLE or REPAIR TABLE.
+ You should the installation notes and tips for i5/OS before
+ starting installation. See i5/OS Installation Notes.
+
+ Before Installation:
Note
- If you are rebuilding tables because a different version of MySQL
- will not handle them after a binary upgrade or downgrade, you must
- use the dump-and-reload method. Dump the tables before upgrading
- or downgrading (using your original version of MySQL), and reload
- the tables after upgrading or downgrading (after installing the
- new version).
+ The installation package will use an existing configuration if you
+ have previously installed MySQL (which is identified by looking
+ for the file /etc/my.cnf). The values for the data directory
+ (DATADIR) and owner of the MySQL files (USRPRF) specified during
+ the installation will be ignored, and the values determined from
+ the /etc/my.cnf will be used instead.
- If you use the dump-and-reload method of rebuilding tables only
- for the purpose of rebuilding indexes, you can perform the dump
- either before or after upgrading or downgrading. Reloading still
- must be done afterward.
+ If you want to change these parameters during a new install, you
+ should temporarily rename /etc/my.cnf, install MySQL using the new
+ parameters you want to use, and then merge your previous
+ /etc/my.cnf configuration settings with the new /etc/my.cnf file
+ that is created during installation.
- To re-create a table by dumping and reloading it, use mysqldump to
- create a dump file and mysql to reload the file:
-shell> mysqldump db_name t1 > dump.sql
-shell> mysql db_name < dump.sql
+ * You must have a user profile with PASE with suitable
+ privileges. The user should be within the *SECOFR class, such
+ as the QSECOFR user ID. You can use the WRKUSRPRF command to
+ check your user profile.
+
+ * For network connections to MySQL, you must have TCP/IP
+ enabled. You should also check the following:
+
+ + Ensure that a name has defined for the system. Run the
+ Configure TCP/IP (CFGTCP) command and select option 12
+ (Change TCP/IP domain information) to display this
+ setting. Make sure that a value is listed in the Host
+ name field.
- To recreate all the tables in a single database, specify the
- database name without any following table name:
-shell> mysqldump db_name > dump.sql
-shell> mysql db_name < dump.sql
+ + Make sure that the system has a loopback entry which
+ represents the localhost or 127.0.0.1.
- To recreate all tables in all databases, use the --all-databases
- option:
-shell> mysqldump --all-databases > dump.sql
-shell> mysql < dump.sql
+ + Ensure that the IP address of the IBM i machine is mapped
+ correctly to the host name.
- To rebuild a table with ALTER TABLE, use a statement that
- "changes" the table to use the storage engine that it already has.
- For example, if t1 is a MyISAM table, use this statement:
-mysql> ALTER TABLE t1 ENGINE = MyISAM;
+ To install MySQL on i5/OS, follow these steps:
- If you are not sure which storage engine to specify in the ALTER
- TABLE statement, use SHOW CREATE TABLE to display the table
- definition.
+ 1. On the System i machine, create a save file that will be used
+ to receive the downloaded installation save file. The file
+ should be located within the General Purpose Library (QGPL):
+CRTSAVF FILE(QGPL/MYSQLINST) TESXT('MySQL Save file')
- If you must rebuild a table because a table checking operation
- indicates that the table is corrupt or needs an upgrade, you can
- use REPAIR TABLE if that statement supports the table's storage
- engine. For example, to repair a MyISAM table, use this statement:
-mysql> REPAIR TABLE t1;
+ 2. Download the MySQL installation save file in 32-bit
+ (mysql-5.1.39-i5os-power-32bit.savf) or 64-bit
+ (mysql-5.1.39-i5os-power-64bit.savf) from MySQL Downloads
+ (http://dev.mysql.com/downloads)
- For storage engines such as InnoDB that REPAIR TABLE does not
- support, use mysqldump to create a dump file and mysql to reload
- the file, as described earlier.
+ 3. You need to FTP the downloaded .savf file directly into the
+ QGPL/MYSQLINST file on the System i server. You can do this
+ through FTP using the following steps after logging in to the
+ System i machine:
+ftp> bin
+ftp> cd qgpl
+ftp> put mysql-5.1.39-i5os-power.savf mysqlinst
- For specifics about which storage engines REPAIR TABLE supports,
- see Section 12.5.2.6, "REPAIR TABLE Syntax."
+ 4. Log into the System i server using a user in the *SECOFR
+ class, such as the QSECOFR user ID.
-2.12.5. Copying MySQL Databases to Another Machine
+ 5. You need to restore the installation library stored in the
+ .savf save file:
+RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST) MBROPT(*ALL) ALWOBJD
+IF(*ALL)
- You can copy the .frm, .MYI, and .MYD files for MyISAM tables
- between different architectures that support the same
- floating-point format. (MySQL takes care of any byte-swapping
- issues.) See Section 13.5, "The MyISAM Storage Engine."
+Note
+ You can ignore the security changes-type message at the bottom
+ of the installation panel.
- In cases where you need to transfer databases between different
- architectures, you can use mysqldump to create a file containing
- SQL statements. You can then transfer the file to the other
- machine and feed it as input to the mysql client.
+ 6. Once you have finished restoring the MYSQLINST library, check
+ that all the necessary objects for installation are on the
+ system by using the Display Library (DSPLIB) command:
+DSPLIB LIB(MYSQLINST)
- Use mysqldump --help to see what options are available.
+ 7. You need to execute the installation command,
+ MYSQLINST/INSMYSQL. You can specify three parameter settings
+ during installation:
- The easiest (although not the fastest) way to move a database
- between two machines is to run the following commands on the
- machine on which the database is located:
-shell> mysqladmin -h 'other_hostname' create db_name
-shell> mysqldump db_name | mysql -h 'other_hostname' db_name
+ + DIR('/QOpenSys/usr/local/mysql') sets the installation
+ location for the MySQL files. The directory will be
+ created if it does not already exist.
+
+ + DATADIR('/QOpenSys/usr/local/mysql/data') sets the
+ location of the directory that will be used to store the
+ database files and binary logs. The default setting is
+ /QOpenSys/usr/local/mysql/data. Note that if the
+ installer detects an existing installation (due to the
+ existence of /etc/my.cnf), then the existing setting will
+ be used instead of the default.
- If you want to copy a database from a remote machine over a slow
- network, you can use these commands:
-shell> mysqladmin create db_name
-shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na
-me
+ + USRPRF(MYSQL) sets the user profile that will own the
+ files that are installed. The profile will be created if
+ it does not already exist.
- You can also store the dump in a file, transfer the file to the
- target machine, and then load the file into the database there.
- For example, you can dump a database to a compressed file on the
- source machine like this:
-shell> mysqldump --quick db_name | gzip > db_name.gz
+Note
+ You should choose an appropriate user for using the MySQL
+ server installation. The user will be used whenever you
+ need to do any administration on the MySQL server.
+ Once you have set the appropriate parameters, you can begin
+ the installation.
+ The installation copies all the necessary files into a
+ directory matching the DIR configuration value; sets the
+ ownership on those files, sets up the MySQL environment and
+ creates the MySQL configuration file (in /etc/my.cnf)
+ completing all the steps in a typical binary installation
+ process automatically. If this is a new installation of MySQL,
+ or if the installer detects that this is a new version
+ (because the /etc/my.cnf file does not exist), then the
+ initial core MySQL databases will also be created during
+ installation.
+ Once the installation has been completed, you will get a
+ notice advising you to set the password for the root user. For
+ more information, Section 2.13, "Post-Installation Setup and
+ Testing."
- Transfer the file containing the database contents to the target
- machine and run these commands there:
-shell> mysqladmin create db_name
-shell> gunzip < db_name.gz | mysql db_name
+ 8. Once the installation has completed, you can delete the
+ installation file:
+DLTLIB LIB(MYSQLINST)
- You can also use mysqldump and mysqlimport to transfer the
- database. For large tables, this is much faster than simply using
- mysqldump. In the following commands, DUMPDIR represents the full
- path name of the directory you use to store the output from
- mysqldump.
+ Upgrading an existing MySQL instance
- First, create the directory for the output files and dump the
- database:
-shell> mkdir DUMPDIR
-shell> mysqldump --tab=DUMPDIR db_name
+ You need to execute the upgrade command, MYSQLINST/UPGMYSQL. You
+ must specify 6 parameters to perform an upgrade:
- Then transfer the files in the DUMPDIR directory to some
- corresponding directory on the target machine and load the files
- into MySQL there:
-shell> mysqladmin create db_name # create database
-shell> cat DUMPDIR/*.sql | mysql db_name # create tables in databas
-e
-shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables
+ * DIR('/QOpenSys/usr/local/') --- sets the installation location
+ for the MySQL files. The directory will be created if it does
+ not already exist. This is the directory that the MySQL server
+ will be installed into, inside a directory with a name
+ matching the version and release. For example if installing
+ MySQL 5.1.39 with the DIR set to /QOpenSys/usr/local/ would
+ result in /QOpenSys/usr/local/mysql-5.1.39-i5os-power64 and a
+ symbolic link to this directory will be created in
+ /QOpenSys/usr/local/mysql.
+
+ * DATADIR('/QOpenSys/mysql/data') --- sets the location of the
+ directory that will be upgraded.
+
+ * USRPRF('MYSQL') --- sets the user profile that will own the
+ files that are installed. The profile will be created if it
+ does not already exist; if it is created as part of the
+ upgrade process, it will be disabled initially. You may wish
+ to enable this user profile so that it can be used to start
+ the MySQL server later. It is best practice to use the one
+ previously created during the first installation.
+
+ * MYSQLUSR('root user') --- any user account in the current
+ MySQL server with SUPER privileges.
+
+ * PASSWORD('root user password') --- the password for the above
+ account. This is necessary as the upgrade starts the MySQL
+ server to upgrade the tables and the password is need to be
+ able to shutdown the MySQL server.
+
+ * CURINST('path to previous install') --- the full path to the
+ installation that is being upgraded. For example an
+ installation in /QOpenSys/usr/local/ will be
+ /QOpenSys/usr/local/msyql-5.1.30-i5os-power64. Failure to
+ specify this option may result in corruption of your existing
+ data files.
+
+ For example:
+MYSQLINST/UPGMYSQL DIR('/QOpenSys/usr/local/') DATADIR('/QOpenSys/mys
+ql/data') »
+ USERPRF(MYSQL) MYSQLUSR('root') PASSWORD('root') CURINST('/QOpen
+Sys/usr/local/mysql-5.1.30-i5os-power64')
+
+ You should receive a Program Message indicating UPGRADE
+ SUCCESSFUL! upon completion or an error message if there is a
+ problem.You can view the upgrade programs progression and the
+ error in the text file upgrade.log in the installation directory.
- Do not forget to copy the mysql database because that is where the
- grant tables are stored. You might have to run commands as the
- MySQL root user on the new machine until you have the mysql
- database in place.
+ To start MySQL:
- After you import the mysql database on the new machine, execute
- mysqladmin flush-privileges so that the server reloads the grant
- table information.
+ 1. Log into the System i server using the user profile create or
+ specified during installation. By default, this is MYSQL.
-2.13. Operating System-Specific Notes
+Note
+ You should start mysqld_safe using a user that in the PASE
+ environment has the id=0 (the equivalent of the standard Unix
+ root user). If you do not use a user with this ID then the
+ system will be unable to change the user when executing mysqld
+ as set using --user option. If this happens, mysqld may be
+ unable to read the files located within the MySQL data
+ directory and the execution will fail.
-2.13.1. Linux Notes
+ 2. Enter the PASE environment using call qp2term.
- This section discusses issues that have been found to occur on
- Linux. The first few subsections describe general operating
- system-related issues, problems that can occur when using binary
- or source distributions, and post-installation issues. The
- remaining subsections discuss problems that occur with Linux on
- specific platforms.
+ 3. Start the MySQL server by changing to the installation
+ directory and running mysqld_safe, specifying the user name
+ used to install the server. The installer conveniently
+ installs a symbolic link to the installation directory
+ (mysql-5.0.42-i5os-power-32bit) as /opt/mysql/mysql:
+> cd /opt/mysql/mysql
+> bin/mysqld_safe --user=mysql &
+ You should see a message similar to the following:
+Starting mysqld daemon with databases »
+ from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data
- Note that most of these problems occur on older versions of Linux.
- If you are running a recent version, you may see none of them.
+ If you are having problems starting MySQL server, see Section
+ 2.13.1.3, "Starting and Troubleshooting the MySQL Server."
-2.13.1.1. Linux Operating System Notes
+ To stop MySQL:
- MySQL needs at least Linux version 2.0.
+ 1. Log into the System i server using the user profile create or
+ specified during installation. By default, this is MYSQL.
-Warning
+ 2. Enter the PASE environment using call qp2term.
- We have seen some strange problems with Linux 2.2.14 and MySQL on
- SMP systems. We also have reports from some MySQL users that they
- have encountered serious stability problems using MySQL with
- kernel 2.2.14. If you are using this kernel, you should upgrade to
- 2.2.19 (or newer) or to a 2.4 kernel. If you have a multiple-CPU
- box, you should seriously consider using 2.4 because it gives you
- a significant speed boost. Your system should be more stable.
-
- When using LinuxThreads, you should see a minimum of three mysqld
- processes running. These are in fact threads. There is one thread
- for the LinuxThreads manager, one thread to handle connections,
- and one thread to handle alarms and signals.
-
-2.13.1.2. Linux Binary Distribution Notes
-
- The Linux-Intel binary and RPM releases of MySQL are configured
- for the highest possible speed. We are always trying to use the
- fastest stable compiler available.
-
- The binary release is linked with -static, which means you do not
- normally need to worry about which version of the system libraries
- you have. You need not install LinuxThreads, either. A program
- linked with -static is slightly larger than a dynamically linked
- program, but also slightly faster (3-5%). However, one problem
- with a statically linked program is that you can't use
- user-defined functions (UDFs). If you are going to write or use
- UDFs (this is something for C or C++ programmers only), you must
- compile MySQL yourself using dynamic linking.
-
- A known issue with binary distributions is that on older Linux
- systems that use libc (such as Red Hat 4.x or Slackware), you get
- some (nonfatal) issues with host name resolution. If your system
- uses libc rather than glibc2, you probably will encounter some
- difficulties with host name resolution and getpwnam(). This
- happens because glibc (unfortunately) depends on some external
- libraries to implement host name resolution and getpwent(), even
- when compiled with -static. These problems manifest themselves in
- two ways:
-
- * You may see the following error message when you run
- mysql_install_db:
-Sorry, the host 'xxxx' could not be looked up
- You can deal with this by executing mysql_install_db --force,
- which does not execute the resolveip test in mysql_install_db.
- The downside is that you cannot use host names in the grant
- tables: except for localhost, you must use IP numbers instead.
- If you are using an old version of MySQL that does not support
- --force, you must manually remove the resolveip test in
- mysql_install_db using a text editor.
-
- * You also may see the following error when you try to run
- mysqld with the --user option:
-getpwnam: No such file or directory
- To work around this problem, start mysqld by using the su
- command rather than by specifying the --user option. This
- causes the system itself to change the user ID of the mysqld
- process so that mysqld need not do so.
-
- Another solution, which solves both problems, is not to use a
- binary distribution. Obtain a MySQL source distribution (in RPM or
- tar.gz format) and install that instead.
-
- On some Linux 2.2 versions, you may get the error Resource
- temporarily unavailable when clients make a great many new
- connections to a mysqld server over TCP/IP. The problem is that
- Linux has a delay between the time that you close a TCP/IP socket
- and the time that the system actually frees it. There is room for
- only a finite number of TCP/IP slots, so you encounter the
- resource-unavailable error if clients attempt too many new TCP/IP
- connections over a short period of time. For example, you may see
- the error when you run the MySQL test-connect benchmark over
- TCP/IP.
-
- We have inquired about this problem a few times on different Linux
- mailing lists but have never been able to find a suitable
- resolution. The only known "fix" is for clients to use persistent
- connections, or, if you are running the database server and
- clients on the same machine, to use Unix socket file connections
- rather than TCP/IP connections.
-
-2.13.1.3. Linux Source Distribution Notes
-
- The following notes regarding glibc apply only to the situation
- when you build MySQL yourself. If you are running Linux on an x86
- machine, in most cases it is much better for you to use our
- binary. We link our binaries against the best patched version of
- glibc we can find and with the best compiler options, in an
- attempt to make it suitable for a high-load server. For a typical
- user, even for setups with a lot of concurrent connections or
- tables exceeding the 2GB limit, our binary is the best choice in
- most cases. After reading the following text, if you are in doubt
- about what to do, try our binary first to determine whether it
- meets your needs. If you discover that it is not good enough, you
- may want to try your own build. In that case, we would appreciate
- a note about it so that we can build a better binary next time.
-
- MySQL uses LinuxThreads on Linux. If you are using an old Linux
- version that doesn't have glibc2, you must install LinuxThreads
- before trying to compile MySQL. You can obtain LinuxThreads from
- http://dev.mysql.com/downloads/os-linux.html.
-
- Note that glibc versions before and including version 2.1.1 have a
- fatal bug in pthread_mutex_timedwait() handling, which is used
- when INSERT DELAYED statements are issued. Do not use INSERT
- DELAYED before upgrading glibc.
-
- Note that Linux kernel and the LinuxThread library can by default
- handle a maximum of 1,024 threads. If you plan to have more than
- 1,000 concurrent connections, you need to make some changes to
- LinuxThreads, as follows:
-
- * Increase PTHREAD_THREADS_MAX in
- sysdeps/unix/sysv/linux/bits/local_lim.h to 4096 and decrease
- STACK_SIZE in linuxthreads/internals.h to 256KB. The paths are
- relative to the root of glibc. (Note that MySQL is not stable
- with 600-1000 connections if STACK_SIZE is the default of
- 2MB.)
-
- * Recompile LinuxThreads to produce a new libpthread.a library,
- and relink MySQL against it.
-
- There is another issue that greatly hurts MySQL performance,
- especially on SMP systems. The mutex implementation in
- LinuxThreads in glibc 2.1 is very poor for programs with many
- threads that hold the mutex only for a short time. This produces a
- paradoxical result: If you link MySQL against an unmodified
- LinuxThreads, removing processors from an SMP actually improves
- MySQL performance in many cases. We have made a patch available
- for glibc 2.1.3 to correct this behavior
- (http://dev.mysql.com/Downloads/Linux/linuxthreads-2.1-patch)
-
- With glibc 2.2.2, MySQL uses the adaptive mutex, which is much
- better than even the patched one in glibc 2.1.3. Be warned,
- however, that under some conditions, the current mutex code in
- glibc 2.2.2 overspins, which hurts MySQL performance. The
- likelihood that this condition occurs can be reduced by re-nicing
- the mysqld process to the highest priority. We have also been able
- to correct the overspin behavior with a patch, available at
- http://dev.mysql.com/Downloads/Linux/linuxthreads-2.2.2.patch. It
- combines the correction of overspin, maximum number of threads,
- and stack spacing all in one. You need to apply it in the
- linuxthreads directory with patch -p0
- </tmp/linuxthreads-2.2.2.patch. We hope it is included in some
- form in future releases of glibc 2.2. In any case, if you link
- against glibc 2.2.2, you still need to correct STACK_SIZE and
- PTHREAD_THREADS_MAX. We hope that the defaults is corrected to
- some more acceptable values for high-load MySQL setup in the
- future, so that the commands needed to produce your own build can
- be reduced to ./configure; make; make install.
-
- If you use these patches to build a special static version of
- libpthread.a, use it only for statically linking against MySQL. We
- know that these patches are safe for MySQL and significantly
- improve its performance, but we cannot say anything about their
- effects on other applications. If you link other applications that
- require LinuxThreads against the patched static version of the
- library, or build a patched shared version and install it on your
- system, you do so at your own risk.
-
- If you experience any strange problems during the installation of
- MySQL, or with some common utilities hanging, it is very likely
- that they are either library or compiler related. If this is the
- case, using our binary resolves them.
+ 3. Stop the MySQL server by changing into the installation
+ directory and running mysqladmin, specifying the user name
+ used to install the server:
+> cd /opt/mysql/mysql
+> bin/mysqladmin -u root shutdown
+ If the session that you started and stopped MySQL are the
+ same, you may get the log output from mysqld:
+ STOPPING server from pid file »
+ /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.R
+CHLAND.IBM.COM.pid
+ 070718 10:34:20 mysqld ended
+ If the sessions used to start and stop MySQL are different,
+ you will not receive any confirmation of the shutdown.
- If you link your own MySQL client programs, you may see the
- following error at runtime:
-ld.so.1: fatal: libmysqlclient.so.#:
-open failed: No such file or directory
+ Note and tips
- This problem can be avoided by one of the following methods:
+ * A problem has been identified with the installation process on
+ DBCS systems. If you are having problems install MySQL on a
+ DBCS system, you need to change your job's coded character set
+ identifier (CSSID) to 37 (EBCDIC) before executing the install
+ command, INSMYSQL. To do this, determine your existing CSSID
+ (using DSPJOB and selecting option 2), execute CHGJOB
+ CSSID(37), run INSMYSQL to install MySQL and then execute
+ CHGJOB again with your original CSSID.
- * Link clients with the -Wl,r/full/path/to/libmysqlclient.so
- flag rather than with -Lpath).
+ * If you want to use the Perl scripts that are included with
+ MySQL, you need to download the iSeries Tools for Developers
+ (5799-PTL). See
+ http://www-03.ibm.com/servers/enable/site/porting/tools/.
- * Copy libmysqclient.so to /usr/lib.
+2.10. Installing MySQL on FreeBSD
- * Add the path name of the directory where libmysqlclient.so is
- located to the LD_RUN_PATH environment variable before running
- your client.
+ This section provides information about using MySQL on variants of
+ FreeBSD Unix.
- If you are using the Fujitsu compiler (fcc/FCC), you may have some
- problems compiling MySQL because the Linux header files are very
- gcc oriented. The following configure line should work with
- fcc/FCC:
-CC=fcc CFLAGS="-O -K fast -K lib -K omitfp -Kpreex -D_GNU_SOURCE \
- -DCONST=const -DNO_STRTOLL_PROTO" \
-CXX=FCC CXXFLAGS="-O -K fast -K lib \
- -K omitfp -K preex --no_exceptions --no_rtti -D_GNU_SOURCE \
- -DCONST=const -Dalloca=__builtin_alloca -DNO_STRTOLL_PROTO \
- '-D_EXTERN_INLINE=static __inline'" \
-./configure \
- --prefix=/usr/local/mysql --enable-assembler \
- --with-mysqld-ldflags=-all-static --disable-shared \
- --with-low-memory
+ The easiest (and preferred) way to install MySQL is to use the
+ mysql-server and mysql-client ports available at
+ http://www.freebsd.org/. Using these ports gives you the following
+ benefits:
-2.13.1.4. Linux Post-Installation Notes
+ * A working MySQL with all optimizations enabled that are known
+ to work on your version of FreeBSD.
- mysql.server can be found in the support-files directory under the
- MySQL installation directory or in a MySQL source tree. You can
- install it as /etc/init.d/mysql for automatic MySQL startup and
- shutdown. See Section 2.11.2.2, "Starting and Stopping MySQL
- Automatically."
+ * Automatic configuration and build.
- If MySQL cannot open enough files or connections, it may be that
- you have not configured Linux to handle enough files.
+ * Startup scripts installed in /usr/local/etc/rc.d.
- In Linux 2.2 and onward, you can check the number of allocated
- file handles as follows:
-shell> cat /proc/sys/fs/file-max
-shell> cat /proc/sys/fs/dquot-max
-shell> cat /proc/sys/fs/super-max
-
- If you have more than 16MB of memory, you should add something
- like the following to your init scripts (for example,
- /etc/init.d/boot.local on SuSE Linux):
-echo 65536 > /proc/sys/fs/file-max
-echo 8192 > /proc/sys/fs/dquot-max
-echo 1024 > /proc/sys/fs/super-max
-
- You can also run the echo commands from the command line as root,
- but these settings are lost the next time your computer restarts.
-
- Alternatively, you can set these parameters on startup by using
- the sysctl tool, which is used by many Linux distributions
- (including SuSE Linux 8.0 and later). Put the following values
- into a file named /etc/sysctl.conf:
-# Increase some values for MySQL
-fs.file-max = 65536
-fs.dquot-max = 8192
-fs.super-max = 1024
-
- You should also add the following to /etc/my.cnf:
-[mysqld_safe]
-open-files-limit=8192
-
- This should allow the server a limit of 8,192 for the combined
- number of connections and open files.
-
- The STACK_SIZE constant in LinuxThreads controls the spacing of
- thread stacks in the address space. It needs to be large enough so
- that there is plenty of room for each individual thread stack, but
- small enough to keep the stack of some threads from running into
- the global mysqld data. Unfortunately, as we have experimentally
- discovered, the Linux implementation of mmap() successfully unmaps
- a mapped region if you ask it to map out an address currently in
- use, zeroing out the data on the entire page instead of returning
- an error. So, the safety of mysqld or any other threaded
- application depends on the "gentlemanly" behavior of the code that
- creates threads. The user must take measures to make sure that the
- number of running threads at any given time is sufficiently low
- for thread stacks to stay away from the global heap. With mysqld,
- you should enforce this behavior by setting a reasonable value for
- the max_connections variable.
-
- If you build MySQL yourself, you can patch LinuxThreads for better
- stack use. See Section 2.13.1.3, "Linux Source Distribution
- Notes." If you do not want to patch LinuxThreads, you should set
- max_connections to a value no higher than 500. It should be even
- less if you have a large key buffer, large heap tables, or some
- other things that make mysqld allocate a lot of memory, or if you
- are running a 2.2 kernel with a 2GB patch. If you are using our
- binary or RPM version, you can safely set max_connections at 1500,
- assuming no large key buffer or heap tables with lots of data. The
- more you reduce STACK_SIZE in LinuxThreads the more threads you
- can safely create. Values between 128KB and 256KB are recommended.
-
- If you use a lot of concurrent connections, you may suffer from a
- "feature" in the 2.2 kernel that attempts to prevent fork bomb
- attacks by penalizing a process for forking or cloning a child.
- This causes MySQL not to scale well as you increase the number of
- concurrent clients. On single-CPU systems, we have seen this
- manifest as very slow thread creation; it may take a long time to
- connect to MySQL (as long as one minute), and it may take just as
- long to shut it down. On multiple-CPU systems, we have observed a
- gradual drop in query speed as the number of clients increases. In
- the process of trying to find a solution, we have received a
- kernel patch from one of our users who claimed it helped for his
- site. This patch is available at
- http://dev.mysql.com/Downloads/Patches/linux-fork.patch. We have
- done rather extensive testing of this patch on both development
- and production systems. It has significantly improved MySQL
- performance without causing any problems and is recommended for
- users who still run high-load servers on 2.2 kernels.
-
- This issue has been fixed in the 2.4 kernel, so if you are not
- satisfied with the current performance of your system, rather than
- patching your 2.2 kernel, it might be easier to upgrade to 2.4. On
- SMP systems, upgrading also gives you a nice SMP boost in addition
- to fixing the fairness bug.
-
- We have tested MySQL on the 2.4 kernel on a two-CPU machine and
- found MySQL scales much better. There was virtually no slowdown on
- query throughput all the way up to 1,000 clients, and the MySQL
- scaling factor (computed as the ratio of maximum throughput to the
- throughput for one client) was 180%. We have observed similar
- results on a four-CPU system: Virtually no slowdown as the number
- of clients was increased up to 1,000, and a 300% scaling factor.
- Based on these results, for a high-load SMP server using a 2.2
- kernel, it is definitely recommended to upgrade to the 2.4 kernel
- at this point.
-
- We have discovered that it is essential to run the mysqld process
- with the highest possible priority on the 2.4 kernel to achieve
- maximum performance. This can be done by adding a renice -20 $$
- command to mysqld_safe. In our testing on a four-CPU machine,
- increasing the priority resulted in a 60% throughput increase with
- 400 clients.
-
- We are currently also trying to collect more information on how
- well MySQL performs with a 2.4 kernel on four-way and eight-way
- systems. If you have access such a system and have done some
- benchmarks, please send an email message to benchmarks(a)mysql.com
- with the results. We will review them for inclusion in the manual.
-
- If you see a dead mysqld server process with ps, this usually
- means that you have found a bug in MySQL or you have a corrupted
- table. See Section B.1.4.2, "What to Do If MySQL Keeps Crashing."
-
- To get a core dump on Linux if mysqld dies with a SIGSEGV signal,
- you can start mysqld with the --core-file option. Note that you
- also probably need to raise the core file size by adding ulimit -c
- 1000000 to mysqld_safe or starting mysqld_safe with
- --core-file-size=1000000. See Section 4.3.2, "mysqld_safe ---
- MySQL Server Startup Script."
-
-2.13.1.5. Linux x86 Notes
-
- MySQL requires libc 5.4.12 or newer. It is known to work with libc
- 5.4.46. glibc 2.0.6 and later should also work. There have been
- some problems with the glibc RPMs from Red Hat, so if you have
- problems, check whether there are any updates. The glibc 2.0.7-19
- and 2.0.7-29 RPMs are known to work.
-
- If you are using Red Hat 8.0 or a new glibc 2.2.x library, you may
- see mysqld die in gethostbyaddr(). This happens because the new
- glibc library requires a stack size greater than 128KB for this
- call. To fix the problem, start mysqld with the
- --thread-stack=192K option. (Use -O thread_stack=192K before MySQL
- 4.) This stack size is the default on MySQL 4.0.10 and above, so
- you should not see the problem.
-
- If you are using gcc 3.0 and above to compile MySQL, you must
- install the libstdc++v3 library before compiling MySQL; if you
- don't do this, you get an error about a missing __cxa_pure_virtual
- symbol during linking.
-
- On some older Linux distributions, configure may produce an error
- like this:
-Syntax error in sched.h. Change _P to __P in the
-/usr/include/sched.h file.
-See the Installation chapter in the Reference Manual.
-
- Just do what the error message says. Add an extra underscore to
- the _P macro name that has only one underscore, and then try
- again.
-
- You may get some warnings when compiling. Those shown here can be
- ignored:
-mysqld.cc -o objs-thread/mysqld.o
-mysqld.cc: In function `void init_signals()':
-mysqld.cc:315: warning: assignment of negative value `-1' to
-`long unsigned int'
-mysqld.cc: In function `void * signal_hand(void *)':
-mysqld.cc:346: warning: assignment of negative value `-1' to
-`long unsigned int'
-
- If mysqld always dumps core when it starts, the problem may be
- that you have an old /lib/libc.a. Try renaming it, and then remove
- sql/mysqld and do a new make install and try again. This problem
- has been reported on some Slackware installations.
-
- If you get the following error when linking mysqld, it means that
- your libg++.a is not installed correctly:
-/usr/lib/libc.a(putc.o): In function `_IO_putc':
-putc.o(.text+0x0): multiple definition of `_IO_putc'
-
- You can avoid using libg++.a by running configure like this:
-shell> CXX=gcc ./configure
-
-2.13.1.6. Linux SPARC Notes
-
- In some implementations, readdir_r() is broken. The symptom is
- that the SHOW DATABASES statement always returns an empty set.
- This can be fixed by removing HAVE_READDIR_R from config.h after
- configuring and before compiling.
-
-2.13.1.7. Linux Alpha Notes
-
- We have tested MySQL 5.1 on Alpha with our benchmarks and test
- suite, and it appears to work well.
-
- We currently build the MySQL binary packages on SuSE Linux 7.0 for
- AXP, kernel 2.4.4-SMP, Compaq C compiler (V6.2-505) and Compaq C++
- compiler (V6.3-006) on a Compaq DS20 machine with an Alpha EV6
- processor.
+ * The ability to use pkg_info -L to see which files are
+ installed.
- You can find the preceding compilers at
- http://www.support.compaq.com/alpha-tools/. By using these
- compilers rather than gcc, we get about 9-14% better MySQL
- performance.
-
- For MySQL on Alpha, we use the -arch generic flag to our compile
- options, which ensures that the binary runs on all Alpha
- processors. We also compile statically to avoid library problems.
- The configure command looks like this:
-CC=ccc CFLAGS="-fast -arch generic" CXX=cxx \
-CXXFLAGS="-fast -arch generic -noexceptions -nortti" \
-./configure --prefix=/usr/local/mysql --disable-shared \
- --with-extra-charsets=complex --enable-thread-safe-client \
- --with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shar
-ed
+ * The ability to use pkg_delete to remove MySQL if you no longer
+ want it on your machine.
- Some known problems when running MySQL on Linux-Alpha:
+ The MySQL build process requires GNU make (gmake) to work. If GNU
+ make is not available, you must install it first before compiling
+ MySQL.
- * Debugging threaded applications like MySQL does not work with
- gdb 4.18. You should use gdb 5.1 instead.
+ The recommended way to compile and install MySQL on FreeBSD with
+ gcc (2.95.2 and up) is:
+CC=gcc CFLAGS="-O2 -fno-strength-reduce" \
+ CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions \
+ -felide-constructors -fno-strength-reduce" \
+ ./configure --prefix=/usr/local/mysql --enable-assembler
+gmake
+gmake install
+cd /usr/local/mysql
+bin/mysql_install_db --user=mysql
+bin/mysqld_safe &
- * If you try linking mysqld statically when using gcc, the
- resulting image dumps core at startup time. In other words, do
- not use --with-mysqld-ldflags=-all-static with gcc.
-
-2.13.1.8. Linux PowerPC Notes
-
- MySQL should work on MkLinux with the newest glibc package (tested
- with glibc 2.0.7).
-
-2.13.1.9. Linux MIPS Notes
-
- To get MySQL to work on Qube2 (Linux Mips), you need the newest
- glibc libraries. glibc-2.0.7-29C2 is known to work. You must also
- use gcc 2.95.2 or newer).
-
-2.13.1.10. Linux IA-64 Notes
-
- To get MySQL to compile on Linux IA-64, we use the following
- configure command for building with gcc 2.96:
-CC=gcc \
-CFLAGS="-O3 -fno-omit-frame-pointer" \
-CXX=gcc \
-CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
- -fno-exceptions -fno-rtti" \
- ./configure --prefix=/usr/local/mysql \
- "--with-comment=Official MySQL binary" \
- --with-extra-charsets=complex
-
- On IA-64, the MySQL client binaries use shared libraries. This
- means that if you install our binary distribution at a location
- other than /usr/local/mysql, you need to add the path of the
- directory where you have libmysqlclient.so installed either to the
- /etc/ld.so.conf file or to the value of your LD_LIBRARY_PATH
- environment variable.
-
- See Section B.1.3.1, "Problems Linking to the MySQL Client
- Library."
-
-2.13.1.11. SELinux Notes
-
- RHEL4 comes with SELinux, which supports tighter access control
- for processes. If SELinux is enabled (SELINUX in
- /etc/selinux/config is set to enforcing, SELINUXTYPE is set to
- either targeted or strict), you might encounter problems
- installing Sun Microsystems, Inc. RPM packages.
-
- Red Hat has an update that solves this. It involves an update of
- the "security policy" specification to handle the install
- structure of the RPMs provided by Sun Microsystems, Inc. For
- further information, see
- https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=167551 and
- http://rhn.redhat.com/errata/RHBA-2006-0049.html.
-
- The preceding discussion applies only to RHEL4. The patch is
- unnecessary for RHEL5.
-
-2.13.2. Mac OS X Notes
-
- On Mac OS X, tar cannot handle long file names. If you need to
- unpack a .tar.gz distribution, use gnutar instead.
-
-2.13.2.1. Mac OS X 10.x (Darwin)
-
- MySQL should work without major problems on Mac OS X 10.x
- (Darwin).
-
- Known issues:
-
- * If you have problems with performance under heavy load, try
- using the --skip-thread-priority option to mysqld. This runs
- all threads with the same priority. On Mac OS X, this gives
- better performance, at least until Apple fixes its thread
- scheduler.
-
- * The connection times (wait_timeout, interactive_timeout and
- net_read_timeout) values are not honored.
- This is probably a signal handling problem in the thread
- library where the signal doesn't break a pending read and we
- hope that a future update to the thread libraries will fix
- this.
-
- Our binary for Mac OS X is compiled on Darwin 6.3 with the
- following configure line:
-CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
-CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
- -fno-exceptions -fno-rtti" \
- ./configure --prefix=/usr/local/mysql \
- --with-extra-charsets=complex --enable-thread-safe-client \
- --enable-local-infile --disable-shared
-
- See Section 2.5, "Installing MySQL on Mac OS X."
-
-2.13.2.2. Mac OS X Server 1.2 (Rhapsody)
-
- For current versions of Mac OS X Server, no operating system
- changes are necessary before compiling MySQL. Compiling for the
- Server platform is the same as for the client version of Mac OS X.
+ FreeBSD is known to have a very low default file handle limit. See
+ Section B.5.2.18, "'File' Not Found and Similar Errors." Start the
+ server by using the --open-files-limit option for mysqld_safe, or
+ raise the limits for the mysqld user in /etc/login.conf and
+ rebuild it with cap_mkdb /etc/login.conf. Also be sure that you
+ set the appropriate class for this user in the password file if
+ you are not using the default (use chpass mysqld-user-name). See
+ Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
- For older versions (Mac OS X Server 1.2, a.k.a. Rhapsody), you
- must first install a pthread package before trying to configure
- MySQL.
+ In current versions of FreeBSD (at least 4.x and greater), you may
+ increase the limit on the amount of memory available for a process
+ by adding the following entries to the /boot/loader.conf file and
+ rebooting the machine (these are not settings that can be changed
+ at run time with the sysctl command):
+kern.maxdsiz="1073741824" # 1GB
+kern.dfldsiz="1073741824" # 1GB
+kern.maxssiz="134217728" # 128MB
- See Section 2.5, "Installing MySQL on Mac OS X."
+ For older versions of FreeBSD, you must recompile your kernel to
+ change the maximum data segment size for a process. In this case,
+ you should look at the MAXDSIZ option in the LINT config file for
+ more information.
-2.13.3. Solaris Notes
+ If you get problems with the current date in MySQL, setting the TZ
+ variable should help. See Section 2.14, "Environment Variables."
- For information about installing MySQL on Solaris using PKG
- distributions, see Section 2.6, "Installing MySQL on Solaris."
+2.11. Installing MySQL on HP-UX
- On Solaris, you may run into trouble even before you get the MySQL
- distribution unpacked, as the Solaris tar cannot handle long file
+ If you install MySQL using a binary tarball distribution on HP-UX,
+ you may run into trouble even before you get the MySQL
+ distribution unpacked, as the HP-UX tar cannot handle long file
names. This means that you may see errors when you try to unpack
MySQL.
If this occurs, you must use GNU tar (gtar) to unpack the
distribution.
- Sun native threads work only on Solaris 2.5 and higher. For
- Solaris 2.4 and earlier, MySQL automatically uses MIT-pthreads.
- See Section 2.10.5, "MIT-pthreads Notes."
-
- If you get the following error from configure, it means that you
- have something wrong with your compiler installation:
-checking for restartable system calls... configure: error can not
-run test programs while cross compiling
-
- In this case, you should upgrade your compiler to a newer version.
- You may also be able to solve this problem by inserting the
- following row into the config.cache file:
-ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls='no'}
-
- If you are using Solaris on a SPARC, the recommended compiler is
- gcc 2.95.2 or 3.2. You can find this at http://gcc.gnu.org/. Note
- that gcc 2.8.1 does not work reliably on SPARC.
-
- The recommended configure line when using gcc 2.95.2 is:
-CC=gcc CFLAGS="-O3" \
-CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
- \
-./configure --prefix=/usr/local/mysql --with-low-memory \
- --enable-assembler
+ Because of some critical bugs in the standard HP-UX libraries, you
+ should install the following patches before trying to run MySQL on
+ HP-UX 11.0:
+PHKL_22840 Streams cumulative
+PHNE_22397 ARPA cumulative
- If you have an UltraSPARC system, you can get 4% better
- performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the CFLAGS
- and CXXFLAGS environment variables.
+ This solves the problem of getting EWOULDBLOCK from recv() and
+ EBADF from accept() in threaded applications.
- If you have Sun's Forte 5.0 (or newer) compiler, you can run
- configure like this:
-CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
-CXX=CC CXXFLAGS="-noex -mt" \
-./configure --prefix=/usr/local/mysql --enable-assembler
+ If you are using gcc 2.95.1 on an unpatched HP-UX 11.x system, you
+ may get the following error:
+In file included from /usr/include/unistd.h:11,
+ from ../include/global.h:125,
+ from mysql_priv.h:15,
+ from item.cc:19:
+/usr/include/sys/unistd.h:184: declaration of C function ...
+/usr/include/sys/pthread.h:440: previous declaration ...
+In file included from item.h:306,
+ from mysql_priv.h:158,
+ from item.cc:19:
- To create a 64-bit binary with Sun's Forte compiler, use the
- following configuration options:
-CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
-CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
-./configure --prefix=/usr/local/mysql --enable-assembler
+ The problem is that HP-UX does not define pthreads_atfork()
+ consistently. It has conflicting prototypes in
+ /usr/include/sys/unistd.h:184 and /usr/include/sys/pthread.h:440.
- To create a 64-bit Solaris binary using gcc, add -m64 to CFLAGS
- and CXXFLAGS and remove --enable-assembler from the configure
- line.
+ One solution is to copy /usr/include/sys/unistd.h into
+ mysql/include and edit unistd.h and change it to match the
+ definition in pthread.h. Look for this line:
+extern int pthread_atfork(void (*prepare)(), void (*parent)(),
+ void (*child)());
- In the MySQL benchmarks, we obtained a 4% speed increase on
- UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
- using gcc 3.2 with the -mcpu flag.
+ Change it to look like this:
+extern int pthread_atfork(void (*prepare)(void), void (*parent)(void)
+,
+ void (*child)(void));
- If you create a 64-bit mysqld binary, it is 4% slower than the
- 32-bit binary, but can handle more threads and memory.
+ After making the change, the following configure line should work:
+CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \
+CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \
+./configure --prefix=/usr/local/mysql --disable-shared
- When using Solaris 10 for x86_64, you should mount any file
- systems on which you intend to store InnoDB files with the
- forcedirectio option. (By default mounting is done without this
- option.) Failing to do so will cause a significant drop in
- performance when using the InnoDB storage engine on this platform.
+ If you are using HP-UX compiler, you can use the following command
+ (which has been tested with cc B.11.11.04):
+CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
+ --with-extra-character-set=complex
- If you get a problem with fdatasync or sched_yield, you can fix
- this by adding LIBS=-lrt to the configure line
+ You can ignore any errors of the following type:
+aCC: warning 901: unknown option: `-3': use +help for online
+documentation
- For compilers older than WorkShop 5.3, you might have to edit the
- configure script. Change this line:
-#if !defined(__STDC__) || __STDC__ != 1
-
- To this:
-#if !defined(__STDC__)
-
- If you turn on __STDC__ with the -Xc option, the Sun compiler
- can't compile with the Solaris pthread.h header file. This is a
- Sun bug (broken compiler or broken include file).
-
- If mysqld issues the following error message when you run it, you
- have tried to compile MySQL with the Sun compiler without enabling
- the -mt multi-thread option:
-libc internal error: _rmutex_unlock: rmutex not held
-
- Add -mt to CFLAGS and CXXFLAGS and recompile.
-
- If you are using the SFW version of gcc (which comes with Solaris
- 8), you must add /opt/sfw/lib to the environment variable
- LD_LIBRARY_PATH before running configure.
-
- If you are using the gcc available from sunfreeware.com, you may
- have many problems. To avoid this, you should recompile gcc and
- GNU binutils on the machine where you are running them.
-
- If you get the following error when compiling MySQL with gcc, it
- means that your gcc is not configured for your version of Solaris:
-shell> gcc -O3 -g -O2 -DDBUG_OFF -o thr_alarm ...
-./thr_alarm.c: In function `signal_hand':
-./thr_alarm.c:556: too many arguments to function `sigwait'
-
- The proper thing to do in this case is to get the newest version
- of gcc and compile it with your current gcc compiler. At least for
- Solaris 2.5, almost all binary versions of gcc have old, unusable
- include files that break all programs that use threads, and
- possibly other programs as well.
+ If you get the following error from configure, verify that you
+ don't have the path to the K&R compiler before the path to the
+ HP-UX C and C++ compiler:
+checking for cc option to accept ANSI C... no
+configure: error: MySQL requires an ANSI C compiler (and a C++ compil
+er).
+Try gcc. See the Installation chapter in the Reference Manual.
- Solaris does not provide static versions of all system libraries
- (libpthreads and libdl), so you cannot compile MySQL with
- --static. If you try to do so, you get one of the following
- errors:
-ld: fatal: library -ldl: not found
-undefined reference to `dlopen'
-cannot find -lrt
+ Another reason for not being able to compile is that you didn't
+ define the +DD64 flags as just described.
- If you link your own MySQL client programs, you may see the
- following error at runtime:
-ld.so.1: fatal: libmysqlclient.so.#:
-open failed: No such file or directory
+ Another possibility for HP-UX 11 is to use the MySQL binaries
+ provided at http://dev.mysql.com/downloads/, which we have built
+ and tested ourselves. We have also received reports that the HP-UX
+ 10.20 binaries supplied by MySQL can be run successfully on HP-UX
+ 11. If you encounter problems, you should be sure to check your
+ HP-UX patch level.
- This problem can be avoided by one of the following methods:
+2.12. Installing MySQL on AIX
- * Link clients with the -Wl,r/full/path/to/libmysqlclient.so
- flag rather than with -Lpath).
+ Automatic detection of xlC is missing from Autoconf, so a number
+ of variables need to be set before running configure. The
+ following example uses the IBM compiler:
+export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 "
+export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192"
+export CFLAGS="-I /usr/local/include"
+export LDFLAGS="-L /usr/local/lib"
+export CPPFLAGS=$CFLAGS
+export CXXFLAGS=$CFLAGS
- * Copy libmysqclient.so to /usr/lib.
+./configure --prefix=/usr/local \
+ --localstatedir=/var/mysql \
+ --sbindir='/usr/local/bin' \
+ --libexecdir='/usr/local/bin' \
+ --enable-thread-safe-client \
+ --enable-large-files
- * Add the path name of the directory where libmysqlclient.so is
- located to the LD_RUN_PATH environment variable before running
- your client.
+ The preceding options are used to compile the MySQL distribution
+ that can be found at http://www-frec.bull.com/.
- If you have problems with configure trying to link with -lz when
- you don't have zlib installed, you have two options:
+ If you change the -O3 to -O2 in the preceding configure line, you
+ must also remove the -qstrict option. This is a limitation in the
+ IBM C compiler.
- * If you want to be able to use the compressed communication
- protocol, you need to get and install zlib from ftp.gnu.org.
+ If you are using gcc to compile MySQL, you must use the
+ -fno-exceptions flag, because the exception handling in gcc is not
+ thread-safe! There are also some known problems with IBM's
+ assembler that may cause it to generate bad code when used with
+ gcc.
- * Run configure with the --with-named-z-libs=no option when
- building MySQL.
+ Use the following configure line with gcc 2.95 on AIX:
+CC="gcc -pipe -mcpu=power -Wa,-many" \
+CXX="gcc -pipe -mcpu=power -Wa,-many" \
+CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \
+./configure --prefix=/usr/local/mysql --with-low-memory
- If you are using gcc and have problems with loading user-defined
- functions (UDFs) into MySQL, try adding -lgcc to the link line for
- the UDF.
+ The -Wa,-many option is necessary for the compile to be
+ successful. IBM is aware of this problem but is in no hurry to fix
+ it because of the workaround that is available. We don't know if
+ the -fno-exceptions is required with gcc 2.95, but because MySQL
+ doesn't use exceptions and the option generates faster code, you
+ should always use it with gcc.
- If you would like MySQL to start automatically, you can copy
- support-files/mysql.server to /etc/init.d and create a symbolic
- link to it named /etc/rc3.d/S99mysql.server.
+ If you get a problem with assembler code, try changing the
+ -mcpu=xxx option to match your CPU. Typically power2, power, or
+ powerpc may need to be used. Alternatively, you might need to use
+ 604 or 604e. We are not positive but suspect that power would
+ likely be safe most of the time, even on a power2 machine.
- If too many processes try to connect very rapidly to mysqld, you
- should see this error in the MySQL log:
-Error in accept: Protocol error
+ If you don't know what your CPU is, execute a uname -m command. It
+ produces a string that looks like 000514676700, with a format of
+ xxyyyyyymmss where xx and ss are always 00, yyyyyy is a unique
+ system ID and mm is the ID of the CPU Planar. A chart of these
+ values can be found at
+ http://www16.boulder.ibm.com/pseries/en_US/cmds/aixcmds5/uname.htm
+ .
- You might try starting the server with the --back_log=50 option as
- a workaround for this. (Use -O back_log=50 before MySQL 4.)
+ This gives you a machine type and a machine model you can use to
+ determine what type of CPU you have.
- Solaris doesn't support core files for setuid() applications, so
- you can't get a core file from mysqld if you are using the --user
- option.
+ If you have problems with threads on AIX 5.3, you should upgrade
+ AIX 5.3 to technology level 7 (5300-07).
+
+ If you have problems with signals (MySQL dies unexpectedly under
+ high load), you may have found an OS bug with threads and signals.
+ In this case, you can tell MySQL not to use signals by configuring
+ as follows:
+CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
+CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \
+-DDONT_USE_THR_ALARM" \
+./configure --prefix=/usr/local/mysql --with-debug \
+ --with-low-memory
+
+ This doesn't affect the performance of MySQL, but has the side
+ effect that you can't kill clients that are "sleeping" on a
+ connection with mysqladmin kill or mysqladmin shutdown. Instead,
+ the client dies when it issues its next command.
+
+ On some versions of AIX, linking with libbind.a makes
+ getservbyname() dump core. This is an AIX bug and should be
+ reported to IBM.
+
+ For AIX 4.2.1 and gcc, you have to make the following changes.
-2.13.3.1. Solaris 2.7/2.8 Notes
+ After configuring, edit config.h and include/my_config.h and
+ change the line that says this:
+#define HAVE_SNPRINTF 1
- Normally, you can use a Solaris 2.6 binary on Solaris 2.7 and 2.8.
- Most of the Solaris 2.6 issues also apply for Solaris 2.7 and 2.8.
+ to this:
+#undef HAVE_SNPRINTF
- MySQL should be able to detect new versions of Solaris
- automatically and enable workarounds for the following problems.
+ And finally, in mysqld.cc, you need to add a prototype for
+ initgroups().
+#ifdef _AIX41
+extern "C" int initgroups(const char *,int);
+#endif
- Solaris 2.7 / 2.8 has some bugs in the include files. You may see
- the following error when you use gcc:
-/usr/include/widec.h:42: warning: `getwc' redefined
-/usr/include/wchar.h:326: warning: this is the location of the previo
-us
-definition
+ For 32-bit binaries, if you need to allocate a lot of memory to
+ the mysqld process, it is not enough to just use ulimit -d
+ unlimited. You may also have to modify mysqld_safe to add a line
+ something like this:
+export LDR_CNTRL='MAXDATA=0x80000000'
- If this occurs, you can fix the problem by copying
- /usr/include/widec.h to .../lib/gcc-lib/os/gcc-version/include and
- changing line 41 from this:
-#if !defined(lint) && !defined(__lint)
+ You can find more information about using a lot of memory at
+ http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lr
+ g_prg_support.htm.
- To this:
-#if !defined(lint) && !defined(__lint) && !defined(getwc)
+ Users of AIX 4.3 should use gmake instead of the make utility
+ included with AIX.
- Alternatively, you can edit /usr/include/widec.h directly. Either
- way, after you make the fix, you should remove config.cache and
- run configure again.
+ As of AIX 4.1, the C compiler has been unbundled from AIX as a
+ separate product. gcc 3.3.2 can be obtained here:
+ ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gc
+ c/
- If you get the following errors when you run make, it is because
- configure didn't detect the curses.h file (probably because of the
- error in /usr/include/widec.h):
-In file included from mysql.cc:50:
-/usr/include/term.h:1060: syntax error before `,'
-/usr/include/term.h:1081: syntax error before `;'
+ The steps for compiling MySQL on AIX with gcc 3.3.2 are similar to
+ those for using gcc 2.95 (in particular, the need to edit config.h
+ and my_config.h after running configure). However, before running
+ configure, you should also patch the curses.h file as follows:
+/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/curses
+.h.ORIG
+ Mon Dec 26 02:17:28 2005
+--- /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/cu
+rses.h
+Mon Dec 26 02:40:13 2005
+***************
+*** 2023,2029 ****
- The solution to this problem is to do one of the following:
- 1. Configure with CFLAGS=-DHAVE_CURSES_H CXXFLAGS=-DHAVE_CURSES_H
- ./configure.
+ #endif /* _AIX32_CURSES */
+! #if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || de
+fined
+(__STRICT_ANSI__)
+ extern int delwin (WINDOW *);
+ extern int endwin (void);
+ extern int getcurx (WINDOW *);
+--- 2023,2029 ----
- 2. Edit /usr/include/widec.h as indicated in the preceding
- discussion and re-run configure.
- 3. Remove the #define HAVE_TERM line from the config.h file and
- run make again.
+ #endif /* _AIX32_CURSES */
+! #if 0 && (defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus)
+|| defined
+(__STRICT_ANSI__))
+ extern int delwin (WINDOW *);
+ extern int endwin (void);
+ extern int getcurx (WINDOW *);
- If your linker cannot find -lz when linking client programs, the
- problem is probably that your libz.so file is installed in
- /usr/local/lib. You can fix this problem by one of the following
- methods:
+2.13. Post-Installation Setup and Testing
- * Add /usr/local/lib to LD_LIBRARY_PATH.
+ After installing MySQL, there are some issues that you should
+ address. For example, on Unix, you should initialize the data
+ directory and create the MySQL grant tables. On all platforms, an
+ important security concern is that the initial accounts in the
+ grant tables have no passwords. You should assign passwords to
+ prevent unauthorized access to the MySQL server. Optionally, you
+ can create time zone tables to enable recognition of named time
+ zones.
- * Add a link to libz.so from /lib.
+ The following sections include post-installation procedures that
+ are specific to Windows systems and to Unix systems. Another
+ section, Section 2.13.1.3, "Starting and Troubleshooting the MySQL
+ Server," applies to all platforms; it describes what to do if you
+ have trouble getting the server to start. Section 2.13.2,
+ "Securing the Initial MySQL Accounts," also applies to all
+ platforms. You should follow its instructions to make sure that
+ you have properly protected your MySQL accounts by assigning
+ passwords to them.
- * If you are using Solaris 8, you can install the optional zlib
- from your Solaris 8 CD distribution.
+ When you are ready to create additional user accounts, you can
+ find information on the MySQL access control system and account
+ management in Section 5.4, "The MySQL Access Privilege System,"
+ and Section 5.5, "MySQL User Account Management."
- * Run configure with the --with-named-z-libs=no option when
- building MySQL.
+2.13.1. Unix Post-Installation Procedures
-2.13.3.2. Solaris x86 Notes
+ After installing MySQL on Unix, you need to initialize the grant
+ tables, start the server, and make sure that the server works
+ satisfactorily. You may also wish to arrange for the server to be
+ started and stopped automatically when your system starts and
+ stops. You should also assign passwords to the accounts in the
+ grant tables.
- On Solaris 8 on x86, mysqld dumps core if you remove the debug
- symbols using strip.
+ On Unix, the grant tables are set up by the mysql_install_db
+ program. For some installation methods, this program is run for
+ you automatically:
- If you are using gcc on Solaris x86 and you experience problems
- with core dumps under load, you should use the following configure
- command:
-CC=gcc CFLAGS="-O3 -fomit-frame-pointer -DHAVE_CURSES_H" \
-CXX=gcc \
-CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors \
- -fno-exceptions -fno-rtti -DHAVE_CURSES_H" \
-./configure --prefix=/usr/local/mysql
+ * If you install MySQL on Linux using RPM distributions, the
+ server RPM runs mysql_install_db.
- This avoids problems with the libstdc++ library and with C++
- exceptions.
+ * If you install MySQL on Mac OS X using a PKG distribution, the
+ installer runs mysql_install_db.
- If this doesn't help, you should compile a debug version and run
- it with a trace file or under gdb. See MySQL Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
+ Otherwise, you'll need to run mysql_install_db yourself.
-2.13.4. BSD Notes
+ The following procedure describes how to initialize the grant
+ tables (if that has not previously been done) and then start the
+ server. It also suggests some commands that you can use to test
+ whether the server is accessible and working properly. For
+ information about starting and stopping the server automatically,
+ see Section 2.13.1.2, "Starting and Stopping MySQL Automatically."
- This section provides information about using MySQL on variants of
- BSD Unix.
+ After you complete the procedure and have the server running, you
+ should assign passwords to the accounts created by
+ mysql_install_db. Instructions for doing so are given in Section
+ 2.13.2, "Securing the Initial MySQL Accounts."
-2.13.4.1. FreeBSD Notes
+ In the examples shown here, the server runs under the user ID of
+ the mysql login account. This assumes that such an account exists.
+ Either create the account if it does not exist, or substitute the
+ name of a different existing login account that you plan to use
+ for running the server.
- FreeBSD 4.x or newer is recommended for running MySQL, because the
- thread package is much more integrated. To get a secure and stable
- system, you should use only FreeBSD kernels that are marked
- -RELEASE.
+ 1. Change location into the top-level directory of your MySQL
+ installation, represented here by BASEDIR:
+shell> cd BASEDIR
+ BASEDIR is likely to be something like /usr/local/mysql or
+ /usr/local. The following steps assume that you are located in
+ this directory.
- The easiest (and preferred) way to install MySQL is to use the
- mysql-server and mysql-client ports available at
- http://www.freebsd.org/. Using these ports gives you the following
- benefits:
+ 2. If necessary, run the mysql_install_db program to set up the
+ initial MySQL grant tables containing the privileges that
+ determine how users are allowed to connect to the server.
+ You'll need to do this if you used a distribution type for
+ which the installation procedure doesn't run the program for
+ you.
+ Typically, mysql_install_db needs to be run only the first
+ time you install MySQL, so you can skip this step if you are
+ upgrading an existing installation, However, mysql_install_db
+ does not overwrite any existing privilege tables, so it should
+ be safe to run in any circumstances.
+ To initialize the grant tables, use one of the following
+ commands, depending on whether mysql_install_db is located in
+ the bin or scripts directory:
+shell> bin/mysql_install_db --user=mysql
+shell> scripts/mysql_install_db --user=mysql
+ It might be necessary to specify other options such as
+ --basedir or --datadir if mysql_install_db does not use the
+ correct locations for the installation directory or data
+ directory. For example:
+shell> bin/mysql_install_db --user=mysql \
+ --basedir=/opt/mysql/mysql \
+ --datadir=/opt/mysql/mysql/data
+ The mysql_install_db script creates the server's data
+ directory. Under the data directory, it creates directories
+ for the mysql database that holds all database privileges and
+ the test database that you can use to test MySQL. The script
+ also creates privilege table entries for root and
+ anonymous-user accounts. The accounts have no passwords
+ initially. A description of their initial privileges is given
+ in Section 2.13.2, "Securing the Initial MySQL Accounts."
+ Briefly, these privileges allow the MySQL root user to do
+ anything, and allow anybody to create or use databases with a
+ name of test or starting with test_.
+ It is important to make sure that the database directories and
+ files are owned by the mysql login account so that the server
+ has read and write access to them when you run it later. To
+ ensure this, the --user option should be used as shown if you
+ run mysql_install_db as root. Otherwise, you should execute
+ the script while logged in as mysql, in which case you can
+ omit the --user option from the command.
+ mysql_install_db creates several tables in the mysql database,
+ including user, db, host, tables_priv, columns_priv, func, and
+ others. See Section 5.4, "The MySQL Access Privilege System,"
+ for a complete listing and description of these tables.
+ If you don't want to have the test database, you can remove it
+ with mysqladmin -u root drop test after starting the server.
+ If you have trouble with mysql_install_db at this point, see
+ Section 2.13.1.1, "Problems Running mysql_install_db."
- * A working MySQL with all optimizations enabled that are known
- to work on your version of FreeBSD.
+ 3. Start the MySQL server:
+shell> bin/mysqld_safe --user=mysql &
+ It is important that the MySQL server be run using an
+ unprivileged (non-root) login account. To ensure this, the
+ --user option should be used as shown if you run mysqld_safe
+ as system root. Otherwise, you should execute the script while
+ logged in to the system as mysql, in which case you can omit
+ the --user option from the command.
+ Further instructions for running MySQL as an unprivileged user
+ are given in Section 5.3.5, "How to Run MySQL as a Normal
+ User."
+ If you neglected to create the grant tables before proceeding
+ to this step, the following message appears in the error log
+ file when you start the server:
+mysqld: Can't find file: 'host.frm'
+ If you have other problems starting the server, see Section
+ 2.13.1.3, "Starting and Troubleshooting the MySQL Server."
- * Automatic configuration and build.
+ 4. Use mysqladmin to verify that the server is running. The
+ following commands provide simple tests to check whether the
+ server is up and responding to connections:
+shell> bin/mysqladmin version
+shell> bin/mysqladmin variables
+ The output from mysqladmin version varies slightly depending
+ on your platform and version of MySQL, but should be similar
+ to that shown here:
+shell> bin/mysqladmin version
+mysqladmin Ver 14.12 Distrib 5.1.41, for pc-linux-gnu on i686
+...
- * Startup scripts installed in /usr/local/etc/rc.d.
+Server version 5.1.41
+Protocol version 10
+Connection Localhost via UNIX socket
+UNIX socket /var/lib/mysql/mysql.sock
+Uptime: 14 days 5 hours 5 min 21 sec
- * The ability to use pkg_info -L to see which files are
- installed.
+Threads: 1 Questions: 366 Slow queries: 0
+Opens: 0 Flush tables: 1 Open tables: 19
+Queries per second avg: 0.000
+ To see what else you can do with mysqladmin, invoke it with
+ the --help option.
- * The ability to use pkg_delete to remove MySQL if you no longer
- want it on your machine.
+ 5. Verify that you can shut down the server:
+shell> bin/mysqladmin -u root shutdown
- It is recommended you use MIT-pthreads on FreeBSD 2.x, and native
- threads on FreeBSD 3 and up. It is possible to run with native
- threads on some late 2.2.x versions, but you may encounter
- problems shutting down mysqld.
-
- Unfortunately, certain function calls on FreeBSD are not yet fully
- thread-safe. Most notably, this includes the gethostbyname()
- function, which is used by MySQL to convert host names into IP
- addresses. Under certain circumstances, the mysqld process
- suddenly causes 100% CPU load and is unresponsive. If you
- encounter this problem, try to start MySQL using the
- --skip-name-resolve option.
-
- Alternatively, you can link MySQL on FreeBSD 4.x against the
- LinuxThreads library, which avoids a few of the problems that the
- native FreeBSD thread implementation has. For a very good
- comparison of LinuxThreads versus native threads, see Jeremy
- Zawodny's article FreeBSD or Linux for your MySQL Server? at
- http://jeremy.zawodny.com/blog/archives/000697.html.
-
- Known problem when using LinuxThreads on FreeBSD is:
-
- * The connection times (wait_timeout, interactive_timeout and
- net_read_timeout) values are not honored. The symptom is that
- persistent connections can hang for a very long time without
- getting closed down and that a 'kill' for a thread will not
- take affect until the thread does it a new command
- This is probably a signal handling problem in the thread
- library where the signal doesn't break a pending read. This is
- supposed to be fixed in FreeBSD 5.0
+ 6. Verify that you can start the server again. Do this by using
+ mysqld_safe or by invoking mysqld directly. For example:
+shell> bin/mysqld_safe --user=mysql --log &
+ If mysqld_safe fails, see Section 2.13.1.3, "Starting and
+ Troubleshooting the MySQL Server."
- The MySQL build process requires GNU make (gmake) to work. If GNU
- make is not available, you must install it first before compiling
- MySQL.
+ 7. Run some simple tests to verify that you can retrieve
+ information from the server. The output should be similar to
+ what is shown here:
+shell> bin/mysqlshow
++-----------+
+| Databases |
++-----------+
+| mysql |
+| test |
++-----------+
- The recommended way to compile and install MySQL on FreeBSD with
- gcc (2.95.2 and up) is:
-CC=gcc CFLAGS="-O2 -fno-strength-reduce" \
- CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions \
- -felide-constructors -fno-strength-reduce" \
- ./configure --prefix=/usr/local/mysql --enable-assembler
-gmake
-gmake install
-cd /usr/local/mysql
-bin/mysql_install_db --user=mysql
-bin/mysqld_safe &
+shell> bin/mysqlshow mysql
+Database: mysql
++---------------------------+
+| Tables |
++---------------------------+
+| columns_priv |
+| db |
+| func |
+| help_category |
+| help_keyword |
+| help_relation |
+| help_topic |
+| host |
+| proc |
+| procs_priv |
+| tables_priv |
+| time_zone |
+| time_zone_leap_second |
+| time_zone_name |
+| time_zone_transition |
+| time_zone_transition_type |
+| user |
++---------------------------+
- If you notice that configure uses MIT-pthreads, you should read
- the MIT-pthreads notes. See Section 2.10.5, "MIT-pthreads Notes."
+shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
++------+--------+------+
+| host | db | user |
++------+--------+------+
+| % | test | |
+| % | test_% | |
++------+--------+------+
- If you get an error from make install that it can't find
- /usr/include/pthreads, configure didn't detect that you need
- MIT-pthreads. To fix this problem, remove config.cache, and then
- re-run configure with the --with-mit-threads option.
-
- Be sure that your name resolver setup is correct. Otherwise, you
- may experience resolver delays or failures when connecting to
- mysqld. Also make sure that the localhost entry in the /etc/hosts
- file is correct. The file should start with a line similar to
- this:
-127.0.0.1 localhost localhost.your.domain
+ 8. There is a benchmark suite in the sql-bench directory (under
+ the MySQL installation directory) that you can use to compare
+ how MySQL performs on different platforms. The benchmark suite
+ is written in Perl. It requires the Perl DBI module that
+ provides a database-independent interface to the various
+ databases, and some other additional Perl modules:
+DBI
+DBD::mysql
+Data::Dumper
+Data::ShowTable
+ These modules can be obtained from CPAN
+ (http://www.cpan.org/) See also Section 2.15.1, "Installing
+ Perl on Unix."
+ The sql-bench/Results directory contains the results from many
+ runs against different databases and platforms. To run all
+ tests, execute these commands:
+shell> cd sql-bench
+shell> perl run-all-tests
+ If you don't have the sql-bench directory, you probably
+ installed MySQL using RPM files other than the source RPM.
+ (The source RPM includes the sql-bench benchmark directory.)
+ In this case, you must first install the benchmark suite
+ before you can use it. There are separate benchmark RPM files
+ named mysql-bench-VERSION.i386.rpm that contain benchmark code
+ and data.
+ If you have a source distribution, there are also tests in its
+ tests subdirectory that you can run. For example, to run
+ auto_increment.tst, execute this command from the top-level
+ directory of your source distribution:
+shell> mysql -vvf test < ./tests/auto_increment.tst
+ The expected result of the test can be found in the
+ ./tests/auto_increment.res file.
- FreeBSD is known to have a very low default file handle limit. See
- Section B.1.2.18, "'File' Not Found and Similar Errors." Start the
- server by using the --open-files-limit option for mysqld_safe, or
- raise the limits for the mysqld user in /etc/login.conf and
- rebuild it with cap_mkdb /etc/login.conf. Also be sure that you
- set the appropriate class for this user in the password file if
- you are not using the default (use chpass mysqld-user-name). See
- Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
+ 9. At this point, you should have the server running. However,
+ none of the initial MySQL accounts have a password, so you
+ should assign passwords using the instructions found in
+ Section 2.13.2, "Securing the Initial MySQL Accounts."
- FreeBSD limits the size of a process to 512MB, even if you have
- much more RAM available on the system. So you may get an error
- such as this:
-Out of memory (Needed 16391 bytes)
+ The MySQL 5.1 installation procedure creates time zone tables in
+ the mysql database. However, you must populate the tables manually
+ using the instructions in Section 9.7, "MySQL Server Time Zone
+ Support."
- In current versions of FreeBSD (at least 4.x and greater), you may
- increase this limit by adding the following entries to the
- /boot/loader.conf file and rebooting the machine (these are not
- settings that can be changed at run time with the sysctl command):
-kern.maxdsiz="1073741824" # 1GB
-kern.dfldsiz="1073741824" # 1GB
-kern.maxssiz="134217728" # 128MB
+2.13.1.1. Problems Running mysql_install_db
- For older versions of FreeBSD, you must recompile your kernel to
- change the maximum data segment size for a process. In this case,
- you should look at the MAXDSIZ option in the LINT config file for
- more information.
+ The purpose of the mysql_install_db script is to generate new
+ MySQL privilege tables. It does not overwrite existing MySQL
+ privilege tables, and it does not affect any other data.
- If you get problems with the current date in MySQL, setting the TZ
- variable should help. See Section 2.14, "Environment Variables."
+ If you want to re-create your privilege tables, first stop the
+ mysqld server if it is running. Then rename the mysql directory
+ under the data directory to save it, and then run
+ mysql_install_db. Suppose that your current directory is the MySQL
+ installation directory and that mysql_install_db is located in the
+ bin directory and the data directory is named data. To rename the
+ mysql database and re-run mysql_install_db, use these commands.
+shell> mv data/mysql data/mysql.old
+shell> bin/mysql_install_db --user=mysql
-2.13.4.2. NetBSD Notes
+ When you run mysql_install_db, you might encounter the following
+ problems:
- To compile on NetBSD, you need GNU make. Otherwise, the build
- process fails when make tries to run lint on C++ files.
+ * mysql_install_db fails to install the grant tables
+ You may find that mysql_install_db fails to install the grant
+ tables and terminates after displaying the following messages:
+Starting mysqld daemon with databases from XXXXXX
+mysqld ended
+ In this case, you should examine the error log file very
+ carefully. The log should be located in the directory XXXXXX
+ named by the error message and should indicate why mysqld
+ didn't start. If you do not understand what happened, include
+ the log when you post a bug report. See Section 1.6, "How to
+ Report Bugs or Problems."
-2.13.4.3. OpenBSD 2.5 Notes
+ * There is a mysqld process running
+ This indicates that the server is running, in which case the
+ grant tables have probably been created already. If so, there
+ is no need to run mysql_install_db at all because it needs to
+ be run only once (when you install MySQL the first time).
- On OpenBSD 2.5, you can compile MySQL with native threads with the
- following options:
-CFLAGS=-pthread CXXFLAGS=-pthread ./configure --with-mit-threads=no
+ * Installing a second mysqld server does not work when one
+ server is running
+ This can happen when you have an existing MySQL installation,
+ but want to put a new installation in a different location.
+ For example, you might have a production installation, but you
+ want to create a second installation for testing purposes.
+ Generally the problem that occurs when you try to run a second
+ server is that it tries to use a network interface that is in
+ use by the first server. In this case, you should see one of
+ the following error messages:
+Can't start server: Bind on TCP/IP port:
+Address already in use
+Can't start server: Bind on unix socket...
+ For instructions on setting up multiple servers, see Section
+ 5.6, "Running Multiple MySQL Servers on the Same Machine."
-2.13.4.4. BSD/OS Version 2.x Notes
+ * You do not have write access to the /tmp directory
+ If you do not have write access to create temporary files or a
+ Unix socket file in the default location (the /tmp directory),
+ an error occurs when you run mysql_install_db or the mysqld
+ server.
+ You can specify different locations for the temporary
+ directory and Unix socket file by executing these commands
+ prior to starting mysql_install_db or mysqld, where
+ some_tmp_dir is the full path name to some directory for which
+ you have write permission:
+shell> TMPDIR=/some_tmp_dir/
+shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock
+shell> export TMPDIR MYSQL_UNIX_PORT
+ Then you should be able to run mysql_install_db and start the
+ server with these commands:
+shell> bin/mysql_install_db --user=mysql
+shell> bin/mysqld_safe --user=mysql &
+ If mysql_install_db is located in the scripts directory,
+ modify the first command to scripts/mysql_install_db.
+ See Section B.5.4.5, "How to Protect or Change the MySQL Unix
+ Socket File," and Section 2.14, "Environment Variables."
- If you get the following error when compiling MySQL, your ulimit
- value for virtual memory is too low:
-item_func.h: In method
-`Item_func_ge::Item_func_ge(const Item_func_ge &)':
-item_func.h:28: virtual memory exhausted
-make[2]: *** [item_func.o] Error 1
+ There are some alternatives to running the mysql_install_db script
+ provided in the MySQL distribution:
- Try using ulimit -v 80000 and run make again. If this doesn't work
- and you are using bash, try switching to csh or sh; some BSDI
- users have reported problems with bash and ulimit.
+ * If you want the initial privileges to be different from the
+ standard defaults, you can modify mysql_install_db before you
+ run it. However, it is preferable to use GRANT and REVOKE to
+ change the privileges after the grant tables have been set up.
+ In other words, you can run mysql_install_db, and then use
+ mysql -u root mysql to connect to the server as the MySQL root
+ user so that you can issue the necessary GRANT and REVOKE
+ statements.
+ If you want to install MySQL on several machines with the same
+ privileges, you can put the GRANT and REVOKE statements in a
+ file and execute the file as a script using mysql after
+ running mysql_install_db. For example:
+shell> bin/mysql_install_db --user=mysql
+shell> bin/mysql -u root < your_script_file
+ By doing this, you can avoid having to issue the statements
+ manually on each machine.
- If you are using gcc, you may also use have to use the
- --with-low-memory flag for configure to be able to compile
- sql_yacc.cc.
+ * It is possible to re-create the grant tables completely after
+ they have previously been created. You might want to do this
+ if you're just learning how to use GRANT and REVOKE and have
+ made so many modifications after running mysql_install_db that
+ you want to wipe out the tables and start over.
+ To re-create the grant tables, remove all the .frm, .MYI, and
+ .MYD files in the mysql database directory. Then run the
+ mysql_install_db script again.
- If you get problems with the current date in MySQL, setting the TZ
- variable should help. See Section 2.14, "Environment Variables."
+ * You can start mysqld manually using the --skip-grant-tables
+ option and add the privilege information yourself using mysql:
+shell> bin/mysqld_safe --user=mysql --skip-grant-tables &
+shell> bin/mysql mysql
+ From mysql, manually execute the SQL commands contained in
+ mysql_install_db. Make sure that you run mysqladmin
+ flush-privileges or mysqladmin reload afterward to tell the
+ server to reload the grant tables.
+ Note that by not using mysql_install_db, you not only have to
+ populate the grant tables manually, you also have to create
+ them first.
-2.13.4.5. BSD/OS Version 3.x Notes
+2.13.1.2. Starting and Stopping MySQL Automatically
- Upgrade to BSD/OS 3.1. If that is not possible, install BSDIpatch
- M300-038.
+ Generally, you start the mysqld server in one of these ways:
- Use the following command when configuring MySQL:
-env CXX=shlicc++ CC=shlicc2 \
-./configure \
- --prefix=/usr/local/mysql \
- --localstatedir=/var/mysql \
- --without-perl \
- --with-unix-socket-path=/var/mysql/mysql.sock
-
- The following is also known to work:
-env CC=gcc CXX=gcc CXXFLAGS=-O3 \
-./configure \
- --prefix=/usr/local/mysql \
- --with-unix-socket-path=/var/mysql/mysql.sock
-
- You can change the directory locations if you wish, or just use
- the defaults by not specifying any locations.
-
- If you have problems with performance under heavy load, try using
- the --skip-thread-priority option to mysqld. This runs all threads
- with the same priority. On BSDI 3.1, this gives better
- performance, at least until BSDI fixes its thread scheduler.
-
- If you get the error virtual memory exhausted while compiling, you
- should try using ulimit -v 80000 and running make again. If this
- doesn't work and you are using bash, try switching to csh or sh;
- some BSDI users have reported problems with bash and ulimit.
-
-2.13.4.6. BSD/OS Version 4.x Notes
-
- BSDI 4.x has some thread-related bugs. If you want to use MySQL on
- this, you should install all thread-related patches. At least
- M400-023 should be installed.
-
- On some BSDI 4.x systems, you may get problems with shared
- libraries. The symptom is that you can't execute any client
- programs, for example, mysqladmin. In this case, you need to
- reconfigure not to use shared libraries with the --disable-shared
- option to configure.
-
- Some customers have had problems on BSDI 4.0.1 that the mysqld
- binary after a while can't open tables. This occurs because some
- library/system-related bug causes mysqld to change current
- directory without having asked for that to happen.
-
- The fix is to either upgrade MySQL to at least version 3.23.34 or,
- after running configure, remove the line #define HAVE_REALPATH
- from config.h before running make.
-
- Note that this means that you can't symbolically link a database
- directories to another database directory or symbolic link a table
- to another database on BSDI. (Making a symbolic link to another
- disk is okay).
+ * Invoke mysqld directly. This works on any platform.
-2.13.5. Other Unix Notes
+ * Run the MySQL server as a Windows service. The service can be
+ set to start the server automatically when Windows starts, or
+ as a manual service that you start on request. For
+ instructions, see Section 2.5.5.6, "Starting MySQL as a
+ Windows Service."
-2.13.5.1. HP-UX Version 10.20 Notes
+ * Invoke mysqld_safe, which tries to determine the proper
+ options for mysqld and then runs it with those options. This
+ script is used on Unix and Unix-like systems. See Section
+ 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
- If you install MySQL using a binary tarball distribution on HP-UX,
- you may run into trouble even before you get the MySQL
- distribution unpacked, as the HP-UX tar cannot handle long file
- names. This means that you may see errors when you try to unpack
- MySQL.
+ * Invoke mysql.server. This script is used primarily at system
+ startup and shutdown on systems that use System V-style run
+ directories, where it usually is installed under the name
+ mysql. The mysql.server script starts the server by invoking
+ mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server
+ Startup Script."
- If this occurs, you must use GNU tar (gtar) to unpack the
- distribution.
+ * On Mac OS X, install a separate MySQL Startup Item package to
+ enable the automatic startup of MySQL on system startup. The
+ Startup Item starts the server by invoking mysql.server. See
+ Section 2.7, "Installing MySQL on Mac OS X," for details.
- There are a couple of small problems when compiling MySQL on
- HP-UX. Use gcc instead of the HP-UX native compiler, because gcc
- produces better code.
-
- Use gcc 2.95 on HP-UX. Don't use high optimization flags (such as
- -O6) because they may not be safe on HP-UX.
-
- The following configure line should work with gcc 2.95:
-CFLAGS="-I/opt/dce/include -fpic" \
-CXXFLAGS="-I/opt/dce/include -felide-constructors -fno-exceptions \
--fno-rtti" \
-CXX=gcc \
-./configure --with-pthread \
- --with-named-thread-libs='-ldce' \
- --prefix=/usr/local/mysql --disable-shared
-
- The following configure line should work with gcc 3.1:
-CFLAGS="-DHPUX -I/opt/dce/include -O3 -fPIC" CXX=gcc \
-CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors \
- -fno-exceptions -fno-rtti -O3 -fPIC" \
-./configure --prefix=/usr/local/mysql \
- --with-extra-charsets=complex --enable-thread-safe-client \
- --enable-local-infile --with-pthread \
- --with-named-thread-libs=-ldce --with-lib-ccflags=-fPIC
- --disable-shared
+ The mysqld_safe and mysql.server scripts and the Mac OS X Startup
+ Item can be used to start the server manually, or automatically at
+ system startup time. mysql.server and the Startup Item also can be
+ used to stop the server.
-2.13.5.2. HP-UX Version 11.x Notes
+ To start or stop the server manually using the mysql.server
+ script, invoke it with start or stop arguments:
+shell> mysql.server start
+shell> mysql.server stop
- If you install MySQL using a binary tarball distribution on HP-UX,
- you may run into trouble even before you get the MySQL
- distribution unpacked, as the HP-UX tar cannot handle long file
- names. This means that you may see errors when you try to unpack
- MySQL.
+ Before mysql.server starts the server, it changes location to the
+ MySQL installation directory, and then invokes mysqld_safe. If you
+ want the server to run as some specific user, add an appropriate
+ user option to the [mysqld] group of the /etc/my.cnf option file,
+ as shown later in this section. (It is possible that you will need
+ to edit mysql.server if you've installed a binary distribution of
+ MySQL in a nonstandard location. Modify it to change location into
+ the proper directory before it runs mysqld_safe. If you do this,
+ your modified version of mysql.server may be overwritten if you
+ upgrade MySQL in the future, so you should make a copy of your
+ edited version that you can reinstall.)
- If this occurs, you must use GNU tar (gtar) to unpack the
- distribution.
+ mysql.server stop stops the server by sending a signal to it. You
+ can also stop the server manually by executing mysqladmin
+ shutdown.
- Because of some critical bugs in the standard HP-UX libraries, you
- should install the following patches before trying to run MySQL on
- HP-UX 11.0:
-PHKL_22840 Streams cumulative
-PHNE_22397 ARPA cumulative
+ To start and stop MySQL automatically on your server, you need to
+ add start and stop commands to the appropriate places in your
+ /etc/rc* files.
- This solves the problem of getting EWOULDBLOCK from recv() and
- EBADF from accept() in threaded applications.
+ If you use the Linux server RPM package
+ (MySQL-server-VERSION.rpm), the mysql.server script is installed
+ in the /etc/init.d directory with the name mysql. You need not
+ install it manually. See Section 2.6.1, "Installing MySQL from RPM
+ Packages on Linux," for more information on the Linux RPM
+ packages.
- If you are using gcc 2.95.1 on an unpatched HP-UX 11.x system, you
- may get the following error:
-In file included from /usr/include/unistd.h:11,
- from ../include/global.h:125,
- from mysql_priv.h:15,
- from item.cc:19:
-/usr/include/sys/unistd.h:184: declaration of C function ...
-/usr/include/sys/pthread.h:440: previous declaration ...
-In file included from item.h:306,
- from mysql_priv.h:158,
- from item.cc:19:
+ Some vendors provide RPM packages that install a startup script
+ under a different name such as mysqld.
- The problem is that HP-UX does not define pthreads_atfork()
- consistently. It has conflicting prototypes in
- /usr/include/sys/unistd.h:184 and /usr/include/sys/pthread.h:440.
+ If you install MySQL from a source distribution or using a binary
+ distribution format that does not install mysql.server
+ automatically, you can install it manually. The script can be
+ found in the support-files directory under the MySQL installation
+ directory or in a MySQL source tree.
- One solution is to copy /usr/include/sys/unistd.h into
- mysql/include and edit unistd.h and change it to match the
- definition in pthread.h. Look for this line:
-extern int pthread_atfork(void (*prepare)(), void (*parent)(),
- void (*child)());
+ To install mysql.server manually, copy it to the /etc/init.d
+ directory with the name mysql, and then make it executable. Do
+ this by changing location into the appropriate directory where
+ mysql.server is located and executing these commands:
+shell> cp mysql.server /etc/init.d/mysql
+shell> chmod +x /etc/init.d/mysql
- Change it to look like this:
-extern int pthread_atfork(void (*prepare)(void), void (*parent)(void)
-,
- void (*child)(void));
+ Older Red Hat systems use the /etc/rc.d/init.d directory rather
+ than /etc/init.d. Adjust the preceding commands accordingly.
+ Alternatively, first create /etc/init.d as a symbolic link that
+ points to /etc/rc.d/init.d:
+shell> cd /etc
+shell> ln -s rc.d/init.d .
- After making the change, the following configure line should work:
-CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \
-CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \
-./configure --prefix=/usr/local/mysql --disable-shared
+ After installing the script, the commands needed to activate it to
+ run at system startup depend on your operating system. On Linux,
+ you can use chkconfig:
+shell> chkconfig --add mysql
- If you are using HP-UX compiler, you can use the following command
- (which has been tested with cc B.11.11.04):
-CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
- --with-extra-character-set=complex
+ On some Linux systems, the following command also seems to be
+ necessary to fully enable the mysql script:
+shell> chkconfig --level 345 mysql on
- You can ignore any errors of the following type:
-aCC: warning 901: unknown option: `-3': use +help for online
-documentation
+ On FreeBSD, startup scripts generally should go in
+ /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in
+ this directory are executed only if their basename matches the
+ *.sh shell file name pattern. Any other files or directories
+ present within the directory are silently ignored. In other words,
+ on FreeBSD, you should install the mysql.server script as
+ /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup.
- If you get the following error from configure, verify that you
- don't have the path to the K&R compiler before the path to the
- HP-UX C and C++ compiler:
-checking for cc option to accept ANSI C... no
-configure: error: MySQL requires an ANSI C compiler (and a C++ compil
-er).
-Try gcc. See the Installation chapter in the Reference Manual.
+ As an alternative to the preceding setup, some operating systems
+ also use /etc/rc.local or /etc/init.d/boot.local to start
+ additional services on startup. To start up MySQL using this
+ method, you could append a command like the one following to the
+ appropriate startup file:
+/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
- Another reason for not being able to compile is that you didn't
- define the +DD64 flags as just described.
+ For other systems, consult your operating system documentation to
+ see how to install startup scripts.
- Another possibility for HP-UX 11 is to use the MySQL binaries
- provided at http://dev.mysql.com/downloads/, which we have built
- and tested ourselves. We have also received reports that the HP-UX
- 10.20 binaries supplied by MySQL can be run successfully on HP-UX
- 11. If you encounter problems, you should be sure to check your
- HP-UX patch level.
+ You can add options for mysql.server in a global /etc/my.cnf file.
+ A typical /etc/my.cnf file might look like this:
+[mysqld]
+datadir=/usr/local/mysql/var
+socket=/var/tmp/mysql.sock
+port=3306
+user=mysql
-2.13.5.3. IBM-AIX notes
+[mysql.server]
+basedir=/usr/local/mysql
- Automatic detection of xlC is missing from Autoconf, so a number
- of variables need to be set before running configure. The
- following example uses the IBM compiler:
-export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 "
-export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192"
-export CFLAGS="-I /usr/local/include"
-export LDFLAGS="-L /usr/local/lib"
-export CPPFLAGS=$CFLAGS
-export CXXFLAGS=$CFLAGS
+ The mysql.server script supports the following options: basedir,
+ datadir, and pid-file. If specified, they must be placed in an
+ option file, not on the command line. mysql.server supports only
+ start and stop as command-line arguments.
-./configure --prefix=/usr/local \
- --localstatedir=/var/mysql \
- --sbindir='/usr/local/bin' \
- --libexecdir='/usr/local/bin' \
- --enable-thread-safe-client \
- --enable-large-files
+ The following table shows which option groups the server and each
+ startup script read from option files.
+ Script Option Groups
+ mysqld [mysqld], [server], [mysqld-major_version]
+ mysqld_safe [mysqld], [server], [mysqld_safe]
+ mysql.server [mysqld], [mysql.server], [server]
- The preceding options are used to compile the MySQL distribution
- that can be found at http://www-frec.bull.com/.
+ [mysqld-major_version] means that groups with names like
+ [mysqld-5.0] and [mysqld-5.1] are read by servers having versions
+ 5.0.x, 5.1.x, and so forth. This feature can be used to specify
+ options that can be read only by servers within a given release
+ series.
- If you change the -O3 to -O2 in the preceding configure line, you
- must also remove the -qstrict option. This is a limitation in the
- IBM C compiler.
+ For backward compatibility, mysql.server also reads the
+ [mysql_server] group and mysqld_safe also reads the [safe_mysqld]
+ group. However, you should update your option files to use the
+ [mysql.server] and [mysqld_safe] groups instead when using MySQL
+ 5.1.
- If you are using gcc to compile MySQL, you must use the
- -fno-exceptions flag, because the exception handling in gcc is not
- thread-safe! There are also some known problems with IBM's
- assembler that may cause it to generate bad code when used with
- gcc.
+ See Section 4.2.3.3, "Using Option Files."
- Use the following configure line with gcc 2.95 on AIX:
-CC="gcc -pipe -mcpu=power -Wa,-many" \
-CXX="gcc -pipe -mcpu=power -Wa,-many" \
-CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \
-./configure --prefix=/usr/local/mysql --with-low-memory
+2.13.1.3. Starting and Troubleshooting the MySQL Server
- The -Wa,-many option is necessary for the compile to be
- successful. IBM is aware of this problem but is in no hurry to fix
- it because of the workaround that is available. We don't know if
- the -fno-exceptions is required with gcc 2.95, but because MySQL
- doesn't use exceptions and the option generates faster code, you
- should always use it with gcc.
+ This section provides troubleshooting suggestions for problems
+ starting the server on Unix. If you are using Windows, see Section
+ 2.5.6, "Troubleshooting a MySQL Installation Under Windows."
- If you get a problem with assembler code, try changing the
- -mcpu=xxx option to match your CPU. Typically power2, power, or
- powerpc may need to be used. Alternatively, you might need to use
- 604 or 604e. We are not positive but suspect that power would
- likely be safe most of the time, even on a power2 machine.
+ If you have problems starting the server, here are some things to
+ try:
- If you don't know what your CPU is, execute a uname -m command. It
- produces a string that looks like 000514676700, with a format of
- xxyyyyyymmss where xx and ss are always 00, yyyyyy is a unique
- system ID and mm is the ID of the CPU Planar. A chart of these
- values can be found at
- http://www16.boulder.ibm.com/pseries/en_US/cmds/aixcmds5/uname.htm
- .
+ * Check the error log to see why the server does not start.
- This gives you a machine type and a machine model you can use to
- determine what type of CPU you have.
+ * Specify any special options needed by the storage engines you
+ are using.
- If you have problems with signals (MySQL dies unexpectedly under
- high load), you may have found an OS bug with threads and signals.
- In this case, you can tell MySQL not to use signals by configuring
- as follows:
-CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
-CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \
--DDONT_USE_THR_ALARM" \
-./configure --prefix=/usr/local/mysql --with-debug \
- --with-low-memory
+ * Make sure that the server knows where to find the data
+ directory.
- This doesn't affect the performance of MySQL, but has the side
- effect that you can't kill clients that are "sleeping" on a
- connection with mysqladmin kill or mysqladmin shutdown. Instead,
- the client dies when it issues its next command.
+ * Make sure that the server can access the data directory. The
+ ownership and permissions of the data directory and its
+ contents must be set such that the server can read and modify
+ them.
- On some versions of AIX, linking with libbind.a makes
- getservbyname() dump core. This is an AIX bug and should be
- reported to IBM.
+ * Verify that the network interfaces the server wants to use are
+ available.
- For AIX 4.2.1 and gcc, you have to make the following changes.
+ Some storage engines have options that control their behavior. You
+ can create a my.cnf file and specify startup options for the
+ engines that you plan to use. If you are going to use storage
+ engines that support transactional tables (InnoDB, NDB), be sure
+ that you have them configured the way you want before starting the
+ server:
- After configuring, edit config.h and include/my_config.h and
- change the line that says this:
-#define HAVE_SNPRINTF 1
+ * If you are using InnoDB tables, see Section 13.6.2, "InnoDB
+ Configuration."
- to this:
-#undef HAVE_SNPRINTF
+ * If you are using MySQL Cluster, see Section 17.3, "MySQL
+ Cluster Configuration."
- And finally, in mysqld.cc, you need to add a prototype for
- initgroups().
-#ifdef _AIX41
-extern "C" int initgroups(const char *,int);
-#endif
+ MySQL Enterprise For expert advice on start-up options appropriate
+ to your circumstances, subscribe to The MySQL Enterprise Monitor.
+ For more information, see
+ http://www.mysql.com/products/enterprise/advisors.html.
- For 32-bit binaries, if you need to allocate a lot of memory to
- the mysqld process, it is not enough to just use ulimit -d
- unlimited. You may also have to modify mysqld_safe to add a line
- something like this:
-export LDR_CNTRL='MAXDATA=0x80000000'
+ Storage engines will use default option values if you specify
+ none, but it is recommended that you review the available options
+ and specify explicit values for those for which the defaults are
+ not appropriate for your installation.
- You can find more information about using a lot of memory at
- http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lr
- g_prg_support.htm.
+ When the mysqld server starts, it changes location to the data
+ directory. This is where it expects to find databases and where it
+ expects to write log files. The server also writes the pid
+ (process ID) file in the data directory.
- Users of AIX 4.3 should use gmake instead of the make utility
- included with AIX.
+ The data directory location is hardwired in when the server is
+ compiled. This is where the server looks for the data directory by
+ default. If the data directory is located somewhere else on your
+ system, the server will not work properly. You can determine what
+ the default path settings are by invoking mysqld with the
+ --verbose and --help options.
- As of AIX 4.1, the C compiler has been unbundled from AIX as a
- separate product. gcc 3.3.2 can be obtained here:
- ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gc
- c/
+ If the default locations don't match the MySQL installation layout
+ on your system, you can override them by specifying options to
+ mysqld or mysqld_safe on the command line or in an option file.
- The steps for compiling MySQL on AIX with gcc 3.3.2 are similar to
- those for using gcc 2.95 (in particular, the need to edit config.h
- and my_config.h after running configure). However, before running
- configure, you should also patch the curses.h file as follows:
-/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/curses
-.h.ORIG
- Mon Dec 26 02:17:28 2005
---- /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/cu
-rses.h
-Mon Dec 26 02:40:13 2005
-***************
-*** 2023,2029 ****
+ To specify the location of the data directory explicitly, use the
+ --datadir option. However, normally you can tell mysqld the
+ location of the base directory under which MySQL is installed and
+ it looks for the data directory there. You can do this with the
+ --basedir option.
+
+ To check the effect of specifying path options, invoke mysqld with
+ those options followed by the --verbose and --help options. For
+ example, if you change location into the directory where mysqld is
+ installed and then run the following command, it shows the effect
+ of starting the server with a base directory of /usr/local:
+shell> ./mysqld --basedir=/usr/local --verbose --help
+ You can specify other options such as --datadir as well, but
+ --verbose and --help must be the last options.
- #endif /* _AIX32_CURSES */
-! #if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || de
-fined
-(__STRICT_ANSI__)
- extern int delwin (WINDOW *);
- extern int endwin (void);
- extern int getcurx (WINDOW *);
---- 2023,2029 ----
+ Once you determine the path settings you want, start the server
+ without --verbose and --help.
+ If mysqld is currently running, you can find out what path
+ settings it is using by executing this command:
+shell> mysqladmin variables
- #endif /* _AIX32_CURSES */
-! #if 0 && (defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus)
-|| defined
-(__STRICT_ANSI__))
- extern int delwin (WINDOW *);
- extern int endwin (void);
- extern int getcurx (WINDOW *);
+ Or:
+shell> mysqladmin -h host_name variables
-2.13.5.4. SunOS 4 Notes
+ host_name is the name of the MySQL server host.
- On SunOS 4, MIT-pthreads is needed to compile MySQL. This in turn
- means you need GNU make.
+ If you get Errcode 13 (which means Permission denied) when
+ starting mysqld, this means that the privileges of the data
+ directory or its contents do not allow the server access. In this
+ case, you change the permissions for the involved files and
+ directories so that the server has the right to use them. You can
+ also start the server as root, but this raises security issues and
+ should be avoided.
- Some SunOS 4 systems have problems with dynamic libraries and
- libtool. You can use the following configure line to avoid this
- problem:
-./configure --disable-shared --with-mysqld-ldflags=-all-static
-
- When compiling readline, you may get warnings about duplicate
- defines. These can be ignored.
-
- When compiling mysqld, there are some implicit declaration of
- function warnings. These can be ignored.
-
-2.13.5.5. Alpha-DEC-UNIX Notes (Tru64)
-
- If you are using egcs 1.1.2 on Digital Unix, you should upgrade to
- gcc 2.95.2, because egcs on DEC has some serious bugs!
-
- When compiling threaded programs under Digital Unix, the
- documentation recommends using the -pthread option for cc and cxx
- and the -lmach -lexc libraries (in addition to -lpthread). You
- should run configure something like this:
-CC="cc -pthread" CXX="cxx -pthread -O" \
-./configure --with-named-thread-libs="-lpthread -lmach -lexc -lc"
-
- When compiling mysqld, you may see a couple of warnings like this:
-mysqld.cc: In function void handle_connections()':
-mysqld.cc:626: passing long unsigned int *' as argument 3 of
-accept(int,sockadddr *, int *)'
-
- You can safely ignore these warnings. They occur because configure
- can detect only errors, not warnings.
-
- If you start the server directly from the command line, you may
- have problems with it dying when you log out. (When you log out,
- your outstanding processes receive a SIGHUP signal.) If so, try
- starting the server like this:
-nohup mysqld [options] &
-
- nohup causes the command following it to ignore any SIGHUP signal
- sent from the terminal. Alternatively, start the server by running
- mysqld_safe, which invokes mysqld using nohup for you. See Section
- 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
-
- If you get a problem when compiling mysys/get_opt.c, just remove
- the #define _NO_PROTO line from the start of that file.
-
- If you are using Compaq's CC compiler, the following configure
- line should work:
-CC="cc -pthread"
-CFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all -arch host"
-CXX="cxx -pthread"
-CXXFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all -arch host -noexceptions -nortti"
-export CC CFLAGS CXX CXXFLAGS
-./configure \
- --prefix=/usr/local/mysql \
- --with-low-memory \
- --enable-large-files \
- --enable-shared=yes \
- --with-named-thread-libs="-lpthread -lmach -lexc -lc"
-gnumake
-
- If you get a problem with libtool when compiling with shared
- libraries as just shown, when linking mysql, you should be able to
- get around this by issuing these commands:
-cd mysql
-/bin/sh ../libtool --mode=link cxx -pthread -O3 -DDBUG_OFF \
- -O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all \ -arch host -DUNDEF_HAVE_GETHOSTBYNAME_R \
- -o mysql mysql.o readline.o sql_string.o completion_hash.o \
- ../readline/libreadline.a -lcurses \
- ../libmysql/.libs/libmysqlclient.so -lm
-cd ..
-gnumake
-gnumake install
-scripts/mysql_install_db
-
-2.13.5.6. Alpha-DEC-OSF/1 Notes
-
- If you have problems compiling and have DEC CC and gcc installed,
- try running configure like this:
-CC=cc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 \
-./configure --prefix=/usr/local/mysql
-
- If you get problems with the c_asm.h file, you can create and use
- a 'dummy' c_asm.h file with:
-touch include/c_asm.h
-CC=gcc CFLAGS=-I./include \
-CXX=gcc CXXFLAGS=-O3 \
-./configure --prefix=/usr/local/mysql
-
- Note that the following problems with the ld program can be fixed
- by downloading the latest DEC (Compaq) patch kit from:
- http://ftp.support.compaq.com/public/unix/.
-
- On OSF/1 V4.0D and compiler "DEC C V5.6-071 on Digital Unix V4.0
- (Rev. 878)," the compiler had some strange behavior (undefined asm
- symbols). /bin/ld also appears to be broken (problems with _exit
- undefined errors occurring while linking mysqld). On this system,
- we have managed to compile MySQL with the following configure
- line, after replacing /bin/ld with the version from OSF 4.0C:
-CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql
-
- With the Digital compiler "C++ V6.1-029," the following should
- work:
-CC=cc -pthread
-CFLAGS=-O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all -arch host
-CXX=cxx -pthread
-CXXFLAGS=-O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all -arch host -noexceptions -nortti
-export CC CFLAGS CXX CXXFLAGS
-./configure --prefix=/usr/mysql/mysql \
- --with-mysqld-ldflags=-all-static --disable-shared \
- --with-named-thread-libs="-lmach -lexc -lc"
-
- In some versions of OSF/1, the alloca() function is broken. Fix
- this by removing the line in config.h that defines 'HAVE_ALLOCA'.
-
- The alloca() function also may have an incorrect prototype in
- /usr/include/alloca.h. This warning resulting from this can be
- ignored.
+ On Unix, change location into the data directory and check the
+ ownership of the data directory and its contents to make sure the
+ server has access. For example, if the data directory is
+ /usr/local/mysql/var, use this command:
+shell> ls -la /usr/local/mysql/var
- configure uses the following thread libraries automatically:
- --with-named-thread-libs="-lpthread -lmach -lexc -lc".
+ If the data directory or its files or subdirectories are not owned
+ by the login account that you use for running the server, change
+ their ownership to that account. If the account is named mysql,
+ use these commands:
+shell> chown -R mysql /usr/local/mysql/var
+shell> chgrp -R mysql /usr/local/mysql/var
- When using gcc, you can also try running configure like this:
-CFLAGS=-D_PTHREAD_USE_D4 CXX=gcc CXXFLAGS=-O3 ./configure ...
+ If it possible that even with correct ownership, MySQL may fail to
+ start up if there is other security software running on your
+ system that manages application access to various parts of the
+ file system. In this case, you may need to reconfigure that
+ software to enable mysqld to access the directories it uses during
+ normal operation.
- If you have problems with signals (MySQL dies unexpectedly under
- high load), you may have found an OS bug with threads and signals.
- In this case, you can tell MySQL not to use signals by configuring
- with:
-CFLAGS=-DDONT_USE_THR_ALARM \
-CXXFLAGS=-DDONT_USE_THR_ALARM \
-./configure ...
+ If the server fails to start up correctly, check the error log.
+ Log files are located in the data directory (typically C:\Program
+ Files\MySQL\MySQL Server 5.1\data on Windows,
+ /usr/local/mysql/data for a Unix binary distribution, and
+ /usr/local/var for a Unix source distribution). Look in the data
+ directory for files with names of the form host_name.err and
+ host_name.log, where host_name is the name of your server host.
+ Then examine the last few lines of these files. On Unix, you can
+ use tail to display them:
+shell> tail host_name.err
+shell> tail host_name.log
- This does not affect the performance of MySQL, but has the side
- effect that you can't kill clients that are "sleeping" on a
- connection with mysqladmin kill or mysqladmin shutdown. Instead,
- the client dies when it issues its next command.
+ The error log should contain information that indicates why the
+ server couldn't start.
+
+ If either of the following errors occur, it means that some other
+ program (perhaps another mysqld server) is using the TCP/IP port
+ or Unix socket file that mysqld is trying to use:
+Can't start server: Bind on TCP/IP port: Address already in use
+Can't start server: Bind on unix socket...
- With gcc 2.95.2, you may encounter the following compile error:
-sql_acl.cc:1456: Internal compiler error in `scan_region',
-at except.c:2566
-Please submit a full bug report.
-
- To fix this, you should change to the sql directory and do a
- cut-and-paste of the last gcc line, but change -O3 to -O0 (or add
- -O0 immediately after gcc if you don't have any -O option on your
- compile line). After this is done, you can just change back to the
- top-level directory and run make again.
-
-2.13.5.7. SGI Irix Notes
-
- As of MySQL 5.0, we don't provide binaries for Irix any more.
-
- If you are using Irix 6.5.3 or newer, mysqld is able to create
- threads only if you run it as a user that has CAP_SCHED_MGT
- privileges (such as root) or give the mysqld server this privilege
- with the following shell command:
-chcap "CAP_SCHED_MGT+epi" /opt/mysql/libexec/mysqld
-
- You may have to undefine some symbols in config.h after running
- configure and before compiling.
-
- In some Irix implementations, the alloca() function is broken. If
- the mysqld server dies on some SELECT statements, remove the lines
- from config.h that define HAVE_ALLOC and HAVE_ALLOCA_H. If
- mysqladmin create doesn't work, remove the line from config.h that
- defines HAVE_READDIR_R. You may have to remove the HAVE_TERM_H
- line as well.
-
- SGI recommends that you install all the patches on this page as a
- set:
- http://support.sgi.com/surfzone/patches/patchset/6.2_indigo.rps.ht
- ml
-
- At the very minimum, you should install the latest kernel rollup,
- the latest rld rollup, and the latest libc rollup.
-
- You definitely need all the POSIX patches on this page, for
- pthreads support:
-
- http://support.sgi.com/surfzone/patches/patchset/6.2_posix.rps.htm
- l
-
- If you get the something like the following error when compiling
- mysql.cc:
-"/usr/include/curses.h", line 82: error(1084):
-invalid combination of type
-
- Type the following in the top-level directory of your MySQL source
- tree:
-extra/replace bool curses_bool < /usr/include/curses.h > include/curs
-es.h
-make
-
- There have also been reports of scheduling problems. If only one
- thread is running, performance is slow. Avoid this by starting
- another client. This may lead to a two-to-tenfold increase in
- execution speed thereafter for the other thread. This is a poorly
- understood problem with Irix threads; you may have to improvise to
- find solutions until this can be fixed.
+ Use ps to determine whether you have another mysqld server
+ running. If so, shut down the server before starting mysqld again.
+ (If another server is running, and you really want to run multiple
+ servers, you can find information about how to do so in Section
+ 5.6, "Running Multiple MySQL Servers on the Same Machine.")
- If you are compiling with gcc, you can use the following configure
- command:
-CC=gcc CXX=gcc CXXFLAGS=-O3 \
-./configure --prefix=/usr/local/mysql --enable-thread-safe-client \
- --with-named-thread-libs=-lpthread
-
- On Irix 6.5.11 with native Irix C and C++ compilers ver. 7.3.1.2,
- the following is reported to work
-CC=cc CXX=CC CFLAGS='-O3 -n32 -TARG:platform=IP22 -I/usr/local/includ
-e \
--L/usr/local/lib' CXXFLAGS='-O3 -n32 -TARG:platform=IP22 \
--I/usr/local/include -L/usr/local/lib' \
-./configure --prefix=/usr/local/mysql --with-innodb \
- --with-libwrap=/usr/local \
- --with-named-curses-libs=/usr/local/lib/libncurses.a
-
-2.13.5.8. SCO UNIX and OpenServer 5.0.x Notes
-
- The current port is tested only on sco3.2v5.0.5, sco3.2v5.0.6, and
- sco3.2v5.0.7 systems. There has also been progress on a port to
- sco3.2v4.2. Open Server 5.0.8 (Legend) has native threads and
- allows files greater than 2GB. The current maximum file size is
- 2GB.
-
- We have been able to compile MySQL with the following configure
- command on OpenServer with gcc 2.95.3.
-CC=gcc CFLAGS="-D_FILE_OFFSET_BITS=64 -O3" \
-CXX=gcc CXXFLAGS="-D_FILE_OFFSET_BITS=64 -O3" \
-./configure --prefix=/usr/local/mysql \
- --enable-thread-safe-client --with-innodb \
- --with-openssl --with-vio --with-extra-charsets=complex
-
- gcc is available at
- ftp://ftp.sco.com/pub/openserver5/opensrc/gnutools-5.0.7Kj.
-
- This development system requires the OpenServer Execution
- Environment Supplement oss646B on OpenServer 5.0.6 and oss656B and
- The OpenSource libraries found in gwxlibs. All OpenSource tools
- are in the opensrc directory. They are available at
- ftp://ftp.sco.com/pub/openserver5/opensrc/.
-
- Use the latest production release of MySQL.
-
- SCO provides operating system patches at
- ftp://ftp.sco.com/pub/openserver5 for OpenServer 5.0.[0-6] and
- ftp://ftp.sco.com/pub/openserverv5/507 for OpenServer 5.0.7.
-
- SCO provides information about security fixes at
- ftp://ftp.sco.com/pub/security/OpenServer for OpenServer 5.0.x.
-
- The maximum file size on an OpenServer 5.0.x system is 2GB.
-
- The total memory which can be allocated for streams buffers,
- clists, and lock records cannot exceed 60MB on OpenServer 5.0.x.
-
- Streams buffers are allocated in units of 4096 byte pages, clists
- are 70 bytes each, and lock records are 64 bytes each, so:
-(NSTRPAGES x 4096) + (NCLIST x 70) + (MAX_FLCKREC x 64) <= 62914560
-
- Follow this procedure to configure the Database Services option.
- If you are unsure whether an application requires this, see the
- documentation provided with the application.
-
- 1. Log in as root.
-
- 2. Enable the SUDS driver by editing the /etc/conf/sdevice.d/suds
- file. Change the N in the second field to a Y.
-
- 3. Use mkdev aio or the Hardware/Kernel Manager to enable support
- for asynchronous I/O and relink the kernel. To allow users to
- lock down memory for use with this type of I/O, update the
- aiomemlock(F) file. This file should be updated to include the
- names of users that can use AIO and the maximum amounts of
- memory they can lock down.
-
- 4. Many applications use setuid binaries so that you need to
- specify only a single user. See the documentation provided
- with the application to determine whether this is the case for
- your application.
+ If no other server is running, try to execute the command telnet
+ your_host_name tcp_ip_port_number. (The default MySQL port number
+ is 3306.) Then press Enter a couple of times. If you don't get an
+ error message like telnet: Unable to connect to remote host:
+ Connection refused, some other program is using the TCP/IP port
+ that mysqld is trying to use. You'll need to track down what
+ program this is and disable it, or else tell mysqld to listen to a
+ different port with the --port option. In this case, you'll also
+ need to specify the port number for client programs when
+ connecting to the server via TCP/IP.
- After you complete this process, reboot the system to create a new
- kernel incorporating these changes.
+ Another reason the port might be inaccessible is that you have a
+ firewall running that blocks connections to it. If so, modify the
+ firewall settings to allow access to the port.
- By default, the entries in /etc/conf/cf.d/mtune are set as
- follows:
-Value Default Min Max
------ ------- --- ---
-NBUF 0 24 450000
-NHBUF 0 32 524288
-NMPBUF 0 12 512
-MAX_INODE 0 100 64000
-MAX_FILE 0 100 64000
-CTBUFSIZE 128 0 256
-MAX_PROC 0 50 16000
-MAX_REGION 0 500 160000
-NCLIST 170 120 16640
-MAXUP 100 15 16000
-NOFILES 110 60 11000
-NHINODE 128 64 8192
-NAUTOUP 10 0 60
-NGROUPS 8 0 128
-BDFLUSHR 30 1 300
-MAX_FLCKREC 0 50 16000
-PUTBUFSZ 8000 2000 20000
-MAXSLICE 100 25 100
-ULIMIT 4194303 2048 4194303
-* Streams Parameters
-NSTREAM 64 1 32768
-NSTRPUSH 9 9 9
-NMUXLINK 192 1 4096
-STRMSGSZ 16384 4096 524288
-STRCTLSZ 1024 1024 1024
-STRMAXBLK 524288 4096 524288
-NSTRPAGES 500 0 8000
-STRSPLITFRAC 80 50 100
-NLOG 3 3 3
-NUMSP 64 1 256
-NUMTIM 16 1 8192
-NUMTRW 16 1 8192
-* Semaphore Parameters
-SEMMAP 10 10 8192
-SEMMNI 10 10 8192
-SEMMNS 60 60 8192
-SEMMNU 30 10 8192
-SEMMSL 25 25 150
-SEMOPM 10 10 1024
-SEMUME 10 10 25
-SEMVMX 32767 32767 32767
-SEMAEM 16384 16384 16384
-* Shared Memory Parameters
-SHMMAX 524288 131072 2147483647
-SHMMIN 1 1 1
-SHMMNI 100 100 2000
-FILE 0 100 64000
-NMOUNT 0 4 256
-NPROC 0 50 16000
-NREGION 0 500 160000
-
- Set these values as follows:
-
- * NOFILES should be 4096 or 2048.
-
- * MAXUP should be 2048.
-
- To make changes to the kernel, use the idtune name parameter
- command. idtune modifies the /etc/conf/cf.d/stune file for you.
- For example, to change SEMMS to 200, execute this command as root:
-# /etc/conf/bin/idtune SEMMNS 200
-
- Then rebuild and reboot the kernel by issuing this command:
-# /etc/conf/bin/idbuild -B && init 6
-
- To tune the system, the proper parameter values to use depend on
- the number of users accessing the application or database and size
- the of the database (that is, the used buffer pool). The following
- kernel parameters can be set with idtune:
-
- * SHMMAX (recommended setting: 128MB) and SHMSEG (recommended
- setting: 15). These parameters have an influence on the MySQL
- database engine to create user buffer pools.
-
- * NOFILES and MAXUP should be set to at least 2048.
-
- * MAXPROC should be set to at least 3000/4000 (depends on number
- of users) or more.
-
- * The following formulas are recommended to calculate values for
- SEMMSL, SEMMNS, and SEMMNU:
-SEMMSL = 13
- 13 is what has been found to be the best for both Progress and
- MySQL.
-SEMMNS = SEMMSL x number of db servers to be run on the system
- Set SEMMNS to the value of SEMMSL multiplied by the number of
- database servers (maximum) that you are running on the system
- at one time.
-SEMMNU = SEMMNS
- Set the value of SEMMNU to equal the value of SEMMNS. You
- could probably set this to 75% of SEMMNS, but this is a
- conservative estimate.
-
- You need to at least install the SCO OpenServer Linker and
- Application Development Libraries or the OpenServer Development
- System to use gcc. You cannot use the GCC Dev system without
- installing one of these.
-
- You should get the FSU Pthreads package and install it first. This
- can be found at
- http://moss.csc.ncsu.edu/~mueller/ftp/pub/PART/pthreads.tar.gz.
- You can also get a precompiled package from
- ftp://ftp.zenez.com/pub/zenez/prgms/FSU-threads-3.14.tar.gz.
-
- FSU Pthreads can be compiled with SCO Unix 4.2 with tcpip, or
- using OpenServer 3.0 or Open Desktop 3.0 (OS 3.0 ODT 3.0) with the
- SCO Development System installed using a good port of GCC 2.5.x.
- For ODT or OS 3.0, you need a good port of GCC 2.5.x. There are a
- lot of problems without a good port. The port for this product
- requires the SCO Unix Development system. Without it, you are
- missing the libraries and the linker that is needed. You also need
- SCO-3.2v4.2-includes.tar.gz. This file contains the changes to the
- SCO Development include files that are needed to get MySQL to
- build. You need to replace the existing system include files with
- these modified header files. They can be obtained from
- ftp://ftp.zenez.com/pub/zenez/prgms/SCO-3.2v4.2-includes.tar.gz.
-
- To build FSU Pthreads on your system, all you should need to do is
- run GNU make. The Makefile in FSU-threads-3.14.tar.gz is set up to
- make FSU-threads.
-
- You can run ./configure in the threads/src directory and select
- the SCO OpenServer option. This command copies Makefile.SCO5 to
- Makefile. Then run make.
+ If the server starts but you can't connect to it, you should make
+ sure that you have an entry in /etc/hosts that looks like this:
+127.0.0.1 localhost
- To install in the default /usr/include directory, log in as root,
- and then cd to the thread/src directory and run make install.
+ This problem occurs only on systems that do not have a working
+ thread library and for which MySQL must be configured to use
+ MIT-pthreads.
- Remember that you must use GNU make to build MySQL.
+ If you cannot get mysqld to start, you can try to make a trace
+ file to find the problem by using the --debug option. See MySQL
+ Internals: Porting
+ (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
-Note
+2.13.2. Securing the Initial MySQL Accounts
- If you don't start mysqld_safe as root, you should get only the
- default 110 open files per process. mysqld writes a note about
- this in the log file.
+ Part of the MySQL installation process is to set up the mysql
+ database that contains the grant tables:
+
+ * Windows distributions contain preinitialized grant tables that
+ are installed automatically.
- With SCO 3.2V4.2, you should use FSU Pthreads version 3.14 or
- newer. The following configure command should work:
-CFLAGS="-D_XOPEN_XPG4" CXX=gcc CXXFLAGS="-D_XOPEN_XPG4" \
-./configure \
- --prefix=/usr/local/mysql \
- --with-named-thread-libs="-lgthreads -lsocket -lgen -lgthreads" \
- --with-named-curses-libs="-lcurses"
+ * On Unix, the grant tables are populated by the
+ mysql_install_db program. Some installation methods run this
+ program for you. Others require that you execute it manually.
+ For details, see Section 2.13.1, "Unix Post-Installation
+ Procedures."
- You may have problems with some include files. In this case, you
- can find new SCO-specific include files at
- ftp://ftp.zenez.com/pub/zenez/prgms/SCO-3.2v4.2-includes.tar.gz.
+ The grant tables define the initial MySQL user accounts and their
+ access privileges. These accounts are set up as follows:
- You should unpack this file in the include directory of your MySQL
- source tree.
+ * Accounts with the user name root are created. These are
+ superuser accounts that can do anything. The initial root
+ account passwords are empty, so anyone can connect to the
+ MySQL server as root --- without a password --- and be granted
+ all privileges.
- SCO development notes:
+ + On Windows, one root account is created; this account
+ allows connecting from the local host only. The Windows
+ installer will optionally create an account allowing for
+ connections from any host only if the user selects the
+ Enable root access from remote machines option during
+ installation.
- * MySQL should automatically detect FSU Pthreads and link mysqld
- with -lgthreads -lsocket -lgthreads.
+ + On Unix, both root accounts are for connections from the
+ local host. Connections must be made from the local host
+ by specifying a host name of localhost for one of the
+ accounts, or the actual host name or IP number for the
+ other.
- * The SCO development libraries are re-entrant in FSU Pthreads.
- SCO claims that its library functions are re-entrant, so they
- must be re-entrant with FSU Pthreads. FSU Pthreads on
- OpenServer tries to use the SCO scheme to make re-entrant
- libraries.
+ * Two anonymous-user accounts are created, each with an empty
+ user name. The anonymous accounts have no password, so anyone
+ can use them to connect to the MySQL server.
- * FSU Pthreads (at least the version at ftp://ftp.zenez.com)
- comes linked with GNU malloc. If you encounter problems with
- memory usage, make sure that gmalloc.o is included in
- libgthreads.a and libgthreads.so.
+ + On Windows, one anonymous account is for connections from
+ the local host. It has no global privileges. (Before
+ MySQL 5.1.16, it has all global privileges, just like the
+ root accounts.) The other is for connections from any
+ host and has all privileges for the test database and for
+ other databases with names that start with test.
- * In FSU Pthreads, the following system calls are
- pthreads-aware: read(), write(), getmsg(), connect(),
- accept(), select(), and wait().
+ + On Unix, both anonymous accounts are for connections from
+ the local host. Connections must be made from the local
+ host by specifying a host name of localhost for one of
+ the accounts, or the actual host name or IP number for
+ the other. These accounts have all privileges for the
+ test database and for other databases with names that
+ start with test_.
- * The CSSA-2001-SCO.35.2 (the patch is listed in custom as
- erg711905-dscr_remap security patch (version 2.0.0)) breaks
- FSU threads and makes mysqld unstable. You have to remove this
- one if you want to run mysqld on an OpenServer 5.0.6 machine.
+ As noted, none of the initial accounts have passwords. This means
+ that your MySQL installation is unprotected until you do something
+ about it:
- * If you use SCO OpenServer 5, you may need to recompile FSU
- pthreads with -DDRAFT7 in CFLAGS. Otherwise, InnoDB may hang
- at a mysqld startup.
+ * If you want to prevent clients from connecting as anonymous
+ users without a password, you should either assign a password
+ to each anonymous account or else remove the accounts.
- * SCO provides operating system patches at
- ftp://ftp.sco.com/pub/openserver5 for OpenServer 5.0.x.
+ * You should assign a password to each MySQL root account.
- * SCO provides security fixes and libsocket.so.2 at
- ftp://ftp.sco.com/pub/security/OpenServer and
- ftp://ftp.sco.com/pub/security/sse for OpenServer 5.0.x.
+ The following instructions describe how to set up passwords for
+ the initial MySQL accounts, first for the anonymous accounts and
+ then for the root accounts. Replace "newpwd" in the examples with
+ the actual password that you want to use. The instructions also
+ cover how to remove the anonymous accounts, should you prefer not
+ to allow anonymous access at all.
- * Pre-OSR506 security fixes. Also, the telnetd fix at
- ftp://stage.caldera.com/pub/security/openserver/ or
- ftp://stage.caldera.com/pub/security/openserver/CSSA-2001-SCO.
- 10/ as both libsocket.so.2 and libresolv.so.1 with
- instructions for installing on pre-OSR506 systems.
- It is probably a good idea to install these patches before
- trying to compile/use MySQL.
+ You might want to defer setting the passwords until later, so that
+ you don't need to specify them while you perform additional setup
+ or testing. However, be sure to set them before using your
+ installation for production purposes.
- Beginning with Legend/OpenServer 6.0.0, there are native threads
- and no 2GB file size limit.
+ Anonymous Account Password Assignment
-2.13.5.9. SCO OpenServer 6.0.x Notes
+ To assign passwords to the anonymous accounts, connect to the
+ server as root and then use either SET PASSWORD or UPDATE. In
+ either case, be sure to encrypt the password using the PASSWORD()
+ function.
- OpenServer 6 includes these key improvements:
+ To use SET PASSWORD on Windows, do this:
+shell> mysql -u root
+mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
+mysql> SET PASSWORD FOR ''@'%' = PASSWORD('newpwd');
- * Larger file support up to 1 TB
+ To use SET PASSWORD on Unix, do this:
+shell> mysql -u root
+mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
+mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
- * Multiprocessor support increased from 4 to 32 processors
+ In the second SET PASSWORD statement, replace host_name with the
+ name of the server host. This is the name that is specified in the
+ Host column of the non-localhost record for root in the user
+ table. If you don't know what host name this is, issue the
+ following statement before using SET PASSWORD:
+mysql> SELECT Host, User FROM mysql.user;
- * Increased memory support up to 64GB
+ Look for the record that has root in the User column and something
+ other than localhost in the Host column. Then use that Host value
+ in the second SET PASSWORD statement.
- * Extending the power of UnixWare into OpenServer 6
+ Anonymous Account Removal
- * Dramatic performance improvement
+ If you prefer to remove the anonymous accounts instead, do so as
+ follows:
+shell> mysql -u root
+mysql> DROP USER '';
- OpenServer 6.0.0 commands are organized as follows:
+ The DROP statement applies both to Windows and to Unix. On
+ Windows, if you want to remove only the anonymous account that has
+ the same privileges as root, do this instead:
+shell> mysql -u root
+mysql> DROP USER ''@'localhost';
- * /bin is for commands that behave exactly the same as on
- OpenServer 5.0.x.
+ That account allows anonymous access but has full privileges, so
+ removing it improves security.
- * /u95/bin is for commands that have better standards
- conformance, for example Large File System (LFS) support.
+ root Account Password Assignment
- * /udk/bin is for commands that behave the same as on UnixWare
- 7.1.4. The default is for the LFS support.
+ You can assign passwords to the root accounts in several ways. The
+ following discussion demonstrates three methods:
- The following is a guide to setting PATH on OpenServer 6. If the
- user wants the traditional OpenServer 5.0.x then PATH should be
- /bin first. If the user wants LFS support, the path should be
- /u95/bin:/bin. If the user wants UnixWare 7 support first, the
- path would be /udk/bin:/u95/bin:/bin:.
+ * Use the SET PASSWORD statement
- Use the latest production release of MySQL. Should you choose to
- use an older release of MySQL on OpenServer 6.0.x, you must use a
- version of MySQL at least as recent as 3.22.13 to get fixes for
- some portability and OS problems.
+ * Use the mysqladmin command-line client program
- MySQL distribution files with names of the following form are tar
- archives of media are tar archives of media images suitable for
- installation with the SCO Software Manager (/etc/custom) on SCO
- OpenServer 6:
-mysql-PRODUCT-5.1.39-sco-osr6-i686.VOLS.tar
+ * Use the UPDATE statement
- A distribution where PRODUCT is pro-cert is the Commercially
- licensed MySQL Pro Certified server. A distribution where PRODUCT
- is pro-gpl-cert is the MySQL Pro Certified server licensed under
- the terms of the General Public License (GPL).
+ To assign passwords using SET PASSWORD, connect to the server as
+ root and issue SET PASSWORD statements. Be sure to encrypt the
+ password using the PASSWORD() function.
- Select whichever distribution you wish to install and, after
- download, extract the tar archive into an empty directory. For
- example:
-shell> mkdir /tmp/mysql-pro
-shell> cd /tmp/mysql-pro
-shell> tar xf /tmp/mysql-pro-cert-5.1.39-sco-osr6-i686.VOLS.tar
+ For Windows, do this:
+shell> mysql -u root
+mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
+mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');
- Prior to installation, back up your data in accordance with the
- procedures outlined in Section 2.12.1, "Upgrading MySQL."
+ For Unix, do this:
+shell> mysql -u root
+mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
+mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
- Remove any previously installed pkgadd version of MySQL:
-shell> pkginfo mysql 2>&1 > /dev/null && pkgrm mysql
+ In the second SET PASSWORD statement, replace host_name with the
+ name of the server host. This is the same host name that you used
+ when you assigned the anonymous account passwords.
- Install MySQL Pro from media images using the SCO Software
- Manager:
-shell> /etc/custom -p SCO:MySQL -i -z /tmp/mysql-pro
+ If the user table contains an account with User and Host values of
+ 'root' and '127.0.0.1', use an additional SET PASSWORD statement
+ to set that account's password:
+mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
- Alternatively, the SCO Software Manager can be displayed
- graphically by clicking on the Software Manager icon on the
- desktop, selecting Software -> Install New, selecting the host,
- selecting Media Images for the Media Device, and entering
- /tmp/mysql-pro as the Image Directory.
+ To assign passwords to the root accounts using mysqladmin, execute
+ the following commands:
+shell> mysqladmin -u root password "newpwd"
+shell> mysqladmin -u root -h host_name password "newpwd"
- After installation, run mkdev mysql as the root user to configure
- your newly installed MySQL Pro Certified server.
+ These commands apply both to Windows and to Unix. In the second
+ command, replace host_name with the name of the server host. The
+ double quotes around the password are not always necessary, but
+ you should use them if the password contains spaces or other
+ characters that are special to your command interpreter.
-Note
+ The mysqladmin method of setting the root account passwords does
+ not set the password for the 'root'@'127.0.0.1' account. To do so,
+ use SET PASSWORD as shown earlier.
- The installation procedure for VOLS packages does not create the
- mysql user and group that the package uses by default. You should
- either create the mysql user and group, or else select a different
- user and group using an option in mkdev mysql.
-
- If you wish to configure your MySQL Pro server to interface with
- the Apache Web server via PHP, download and install the PHP update
- from SCO at
- ftp://ftp.sco.com/pub/updates/OpenServer/SCOSA-2006.17/.
-
- We have been able to compile MySQL with the following configure
- command on OpenServer 6.0.x:
-CC=cc CFLAGS="-D_FILE_OFFSET_BITS=64 -O3" \
-CXX=CC CXXFLAGS="-D_FILE_OFFSET_BITS=64 -O3" \
-./configure --prefix=/usr/local/mysql \
- --enable-thread-safe-client \
- --with-extra-charsets=complex \
- --build=i686-unknown-sysv5SCO_SV6.0.0
-
- If you use gcc, you must use gcc 2.95.3 or newer.
-CC=gcc CXX=g++ ... ./configure ...
-
- SCO provides OpenServer 6 operating system patches at
- ftp://ftp.sco.com/pub/openserver6.
-
- SCO provides information about security fixes at
- ftp://ftp.sco.com/pub/security/OpenServer.
-
- By default, the maximum file size on a OpenServer 6.0.0 system is
- 1TB. Some operating system utilities have a limitation of 2GB. The
- maximum possible file size on UnixWare 7 is 1TB with VXFS or HTFS.
+ You can also use UPDATE to modify the user table directly. The
+ following UPDATE statement assigns a password to all root
+ accounts:
+shell> mysql -u root
+mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
+ -> WHERE User = 'root';
+mysql> FLUSH PRIVILEGES;
- OpenServer 6 can be configured for large file support (file sizes
- greater than 2GB) by tuning the UNIX kernel.
+ The UPDATE statement applies both to Windows and to Unix.
- By default, the entries in /etc/conf/cf.d/mtune are set as
- follows:
-Value Default Min Max
------ ------- --- ---
-SVMMLIM 0x9000000 0x1000000 0x7FFFFFFF
-HVMMLIM 0x9000000 0x1000000 0x7FFFFFFF
-
- To make changes to the kernel, use the idtune name parameter
- command. idtune modifies the /etc/conf/cf.d/stune file for you. To
- set the kernel values, execute the following commands as root:
-# /etc/conf/bin/idtune SDATLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune HDATLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune SVMMLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune HVMMLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune SFNOLIM 2048
-# /etc/conf/bin/idtune HFNOLIM 2048
-
- Then rebuild and reboot the kernel by issuing this command:
-# /etc/conf/bin/idbuild -B && init 6
-
- To tune the system, the proper parameter values to use depend on
- the number of users accessing the application or database and size
- the of the database (that is, the used buffer pool). The following
- kernel parameters can be set with idtune:
-
- * SHMMAX (recommended setting: 128MB) and SHMSEG (recommended
- setting: 15). These parameters have an influence on the MySQL
- database engine to create user buffer pools.
-
- * SFNOLIM and HFNOLIM should be at maximum 2048.
-
- * NPROC should be set to at least 3000/4000 (depends on number
- of users).
-
- * The following formulas are recommended to calculate values for
- SEMMSL, SEMMNS, and SEMMNU:
-SEMMSL = 13
- 13 is what has been found to be the best for both Progress and
- MySQL.
-SEMMNS = SEMMSL x number of db servers to be run on the system
- Set SEMMNS to the value of SEMMSL multiplied by the number of
- database servers (maximum) that you are running on the system
- at one time.
-SEMMNU = SEMMNS
- Set the value of SEMMNU to equal the value of SEMMNS. You
- could probably set this to 75% of SEMMNS, but this is a
- conservative estimate.
-
-2.13.5.10. SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
-
- Use the latest production release of MySQL. Should you choose to
- use an older release of MySQL on UnixWare 7.1.x, you must use a
- version of MySQL at least as recent as 3.22.13 to get fixes for
- some portability and OS problems.
-
- We have been able to compile MySQL with the following configure
- command on UnixWare 7.1.x:
-CC="cc" CFLAGS="-I/usr/local/include" \
-CXX="CC" CXXFLAGS="-I/usr/local/include" \
-./configure --prefix=/usr/local/mysql \
- --enable-thread-safe-client \
- --with-innodb --with-openssl --with-extra-charsets=complex
-
- If you want to use gcc, you must use gcc 2.95.3 or newer.
-CC=gcc CXX=g++ ... ./configure ...
-
- SCO provides operating system patches at
- ftp://ftp.sco.com/pub/unixware7 for UnixWare 7.1.1,
- ftp://ftp.sco.com/pub/unixware7/713/ for UnixWare 7.1.3,
- ftp://ftp.sco.com/pub/unixware7/714/ for UnixWare 7.1.4, and
- ftp://ftp.sco.com/pub/openunix8 for OpenUNIX 8.0.0.
-
- SCO provides information about security fixes at
- ftp://ftp.sco.com/pub/security/OpenUNIX for OpenUNIX and
- ftp://ftp.sco.com/pub/security/UnixWare for UnixWare.
-
- The UnixWare 7 file size limit is 1 TB with VXFS. Some OS
- utilities have a limitation of 2GB.
-
- On UnixWare 7.1.4 you do not need to do anything to get large file
- support, but to enable large file support on prior versions of
- UnixWare 7.1.x, run fsadm.
-# fsadm -Fvxfs -o largefiles /
-# fsadm / * Note
-# ulimit unlimited
-# /etc/conf/bin/idtune SFSZLIM 0x7FFFFFFF ** Note
-# /etc/conf/bin/idtune HFSZLIM 0x7FFFFFFF ** Note
-# /etc/conf/bin/idbuild -B
+ After the passwords have been set, you must supply the appropriate
+ password whenever you connect to the server. For example, if you
+ want to use mysqladmin to shut down the server, you can do so
+ using this command:
+shell> mysqladmin -u root -p shutdown
+Enter password: (enter root password here)
-* This should report "largefiles".
-** 0x7FFFFFFF represents infinity for these values.
+Note
- Reboot the system using shutdown.
+ If you forget your root password after setting it up, Section
+ B.5.4.1, "How to Reset the Root Password," covers the procedure
+ for resetting it.
- By default, the entries in /etc/conf/cf.d/mtune are set as
- follows:
-Value Default Min Max
------ ------- --- ---
-SVMMLIM 0x9000000 0x1000000 0x7FFFFFFF
-HVMMLIM 0x9000000 0x1000000 0x7FFFFFFF
-
- To make changes to the kernel, use the idtune name parameter
- command. idtune modifies the /etc/conf/cf.d/stune file for you. To
- set the kernel values, execute the following commands as root:
-# /etc/conf/bin/idtune SDATLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune HDATLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune SVMMLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune HVMMLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune SFNOLIM 2048
-# /etc/conf/bin/idtune HFNOLIM 2048
-
- Then rebuild and reboot the kernel by issuing this command:
-# /etc/conf/bin/idbuild -B && init 6
-
- To tune the system, the proper parameter values to use depend on
- the number of users accessing the application or database and size
- the of the database (that is, the used buffer pool). The following
- kernel parameters can be set with idtune:
-
- * SHMMAX (recommended setting: 128MB) and SHMSEG (recommended
- setting: 15). These parameters have an influence on the MySQL
- database engine to create user buffer pools.
-
- * SFNOLIM and HFNOLIM should be at maximum 2048.
-
- * NPROC should be set to at least 3000/4000 (depends on number
- of users).
-
- * The following formulas are recommended to calculate values for
- SEMMSL, SEMMNS, and SEMMNU:
-SEMMSL = 13
- 13 is what has been found to be the best for both Progress and
- MySQL.
-SEMMNS = SEMMSL x number of db servers to be run on the system
- Set SEMMNS to the value of SEMMSL multiplied by the number of
- database servers (maximum) that you are running on the system
- at one time.
-SEMMNU = SEMMNS
- Set the value of SEMMNU to equal the value of SEMMNS. You
- could probably set this to 75% of SEMMNS, but this is a
- conservative estimate.
+ To set up additional accounts, you can use the GRANT statement.
+ For instructions, see Section 5.5.2, "Adding User Accounts."
2.14. Environment Variables
@@ -9003,7 +7980,7 @@ SEMMNU = SEMMNS
PATH Used by the shell to find MySQL programs.
TMPDIR The directory where temporary files are created.
TZ This should be set to your local time zone. See Section
- B.1.4.6, "Time Zone Problems."
+ B.5.4.6, "Time Zone Problems."
UMASK The user-file creation mode when creating files. See note
following table.
UMASK_DIR The user-directory creation mode when creating
@@ -9047,9 +8024,9 @@ SEMMNU = SEMMNS
sections describe how to do this.
Perl support for MySQL must be installed if you want to run the
- MySQL benchmark scripts; see Section 7.1.4, "The MySQL Benchmark
+ MySQL benchmark scripts; see Section 7.1.3, "The MySQL Benchmark
Suite." It is also required for the MySQL Cluster ndb_size.pl
- utility; see Section 17.6.21, "ndb_size.pl --- NDBCLUSTER Size
+ utility; see Section 17.4.21, "ndb_size.pl --- NDBCLUSTER Size
Requirement Estimator."
2.15.1. Installing Perl on Unix
=== modified file 'INSTALL-WIN-SOURCE'
--- a/INSTALL-WIN-SOURCE 2009-09-16 12:03:18 +0000
+++ b/INSTALL-WIN-SOURCE 2009-12-01 07:24:05 +0000
@@ -1,5 +1,5 @@
-2.10.6. Installing MySQL from Source on Windows
+2.5.10. Installing MySQL from Source on Windows
These instructions describe how to build binaries from source for
MySQL 5.1 on Windows. Instructions are provided for building
@@ -15,7 +15,7 @@ Note
to use precompiled binary distributions of MySQL that are built
specifically for optimal performance on Windows by Sun
Microsystems, Inc. Instructions for installing binary
- distributions are available in Section 2.3, "Installing MySQL on
+ distributions are available in Section 2.5, "Installing MySQL on
Windows."
To build MySQL on Windows from source, you must satisfy the
@@ -68,7 +68,7 @@ Note
* 3GB to 5GB of disk space.
- The exact system requirements can be found here:
+ The exact system requirements for Visual Studio can be found here:
http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as
px and
http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx
@@ -81,7 +81,7 @@ Note
* Package a source distribution yourself from the latest Bazaar
developer source tree. For instructions on pulling the latest
- source files, see Section 2.10.3, "Installing from the
+ source files, see Section 2.3.3, "Installing from the
Development Source Tree."
If you find something not working as expected, or you have
@@ -89,7 +89,7 @@ Note
Windows, please send a message to the win32 mailing list. See
Section 1.5.1, "MySQL Mailing Lists."
-2.10.6.1. Building MySQL from Source Using CMake and Visual Studio
+2.5.10.1. Building MySQL from Source Using CMake and Visual Studio
You can build MySQL on Windows by using a combination of cmake and
Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio
@@ -99,7 +99,7 @@ Note
Note
To compile from the source code on Windows you must use the
- standard source distribution (for example, mysql-5.0.45.tar.gz).
+ standard source distribution (for example, mysql-5.1.41.tar.gz).
You build from the same distribution as used to build MySQL on
Unix, Linux and other platforms. Do not use the Windows Source
distributions as they do not contain the necessary configuration
@@ -264,5 +264,5 @@ C:\workdir> copy libmysql\libmysql.def C
C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
After installation, set up and start the server in the same way as
- for binary Windows distributions. See Section 2.3, "Installing
+ for binary Windows distributions. See Section 2.5, "Installing
MySQL on Windows."
=== modified file 'man/comp_err.1'
--- a/man/comp_err.1 2009-09-16 12:03:18 +0000
+++ b/man/comp_err.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBcomp_err\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBCOMP_ERR\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBCOMP_ERR\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -91,7 +91,8 @@ Display a help message and exit\&.
.\}
.\" comp_err: charset option
.\" charset option: comp_err
-\fB\-\-charset=\fR\fB\fIpath\fR\fR\fB, \-C \fR\fB\fIpath\fR\fR
+\fB\-\-charset=\fR\fB\fIpath\fR\fR,
+\fB\-C \fR\fB\fIpath\fR\fR
.sp
The character set directory\&. The default is
\&.\&./sql/share/charsets\&.
@@ -107,7 +108,8 @@ The character set directory\&. The defau
.\}
.\" comp_err: debug option
.\" debug option: comp_err
-\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR\fB, \-# \fR\fB\fIdebug_options\fR\fR
+\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
+\fB\-# \fR\fB\fIdebug_options\fR\fR
.sp
Write a debugging log\&. A typical
\fIdebug_options\fR
@@ -142,7 +144,8 @@ Print some debugging information when th
.\}
.\" comp_err: header_file option
.\" header_file option: comp_err
-\fB\-\-header_file=\fR\fB\fIfile_name\fR\fR\fB, \-H \fR\fB\fIfile_name\fR\fR
+\fB\-\-header_file=\fR\fB\fIfile_name\fR\fR,
+\fB\-H \fR\fB\fIfile_name\fR\fR
.sp
The name of the error header file\&. The default is
mysqld_error\&.h\&.
@@ -158,7 +161,8 @@ mysqld_error\&.h\&.
.\}
.\" comp_err: in_file option
.\" in_file option: comp_err
-\fB\-\-in_file=\fR\fB\fIfile_name\fR\fR\fB, \-F \fR\fB\fIfile_name\fR\fR
+\fB\-\-in_file=\fR\fB\fIfile_name\fR\fR,
+\fB\-F \fR\fB\fIfile_name\fR\fR
.sp
The name of the input file\&. The default is
\&.\&./sql/share/errmsg\&.txt\&.
@@ -174,7 +178,8 @@ The name of the input file\&. The defaul
.\}
.\" comp_err: name_file option
.\" name_file option: comp_err
-\fB\-\-name_file=\fR\fB\fIfile_name\fR\fR\fB, \-N \fR\fB\fIfile_name\fR\fR
+\fB\-\-name_file=\fR\fB\fIfile_name\fR\fR,
+\fB\-N \fR\fB\fIfile_name\fR\fR
.sp
The name of the error name file\&. The default is
mysqld_ername\&.h\&.
@@ -190,7 +195,8 @@ mysqld_ername\&.h\&.
.\}
.\" comp_err: out_dir option
.\" out_dir option: comp_err
-\fB\-\-out_dir=\fR\fB\fIpath\fR\fR\fB, \-D \fR\fB\fIpath\fR\fR
+\fB\-\-out_dir=\fR\fB\fIpath\fR\fR,
+\fB\-D \fR\fB\fIpath\fR\fR
.sp
The name of the output base directory\&. The default is
\&.\&./sql/share/\&.
@@ -206,7 +212,8 @@ The name of the output base directory\&.
.\}
.\" comp_err: out_file option
.\" out_file option: comp_err
-\fB\-\-out_file=\fR\fB\fIfile_name\fR\fR\fB, \-O \fR\fB\fIfile_name\fR\fR
+\fB\-\-out_file=\fR\fB\fIfile_name\fR\fR,
+\fB\-O \fR\fB\fIfile_name\fR\fR
.sp
The name of the output file\&. The default is
errmsg\&.sys\&.
@@ -222,7 +229,8 @@ errmsg\&.sys\&.
.\}
.\" comp_err: statefile option
.\" statefile option: comp_err
-\fB\-\-statefile=\fR\fB\fIfile_name\fR\fR\fB, \-S \fR\fB\fIfile_name\fR\fR
+\fB\-\-statefile=\fR\fB\fIfile_name\fR\fR,
+\fB\-S \fR\fB\fIfile_name\fR\fR
.sp
The name for the SQLSTATE header file\&. The default is
sql_state\&.h\&.
=== modified file 'man/innochecksum.1'
--- a/man/innochecksum.1 2009-09-16 12:03:18 +0000
+++ b/man/innochecksum.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBinnochecksum\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBINNOCHECKSUM\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBINNOCHECKSUM\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -29,7 +29,20 @@ innochecksum \- offline InnoDB file chec
\fBinnochecksum\fR
prints checksums for
InnoDB
-files\&.
+files\&. This tool reads an
+InnoDB
+tablespace file, calculates the checksum for each page, compares the calculated checksum to the stored checksum, and reports mismatches, which indicate damaged pages\&. It was originally developed to speed up verifying the integrity of tablespace files after power outages but can also be used after file copies\&. Because checksum mismatches will cause
+InnoDB
+to deliberately shut down a running server, it can be preferable to use this tool rather than waiting for a server in production usage to encounter the damaged pages\&.
+.PP
+\fBinnochecksum\fR
+cannot be used on tablespace files that the server already has open\&. For such files, you should use
+CHECK TABLE
+to check tables within the tablespace\&.
+.PP
+If checksum mismatches are found, you would normally restore the tablespace from backup or start the server and attempt to use
+\fBmysqldump\fR
+to make a backup of the tables within the tablespace\&.
.PP
Invoke
\fBinnochecksum\fR
=== modified file 'man/make_win_bin_dist.1'
--- a/man/make_win_bin_dist.1 2009-09-16 12:03:18 +0000
+++ b/man/make_win_bin_dist.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmake_win_bin_dist\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMAKE_WIN_BIN_DIST" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMAKE_WIN_BIN_DIST" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/msql2mysql.1'
--- a/man/msql2mysql.1 2009-09-16 12:03:18 +0000
+++ b/man/msql2mysql.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmsql2mysql\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMSQL2MYSQL\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMSQL2MYSQL\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/my_print_defaults.1'
--- a/man/my_print_defaults.1 2009-09-16 12:03:18 +0000
+++ b/man/my_print_defaults.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmy_print_defaults\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMY_PRINT_DEFAULTS" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMY_PRINT_DEFAULTS" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -100,7 +100,8 @@ Read only the given option file\&.
.\}
.\" my_print_defaults: debug option
.\" debug option: my_print_defaults
-\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR\fB, \-# \fR\fB\fIdebug_options\fR\fR
+\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
+\fB\-# \fR\fB\fIdebug_options\fR\fR
.sp
Write a debugging log\&. A typical
\fIdebug_options\fR
=== modified file 'man/myisam_ftdump.1'
--- a/man/myisam_ftdump.1 2009-09-16 12:03:18 +0000
+++ b/man/myisam_ftdump.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmyisam_ftdump\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYISAM_FTDUMP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYISAM_FTDUMP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/myisamchk.1'
--- a/man/myisamchk.1 2009-09-16 12:03:18 +0000
+++ b/man/myisamchk.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmyisamchk\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYISAMCHK\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYISAMCHK\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -275,7 +275,8 @@ Display a help message and exit\&. Optio
.\}
.\" myisamchk: debug option
.\" debug option: myisamchk
-\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR\fB, \-# \fR\fB\fIdebug_options\fR\fR
+\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
+\fB\-# \fR\fB\fIdebug_options\fR\fR
.sp
Write a debugging log\&. A typical
\fIdebug_options\fR
@@ -520,7 +521,7 @@ system variable\&. For more information,
myisam_stats_method
in
Section\ \&5.1.4, \(lqServer System Variables\(rq, and
-Section\ \&7.4.6, \(lqMyISAM Index Statistics Collection\(rq\&. For MySQL 5\&.1,
+Section\ \&7.4.7, \(lqMyISAM Index Statistics Collection\(rq\&. For MySQL 5\&.1,
stats_method
was added in MySQL 5\&.0\&.14\&. For older versions, the statistics collection method is equivalent to
nulls_equal\&.
@@ -662,6 +663,9 @@ If you are using
and have plenty of memory, setting the
key_buffer_size
variable to a large value helps the repair operation run faster\&.
+.sp
+For a description of the output format, see
+the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&.
.RE
.sp
.RS 4
@@ -782,7 +786,11 @@ server is using the table and you are ru
.\" files: repairing
.PP
\fBmyisamchk\fR
-supports the following options for table repair operations:
+supports the following options for table repair operations (operations performed when an option such as
+\fB\-\-recover\fR
+or
+\fB\-\-safe\-recover\fR
+is given):
.sp
.RS 4
.ie n \{\
@@ -844,7 +852,8 @@ Correct the checksum information for the
.\}
.\" myisamchk: data-file-length option
.\" data-file-length option: myisamchk
-\fB\-\-data\-file\-length=\fR\fB\fIlen\fR\fR\fB, \-D \fR\fB\fIlen\fR\fR
+\fB\-\-data\-file\-length=\fR\fB\fIlen\fR\fR,
+\fB\-D \fR\fB\fIlen\fR\fR
.sp
The maximum length of the data file (when re\-creating data file when it is
\(lqfull\(rq)\&.
@@ -864,6 +873,9 @@ The maximum length of the data file (whe
\fB\-e\fR
.sp
Do a repair that tries to recover every possible row from the data file\&. Normally, this also finds a lot of garbage rows\&. Do not use this option unless you are desperate\&.
+.sp
+For a description of the output format, see
+the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&.
.RE
.sp
.RS 4
@@ -1172,7 +1184,10 @@ Find the record that a block at the give
\fB\-\-description\fR,
\fB\-d\fR
.sp
-Print some descriptive information about the table\&.
+Print some descriptive information about the table\&. Specifying the
+\fB\-\-verbose\fR
+option once or twice produces additional information\&. See
+the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&.
.RE
.sp
.RS 4
@@ -1243,47 +1258,187 @@ sorts and moves records, it just overwri
\fBmyisamchk\fR
must unpack key blocks first, then re\-create indexes and pack the key blocks again\&. (In this case, re\-creating indexes is faster than updating offsets for each index\&.)
.RE
-.SH "MYISAMCHK MEMORY USAGE"
-.\" memory usage: myisamchk
+.SH "MYISAMCHK TABLE INFORMATION"
+.\" table description: myisamchk
+.\" tables: information
+.\" examples: myisamchk output
+.\" myisamchk: example output
.PP
-Memory allocation is important when you run
-\fBmyisamchk\fR\&.
+To obtain a description of a
+MyISAM
+table or statistics about it, use the commands shown here\&. The output from these commands is explained later in this section\&.
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBmyisamchk \-d \fR\fB\fItbl_name\fR\fR
+.sp
+Runs
\fBmyisamchk\fR
-uses no more memory than its memory\-related variables are set to\&. If you are going to use
+in
+\(lqdescribe mode\(rq
+to produce a description of your table\&. If you start the MySQL server with external locking disabled,
\fBmyisamchk\fR
-on very large tables, you should first decide how much memory you want it to use\&. The default is to use only about 3MB to perform repairs\&. By using larger values, you can get
+may report an error for a table that is updated while it runs\&. However, because
\fBmyisamchk\fR
-to operate faster\&. For example, if you have more than 32MB RAM, you could use options such as these (in addition to any other options you might specify):
+does not change the table in describe mode, there is no risk of destroying data\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR
+.sp
+Adding
+\fB\-v\fR
+runs
+\fBmyisamchk\fR
+in verbose mode so that it produces more information about the table\&. Adding
+\fB\-v\fR
+a second time produces even more information\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBmyisamchk \-eis \fR\fB\fItbl_name\fR\fR
+.sp
+Shows only the most important information from a table\&. This operation is slow because it must read the entire table\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBmyisamchk \-eiv \fR\fB\fItbl_name\fR\fR
+.sp
+This is like
+\fB\-eis\fR, but tells you what is being done\&.
+.RE
+.PP
+The
+\fItbl_name\fR
+argument can be either the name of a
+MyISAM
+table or the name of its index file, as described in
+\fBmyisamchk\fR(1)\&. Multiple
+\fItbl_name\fR
+arguments can be given\&.
+.PP
+Suppose that a table named
+person
+has the following structure\&. (The
+MAX_ROWS
+table option is included so that in the example output from
+\fBmyisamchk\fR
+shown later, some values are smaller and fit the output format more easily\&.)
.sp
.if n \{\
.RS 4
.\}
.nf
-shell> \fBmyisamchk \-\-sort_buffer_size=16M \-\-key_buffer_size=16M \e\fR
- \fB\-\-read_buffer_size=1M \-\-write_buffer_size=1M \&.\&.\&.\fR
+CREATE TABLE person
+(
+ id INT NOT NULL AUTO_INCREMENT,
+ last_name VARCHAR(20) NOT NULL,
+ first_name VARCHAR(20) NOT NULL,
+ birth DATE,
+ death DATE,
+ PRIMARY KEY (id),
+ INDEX (last_name, first_name),
+ INDEX (birth)
+) MAX_ROWS = 1000000;
.fi
.if n \{\
.RE
.\}
.PP
-Using
-\fB\-\-sort_buffer_size=16M\fR
-should probably be enough for most cases\&.
+Suppose also that the table has these data and index file sizes:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+\-rw\-rw\-\-\-\- 1 mysql mysql 9347072 Aug 19 11:47 person\&.MYD
+\-rw\-rw\-\-\-\- 1 mysql mysql 6066176 Aug 19 11:47 person\&.MYI
+.fi
+.if n \{\
+.RE
+.\}
.PP
-Be aware that
-\fBmyisamchk\fR
-uses temporary files in
-TMPDIR\&. If
-TMPDIR
-points to a memory file system, you may easily get out of memory errors\&. If this happens, run
-\fBmyisamchk\fR
-with the
-\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR
-option to specify some directory located on a file system that has more space\&.
+Example of
+\fBmyisamchk \-dvv\fR
+output:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+MyISAM file: person
+Record format: Packed
+Character set: latin1_swedish_ci (8)
+File\-version: 1
+Creation time: 2009\-08\-19 16:47:41
+Recover time: 2009\-08\-19 16:47:56
+Status: checked,analyzed,optimized keys
+Auto increment key: 1 Last value: 306688
+Data records: 306688 Deleted blocks: 0
+Datafile parts: 306688 Deleted data: 0
+Datafile pointer (bytes): 4 Keyfile pointer (bytes): 3
+Datafile length: 9347072 Keyfile length: 6066176
+Max datafile length: 4294967294 Max keyfile length: 17179868159
+Recordlength: 54
+table description:
+Key Start Len Index Type Rec/key Root Blocksize
+1 2 4 unique long 1 99328 1024
+2 6 20 multip\&. varchar prefix 512 3563520 1024
+ 27 20 varchar 512
+3 48 3 multip\&. uint24 NULL 306688 6065152 1024
+Field Start Length Nullpos Nullbit Type
+1 1 1
+2 2 4 no zeros
+3 6 21 varchar
+4 27 21 varchar
+5 48 3 1 1 no zeros
+6 51 3 1 2 no zeros
+.fi
+.if n \{\
+.RE
+.\}
.PP
-When repairing,
+Explanations for the types of information
\fBmyisamchk\fR
-also needs a lot of disk space:
+produces are given here\&.
+\(lqKeyfile\(rq
+refers to the index file\&.
+\(lqRecord\(rq
+and
+\(lqrow\(rq
+are synonymous, as are
+\(lqfield\(rq
+and
+\(lqcolumn\&.\(rq
+.PP
+The initial part of the table description contains these values:
.sp
.RS 4
.ie n \{\
@@ -1293,9 +1448,11 @@ also needs a lot of disk space:
.sp -1
.IP \(bu 2.3
.\}
-Double the size of the data file (the original file and a copy)\&. This space is not needed if you do a repair with
-\fB\-\-quick\fR; in this case, only the index file is re\-created\&.
-\fIThis space must be available on the same file system as the original data file\fR, as the copy is created in the same directory as the original\&.
+MyISAM file
+.sp
+Name of the
+MyISAM
+(index) file\&.
.RE
.sp
.RS 4
@@ -1306,7 +1463,13 @@ Double the size of the data file (the or
.sp -1
.IP \(bu 2.3
.\}
-Space for the new index file that replaces the old one\&. The old index file is truncated at the start of the repair operation, so you usually ignore this space\&. This space must be available on the same file system as the original data file\&.
+Record format
+.sp
+The format used to store table rows\&. The preceding examples use
+Fixed length\&. Other possible values are
+Compressed
+and
+Packed\&.
.RE
.sp
.RS 4
@@ -1317,30 +1480,964 @@ Space for the new index file that replac
.sp -1
.IP \(bu 2.3
.\}
-When using
-\fB\-\-recover\fR
-or
-\fB\-\-sort\-recover\fR
-(but not when using
-\fB\-\-safe\-recover\fR), you need space for a sort buffer\&. The following formula yields the amount of space required:
+Chararacter set
+.sp
+The table default character set\&.
+.RE
.sp
-.if n \{\
.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
.\}
-.nf
-(\fIlargest_key\fR + \fIrow_pointer_length\fR) \(mu \fInumber_of_rows\fR \(mu 2
-.fi
-.if n \{\
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+File\-version
+.sp
+Version of
+MyISAM
+format\&. Currently always 1\&.
.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
.\}
+Creation time
.sp
-You can check the length of the keys and the
-row_pointer_length
-with
-\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR\&. This space is allocated in the temporary directory (specified by
-TMPDIR
-or
-\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR)\&.
+When the data file was created\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recover time
+.sp
+When the index/data file was last reconstructed\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Status
+.sp
+Table status flags\&. Possible values are
+crashed,
+open,
+changed,
+analyzed,
+optimized keys, and
+sorted index pages\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Auto increment key,
+Last value
+.sp
+The key number associated the table\'s
+AUTO_INCREMENT
+column, and the most recently generated value for this column\&. These fields do not appear if there is no such column\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Data records
+.sp
+The number of rows in the table\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleted blocks
+.sp
+How many deleted blocks still have reserved space\&. You can optimize your table to minimize this space\&. See
+Section\ \&6.4.4, \(lqTable Optimization\(rq\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Datafile parts
+.sp
+For dynamic\-row format, this indicates how many data blocks there are\&. For an optimized table without fragmented rows, this is the same as
+Data records\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleted data
+.sp
+How many bytes of unreclaimed deleted data there are\&. You can optimize your table to minimize this space\&. See
+Section\ \&6.4.4, \(lqTable Optimization\(rq\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Datafile pointer
+.sp
+The size of the data file pointer, in bytes\&. It is usually 2, 3, 4, or 5 bytes\&. Most tables manage with 2 bytes, but this cannot be controlled from MySQL yet\&. For fixed tables, this is a row address\&. For dynamic tables, this is a byte address\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Keyfile pointer
+.sp
+The size of the index file pointer, in bytes\&. It is usually 1, 2, or 3 bytes\&. Most tables manage with 2 bytes, but this is calculated automatically by MySQL\&. It is always a block address\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Max datafile length
+.sp
+How long the table data file can become, in bytes\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Max keyfile length
+.sp
+How long the table index file can become, in bytes\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recordlength
+.sp
+How much space each row takes, in bytes\&.
+.RE
+.PP
+The
+table description
+part of the output includes a list of all keys in the table\&. For each key,
+\fBmyisamchk\fR
+displays some low\-level information:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Key
+.sp
+This key\'s number\&. This value is shown only for the first column of the key\&. If this value is missing, the line corresponds to the second or later column of a multiple\-column key\&. For the table shown in the example, there are two
+table description
+lines for the second index\&. This indicates that it is a multiple\-part index with two parts\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Start
+.sp
+Where in the row this portion of the index starts\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Len
+.sp
+How long this portion of the index is\&. For packed numbers, this should always be the full length of the column\&. For strings, it may be shorter than the full length of the indexed column, because you can index a prefix of a string column\&. The total length of a multiple\-part key is the sum of the
+Len
+values for all key parts\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Index
+.sp
+Whether a key value can exist multiple times in the index\&. Possible values are
+unique
+or
+multip\&.
+(multiple)\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Type
+.sp
+What data type this portion of the index has\&. This is a
+MyISAM
+data type with the possible values
+packed,
+stripped, or
+empty\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Root
+.sp
+Address of the root index block\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Blocksize
+.sp
+The size of each index block\&. By default this is 1024, but the value may be changed at compile time when MySQL is built from source\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Rec/key
+.sp
+This is a statistical value used by the optimizer\&. It tells how many rows there are per value for this index\&. A unique index always has a value of 1\&. This may be updated after a table is loaded (or greatly changed) with
+\fBmyisamchk \-a\fR\&. If this is not updated at all, a default value of 30 is given\&.
+.RE
+.PP
+The last part of the output provides information about each column:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Field
+.sp
+The column number\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Start
+.sp
+The byte position of the column within table rows\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Length
+.sp
+The length of the column in bytes\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Nullpos,
+Nullbit
+.sp
+For columns that can be
+NULL,
+MyISAM
+stores
+NULL
+values as a flag in a byte\&. Depending on how many nullable columns there are, there can be one or more bytes used for this purpose\&. The
+Nullpos
+and
+Nullbit
+values, if nonempty, indicate which byte and bit contains that flag indicating whether the column is
+NULL\&.
+.sp
+The position and number of bytes used to store
+NULL
+flags is shown in the line for field 1\&. This is why there are six
+Field
+lines for the
+person
+table even though it has only five columns\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Type
+.sp
+The data type\&. The value may contain any of the following descriptors:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+constant
+.sp
+All rows have the same value\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+no endspace
+.sp
+Do not store endspace\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+no endspace, not_always
+.sp
+Do not store endspace and do not do endspace compression for all values\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+no endspace, no empty
+.sp
+Do not store endspace\&. Do not store empty values\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+table\-lookup
+.sp
+The column was converted to an
+ENUM\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+zerofill(\fIN\fR)
+.sp
+The most significant
+\fIN\fR
+bytes in the value are always 0 and are not stored\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+no zeros
+.sp
+Do not store zeros\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+always zero
+.sp
+Zero values are stored using one bit\&.
+.RE
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Huff tree
+.sp
+The number of the Huffman tree associated with the column\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Bits
+.sp
+The number of bits used in the Huffman tree\&.
+.RE
+.PP
+The
+Huff tree
+and
+Bits
+fields are displayed if the table has been compressed with
+\fBmyisampack\fR\&. See
+\fBmyisampack\fR(1), for an example of this information\&.
+.PP
+Example of
+\fBmyisamchk \-eiv\fR
+output:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Checking MyISAM file: person
+Data records: 306688 Deleted blocks: 0
+\- check file\-size
+\- check record delete\-chain
+No recordlinks
+\- check key delete\-chain
+block_size 1024:
+\- check index reference
+\- check data record references index: 1
+Key: 1: Keyblocks used: 98% Packed: 0% Max levels: 3
+\- check data record references index: 2
+Key: 2: Keyblocks used: 99% Packed: 97% Max levels: 3
+\- check data record references index: 3
+Key: 3: Keyblocks used: 98% Packed: \-14% Max levels: 3
+Total: Keyblocks used: 98% Packed: 89%
+\- check records and index references
+\fI*** LOTS OF ROW NUMBERS DELETED ***\fR
+Records: 306688 M\&.recordlength: 25 Packed: 83%
+Recordspace used: 97% Empty space: 2% Blocks/Record: 1\&.00
+Record blocks: 306688 Delete blocks: 0
+Record data: 7934464 Deleted data: 0
+Lost space: 256512 Linkdata: 1156096
+User time 43\&.08, System time 1\&.68
+Maximum resident set size 0, Integral resident set size 0
+Non\-physical pagefaults 0, Physical pagefaults 0, Swaps 0
+Blocks in 0 out 7, Messages in 0 out 0, Signals 0
+Voluntary context switches 0, Involuntary context switches 0
+Maximum memory usage: 1046926 bytes (1023k)
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fBmyisamchk \-eiv\fR
+output includes the following information:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Data records
+.sp
+The number of rows in the table\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleted blocks
+.sp
+How many deleted blocks still have reserved space\&. You can optimize your table to minimize this space\&. See
+Section\ \&6.4.4, \(lqTable Optimization\(rq\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Key
+.sp
+The key number\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Keyblocks used
+.sp
+What percentage of the keyblocks are used\&. When a table has just been reorganized with
+\fBmyisamchk\fR, the values are very high (very near theoretical maximum)\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Packed
+.sp
+MySQL tries to pack key values that have a common suffix\&. This can only be used for indexes on
+CHAR
+and
+VARCHAR
+columns\&. For long indexed strings that have similar leftmost parts, this can significantly reduce the space used\&. In the preceding example, the second key is 40 bytes long and a 97% reduction in space is achieved\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Max levels
+.sp
+How deep the B\-tree for this key is\&. Large tables with long key values get high values\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Records
+.sp
+How many rows are in the table\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+M\&.recordlength
+.sp
+The average row length\&. This is the exact row length for tables with fixed\-length rows, because all rows have the same length\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Packed
+.sp
+MySQL strips spaces from the end of strings\&. The
+Packed
+value indicates the percentage of savings achieved by doing this\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recordspace used
+.sp
+What percentage of the data file is used\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Empty space
+.sp
+What percentage of the data file is unused\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Blocks/Record
+.sp
+Average number of blocks per row (that is, how many links a fragmented row is composed of)\&. This is always 1\&.0 for fixed\-format tables\&. This value should stay as close to 1\&.0 as possible\&. If it gets too large, you can reorganize the table\&. See
+Section\ \&6.4.4, \(lqTable Optimization\(rq\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recordblocks
+.sp
+How many blocks (links) are used\&. For fixed\-format tables, this is the same as the number of rows\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleteblocks
+.sp
+How many blocks (links) are deleted\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recorddata
+.sp
+How many bytes in the data file are used\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleted data
+.sp
+How many bytes in the data file are deleted (unused)\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Lost space
+.sp
+If a row is updated to a shorter length, some space is lost\&. This is the sum of all such losses, in bytes\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Linkdata
+.sp
+When the dynamic table format is used, row fragments are linked with pointers (4 to 7 bytes each)\&.
+Linkdata
+is the sum of the amount of storage used by all such pointers\&.
+.RE
+.SH "MYISAMCHK MEMORY USAGE"
+.\" memory usage: myisamchk
+.PP
+Memory allocation is important when you run
+\fBmyisamchk\fR\&.
+\fBmyisamchk\fR
+uses no more memory than its memory\-related variables are set to\&. If you are going to use
+\fBmyisamchk\fR
+on very large tables, you should first decide how much memory you want it to use\&. The default is to use only about 3MB to perform repairs\&. By using larger values, you can get
+\fBmyisamchk\fR
+to operate faster\&. For example, if you have more than 32MB RAM, you could use options such as these (in addition to any other options you might specify):
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+shell> \fBmyisamchk \-\-sort_buffer_size=16M \e\fR
+ \fB\-\-key_buffer_size=16M \e\fR
+ \fB\-\-read_buffer_size=1M \e\fR
+ \fB\-\-write_buffer_size=1M \&.\&.\&.\fR
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+Using
+\fB\-\-sort_buffer_size=16M\fR
+should probably be enough for most cases\&.
+.PP
+Be aware that
+\fBmyisamchk\fR
+uses temporary files in
+TMPDIR\&. If
+TMPDIR
+points to a memory file system, out of memory errors can easily occur\&. If this happens, run
+\fBmyisamchk\fR
+with the
+\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR
+option to specify a directory located on a file system that has more space\&.
+.PP
+When performing repair operations,
+\fBmyisamchk\fR
+also needs a lot of disk space:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Twice the size of the data file (the original file and a copy)\&. This space is not needed if you do a repair with
+\fB\-\-quick\fR; in this case, only the index file is re\-created\&.
+\fIThis space must be available on the same file system as the original data file\fR, as the copy is created in the same directory as the original\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Space for the new index file that replaces the old one\&. The old index file is truncated at the start of the repair operation, so you usually ignore this space\&. This space must be available on the same file system as the original data file\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+When using
+\fB\-\-recover\fR
+or
+\fB\-\-sort\-recover\fR
+(but not when using
+\fB\-\-safe\-recover\fR), you need space on disk for sorting\&. This space is allocated in the temporary directory (specified by
+TMPDIR
+or
+\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR)\&. The following formula yields the amount of space required:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+(\fIlargest_key\fR + \fIrow_pointer_length\fR) \(mu \fInumber_of_rows\fR \(mu 2
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+You can check the length of the keys and the
+\fIrow_pointer_length\fR
+with
+\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR
+(see
+the section called \(lqMYISAMCHK TABLE INFORMATION\(rq)\&. The
+\fIrow_pointer_length\fR
+and
+\fInumber_of_rows\fR
+values are the
+Datafile pointer
+and
+Data records
+values in the table description\&. To determine the
+\fIlargest_key\fR
+value, check the
+Key
+lines in the table description\&. The
+Len
+column indicates the number of bytes for each key part\&. For a multiple\-column index, the key size is the sum of the
+Len
+values for all key parts\&.
.RE
.PP
If you have a problem with disk space during repair, you can try
=== modified file 'man/myisamlog.1'
--- a/man/myisamlog.1 2009-09-16 12:03:18 +0000
+++ b/man/myisamlog.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmyisamlog\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYISAMLOG\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYISAMLOG\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/myisampack.1'
--- a/man/myisampack.1 2009-09-16 12:03:18 +0000
+++ b/man/myisampack.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmyisampack\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYISAMPACK\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYISAMPACK\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -652,9 +652,11 @@ After join
The number of distinct Huffman trees left after joining trees to save some header space\&.
.RE
.PP
-After a table has been compressed,
+After a table has been compressed, the
+Field
+lines displayed by
\fBmyisamchk \-dvv\fR
-prints additional information about each column:
+include additional information about each column:
.sp
.RS 4
.ie n \{\
=== modified file 'man/mysql-stress-test.pl.1'
--- a/man/mysql-stress-test.pl.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql-stress-test.pl.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql-stress-test.pl\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/08/2009
+.\" Date: 10/29/2009
.\" Manual: MySQL Database System
.\" Source: MySQL
.\" Language: English
.\"
-.TH "\FBMYSQL\-STRESS\-TE" "1" "08/08/2009" "MySQL" "MySQL Database System"
+.TH "\FBMYSQL\-STRESS\-TE" "1" "10/29/2009" "MySQL" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql-test-run.pl.1'
--- a/man/mysql-test-run.pl.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql-test-run.pl.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql-test-run.pl\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/08/2009
+.\" Date: 10/29/2009
.\" Manual: MySQL Database System
.\" Source: MySQL
.\" Language: English
.\"
-.TH "\FBMYSQL\-TEST\-RUN\" "1" "08/08/2009" "MySQL" "MySQL Database System"
+.TH "\FBMYSQL\-TEST\-RUN\" "1" "10/29/2009" "MySQL" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -700,6 +700,9 @@ Specify a file that contains a list of t
code rather than
[ fail ]
if they fail\&. This option was added in MySQL 5\&.1\&.33/6\&.0\&.11\&.
+.sp
+For an example of a file that might be specified via this option, see
+mysql\-test/collections/default\&.experimental\&.
.RE
.sp
.RS 4
@@ -1132,6 +1135,26 @@ not to generate a timing file\&.
.sp -1
.IP \(bu 2.3
.\}
+.\" mysql-test-run.pl: parallel option
+.\" parallel option: mysql-test-run.pl
+\fB\-\-parallel={\fR\fB\fIN\fR\fR\fB|auto}\fR
+.sp
+Run tests using
+\fIN\fR
+parallel threads\&. By default, 1 thread is used\&. Use
+\fB\-\-parallel=auto\fR
+for auto\-setting of
+\fIN\fR\&. This option was added in MySQL 5\&.1\&.36\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.\" mysql-test-run.pl: ps-protocol option
.\" ps-protocol option: mysql-test-run.pl
\fB\-\-ps\-protocol\fR
=== modified file 'man/mysql.1'
--- a/man/mysql.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -334,8 +334,18 @@ to display result set metadata\&.
.sp
Use
\fIcharset_name\fR
-as the default character set\&. See
-Section\ \&9.2, \(lqThe Character Set Used for Data and Sorting\(rq\&.
+as the default character set for the client and connection\&.
+.sp
+A common issue that can occur when the operating system uses
+utf8
+or another multi\-byte character set is that output from the
+\fBmysql\fR
+client is formatted incorrectly, due to the fact that the MySQL client uses the
+latin1
+character set by default\&. You can usually fix such issues by using this option to force the client to use the system character set instead\&.
+.sp
+See
+Section\ \&9.2, \(lqThe Character Set Used for Data and Sorting\(rq, for more information\&.
.RE
.sp
.RS 4
@@ -648,7 +658,7 @@ PAGER
environment variable\&. Valid pagers are
\fBless\fR,
\fBmore\fR,
-\fBcat [> filename]\fR, and so forth\&. This option works only on Unix\&. It does not work in batch mode\&. To disable paging, use
+\fBcat [> filename]\fR, and so forth\&. This option works only on Unix and only in interactive mode\&. To disable paging, use
\fB\-\-skip\-pager\fR\&.
the section called \(lqMYSQL COMMANDS\(rq, discusses output paging further\&.
.RE
@@ -1026,7 +1036,7 @@ Display output in table format\&. This i
.\" tee option: mysql
\fB\-\-tee=\fR\fB\fIfile_name\fR\fR
.sp
-Append a copy of output to the given file\&. This option does not work in batch mode\&.
+Append a copy of output to the given file\&. This option works only in interactive mode\&.
the section called \(lqMYSQL COMMANDS\(rq, discusses tee files further\&.
.RE
.sp
@@ -1523,7 +1533,7 @@ is set to something other than the defau
\(lq;\(rq, instances of that character are sent to the server without interpretation\&. However, the server itself still interprets
\(lq;\(rq
as a statement delimiter and processes statements accordingly\&. This behavior on the server side comes into play for multiple\-statement execution (see
-Section\ \&21.10.12, \(lqC API Support for Multiple Statement Execution\(rq), and for parsing the body of stored procedures and functions, triggers, and events (see
+Section\ \&21.9.12, \(lqC API Support for Multiple Statement Execution\(rq), and for parsing the body of stored procedures and functions, triggers, and events (see
Section\ \&19.1, \(lqDefining Stored Programs\(rq)\&.
.RE
.sp
@@ -1680,7 +1690,7 @@ option when you invoke
\fBmysql\fR
checks the value of the
PAGER
-environment variable and sets the pager to that\&.
+environment variable and sets the pager to that\&. Pager functionality works only in interactive mode\&.
.sp
Output paging can be enabled interactively with the
\fBpager\fR
@@ -1853,7 +1863,7 @@ By using the
option when you invoke
\fBmysql\fR, you can log statements and their output\&. All the data displayed on the screen is appended into a given file\&. This can be very useful for debugging purposes also\&.
\fBmysql\fR
-flushes results to the file after each statement, just before it prints its next prompt\&.
+flushes results to the file after each statement, just before it prints its next prompt\&. Tee functionality works only in interactive mode\&.
.sp
You can enable this feature interactively with the
\fBtee\fR
@@ -2334,7 +2344,7 @@ prompt=(\e\eu@\e\eh) [\e\ed]>\e\e_
.sp
In this example, note that the backslashes are doubled\&. If you set the prompt using the
prompt
-option in an option file, it is advisable to double the backslashes when using the special prompt options\&. There is some overlap in the set of allowable prompt options and the set of special escape sequences that are recognized in option files\&. (These sequences are listed in
+option in an option file, it is advisable to double the backslashes when using the special prompt options\&. There is some overlap in the set of allowable prompt options and the set of special escape sequences that are recognized in option files\&. (The rules for escape sequences in option files are listed in
Section\ \&4.2.3.3, \(lqUsing Option Files\(rq\&.) The overlap may cause you problems if you use single backslashes\&. For example,
\es
is interpreted as a space rather than as the current seconds value\&. The following example shows how to define a prompt within an option file to include the current time in
@@ -2586,6 +2596,12 @@ SELECT \'<info_to_display>\' AS \' \';
The statement shown outputs
<info_to_display>\&.
.PP
+You can also invoke
+\fBmysql\fR
+with the
+\fB\-\-verbose\fR
+option, which causes each statement to be displayed before the result that it produces\&.
+.PP
As of MySQL 5\&.1\&.23,
\fBmysql\fR
ignores Unicode byte order mark (BOM) characters at the beginning of input files\&. Previously, it read them and sent them to the server, resulting in a syntax error\&. Presence of a BOM does not cause
@@ -2785,7 +2801,7 @@ client with the
option\&.
.PP
For more information about auto\-reconnect and its effect on state information when a reconnection occurs, see
-Section\ \&21.10.11, \(lqControlling Automatic Reconnection Behavior\(rq\&.
+Section\ \&21.9.11, \(lqControlling Automatic Reconnection Behavior\(rq\&.
.SH "COPYRIGHT"
.br
.PP
=== modified file 'man/mysql.server.1'
--- a/man/mysql.server.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql.server.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql.server\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL\&.SERVER\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL\&.SERVER\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -40,7 +40,7 @@ script will be installed in the
/etc/init\&.d
directory with the name
mysql\&. You need not install it manually\&. See
-Section\ \&2.4, \(lqInstalling MySQL from RPM Packages on Linux\(rq, for more information on the Linux RPM packages\&.
+Section\ \&2.6.1, \(lqInstalling MySQL from RPM Packages on Linux\(rq, for more information on the Linux RPM packages\&.
.PP
Some vendors provide RPM packages that install a startup script under a different name such as
\fBmysqld\fR\&.
@@ -48,7 +48,7 @@ Some vendors provide RPM packages that i
If you install MySQL from a source distribution or using a binary distribution format that does not install
\fBmysql\&.server\fR
automatically, you can install it manually\&. Instructions are provided in
-Section\ \&2.11.2.2, \(lqStarting and Stopping MySQL Automatically\(rq\&.
+Section\ \&2.13.1.2, \(lqStarting and Stopping MySQL Automatically\(rq\&.
.PP
\fBmysql\&.server\fR
reads options from the
=== modified file 'man/mysql_client_test.1'
--- a/man/mysql_client_test.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_client_test.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_client_test\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/08/2009
+.\" Date: 10/29/2009
.\" Manual: MySQL Database System
.\" Source: MySQL
.\" Language: English
.\"
-.TH "\FBMYSQL_CLIENT_TEST" "1" "08/08/2009" "MySQL" "MySQL Database System"
+.TH "\FBMYSQL_CLIENT_TEST" "1" "10/29/2009" "MySQL" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_config.1'
--- a/man/mysql_config.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_config.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_config\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_CONFIG\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_CONFIG\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_convert_table_format.1'
--- a/man/mysql_convert_table_format.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_convert_table_format.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_convert_table_format\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_CONVERT_TAB" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_CONVERT_TAB" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_find_rows.1'
--- a/man/mysql_find_rows.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_find_rows.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_find_rows\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_FIND_ROWS\F" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_FIND_ROWS\F" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_fix_extensions.1'
--- a/man/mysql_fix_extensions.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_fix_extensions.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_fix_extensions\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_FIX_EXTENSI" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_FIX_EXTENSI" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_fix_privilege_tables.1'
--- a/man/mysql_fix_privilege_tables.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_fix_privilege_tables.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_fix_privilege_tables\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_FIX_PRIVILE" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_FIX_PRIVILE" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_install_db.1'
--- a/man/mysql_install_db.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_install_db.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_install_db\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_INSTALL_DB\" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_INSTALL_DB\" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -81,7 +81,7 @@ with the
and
\fB\-\-skip\-grant\-tables\fR
options (see
-Section\ \&2.10.2, \(lqTypical configure Options\(rq)\&. If MySQL was configured with the
+Section\ \&2.3.2, \(lqTypical configure Options\(rq)\&. If MySQL was configured with the
\fB\-\-disable\-grant\-options\fR
option,
\fB\-\-bootstrap\fR
=== modified file 'man/mysql_secure_installation.1'
--- a/man/mysql_secure_installation.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_secure_installation.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_secure_installation\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_SECURE_INST" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_SECURE_INST" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_setpermission.1'
--- a/man/mysql_setpermission.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_setpermission.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_setpermission\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_SETPERMISSI" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_SETPERMISSI" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_tzinfo_to_sql.1'
--- a/man/mysql_tzinfo_to_sql.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_tzinfo_to_sql.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_tzinfo_to_sql\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_TZINFO_TO_S" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_TZINFO_TO_S" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_upgrade.1'
--- a/man/mysql_upgrade.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_upgrade.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_upgrade\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_UPGRADE\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_UPGRADE\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -41,7 +41,7 @@ script, which should no longer be used\&
If a table is found to have a possible incompatibility,
\fBmysql_upgrade\fR
performs a table check\&. If any problems are found, a table repair is attempted\&. If the table cannot be repaired, see
-Section\ \&2.12.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
+Section\ \&2.4.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
for manual table repair strategies\&.
.if n \{\
.sp
@@ -59,11 +59,11 @@ for manual table repair strategies\&.
You should always back up your current MySQL installation
\fIbefore\fR
performing an upgrade\&. See
-Section\ \&6.1, \(lqDatabase Backups\(rq\&.
+Section\ \&6.1, \(lqDatabase Backup Methods\(rq\&.
.PP
Some upgrade incompatibilities may require special handling before you upgrade your MySQL installation and run
\fBmysql_upgrade\fR\&. See
-Section\ \&2.12.1, \(lqUpgrading MySQL\(rq, for instructions on determining whether any such incompatibilities apply to your installation and how to handle them\&.
+Section\ \&2.4.1, \(lqUpgrading MySQL\(rq, for instructions on determining whether any such incompatibilities apply to your installation and how to handle them\&.
.sp .5v
.RE
.PP
@@ -189,7 +189,7 @@ If you install MySQL from RPM packages o
\fBmysql_upgrade\fR
is included in the server RPM but requires the client RPM because the latter includes
\fBmysqlcheck\fR\&. (See
-Section\ \&2.4, \(lqInstalling MySQL from RPM Packages on Linux\(rq\&.)
+Section\ \&2.6.1, \(lqInstalling MySQL from RPM Packages on Linux\(rq\&.)
.PP
In MySQL 5\&.1\&.7,
\fBmysql_upgrade \fR
@@ -352,6 +352,26 @@ root\&.
.sp
Verbose mode\&. Print more information about what the program does\&.
.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" mysql_upgrade: write-binlog option
+.\" write-binlog option: mysql_upgrade
+\fB\-\-write\-binlog\fR
+.sp
+Cause binary logging to be enabled while
+\fBmysql_upgrade\fR
+runs\&. This is the default behavior; to disable binary logging during the upgrade, use the inverse of this option (that is, start the program with
+\fB\-\-skip\-write\-binlog\fR)\&.
+.sp
+This option was introduced in MySQL 5\&.1\&.40\&.
+.RE
.SH "COPYRIGHT"
.br
.PP
=== modified file 'man/mysql_waitpid.1'
--- a/man/mysql_waitpid.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_waitpid.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_waitpid\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_WAITPID\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_WAITPID\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_zap.1'
--- a/man/mysql_zap.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_zap.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_zap\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_ZAP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_ZAP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlaccess.1'
--- a/man/mysqlaccess.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlaccess.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlaccess\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLACCESS\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLACCESS\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqladmin.1'
--- a/man/mysqladmin.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqladmin.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqladmin\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLADMIN\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLADMIN\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlbinlog.1'
--- a/man/mysqlbinlog.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlbinlog.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlbinlog\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLBINLOG\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLBINLOG\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -855,7 +855,7 @@ You can pipe the output of
into the
\fBmysql\fR
client to execute the statements contained in the binary log\&. This is used to recover from a crash when you have an old backup (see
-Section\ \&6.1, \(lqDatabase Backups\(rq)\&. For example:
+Section\ \&6.1, \(lqDatabase Backup Methods\(rq)\&. For example:
.sp
.if n \{\
.RS 4
=== modified file 'man/mysqlbug.1'
--- a/man/mysqlbug.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlbug.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlbug\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLBUG\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLBUG\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlcheck.1'
--- a/man/mysqlcheck.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlcheck.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlcheck\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLCHECK\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLCHECK\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -34,7 +34,14 @@ The
\fBmysqlcheck\fR
client performs table maintenance: It checks, repairs, optimizes, or analyzes tables\&.
.PP
-Each table is locked and therefore unavailable to other sessions while it is being processed\&. Table maintenance operations can be time\-consuming, particularly for large tables\&. If you use the
+Each table is locked and therefore unavailable to other sessions while it is being processed, although for check operations, the table is locked with a
+READ
+lock only (see
+Section\ \&12.4.5, \(lqLOCK TABLES and UNLOCK TABLES Syntax\(rq, for more information about
+READ
+and
+WRITE
+locks)\&. Table maintenance operations can be time\-consuming, particularly for large tables\&. If you use the
\fB\-\-databases\fR
or
\fB\-\-all\-databases\fR
@@ -94,7 +101,7 @@ note : The storage engine for the ta
If
\fBmysqlcheck\fR
is unable to repair a table, see
-Section\ \&2.12.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
+Section\ \&2.4.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
for manual table repair strategies\&. This will be the case, for example, for
InnoDB
tables, which can be checked with
=== modified file 'man/mysqld.8'
--- a/man/mysqld.8 2009-09-16 12:03:18 +0000
+++ b/man/mysqld.8 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqld\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLD\FR" "8" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLD\FR" "8" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqld_multi.1'
--- a/man/mysqld_multi.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqld_multi.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqld_multi\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLD_MULTI\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLD_MULTI\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -51,7 +51,7 @@ to specify which servers you want to sta
[mysqld]
group used for starting
\fBmysqld\fR\&. (See, for example,
-Section\ \&2.11.2.2, \(lqStarting and Stopping MySQL Automatically\(rq\&.) However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number\&. For more information on which options must be unique per server in a multiple\-server environment, see
+Section\ \&2.13.1.2, \(lqStarting and Stopping MySQL Automatically\(rq\&.) However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number\&. For more information on which options must be unique per server in a multiple\-server environment, see
Section\ \&5.6, \(lqRunning Multiple MySQL Servers on the Same Machine\(rq\&.
.PP
To invoke
@@ -183,12 +183,6 @@ Otherwise, option files in the standard
option, if one is given\&. (If the option is given multiple times, the last value is used\&.)
.RE
.PP
-Option files read are searched for
-[mysqld_multi]
-and
-[mysqld\fIN\fR]
-option groups\&.
-.PP
Before MySQL 5\&.1\&.18, the preceding options are not recognized\&. Files in the standard locations are read, and any file named by the
\fB\-\-config\-file=\fR\fB\fIfile_name\fR\fR
option, if one is given\&. A file named by
@@ -199,6 +193,39 @@ option groups, not the
[mysqld_multi]
group\&.
.PP
+Option files read are searched for
+[mysqld_multi]
+and
+[mysqld\fIN\fR]
+option groups\&. The
+[mysqld_multi]
+group can be used for options to
+\fBmysqld_multi\fR
+itself\&.
+[mysqld\fIN\fR]
+groups can be used for options passed to specific
+\fBmysqld\fR
+instances\&.
+.PP
+As of MySQL 5\&.1\&.35, the
+[mysqld]
+or
+[mysqld_safe]
+groups can be used for common options read by all instances of
+\fBmysqld\fR
+or
+\fBmysqld_safe\fR\&. You can specify a
+\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR
+option to use a different configuration file for that instance, in which case the
+[mysqld]
+or
+[mysqld_safe]
+groups from that file will be used for that instance\&. Before MySQL 5\&.1\&.35, some versions of
+\fBmysqld_multi\fR
+pass the
+\fB\-\-no\-defaults\fR
+options to instances, so these techniques are inapplicable\&.
+.PP
\fBmysqld_multi\fR
supports the following options:
.sp
=== modified file 'man/mysqld_safe.1'
--- a/man/mysqld_safe.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqld_safe.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqld_safe\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLD_SAFE\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLD_SAFE\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqldump.1'
--- a/man/mysqldump.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqldump.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqldump\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLDUMP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLDUMP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -575,7 +575,7 @@ uses
utf8, and earlier versions use
latin1\&.
.sp
-This option has no effect for output data files produced by using the
+Prior to MySQL 5\&.1\&.38, this option has no effect for output data files produced by using the
\fB\-\-tab\fR
option\&. See the description for that option\&.
.RE
@@ -1232,7 +1232,8 @@ statement for the table\&.
\fB\-\-no\-set\-names\fR
.sp
This option is deprecated\&. Use
-\fB\-\-skip\-set\-charset\fR\&. instead\&.
+\fB\-\-skip\-set\-charset\fR
+instead\&.
.RE
.sp
.RS 4
@@ -1657,11 +1658,11 @@ and
\fB\-\-lines\-terminated\-by\fR
options\&.
.sp
-Column values are dumped using the
-binary
-character set and the
+As of MySQL 5\&.1\&.38, column values are written converted to the character set specified by the
\fB\-\-default\-character\-set\fR
-option is ignored\&. In effect, there is no character set conversion\&. If a table contains columns in several character sets, the output data file will as well and you may not be able to reload the file correctly\&.
+option\&. Prior to 5\&.1\&.38 or if no such option is present, values are dumped using the
+binary
+character set\&. In effect, there is no character set conversion\&. If a table contains columns in several character sets, the output data file will as well and you may not be able to reload the file correctly\&.
.if n \{\
.sp
.\}
@@ -2110,7 +2111,7 @@ InnoDB
storage engine\&.
.PP
For more information on making backups, see
-Section\ \&6.1, \(lqDatabase Backups\(rq, and
+Section\ \&6.1, \(lqDatabase Backup Methods\(rq, and
Section\ \&6.2, \(lqExample Backup and Recovery Strategy\(rq\&.
.\" mysqldump: views
.\" mysqldump: problems
=== modified file 'man/mysqldumpslow.1'
--- a/man/mysqldumpslow.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqldumpslow.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqldumpslow\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLDUMPSLOW\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLDUMPSLOW\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlhotcopy.1'
--- a/man/mysqlhotcopy.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlhotcopy.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlhotcopy\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLHOTCOPY\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLHOTCOPY\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlimport.1'
--- a/man/mysqlimport.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlimport.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlimport\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLIMPORT\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLIMPORT\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlmanager.8'
--- a/man/mysqlmanager.8 2009-09-16 12:03:18 +0000
+++ b/man/mysqlmanager.8 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlmanager\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLMANAGER\FR" "8" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLMANAGER\FR" "8" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -274,7 +274,8 @@ Drop all users from the password file\&.
.\}
.\" mysqlmanager: debug option
.\" debug option: mysqlmanager
-\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR\fB, \-# \fR\fB\fIdebug_options\fR\fR
+\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
+\fB\-# \fR\fB\fIdebug_options\fR\fR
.sp
Write a debugging log\&. A typical
\fIdebug_options\fR
=== modified file 'man/mysqlshow.1'
--- a/man/mysqlshow.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlshow.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlshow\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLSHOW\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLSHOW\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlslap.1'
--- a/man/mysqlslap.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlslap.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlslap\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLSLAP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLSLAP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqltest.1'
--- a/man/mysqltest.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqltest.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqltest\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/08/2009
+.\" Date: 10/29/2009
.\" Manual: MySQL Database System
.\" Source: MySQL
.\" Language: English
.\"
-.TH "\FBMYSQLTEST\FR" "1" "08/08/2009" "MySQL" "MySQL Database System"
+.TH "\FBMYSQLTEST\FR" "1" "10/29/2009" "MySQL" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/ndbd.8'
--- a/man/ndbd.8 2009-09-16 12:03:18 +0000
+++ b/man/ndbd.8 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBndbd\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBNDBD\FR" "8" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBNDBD\FR" "8" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -41,8 +41,9 @@ processes cooperate in handling data\&.
.\" command options (MySQL Cluster): ndbd
.\" MySQL Cluster: ndbd process
.PP
-The following list describes command options specific to the MySQL Cluster data node program
-\fBndbd\fR\&.
+The following table includes command options specific to the MySQL Cluster data node program
+\fBndbd\fR\&. Additional descriptions follow the table\&. For options common to all MySQL Cluster programs, see
+Section\ \&17.4.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&.
.if n \{\
.sp
.\}
@@ -68,7 +69,7 @@ wherever the latter occurs in this secti
For options common to all
NDBCLUSTER
programs, see
-Section\ \&17.6.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&.
+Section\ \&17.4.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&.
.sp
.RS 4
.ie n \{\
@@ -81,9 +82,11 @@ Section\ \&17.6.2, \(lqOptions Common to
\fB\-\-bind\-address\fR
.TS
allbox tab(:);
-l l
-l l
-l l.
+l l s
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBVersion Introduced\fR
T}:T{
@@ -95,28 +98,16 @@ T}:T{
\-\-bind\-address=name
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
string
T}
-T{
+:T{
\fBDefault\fR
T}:T{
T}
@@ -141,36 +132,26 @@ This option was added in MySQL 5\&.1\&.1
\fB\-d\fR
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-\-daemon
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
TRUE
@@ -182,6 +163,12 @@ Instructs
to execute as a daemon process\&. This is the default behavior\&.
\fB\-\-nodaemon\fR
can be used to prevent the process from running as a daemon\&.
+.sp
+This option has no effect when running
+\fBndbd\fR
+or
+\fBndbmtd\fR
+on Windows platforms\&.
.RE
.sp
.RS 4
@@ -197,36 +184,26 @@ can be used to prevent the process from
\fB\-\-initial\fR
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-\-initial
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
@@ -321,9 +298,11 @@ Backup files that have already been crea
.IP \(bu 2.3
.\}
MySQL Cluster Disk Data files (see
-Section\ \&17.10, \(lqMySQL Cluster Disk Data Tables\(rq)\&.
+Section\ \&17.5.9, \(lqMySQL Cluster Disk Data Tables\(rq)\&.
.RE
.RS 4
+.sp
+This option also has no effect on recovery of data by a data node that is just starting (or restarting) from data nodes that are already running\&. This recovery of data occurs automatically, and requires no user intervention in a MySQL Cluster that is running normally\&.
.sp .5v
.RE
It is permissible to use this option when starting the cluster for the very first time (that is, before any data node files have been created); however, it is
@@ -344,9 +323,11 @@ necessary to do so\&.
\fB\-\-initial\-start\fR
.TS
allbox tab(:);
-l l
-l l
-l l.
+l l s
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBVersion Introduced\fR
T}:T{
@@ -358,28 +339,16 @@ T}:T{
\-\-initial\-start
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
@@ -435,9 +404,11 @@ Prior to MySQL 5\&.1\&.19, it was not po
\fB\-\-nowait\-nodes=\fR\fB\fInode_id_1\fR\fR\fB[, \fR\fB\fInode_id_2\fR\fR\fB[, \&.\&.\&.]]\fR
.TS
allbox tab(:);
-l l
-l l
-l l.
+l l s
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBVersion Introduced\fR
T}:T{
@@ -449,28 +420,16 @@ T}:T{
\-\-nowait\-nodes=list
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
string
T}
-T{
+:T{
\fBDefault\fR
T}:T{
T}
@@ -508,36 +467,26 @@ This option was added in MySQL 5\&.1\&.9
\fB\-\-nodaemon\fR
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-\-nodaemon
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
@@ -549,6 +498,12 @@ Instructs
not to start as a daemon process\&. This is useful when
\fBndbd\fR
is being debugged and you want output to be redirected to the screen\&.
+.sp
+As of MySQL Cluster NDB 7\&.0\&.8, the default behavior for
+\fBndbd\fR
+and
+\fBndbmtd\fR
+on Windows is to run in the foreground, making this option unnecessary on Windows platforms\&. (\m[blue]\fBBug#45588\fR\m[]\&\s-2\u[2]\d\s+2)
.RE
.sp
.RS 4
@@ -567,36 +522,26 @@ is being debugged and you want output to
\fB\-n\fR
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-\-nostart
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
@@ -610,7 +555,7 @@ not to start automatically\&. When this
connects to the management server, obtains configuration data from it, and initializes communication objects\&. However, it does not actually start the execution engine until specifically requested to do so by the management server\&. This can be accomplished by issuing the proper
START
command in the management client (see
-Section\ \&17.7.2, \(lqCommands in the MySQL Cluster Management Client\(rq)\&.
+Section\ \&17.5.2, \(lqCommands in the MySQL Cluster Management Client\(rq)\&.
.RE
.\" MySQL Cluster: log files
.\" log files (MySQL Cluster)
@@ -668,7 +613,7 @@ TraceFile: ndb_2_trace\&.log\&.2
Listings of possible
\fBndbd\fR
exit codes and messages generated when a data node process shuts down prematurely can be found in
-\m[blue]\fBndbd Error Messages\fR\m[]\&\s-2\u[2]\d\s+2\&.
+\m[blue]\fBndbd Error Messages\fR\m[]\&\s-2\u[3]\d\s+2\&.
.if n \{\
.sp
.\}
@@ -784,7 +729,7 @@ shell> \fBndbd \-\-connect\-string="node
.\}
.PP
See
-Section\ \&17.3.4.3, \(lqThe MySQL Cluster Connectstring\(rq, for additional information about this issue\&.
+Section\ \&17.3.2.3, \(lqThe MySQL Cluster Connectstring\(rq, for additional information about this issue\&.
\fBndbd\fR(8), describes other options for
\fBndbd\fR\&.
.PP
@@ -810,7 +755,7 @@ process can consume up to 2 CPUs if perm
For a machine with many CPUs it is possible to use several
\fBndbd\fR
processes which belong to different node groups; however, such a configuration is still considered experimental and is not supported for MySQL 5\&.1 in a production setting\&. See
-Section\ \&17.12, \(lqKnown Limitations of MySQL Cluster\(rq\&.
+Section\ \&17.1.5, \(lqKnown Limitations of MySQL Cluster\(rq\&.
.SH "COPYRIGHT"
.br
.PP
@@ -829,6 +774,11 @@ Bug#24631
\%http://bugs.mysql.com/24631
.RE
.IP " 2." 4
+Bug#45588
+.RS 4
+\%http://bugs.mysql.com/45588
+.RE
+.IP " 3." 4
ndbd Error Messages
.RS 4
\%http://dev.mysql.com/doc/ndbapi/en/ndbd-error-messages.html
=== modified file 'man/ndbd_redo_log_reader.1'
--- a/man/ndbd_redo_log_reader.1 2009-09-16 12:03:18 +0000
+++ b/man/ndbd_redo_log_reader.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBndbd_redo_log_reader\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBNDBD_REDO_LOG_REA" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBNDBD_REDO_LOG_REA" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -37,6 +37,10 @@ The C++ source files for
can be found in the directory
/storage/ndb/src/kernel/blocks/dblqh/redoLogReader\&.
.PP
+The following table includes options that are specific to the MySQL Cluster program
+\fBndbd_redo_log_reader\fR\&. Additional descriptions follow the table\&. For options common to all MySQL Cluster programs, see
+Section\ \&17.4.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&.
+.PP
\fBUsage\fR:
.sp
.if n \{\
@@ -56,105 +60,83 @@ ndb_\fI#\fR_fs/D\fI#\fR/LCP/\fI#\fR/T\fI
represents a number (not necessarily the same number)\&. For more information, see
\m[blue]\fBCluster Data Node FileSystemDir Files\fR\m[]\&\s-2\u[1]\d\s+2\&.
.PP
-\fBAdditional Options\fR:
+The name of the file to be read may be followed by one or more of the options listed here:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-noprint
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
T}
.TE
.sp 1
+\fB\-noprint\fR: Do not print the contents of the log file\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-nocheck
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
T}
.TE
.sp 1
-.PP
-The name of the file to be read may be followed by one or more of the options listed here:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fB\-noprint\fR: Do not print the contents of the log file\&.
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
\fB\-nocheck\fR: Do not check the log file for errors\&.
.RE
.sp
@@ -184,7 +166,7 @@ You should have received a copy of the G
.IP " 1." 4
Cluster Data Node FileSystemDir Files
.RS 4
-\%http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndbd-filesystem.html#ndb-internals-ndbd-filesystemdir-files
+\%http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndbd-filesystemdir-files.html
.RE
.SH "SEE ALSO"
For more information, please refer to the MySQL Reference Manual,
=== modified file 'man/ndbmtd.8'
--- a/man/ndbmtd.8 2009-09-16 12:03:18 +0000
+++ b/man/ndbmtd.8 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBndbmtd\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBNDBMTD\FR" "8" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBNDBMTD\FR" "8" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -49,8 +49,8 @@ Command\-line options and configuration
\fBndbd\fR
also apply to
\fBndbmtd\fR\&. For more information about these options and parameters, see
-Section\ \&17.6.3.2, \(lqProgram Options for ndbd and ndbmtd\(rq, and
-Section\ \&17.3.4.6, \(lqDefining MySQL Cluster Data Nodes\(rq, respectively\&.
+\fBndbd\fR(8), and
+Section\ \&17.3.2.6, \(lqDefining MySQL Cluster Data Nodes\(rq, respectively\&.
.PP
\fBndbmtd\fR
is also file system\-compatible with
@@ -69,25 +69,13 @@ simply by stopping the node and then sta
\fBndbd\fR
in place of the multi\-threaded binary\&. It is not necessary when switching between the two to start the data node binary using
\fB\-\-initial\fR\&.
-.if n \{\
-.sp
-.\}
-.RS 4
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fBImportant\fR
-.ps -1
-.br
.PP
-We do not currently recommend using
+Prior to MySQL Cluster NDB 7\&.0\&.6, there were known issues when using
\fBndbmtd\fR
-with MySQL Cluster Disk Data tables in production, due to known issues which we are working to fix in a future MySQL Cluster release\&. (\m[blue]\fBBug#41915\fR\m[]\&\s-2\u[1]\d\s+2,
+with MySQL Cluster Disk Data tables\&. If you wish to use multi\-threaded data nodes with disk\-based
+NDB
+tables, you should insure that you are running MySQL Cluster NDB 7\&.0\&.6 or later\&. (\m[blue]\fBBug#41915\fR\m[]\&\s-2\u[1]\d\s+2,
\m[blue]\fBBug#44915\fR\m[]\&\s-2\u[2]\d\s+2)
-.sp .5v
-.RE
.PP
Using
\fBndbmtd\fR
@@ -129,6 +117,8 @@ failures\&.
.RE
.PP
These differences are discussed in more detail in the next few paragraphs\&.
+.\" execution threads (MySQL Cluster)
+.\" MySQL Cluster: execution threads
.\" ndbmtd: MaxNoOfExecutionThreads
.\" MaxNoOfExecutionThreads: ndbmtd
.\" ndbmtd: trace files
@@ -148,7 +138,7 @@ file, it is exclusive to
and does not apply to
\fBndbd\fR\&.
.PP
-This parameter takes an integer value from 2 to 8 inclusive\&. Generally, you should set this to the number of CPU cores on the data node host, as shown in the following table:
+This parameter takes an integer value from 2 to 8 inclusive\&. Generally, you should set this parameter equal to the number of CPU cores on the data node host, as shown in the following table:
.TS
allbox tab(:);
lB lB.
=== modified file 'man/perror.1'
--- a/man/perror.1 2009-09-16 12:03:18 +0000
+++ b/man/perror.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBperror\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBPERROR\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBPERROR\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/replace.1'
--- a/man/replace.1 2009-09-16 12:03:18 +0000
+++ b/man/replace.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBreplace\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBREPLACE\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBREPLACE\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/resolve_stack_dump.1'
--- a/man/resolve_stack_dump.1 2009-09-16 12:03:18 +0000
+++ b/man/resolve_stack_dump.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBresolve_stack_dump\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBRESOLVE_STACK_DUM" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBRESOLVE_STACK_DUM" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/resolveip.1'
--- a/man/resolveip.1 2009-09-16 12:03:18 +0000
+++ b/man/resolveip.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBresolveip\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBRESOLVEIP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBRESOLVEIP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'scripts/fill_help_tables.sql'
--- a/scripts/fill_help_tables.sql 2009-09-16 12:03:18 +0000
+++ b/scripts/fill_help_tables.sql 2009-12-01 07:24:05 +0000
@@ -87,7 +87,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,25,'SHOW CREATE PROCEDURE','Syntax:\nSHOW CREATE PROCEDURE proc_name\n\nThis statement is a MySQL extension. It returns the exact string that\ncan be used to re-create the named stored procedure. A similar\nstatement, SHOW CREATE FUNCTION, displays information about stored\nfunctions (see [HELP SHOW CREATE FUNCTION]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table. If you do not have privileges\nfor the routine itself, the value displayed for the Create Procedure or\nCreate Function field will be NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-procedure.html\n\n','mysql> SHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row ***************************\n Procedure: simpleproc\n sql_mode:\n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nmysql> SHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row ***************************\n Function: hello\n sql_mode:\n Create Function: CREATE FUNCTION `hello`(s CHAR(20))\n RETURNS CHAR(50)\n RETURN CONCAT(\'Hello, \',s,\'!\')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.1/en/show-create-procedure.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,20,'INTEGER','INTEGER[(M)] [UNSIGNED] [ZEROFILL]\n\nThis type is a synonym for INT.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,35,'LOWER','Syntax:\nLOWER(str)\n\nReturns the string str with all characters changed to lowercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT LOWER(\'QUADRATICALLY\');\n -> \'quadratically\'\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings\n(BINARY, VARBINARY, BLOB). To perform lettercase conversion, convert\nthe string to a nonbinary string:\n\nmysql> SET @str = BINARY \'New York\';\nmysql> SELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+-------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+-------------+-----------------------------------+\n| New York | new york |\n+-------------+-----------------------------------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,25,'SHOW COLUMNS','Syntax:\nSHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW COLUMNS displays information about the columns in a given table.\nIt also works for views. The LIKE clause, if present, indicates which\ncolumn names to match. The WHERE clause can be given to select rows\nusing more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nmysql> SHOW COLUMNS FROM City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nIf the data types differ from what you expect them to be based on a\nCREATE TABLE statement, note that MySQL sometimes changes data types\nwhen you create or alter a table. The conditions under which this\noccurs are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/silent-column-changes.html.\n\nT… FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. In other words, these two statements are equivalent:\n\nmysql> SHOW COLUMNS FROM mytable FROM mydb;\nmysql> SHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for nonbinary string columns, or NULL\nfor other columns. This value is displayed only if you use the FULL\nkeyword.\n\nThe Null field contains YES if NULL values can be stored in the column,\nNO if not.\n\nThe Key field indicates whether the column is indexed:\n\no If Key is empty, the column either is not indexed or is indexed only\n as a secondary column in a multiple-column, nonunique index.\n\no If Key is PRI, the column is a PRIMARY KEY or is one of the columns\n in a multiple-column PRIMARY KEY.\n\no If Key is UNI, the column is the first column of a unique-valued\n index that cannot contain NULL values.\n\no If Key is MUL, multiple occurrences of a given value are allowed\n within the column. The column is the first column of a nonunique\n index or a unique-valued index that can contain NULL values.\n\nIf more than one of the Key values applies to a given column of a\ntable, Key displays the one with the highest priority, in the order\nPRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values\nand there is no PRIMARY KEY in the table. A UNIQUE index may display as\nMUL if several columns form a composite UNIQUE index; although the\ncombination of the columns is unique, each column can still hold\nmultiple occurrences of a given value.\n\nThe Default field indicates the default value that is assigned to the\ncolumn.\n\nThe Extra field contains any additional information that is available\nabout a given column. The value is auto_increment if the column was\ncreated with the AUTO_INCREMENT keyword and empty otherwise.\n\nPrivileges indicates the privileges you have for the column. This value\nis displayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed\nonly if you use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. You can also list a table\'s\ncolumns with the mysqlshow db_name tbl_name command.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS.\nSee [HELP DESCRIBE].\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements\nalso provide information about tables. See [HELP SHOW].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-columns.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-columns.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,25,'SHOW COLUMNS','Syntax:\nSHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW COLUMNS displays information about the columns in a given table.\nIt also works for views. The LIKE clause, if present, indicates which\ncolumn names to match. The WHERE clause can be given to select rows\nusing more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nmysql> SHOW COLUMNS FROM City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nIf the data types differ from what you expect them to be based on a\nCREATE TABLE statement, note that MySQL sometimes changes data types\nwhen you create or alter a table. The conditions under which this\noccurs are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/silent-column-changes.html.\n\nT… FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. In other words, these two statements are equivalent:\n\nmysql> SHOW COLUMNS FROM mytable FROM mydb;\nmysql> SHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for nonbinary string columns, or NULL\nfor other columns. This value is displayed only if you use the FULL\nkeyword.\n\nThe Null field contains YES if NULL values can be stored in the column,\nNO if not.\n\nThe Key field indicates whether the column is indexed:\n\no If Key is empty, the column either is not indexed or is indexed only\n as a secondary column in a multiple-column, nonunique index.\n\no If Key is PRI, the column is a PRIMARY KEY or is one of the columns\n in a multiple-column PRIMARY KEY.\n\no If Key is UNI, the column is the first column of a unique-valued\n index that cannot contain NULL values.\n\no If Key is MUL, multiple occurrences of a given value are allowed\n within the column. The column is the first column of a nonunique\n index or a unique-valued index that can contain NULL values.\n\nIf more than one of the Key values applies to a given column of a\ntable, Key displays the one with the highest priority, in the order\nPRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values\nand there is no PRIMARY KEY in the table. A UNIQUE index may display as\nMUL if several columns form a composite UNIQUE index; although the\ncombination of the columns is unique, each column can still hold\nmultiple occurrences of a given value.\n\nThe Default field indicates the default value that is assigned to the\ncolumn.\n\nThe Extra field contains any additional information that is available\nabout a given column. The value is nonempty in these cases:\nauto_increment for columns that have the AUTO_INCREMENT attribute; as\nof MySQL 5.1.23, on update CURRENT_TIMESTAMP for TIMESTAMP columns that\nhave the ON UPDATE CURRENT_TIMESTAMP attribute.\n\nPrivileges indicates the privileges you have for the column. This value\nis displayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed\nonly if you use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. You can also list a table\'s\ncolumns with the mysqlshow db_name tbl_name command.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS.\nSee [HELP DESCRIBE].\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements\nalso provide information about tables. See [HELP SHOW].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-columns.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-columns.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,37,'CREATE TRIGGER','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n TRIGGER trigger_name trigger_time trigger_event\n ON tbl_name FOR EACH ROW trigger_stmt\n\nThis statement creates a new trigger. A trigger is a named database\nobject that is associated with a table, and that activates when a\nparticular event occurs for the table. The trigger becomes associated\nwith the table named tbl_name, which must refer to a permanent table.\nYou cannot associate a trigger with a TEMPORARY table or a view.\n\nCREATE TRIGGER requires the TRIGGER privilege for the table associated\nwith the trigger. (Before MySQL 5.1.6, this statement requires the\nSUPER privilege.)\n\nThe DEFINER clause determines the security context to be used when\nchecking access privileges at trigger activation time.\n\ntrigger_time is the trigger action time. It can be BEFORE or AFTER to\nindicate that the trigger activates before or after each row to be\nmodified.\n\ntrigger_event indicates the kind of statement that activates the\ntrigger. The trigger_event can be one of the following:\n\no INSERT: The trigger is activated whenever a new row is inserted into\n the table; for example, through INSERT, LOAD DATA, and REPLACE\n statements.\n\no UPDATE: The trigger is activated whenever a row is modified; for\n example, through UPDATE statements.\n\no DELETE: The trigger is activated whenever a row is deleted from the\n table; for example, through DELETE and REPLACE statements. However,\n DROP TABLE and TRUNCATE statements on the table do not activate this\n trigger, because they do not use DELETE. Dropping a partition does\n not activate DELETE triggers, either. See [HELP TRUNCATE TABLE].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,30,'MONTH','Syntax:\nMONTH(date)\n\nReturns the month for date, in the range 1 to 12 for January to\nDecember, or 0 for dates such as \'0000-00-00\' or \'2008-00-00\' that have\na zero month part.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MONTH(\'2008-02-03\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,20,'TINYINT','TINYINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA very small integer. The signed range is -128 to 127. The unsigned\nrange is 0 to 255.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
@@ -153,7 +153,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,25,'EXECUTE STATEMENT','Syntax:\nEXECUTE stmt_name\n [USING @var_name [, @var_name] ...]\n\nAfter preparing a statement with PREPARE, you execute it with an\nEXECUTE statement that refers to the prepared statement name. If the\nprepared statement contains any parameter markers, you must supply a\nUSING clause that lists user variables containing the values to be\nbound to the parameters. Parameter values can be supplied only by user\nvariables, and the USING clause must name exactly as many variables as\nthe number of parameter markers in the statement.\n\nYou can execute a given prepared statement multiple times, passing\ndifferent variables to it or setting the variables to different values\nbefore each execution.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/execute.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/execute.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,37,'DROP INDEX','Syntax:\nDROP [ONLINE|OFFLINE] INDEX index_name ON tbl_name\n\nDROP INDEX drops the index named index_name from the table tbl_name.\nThis statement is mapped to an ALTER TABLE statement to drop the index.\nSee [HELP ALTER TABLE].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-index.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-index.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,35,'MATCH AGAINST','Syntax:\nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n\nMySQL has support for full-text indexing and searching:\n\no A full-text index in MySQL is an index of type FULLTEXT.\n\no Full-text indexes can be used only with MyISAM tables, and can be\n created only for CHAR, VARCHAR, or TEXT columns.\n\no A FULLTEXT index definition can be given in the CREATE TABLE\n statement when a table is created, or added later using ALTER TABLE\n or CREATE INDEX.\n\no For large data sets, it is much faster to load your data into a table\n that has no FULLTEXT index and then create the index after that, than\n to load data into a table that has an existing FULLTEXT index.\n\nFull-text searching is performed using MATCH() ... AGAINST syntax.\nMATCH() takes a comma-separated list that names the columns to be\nsearched. AGAINST takes a string to search for, and an optional\nmodifier that indicates what type of search to perform. The search\nstring must be a literal string, not a variable or a column name. There\nare three types of full-text searches:\n\no A boolean search interprets the search string using the rules of a\n special query language. The string contains the words to search for.\n It can also contain operators that specify requirements such that a\n word must be present or absent in matching rows, or that it should be\n weighted higher or lower than usual. Common words such as "some" or\n "then" are stopwords and do not match if present in the search\n string. The IN BOOLEAN MODE modifier specifies a boolean search. For\n more information, see\n http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html.\n\no A natural language search interprets the search string as a phrase in\n natural human language (a phrase in free text). There are no special\n operators. The stopword list applies. In addition, words that are\n present in 50% or more of the rows are considered common and do not\n match. Full-text searches are natural language searches if the IN\n NATURAL LANGUAGE MODE modifier is given or if no modifier is given.\n\no A query expansion search is a modification of a natural language\n search. The search string is used to perform a natural language\n search. Then words from the most relevant rows returned by the search\n are added to the search string and the search is done again. The\n query returns the rows from the second search. The IN NATURAL\n LANGUAGE MODE WITH QUERY EXPANSION or WITH QUERY EXPANSION modifier\n specifies a query expansion search. For more information, see\n http://dev.mysql.com/doc/refman/5.1/en/fulltext-query-expansion.html.\n\nThe IN NATURAL LANGUAGE MODE and IN NATURAL LANGUAGE MODE WITH QUERY\nEXPANSION modifiers were added in MySQL 5.1.7.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html\n\n','mysql> SELECT id, body, MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE) AS score\n -> FROM articles WHERE MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE);\n+----+-------------------------------------+-----------------+\n| id | body | score |\n+----+-------------------------------------+-----------------+\n| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |\n| 6 | When configured properly, MySQL ... | 1.3114095926285 |\n+----+-------------------------------------+-----------------+\n2 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,37,'CREATE EVENT','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n EVENT\n [IF NOT EXISTS]\n event_name\n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO sql_statement;\n\nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval\n [STARTS timestamp [+ INTERVAL interval] ...]\n [ENDS timestamp [+ INTERVAL interval] ...]\n\ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n\nThis statement creates and schedules a new event. It requires the EVENT\nprivilege for the schema in which the event is to be created.\n\nThe minimum requirements for a valid CREATE EVENT statement are as\nfollows:\n\no The keywords CREATE EVENT plus an event name, which uniquely\n identifies the event in the current schema. (Prior to MySQL 5.1.12,\n the event name needed to be unique only among events created by the\n same user on a given database.)\n\no An ON SCHEDULE clause, which determines when and how often the event\n executes.\n\no A DO clause, which contains the SQL statement to be executed by an\n event.\n\nThis is an example of a minimal CREATE EVENT statement:\n\nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n\nThe previous statement creates an event named myevent. This event\nexecutes once --- one hour following its creation --- by running an SQL\nstatement that increments the value of the myschema.mytable table\'s\nmycol column by 1.\n\nThe event_name must be a valid MySQL identifier with a maximum length\nof 64 characters. It may be delimited using back ticks, and may be\nqualified with the name of a database schema. An event is associated\nwith both a MySQL user (the definer) and a schema, and its name must be\nunique among names of events within that schema. In general, the rules\ngoverning event names are the same as those for names of stored\nroutines. See http://dev.mysql.com/doc/refman/5.1/en/identifiers.html.\n\nIf no schema is indicated as part of event_name, the default (current)\nschema is assumed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-event.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-event.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,37,'CREATE EVENT','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n EVENT\n [IF NOT EXISTS]\n event_name\n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO sql_statement;\n\nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval\n [STARTS timestamp [+ INTERVAL interval] ...]\n [ENDS timestamp [+ INTERVAL interval] ...]\n\ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n\nThis statement creates and schedules a new event. It requires the EVENT\nprivilege for the schema in which the event is to be created.\n\nThe minimum requirements for a valid CREATE EVENT statement are as\nfollows:\n\no The keywords CREATE EVENT plus an event name, which uniquely\n identifies the event within a database schema. (Prior to MySQL\n 5.1.12, the event name needed to be unique only among events created\n by the same user within a schema.)\n\no An ON SCHEDULE clause, which determines when and how often the event\n executes.\n\no A DO clause, which contains the SQL statement to be executed by an\n event.\n\nThis is an example of a minimal CREATE EVENT statement:\n\nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n\nThe previous statement creates an event named myevent. This event\nexecutes once --- one hour following its creation --- by running an SQL\nstatement that increments the value of the myschema.mytable table\'s\nmycol column by 1.\n\nThe event_name must be a valid MySQL identifier with a maximum length\nof 64 characters. Event names are not case sensitive, so you cannot\nhave two events named myevent and MyEvent in the same schema. In\ngeneral, the rules governing event names are the same as those for\nnames of stored routines. See\nhttp://dev.mysql.com/doc/refman/5.1/en/identifiers.html.\n\nAn event is associated with a schema. If no schema is indicated as part\nof event_name, the default (current) schema is assumed. To create an\nevent in a specific schema, qualify the event name with a schema using\nschema_name.event_name syntax.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-event.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-event.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,4,'ABS','Syntax:\nABS(X)\n\nReturns the absolute value of X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ABS(2);\n -> 2\nmysql> SELECT ABS(-32);\n -> 32\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,31,'POLYFROMWKB','PolyFromWKB(wkb[,srid]), PolygonFromWKB(wkb[,srid])\n\nConstructs a POLYGON value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb…','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb…');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,35,'NOT LIKE','Syntax:\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nThis is the same as NOT (expr LIKE pat [ESCAPE \'escape_char\']).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html');
@@ -163,7 +163,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,16,'MAX','Syntax:\nMAX([DISTINCT] expr)\n\nReturns the maximum value of expr. MAX() may take a string argument; in\nsuch cases, it returns the maximum string value. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the maximum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMAX() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,21,'CREATE FUNCTION UDF','Syntax:\nCREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n\nA user-defined function (UDF) is a way to extend MySQL with a new\nfunction that works like a native (built-in) MySQL function such as\nABS() or CONCAT().\n\nfunction_name is the name that should be used in SQL statements to\ninvoke the function. The RETURNS clause indicates the type of the\nfunction\'s return value. DECIMAL is a legal value after RETURNS, but\ncurrently DECIMAL functions return string values and should be written\nlike STRING functions.\n\nshared_library_name is the basename of the shared object file that\ncontains the code that implements the function. The file must be\nlocated in the plugin directory. This directory is given by the value\nof the plugin_dir system variable.\n\n*Note*: This is a change in MySQL 5.1. For earlier versions of MySQL,\nthe shared object can be located in any directory that is searched by\nyour system\'s dynamic linker.\n\nTo create a function, you must have the INSERT privilege for the mysql\ndatabase. This is necessary because CREATE FUNCTION adds a row to the\nmysql.func system table that records the function\'s name, type, and\nshared library name. If you do not have this table, you should run the\nmysql_upgrade command to create it. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-function-udf.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-function-udf.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,4,'*','Syntax:\n*\n\nMultiplication:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT 3*5;\n -> 15\nmysql> SELECT 18014398509481984*18014398509481984.0;\n -> 324518553658426726783156020576256.0\nmysql> SELECT 18014398509481984*18014398509481984;\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,20,'TIMESTAMP','TIMESTAMP\n\nA timestamp. The range is \'1970-01-01 00:00:01\' UTC to \'2038-01-09\n03:14:07\' UTC. TIMESTAMP values are stored as the number of seconds\nsince the epoch (\'1970-01-01 00:00:00\' UTC). A TIMESTAMP cannot\nrepresent the value \'1970-01-01 00:00:00\' because that is equivalent to\n0 seconds from the epoch and the value 0 is reserved for representing\n\'0000-00-00 00:00:00\', the "zero" TIMESTAMP value.\n\nA TIMESTAMP column is useful for recording the date and time of an\nINSERT or UPDATE operation. By default, the first TIMESTAMP column in a\ntable is automatically set to the date and time of the most recent\noperation if you do not assign it a value yourself. You can also set\nany TIMESTAMP column to the current date and time by assigning it a\nNULL value. Variations on automatic initialization and update\nproperties are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/timestamp.html.\n\nA TIMESTAMP value is returned as a string in the format \'YYYY-MM-DD\nHH:MM:SS\' with a display width fixed at 19 characters. To obtain the\nvalue as a number, you should add +0 to the timestamp column.\n\n*Note*: The TIMESTAMP format that was used prior to MySQL 4.1 is not\nsupported in MySQL 5.1; see MySQL 3.23, 4.0, 4.1 Reference Manual for\ninformation regarding the old format.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,20,'TIMESTAMP','TIMESTAMP\n\nA timestamp. The range is \'1970-01-01 00:00:01\' UTC to \'2038-01-19\n03:14:07\' UTC. TIMESTAMP values are stored as the number of seconds\nsince the epoch (\'1970-01-01 00:00:00\' UTC). A TIMESTAMP cannot\nrepresent the value \'1970-01-01 00:00:00\' because that is equivalent to\n0 seconds from the epoch and the value 0 is reserved for representing\n\'0000-00-00 00:00:00\', the "zero" TIMESTAMP value.\n\nA TIMESTAMP column is useful for recording the date and time of an\nINSERT or UPDATE operation. By default, the first TIMESTAMP column in a\ntable is automatically set to the date and time of the most recent\noperation if you do not assign it a value yourself. You can also set\nany TIMESTAMP column to the current date and time by assigning it a\nNULL value. Variations on automatic initialization and update\nproperties are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/timestamp.html.\n\nA TIMESTAMP value is returned as a string in the format \'YYYY-MM-DD\nHH:MM:SS\' with a display width fixed at 19 characters. To obtain the\nvalue as a number, you should add +0 to the timestamp column.\n\n*Note*: The TIMESTAMP format that was used prior to MySQL 4.1 is not\nsupported in MySQL 5.1; see MySQL 3.23, 4.0, 4.1 Reference Manual for\ninformation regarding the old format.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,11,'DES_DECRYPT','Syntax:\nDES_DECRYPT(crypt_str[,key_str])\n\nDecrypts a string encrypted with DES_ENCRYPT(). If an error occurs,\nthis function returns NULL.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.1/en/secure-connections.html.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte\nof the encrypted string to determine the DES key number that was used\nto encrypt the original string, and then reads the key from the DES key\nfile to decrypt the message. For this to work, the user must have the\nSUPER privilege. The key file can be specified with the --des-key-file\nserver option.\n\nIf you pass this function a key_str argument, that string is used as\nthe key for decrypting the message.\n\nIf the crypt_str argument does not appear to be an encrypted string,\nMySQL returns the given crypt_str.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,25,'CACHE INDEX','Syntax:\nCACHE INDEX\n tbl_index_list [, tbl_index_list] ...\n IN key_cache_name\n\ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n\nThe CACHE INDEX statement assigns table indexes to a specific key\ncache. It is used only for MyISAM tables.\n\nThe following statement assigns indexes from the tables t1, t2, and t3\nto the key cache named hot_cache:\n\nmysql> CACHE INDEX t1, t2, t3 IN hot_cache;\n+---------+--------------------+----------+----------+\n| Table | Op | Msg_type | Msg_text |\n+---------+--------------------+----------+----------+\n| test.t1 | assign_to_keycache | status | OK |\n| test.t2 | assign_to_keycache | status | OK |\n| test.t3 | assign_to_keycache | status | OK |\n+---------+--------------------+----------+----------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/cache-index.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/cache-index.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,12,'ENDPOINT','EndPoint(ls)\n\nReturns the Point that is the endpoint of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#lin…','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#lin…');
@@ -202,7 +202,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,25,'SHOW STATUS','Syntax:\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW STATUS provides server status information. This information also\ncan be obtained using the mysqladmin extended-status command. The LIKE\nclause, if present, indicates which variable names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in http://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\nThis statement does not require any privilege. It requires only the\nability to connect to the server.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern:\n\nmysql> SHOW STATUS LIKE \'Key%\';\n+--------------------+----------+\n| Variable_name | Value |\n+--------------------+----------+\n| Key_blocks_used | 14955 |\n| Key_read_requests | 96854827 |\n| Key_reads | 162040 |\n| Key_write_requests | 7589728 |\n| Key_writes | 3813196 |\n+--------------------+----------+\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for\nall connections to MySQL. With SESSION, it displays the status values\nfor the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION.\n\nSome status variables have only a global value. For these, you get the\nsame value for both GLOBAL and SESSION. The scope for each status\nvariable is listed at\nhttp://dev.mysql.com/doc/refman/5.1/en/server-status-variables.html.\n\…: http://dev.mysql.com/doc/refman/5.1/en/show-status.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-status.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,35,'EXTRACTVALUE','Syntax:\nExtractValue(xml_frag, xpath_expr)\n\nExtractValue() takes two string arguments, a fragment of XML markup\nxml_frag and an XPath expression xpath_expr (also known as a locator);\nit returns the text (CDATA) of the first text node which is a child of\nthe element(s) matched by the XPath expression. It is the equivalent of\nperforming a match using the xpath_expr after appending /text(). In\nother words, ExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b\') and\nExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b/text()\') produce the same\nresult.\n\nIf multiple matches are found, then the content of the first child text\nnode of each matching element is returned (in the order matched) as a\nsingle, space-delimited string.\n\nIf no matching text node is found for the expression (including the\nimplicit /text()) --- for whatever reason, as long as xpath_expr is\nvalid, and xml_frag consists of elements which are properly nested and\nclosed --- an empty string is returned. No distinction is made between\na match on an empty element and no match at all. This is by design.\n\nIf you need to determine whether no matching element was found in\nxml_frag or such an element was found but contained no child text\nnodes, you should test the result of an expression that uses the XPath\ncount() function. For example, both of these statements return an empty\nstring, as shown here:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nHowever, you can determine whether there was actually a matching\nelement using the following:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 1 |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n1 row in set (0.01 sec)\n\n*Important*: ExtractValue() returns only CDATA, and does not return any\ntags that might be contained within a matching tag, nor any of their\ncontent (see the result returned as val1 in the following example).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html\n\n','mysql> SELECT\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a\') AS val1,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a/b\') AS val2,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'//b\') AS val3,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/b\') AS val4,\n -> ExtractValue(\'<a>ccc<b>ddd</b><b>eee</b></a>\', \'//b\') AS val5;\n\n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+\n','http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,11,'OLD_PASSWORD','Syntax:\nOLD_PASSWORD(str)\n\nOLD_PASSWORD() was added to MySQL when the implementation of PASSWORD()\nwas changed to improve security. OLD_PASSWORD() returns the value of\nthe old (pre-4.1) implementation of PASSWORD() as a binary string, and\nis intended to permit you to reset passwords for any pre-4.1 clients\nthat need to connect to your version 5.1 MySQL server without locking\nthem out. See\nhttp://dev.mysql.com/doc/refman/5.1/en/password-hashing.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,22,'SET VARIABLE','Syntax:\nSET var_name = expr [, var_name = expr] ...\n\nThe SET statement in stored programs is an extended version of the\ngeneral SET statement (see [HELP SET]). Referenced variables may be\nones declared inside a stored program, global system variables, or\nuser-defined variables.\n\nThe SET statement in stored programs is implemented as part of the\npre-existing SET syntax. This allows an extended syntax of SET a=x,\nb=y, ... where different variable types (locally declared variables,\nglobal and session server variables, user-defined variables) can be\nmixed. This also allows combinations of local variables and some\noptions that make sense only for system variables; in that case, the\noptions are recognized but ignored.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-statement.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,22,'SET VARIABLE','Syntax:\nSET var_name = expr [, var_name = expr] ...\n\nThe SET statement in stored programs is an extended version of the\ngeneral SET statement (see [HELP SET]). Each var_name may refer to a\nlocal variable declared inside a stored program, a system variable, or\na user-defined variable.\n\nThe SET statement in stored programs is implemented as part of the\npre-existing SET syntax. This allows an extended syntax of SET a=x,\nb=y, ... where different variable types (locally declared variables,\nglobal and session system variables, user-defined variables) can be\nmixed. This also allows combinations of local variables and some\noptions that make sense only for system variables; in that case, the\noptions are recognized but ignored.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-statement.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,35,'FORMAT','Syntax:\nFORMAT(X,D)\n\nFormats the number X to a format like \'#,###,###.##\', rounded to D\ndecimal places, and returns the result as a string. If D is 0, the\nresult has no decimal point or fractional part.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT FORMAT(12332.123456, 4);\n -> \'12,332.1235\'\nmysql> SELECT FORMAT(12332.1,4);\n -> \'12,332.1000\'\nmysql> SELECT FORMAT(12332.2,0);\n -> \'12,332\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,13,'||','Syntax:\nOR, ||\n\nLogical OR. When both operands are non-NULL, the result is 1 if any\noperand is nonzero, and 0 otherwise. With a NULL operand, the result is\n1 if the other operand is nonzero, and NULL otherwise. If both operands\nare NULL, the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html\n\n','mysql> SELECT 1 || 1;\n -> 1\nmysql> SELECT 1 || 0;\n -> 1\nmysql> SELECT 0 || 0;\n -> 0\nmysql> SELECT 0 || NULL;\n -> NULL\nmysql> SELECT 1 || NULL;\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,35,'BIT_LENGTH','Syntax:\nBIT_LENGTH(str)\n\nReturns the length of the string str in bits.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT BIT_LENGTH(\'text\');\n -> 32\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
@@ -233,7 +233,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,30,'SEC_TO_TIME','Syntax:\nSEC_TO_TIME(seconds)\n\nReturns the seconds argument, converted to hours, minutes, and seconds,\nas a TIME value. The range of the result is constrained to that of the\nTIME data type. A warning occurs if the argument corresponds to a value\noutside that range.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT SEC_TO_TIME(2378);\n -> \'00:39:38\'\nmysql> SELECT SEC_TO_TIME(2378) + 0;\n -> 3938\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,20,'FLOAT','FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA small (single-precision) floating-point number. Allowable values are\n-3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to\n3.402823466E+38. These are the theoretical limits, based on the IEEE\nstandard. The actual range might be slightly smaller depending on your\nhardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits allowed by the hardware. A single-precision floating-point\nnumber is accurate to approximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all\ncalculations in MySQL are done with double precision. See\nhttp://dev.mysql.com/doc/refman/5.1/en/no-matching-rows.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,35,'LOCATE','Syntax:\nLOCATE(substr,str), LOCATE(substr,str,pos)\n\nThe first syntax returns the position of the first occurrence of\nsubstring substr in string str. The second syntax returns the position\nof the first occurrence of substring substr in string str, starting at\nposition pos. Returns 0 if substr is not in str.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT LOCATE(\'bar\', \'foobarbar\');\n -> 4\nmysql> SELECT LOCATE(\'xbar\', \'foobar\');\n -> 0\nmysql> SELECT LOCATE(\'bar\', \'foobarbar\', 5);\n -> 7\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,25,'SHOW EVENTS','Syntax:\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nIn its simplest form, SHOW EVENTS lists all of the events in the\ncurrent schema:\n\nmysql> SELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n1 row in set (0.00 sec)\n\nmysql> SHOW EVENTS\\G\n*************************** 1. row ***************************\n Db: myschema\n Name: e_daily\n Definer: jon@ghidora\n Time zone: SYSTEM\n Type: RECURRING\n Execute at: NULL\n Interval value: 10\n Interval field: SECOND\n Starts: 2006-02-09 10:41:23\n Ends: 0000-00-00 00:00:00\n Status: ENABLED\n Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nThe LIKE clause, if present, indicates which event names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-events.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-events.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,25,'SHOW EVENTS','Syntax:\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nIn its simplest form, SHOW EVENTS lists all of the events in the\ncurrent schema:\n\nmysql> SELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n1 row in set (0.00 sec)\n\nmysql> SHOW EVENTS\\G\n*************************** 1. row ***************************\n Db: myschema\n Name: e_daily\n Definer: jon@ghidora\n Time zone: SYSTEM\n Type: RECURRING\n Execute at: NULL\n Interval value: 10\n Interval field: SECOND\n Starts: 2006-02-09 10:41:23\n Ends: NULL\n Status: ENABLED\n Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nTo see events for a specific schema, use the FROM clause. For example,\nto see events for the test schema, use the following statement:\n\nSHOW EVENTS FROM test;\n\nThe LIKE clause, if present, indicates which event names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-events.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-events.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,15,'CHARSET','Syntax:\nCHARSET(str)\n\nReturns the character set of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT CHARSET(\'abc\');\n -> \'latin1\'\nmysql> SELECT CHARSET(CONVERT(\'abc\' USING utf8));\n -> \'utf8\'\nmysql> SELECT CHARSET(USER());\n -> \'utf8\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,30,'SUBDATE','Syntax:\nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, SUBDATE()\nis a synonym for DATE_SUB(). For information on the INTERVAL unit\nargument, see the discussion for DATE_ADD().\n\nmysql> SELECT DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\nmysql> SELECT SUBDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\n\nThe second form allows the use of an integer value for days. In such\ncases, it is interpreted as the number of days to be subtracted from\nthe date or datetime expression expr.\n\nmysql> SELECT SUBDATE(\'2008-01-02 12:00:00\', 31);\n -> \'2007-12-02 12:00:00\'\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,30,'DAYOFYEAR','Syntax:\nDAYOFYEAR(date)\n\nReturns the day of the year for date, in the range 1 to 366.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFYEAR(\'2007-02-03\');\n -> 34\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
@@ -250,7 +250,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,24,'NUMGEOMETRIES','NumGeometries(gc)\n\nReturns the number of geometries in the GeometryCollection value gc.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#geo…','mysql> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nmysql> SELECT NumGeometries(GeomFromText(@gc));\n+----------------------------------+\n| NumGeometries(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#geo…');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,30,'MONTHNAME','Syntax:\nMONTHNAME(date)\n\nReturns the full name of the month for date. As of MySQL 5.1.12, the\nlanguage used for the name is controlled by the value of the\nlc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.1/en/locale-support.html).\n\n…: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MONTHNAME(\'2008-02-03\');\n -> \'February\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,36,'PROCEDURE ANALYSE','Syntax:\nANALYSE([max_elements[,max_memory]])\n\nANALYSE() is defined in the sql/sql_analyse.cc source file, which\nserves as an example of how to create a procedure for use with the\nPROCEDURE clause of SELECT statements. ANALYSE() is built in and is\navailable by default; other procedures can be created using the format\ndemonstrated in the source file.\n\nANALYSE() examines the result from a query and returns an analysis of\nthe results that suggests optimal data types for each column that may\nhelp reduce table sizes. To obtain this analysis, append PROCEDURE\nANALYSE to the end of a SELECT statement:\n\nSELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])\n\nFor example:\n\nSELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);\n\nThe results show some statistics for the values returned by the query,\nand propose an optimal data type for the columns. This can be helpful\nfor checking your existing tables, or after importing new data. You may\nneed to try different settings for the arguments so that PROCEDURE\nANALYSE() does not suggest the ENUM data type when it is not\nappropriate.\n\nThe arguments are optional and are used as follows:\n\no max_elements (default 256) is the maximum number of distinct values\n that ANALYSE() notices per column. This is used by ANALYSE() to check\n whether the optimal data type should be of type ENUM; if there are\n more than max_elements distinct values, then ENUM is not a suggested\n type.\n\no max_memory (default 8192) is the maximum amount of memory that\n ANALYSE() should allocate per column while trying to find all\n distinct values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/procedure-analyse.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/procedure-analyse.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,25,'CHANGE MASTER TO','Syntax:\nCHANGE MASTER TO master_def [, master_def] ...\n\nmaster_def:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n\nCHANGE MASTER TO changes the parameters that the slave server uses for\nconnecting to and communicating with the master server. It also updates\nthe contents of the master.info and relay-log.info files.\n\nMASTER_USER, MASTER_PASSWORD, MASTER_SSL, MASTER_SSL_CA,\nMASTER_SSL_CAPATH, MASTER_SSL_CERT, MASTER_SSL_KEY, MASTER_SSL_CIPHER,\nand MASTER_SSL_VERIFY_SERVER_CERT provide information to the slave\nabout how to connect to its master. MASTER_SSL_VERIFY_SERVER_CERT was\nadded in MySQL 5.1.18. It is used as described for the\n--ssl-verify-server-cert option in\nhttp://dev.mysql.com/doc/refman/5.1/en/ssl-options.html.\n\nMASTER_CONN… specifies how many seconds to wait between connect\nretries. The default is 60. The number of reconnection attempts is\nlimited by the --master-retry-count server option; for more\ninformation, see\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-options.html.\n\nThe SSL options (MASTER_SSL, MASTER_SSL_CA, MASTER_SSL_CAPATH,\nMASTER_SSL_CERT, MASTER_SSL_KEY, MASTER_SSL_CIPHER), and\nMASTER_SSL_VERIFY_SERVER_CERT can be changed even on slaves that are\ncompiled without SSL support. They are saved to the master.info file,\nbut are ignored unless you use a server that has SSL support enabled.\n\nIf you don\'t specify a given parameter, it keeps its old value, except\nas indicated in the following discussion. For example, if the password\nto connect to your MySQL master has changed, you just need to issue\nthese statements to tell the slave about the new password:\n\nSTOP SLAVE; -- if replication was running\nCHANGE MASTER TO MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE; -- if you want to restart replication\n\nThere is no need to specify the parameters that do not change (host,\nport, user, and so forth).\n\nMASTER_HOST and MASTER_PORT are the host name (or IP address) of the\nmaster host and its TCP/IP port.\n\nThe next two options are available only in MySQL Cluster NDB 6.3 and\n6.4; they are not supported in mainline MySQL 5.1:\n\no MASTER_BIND is for use on replication slaves having multiple network\n interfaces, and determines which of the slave\'s network interfaces is\n chosen for connecting to the master. It is also possible to determine\n which network interface is to be used in such cases by starting the\n slave mysqld process with the --master-bind option.\n\n The ability to bind a replication slave to specific network interface\n was added in MySQL Cluster NDB 6.3.4.\n\no MASTER_HEARTBEAT_PERIOD is used to set the interval in seconds\n between replication heartbeats. Whenever the master\'s binlog is\n updated with an event, the waiting period for the next heartbeat is\n reset. interval is a decimal value having the range 0 to 4294967\n seconds and a resolution to hundredths of a second; the smallest\n nonzero value is 0.001. Heartbeats are sent by the master only if\n there are no unsent events in the binlog file for a period longer\n than interval.\n\n Setting interval to 0 disables heartbeats altogether. The default\n value for interval is equal to the value of slave_net_timeout divided\n by 2.\n\n *Note*: Setting @@global.slave_net_timeout to a value less than that\n of the current heartbeat interval results in a warning being issued.\n\n Issuing RESET SLAVE resets the heartbeat interval to the default.\n\n MASTER_HEARTBEAT_PERIOD was added in MySQL Cluster NDB 6.3.4.\n\n*Note*: Replication cannot use Unix socket files. You must be able to\nconnect to the master MySQL server using TCP/IP.\n\nIf you specify MASTER_HOST or MASTER_PORT, the slave assumes that the\nmaster server is different from before (even if you specify a host or\nport value that is the same as the current value.) In this case, the\nold values for the master binary log name and position are considered\nno longer applicable, so if you do not specify MASTER_LOG_FILE and\nMASTER_LOG_POS in the statement, MASTER_LOG_FILE=\'\' and\nMASTER_LOG_POS=4 are silently appended to it.\n\nSetting MASTER_HOST=\'\' --- that is, setting its value explicitly to an\nempty string --- is not the same as not setting it at all. Setting this\noption to an empty string causes START SLAVE subsequently to fail. This\nissue is addressed in MySQL 6.0. (Bug#28796\n(http://bugs.mysql.com/28796))\n\nMASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the\nslave I/O thread should begin reading from the master the next time the\nthread starts. If you specify either of them, you cannot specify\nRELAY_LOG_FILE or RELAY_LOG_POS. If neither of MASTER_LOG_FILE or\nMASTER_LOG_POS are specified, the slave uses the last coordinates of\nthe slave SQL thread before CHANGE MASTER TO was issued. This ensures\nthat there is no discontinuity in replication, even if the slave SQL\nthread was late compared to the slave I/O thread, when you merely want\nto change, say, the password to use.\n\nCHANGE MASTER TO deletes all relay log files and starts a new one,\nunless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay\nlogs are kept; the relay_log_purge global variable is set silently to\n0.\n\nCHANGE MASTER TO is useful for setting up a slave when you have the\nsnapshot of the master and have recorded the log and the offset\ncorresponding to it. After loading the snapshot into the slave, you can\nrun CHANGE MASTER TO MASTER_LOG_FILE=\'log_name_on_master\',\nMASTER_LOG_POS=log_offset_on_master on the slave.\n\nThe following example changes the master and master\'s binary log\ncoordinates. This is used when you want to set up the slave to\nreplicate the master:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\n\nThe next example shows an operation that is less frequently employed.\nIt is used when the slave has relay logs that you want it to execute\nagain for some reason. To do this, the master need not be reachable.\nYou need only use CHANGE MASTER TO and start the SQL thread (START\nSLAVE SQL_THREAD):\n\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,25,'CHANGE MASTER TO','Syntax:\nCHANGE MASTER TO master_def [, master_def] ...\n\nmaster_def:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n\nCHANGE MASTER TO changes the parameters that the slave server uses for\nconnecting to and communicating with the master server. It also updates\nthe contents of the master.info and relay-log.info files.\n\nMASTER_USER, MASTER_PASSWORD, MASTER_SSL, MASTER_SSL_CA,\nMASTER_SSL_CAPATH, MASTER_SSL_CERT, MASTER_SSL_KEY, MASTER_SSL_CIPHER,\nand MASTER_SSL_VERIFY_SERVER_CERT provide information to the slave\nabout how to connect to its master. MASTER_SSL_VERIFY_SERVER_CERT was\nadded in MySQL 5.1.18. It is used as described for the\n--ssl-verify-server-cert option in\nhttp://dev.mysql.com/doc/refman/5.1/en/ssl-options.html.\n\nMASTER_CONN… specifies how many seconds to wait between connect\nretries. The default is 60. The number of reconnection attempts is\nlimited by the --master-retry-count server option; for more\ninformation, see\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-options.html.\n\nThe SSL options (MASTER_SSL, MASTER_SSL_CA, MASTER_SSL_CAPATH,\nMASTER_SSL_CERT, MASTER_SSL_KEY, MASTER_SSL_CIPHER), and\nMASTER_SSL_VERIFY_SERVER_CERT can be changed even on slaves that are\ncompiled without SSL support. They are saved to the master.info file,\nbut are ignored unless you use a server that has SSL support enabled.\n\nIf you do not specify a given parameter, it keeps its old value, except\nas indicated in the following discussion. For example, if the password\nto connect to your MySQL master has changed, you just need to issue\nthese statements to tell the slave about the new password:\n\nSTOP SLAVE; -- if replication was running\nCHANGE MASTER TO MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE; -- if you want to restart replication\n\nThere is no need to specify the parameters that do not change (host,\nport, user, and so forth).\n\nMASTER_HOST and MASTER_PORT are the host name (or IP address) of the\nmaster host and its TCP/IP port.\n\nThe next two options (MASTER_BIND and MASTER_HEARTBEAT_PERIOD) are\navailable in MySQL Cluster NDB 6.3 and later, but are not supported in\nmainline MySQL 5.1:\n\no MASTER_BIND is for use on replication slaves having multiple network\n interfaces, and determines which of the slave\'s network interfaces is\n chosen for connecting to the master. It is also possible to determine\n which network interface is to be used in such cases by starting the\n slave mysqld process with the --master-bind option.\n\n The ability to bind a replication slave to specific network interface\n was added in MySQL Cluster NDB 6.3.4.\n\no MASTER_HEARTBEAT_PERIOD is used to set the interval in seconds\n between replication heartbeats. Whenever the master\'s binlog is\n updated with an event, the waiting period for the next heartbeat is\n reset. interval is a decimal value having the range 0 to 4294967\n seconds and a resolution to hundredths of a second; the smallest\n nonzero value is 0.001. Heartbeats are sent by the master only if\n there are no unsent events in the binlog file for a period longer\n than interval.\n\n Setting interval to 0 disables heartbeats altogether. The default\n value for interval is equal to the value of slave_net_timeout divided\n by 2.\n\n Setting @@global.slave_net_timeout to a value less than that of the\n current heartbeat interval results in a warning being issued. The\n effect of issuing RESET SLAVE on the heartbeat interval is to reset\n it to the default value.\n\n MASTER_HEARTBEAT_PERIOD was added in MySQL Cluster NDB 6.3.4.\n\n*Note*: Replication cannot use Unix socket files. You must be able to\nconnect to the master MySQL server using TCP/IP.\n\nIf you specify MASTER_HOST or MASTER_PORT, the slave assumes that the\nmaster server is different from before (even if you specify a host or\nport value that is the same as the current value.) In this case, the\nold values for the master binary log name and position are considered\nno longer applicable, so if you do not specify MASTER_LOG_FILE and\nMASTER_LOG_POS in the statement, MASTER_LOG_FILE=\'\' and\nMASTER_LOG_POS=4 are silently appended to it.\n\nSetting MASTER_HOST=\'\' --- that is, setting its value explicitly to an\nempty string --- is not the same as not setting it at all. Setting this\noption to an empty string causes START SLAVE subsequently to fail. This\nissue is addressed in MySQL 5.5. (Bug#28796\n(http://bugs.mysql.com/28796))\n\nMASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the\nslave I/O thread should begin reading from the master the next time the\nthread starts. If you specify either of them, you cannot specify\nRELAY_LOG_FILE or RELAY_LOG_POS. If neither of MASTER_LOG_FILE or\nMASTER_LOG_POS are specified, the slave uses the last coordinates of\nthe slave SQL thread before CHANGE MASTER TO was issued. This ensures\nthat there is no discontinuity in replication, even if the slave SQL\nthread was late compared to the slave I/O thread, when you merely want\nto change, say, the password to use.\n\nCHANGE MASTER TO deletes all relay log files and starts a new one,\nunless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay\nlogs are kept; the relay_log_purge global variable is set silently to\n0.\n\nCHANGE MASTER TO is useful for setting up a slave when you have the\nsnapshot of the master and have recorded the log and the offset\ncorresponding to it. After loading the snapshot into the slave, you can\nrun CHANGE MASTER TO MASTER_LOG_FILE=\'log_name_on_master\',\nMASTER_LOG_POS=log_offset_on_master on the slave.\n\nThe following example changes the master and master\'s binary log\ncoordinates. This is used when you want to set up the slave to\nreplicate the master:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\n\nThe next example shows an operation that is less frequently employed.\nIt is used when the slave has relay logs that you want it to execute\nagain for some reason. To do this, the master need not be reachable.\nYou need only use CHANGE MASTER TO and start the SQL thread (START\nSLAVE SQL_THREAD):\n\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,37,'DROP DATABASE','Syntax:\nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n\nDROP DATABASE drops all tables in the database and deletes the\ndatabase. Be very careful with this statement! To use DROP DATABASE,\nyou need the DROP privilege on the database. DROP SCHEMA is a synonym\nfor DROP DATABASE.\n\n*Important*: When a database is dropped, user privileges on the\ndatabase are not automatically dropped. See [HELP GRANT].\n\nIF EXISTS is used to prevent an error from occurring if the database\ndoes not exist.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-database.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-database.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,6,'MBREQUAL','MBREqual(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are the same.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,30,'TIMESTAMP FUNCTION','Syntax:\nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n\nWith a single argument, this function returns the date or datetime\nexpression expr as a datetime value. With two arguments, it adds the\ntime expression expr2 to the date or datetime expression expr1 and\nreturns the result as a datetime value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMP(\'2003-12-31\');\n -> \'2003-12-31 00:00:00\'\nmysql> SELECT TIMESTAMP(\'2003-12-31 12:00:00\',\'12:00:00\');\n -> \'2004-01-01 00:00:00\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
@@ -322,7 +322,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,20,'VARCHAR','[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,535. The effective maximum length\nof a VARCHAR is subject to the maximum row size (65,535 bytes, which is\nshared among all columns) and the character set used. For example, utf8\ncharacters can require up to three bytes per character, so a VARCHAR\ncolumn that uses the utf8 character set can be declared to be a maximum\nof 21,844 characters.\n\nMySQL stores VARCHAR values as a one-byte or two-byte length prefix\nplus data. The length prefix indicates the number of bytes in the\nvalue. A VARCHAR column uses one length byte if values require no more\nthan 255 bytes, two length bytes if values may require more than 255\nbytes.\n\n*Note*: MySQL 5.1 follows the standard SQL specification, and does not\nremove trailing spaces from VARCHAR values.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the\nstandard SQL way to define that a VARCHAR column should use some\npredefined character set. MySQL 4.1 and up uses utf8 as this predefined\ncharacter set.\nhttp://dev.mysql.com/doc/refman/5.1/en/charset-national.html. NVARCHAR\nis shorthand for NATIONAL VARCHAR.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,35,'UNHEX','Syntax:\n\nUNHEX(str)\n\nPerforms the inverse operation of HEX(str). That is, it interprets each\npair of hexadecimal digits in the argument as a number and converts it\nto the character represented by the number. The resulting characters\nare returned as a binary string.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT UNHEX(\'4D7953514C\');\n -> \'MySQL\'\nmysql> SELECT 0x4D7953514C;\n -> \'MySQL\'\nmysql> SELECT UNHEX(HEX(\'string\'));\n -> \'string\'\nmysql> SELECT HEX(UNHEX(\'1267\'));\n -> \'1267\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,4,'- UNARY','Syntax:\n-\n\nUnary minus. This operator changes the sign of the argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT - 2;\n -> -2\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,22,'SELECT INTO','Syntax:\nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n\nSELECT ... INTO syntax enables selected columns to be stored directly\ninto variables. The query should return a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No data), and\nthe variable values remain unchanged. If the query returns multiple\nrows, error 1172 occurs (Result consisted of more than one row). If it\nis possible that the statement may retrieve multiple rows, you can use\nLIMIT 1 to limit the result set to a single row.\n\nIn the context of such statements that occur as part of events executed\nby the Event Scheduler, diagnostics messages (not only errors, but also\nwarnings) are written to the error log, and, on Windows, to the\napplication event log. For additional information, see\nhttp://dev.mysql.com/doc/refman/5.1/en/events-status-info.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html\n\n','SELECT id,data INTO x,y FROM test.t1 LIMIT 1;\n','http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,22,'SELECT INTO','Syntax:\nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n\nSELECT ... INTO syntax enables selected columns to be stored directly\ninto variables. The query should return a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No data), and\nthe variable values remain unchanged. If the query returns multiple\nrows, error 1172 occurs (Result consisted of more than one row). If it\nis possible that the statement may retrieve multiple rows, you can use\nLIMIT 1 to limit the result set to a single row.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html\n\n','SELECT id,data INTO x,y FROM test.t1 LIMIT 1;\n','http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,16,'STD','Syntax:\nSTD(expr)\n\nReturns the population standard deviation of expr. This is an extension\nto standard SQL. The standard SQL function STDDEV_POP() can be used\ninstead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,4,'COS','Syntax:\nCOS(X)\n\nReturns the cosine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT COS(PI());\n -> -1\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,30,'DATE FUNCTION','Syntax:\nDATE(expr)\n\nExtracts the date part of the date or datetime expression expr.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DATE(\'2003-12-31 01:02:03\');\n -> \'2003-12-31\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
@@ -384,7 +384,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (315,15,'FOUND_ROWS','Syntax:\nFOUND_ROWS()\n\nA SELECT statement may include a LIMIT clause to restrict the number of\nrows the server returns to the client. In some cases, it is desirable\nto know how many rows the statement would have returned without the\nLIMIT, but without running the statement again. To obtain this row\ncount, include a SQL_CALC_FOUND_ROWS option in the SELECT statement,\nand then invoke FOUND_ROWS() afterward:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name\n -> WHERE id > 100 LIMIT 10;\nmysql> SELECT FOUND_ROWS();\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (316,15,'SYSTEM_USER','Syntax:\nSYSTEM_USER()\n\nSYSTEM_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (317,29,'CROSSES','Crosses(g1,g2)\n\nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon\nor a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\no The two geometries intersect\n\no Their intersection results in a geometry that has a dimension that is\n one less than the maximum dimension of the two given geometries\n\no Their intersection is not equal to either of the two given geometries\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relation…','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relation…');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,26,'TRUNCATE TABLE','Syntax:\nTRUNCATE [TABLE] tbl_name\n\nTRUNCATE TABLE empties a table completely. Logically, this is\nequivalent to a DELETE statement that deletes all rows, but there are\npractical differences under some circumstances.\n\nFor an InnoDB table, InnoDB processes TRUNCATE TABLE by deleting rows\none by one if there are any FOREIGN KEY constraints that reference the\ntable. If there are no FOREIGN KEY constraints, InnoDB performs fast\ntruncation by dropping the original table and creating an empty one\nwith the same definition, which is much faster than deleting rows one\nby one. The AUTO_INCREMENT counter is reset by TRUNCATE TABLE,\nregardless of whether there is a FOREIGN KEY constraint.\n\nIn the case that FOREIGN KEY constraints reference the table, InnoDB\ndeletes rows one by one and processes the constraints on each one. If\nthe FOREIGN KEY constraint specifies DELETE CASCADE, rows from the\nchild (referenced) table are deleted, and the truncated table becomes\nempty. If the FOREIGN KEY constraint does not specify CASCADE, the\nTRUNCATE statement deletes rows one by one and stops if it encounters a\nparent row that is referenced by the child, returning this error:\n\nERROR 1451 (23000): Cannot delete or update a parent row: a foreign\nkey constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1`\nFOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))\n\nThis is the same as a DELETE statement with no WHERE clause.\n\nBeginning with MySQL 5.1.32, TRUNCATE is treated for purposes of binary\nlogging and replication as DROP TABLE followed by CREATE TABLE --- that\nis, as DDL rather than DML. This is due to the fact that, when using\nInnoDB and other transactional storage engines where the transaction\nisolation level does not allow for statement-based logging (READ\nCOMMITTED or READ UNCOMMITTED), the statement was not logged and\nreplicated when using STATEMENT or MIXED logging mode. (Bug#36763\n(http://bugs.mysql.com/36763)) However, it is still applied on\nreplication slaves using InnoDB in the manner described previously.\n\nThe count of rows affected by TRUNCATE TABLE is accurate only when it\nis mapped to a DELETE statement.\n\nFor other storage engines, TRUNCATE TABLE differs from DELETE in the\nfollowing ways in MySQL 5.1:\n\no Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n\no Truncate operations cause an implicit commit.\n\no Truncation operations cannot be performed if the session holds an\n active table lock.\n\no Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is "0 rows affected," which should\n be interpreted as "no information."\n\no As long as the table format file tbl_name.frm is valid, the table can\n be re-created as an empty table with TRUNCATE TABLE, even if the data\n or index files have become corrupted.\n\no The table handler does not remember the last used AUTO_INCREMENT\n value, but starts counting from the beginning. This is true even for\n MyISAM and InnoDB, which normally do not reuse sequence values.\n\no When used with partitioned tables, TRUNCATE TABLE preserves the\n partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n\no Since truncation of a table does not make any use of DELETE, the\n TRUNCATE statement does not invoke ON DELETE triggers.\n\nTRUNCATE TABLE requires the DROP privilege as of MySQL 5.1.16. (Before\n5.1.16, it requires the DELETE privilege.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/truncate.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/truncate.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,26,'TRUNCATE TABLE','Syntax:\nTRUNCATE [TABLE] tbl_name\n\nTRUNCATE TABLE empties a table completely. It requires the DROP\nprivilege as of MySQL 5.1.16. (Before 5.1.16, it requires the DELETE\nprivilege.\n\nLogically, TRUNCATE TABLE is equivalent to a DELETE statement that\ndeletes all rows, but there are practical differences under some\ncircumstances.\n\nFor an InnoDB table, InnoDB processes TRUNCATE TABLE by deleting rows\none by one if there are any FOREIGN KEY constraints that reference the\ntable. If there are no FOREIGN KEY constraints, InnoDB performs fast\ntruncation by dropping the original table and creating an empty one\nwith the same definition, which is much faster than deleting rows one\nby one. The AUTO_INCREMENT counter is reset by TRUNCATE TABLE,\nregardless of whether there is a FOREIGN KEY constraint.\n\nIn the case that FOREIGN KEY constraints reference the table, InnoDB\ndeletes rows one by one and processes the constraints on each one. If\nthe FOREIGN KEY constraint specifies DELETE CASCADE, rows from the\nchild (referenced) table are deleted, and the truncated table becomes\nempty. If the FOREIGN KEY constraint does not specify CASCADE, the\nTRUNCATE statement deletes rows one by one and stops if it encounters a\nparent row that is referenced by the child, returning this error:\n\nERROR 1451 (23000): Cannot delete or update a parent row: a foreign\nkey constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1`\nFOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))\n\nThis is the same as a DELETE statement with no WHERE clause.\n\nThe count of rows affected by TRUNCATE TABLE is accurate only when it\nis mapped to a DELETE statement.\n\nFor other storage engines, TRUNCATE TABLE differs from DELETE in the\nfollowing ways in MySQL 5.1:\n\no Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n\no Truncate operations cause an implicit commit.\n\no Truncation operations cannot be performed if the session holds an\n active table lock.\n\no Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is "0 rows affected," which should\n be interpreted as "no information."\n\no As long as the table format file tbl_name.frm is valid, the table can\n be re-created as an empty table with TRUNCATE TABLE, even if the data\n or index files have become corrupted.\n\no The table handler does not remember the last used AUTO_INCREMENT\n value, but starts counting from the beginning. This is true even for\n MyISAM and InnoDB, which normally do not reuse sequence values.\n\no When used with partitioned tables, TRUNCATE TABLE preserves the\n partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n\no Since truncation of a table does not make any use of DELETE, the\n TRUNCATE statement does not invoke ON DELETE triggers.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/truncate.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/truncate.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (319,16,'BIT_XOR','Syntax:\nBIT_XOR(expr)\n\nReturns the bitwise XOR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (320,30,'CURRENT_DATE','Syntax:\nCURRENT_DATE, CURRENT_DATE()\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (321,25,'START SLAVE','Syntax:\nSTART SLAVE [thread_type [, thread_type] ... ]\nSTART SLAVE [SQL_THREAD] UNTIL\n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos\nSTART SLAVE [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos\n\nthread_type: IO_THREAD | SQL_THREAD\n\nSTART SLAVE with no thread_type options starts both of the slave\nthreads. The I/O thread reads queries from the master server and stores\nthem in the relay log. The SQL thread reads the relay log and executes\nthe queries. START SLAVE requires the SUPER privilege.\n\nIf START SLAVE succeeds in starting the slave threads, it returns\nwithout any error. However, even in that case, it might be that the\nslave threads start and then later stop (for example, because they do\nnot manage to connect to the master or read its binary logs, or some\nother problem). START SLAVE does not warn you about this. You must\ncheck the slave\'s error log for error messages generated by the slave\nthreads, or check that they are running satisfactorily with SHOW SLAVE\nSTATUS.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/start-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/start-slave.html');
@@ -410,7 +410,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,22,'LOOP','Syntax:\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nLOOP implements a simple loop construct, enabling repeated execution of\nthe statement list, which consists of one or more statements, each\nterminated by a semicolon (;) statement delimiter. The statements\nwithin the loop are repeated until the loop is exited; usually this is\naccomplished with a LEAVE statement.\n\nA LOOP statement can be labeled. end_label cannot be given unless\nbegin_label also is present. If both are present, they must be the\nsame.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/loop-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/loop-statement.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,4,'TRUNCATE','Syntax:\nTRUNCATE(X,D)\n\nReturns the number X, truncated to D decimal places. If D is 0, the\nresult has no decimal point or fractional part. D can be negative to\ncause D digits left of the decimal point of the value X to become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT TRUNCATE(1.223,1);\n -> 1.2\nmysql> SELECT TRUNCATE(1.999,1);\n -> 1.9\nmysql> SELECT TRUNCATE(1.999,0);\n -> 1\nmysql> SELECT TRUNCATE(-1.999,1);\n -> -1.9\nmysql> SELECT TRUNCATE(122,-2);\n -> 100\nmysql> SELECT TRUNCATE(10.28*100,0);\n -> 1028\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,30,'TIMESTAMPADD','Syntax:\nTIMESTAMPADD(unit,interval,datetime_expr)\n\nAdds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument,\nwhich should be one of the following values: FRAC_SECOND\n(microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or\nYEAR.\n\nBeginning with MySQL 5.1.24, it is possible to use MICROSECOND in place\nof FRAC_SECOND with this function, and FRAC_SECOND is deprecated.\n\nThe unit value may be specified using one of keywords as shown, or with\na prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMPADD(MINUTE,1,\'2003-01-02\');\n -> \'2003-01-02 00:01:00\'\nmysql> SELECT TIMESTAMPADD(WEEK,1,\'2003-01-02\');\n -> \'2003-01-09\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,25,'SHOW','SHOW has many forms that provide information about databases, tables,\ncolumns, or status information about the server. This section describes\nthose following:\n\nSHOW AUTHORS\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE FUNCTION func_name\nSHOW CREATE PROCEDURE proc_name\nSHOW CREATE TABLE tbl_name\nSHOW CREATE TRIGGER trigger_name\nSHOW CREATE VIEW view_name\nSHOW DATABASES [like_or_where]\nSHOW ENGINE engine_name {STATUS | MUTEX}\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW [FULL] EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW INNODB STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW SCHEDULER STATUS\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW TABLES [FROM db_name] [like_or_where]\nSHOW TRIGGERS [FROM db_name] [like_or_where]\nSHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\nSHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\'\npart, \'pattern\' is a string that can contain the SQL "%" and "_"\nwildcard characters. The pattern is useful for restricting statement\noutput to matching values.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,25,'SHOW','SHOW has many forms that provide information about databases, tables,\ncolumns, or status information about the server. This section describes\nthose following:\n\nSHOW AUTHORS\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE FUNCTION func_name\nSHOW CREATE PROCEDURE proc_name\nSHOW CREATE TABLE tbl_name\nSHOW CREATE TRIGGER trigger_name\nSHOW CREATE VIEW view_name\nSHOW DATABASES [like_or_where]\nSHOW ENGINE engine_name {STATUS | MUTEX}\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW INNODB STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW SCHEDULER STATUS\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW TABLES [FROM db_name] [like_or_where]\nSHOW TRIGGERS [FROM db_name] [like_or_where]\nSHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\nSHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\'\npart, \'pattern\' is a string that can contain the SQL "%" and "_"\nwildcard characters. The pattern is useful for restricting statement\noutput to matching values.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,17,'GREATEST','Syntax:\nGREATEST(value1,value2,...)\n\nWith two or more arguments, returns the largest (maximum-valued)\nargument. The arguments are compared using the same rules as for\nLEAST().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT GREATEST(2,0);\n -> 2\nmysql> SELECT GREATEST(34.0,3.0,5.0,767.0);\n -> 767.0\nmysql> SELECT GREATEST(\'B\',\'A\',\'C\');\n -> \'C\'\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,25,'SHOW VARIABLES','Syntax:\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW VARIABLES shows the values of MySQL system variables. This\ninformation also can be obtained using the mysqladmin variables\ncommand. The LIKE clause, if present, indicates which variable names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html. This\nstatement does not require any privilege. It requires only the ability\nto connect to the server.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are\nused for new connections to MySQL. With SESSION, it displays the values\nthat are in effect for the current connection. If no modifier is\npresent, the default is SESSION. LOCAL is a synonym for SESSION.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern. To obtain the row for a\nspecific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'max_join_size\';\nSHOW SESSION VARIABLES LIKE \'max_join_size\';\n\nTo get a list of variables whose name match a pattern, use the "%"\nwildcard character in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%size%\';\nSHOW GLOBAL VARIABLES LIKE \'%size%\';\n\nWildcard characters can be used in any position within the pattern to\nbe matched. Strictly speaking, because "_" is a wildcard that matches\nany single character, you should escape it as "\\_" to match it\nliterally. In practice, this is rarely necessary.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-variables.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-variables.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,25,'BINLOG','Syntax:\nBINLOG \'str\'\n\nBINLOG is an internal-use statement. It is generated by the mysqlbinlog\nprogram as the printable representation of certain events in binary log\nfiles. (See http://dev.mysql.com/doc/refman/5.1/en/mysqlbinlog.html.)\nThe \'str\' value is a base 64-encoded string the that server decodes to\ndetermine the data change indicated by the corresponding event. This\nstatement requires the SUPER privilege. It was added in MySQL 5.1.5.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/binlog.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/binlog.html');
@@ -419,7 +419,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,4,'ATAN2','Syntax:\nATAN(Y,X), ATAN2(Y,X)\n\nReturns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both\narguments are used to determine the quadrant of the result.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ATAN(-2,2);\n -> -0.78539816339745\nmysql> SELECT ATAN2(PI(),0);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,6,'MBRCONTAINS','MBRContains(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\ncontains the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','mysql> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nmysql> SET @g2 = GeomFromText(\'Point(1 1)\');\nmysql> SELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,30,'HOUR','Syntax:\nHOUR(time)\n\nReturns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much\nlarger, so HOUR can return values greater than 23.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT HOUR(\'10:05:03\');\n -> 10\nmysql> SELECT HOUR(\'272:59:59\');\n -> 272\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SELECT','Syntax:\nSELECT\n [ALL | DISTINCT | DISTINCTROW ]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr [, select_expr ...]\n [FROM table_references\n [WHERE where_condition]\n [GROUP BY {col_name | expr | position}\n [ASC | DESC], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position}\n [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\' export_options\n | INTO DUMPFILE \'file_name\'\n | INTO var_name [, var_name]]\n [FOR UPDATE | LOCK IN SHARE MODE]]\n\nSELECT is used to retrieve rows selected from one or more tables, and\ncan include UNION statements and subqueries. See [HELP UNION], and\nhttp://dev.mysql.com/doc/refman/5.1/en/subqueries.html.\n\nThe most commonly used clauses of SELECT statements are these:\n\no Each select_expr indicates a column that you want to retrieve. There\n must be at least one select_expr.\n\no table_references indicates the table or tables from which to retrieve\n rows. Its syntax is described in [HELP JOIN].\n\no The WHERE clause, if given, indicates the condition or conditions\n that rows must satisfy to be selected. where_condition is an\n expression that evaluates to true for each row to be selected. The\n statement selects all rows if there is no WHERE clause.\n\n In the WHERE clause, you can use any of the functions and operators\n that MySQL supports, except for aggregate (summary) functions. See\n http://dev.mysql.com/doc/refman/5.1/en/functions.html.\n\nSELECT can also be used to retrieve rows computed without reference to\nany table.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/select.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SELECT','Syntax:\nSELECT\n [ALL | DISTINCT | DISTINCTROW ]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr [, select_expr ...]\n [FROM table_references\n [WHERE where_condition]\n [GROUP BY {col_name | expr | position}\n [ASC | DESC], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position}\n [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n export_options\n | INTO DUMPFILE \'file_name\'\n | INTO var_name [, var_name]]\n [FOR UPDATE | LOCK IN SHARE MODE]]\n\nSELECT is used to retrieve rows selected from one or more tables, and\ncan include UNION statements and subqueries. See [HELP UNION], and\nhttp://dev.mysql.com/doc/refman/5.1/en/subqueries.html.\n\nThe most commonly used clauses of SELECT statements are these:\n\no Each select_expr indicates a column that you want to retrieve. There\n must be at least one select_expr.\n\no table_references indicates the table or tables from which to retrieve\n rows. Its syntax is described in [HELP JOIN].\n\no The WHERE clause, if given, indicates the condition or conditions\n that rows must satisfy to be selected. where_condition is an\n expression that evaluates to true for each row to be selected. The\n statement selects all rows if there is no WHERE clause.\n\n In the WHERE clause, you can use any of the functions and operators\n that MySQL supports, except for aggregate (summary) functions. See\n http://dev.mysql.com/doc/refman/5.1/en/functions.html.\n\nSELECT can also be used to retrieve rows computed without reference to\nany table.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/select.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,4,'COT','Syntax:\nCOT(X)\n\nReturns the cotangent of X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT COT(12);\n -> -1.5726734063977\nmysql> SELECT COT(0);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,25,'SHOW CREATE EVENT','Syntax:\nSHOW CREATE EVENT event_name\n\nThis statement displays the CREATE EVENT statement needed to re-create\na given event. For example (using the same event e_daily defined and\nthen altered in [HELP SHOW EVENTS]):\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-event.html\n\n','mysql> SHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row ***************************\n Event: e_daily\n sql_mode:\n time_zone: SYSTEM\n Create Event: CREATE EVENT `e_daily`\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n ON COMPLETION NOT PRESERVE\n ENABLE\n COMMENT \'Saves total number of sessions then\n clears the table each day\'\n DO BEGIN\n INSERT INTO site_activity.totals (time, total)\n SELECT CURRENT_TIMESTAMP, COUNT(*)\n FROM site_activity.sessions;\n DELETE FROM site_activity.sessions;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.1/en/show-create-event.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,19,'BACKUP TABLE','Syntax:\nBACKUP TABLE tbl_name [, tbl_name] ... TO \'/path/to/backup/directory\'\n\n*Note*: This statement is deprecated. We are working on a better\nreplacement for it that will provide online backup capabilities. In the\nmeantime, the mysqlhotcopy script can be used instead.\n\nBACKUP TABLE copies to the backup directory the minimum number of table\nfiles needed to restore the table, after flushing any buffered changes\nto disk. The statement works only for MyISAM tables. It copies the .frm\ndefinition and .MYD data files. The .MYI index file can be rebuilt from\nthose two files. The directory should be specified as a full path name.\nTo restore the table, use RESTORE TABLE.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/backup-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/backup-table.html');
@@ -486,7 +486,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,35,'BIN','Syntax:\nBIN(N)\n\nReturns a string representation of the binary value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,2). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT BIN(12);\n -> \'1100\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,5,'INSTALL PLUGIN','Syntax:\nINSTALL PLUGIN plugin_name SONAME \'plugin_library\'\n\nThis statement installs a plugin.\n\nplugin_name is the name of the plugin as defined in the plugin\ndeclaration structure contained in the library file. Plugin names are\nnot case sensitive. For maximal compatibility, plugin names should be\nlimited to ASCII letters, digits, and underscore, because they are used\nin C source files, shell command lines, M4 and Bourne shell scripts,\nand SQL environments.\n\nplugin_library is the name of the shared library that contains the\nplugin code. The name includes the file name extension (for example,\nlibmyplugin.so or libmyplugin.dylib).\n\nThe shared library must be located in the plugin directory (that is,\nthe directory named by the plugin_dir system variable). The library\nmust be in the plugin directory itself, not in a subdirectory. By\ndefault, plugin_dir is plugin directory under the directory named by\nthe pkglibdir configuration variable, but it can be changed by setting\nthe value of plugin_dir at server startup. For example, set its value\nin a my.cnf file:\n\n[mysqld]\nplugin_dir=/path/to/plugin/directory\n\nIf the value of plugin_dir is a relative path name, it is taken to be\nrelative to the MySQL base directory (the value of the basedir system\nvariable).\n\nINSTALL PLUGIN adds a line to the mysql.plugin table that describes the\nplugin. This table contains the plugin name and library file name.\n\nAs of MySQL 5.1.33, INSTALL PLUGIN causes the server to read option\n(my.cnf) files just as during server startup. This enables the plugin\nto pick up any relevant options from those files. It is possible to add\nplugin options to an option file even before loading a plugin (if the\nloose prefix is used). It is also possible to uninstall a plugin, edit\nmy.cnf, and install the plugin again. Restarting the plugin this way\nenables it to the new option values without a server restart.\n\nBefore MySQL 5.1.33, a plugin is started with each option set to its\ndefault value.\n\nINSTALL PLUGIN also loads and initializes the plugin code to make the\nplugin available for use. A plugin is initialized by executing its\ninitialization function, which handles any setup that the plugin must\nperform before it can be used.\n\nTo use INSTALL PLUGIN, you must have the INSERT privilege for the\nmysql.plugin table.\n\nAt server startup, the server loads and initializes any plugin that is\nlisted in the mysql.plugin table. This means that a plugin is installed\nwith INSTALL PLUGIN only once, not every time the server starts. Plugin\nloading at startup does not occur if the server is started with the\n--skip-grant-tables option.\n\nWhen the server shuts down, it executes the deinitialization function\nfor each plugin that is loaded so that the plugin has a change to\nperform any final cleanup.\n\nFor options that control individual plugin loading at server startup,\nsee http://dev.mysql.com/doc/refman/5.1/en/server-plugin-options.html.\nIf you need to load plugins for a single server startup when the\n--skip-grant-tables option is given (which tells the server not to read\nsystem tables), use the --plugin-load option. See\nhttp://dev.mysql.com/doc/refman/5.1/en/server-options.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/install-plugin.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/install-plugin.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,22,'DECLARE CURSOR','Syntax:\nDECLARE cursor_name CURSOR FOR select_statement\n\nThis statement declares a cursor. Multiple cursors may be declared in a\nstored program, but each cursor in a given block must have a unique\nname.\n\nThe SELECT statement cannot have an INTO clause.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/declare-cursor.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/declare-cursor.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,26,'LOAD DATA','Syntax:\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD DATA INFILE statement reads rows from a text file into a table\nat a very high speed. The file name must be given as a literal string.\n\nLOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See\nhttp://dev.mysql.com/doc/refman/5.1/en/select.html.) To write data from\na table to a file, use SELECT ... INTO OUTFILE. To read the file back\ninto a table, use LOAD DATA INFILE. The syntax of the FIELDS and LINES\nclauses is the same for both statements. Both clauses are optional, but\nFIELDS must precede LINES if both are specified.\n\nFor more information about the efficiency of INSERT versus LOAD DATA\nINFILE and speeding up LOAD DATA INFILE, see\nhttp://dev.mysql.com/doc/refman/5.1/en/insert-speed.html.\n\nThe character set indicated by the character_set_database system\nvariable is used to interpret the information in the file. SET NAMES\nand the setting of character_set_client do not affect interpretation of\ninput. If the contents of the input file use a character set that\ndiffers from the default, it is usually preferable to specify the\ncharacter set of the file by using the CHARACTER SET clause, which is\navailable as of MySQL 5.1.17. A character set of binary specifies "no\nconversion."\n\nLOAD DATA INFILE interprets all fields in the file as having the same\ncharacter set, regardless of the data types of the columns into which\nfield values are loaded. For proper interpretation of file contents,\nyou must ensure that it was written with the correct character set. For\nexample, if you write a data file with mysqldump -T or by issuing a\nSELECT ... INTO OUTFILE statement in mysql, be sure to use a\n--default-character-set option with mysqldump or mysql so that output\nis written in the character set to be used when the file is loaded with\nLOAD DATA INFILE.\n\nNote that it is currently not possible to load data files that use the\nucs2, utf16, or utf32 character set.\n\nAs of MySQL 5.1.6, the character_set_filesystem system variable\ncontrols the interpretation of the file name.\n\nYou can also load data files by using the mysqlimport utility; it\noperates by sending a LOAD DATA INFILE statement to the server. The\n--local option causes mysqlimport to read data files from the client\nhost. You can specify the --compress option to get better performance\nover slow networks if the client and server support the compressed\nprotocol. See http://dev.mysql.com/doc/refman/5.1/en/mysqlimport.html.\n\nIf you use LOW_PRIORITY, execution of the LOAD DATA statement is\ndelayed until no other clients are reading from the table. This affects\nonly storage engines that use only table-level locking (MyISAM, MEMORY,\nMERGE).\n\nIf you specify CONCURRENT with a MyISAM table that satisfies the\ncondition for concurrent inserts (that is, it contains no free blocks\nin the middle), other threads can retrieve data from the table while\nLOAD DATA is executing. Using this option affects the performance of\nLOAD DATA a bit, even if no other thread is using the table at the same\ntime.\n\nCONCURRENT is not replicated when using statement-based replication;\nhowever, it is replicated when using row-based replication. See\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-features-load-data.…, for more information.\n\n*Note*: Prior to MySQL 5.1.23, LOAD DATA performed very poorly when\nimporting into partitioned tables. The statement now uses buffering to\nimprove performance; however, the buffer uses 130 KB memory per\npartition to achieve this. (Bug#26527 (http://bugs.mysql.com/26527))\n\nThe LOCAL keyword, if specified, is interpreted with respect to the\nclient end of the connection:\n\no If LOCAL is specified, the file is read by the client program on the\n client host and sent to the server. The file can be given as a full\n path name to specify its exact location. If given as a relative path\n name, the name is interpreted relative to the directory in which the\n client program was started.\n\no If LOCAL is not specified, the file must be located on the server\n host and is read directly by the server. The server uses the\n following rules to locate the file:\n\n o If the file name is an absolute path name, the server uses it as\n given.\n\n o If the file name is a relative path name with one or more leading\n components, the server searches for the file relative to the\n server\'s data directory.\n\n o If a file name with no leading components is given, the server\n looks for the file in the database directory of the default\n database.\n\nNote that, in the non-LOCAL case, these rules mean that a file named as\n./myfile.txt is read from the server\'s data directory, whereas the file\nnamed as myfile.txt is read from the database directory of the default\ndatabase. For example, if db1 is the default database, the following\nLOAD DATA statement reads the file data.txt from the database directory\nfor db1, even though the statement explicitly loads the file into a\ntable in the db2 database:\n\nLOAD DATA INFILE \'data.txt\' INTO TABLE db2.my_table;\n\nWindows path names are specified using forward slashes rather than\nbackslashes. If you do use backslashes, you must double them.\n\nFor security reasons, when reading text files located on the server,\nthe files must either reside in the database directory or be readable\nby all. Also, to use LOAD DATA INFILE on server files, you must have\nthe FILE privilege. See\nhttp://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html. For\nnon-LOCAL load operations, if the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/load-data.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/load-data.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,26,'LOAD DATA','Syntax:\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD DATA INFILE statement reads rows from a text file into a table\nat a very high speed. The file name must be given as a literal string.\n\nLOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See\nhttp://dev.mysql.com/doc/refman/5.1/en/select.html.) To write data from\na table to a file, use SELECT ... INTO OUTFILE. To read the file back\ninto a table, use LOAD DATA INFILE. The syntax of the FIELDS and LINES\nclauses is the same for both statements. Both clauses are optional, but\nFIELDS must precede LINES if both are specified.\n\nFor more information about the efficiency of INSERT versus LOAD DATA\nINFILE and speeding up LOAD DATA INFILE, see\nhttp://dev.mysql.com/doc/refman/5.1/en/insert-speed.html.\n\nThe character set indicated by the character_set_database system\nvariable is used to interpret the information in the file. SET NAMES\nand the setting of character_set_client do not affect interpretation of\ninput. If the contents of the input file use a character set that\ndiffers from the default, it is usually preferable to specify the\ncharacter set of the file by using the CHARACTER SET clause, which is\navailable as of MySQL 5.1.17. A character set of binary specifies "no\nconversion."\n\nLOAD DATA INFILE interprets all fields in the file as having the same\ncharacter set, regardless of the data types of the columns into which\nfield values are loaded. For proper interpretation of file contents,\nyou must ensure that it was written with the correct character set. For\nexample, if you write a data file with mysqldump -T or by issuing a\nSELECT ... INTO OUTFILE statement in mysql, be sure to use a\n--default-character-set option with mysqldump or mysql so that output\nis written in the character set to be used when the file is loaded with\nLOAD DATA INFILE.\n\nNote that it is currently not possible to load data files that use the\nucs2, utf16, or utf32 character set.\n\nAs of MySQL 5.1.6, the character_set_filesystem system variable\ncontrols the interpretation of the file name.\n\nYou can also load data files by using the mysqlimport utility; it\noperates by sending a LOAD DATA INFILE statement to the server. The\n--local option causes mysqlimport to read data files from the client\nhost. You can specify the --compress option to get better performance\nover slow networks if the client and server support the compressed\nprotocol. See http://dev.mysql.com/doc/refman/5.1/en/mysqlimport.html.\n\nIf you use LOW_PRIORITY, execution of the LOAD DATA statement is\ndelayed until no other clients are reading from the table. This affects\nonly storage engines that use only table-level locking (MyISAM, MEMORY,\nMERGE).\n\nIf you specify CONCURRENT with a MyISAM table that satisfies the\ncondition for concurrent inserts (that is, it contains no free blocks\nin the middle), other threads can retrieve data from the table while\nLOAD DATA is executing. Using this option affects the performance of\nLOAD DATA a bit, even if no other thread is using the table at the same\ntime.\n\nCONCURRENT is not replicated when using statement-based replication;\nhowever, it is replicated when using row-based replication. See\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-features-load-data.…, for more information.\n\n*Note*: Prior to MySQL 5.1.23, LOAD DATA performed very poorly when\nimporting into partitioned tables. The statement now uses buffering to\nimprove performance; however, the buffer uses 130 KB memory per\npartition to achieve this. (Bug#26527 (http://bugs.mysql.com/26527))\n\nThe LOCAL keyword, if specified, is interpreted with respect to the\nclient end of the connection:\n\no If LOCAL is specified, the file is read by the client program on the\n client host and sent to the server. The file can be given as a full\n path name to specify its exact location. If given as a relative path\n name, the name is interpreted relative to the directory in which the\n client program was started.\n\no If LOCAL is not specified, the file must be located on the server\n host and is read directly by the server. The server uses the\n following rules to locate the file:\n\n o If the file name is an absolute path name, the server uses it as\n given.\n\n o If the file name is a relative path name with one or more leading\n components, the server searches for the file relative to the\n server\'s data directory.\n\n o If a file name with no leading components is given, the server\n looks for the file in the database directory of the default\n database.\n\nNote that, in the non-LOCAL case, these rules mean that a file named as\n./myfile.txt is read from the server\'s data directory, whereas the file\nnamed as myfile.txt is read from the database directory of the default\ndatabase. For example, if db1 is the default database, the following\nLOAD DATA statement reads the file data.txt from the database directory\nfor db1, even though the statement explicitly loads the file into a\ntable in the db2 database:\n\nLOAD DATA INFILE \'data.txt\' INTO TABLE db2.my_table;\n\nWindows path names are specified using forward slashes rather than\nbackslashes. If you do use backslashes, you must double them.\n\n*Note*: A regression in MySQL 5.1.40 caused the database referenced in\na fully qualified table name to be ignored by LOAD DATA when using\nreplication with either STATEMENT or MIXED as the binary logging\nformat; this could lead to problems if the table was not in the current\ndatabase. As a workaround, you can specify the correct database with\nthe USE statement prior to executing LOAD DATA. If necessary, you can\nreset the current database with a second USE statement following the\nLOAD DATA statement. This issue was fixed in MySQL 5.1.41. (Bug#48297\n(http://bugs.mysql.com/48297))\n\nFor security reasons, when reading text files located on the server,\nthe files must either reside in the database directory or be readable\nby all. Also, to use LOAD DATA INFILE on server files, you must have\nthe FILE privilege. See\nhttp://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html. For\nnon-LOCAL load operations, if the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/load-data.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/load-data.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,23,'MULTILINESTRING','MultiLineString(ls1,ls2,...)\n\nConstructs a MultiLineString value using LineString or WKB LineString\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mys…','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mys…');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,30,'LOCALTIME','Syntax:\nLOCALTIME, LOCALTIME()\n\nLOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,3,'MPOINTFROMTEXT','MPointFromText(wkt[,srid]), MultiPointFromText(wkt[,srid])\n\nConstructs a MULTIPOINT value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt…','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt…');
@@ -497,7 +497,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,20,'CHAR','[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA fixed-length string that is always right-padded with spaces to the\nspecified length when stored. M represents the column length in\ncharacters. The range of M is 0 to 255. If M is omitted, the length is\n1.\n\n*Note*: Trailing spaces are removed when CHAR values are retrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,30,'UTC_DATE','Syntax:\nUTC_DATE, UTC_DATE()\n\nReturns the current UTC date as a value in \'YYYY-MM-DD\' or YYYYMMDD\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_DATE(), UTC_DATE() + 0;\n -> \'2003-08-14\', 20030814\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,34,'DIMENSION','Dimension(g)\n\nReturns the inherent dimension of the geometry value g. The result can\nbe -1, 0, 1, or 2. The meaning of these values is given in\nhttp://dev.mysql.com/doc/refman/5.1/en/gis-class-geometry.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#gen…','mysql> SELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#gen…');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,16,'COUNT DISTINCT','Syntax:\nCOUNT(DISTINCT expr,[expr...])\n\nReturns a count of the number of different non-NULL values.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT COUNT(DISTINCT results) FROM student;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,16,'COUNT DISTINCT','Syntax:\nCOUNT(DISTINCT expr,[expr...])\n\nReturns a count of the number of rows with different non-NULL expr\nvalues.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT COUNT(DISTINCT results) FROM student;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,20,'BIT','BIT[(M)]\n\nA bit-field type. M indicates the number of bits per value, from 1 to\n64. The default is 1 if M is omitted.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,29,'EQUALS','Equals(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relation…','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relation…');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,25,'SHOW CREATE VIEW','Syntax:\nSHOW CREATE VIEW view_name\n\nThis statement shows a CREATE VIEW statement that creates the given\nview.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-view.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-create-view.html');
@@ -532,7 +532,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,37,'MERGE','The MERGE storage engine, also known as the MRG_MyISAM engine, is a\ncollection of identical MyISAM tables that can be used as one.\n"Identical" means that all tables have identical column and index\ninformation. You cannot merge MyISAM tables in which the columns are\nlisted in a different order, do not have exactly the same columns, or\nhave the indexes in different order. However, any or all of the MyISAM\ntables can be compressed with myisampack. See\nhttp://dev.mysql.com/doc/refman/5.1/en/myisampack.html. Differences in\ntable options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS do not\nmatter.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/merge-storage-engine.html\n\n','mysql> CREATE TABLE t1 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> CREATE TABLE t2 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> INSERT INTO t1 (message) VALUES (\'Testing\'),(\'table\'),(\'t1\');\nmysql> INSERT INTO t2 (message) VALUES (\'Testing\'),(\'table\'),(\'t2\');\nmysql> CREATE TABLE total (\n -> a INT NOT NULL AUTO_INCREMENT,\n -> message CHAR(20), INDEX(a))\n -> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;\n','http://dev.mysql.com/doc/refman/5.1/en/merge-storage-engine.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,37,'CREATE TABLE','Syntax:\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n (create_definition,...)\n [table_options]\n [partition_options]\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)]\n [table_options]\n [partition_options]\n select_statement\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n { LIKE old_tbl_name | (LIKE old_tbl_name) }\n\ncreate_definition:\n col_name column_definition\n | [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n [index_option] ...\n | {INDEX|KEY} [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY]\n [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name,...) reference_definition\n | CHECK (expr)\n\ncolumn_definition:\n data_type [NOT NULL | NULL] [DEFAULT default_value]\n [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]\n [COMMENT \'string\']\n [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]\n [STORAGE {DISK|MEMORY|DEFAULT}]\n [reference_definition]\n\ndata_type:\n BIT[(length)]\n | TINYINT[(length)] [UNSIGNED] [ZEROFILL]\n | SMALLINT[(length)] [UNSIGNED] [ZEROFILL]\n | MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]\n | INT[(length)] [UNSIGNED] [ZEROFILL]\n | INTEGER[(length)] [UNSIGNED] [ZEROFILL]\n | BIGINT[(length)] [UNSIGNED] [ZEROFILL]\n | REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | NUMERIC[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | DATE\n | TIME\n | TIMESTAMP\n | DATETIME\n | YEAR\n | CHAR[(length)]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | VARCHAR(length)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | BINARY[(length)]\n | VARBINARY(length)\n | TINYBLOB\n | BLOB\n | MEDIUMBLOB\n | LONGBLOB\n | TINYTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | TEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | MEDIUMTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | LONGTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | ENUM(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | SET(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | spatial_type\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH | RTREE}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\ntable_options:\n table_option [[,] table_option] ...\n\ntable_option:\n ENGINE [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DEFAULT] CHARACTER SET [=] charset_name\n | CHECKSUM [=] {0 | 1}\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'string\'\n | CONNECTION [=] \'connect_string\'\n | DATA DIRECTORY [=] \'absolute path to directory\'\n | DELAY_KEY_WRITE [=] {0 | 1}\n | INDEX DIRECTORY [=] \'absolute path to directory\'\n | INSERT_METHOD [=] { NO | FIRST | LAST }\n | KEY_BLOCK_SIZE [=] value\n | MAX_ROWS [=] value\n | MIN_ROWS [=] value\n | PACK_KEYS [=] {0 | 1 | DEFAULT}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}\n | TABLESPACE tablespace_name [STORAGE {DISK|MEMORY|DEFAULT}]\n | UNION [=] (tbl_name[,tbl_name]...)\n\npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE(expr)\n | LIST(expr) }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\n\npartition_definition:\n PARTITION partition_name\n [VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\n\nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n\nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some legal select statement)\n\nCREATE TABLE creates a table with the given name. You must have the\nCREATE privilege for the table.\n\nRules for allowable table names are given in\nhttp://dev.mysql.com/doc/refman/5.1/en/identifiers.html. By default,\nthe table is created in the default database. An error occurs if the\ntable exists, if there is no default database, or if the database does\nnot exist.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-table.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,17,'>','Syntax:\n>\n\nGreater than:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 2 > 2;\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,19,'ANALYZE TABLE','Syntax:\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nANALYZE TABLE analyzes and stores the key distribution for a table.\nDuring the analysis, the table is locked with a read lock for MyISAM.\nFor InnoDB the table is locked with a write lock. This statement works\nwith MyISAM, and InnoDB tables. For MyISAM tables, this statement is\nequivalent to using myisamchk --analyze.\n\nFor more information on how the analysis works within InnoDB, see\nhttp://dev.mysql.com/doc/refman/5.1/en/innodb-restrictions.html.\n\nMy… uses the stored key distribution to decide the order in which\ntables should be joined when you perform a join on something other than\na constant. In addition, key distributions can be used when deciding\nwhich indexes to use for a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBeginning with MySQL 5.1.27, ANALYZE TABLE is also supported for\npartitioned tables. Also beginning with MySQL 5.1.27, you can use ALTER\nTABLE ... ANALYZE PARTITION to analyze one or more partitions; for more\ninformation, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.1/en/partitioning-maintenance.html.\…: http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,19,'ANALYZE TABLE','Syntax:\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nANALYZE TABLE analyzes and stores the key distribution for a table.\nDuring the analysis, the table is locked with a read lock for MyISAM.\nFor InnoDB the table is locked with a write lock. This statement works\nwith MyISAM and InnoDB tables. For MyISAM tables, this statement is\nequivalent to using myisamchk --analyze.\n\nFor more information on how the analysis works within InnoDB, see\nhttp://dev.mysql.com/doc/refman/5.1/en/innodb-restrictions.html.\n\nMy… uses the stored key distribution to decide the order in which\ntables should be joined when you perform a join on something other than\na constant. In addition, key distributions can be used when deciding\nwhich indexes to use for a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBeginning with MySQL 5.1.27, ANALYZE TABLE is also supported for\npartitioned tables. Also beginning with MySQL 5.1.27, you can use ALTER\nTABLE ... ANALYZE PARTITION to analyze one or more partitions; for more\ninformation, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.1/en/partitioning-maintenance.html.\…: http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,30,'MICROSECOND','Syntax:\nMICROSECOND(expr)\n\nReturns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MICROSECOND(\'12:00:00.123456\');\n -> 123456\nmysql> SELECT MICROSECOND(\'2009-12-31 23:59:59.000010\');\n -> 10\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,37,'CONSTRAINT','InnoDB supports foreign key constraints. The syntax for a foreign key\nconstraint definition in InnoDB looks like this:\n\n[CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name,...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\…','CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) ENGINE=INNODB;\n','http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,37,'CREATE SERVER','Syntax:\nCREATE SERVER server_name\n FOREIGN DATA WRAPPER wrapper_name\n OPTIONS (option [, option] ...)\n\noption:\n { HOST character-literal\n | DATABASE character-literal\n | USER character-literal\n | PASSWORD character-literal\n | SOCKET character-literal\n | OWNER character-literal\n | PORT numeric-literal }\n\nThis statement creates the definition of a server for use with the\nFEDERATED storage engine. The CREATE SERVER statement creates a new row\nwithin the servers table within the mysql database. This statement\nrequires the SUPER privilege.\n\nThe server_name should be a unique reference to the server. Server\ndefinitions are global within the scope of the server, it is not\npossible to qualify the server definition to a specific database.\nserver_name has a maximum length of 64 characters (names longer than 64\ncharacters are silently truncated), and is case insensitive. You may\nspecify the name as a quoted string.\n\nThe wrapper_name should be mysql, and may be quoted with single quotes.\nOther values for wrapper_name are not currently supported.\n\nFor each option you must specify either a character literal or numeric\nliteral. Character literals are UTF-8, support a maximum length of 64\ncharacters and default to a blank (empty) string. String literals are\nsilently truncated to 64 characters. Numeric literals must be a number\nbetween 0 and 9999, default value is 0.\n\n*Note*: Note that the OWNER option is currently not applied, and has no\neffect on the ownership or operation of the server connection that is\ncreated.\n\nThe CREATE SERVER statement creates an entry in the mysql.server table\nthat can later be used with the CREATE TABLE statement when creating a\nFEDERATED table. The options that you specify will be used to populate\nthe columns in the mysql.server table. The table columns are\nServer_name, Host, Db, Username, Password, Port and Socket.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-server.html\n\n','CREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'test\');\n','http://dev.mysql.com/doc/refman/5.1/en/create-server.html');
@@ -567,7 +567,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,4,'RADIANS','Syntax:\nRADIANS(X)\n\nReturns the argument X, converted from degrees to radians. (Note that\nπ radians equals 180 degrees.)\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT RADIANS(90);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (499,15,'COLLATION','Syntax:\nCOLLATION(str)\n\nReturns the collation of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT COLLATION(\'abc\');\n -> \'latin1_swedish_ci\'\nmysql> SELECT COLLATION(_utf8\'abc\');\n -> \'utf8_general_ci\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (500,17,'COALESCE','Syntax:\nCOALESCE(value,...)\n\nReturns the first non-NULL value in the list, or NULL if there are no\nnon-NULL values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT COALESCE(NULL,1);\n -> 1\nmysql> SELECT COALESCE(NULL,NULL,NULL);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,15,'VERSION','Syntax:\nVERSION()\n\nReturns a string that indicates the MySQL server version. The string\nuses the utf8 character set.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT VERSION();\n -> \'5.1.39-standard\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,15,'VERSION','Syntax:\nVERSION()\n\nReturns a string that indicates the MySQL server version. The string\nuses the utf8 character set.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT VERSION();\n -> \'5.1.41-standard\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (502,35,'MAKE_SET','Syntax:\nMAKE_SET(bits,str1,str2,...)\n\nReturns a set value (a string containing substrings separated by ","\ncharacters) consisting of the strings that have the corresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL\nvalues in str1, str2, ... are not appended to the result.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT MAKE_SET(1,\'a\',\'b\',\'c\');\n -> \'a\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\');\n -> \'hello,world\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\');\n -> \'hello\'\nmysql> SELECT MAKE_SET(0,\'a\',\'b\',\'c\');\n -> \'\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (503,35,'FIND_IN_SET','Syntax:\nFIND_IN_SET(str,strlist)\n\nReturns a value in the range of 1 to N if the string str is in the\nstring list strlist consisting of N substrings. A string list is a\nstring composed of substrings separated by "," characters. If the first\nargument is a constant string and the second is a column of type SET,\nthe FIND_IN_SET() function is optimized to use bit arithmetic. Returns\n0 if str is not in strlist or if strlist is the empty string. Returns\nNULL if either argument is NULL. This function does not work properly\nif the first argument contains a comma (",") character.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT FIND_IN_SET(\'b\',\'a,b,c,d\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
@@ -1293,6 +1293,7 @@ insert into help_relation (help_topic_id
insert into help_relation (help_topic_id,help_keyword_id) values (143,115);
insert into help_relation (help_topic_id,help_keyword_id) values (468,115);
insert into help_relation (help_topic_id,help_keyword_id) values (180,115);
+insert into help_relation (help_topic_id,help_keyword_id) values (353,115);
insert into help_relation (help_topic_id,help_keyword_id) values (420,115);
insert into help_relation (help_topic_id,help_keyword_id) values (473,115);
insert into help_relation (help_topic_id,help_keyword_id) values (197,116);
@@ -1550,11 +1551,12 @@ insert into help_relation (help_topic_id
insert into help_relation (help_topic_id,help_keyword_id) values (383,238);
insert into help_relation (help_topic_id,help_keyword_id) values (330,239);
insert into help_relation (help_topic_id,help_keyword_id) values (344,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (253,239);
insert into help_relation (help_topic_id,help_keyword_id) values (152,239);
insert into help_relation (help_topic_id,help_keyword_id) values (428,239);
insert into help_relation (help_topic_id,help_keyword_id) values (464,239);
+insert into help_relation (help_topic_id,help_keyword_id) values (253,239);
insert into help_relation (help_topic_id,help_keyword_id) values (209,239);
+insert into help_relation (help_topic_id,help_keyword_id) values (353,239);
insert into help_relation (help_topic_id,help_keyword_id) values (420,239);
insert into help_relation (help_topic_id,help_keyword_id) values (184,240);
insert into help_relation (help_topic_id,help_keyword_id) values (273,241);
=== modified file 'support-files/MacOSX/ReadMe.txt'
--- a/support-files/MacOSX/ReadMe.txt 2009-05-25 09:59:47 +0000
+++ b/support-files/MacOSX/ReadMe.txt 2009-12-01 07:24:05 +0000
@@ -1,5 +1,47 @@
-2.5. Installing MySQL on Mac OS X
+2.7. Installing MySQL on Mac OS X
+
+ MySQL for Mac OS X is available in a number of different forms:
+
+ * Native Package Installer format, which uses the native Mac OS
+ X installer to walk you through the installation of MySQL. For
+ more information, see Section 2.7.1, "Installing MySQL Using
+ the Installation Package." You can use the package installer
+ with Mac OS X 10.3 and later, and available for both PowerPC
+ and Intel architectures, and both 32-bit and 64-bit
+ architectures. There is no Universal Binary available using
+ the package installation method. The user you use to perform
+ the installation must have administrator privileges.
+
+ * Tar package format, which uses a file packaged using the Unix
+ tar and gzip commands. To use this method, you will need to
+ open a Terminal window. You do not need administrator
+ privileges using this method, as you can install the MySQL
+ server anywhere using this method. For more information on
+ using this method, you can use the generic instructions for
+ using a tarball, Section 2.2, "Installing MySQL from Generic
+ Binaries on Unix/Linux."You can use the package installer with
+ Mac OS X 10.3 and later, and available for both PowerPC and
+ Intel architectures, and both 32-bit and 64-bit architectures.
+ A Universal Binary, incorporating both Power PC and Intel
+ architectures and 32-bit and 64-bit binaries is available.
+ In addition to the core installation, the Package Installer
+ also includes Section 2.7.2, "Installing the MySQL Startup
+ Item" and Section 2.7.3, "Installing and Using the MySQL
+ Preference Pane," both of which simplify the management of
+ your installation.
+
+ * Mac OS X server includes a version of MySQL as standard. If
+ you want to use a more recent version than that supplied with
+ the Mac OS X server release, you can make use of the package
+ or tar formats. For more information on using the MySQL
+ bundled with Mac OS X, see Section 2.7.4, "Using MySQL on Mac
+ OS X Server."
+
+ For additional information on using MySQL on Mac OS X, see Section
+ 2.7.5, "MySQL Installation on Mac OS X Notes."
+
+2.7.1. Installing MySQL Using the Installation Package
You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
using a Mac OS X binary package in PKG format instead of the
@@ -11,8 +53,6 @@
first need to mount by double-clicking its icon in the Finder. It
should then mount the image and display its contents.
- To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
-
Note
Before proceeding with the installation, be sure to shut down all
@@ -20,144 +60,319 @@ Note
Application (on Mac OS X Server) or via mysqladmin shutdown on the
command line.
- To actually install the MySQL PKG file, double-click on the
- package icon. This launches the Mac OS X Package Installer, which
- guides you through the installation of MySQL.
+ When installing from the package version, you should also install
+ the MySQL Preference Pane, which will allow you to control the
+ startup and execution of your MySQL server from System
+ Preferences. For more information, see Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+ When installing using the package installer, the files are
+ installed into a directory within /usr/local matching the name of
+ the installation version and platform. For example, the installer
+ file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
+ /usr/local/mysql-5.1.39-osx10.5-x86_64 . The installation layout
+ of the directory is as shown in the following table:
+ Directory Contents of Directory
+ bin Client programs and the mysqld server
+ data Log files, databases
+ docs Manual in Info format
+ include Include (header) files
+ lib Libraries
+ man Unix manual pages
+ mysql-test MySQL test suite
+ scripts Contains the mysql_install_db script
+ share/mysql Error message files
+ sql-bench Benchmarks
+ support-files Scripts and sample configuration files
+ /tmp/mysql.sock The location of the MySQL Unix socket
+
+ During the package installer process, a symbolic link from
+ /usr/local/mysql to the version/platform specific directory
+ created during installation will be created automatically.
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQL installer package. It will be named
+ according to the version of MySQL you have downloaded. For
+ example, if you have downloaded MySQL 5.1.39, double-click
+ mysql-5.1.39-osx10.5-x86.pkg.
+
+ 3. You will be presented with the openin installer dialog. Click
+ Continue to begihn installation.
+ MySQL Package Installer: Step 1
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. If you have downloaded the community version of MySQL, you
+ will be shown a copy of the relevent GNU General Public
+ License. Click Continue .
+
+ 6. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Package Installer: Step 4
+
+ 7. You will be asked to confirm the details of the installation,
+ including the space required for the installation. To change
+ the drive on which the startup item is installed you can click
+ either Go Back or Change Install Location.... To install the
+ startup item, click Install.
- Due to a bug in the Mac OS X package installer, you may see this
- error message in the destination disk selection dialog:
-You cannot install this software on this disk. (null)
-
- If this error occurs, simply click the Go Back button once to
- return to the previous screen. Then click Continue to advance to
- the destination disk selection again, and you should be able to
- choose the destination disk correctly. We have reported this bug
- to Apple and it is investigating this problem.
-
- The Mac OS X PKG of MySQL installs itself into
- /usr/local/mysql-VERSION and also installs a symbolic link,
- /usr/local/mysql, that points to the new location. If a directory
- named /usr/local/mysql exists, it is renamed to
- /usr/local/mysql.bak first. Additionally, the installer creates
- the grant tables in the mysql database by executing
- mysql_install_db.
-
- The installation layout is similar to that of a tar file binary
- distribution; all MySQL binaries are located in the directory
- /usr/local/mysql/bin. The MySQL socket file is created as
- /tmp/mysql.sock by default. See Section 2.1.5, "Installation
- Layouts."
-
- MySQL installation requires a Mac OS X user account named mysql. A
- user account with this name should exist by default on Mac OS X
- 10.2 and up.
+ 8. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
- If you are running Mac OS X Server, a version of MySQL should
- already be installed. The following table shows the versions of
- MySQL that ship with Mac OS X Server versions.
- Mac OS X Server Version MySQL Version
- 10.2-10.2.2 3.23.51
- 10.2.3-10.2.6 3.23.53
- 10.3 4.0.14
- 10.3.2 4.0.16
- 10.4.0 4.1.10a
+ Once you have completed the basic installation, you must complete
+ the post-installation steps as specifed in Section 2.13,
+ "Post-Installation Setup and Testing."
- This manual section covers the installation of the official MySQL
- Mac OS X PKG only. Make sure to read Apple's help information
- about installing MySQL: Run the "Help View" application, select
- "Mac OS X Server" help, do a search for "MySQL," and read the item
- entitled "Installing MySQL."
-
- If you previously used Marc Liyanage's MySQL packages for Mac OS X
- from http://www.entropy.ch, you can simply follow the update
- instructions for packages using the binary installation layout as
- given on his pages.
-
- If you are upgrading from Marc's 3.23.x versions or from the Mac
- OS X Server version of MySQL to the official MySQL PKG, you also
- need to convert the existing MySQL privilege tables to the current
- format, because some new security privileges have been added. See
- Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL Upgrade."
-
- If you want MySQL to start automatically during system startup,
- you also need to install the MySQL Startup Item. It is part of the
- Mac OS X installation disk images as a separate installation
- package. Simply double-click the MySQLStartupItem.pkg icon and
- follow the instructions to install it. The Startup Item need be
- installed only once. There is no need to install it each time you
- upgrade the MySQL package later.
+ For convenience, you may also want to install the Section 2.7.2,
+ "Installing the MySQL Startup Item" and Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+2.7.2. Installing the MySQL Startup Item
+
+ The MySQL Installation Package includes a startup item that can be
+ used to automatically startup and shutdown MySQL during boot.
+
+ To install the MySQL Startup Item:
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQLStartItem.pkg file to start the
+ installation process.
+
+ 3. You will be presented with the Install MySQL Startup Item
+ dialog.
+ MySQL Startup Item Installer: Step 1
+ Click Continue to continue the installation process.
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Startup Item Installer: Step 3
+
+ 6. You will be asked to confirm the details of the installation.
+ To change the drive on which the startup item is installed you
+ can click either Go Back or Change Install Location.... To
+ install the startup item, click Install.
+
+ 7. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
+ MySQL Startup Item Installer: Step 5
The Startup Item for MySQL is installed into
- /Library/StartupItems/MySQLCOM. (Before MySQL 4.1.2, the location
- was /Library/StartupItems/MySQL, but that collided with the MySQL
- Startup Item installed by Mac OS X Server.) Startup Item
- installation adds a variable MYSQLCOM=-YES- to the system
- configuration file /etc/hostconfig. If you want to disable the
- automatic startup of MySQL, simply change this variable to
- MYSQLCOM=-NO-.
-
- On Mac OS X Server, the default MySQL installation uses the
- variable MYSQL in the /etc/hostconfig file. The MySQL Startup Item
- installer disables this variable by setting it to MYSQL=-NO-. This
- avoids boot time conflicts with the MYSQLCOM variable used by the
- MySQL Startup Item. However, it does not shut down a running MySQL
- server. You should do that yourself.
+ /Library/StartupItems/MySQLCOM. The Startup Item installation adds
+ a variable MYSQLCOM=-YES- to the system configuration file
+ /etc/hostconfig. If you want to disable the automatic startup of
+ MySQL, simply change this variable to MYSQLCOM=-NO-.
After the installation, you can start up MySQL by running the
following commands in a terminal window. You must have
administrator privileges to perform this task.
- If you have installed the Startup Item, use this command:
+ If you have installed the Startup Item, use this command to start
+ the server:
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
-(Enter your password, if necessary)
-(Press Control-D or enter "exit" to exit the shell)
- If you don't use the Startup Item, enter the following command
- sequence:
-shell> cd /usr/local/mysql
-shell> sudo ./bin/mysqld_safe
-(Enter your password, if necessary)
-(Press Control-Z)
-shell> bg
-(Press Control-D or enter "exit" to exit the shell)
+ You may be prompted for your password to complete the startup.
- You should be able to connect to the MySQL server, for example, by
- running /usr/local/mysql/bin/mysql.
+ If you have installed the Startup Item, use this command to stop
+ the server:
+shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
+
+ You may be prompted for your password to complete the shutdown.
+
+2.7.3. Installing and Using the MySQL Preference Pane
+
+ The MySQL Package installer disk image also includes a custom
+ MySQL Preference Pane that enables you to start, stop and control
+ automated startup during boot of your MySQL installation.
+
+ To install the MySQL Preference Pane:
+
+ 1. Download and open the MySQL package installer package, which
+ is provided on a disk image (.dmg). Double-click to open the
+ disk image, which includes the main MySQL installation
+ package, the MySQLStartupItem.pkg installation package, and
+ the MySQL.prefPane.
+
+ 2. Double click on MySQL.prefPane. The MySQL System Preferences
+ will open.
+
+ 3. If this is the first time you have installed the preference
+ pane, you will be asked to confirm installation and whether
+ you want to install the preference pane for all users, or only
+ the current user. To install the preference pane for all users
+ you will need administrator privileges. If necessary, you will
+ be prompted for the username and password for a user with
+ administrator privileges.
+
+ 4. If you already have the MySQL Preference Pane installed, you
+ will be asked to confirm whether you want to overwrite the
+ existing MySQL Preference Pane.
Note
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ The MySQL Preference Pane only starts and stops MySQL installation
+ installed from the MySQL package installation that have been
+ installed in the default location.
+
+ Once the MySQL Preference Pane has been installed, you can control
+ your MySQL server instance using the preference pane. To use the
+ preference pane, open the System Preferences... from the Apple
+ menu. Select the MySQL preference pane by clicking on the MySQL
+ logo within the Other section of the preference panes list.
+ MySQL Preference Pane
+
+ The MySQL Preference Pane shows the current status of the MySQL
+ server, showing stopped (in red) if the server is not running and
+ running (in green) if the server has already been started. The
+ preference pane will also show the current setting for whether the
+ MySQL server has been set to start up automatically.
+
+ * To start MySQL using the preference pane:
+ Click Start MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to start
+ the MySQL server.
+
+ * To stop MySQL using the preference pane:
+ Click Stop MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to
+ shutdown the MySQL server.
+
+ * To automatically start the MySQL server when the system boots:
+ Check the checkbox next to Automatically Start MySQL Server on
+ Startup.
+
+ * To disable the automatic starting of the MySQL server when the
+ system boots:
+ Uncheck the checkbox next to Automatically Start MySQL Server
+ on Startup.
+
+ You can close the System Preferences... once you have completed
+ your settings.
- You might want to add aliases to your shell's resource file to
- make it easier to access commonly used programs such as mysql and
- mysqladmin from the command line. The syntax for bash is:
+2.7.4. Using MySQL on Mac OS X Server
+
+ If you are running Mac OS X Server, a version of MySQL should
+ already be installed. The following table shows the versions of
+ MySQL that ship with Mac OS X Server versions.
+ Mac OS X Server Version MySQL Version
+ 10.2-10.2.2 3.23.51
+ 10.2.3-10.2.6 3.23.53
+ 10.3 4.0.14
+ 10.3.2 4.0.16
+ 10.4.0 4.1.10a
+ 10.5.0 5.0.45
+ 10.6.0 5.0.82
+
+ The installation layout of MySQL on Mac OS X Server is as shown in
+ the table below:
+ Directory Contents of Directory
+ /usr/bin Client programs
+ /var/mysql Log files, databases
+ /usr/libexec The mysqld server
+ /usr/share/man Unix manual pages
+ /usr/share/mysql/mysql-test MySQL test suite
+ /usr/share/mysql Contains the mysql_install_db script
+ /var/mysql/mysql.sock The location of the MySQL Unix socket
+
+Note
+
+ The MySQL server bundled with Mac OS X Server does not include the
+ MySQL client libraries and header files required if you want to
+ access and use MySQL from a third-party driver, such as Perl DBI
+ or PHP. For more information on obtaining and installing MySQL
+ libraries, see Mac OS X Server version 10.5: MySQL libraries
+ available for download (http://support.apple.com/kb/TA25017)
+ Alternatively, you can ignore the bundled MySQL server and install
+ MySQL from the package or tarball installation.
+
+ For more information on managing the bundled MySQL instance in Mac
+ OS X Server 10.5, see Mac OS X Server: Web Technologies
+ Administration For Version 10.5 Leopard
+ (http://images.apple.com/server/macosx/docs/Web_Technologies_Admin
+ _v10.5.pdf). For more information on managing the bundled MySQL
+ instance in Mac OS X Server 10.6, see Mac OS X Server: Web
+ Technologies Administration Version 10.6 Snow Leopard
+ (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf)
+
+2.7.5. MySQL Installation on Mac OS X Notes
+
+ You should keep the following issues and notes in mind:
+
+ * The default location for the MySQL Unix socket is different on
+ Mac OS X and Mac OS X Server depending on the installation
+ type you chose. The default locations by installation are as
+ follows:
+
+ Package Installer from MySQL /tmp/mysql.sock
+ Tarball from MySQL /tmp/mysql.sock
+ MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
+ To prevent issues, you should either change the configuration
+ of the socket used within your application (for example,
+ changing php.ini), or you should configure the socket location
+ using a MySQL configuration file and the socket option. For
+ more information, see Section 5.1.2, "Server Command Options."
+
+ * You may need (or want) to create a specific mysql user to own
+ the MySQL directory and data. On Mac OS X 10.4 and lower you
+ can do this by using the Netinfo Manager application, located
+ within the Utilities folder within the Applications folder. On
+ Mac OS X 10.5 and later you can do this through the Directory
+ Utility. From Mac OS X 10.5 and later (including Mac OS X
+ Server 10.5) the mysql should already exist. For use in single
+ user mode, an entry for _mysql (note the underscore prefix)
+ should already exist within the system /etc/passwd file.
+
+ * Due to a bug in the Mac OS X package installer, you may see
+ this error message in the destination disk selection dialog:
+You cannot install this software on this disk. (null)
+ If this error occurs, simply click the Go Back button once to
+ return to the previous screen. Then click Continue to advance
+ to the destination disk selection again, and you should be
+ able to choose the destination disk correctly. We have
+ reported this bug to Apple and it is investigating this
+ problem.
+
+ * Because the MySQL package installer installs the MySQL
+ contents into a version and platform specific directory, you
+ can use this to upgrade and migrate your database between
+ versions. You will need to either copy the data directory from
+ the old version to the new version, or alternatively specify
+ an alternative datadir value to set location of the data
+ directory.
+
+ * You might want to add aliases to your shell's resource file to
+ make it easier to access commonly used programs such as mysql
+ and mysqladmin from the command line. The syntax for bash is:
alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
-
- For tcsh, use:
+ For tcsh, use:
alias mysql /usr/local/mysql/bin/mysql
alias mysqladmin /usr/local/mysql/bin/mysqladmin
-
- Even better, add /usr/local/mysql/bin to your PATH environment
- variable. You can do this by modifying the appropriate startup
- file for your shell. For more information, see Section 4.2.1,
- "Invoking MySQL Programs."
-
- If you are upgrading an existing installation, note that
- installing a new MySQL PKG does not remove the directory of an
- older installation. Unfortunately, the Mac OS X Installer does not
- yet offer the functionality required to properly upgrade
- previously installed packages.
-
- To use your existing databases with the new installation, you'll
- need to copy the contents of the old data directory to the new
- data directory. Make sure that neither the old server nor the new
- one is running when you do this. After you have copied over the
- MySQL database files from the previous installation and have
- successfully started the new server, you should consider removing
- the old installation files to save disk space. Additionally, you
- should also remove older versions of the Package Receipt
- directories located in /Library/Receipts/mysql-VERSION.pkg.
+ Even better, add /usr/local/mysql/bin to your PATH environment
+ variable. You can do this by modifying the appropriate startup
+ file for your shell. For more information, see Section 4.2.1,
+ "Invoking MySQL Programs."
+
+ * After you have copied over the MySQL database files from the
+ previous installation and have successfully started the new
+ server, you should consider removing the old installation
+ files to save disk space. Additionally, you should also remove
+ older versions of the Package Receipt directories located in
+ /Library/Receipts/mysql-VERSION.pkg.
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2708)
by knielsen@knielsen-hq.org 01 Dec '09
by knielsen@knielsen-hq.org 01 Dec '09
01 Dec '09
#At lp:maria
2708 knielsen(a)knielsen-hq.org 2009-12-01
Imported MySQL documentation files from MySQL 5.1.41 source tarball
modified:
Docs/INSTALL-BINARY
INSTALL-SOURCE
INSTALL-WIN-SOURCE
man/comp_err.1
man/innochecksum.1
man/make_win_bin_dist.1
man/msql2mysql.1
man/my_print_defaults.1
man/myisam_ftdump.1
man/myisamchk.1
man/myisamlog.1
man/myisampack.1
man/mysql-stress-test.pl.1
man/mysql-test-run.pl.1
man/mysql.1
man/mysql.server.1
man/mysql_client_test.1
man/mysql_config.1
man/mysql_convert_table_format.1
man/mysql_find_rows.1
man/mysql_fix_extensions.1
man/mysql_fix_privilege_tables.1
man/mysql_install_db.1
man/mysql_secure_installation.1
man/mysql_setpermission.1
man/mysql_tzinfo_to_sql.1
man/mysql_upgrade.1
man/mysql_waitpid.1
man/mysql_zap.1
man/mysqlaccess.1
man/mysqladmin.1
man/mysqlbinlog.1
man/mysqlbug.1
man/mysqlcheck.1
man/mysqld.8
man/mysqld_multi.1
man/mysqld_safe.1
man/mysqldump.1
man/mysqldumpslow.1
man/mysqlhotcopy.1
man/mysqlimport.1
man/mysqlmanager.8
man/mysqlshow.1
man/mysqlslap.1
man/mysqltest.1
man/ndbd.8
man/ndbd_redo_log_reader.1
man/ndbmtd.8
man/perror.1
man/replace.1
man/resolve_stack_dump.1
man/resolveip.1
scripts/fill_help_tables.sql
support-files/MacOSX/ReadMe.txt
=== modified file 'Docs/INSTALL-BINARY'
--- a/Docs/INSTALL-BINARY 2009-09-16 12:03:18 +0000
+++ b/Docs/INSTALL-BINARY 2009-12-01 07:24:05 +0000
@@ -1,23 +1,35 @@
-2.9. Installing MySQL from tar.gz Packages on Other Unix-Like Systems
+2.2. Installing MySQL from Generic Binaries on Unix/Linux
This section covers the installation of MySQL binary distributions
that are provided for various platforms in the form of compressed
- tar files (files with a .tar.gz extension). See Section 2.1.2.4,
- "MySQL Binaries Compiled by Sun Microsystems, Inc.," for a
+ tar files (files with a .tar.gz extension). See Section 2.2,
+ "Installing MySQL from Generic Binaries on Unix/Linux," for a
detailed list.
To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
+ Sun Microsystems, Inc. provides a set of binary distributions of
+ MySQL. In addition to binaries provided in platform-specific
+ package formats, we offer binary distributions for a number of
+ platforms in the form of compressed tar files (.tar.gz files). For
+ Windows distributions, see Section 2.5, "Installing MySQL on
+ Windows."
+
+ If you want to compile a debug version of MySQL from a source
+ distribution, you should add --with-debug or --with-debug=full to
+ the configure command used to configure the distribution and
+ remove any -fomit-frame-pointer options.
+
MySQL tar file binary distributions have names of the form
mysql-VERSION-OS.tar.gz, where VERSION is a number (for example,
- 5.1.39), and OS indicates the type of operating system for which
+ 5.1.41), and OS indicates the type of operating system for which
the distribution is intended (for example, pc-linux-i686).
In addition to these generic packages, we also offer binaries in
- platform-specific package formats for selected platforms. See
- Section 2.2, "Standard MySQL Installation Using a Binary
- Distribution," for more information on how to install these.
+ platform-specific package formats for selected platforms. See the
+ platform specific sections for more information, for more
+ information on how to install these.
You need the following tools to install a MySQL tar file binary
distribution:
@@ -27,11 +39,13 @@
* A reasonable tar to unpack the distribution. GNU tar is known
to work. Some operating systems come with a preinstalled
version of tar that is known to have problems. For example,
- the tar provided with early versions of Mac OS X, SunOS 4.x
- and Solaris 8 and earlier are known to have problems with long
- file names. On Mac OS X, you can use the preinstalled gnutar
- program. On other systems with a deficient tar, you should
- install GNU tar first.
+ the tar provided with early versions of Mac OS X, SunOS 4.x,
+ Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
+ are known to have problems with long file names. On Mac OS X,
+ you can use the preinstalled gnutar program. On Solaris 10 and
+ OpenSolaris you can use the preinstalled gtar. On other
+ systems with a deficient tar, you should install GNU tar
+ first.
If you run into problems and need to file a bug report, please use
the instructions in Section 1.6, "How to Report Bugs or Problems."
@@ -54,7 +68,7 @@ shell> bin/mysqld_safe --user=mysql &
Note
This procedure does not set up any passwords for MySQL accounts.
- After following the procedure, proceed to Section 2.11,
+ After following the procedure, proceed to Section 2.13,
"Post-Installation Setup and Testing."
A more detailed version of the preceding description for
@@ -148,7 +162,7 @@ shell> chown -R mysql data
machine, you can copy support-files/mysql.server to the
location where your system has its startup files. More
information can be found in the support-files/mysql.server
- script itself and in Section 2.11.2.2, "Starting and Stopping
+ script itself and in Section 2.13.1.2, "Starting and Stopping
MySQL Automatically."
10. You can set up new accounts using the bin/mysql_setpermission
script if you install the DBI and DBD::mysql Perl modules. See
@@ -187,5 +201,5 @@ Note
The accounts that are listed in the MySQL grant tables initially
have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
+ passwords for them using the instructions in Section 2.13,
"Post-Installation Setup and Testing."
=== modified file 'INSTALL-SOURCE'
--- a/INSTALL-SOURCE 2009-09-16 12:03:18 +0000
+++ b/INSTALL-SOURCE 2009-12-01 07:24:05 +0000
@@ -5,9 +5,8 @@ Chapter 2. Installing and Upgrading MySQ
of the procedure follows and later sections provide the details.
If you plan to upgrade an existing version of MySQL to a newer
version rather than install MySQL for the first time, see Section
- 2.12.1, "Upgrading MySQL," for information about upgrade
- procedures and about issues that you should consider before
- upgrading.
+ 2.4.1, "Upgrading MySQL," for information about upgrade procedures
+ and about issues that you should consider before upgrading.
If you are interested in migrating to MySQL from another database
system, you may wish to read Section A.8, "MySQL 5.1 FAQ ---
@@ -15,96 +14,61 @@ Chapter 2. Installing and Upgrading MySQ
concerning migration issues.
1. Determine whether MySQL runs and is supported on your
- platform. Please note that not all platforms are equally
- suitable for running MySQL, and that not all platforms on
- which MySQL is known to run are officially supported by Sun
- Microsystems, Inc.:
-
- + For MySQL Enterprise Server, the officially supported
- platforms are listed at
- http://www.mysql.com/support/supportedplatforms.html.
-
- + MySQL Community Server runs on the platforms listed at
- Section 2.1.1, "Operating Systems Supported by MySQL
- Community Server."
-
- 2. Choose which distribution to install. Several versions of
- MySQL are available, and most are available in several
- distribution formats. You can choose from pre-packaged
- distributions containing binary (precompiled) programs or
- source code. When in doubt, use a binary distribution. We also
- provide public access to our current source tree for those who
- want to see our most recent developments and help us test new
- code. To determine which version and type of distribution you
- should use, see Section 2.1.2, "Choosing Which MySQL
- Distribution to Install."
-
- 3. Download the distribution that you want to install. For
- instructions, see Section 2.1.3, "How to Get MySQL." To verify
- the integrity of the distribution, use the instructions in
- Section 2.1.4, "Verifying Package Integrity Using MD5
+ platform.
+ Please note that not all platforms are equally suitable for
+ running MySQL, and that not all platforms on which MySQL is
+ known to run are officially supported by Sun Microsystems,
+ Inc.:
+
+ 2. Choose which distribution to install.
+ Several versions of MySQL are available, and most are
+ available in several distribution formats. You can choose from
+ pre-packaged distributions containing binary (precompiled)
+ programs or source code. When in doubt, use a binary
+ distribution. We also provide public access to our current
+ source tree for those who want to see our most recent
+ developments and help us test new code. To determine which
+ version and type of distribution you should use, see Section
+ 2.1.2, "Choosing Which MySQL Distribution to Install."
+
+ 3. Download the distribution that you want to install.
+ For instructions, see Section 2.1.3, "How to Get MySQL." To
+ verify the integrity of the distribution, use the instructions
+ in Section 2.1.4, "Verifying Package Integrity Using MD5
Checksums or GnuPG."
- 4. Install the distribution. To install MySQL from a binary
- distribution, use the instructions in Section 2.2, "Standard
- MySQL Installation Using a Binary Distribution." To install
- MySQL from a source distribution or from the current
- development source tree, use the instructions in Section 2.10,
- "MySQL Installation Using a Source Distribution."
- If you encounter installation difficulties, see Section 2.13,
- "Operating System-Specific Notes," for information on solving
- problems for particular platforms.
-
- 5. Perform any necessary post-installation setup. After
- installing MySQL, read Section 2.11, "Post-Installation Setup
- and Testing." This section contains important information
- about making sure the MySQL server is working properly. It
- also describes how to secure the initial MySQL user accounts,
- which have no passwords until you assign passwords. The
- section applies whether you install MySQL using a binary or
- source distribution.
+ 4. Install the distribution.
+ To install MySQL from a binary distribution, use the
+ instructions in Section 2.2, "Installing MySQL from Generic
+ Binaries on Unix/Linux."
+ To install MySQL from a source distribution or from the
+ current development source tree, use the instructions in
+ Section 2.3, "MySQL Installation Using a Source Distribution."
+
+ 5. Perform any necessary post-installation setup.
+ After installing MySQL, read Section 2.13, "Post-Installation
+ Setup and Testing." This section contains important
+ information about making sure the MySQL server is working
+ properly. It also describes how to secure the initial MySQL
+ user accounts, which have no passwords until you assign
+ passwords. The section applies whether you install MySQL using
+ a binary or source distribution.
6. If you want to run the MySQL benchmark scripts, Perl support
for MySQL must be available. See Section 2.15, "Perl
Installation Notes."
-2.1. General Installation Issues
-
- The MySQL installation procedure depends on whether you will
- install MySQL Enterprise Server or MySQL Community Server. The set
- of applicable platforms depends on which distribution you will
- install:
-
- * For MySQL Enterprise Server, the officially supported
- platforms are listed at
- http://www.mysql.com/support/supportedplatforms.html.
-
- * MySQL Community Server runs on the platforms listed at Section
- 2.1.1, "Operating Systems Supported by MySQL Community
- Server."
-
- For MySQL Enterprise Server, install the main distribution plus
- any service packs or hotfixes that you wish to apply using the
- Enterprise Installer. For platforms that do not yet have an
- Enterprise Installer, use the Community Server instructions.
-
- For MySQL Community Server, install the main distribution plus any
- hotfixes and updates:
-
- * Download a binary release, or download a source release and
- build MySQL yourself from the source code.
-
- * Retrieve MySQL from the Bazaar tree and build it from source.
- The Bazaar tree contains the latest developer code.
+2.1. General Installation Guidance
The immediately following sections contain the information
necessary to choose, download, and verify your distribution. The
instructions in later sections of the chapter describe how to
install the distribution that you choose. For binary
- distributions, see the instructions at Section 2.2, "Standard
- MySQL Installation Using a Binary Distribution." To build MySQL
- from source, use the instructions at Section 2.10, "MySQL
- Installation Using a Source Distribution."
+ distributions, see the instructions at Section 2.2, "Installing
+ MySQL from Generic Binaries on Unix/Linux" or the corresponding
+ section for your platform if available. To build MySQL from
+ source, use the instructions in Section 2.3, "MySQL Installation
+ Using a Source Distribution."
2.1.1. Operating Systems Supported by MySQL Community Server
@@ -129,58 +93,31 @@ Important
MySQL has been reported to compile successfully on the following
combinations of operating system and thread package.
- * AIX 4.x, 5.x with native threads. See Section 2.13.5.3,
- "IBM-AIX notes."
-
- * Amiga.
+ * AIX 4.x, 5.x with native threads. See Section 2.12,
+ "Installing MySQL on AIX." AIX 5.3 should be upgraded to
+ technology level 7 (5300-07).
- * FreeBSD 5.x and up with native threads.
+ * FreeBSD 5.x and up with native threads. See Section 2.10,
+ "Installing MySQL on FreeBSD."
- * HP-UX 11.x with the native threads. See Section 2.13.5.2,
- "HP-UX Version 11.x Notes."
+ * HP-UX 11.x with the native threads. See Section 2.11,
+ "Installing MySQL on HP-UX."
* Linux, builds on all fairly recent Linux distributions with
- glibc 2.3. See Section 2.13.1, "Linux Notes."
-
- * Mac OS X. See Section 2.13.2, "Mac OS X Notes."
-
- * NetBSD 1.3/1.4 Intel and NetBSD 1.3 Alpha. See Section
- 2.13.4.2, "NetBSD Notes."
+ glibc 2.3. See Section 2.6, "Installing MySQL on Linux."
- * Novell NetWare 6.0 and 6.5. See Section 2.8, "Installing MySQL
- on NetWare."
+ * Mac OS X. See Section 2.7, "Installing MySQL on Mac OS X."
- * OpenBSD 2.5 and with native threads. OpenBSD earlier than 2.5
- with the MIT-pthreads package. See Section 2.13.4.3, "OpenBSD
- 2.5 Notes."
-
- * SCO OpenServer 5.0.X with a recent port of the FSU Pthreads
- package. See Section 2.13.5.8, "SCO UNIX and OpenServer 5.0.x
- Notes."
-
- * SCO Openserver 6.0.x. See Section 2.13.5.9, "SCO OpenServer
- 6.0.x Notes."
-
- * SCO UnixWare 7.1.x. See Section 2.13.5.10, "SCO UnixWare 7.1.x
- and OpenUNIX 8.0.0 Notes."
-
- * SGI Irix 6.x with native threads. See Section 2.13.5.7, "SGI
- Irix Notes."
-
- * Solaris 2.5 and above with native threads on SPARC and x86.
- See Section 2.13.3, "Solaris Notes."
-
- * Tru64 Unix. See Section 2.13.5.5, "Alpha-DEC-UNIX Notes
- (Tru64)."
+ * Solaris 2.8 on SPARC and x86, including support for native
+ threads. See Section 2.8.1, "Solaris Notes."
* Windows 2000, Windows XP, Windows Vista, Windows Server 2003,
- and Windows Server 2008. See Section 2.3, "Installing MySQL on
+ and Windows Server 2008. See Section 2.5, "Installing MySQL on
Windows."
MySQL has also been known to run on other systems in the past. See
- Section 2.13, "Operating System-Specific Notes." Some porting
- effort might be required for current versions of MySQL on these
- systems.
+ Section 2.1, "General Installation Guidance." Some porting effort
+ might be required for current versions of MySQL on these systems.
Not all platforms are equally well-suited for running MySQL. How
well a certain platform is suited for a high-load mission-critical
@@ -208,8 +145,8 @@ Important
* General file system stability and performance.
* Table size. If your tables are large, performance is affected
- by the ability of the file system to deal with large files at
- all and to deal with them efficiently.
+ by the ability of the file system to deal with large files and
+ dealing with them efficiently.
* Our level of expertise here at Sun Microsystems, Inc. with the
platform. If we know a platform well, we enable
@@ -240,7 +177,7 @@ Important
development process, multiple release series co-exist, each at a
different stage of maturity:
- * MySQL 5.4 and 6.0 are the current development release series.
+ * MySQL 5.5 is the current development release series.
* MySQL 5.1 is the current General Availability (Production)
release series. New releases are issued for bugfixes only; no
@@ -255,9 +192,9 @@ Important
has ended.
Extended support for MySQL 4.1 remains available. According to
the MySQL Lifecycle Policy
- (http://www.mysql.com/company/legal/lifecycle/#policy) only
- Security and Severity Level 1 issues are still being fixed for
- MySQL 4.1.
+ (http://www.mysql.com/about/legal/lifecycle/) only Security
+ and Severity Level 1 issues are still being fixed for MySQL
+ 4.1.
We do not believe in a complete code freeze because this prevents
us from making bugfixes and other fixes that must be done. By
@@ -367,13 +304,13 @@ Important
* The MySQL benchmark suite
This suite runs a range of common queries. It is also a test
to determine whether the latest batch of optimizations
- actually made the code faster. See Section 7.1.4, "The MySQL
+ actually made the code faster. See Section 7.1.3, "The MySQL
Benchmark Suite."
* The crash-me test
This test tries to determine what features the database
supports and what its capabilities and limitations are. See
- Section 7.1.4, "The MySQL Benchmark Suite."
+ Section 7.1.3, "The MySQL Benchmark Suite."
We also test the newest MySQL version in our internal production
environment, on at least one machine. We have more than 100GB of
@@ -492,21 +429,6 @@ Important
as soon as possible. (We would like other companies to do
this, too!)
-2.1.2.4. MySQL Binaries Compiled by Sun Microsystems, Inc.
-
- Sun Microsystems, Inc. provides a set of binary distributions of
- MySQL. In addition to binaries provided in platform-specific
- package formats, we offer binary distributions for a number of
- platforms in the form of compressed tar files (.tar.gz files). See
- Section 2.2, "Standard MySQL Installation Using a Binary
- Distribution." For Windows distributions, see Section 2.3,
- "Installing MySQL on Windows."
-
- If you want to compile a debug version of MySQL from a source
- distribution, you should add --with-debug or --with-debug=full to
- the configure command used to configure the distribution and
- remove any -fomit-frame-pointer options.
-
2.1.3. How to Get MySQL
Check our downloads page at http://dev.mysql.com/downloads/ for
@@ -553,8 +475,8 @@ Important
shell> md5sum package_name
Example:
-shell> md5sum mysql-standard-5.1.39-linux-i686.tar.gz
-aaab65abbec64d5e907dcd41b8699945 mysql-standard-5.1.39-linux-i686.ta
+shell> md5sum mysql-standard-5.1.41-linux-i686.tar.gz
+aaab65abbec64d5e907dcd41b8699945 mysql-standard-5.1.41-linux-i686.ta
r.gz
You should verify that the resulting checksum (the string of
@@ -728,8 +650,8 @@ pg-signature.html
signature, which also is available from the download page. The
signature file has the same name as the distribution file with an
.asc extension, as shown by the examples in the following table.
- Distribution file mysql-standard-5.1.39-linux-i686.tar.gz
- Signature file mysql-standard-5.1.39-linux-i686.tar.gz.asc
+ Distribution file mysql-standard-5.1.41-linux-i686.tar.gz
+ Signature file mysql-standard-5.1.41-linux-i686.tar.gz.asc
Make sure that both files are stored in the same directory and
then run the following command to verify the signature for the
@@ -737,7 +659,7 @@ pg-signature.html
shell> gpg --verify package_name.asc
Example:
-shell> gpg --verify mysql-standard-5.1.39-linux-i686.tar.gz.asc
+shell> gpg --verify mysql-standard-5.1.41-linux-i686.tar.gz.asc
gpg: Signature made Tue 12 Jul 2005 23:35:41 EST using DSA key ID 507
2E1F5
gpg: Good signature from "MySQL Package signing key (www.mysql.com) <
@@ -757,8 +679,8 @@ build(a)mysql.com>"
shell> rpm --checksig package_name.rpm
Example:
-shell> rpm --checksig MySQL-server-5.1.39-0.glibc23.i386.rpm
-MySQL-server-5.1.39-0.glibc23.i386.rpm: md5 gpg OK
+shell> rpm --checksig MySQL-server-5.1.41-0.glibc23.i386.rpm
+MySQL-server-5.1.41-0.glibc23.i386.rpm: md5 gpg OK
Note
@@ -786,22 +708,6 @@ shell> rpm --import mysql_pubkey.asc
Sun Microsystems, Inc. A distribution provided by another vendor
might use a layout different from those shown here.
- For MySQL 5.1 on Windows, the default installation directory is
- C:\Program Files\MySQL\MySQL Server 5.1. (Some Windows users
- prefer to install in C:\mysql, the directory that formerly was
- used as the default. However, the layout of the subdirectories
- remains the same.) The installation directory has the following
- subdirectories.
- Directory Contents of Directory
- bin Client programs and the mysqld server
- data Log files, databases
- Docs Manual in CHM format
- examples Example programs and scripts
- include Include (header) files
- lib Libraries
- scripts Utility scripts
- share Error message files
-
Installations created from our Linux RPM distributions result in
files under the following system directories.
Directory Contents of Directory
@@ -863,8100 +769,7171 @@ shell> rpm --import mysql_pubkey.asc
distribution by executing the scripts/make_binary_distribution
script from the top directory of the source distribution.
-2.2. Standard MySQL Installation Using a Binary Distribution
+2.2. Installing MySQL from Generic Binaries on Unix/Linux
- The next several sections cover the installation of MySQL on
- platforms where we offer packages using the native packaging
- format of the respective platform. (This is also known as
- performing a "binary install.") However, binary distributions of
- MySQL are available for many other platforms as well. See Section
- 2.9, "Installing MySQL from tar.gz Packages on Other Unix-Like
- Systems," for generic installation instructions for these packages
- that apply to all platforms.
-
- See Section 2.1, "General Installation Issues," for more
- information on what other binary distributions are available and
- how to obtain them.
-
-2.3. Installing MySQL on Windows
-
- A native Windows distribution of MySQL has been available since
- version 3.21 and represents a sizable percentage of the daily
- downloads of MySQL. This section describes the process for
- installing MySQL on Windows.
+ This section covers the installation of MySQL binary distributions
+ that are provided for various platforms in the form of compressed
+ tar files (files with a .tar.gz extension). See Section 2.2,
+ "Installing MySQL from Generic Binaries on Unix/Linux," for a
+ detailed list.
-Note
+ To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
- If you are upgrading MySQL from an existing installation older
- than MySQL 4.1.5, you must first perform the procedure described
- in Section 2.3.14, "Upgrading MySQL on Windows."
+ Sun Microsystems, Inc. provides a set of binary distributions of
+ MySQL. In addition to binaries provided in platform-specific
+ package formats, we offer binary distributions for a number of
+ platforms in the form of compressed tar files (.tar.gz files). For
+ Windows distributions, see Section 2.5, "Installing MySQL on
+ Windows."
- To run MySQL on Windows, you need the following:
+ If you want to compile a debug version of MySQL from a source
+ distribution, you should add --with-debug or --with-debug=full to
+ the configure command used to configure the distribution and
+ remove any -fomit-frame-pointer options.
- * A Windows operating system such as Windows 2000, Windows XP,
- Windows Vista, Windows Server 2003, or Windows Server 2008.
- Both 32-bit and 64-bit versions are supported.
- A Windows operating system permits you to run the MySQL server
- as a service. See Section 2.3.11, "Starting MySQL as a Windows
- Service."
- Generally, you should install MySQL on Windows using an
- account that has administrator rights. Otherwise, you may
- encounter problems with certain operations such as editing the
- PATH environment variable or accessing the Service Control
- Manager. Once installed, MySQL does not need to be executed
- using a user with Administrator privileges.
+ MySQL tar file binary distributions have names of the form
+ mysql-VERSION-OS.tar.gz, where VERSION is a number (for example,
+ 5.1.41), and OS indicates the type of operating system for which
+ the distribution is intended (for example, pc-linux-i686).
- * TCP/IP protocol support.
+ In addition to these generic packages, we also offer binaries in
+ platform-specific package formats for selected platforms. See the
+ platform specific sections for more information, for more
+ information on how to install these.
- * Enough space on the hard drive to unpack, install, and create
- the databases in accordance with your requirements (generally
- a minimum of 200 megabytes is recommended.)
+ You need the following tools to install a MySQL tar file binary
+ distribution:
- For a list of limitations within the Windows version of MySQL, see
- Section D.7.3, "Windows Platform Limitations."
+ * GNU gunzip to uncompress the distribution.
- There may also be other requirements, depending on how you plan to
- use MySQL:
+ * A reasonable tar to unpack the distribution. GNU tar is known
+ to work. Some operating systems come with a preinstalled
+ version of tar that is known to have problems. For example,
+ the tar provided with early versions of Mac OS X, SunOS 4.x,
+ Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
+ are known to have problems with long file names. On Mac OS X,
+ you can use the preinstalled gnutar program. On Solaris 10 and
+ OpenSolaris you can use the preinstalled gtar. On other
+ systems with a deficient tar, you should install GNU tar
+ first.
- * If you plan to connect to the MySQL server via ODBC, you need
- a Connector/ODBC driver. See Section 21.1, "MySQL
- Connector/ODBC."
+ If you run into problems and need to file a bug report, please use
+ the instructions in Section 1.6, "How to Report Bugs or Problems."
- * If you plan to use MySQL server with ADO.NET applications, you
- need the Connector/NET driver. See Section 21.2, "MySQL
- Connector/NET."
+ The basic commands that you must execute to install and use a
+ MySQL binary distribution are:
+shell> groupadd mysql
+shell> useradd -g mysql mysql
+shell> cd /usr/local
+shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
+shell> ln -s full-path-to-mysql-VERSION-OS mysql
+shell> cd mysql
+shell> chown -R mysql .
+shell> chgrp -R mysql .
+shell> scripts/mysql_install_db --user=mysql
+shell> chown -R root .
+shell> chown -R mysql data
+shell> bin/mysqld_safe --user=mysql &
- * If you need tables with a size larger than 4GB, install MySQL
- on an NTFS or newer file system. Don't forget to use MAX_ROWS
- and AVG_ROW_LENGTH when you create tables. See Section
- 12.1.17, "CREATE TABLE Syntax."
+Note
- MySQL for Windows is available in several distribution formats:
+ This procedure does not set up any passwords for MySQL accounts.
+ After following the procedure, proceed to Section 2.13,
+ "Post-Installation Setup and Testing."
- * Binary distributions are available that contain a setup
- program that installs everything you need so that you can
- start the server immediately. Another binary distribution
- format contains an archive that you simply unpack in the
- installation location and then configure yourself. For
- details, see Section 2.3.1, "Choosing An Installation
- Package."
+ A more detailed version of the preceding description for
+ installing a binary distribution follows:
- * The source distribution contains all the code and support
- files for building the executables using the Visual Studio
- compiler system.
+ 1. Add a login user and group for mysqld to run as:
+shell> groupadd mysql
+shell> useradd -g mysql mysql
+ These commands add the mysql group and the mysql user. The
+ syntax for useradd and groupadd may differ slightly on
+ different versions of Unix, or they may have different names
+ such as adduser and addgroup.
+ You might want to call the user and group something else
+ instead of mysql. If so, substitute the appropriate name in
+ the following steps.
- Generally speaking, you should use a binary distribution that
- includes an installer. It is simpler to use than the others, and
- you need no additional tools to get MySQL up and running. The
- installer for the Windows version of MySQL, combined with a GUI
- Configuration Wizard, automatically installs MySQL, creates an
- option file, starts the server, and secures the default user
- accounts.
+ 2. Pick the directory under which you want to unpack the
+ distribution and change location into it. In the following
+ example, we unpack the distribution under /usr/local. (The
+ instructions, therefore, assume that you have permission to
+ create files and directories in /usr/local. If that directory
+ is protected, you must perform the installation as root.)
+shell> cd /usr/local
-Caution
+ 3. Obtain a distribution file using the instructions in Section
+ 2.1.3, "How to Get MySQL." For a given release, binary
+ distributions for all platforms are built from the same MySQL
+ source distribution.
- Using virus scanning software such as Norton/Symantec Anti-Virus
- on directories containing MySQL data and temporary tables can
- cause issues, both in terms of the performance of MySQL and the
- virus-scanning software mis-identifying the contents of the files
- as containing spam. This is because of the fingerprinting
- mechanism used by the virus scanning software, and the way in
- which MySQL rapidly updates different files, which may be
- identified as a potential security risk.
-
- After installing MySQL Server, it is recommended that you disable
- virus scanning on the main directory (datadir) being used to store
- your MySQL table data. There is usually a system built into the
- virus scanning software to allow certain directories to be
- specifically ignored during virus scanning.
-
- In addition, by default, MySQL creates temporary files in the
- standard Windows temporary directory. To prevent the temporary
- files also being scanned, you should configure a separate
- temporary directory for MySQL temporary files and add this to the
- virus scanning exclusion list. To do this, add a configuration
- option for the tmpdir parameter to your my.ini configuration file.
- For more information, see Section 2.3.7, "Creating an Option
- File."
-
- The following section describes how to install MySQL on Windows
- using a binary distribution. To use an installation package that
- does not include an installer, follow the procedure described in
- Section 2.3.5, "Installing MySQL from a Noinstall Zip Archive." To
- install using a source distribution, see Section 2.10.6,
- "Installing MySQL from Source on Windows."
+ 4. Unpack the distribution, which creates the installation
+ directory. Then create a symbolic link to that directory:
+shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
+shell> ln -s full-path-to-mysql-VERSION-OS mysql
+ The tar command creates a directory named mysql-VERSION-OS.
+ The ln command makes a symbolic link to that directory. This
+ lets you refer more easily to the installation directory as
+ /usr/local/mysql.
+ With GNU tar, no separate invocation of gunzip is necessary.
+ You can replace the first line with the following alternative
+ command to uncompress and extract the distribution:
+shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
- MySQL distributions for Windows can be downloaded from
- http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
- MySQL."
+ 5. Change location into the installation directory:
+shell> cd mysql
+ You will find several files and subdirectories in the mysql
+ directory. The most important for installation purposes are
+ the bin and scripts subdirectories:
-2.3.1. Choosing An Installation Package
+ + The bin directory contains client programs and the
+ server. You should add the full path name of this
+ directory to your PATH environment variable so that your
+ shell finds the MySQL programs properly. See Section
+ 2.14, "Environment Variables."
- For MySQL 5.1, there are three installation packages to choose
- from when installing MySQL on Windows:
+ + The scripts directory contains the mysql_install_db
+ script used to initialize the mysql database containing
+ the grant tables that store the server access
+ permissions.
- * The Essentials Package: This package has a file name similar
- to mysql-essential-5.1.39-win32.msi and contains the minimum
- set of files needed to install MySQL on Windows, including the
- Configuration Wizard. This package does not include optional
- components such as the embedded server and benchmark suite.
-
- * The Complete Package: This package has a file name similar to
- mysql-5.1.39-win32.zip and contains all files needed for a
- complete Windows installation, including the Configuration
- Wizard. This package includes optional components such as the
- embedded server and benchmark suite.
+ 6. Ensure that the distribution contents are accessible to mysql.
+ If you unpacked the distribution as mysql, no further action
+ is required. If you unpacked the distribution as root, its
+ contents will be owned by root. Change its ownership to mysql
+ by executing the following commands as root in the
+ installation directory:
+shell> chown -R mysql .
+shell> chgrp -R mysql .
+ The first command changes the owner attribute of the files to
+ the mysql user. The second changes the group attribute to the
+ mysql group.
- * The Noinstall Archive: This package has a file name similar to
- mysql-noinstall-5.1.39-win32.zip and contains all the files
- found in the Complete install package, with the exception of
- the Configuration Wizard. This package does not include an
- automated installer, and must be manually installed and
- configured.
-
- The Essentials package is recommended for most users. It is
- provided as an .msi file for use with the Windows Installer. The
- Complete and Noinstall distributions are packaged as Zip archives.
- To use them, you must have a tool that can unpack .zip files.
+ 7. If you have not installed MySQL before, you must create the
+ MySQL data directory and initialize the grant tables:
+shell> scripts/mysql_install_db --user=mysql
+ If you run the command as root, include the --user option as
+ shown. If you run the command while logged in as that user,
+ you can omit the --user option.
+ The command should create the data directory and its contents
+ with mysql as the owner.
+ After creating or updating the grant tables, you need to
+ restart the server manually.
- Your choice of install package affects the installation process
- you must follow. If you choose to install either the Essentials or
- Complete install packages, see Section 2.3.2, "Installing MySQL
- with the Automated Installer." If you choose to install MySQL from
- the Noinstall archive, see Section 2.3.5, "Installing MySQL from a
- Noinstall Zip Archive."
-
-2.3.2. Installing MySQL with the Automated Installer
-
- New MySQL users can use the MySQL Installation Wizard and MySQL
- Configuration Wizard to install MySQL on Windows. These are
- designed to install and configure MySQL in such a way that new
- users can immediately get started using MySQL.
+ 8. Most of the MySQL installation can be owned by root if you
+ like. The exception is that the data directory must be owned
+ by mysql. To accomplish this, run the following commands as
+ root in the installation directory:
+shell> chown -R root .
+shell> chown -R mysql data
- The MySQL Installation Wizard and MySQL Configuration Wizard are
- available in the Essentials and Complete install packages. They
- are recommended for most standard MySQL installations. Exceptions
- include users who need to install multiple instances of MySQL on a
- single server host and advanced users who want complete control of
- server configuration.
+ 9. If you want MySQL to start automatically when you boot your
+ machine, you can copy support-files/mysql.server to the
+ location where your system has its startup files. More
+ information can be found in the support-files/mysql.server
+ script itself and in Section 2.13.1.2, "Starting and Stopping
+ MySQL Automatically."
+ 10. You can set up new accounts using the bin/mysql_setpermission
+ script if you install the DBI and DBD::mysql Perl modules. See
+ Section 4.6.14, "mysql_setpermission --- Interactively Set
+ Permissions in Grant Tables." For Perl module installation
+ instructions, see Section 2.15, "Perl Installation Notes."
+ 11. If you would like to use mysqlaccess and have the MySQL
+ distribution in some nonstandard location, you must change the
+ location where mysqlaccess expects to find the mysql client.
+ Edit the bin/mysqlaccess script at approximately line 18.
+ Search for a line that looks like this:
+$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable
+ Change the path to reflect the location where mysql actually
+ is stored on your system. If you do not do this, a Broken pipe
+ error will occur when you run mysqlaccess.
-2.3.3. Using the MySQL Installation Wizard
+ After everything has been unpacked and installed, you should test
+ your distribution. To start the MySQL server, use the following
+ command:
+shell> bin/mysqld_safe --user=mysql &
- MySQL Installation Wizard is an installer for the MySQL server
- that uses the latest installer technologies for Microsoft Windows.
- The MySQL Installation Wizard, in combination with the MySQL
- Configuration Wizard, allows a user to install and configure a
- MySQL server that is ready for use immediately after installation.
+ If you run the command as root, you must use the --user option as
+ shown. The value of the option is the name of the login account
+ that you created in the first step to use for running the server.
+ If you run the command while logged in as mysql, you can omit the
+ --user option.
- The MySQL Installation Wizard is the standard installer for all
- MySQL server distributions, version 4.1.5 and higher. Users of
- previous versions of MySQL need to shut down and remove their
- existing MySQL installations manually before installing MySQL with
- the MySQL Installation Wizard. See Section 2.3.3.6, "Upgrading
- MySQL with the Installation Wizard," for more information on
- upgrading from a previous version.
+ If the command fails immediately and prints mysqld ended, you can
+ find some information in the host_name.err file in the data
+ directory.
- Microsoft has included an improved version of their Microsoft
- Windows Installer (MSI) in the recent versions of Windows. MSI has
- become the de-facto standard for application installations on
- Windows 2000, Windows XP, and Windows Server 2003. The MySQL
- Installation Wizard makes use of this technology to provide a
- smoother and more flexible installation process.
+ More information about mysqld_safe is given in Section 4.3.2,
+ "mysqld_safe --- MySQL Server Startup Script."
- The Microsoft Windows Installer Engine was updated with the
- release of Windows XP; those using a previous version of Windows
- can reference this Microsoft Knowledge Base article
- (http://support.microsoft.com/default.aspx?scid=kb;EN-US;292539)
- for information on upgrading to the latest version of the Windows
- Installer Engine.
+Note
- In addition, Microsoft has introduced the WiX (Windows Installer
- XML) toolkit recently. This is the first highly acknowledged Open
- Source project from Microsoft. We have switched to WiX because it
- is an Open Source project and it allows us to handle the complete
- Windows installation process in a flexible manner using scripts.
+ The accounts that are listed in the MySQL grant tables initially
+ have no passwords. After starting the server, you should set up
+ passwords for them using the instructions in Section 2.13,
+ "Post-Installation Setup and Testing."
- Improving the MySQL Installation Wizard depends on the support and
- feedback of users like you. If you find that the MySQL
- Installation Wizard is lacking some feature important to you, or
- if you discover a bug, please report it in our bugs database using
- the instructions given in Section 1.6, "How to Report Bugs or
- Problems."
+2.3. MySQL Installation Using a Source Distribution
-2.3.3.1. Downloading and Starting the MySQL Installation Wizard
+ Before you proceed with an installation from source, first check
+ whether our binary is available for your platform and whether it
+ works for you. We put a great deal of effort into ensuring that
+ our binaries are built with the best possible options.
- The MySQL installation packages can be downloaded from
- http://dev.mysql.com/downloads/. If the package you download is
- contained within a Zip archive, you need to extract the archive
- first.
-
-Note
+ To obtain a source distribution for MySQL, Section 2.1.3, "How to
+ Get MySQL." If you want to build MySQL from source on Windows, see
+ Section 2.5.10, "Installing MySQL from Source on Windows."
- If you are installing on Windows Vista it is best to open a
- network port before beginning the installation. To do this, first
- ensure that you are logged in as an Administrator, go to the
- Control Panel, and double click the Windows Firewall icon. Choose
- the Allow a program through Windows Firewall option and click the
- Add port button. Enter MySQL into the Name text box and 3306 (or
- the port of your choice) into the Port number text box. Also
- ensure that the TCP protocol radio button is selected. If you
- wish, you can also limit access to the MySQL server by choosing
- the Change scope button. Confirm your choices by clicking the OK
- button. If you do not open a port prior to installation, you
- cannot configure the MySQL server immediately after installation.
- Additionally, when running the MySQL Installation Wizard on
- Windows Vista, ensure that you are logged in as a user with
- administrative rights.
+ MySQL source distributions are provided as compressed tar archives
+ and have names of the form mysql-VERSION.tar.gz, where VERSION is
+ a number like 5.1.41.
- The process for starting the wizard depends on the contents of the
- installation package you download. If there is a setup.exe file
- present, double-click it to start the installation process. If
- there is an .msi file present, double-click it to start the
- installation process.
+ You need the following tools to build and install MySQL from
+ source:
-2.3.3.2. Choosing an Install Type
+ * GNU gunzip to uncompress the distribution.
- There are three installation types available: Typical, Complete,
- and Custom.
+ * A reasonable tar to unpack the distribution. GNU tar is known
+ to work. Some operating systems come with a preinstalled
+ version of tar that is known to have problems. For example,
+ the tar provided with early versions of Mac OS X, SunOS 4.x,
+ Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
+ are known to have problems with long file names. On Mac OS X,
+ you can use the preinstalled gnutar program. On Solaris 10 and
+ OpenSolaris you can use the preinstalled gtar. On other
+ systems with a deficient tar, you should install GNU tar
+ first.
- The Typical installation type installs the MySQL server, the mysql
- command-line client, and the command-line utilities. The
- command-line clients and utilities include mysqldump, myisamchk,
- and several other tools to help you manage the MySQL server.
+ * A working ANSI C++ compiler. gcc 2.95.2 or later, SGI C++, and
+ SunPro C++ are some of the compilers that are known to work.
+ libg++ is not needed when using gcc. gcc 2.7.x has a bug that
+ makes it impossible to compile some perfectly legal C++ files,
+ such as sql/sql_base.cc. If you have only gcc 2.7.x, you must
+ upgrade your gcc to be able to compile MySQL. gcc 2.8.1 is
+ also known to have problems on some platforms, so it should be
+ avoided if a newer compiler exists for the platform. gcc
+ 2.95.2 or later is recommended.
- The Complete installation type installs all components included in
- the installation package. The full installation package includes
- components such as the embedded server library, the benchmark
- suite, support scripts, and documentation.
+ * A good make program. GNU make is always recommended and is
+ sometimes required. (BSD make fails, and vendor-provided make
+ implementations may fail as well.) If you have problems, use
+ GNU make 3.75 or newer.
- The Custom installation type gives you complete control over which
- packages you wish to install and the installation path that is
- used. See Section 2.3.3.3, "The Custom Install Dialog," for more
- information on performing a custom install.
+ * libtool 1.5.24 or later is also recommended.
- If you choose the Typical or Complete installation types and click
- the Next button, you advance to the confirmation screen to verify
- your choices and begin the installation. If you choose the Custom
- installation type and click the Next button, you advance to the
- custom installation dialog, described in Section 2.3.3.3, "The
- Custom Install Dialog."
+ If you are using a version of gcc recent enough to understand the
+ -fno-exceptions option, it is very important that you use this
+ option. Otherwise, you may compile a binary that crashes randomly.
+ Also use -felide-constructors and -fno-rtti along with
+ -fno-exceptions. When in doubt, do the following:
+CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
+ -fno-exceptions -fno-rtti" ./configure \
+ --prefix=/usr/local/mysql --enable-assembler \
+ --with-mysqld-ldflags=-all-static
-2.3.3.3. The Custom Install Dialog
+ On most systems, this gives you a fast and stable binary.
- If you wish to change the installation path or the specific
- components that are installed by the MySQL Installation Wizard,
- choose the Custom installation type.
+ If you run into problems and need to file a bug report, please use
+ the instructions in Section 1.6, "How to Report Bugs or Problems."
- A tree view on the left side of the custom install dialog lists
- all available components. Components that are not installed have a
- red X icon; components that are installed have a gray icon. To
- change whether a component is installed, click on that component's
- icon and choose a new option from the drop-down list that appears.
+2.3.1. Source Installation Overview
- You can change the default installation path by clicking the
- Change... button to the right of the displayed installation path.
+ The basic commands that you must execute to install a MySQL source
+ distribution are:
+shell> groupadd mysql
+shell> useradd -g mysql mysql
+shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
+shell> cd mysql-VERSION
+shell> ./configure --prefix=/usr/local/mysql
+shell> make
+shell> make install
+shell> cp support-files/my-medium.cnf /etc/my.cnf
+shell> cd /usr/local/mysql
+shell> chown -R mysql .
+shell> chgrp -R mysql .
+shell> bin/mysql_install_db --user=mysql
+shell> chown -R root .
+shell> chown -R mysql var
+shell> bin/mysqld_safe --user=mysql &
- After choosing your installation components and installation path,
- click the Next button to advance to the confirmation dialog.
+ If you start from a source RPM, do the following:
+shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
-2.3.3.4. The Confirmation Dialog
+ This makes a binary RPM that you can install. For older versions
+ of RPM, you may have to replace the command rpmbuild with rpm
+ instead.
- Once you choose an installation type and optionally choose your
- installation components, you advance to the confirmation dialog.
- Your installation type and installation path are displayed for you
- to review.
+Note
- To install MySQL if you are satisfied with your settings, click
- the Install button. To change your settings, click the Back
- button. To exit the MySQL Installation Wizard without installing
- MySQL, click the Cancel button.
+ This procedure does not set up any passwords for MySQL accounts.
+ After following the procedure, proceed to Section 2.13,
+ "Post-Installation Setup and Testing," for post-installation setup
+ and testing.
- After installation is complete, you have the option of registering
- with the MySQL web site. Registration gives you access to post in
- the MySQL forums at forums.mysql.com (http://forums.mysql.com)
- along with the ability to report bugs at bugs.mysql.com
- (http://bugs.mysql.com) and to subscribe to our newsletter. The
- final screen of the installer provides a summary of the
- installation and gives you the option to launch the MySQL
- Configuration Wizard, which you can use to create a configuration
- file, install the MySQL service, and configure security settings.
+ A more detailed version of the preceding description for
+ installing MySQL from a source distribution follows:
-2.3.3.5. Changes Made by MySQL Installation Wizard
+ 1. Add a login user and group for mysqld to run as:
+shell> groupadd mysql
+shell> useradd -g mysql mysql
+ These commands add the mysql group and the mysql user. The
+ syntax for useradd and groupadd may differ slightly on
+ different versions of Unix, or they may have different names
+ such as adduser and addgroup.
+ You might want to call the user and group something else
+ instead of mysql. If so, substitute the appropriate name in
+ the following steps.
- Once you click the Install button, the MySQL Installation Wizard
- begins the installation process and makes certain changes to your
- system which are described in the sections that follow.
+ 2. Perform the following steps as the mysql user, except as
+ noted.
- Changes to the Registry
+ 3. Pick the directory under which you want to unpack the
+ distribution and change location into it.
- The MySQL Installation Wizard creates one Windows registry key in
- a typical install situation, located in
- HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.
+ 4. Obtain a distribution file using the instructions in Section
+ 2.1.3, "How to Get MySQL."
- The MySQL Installation Wizard creates a key named after the major
- version of the server that is being installed, such as MySQL
- Server 5.1. It contains two string values, Location and Version.
- The Location string contains the path to the installation
- directory. In a default installation it contains C:\Program
- Files\MySQL\MySQL Server 5.1\. The Version string contains the
- release number. For example, for an installation of MySQL Server
- 5.1.39, the key contains a value of 5.1.39.
+ 5. Unpack the distribution into the current directory:
+shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
+ This command creates a directory named mysql-VERSION.
+ With GNU tar, no separate invocation of gunzip is necessary.
+ You can use the following alternative command to uncompress
+ and extract the distribution:
+shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
- These registry keys are used to help external tools identify the
- installed location of the MySQL server, preventing a complete scan
- of the hard-disk to determine the installation path of the MySQL
- server. The registry keys are not required to run the server, and
- if you install MySQL using the noinstall Zip archive, the registry
- keys are not created.
+ 6. Change location into the top-level directory of the unpacked
+ distribution:
+shell> cd mysql-VERSION
+ Note that currently you must configure and build MySQL from
+ this top-level directory. You cannot build it in a different
+ directory.
- Changes to the Start Menu
+ 7. Configure the release and compile everything:
+shell> ./configure --prefix=/usr/local/mysql
+shell> make
+ When you run configure, you might want to specify other
+ options. Run ./configure --help for a list of options. Section
+ 2.3.2, "Typical configure Options," discusses some of the more
+ useful options.
+ If configure fails and you are going to send mail to a MySQL
+ mailing list to ask for assistance, please include any lines
+ from config.log that you think can help solve the problem.
+ Also include the last couple of lines of output from
+ configure. To file a bug report, please use the instructions
+ in Section 1.6, "How to Report Bugs or Problems."
+ If the compile fails, see Section 2.3.4, "Dealing with
+ Problems Compiling MySQL," for help.
- The MySQL Installation Wizard creates a new entry in the Windows
- Start menu under a common MySQL menu heading named after the major
- version of MySQL that you have installed. For example, if you
- install MySQL 5.1, the MySQL Installation Wizard creates a MySQL
- Server 5.1 section in the Start menu.
+ 8. Install the distribution:
+shell> make install
+ You might need to run this command as root.
+ If you want to set up an option file, use one of those present
+ in the support-files directory as a template. For example:
+shell> cp support-files/my-medium.cnf /etc/my.cnf
+ You might need to run this command as root.
+ If you want to configure support for InnoDB tables, you should
+ edit the /etc/my.cnf file, remove the # character before the
+ option lines that start with innodb_..., and modify the option
+ values to be what you want. See Section 4.2.3.3, "Using Option
+ Files," and Section 13.6.2, "InnoDB Configuration."
- The following entries are created within the new Start menu
- section:
+ 9. Change location into the installation directory:
+shell> cd /usr/local/mysql
+ 10. If you ran the make install command as root, the installed
+ files will be owned by root. Ensure that the installation is
+ accessible to mysql by executing the following commands as
+ root in the installation directory:
+shell> chown -R mysql .
+shell> chgrp -R mysql .
+ The first command changes the owner attribute of the files to
+ the mysql user. The second changes the group attribute to the
+ mysql group.
+ 11. If you have not installed MySQL before, you must create the
+ MySQL data directory and initialize the grant tables:
+shell> bin/mysql_install_db --user=mysql
+ If you run the command as root, include the --user option as
+ shown. If you run the command while logged in as mysql, you
+ can omit the --user option.
+ The command should create the data directory and its contents
+ with mysql as the owner.
+ After using mysql_install_db to create the grant tables for
+ MySQL, you must restart the server manually. The mysqld_safe
+ command to do this is shown in a later step.
+ 12. Most of the MySQL installation can be owned by root if you
+ like. The exception is that the data directory must be owned
+ by mysql. To accomplish this, run the following commands as
+ root in the installation directory:
+shell> chown -R root .
+shell> chown -R mysql var
+ 13. If you want MySQL to start automatically when you boot your
+ machine, you can copy support-files/mysql.server to the
+ location where your system has its startup files. More
+ information can be found in the support-files/mysql.server
+ script itself; see also Section 2.13.1.2, "Starting and
+ Stopping MySQL Automatically."
+ 14. You can set up new accounts using the bin/mysql_setpermission
+ script if you install the DBI and DBD::mysql Perl modules. See
+ Section 4.6.14, "mysql_setpermission --- Interactively Set
+ Permissions in Grant Tables." For Perl module installation
+ instructions, see Section 2.15, "Perl Installation Notes."
- * MySQL Command Line Client: This is a shortcut to the mysql
- command-line client and is configured to connect as the root
- user. The shortcut prompts for a root user password when you
- connect.
+ After everything has been installed, you should test your
+ distribution. To start the MySQL server, use the following
+ command:
+shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
- * MySQL Server Instance Config Wizard: This is a shortcut to the
- MySQL Configuration Wizard. Use this shortcut to configure a
- newly installed server, or to reconfigure an existing server.
+ If you run the command as root, you should use the --user option
+ as shown. The value of the option is the name of the login account
+ that you created in the first step to use for running the server.
+ If you run the command while logged in as that user, you can omit
+ the --user option.
- * MySQL Documentation: This is a link to the MySQL server
- documentation that is stored locally in the MySQL server
- installation directory. This option is not available when the
- MySQL server is installed using the Essentials installation
- package.
-
- Changes to the File System
-
- The MySQL Installation Wizard by default installs the MySQL 5.1
- server to C:\Program Files\MySQL\MySQL Server 5.1, where Program
- Files is the default location for applications in your system, and
- 5.1 is the major version of your MySQL server. This is the
- recommended location for the MySQL server, replacing the former
- default location C:\mysql.
+ If the command fails immediately and prints mysqld ended, you can
+ find some information in the host_name.err file in the data
+ directory.
- By default, all MySQL applications are stored in a common
- directory at C:\Program Files\MySQL, where Program Files is the
- default location for applications in your Windows installation. A
- typical MySQL installation on a developer machine might look like
- this:
-C:\Program Files\MySQL\MySQL Server 5.1
-C:\Program Files\MySQL\MySQL Workbench 5.1 OSS
+ More information about mysqld_safe is given in Section 4.3.2,
+ "mysqld_safe --- MySQL Server Startup Script."
- This approach makes it easier to manage and maintain all MySQL
- applications installed on a particular system.
+Note
- In MySQL 5.1.23 and earlier, the default location for the data
- files used by MySQL is located within the corresponding MySQL
- Server installation directory. For MySQL 5.1.24 and later, the
- default location of the data directory is the AppData directory
- configured for the user that installed the MySQL application.
+ The accounts that are listed in the MySQL grant tables initially
+ have no passwords. After starting the server, you should set up
+ passwords for them using the instructions in Section 2.13,
+ "Post-Installation Setup and Testing."
-2.3.3.6. Upgrading MySQL with the Installation Wizard
+2.3.2. Typical configure Options
- The MySQL Installation Wizard can perform server upgrades
- automatically using the upgrade capabilities of MSI. That means
- you do not need to remove a previous installation manually before
- installing a new release. The installer automatically shuts down
- and removes the previous MySQL service before installing the new
- version.
+ The configure script gives you a great deal of control over how
+ you configure a MySQL source distribution. Typically you do this
+ using options on the configure command line. You can also affect
+ configure using certain environment variables. See Section 2.14,
+ "Environment Variables." For a full list of options supported by
+ configure, run this command:
+shell> ./configure --help
- Automatic upgrades are available only when upgrading between
- installations that have the same major and minor version numbers.
- For example, you can upgrade automatically from MySQL 4.1.5 to
- MySQL 4.1.6, but not from MySQL 5.0 to MySQL 5.1.
+ A list of the available configure options is provided in the table
+ below.
- See Section 2.3.14, "Upgrading MySQL on Windows."
+ Table 2.1. Build (configure) Reference
+ Formats Description Default Introduced Removed
+ --bindir=DIR User executables EPREFIX/bin
+ --build=BUILD Configure for building on BUILD guessed
+ --cache-file=FILE Cache test results in FILE disabled
+ -C Alias for `--cache-file=config.cache'
+ --config-cache
+ --datadir=DIR Read-only architecture-independent data PREFIX/share
-2.3.4. MySQL Server Instance Configuration Wizard
+ --disable-FEATURE Do not include FEATURE
+ --disable-dependency-tracking Disable dependency tracking
+ --disable-grant-options Disable GRANT options
+ --disable-largefile Omit support for large files
+ --disable-libtool-lock Disable libtool lock
+ --disable-thread-safe-client Compile the client without threads
+ 5.1.7
+ --enable-FEATURE Enable FEATURE
+ --enable-assembler Use assembler versions of some string functions
+ if available
+ --enable-debug-sync Compile in Debug Sync facility 5.1.41
+ --enable-dependency-tracking Do not reject slow dependency
+ extractors
+ --enable-fast-install Optimize for fast installation yes
+ --enable-local-infile Enable LOAD DATA LOCAL INFILE disabled
+ --enable-shared Build shared libraries yes
+ --enable-static Build static libraries yes
+ --enable-thread-safe-client Compile the client with threads
+ --exec-prefix=EPREFIX Install architecture-dependent files in
+ EPREFIX
+ -h Display this help and exit
+ --help
+ --help=short Display options specific to this package
+ --help=recursive Display the short help of all the included
+ packages
+ --host=HOST Cross-compile to build programs to run on HOST
+ --includedir=DIR C header files PREFIX/include
+ --infodir=DIR Info documentation PREFIX/info
+ --libdir=DIR Object code libraries EPREFIX/lib
+ --libexecdir=DIR Program executables EPREFIX/libexec
+ --localstatedir=DIR Modifiable single-machine data PREFIX/var
+ --mandir=DIR man documentation PREFIX/man
+ -n Do not create output files
+ --no-create
+ --oldincludedir=DIR C header files for non-gcc /usr/include
+ --prefix=PREFIX Install architecture-independent files in PREFIX
- The MySQL Server Instance Configuration Wizard helps automate the
- process of configuring your server. It creates a custom MySQL
- configuration file (my.ini or my.cnf) by asking you a series of
- questions and then applying your responses to a template to
- generate the configuration file that is tuned to your
- installation.
+ --program-prefix=PREFIX Prepend PREFIX to installed program names
- The MySQL Server Instance Configuration Wizard is included with
- the MySQL 5.1 server. The MySQL Server Instance Configuration
- Wizard is only available for Windows.
-
-2.3.4.1. Starting the MySQL Server Instance Configuration Wizard
-
- The MySQL Server Instance Configuration Wizard is normally started
- as part of the installation process. You should only need to run
- the MySQL Server Instance Configuration Wizard again when you need
- to change the configuration parameters of your server.
+ --program-suffix=SUFFIX Append SUFFIX to installed program names
- If you chose not to open a port prior to installing MySQL on
- Windows Vista, you can choose to use the MySQL Server
- Configuration Wizard after installation. However, you must open a
- port in the Windows Firewall. To do this see the instructions
- given in Section 2.3.3.1, "Downloading and Starting the MySQL
- Installation Wizard." Rather than opening a port, you also have
- the option of adding MySQL as a program that bypasses the Windows
- Firewall. One or the other option is sufficient --- you need not
- do both. Additionally, when running the MySQL Server Configuration
- Wizard on Windows Vista ensure that you are logged in as a user
- with administrative rights.
- MySQL Server Instance Configuration Wizard
-
- You can launch the MySQL Configuration Wizard by clicking the
- MySQL Server Instance Config Wizard entry in the MySQL section of
- the Windows Start menu.
+ --program-transform-name=PROGRAM run sed PROGRAM on installed
+ program names
+ -q Do not print `checking...' messages
+ --quiet
+ --sbindir=DIR System admin executables EPREFIX/sbin
+ --sharedstatedir=DIR Modifiable architecture-independent data
+ PREFIX/com
+ --srcdir=DIR Find the sources in DIR configure directory or ..
+ --sysconfdir=DIR Read-only single-machine data PREFIX/etc
+ --target=TARGET Configure for building compilers for TARGET
+ -V Display version information and exit
+ --version
+ --with-PACKAGE Use PACKAGE
+ --with-archive-storage-engine Enable the Archive Storage Engine no
- Alternatively, you can navigate to the bin directory of your MySQL
- installation and launch the MySQLInstanceConfig.exe file directly.
+ --with-atomic-ops Implement atomic operations using pthread
+ rwlocks or atomic CPU instructions for multi-processor 5.1.12
+ --with-berkeley-db Use BerkeleyDB located in DIR no
+ --with-berkeley-db-includes Find Berkeley DB headers in DIR
+ --with-berkeley-db-libs Find Berkeley DB libraries in DIR
+ --with-big-tables Support tables with more than 4 G rows even on
+ 32 bit platforms
+ --with-blackhole-storage-engine Enable the Blackhole Storage
+ Engine no
+ --with-charset Default character set
+ --with-client-ldflags Extra linking arguments for clients
+ --with-collation Default collation
+ --with-comment Comment about compilation environment
+ --with-csv-storage-engine Enable the CSV Storage Engine yes
+ --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS
+ X/Darwin
+ --with-debug Add debug code 5.1.7
+ --with-debug=full Add debug code (adds memory checker, very slow)
- The MySQL Server Instance Configuration Wizard places the my.ini
- file in the installation directory for the MySQL server. This
- helps associate configuration files with particular server
- instances.
+ --with-embedded-privilege-control Build parts to check user's
+ privileges (only affects embedded library)
+ --with-embedded-server Build the embedded server
+ --with-error-inject Enable error injection in MySQL Server
+ 5.1.11
+ --with-example-storage-engine Enable the Example Storage Engine no
- To ensure that the MySQL server knows where to look for the my.ini
- file, an argument similar to this is passed to the MySQL server as
- part of the service installation:
---defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
+ --with-extra-charsets Use charsets in addition to default
+ --with-fast-mutexes Compile with fast mutexes enabled 5.1.5
+ --with-federated-storage-engine Enable federated storage engine no
+ 5.1.3 5.1.9
+ --with-gnu-ld Assume the C compiler uses GNU ld no
+ --with-innodb Enable innobase storage engine no 5.1.3 5.1.9
+ --with-lib-ccflags Extra CC options for libraries
+ --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
+ --with-low-memory Try to use less memory to compile to avoid
+ memory limitations
+ --with-machine-type Set the machine type, like "powerpc"
+ --with-max-indexes=N Sets the maximum number of indexes per table
+ 64
+ --with-mysqld-ldflags Extra linking arguments for mysqld
+ --with-mysqld-libs Extra libraries to link with for mysqld
+ --with-mysqld-user What user the mysqld daemon shall be run as
- Here, C:\Program Files\MySQL\MySQL Server 5.1 is replaced with the
- installation path to the MySQL Server. The --defaults-file option
- instructs the MySQL server to read the specified file for
- configuration options when it starts.
+ --with-mysqlmanager Build the mysqlmanager binary Build if server
+ is built
+ --with-named-curses-libs Use specified curses libraries
+ --with-named-thread-libs Use specified thread libraries
+ --with-ndb-ccflags Extra CC options for ndb compile
+ --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi
+ documentation
+ --with-ndb-port Port for NDB Cluster management server
+ --with-ndb-port-base Port for NDB Cluster management server
+ --with-ndb-sci=DIR Provide MySQL with a custom location of sci
+ library
+ --with-ndb-test Include the NDB Cluster ndbapi test programs
+ --with-ndbcluster Include the NDB Cluster table handler no
+ --with-openssl=DIR Include the OpenSSL support
+ --with-openssl-includes Find OpenSSL headers in DIR
+ --with-openssl-libs Find OpenSSL libraries in DIR
+ --with-other-libc=DIR Link against libc and other standard
+ libraries installed in the specified nonstandard location
+ --with-pic Try to use only PIC/non-PIC objects Use both
+ --with-plugin-PLUGIN Forces the named plugin to be linked into
+ mysqld statically 5.1.11
+ --with-plugins Plugins to include in mysqld none 5.1.11
+ --with-pstack Use the pstack backtrace library
+ --with-pthread Force use of pthread library
+ --with-row-based-replication Include row-based replication 5.1.5
+ 5.1.6
+ --with-server-suffix Append value to the version string
+ --with-ssl=DIR Include SSL support 5.1.11
+ --with-system-type Set the system type, like "sun-solaris10"
+ --with-tags Include additional configurations automatic
+ --with-tcp-port Which port to use for MySQL services 3306
+ --with-unix-socket-path Where to put the unix-domain socket
+ --with-yassl Include the yaSSL support
+ --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom
+ location of compression library
+ --without-PACKAGE Do not use PACKAGE
+ --without-bench Skip building of the benchmark suite
+ --without-debug Build a production version without debugging code
- Apart from making changes to the my.ini file by running the MySQL
- Server Instance Configuration Wizard again, you can modify it by
- opening it with a text editor and making any necessary changes.
- You can also modify the server configuration with the MySQL
- Administrator (http://www.mysql.com/products/administrator/)
- utility. For more information about server configuration, see
- Section 5.1.2, "Server Command Options."
+ --without-docs Skip building of the documentation
+ --without-extra-tools Skip building utilities in the tools
+ directory
+ --without-geometry Do not build geometry-related parts
+ --without-libedit Use system libedit instead of bundled copy
+ --without-man Skip building of the man pages
+ --without-ndb-binlog Disable ndb binlog 5.1.6
+ --without-ndb-debug Disable special ndb debug features
+ --without-plugin-PLUGIN Exclude PLUGIN 5.1.11
+ --without-query-cache Do not build query cache
+ --without-readline Use system readline instead of bundled copy
- MySQL clients and utilities such as the mysql and mysqldump
- command-line clients are not able to locate the my.ini file
- located in the server installation directory. To configure the
- client and utility applications, create a new my.ini file in the
- Windows installation directory (for example, C:\WINDOWS).
+ --without-row-based-replication Don't include row-based
+ replication 5.1.7 5.1.14
+ --without-server Only build the client
+ --without-uca Skip building of the national Unicode collations
- Under Windows Server 2003, Windows Server 2000, Windows XP, and
- Windows Vista MySQL Server Instance Configuration Wizard will
- configure MySQL to work as a Windows service. To start and stop
- MySQL you use the Services application that is supplied as part of
- the Windows Administrator Tools.
-
-2.3.4.2. Choosing a Maintenance Option
-
- If the MySQL Server Instance Configuration Wizard detects an
- existing configuration file, you have the option of either
- reconfiguring your existing server, or removing the server
- instance by deleting the configuration file and stopping and
- removing the MySQL service.
+ Some of the configure options available are described here. For
+ options that may be of use if you have difficulties building
+ MySQL, see Section 2.3.4, "Dealing with Problems Compiling MySQL."
- To reconfigure an existing server, choose the Re-configure
- Instance option and click the Next button. Any existing
- configuration file is not overwritten, but renamed (within the
- same directory) using a timestamp (Windows) or sequential number
- (Linux). To remove the existing server instance, choose the Remove
- Instance option and click the Next button.
+ * To compile just the MySQL client libraries and client programs
+ and not the server, use the --without-server option:
+shell> ./configure --without-server
+ If you have no C++ compiler, some client programs such as
+ mysql cannot be compiled because they require C++.. In this
+ case, you can remove the code in configure that tests for the
+ C++ compiler and then run ./configure with the
+ --without-server option. The compile step should still try to
+ build all clients, but you can ignore any warnings about files
+ such as mysql.cc. (If make stops, try make -k to tell it to
+ continue with the rest of the build even if errors occur.)
- If you choose the Remove Instance option, you advance to a
- confirmation window. Click the Execute button. The MySQL Server
- Configuration Wizard stops and removes the MySQL service, and then
- deletes the configuration file. The server installation and its
- data folder are not removed.
+ * If you want to build the embedded MySQL library (libmysqld.a),
+ use the --with-embedded-server option.
- If you choose the Re-configure Instance option, you advance to the
- Configuration Type dialog where you can choose the type of
- installation that you wish to configure.
-
-2.3.4.3. Choosing a Configuration Type
-
- When you start the MySQL Server Instance Configuration Wizard for
- a new MySQL installation, or choose the Re-configure Instance
- option for an existing installation, you advance to the
- Configuration Type dialog.
- MySQL Server Instance Configuration Wizard: Configuration Type
-
- There are two configuration types available: Detailed
- Configuration and Standard Configuration. The Standard
- Configuration option is intended for new users who want to get
- started with MySQL quickly without having to make many decisions
- about server configuration. The Detailed Configuration option is
- intended for advanced users who want more fine-grained control
- over server configuration.
-
- If you are new to MySQL and need a server configured as a
- single-user developer machine, the Standard Configuration should
- suit your needs. Choosing the Standard Configuration option causes
- the MySQL Configuration Wizard to set all configuration options
- automatically with the exception of Service Options and Security
- Options.
+ * If you don't want your log files and database directories
+ located under /usr/local/var, use a configure command
+ something like one of these:
+shell> ./configure --prefix=/usr/local/mysql
+shell> ./configure --prefix=/usr/local \
+ --localstatedir=/usr/local/mysql/data
+ The first command changes the installation prefix so that
+ everything is installed under /usr/local/mysql rather than the
+ default of /usr/local. The second command preserves the
+ default installation prefix, but overrides the default
+ location for database directories (normally /usr/local/var)
+ and changes it to /usr/local/mysql/data.
+ You can also specify the installation directory and data
+ directory locations at server startup time by using the
+ --basedir and --datadir options. These can be given on the
+ command line or in an MySQL option file, although it is more
+ common to use an option file. See Section 4.2.3.3, "Using
+ Option Files."
- The Standard Configuration sets options that may be incompatible
- with systems where there are existing MySQL installations. If you
- have an existing MySQL installation on your system in addition to
- the installation you wish to configure, the Detailed Configuration
- option is recommended.
+ * This option specifies the port number on which the server
+ listens for TCP/IP connections. The default is port 3306. To
+ listen on a different port, use a configure command like this:
+shell> ./configure --with-tcp-port=3307
- To complete the Standard Configuration, please refer to the
- sections on Service Options and Security Options in Section
- 2.3.4.10, "The Service Options Dialog," and Section 2.3.4.11, "The
- Security Options Dialog," respectively.
+ * If you are using Unix and you want the MySQL socket file
+ location to be somewhere other than the default location
+ (normally in the directory /tmp or /var/run), use a configure
+ command like this:
+shell> ./configure \
+ --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
+ The socket file name must be an absolute path name. You can
+ also change the location of mysql.sock at server startup by
+ using a MySQL option file. See Section B.5.4.5, "How to
+ Protect or Change the MySQL Unix Socket File."
-2.3.4.4. The Server Type Dialog
+ * If you want to compile statically linked programs (for
+ example, to make a binary distribution, to get better
+ performance, or to work around problems with some Red Hat
+ Linux distributions), run configure like this:
+shell> ./configure --with-client-ldflags=-all-static \
+ --with-mysqld-ldflags=-all-static
- There are three different server types available to choose from.
- The server type that you choose affects the decisions that the
- MySQL Server Instance Configuration Wizard makes with regard to
- memory, disk, and processor usage.
- MySQL Server Instance Configuration Wizard: Server Type
+ * If you are using gcc and don't have libg++ or libstdc++
+ installed, you can tell configure to use gcc as your C++
+ compiler:
+shell> CC=gcc CXX=gcc ./configure
+ When you use gcc as your C++ compiler, it does not attempt to
+ link in libg++ or libstdc++. This may be a good thing to do
+ even if you have those libraries installed. Some versions of
+ them have caused strange problems for MySQL users in the past.
+ The following list indicates some compilers and environment
+ variable settings that are commonly used with each one.
- * Developer Machine: Choose this option for a typical desktop
- workstation where MySQL is intended only for personal use. It
- is assumed that many other desktop applications are running.
- The MySQL server is configured to use minimal system
- resources.
+ + gcc 2.7.2:
+CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
- * Server Machine: Choose this option for a server machine where
- the MySQL server is running alongside other server
- applications such as FTP, email, and Web servers. The MySQL
- server is configured to use a moderate portion of the system
- resources.
+ + gcc 2.95.2:
+CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
+-felide-constructors -fno-exceptions -fno-rtti"
- * Dedicated MySQL Server Machine: Choose this option for a
- server machine that is intended to run only the MySQL server.
- It is assumed that no other applications are running. The
- MySQL server is configured to use all available system
- resources.
+ + pgcc 2.90.29 or newer:
+CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
+CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
+-felide-constructors -fno-exceptions -fno-rtti"
+ In most cases, you can get a reasonably optimized MySQL binary
+ by using the options from the preceding list and adding the
+ following options to the configure line:
+--prefix=/usr/local/mysql --enable-assembler \
+--with-mysqld-ldflags=-all-static
+ The full configure line would, in other words, be something
+ like the following for all recent gcc versions:
+CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
+-felide-constructors -fno-exceptions -fno-rtti" ./configure \
+--prefix=/usr/local/mysql --enable-assembler \
+--with-mysqld-ldflags=-all-static
+ The binaries we provide on the MySQL Web site at
+ http://dev.mysql.com/downloads/ are all compiled with full
+ optimization and should be perfect for most users. See Section
+ 2.2, "Installing MySQL from Generic Binaries on Unix/Linux."
+ There are some configuration settings you can tweak to build
+ an even faster binary, but these are only for advanced users.
+ See Section 7.5.1, "How Compiling and Linking Affects the
+ Speed of MySQL."
+ If the build fails and produces errors about your compiler or
+ linker not being able to create the shared library
+ libmysqlclient.so.N (where N is a version number), you can
+ work around this problem by giving the --disable-shared option
+ to configure. In this case, configure does not build a shared
+ libmysqlclient.so.N library.
-Note
+ * By default, MySQL uses the latin1 (cp1252 West European)
+ character set. To change the default set, use the
+ --with-charset option:
+shell> ./configure --with-charset=CHARSET
+ CHARSET may be one of binary, armscii8, ascii, big5, cp1250,
+ cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8,
+ eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8,
+ keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce,
+ macroman, sjis, swe7, tis620, ucs2, ujis, utf8. See Section
+ 9.2, "The Character Set Used for Data and Sorting."
+ (Additional character sets might be available. Check the
+ output from ./configure --help for the current list.)
+ The default collation may also be specified. MySQL uses the
+ latin1_swedish_ci collation by default. To change this, use
+ the --with-collation option:
+shell> ./configure --with-collation=COLLATION
+ To change both the character set and the collation, use both
+ the --with-charset and --with-collation options. The collation
+ must be a legal collation for the character set. (Use the SHOW
+ COLLATION statement to determine which collations are
+ available for each character set.)
+ With the configure option --with-extra-charsets=LIST, you can
+ define which additional character sets should be compiled into
+ the server. LIST is one of the following:
- By selecting one of the preconfigured configurations, the values
- and settings of various options in your my.cnf or my.ini will be
- altered accordingly. The default values and options as described
- in the reference manual may therefore be different to the options
- and values that were created during the execution of the
- configuration wizard.
+ + A list of character set names separated by spaces
-2.3.4.5. The Database Usage Dialog
+ + complex to include all character sets that can't be
+ dynamically loaded
- The Database Usage dialog allows you to indicate the storage
- engines that you expect to use when creating MySQL tables. The
- option you choose determines whether the InnoDB storage engine is
- available and what percentage of the server resources are
- available to InnoDB.
- MySQL Server Instance Configuration Wizard: Usage Dialog
+ + all to include all character sets into the binaries
+ Clients that want to convert characters between the server and
+ the client should use the SET NAMES statement. See Section
+ 5.1.5, "Session System Variables," and Section 9.1.4,
+ "Connection Character Sets and Collations."
- * Multifunctional Database: This option enables both the InnoDB
- and MyISAM storage engines and divides resources evenly
- between the two. This option is recommended for users who use
- both storage engines on a regular basis.
+ * To configure MySQL with debugging code, use the --with-debug
+ option:
+shell> ./configure --with-debug
+ This causes a safe memory allocator to be included that can
+ find some errors and that provides output about what is
+ happening. See MySQL Internals: Porting
+ (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
+ As of MySQL 5.1.12, using --with-debug to configure MySQL with
+ debugging support enables you to use the
+ --debug="d,parser_debug" option when you start the server.
+ This causes the Bison parser that is used to process SQL
+ statements to dump a parser trace to the server's standard
+ error output. Typically, this output is written to the error
+ log.
- * Transactional Database Only: This option enables both the
- InnoDB and MyISAM storage engines, but dedicates most server
- resources to the InnoDB storage engine. This option is
- recommended for users who use InnoDB almost exclusively and
- make only minimal use of MyISAM.
+ * To cause the Debug Sync facility to be compiled into the
+ server, use the --enable-debug-sync option. This facility is
+ used for testing and debugging. When compiled in, Debug Sync
+ is disabled by default. To enable it, start mysqld with the
+ --debug-sync-timeout=N option, where N is a timeout value
+ greater than 0. (The default value is 0, which disables Debug
+ Sync.) N becomes the default timeout for individual
+ synchronization points.
+ Debug Sync is also compiled in if you configure with the
+ --with-debug option (which implies --enable-debug-sync),
+ unless you also use the --disable-debug-sync option.
+ For a description of the Debug Sync facility and how to use
+ synchronization points, see MySQL Internals: Test
+ Synchronization
+ (http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronizat
+ ion).
+ The --enable-debug-sync and --disable-debug-sync options were
+ added in MySQL 5.1.41.
- * Non-Transactional Database Only: This option disables the
- InnoDB storage engine completely and dedicates all server
- resources to the MyISAM storage engine. This option is
- recommended for users who do not use InnoDB.
+ * If your client programs are using threads, you must compile a
+ thread-safe version of the MySQL client library with the
+ --enable-thread-safe-client configure option. This creates a
+ libmysqlclient_r library with which you should link your
+ threaded applications. See Section 21.9.16.2, "How to Make a
+ Threaded Client."
- The Configuration Wizard uses a template to generate the server
- configuration file. The Database Usage dialog sets one of the
- following option strings:
-Multifunctional Database: MIXED
-Transactional Database Only: INNODB
-Non-Transactional Database Only: MYISAM
+ * Some features require that the server be built with
+ compression library support, such as the COMPRESS() and
+ UNCOMPRESS() functions, and compression of the client/server
+ protocol. The --with-zlib-dir=no|bundled|DIR option provides
+ control over compression library support. The value no
+ explicitly disables compression support. bundled causes the
+ zlib library bundled in the MySQL sources to be used. A DIR
+ path name specifies the directory in which to find the
+ compression library sources.
- When these options are processed through the default template
- (my-template.ini) the result is:
-Multifunctional Database:
-default-storage-engine=InnoDB
-_myisam_pct=50
+ * It is possible to build MySQL with large table support using
+ the --with-big-tables option.
+ This option causes the variables that store table row counts
+ to be declared as unsigned long long rather than unsigned
+ long. This enables tables to hold up to approximately
+ 1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows.
+ Previously it was necessary to pass -DBIG_TABLES to the
+ compiler manually in order to enable this feature.
-Transactional Database Only:
-default-storage-engine=InnoDB
-_myisam_pct=5
+ * Run configure with the --disable-grant-options option to cause
+ the --bootstrap, --skip-grant-tables, and --init-file options
+ for mysqld to be disabled. For Windows, the configure.js
+ script recognizes the DISABLE_GRANT_OPTIONS flag, which has
+ the same effect. The capability is available as of MySQL
+ 5.1.15.
-Non-Transactional Database Only:
-default-storage-engine=MyISAM
-_myisam_pct=100
-skip-innodb
+ * This option allows MySQL Community Server features to be
+ enabled. Additional options may be required for individual
+ features, such as --enable-profiling to enable statement
+ profiling. This option was added in MySQL 5.1.24. It is
+ enabled by default as of MySQL 5.1.28; to disable it, use
+ --disable-community-features.
- The _myisam_pct value is used to calculate the percentage of
- resources dedicated to MyISAM. The remaining resources are
- allocated to InnoDB.
+ * When given with --enable-community-features, the
+ --enable-profiling option enables the statement profiling
+ capability exposed by the SHOW PROFILE and SHOW PROFILES
+ statements. (See Section 12.5.5.33, "SHOW PROFILES Syntax.")
+ This option was added in MySQL 5.1.24. It is enabled by
+ default as of MySQL 5.1.28; to disable it, use
+ --disable-profiling.
-2.3.4.6. The InnoDB Tablespace Dialog
+ * See Section 2.1, "General Installation Guidance," for options
+ that pertain to particular operating systems.
- Some users may want to locate the InnoDB tablespace files in a
- different location than the MySQL server data directory. Placing
- the tablespace files in a separate location can be desirable if
- your system has a higher capacity or higher performance storage
- device available, such as a RAID storage system.
- MySQL Server Instance Configuration Wizard: InnoDB Data Tablespace
+ * See Section 5.5.7.2, "Using SSL Connections," for options that
+ pertain to configuring MySQL to support secure (encrypted)
+ connections.
- To change the default location for the InnoDB tablespace files,
- choose a new drive from the drop-down list of drive letters and
- choose a new path from the drop-down list of paths. To create a
- custom path, click the ... button.
-
- If you are modifying the configuration of an existing server, you
- must click the Modify button before you change the path. In this
- situation you must move the existing tablespace files to the new
- location manually before starting the server.
-
-2.3.4.7. The Concurrent Connections Dialog
-
- To prevent the server from running out of resources, it is
- important to limit the number of concurrent connections to the
- MySQL server that can be established. The Concurrent Connections
- dialog allows you to choose the expected usage of your server, and
- sets the limit for concurrent connections accordingly. It is also
- possible to set the concurrent connection limit manually.
- MySQL Server Instance Configuration Wizard: Connections
-
- * Decision Support (DSS)/OLAP: Choose this option if your server
- does not require a large number of concurrent connections. The
- maximum number of connections is set at 100, with an average
- of 20 concurrent connections assumed.
-
- * Online Transaction Processing (OLTP): Choose this option if
- your server requires a large number of concurrent connections.
- The maximum number of connections is set at 500.
+ * Several configure options apply to plugin selection and
+ building:
+--with-plugins=PLUGIN[,PLUGIN]...
+--with-plugins=GROUP
+--with-plugin-PLUGIN
+--without-plugin-PLUGIN
+ PLUGIN is an individual plugin name such as csv or archive.
+ As shorthand, GROUP is a configuration group name such as none
+ (select no plugins) or all (select all plugins).
+ You can build a plugin as static (compiled into the server) or
+ dynamic (built as a dynamic library that must be installed
+ using the INSTALL PLUGIN statement before it can be used).
+ Some plugins might not support static or dynamic build.
+ configure --help shows the following information pertaining to
+ plugins:
- * Manual Setting: Choose this option to set the maximum number
- of concurrent connections to the server manually. Choose the
- number of concurrent connections from the drop-down box
- provided, or enter the maximum number of connections into the
- drop-down box if the number you desire is not listed.
+ + The plugin-related options
-2.3.4.8. The Networking and Strict Mode Options Dialog
+ + The names of all available plugins
- Use the Networking Options dialog to enable or disable TCP/IP
- networking and to configure the port number that is used to
- connect to the MySQL server.
- MySQL Server Instance Configuration Wizard: Network Configuration
+ + For each plugin, a description of its purpose, which
+ build types it supports (static or dynamic), and which
+ plugin groups it is a part of.
+ --with-plugins can take a list of one or more plugin names
+ separated by commas, or a plugin group name. The named plugins
+ are configured to be built as static plugins.
+ --with-plugin-PLUGIN configures the given plugin to be built
+ as a static plugin.
+ --without-plugin-PLUGIN disables the given plugin from being
+ built.
+ If a plugin is named both with a --with and --without option,
+ the result is undefined.
+ For any plugin that is not explicitly selected or disabled, it
+ is selected to be built dynamically if it supports dynamic
+ build, and not built if it does not support dynamic build.
+ (Thus, in the case that no plugin options are given, all
+ plugins that support dynamic build are selected to be built as
+ dynamic plugins. Plugins that do not support dynamic build are
+ not built.)
- TCP/IP networking is enabled by default. To disable TCP/IP
- networking, uncheck the box next to the Enable TCP/IP Networking
- option.
+2.3.3. Installing from the Development Source Tree
- Port 3306 is used by default. To change the port used to access
- MySQL, choose a new port number from the drop-down box or type a
- new port number directly into the drop-down box. If the port
- number you choose is in use, you are prompted to confirm your
- choice of port number.
+Caution
- Set the Server SQL Mode to either enable or disable strict mode.
- Enabling strict mode (default) makes MySQL behave more like other
- database management systems. If you run applications that rely on
- MySQL's old "forgiving" behavior, make sure to either adapt those
- applications or to disable strict mode. For more information about
- strict mode, see Section 5.1.8, "Server SQL Modes."
+ You should read this section only if you are interested in helping
+ us test our new code. If you just want to get MySQL up and running
+ on your system, you should use a standard release distribution
+ (either a binary or source distribution).
-2.3.4.9. The Character Set Dialog
+ To obtain the most recent development source tree, you must have
+ Bazaar installed. You can obtain Bazaar from the Bazaar VCS
+ Website (http://bazaar-vcs.org) Bazaar is supported by any
+ platform that supports Python, and is therefore compatible with
+ any Linux, Unix, Windows or Mac OS X host. Instructions for
+ downloading and installing Bazaar on the different platforms are
+ available on the Bazaar website.
- The MySQL server supports multiple character sets and it is
- possible to set a default server character set that is applied to
- all tables, columns, and databases unless overridden. Use the
- Character Set dialog to change the default character set of the
- MySQL server.
- MySQL Server Instance Configuration Wizard: Character Set
+ All MySQL projects are hosted on Launchpad
+ (http://launchpad.net/) MySQL projects, including MySQL server,
+ MySQL Workbench, and others are available from the Sun/MySQL
+ Engineering (http://launchpad.net/~mysql) page. For the
+ repositories related only to MySQL server, see the MySQL Server
+ (http://launchpad.net/mysql-server) page.
- * Standard Character Set: Choose this option if you want to use
- latin1 as the default server character set. latin1 is used for
- English and many Western European languages.
+ To build under Unix/Linux, you must have the following tools
+ installed:
- * Best Support For Multilingualism: Choose this option if you
- want to use utf8 as the default server character set. This is
- a Unicode character set that can store characters from many
- different languages.
+ * GNU make, available from http://www.gnu.org/software/make/.
+ Although some platforms come with their own make
+ implementations, it is highly recommended that you use GNU
+ make. It may already be available on your system as gmake.
- * Manual Selected Default Character Set / Collation: Choose this
- option if you want to pick the server's default character set
- manually. Choose the desired character set from the provided
- drop-down list.
+ * autoconf 2.58 (or newer), available from
+ http://www.gnu.org/software/autoconf/.
-2.3.4.10. The Service Options Dialog
+ * automake 1.8.1, available from
+ http://www.gnu.org/software/automake/.
- On Windows platforms, the MySQL server can be installed as a
- Windows service. When installed this way, the MySQL server can be
- started automatically during system startup, and even restarted
- automatically by Windows in the event of a service failure.
+ * libtool 1.5, available from
+ http://www.gnu.org/software/libtool/.
- The MySQL Server Instance Configuration Wizard installs the MySQL
- server as a service by default, using the service name MySQL. If
- you do not wish to install the service, uncheck the box next to
- the Install As Windows Service option. You can change the service
- name by picking a new service name from the drop-down box provided
- or by entering a new service name into the drop-down box.
+ * m4, available from http://www.gnu.org/software/m4/.
-Note
+ * bison, available from http://www.gnu.org/software/bison/. You
+ should use the latest version of bison where possible. Version
+ 1.75 and version 2.1 are known to work. There have been
+ reported problems with bison 1.875. If you experience
+ problems, upgrade to a later, rather than earlier, version.
+ Versions of bison older than 1.75 may report this error:
+sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
+ The maximum table size is not actually exceeded; the error is
+ caused by bugs in older versions of bison.
- Service names can include any legal character except forward (/)
- or backward (\) slashes, and must be less than 256 characters
- long.
+ To build under Windows you must have Microsoft Visual C++ 2005
+ Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio
+ 2005 (8.0) compiler system.
-Warning
+ Once the necessary tools are installed, you must create a local
+ branch of the MySQL source code on your machine:
- If you are installing multiple versions of MySQL onto the same
- machine, you must choose a different service name for each version
- that you install. If you do not choose a different service for
- each installed version then the service manager information will
- be inconsistent and this will cause problems when you try to
- uninstall a previous version.
+ 1. To obtain a copy of the MySQL source code, you must create a
+ new Bazaar branch. If you do not already have a Bazaar
+ repository directory set up, you need to initialize a new
+ directory:
+shell> mkdir mysql-server
+shell> bzr init-repo --trees mysql-server
- If you have already installed multiple versions using the same
- service name, you must manually edit the contents of the
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters
- within the Windows registry to update the association of the
- service name with the correct server version.
+ 2. Once you have an initialized directory, you can branch from
+ the public MySQL server repositories to create a local source
+ tree. To create a branch of a specific version:
+shell> cd mysql-server
+shell> bzr branch lp:mysql-server/5.1 mysql-5.1
- Typically, when installing multiple versions you create a service
- name based on the version information. For example, you might
- install MySQL 5.x as mysql5, or specific versions such as MySQL
- 5.1.30 as mysql50130.
+ 3. The initial download will take some time to complete,
+ depending on the speed of your connection. Please be patient.
+ Once you have downloaded the first tree, additional trees
+ should take significantly less time to download.
- To install the MySQL server as a service but not have it started
- automatically at startup, uncheck the box next to the Launch the
- MySQL Server Automatically option.
+ 4. When building from the Bazaar branch, you may want to create a
+ copy of your active branch so that you can make configuration
+ and other changes without affecting the original branch
+ contents. You can achieve this by branching from the original
+ branch:
+shell> bzr branch mysql-5.1 mysql-5.1-build
-2.3.4.11. The Security Options Dialog
+ 5. To obtain changes made after you have set up the branch
+ initially, update it using the pull option periodically. Use
+ this command in the top-level directory of the local copy:
+shell> bzr pull
+ You can examine the changeset comments for the tree by using
+ the log option to bzr:
+shell> bzr log
+ You can also browse changesets, comments, and source code
+ online. To browse this information for MySQL 5.1, go to the
+ Launchpad MySQL Server (http://launchpad.net/mysql-server)
+ page.
+ If you see diffs (changes) or code that you have a question
+ about, do not hesitate to send email to the MySQL internals
+ mailing list. See Section 1.5.1, "MySQL Mailing Lists." Also,
+ if you think you have a better idea on how to do something,
+ send an email message to the list with a patch.
+
+ After you have the local branch, you can build MySQL server from
+ the source code. On Windows, the build process is different from
+ Unix/Linux: see Section 2.5.10, "Installing MySQL from Source on
+ Windows."
- It is strongly recommended that you set a root password for your
- MySQL server, and the MySQL Server Instance Configuration Wizard
- requires by default that you do so. If you do not wish to set a
- root password, uncheck the box next to the Modify Security
- Settings option.
- MySQL Server Instance Configuration Wizard: Security
+ On Unix/Linux, use the autoconf system to create the configure
+ script so that you can configure the build environment before
+ building. The following example shows the typical commands
+ required to build MySQL from a source tree.
- To set the root password, enter the desired password into both the
- New root password and Confirm boxes. If you are reconfiguring an
- existing server, you need to enter the existing root password into
- the Current root password box.
+ 1. Change location to the top-level directory of the source tree;
+ replace mysql-5.1 with the appropriate directory name.
+shell> cd mysql-5.1
- To prevent root logins from across the network, check the box next
- to the Root may only connect from localhost option. This increases
- the security of your root account.
+ 2. Prepare the source tree for configuration.
+ Prior to MySQL 5.1.12, you must separately configure the
+ InnoDB storage engine. Run the following command from the main
+ source directory:
+shell> (cd storage/innobase; autoreconf --force --install)
+ You can omit the previous command for MySQL 5.1.12 and later,
+ or if you do not require InnoDB support.
+ Prepare the remainder of the source tree:
+shell> autoreconf --force --install
+ As an alternative to the preceding autoreconf command, you can
+ use BUILD/autorun.sh, which acts as a shortcut for the
+ following sequence of commands:
+shell> aclocal; autoheader
+shell> libtoolize --automake --force
+shell> automake --force --add-missing; autoconf
+ If you get some strange errors during this stage, verify that
+ you have the correct version of libtool installed.
- To create an anonymous user account, check the box next to the
- Create An Anonymous Account option. Creating an anonymous account
- can decrease server security and cause login and permission
- difficulties. For this reason, it is not recommended.
+ 3. Configure the source tree and compile MySQL:
+shell> ./configure # Add your favorite options here
+shell> make
+ For a description of some configure options, see Section
+ 2.3.2, "Typical configure Options."
+ A collection of our standard configuration scripts is located
+ in the BUILD/ subdirectory. For example, you may find it more
+ convenient to use the BUILD/compile-pentium-debug script than
+ the preceding set of shell commands. To compile on a different
+ architecture, modify the script by removing flags that are
+ Pentium-specific, or use another script that may be more
+ appropriate. These scripts are provided on an "as-is" basis.
+ They are not officially maintained and their contents may
+ change from release to release.
-2.3.4.12. The Confirmation Dialog
+ 4. When the build is done, run make install. Be careful with this
+ on a production machine; the command may overwrite your live
+ release installation. If you already have MySQL installed and
+ do not want to overwrite it, run ./configure with values for
+ the --prefix, --with-tcp-port, and --with-unix-socket-path
+ options different from those used for your production server.
- The final dialog in the MySQL Server Instance Configuration Wizard
- is the Confirmation Dialog. To start the configuration process,
- click the Execute button. To return to a previous dialog, click
- the Back button. To exit the MySQL Server Instance Configuration
- Wizard without configuring the server, click the Cancel button.
- MySQL Server Instance Configuration Wizard: Confirmation
+ 5. Play hard with your new installation and try to make the new
+ features crash. Start by running make test. See Section
+ 22.1.2, "MySQL Test Suite."
- After you click the Execute button, the MySQL Server Instance
- Configuration Wizard performs a series of tasks and displays the
- progress onscreen as the tasks are performed.
+ 6. If you have gotten to the make stage, but the distribution
+ does not compile, please enter the problem into our bugs
+ database using the instructions given in Section 1.6, "How to
+ Report Bugs or Problems." If you have installed the latest
+ versions of the required GNU tools, and they crash trying to
+ process our configuration files, please report that also.
+ However, if you get a command not found error or a similar
+ problem for aclocal, configure, or other required tools, do
+ not report it. Instead, make sure that all the required tools
+ are installed and that your PATH variable is set correctly so
+ that your shell can find them.
- The MySQL Server Instance Configuration Wizard first determines
- configuration file options based on your choices using a template
- prepared by MySQL developers and engineers. This template is named
- my-template.ini and is located in your server installation
- directory.
+2.3.4. Dealing with Problems Compiling MySQL
- The MySQL Configuration Wizard then writes these options to the
- corresponding configuration file.
+ All MySQL programs compile cleanly for us with no warnings on
+ Solaris or Linux using gcc. On other systems, warnings may occur
+ due to differences in system include files. See Section 2.3.5,
+ "MIT-pthreads Notes," for warnings that may occur when using
+ MIT-pthreads. For other problems, check the following list.
- If you chose to create a service for the MySQL server, the MySQL
- Server Instance Configuration Wizard creates and starts the
- service. If you are reconfiguring an existing service, the MySQL
- Server Instance Configuration Wizard restarts the service to apply
- your configuration changes.
-
- If you chose to set a root password, the MySQL Configuration
- Wizard connects to the server, sets your new root password, and
- applies any other security settings you may have selected.
-
- After the MySQL Server Instance Configuration Wizard has completed
- its tasks, it displays a summary. Click the Finish button to exit
- the MySQL Server Configuration Wizard.
+ The solution to many problems involves reconfiguring. If you do
+ need to reconfigure, take note of the following:
-2.3.5. Installing MySQL from a Noinstall Zip Archive
+ * If configure is run after it has previously been run, it may
+ use information that was gathered during its previous
+ invocation. This information is stored in config.cache. When
+ configure starts up, it looks for that file and reads its
+ contents if it exists, on the assumption that the information
+ is still correct. That assumption is invalid when you
+ reconfigure.
- Users who are installing from the Noinstall package can use the
- instructions in this section to manually install MySQL. The
- process for installing MySQL from a Zip archive is as follows:
+ * Each time you run configure, you must run make again to
+ recompile. However, you may want to remove old object files
+ from previous builds first because they were compiled using
+ different configuration options.
- 1. Extract the archive to the desired install directory
+ To prevent old configuration information or object files from
+ being used, run these commands before re-running configure:
+shell> rm config.cache
+shell> make clean
- 2. Create an option file
+ Alternatively, you can run make distclean.
- 3. Choose a MySQL server type
+ The following list describes some of the problems when compiling
+ MySQL that have been found to occur most often:
- 4. Start the MySQL server
+ * If you get errors such as the ones shown here when compiling
+ sql_yacc.cc, you probably have run out of memory or swap
+ space:
+Internal compiler error: program cc1plus got fatal signal 11
+Out of virtual memory
+Virtual memory exhausted
+ The problem is that gcc requires a huge amount of memory to
+ compile sql_yacc.cc with inline functions. Try running
+ configure with the --with-low-memory option:
+shell> ./configure --with-low-memory
+ This option causes -fno-inline to be added to the compile line
+ if you are using gcc and -O0 if you are using something else.
+ You should try the --with-low-memory option even if you have
+ so much memory and swap space that you think you can't
+ possibly have run out. This problem has been observed to occur
+ even on systems with generous hardware configurations, and the
+ --with-low-memory option usually fixes it.
- 5. Secure the default user accounts
+ * By default, configure picks c++ as the compiler name and GNU
+ c++ links with -lg++. If you are using gcc, that behavior can
+ cause problems during configuration such as this:
+configure: error: installation or configuration problem:
+C++ compiler cannot create executables.
+ You might also observe problems during compilation related to
+ g++, libg++, or libstdc++.
+ One cause of these problems is that you may not have g++, or
+ you may have g++ but not libg++, or libstdc++. Take a look at
+ the config.log file. It should contain the exact reason why
+ your C++ compiler didn't work. To work around these problems,
+ you can use gcc as your C++ compiler. Try setting the
+ environment variable CXX to "gcc -O3". For example:
+shell> CXX="gcc -O3" ./configure
+ This works because gcc compiles C++ source files as well as
+ g++ does, but does not link in libg++ or libstdc++ by default.
+ Another way to fix these problems is to install g++, libg++,
+ and libstdc++. However, do not use libg++ or libstdc++ with
+ MySQL because this only increases the binary size of mysqld
+ without providing any benefits. Some versions of these
+ libraries have also caused strange problems for MySQL users in
+ the past.
- This process is described in the sections that follow.
+ * If your compile fails with errors such as any of the
+ following, you must upgrade your version of make to GNU make:
+making all in mit-pthreads
+make: Fatal error in reader: Makefile, line 18:
+Badly formed macro assignment
+ Or:
+make: file `Makefile' line 18: Must be a separator (:
+ Or:
+pthread.h: No such file or directory
+ Solaris and FreeBSD are known to have troublesome make
+ programs.
+ GNU make 3.75 is known to work.
-2.3.6. Extracting the Install Archive
+ * If you want to define flags to be used by your C or C++
+ compilers, do so by adding the flags to the CFLAGS and
+ CXXFLAGS environment variables. You can also specify the
+ compiler names this way using CC and CXX. For example:
+shell> CC=gcc
+shell> CFLAGS=-O3
+shell> CXX=gcc
+shell> CXXFLAGS=-O3
+shell> export CC CFLAGS CXX CXXFLAGS
+ See Section 2.2, "Installing MySQL from Generic Binaries on
+ Unix/Linux," for a list of flag definitions that have been
+ found to be useful on various systems.
- To install MySQL manually, do the following:
+ * If you get errors such as those shown here when compiling
+ mysqld, configure did not correctly detect the type of the
+ last argument to accept(), getsockname(), or getpeername():
+cxx: Error: mysqld.cc, line 645: In this statement, the referenced
+ type of the pointer value ''length'' is ''unsigned long'',
+ which is not compatible with ''int''.
+new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
+ To fix this, edit the config.h file (which is generated by
+ configure). Look for these lines:
+/* Define as the base type of the last arg to accept */
+#define SOCKET_SIZE_TYPE XXX
+ Change XXX to size_t or int, depending on your operating
+ system. (You must do this each time you run configure because
+ configure regenerates config.h.)
- 1. If you are upgrading from a previous version please refer to
- Section 2.3.14, "Upgrading MySQL on Windows," before beginning
- the upgrade process.
+ * The sql_yacc.cc file is generated from sql_yacc.yy. Normally,
+ the build process does not need to create sql_yacc.cc because
+ MySQL comes with a pre-generated copy. However, if you do need
+ to re-create it, you might encounter this error:
+"sql_yacc.yy", line xxx fatal: default action causes potential...
+ This is a sign that your version of yacc is deficient. You
+ probably need to install bison (the GNU version of yacc) and
+ use that instead.
- 2. Make sure that you are logged in as a user with administrator
- privileges.
+ * On Debian Linux 3.0, you need to install gawk instead of the
+ default mawk.
- 3. Choose an installation location. Traditionally, the MySQL
- server is installed in C:\mysql. The MySQL Installation Wizard
- installs MySQL under C:\Program Files\MySQL. If you do not
- install MySQL at C:\mysql, you must specify the path to the
- install directory during startup or in an option file. See
- Section 2.3.7, "Creating an Option File."
+ * If you need to debug mysqld or a MySQL client, run configure
+ with the --with-debug option, and then recompile and link your
+ clients with the new client library. See MySQL Internals:
+ Porting (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
- 4. Extract the install archive to the chosen installation
- location using your preferred Zip archive tool. Some tools may
- extract the archive to a folder within your chosen
- installation location. If this occurs, you can move the
- contents of the subfolder into the chosen installation
- location.
+ * If you get a compilation error on Linux (for example, SuSE
+ Linux 8.1 or Red Hat Linux 7.3) similar to the following one,
+ you probably do not have g++ installed:
+libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
+incompatible pointer type
+libmysql.c:1329: too few arguments to function `gethostbyname_r'
+libmysql.c:1329: warning: assignment makes pointer from integer
+without a cast
+make[2]: *** [libmysql.lo] Error 1
+ By default, the configure script attempts to determine the
+ correct number of arguments by using g++ (the GNU C++
+ compiler). This test yields incorrect results if g++ is not
+ installed. There are two ways to work around this problem:
-2.3.7. Creating an Option File
+ + Make sure that the GNU C++ g++ is installed. On some
+ Linux distributions, the required package is called gpp;
+ on others, it is named gcc-c++.
- If you need to specify startup options when you run the server,
- you can indicate them on the command line or place them in an
- option file. For options that are used every time the server
- starts, you may find it most convenient to use an option file to
- specify your MySQL configuration. This is particularly true under
- the following circumstances:
+ + Use gcc as your C++ compiler by setting the CXX
+ environment variable to gcc:
+export CXX="gcc"
+ You must run configure again after making either of those
+ changes.
- * The installation or data directory locations are different
- from the default locations (C:\Program Files\MySQL\MySQL
- Server 5.1 and C:\Program Files\MySQL\MySQL Server 5.1\data).
+2.3.5. MIT-pthreads Notes
- * You need to tune the server settings, such as memory, cache,
- or InnoDB configuration information.
+ This section describes some of the issues involved in using
+ MIT-pthreads.
- When the MySQL server starts on Windows, it looks for options in
- two files: the my.ini file in the Windows directory, and the
- C:\my.cnf file. The Windows directory typically is named something
- like C:\WINDOWS. You can determine its exact location from the
- value of the WINDIR environment variable using the following
- command:
-C:\> echo %WINDIR%
+ On Linux, you should not use MIT-pthreads. Use the installed
+ LinuxThreads implementation instead. See Section 2.6, "Installing
+ MySQL on Linux."
- MySQL looks for options first in the my.ini file, and then in the
- my.cnf file. However, to avoid confusion, it is best if you use
- only one file. If your PC uses a boot loader where C: is not the
- boot drive, your only option is to use the my.ini file. Whichever
- option file you use, it must be a plain text file.
+ If your system does not provide native thread support, you should
+ build MySQL using the MIT-pthreads package. This includes older
+ FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some
+ others. See Section 2.1, "General Installation Guidance."
- You can also make use of the example option files included with
- your MySQL distribution; see Section 4.2.3.3.2, "Preconfigured
- Option Files."
+ MIT-pthreads is not part of the MySQL 5.1 source distribution. If
+ you require this package, you need to download it separately from
+ http://dev.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.t
+ ar.gz
- An option file can be created and modified with any text editor,
- such as Notepad. For example, if MySQL is installed in E:\mysql
- and the data directory is in E:\mydata\data, you can create an
- option file containing a [mysqld] section to specify values for
- the basedir and datadir options:
-[mysqld]
-# set basedir to your installation path
-basedir=E:/mysql
-# set datadir to the location of your data directory
-datadir=E:/mydata/data
+ After downloading, extract this source archive into the top level
+ of the MySQL source directory. It creates a new subdirectory named
+ mit-pthreads.
- Note that Windows path names are specified in option files using
- (forward) slashes rather than backslashes. If you do use
- backslashes, you must double them:
-[mysqld]
-# set basedir to your installation path
-basedir=E:\\mysql
-# set datadir to the location of your data directory
-datadir=E:\\mydata\\data
+ * On most systems, you can force MIT-pthreads to be used by
+ running configure with the --with-mit-threads option:
+shell> ./configure --with-mit-threads
+ Building in a nonsource directory is not supported when using
+ MIT-pthreads because we want to minimize our changes to this
+ code.
- MySQL Enterprise For expert advice on the start-up options
- appropriate to your circumstances, subscribe to the MySQL
- Enterprise Monitor. For more information, see
- http://www.mysql.com/products/enterprise/advisors.html.
+ * The checks that determine whether to use MIT-pthreads occur
+ only during the part of the configuration process that deals
+ with the server code. If you have configured the distribution
+ using --without-server to build only the client code, clients
+ do not know whether MIT-pthreads is being used and use Unix
+ socket file connections by default. Because Unix socket files
+ do not work under MIT-pthreads on some platforms, this means
+ you need to use -h or --host with a value other than localhost
+ when you run client programs.
- In MySQL 5.1.23 and earlier, the MySQL installer places the data
- directory directly under the directory where you install MySQL. On
- MySQL 5.1.24 and later, the data directory is located within the
- AppData directory for the user running MySQL.
+ * When MySQL is compiled using MIT-pthreads, system locking is
+ disabled by default for performance reasons. You can tell the
+ server to use system locking with the --external-locking
+ option. This is needed only if you want to be able to run two
+ MySQL servers against the same data files, but that is not
+ recommended, anyway.
- If you would like to use a data directory in a different location,
- you should copy the entire contents of the data directory to the
- new location. For example, if you want to use E:\mydata as the
- data directory instead, you must do two things:
+ * Sometimes the pthread bind() command fails to bind to a socket
+ without any error message (at least on Solaris). The result is
+ that all connections to the server fail. For example:
+shell> mysqladmin version
+mysqladmin: connect to server at '' failed;
+error: 'Can't connect to mysql server on localhost (146)'
+ The solution to this problem is to kill the mysqld server and
+ restart it. This has happened to us only when we have forcibly
+ stopped the server and restarted it immediately.
- 1. Move the entire data directory and all of its contents from
- the default location (for example C:\Program Files\MySQL\MySQL
- Server 5.1\data) to E:\mydata.
+ * With MIT-pthreads, the sleep() system call isn't interruptible
+ with SIGINT (break). This is noticeable only when you run
+ mysqladmin --sleep. You must wait for the sleep() call to
+ terminate before the interrupt is served and the process
+ stops.
- 2. Use a --datadir option to specify the new data directory
- location each time you start the server.
+ * When linking, you might receive warning messages like these
+ (at least on Solaris); they can be ignored:
+ld: warning: symbol `_iob' has differing sizes:
+ (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
+file /usr/lib/libc.so value=0x140);
+ /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
+ld: warning: symbol `__iob' has differing sizes:
+ (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
+file /usr/lib/libc.so value=0x140);
+ /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
-2.3.8. Selecting a MySQL Server Type
+ * Some other warnings also can be ignored:
+implicit declaration of function `int strtoll(...)'
+implicit declaration of function `int strtoul(...)'
- The following table shows the available servers for Windows in
- MySQL 5.1.20 and earlier.
- Binary Description
- mysqld-nt Optimized binary with named-pipe support
- mysqld Optimized binary without named-pipe support
- mysqld-debug Like mysqld-nt, but compiled with full debugging and
- automatic memory allocation checking
+ * We have not been able to make readline work with MIT-pthreads.
+ (This is not necessary, but may be of interest to some.)
- The following table shows the available servers for Windows in
- MySQL 5.1.21 and later.
- Binary Description
- mysqld Optimized binary with named-pipe support
- mysqld-debug Like mysqld, but compiled with full debugging and
- automatic memory allocation checking
+2.4. Upgrading or Downgrading MySQL
- All of the preceding binaries are optimized for modern Intel
- processors, but should work on any Intel i386-class or higher
- processor.
+2.4.1. Upgrading MySQL
- Each of the servers in a distribution support the same set of
- storage engines. The SHOW ENGINES statement displays which engines
- a given server supports.
-
- All Windows MySQL 5.1 servers have support for symbolic linking of
- database directories.
+ As a general rule, to upgrade from one release series to another,
+ you should go to the next series rather than skipping a series. To
+ upgrade from a release series previous to MySQL 5.0, upgrade to
+ each successive release series in turn until you have reached
+ MySQL 5.0, and then proceed with the upgrade to MySQL 5.1. For
+ example, if you currently are running MySQL 4.0 and wish to
+ upgrade to a newer series, upgrade to MySQL 4.1 first before
+ upgrading to 5.0, and so forth. For information on upgrading to
+ MySQL 5.0, see the MySQL 5.0 Reference Manual; for earlier
+ releases, see the MySQL 3.23, 4.0, 4.1 Reference Manual.
- MySQL supports TCP/IP on all Windows platforms. MySQL servers on
- Windows support named pipes as indicated in the following list.
- However, the default is to use TCP/IP regardless of platform.
- (Named pipes are slower than TCP/IP in many Windows
- configurations.)
+ If you perform a binary (in-place) upgrade without dumping and
+ reloading tables, you cannot upgrade directly from MySQL 4.1 to
+ 5.1. This occurs due to an incompatible change in the MyISAM table
+ index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
+ repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
+ Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
+ and check and repair your tables.
- Use of named pipes is subject to these conditions:
+ To upgrade from MySQL 5.0 to 5.1, use the items in the following
+ checklist as a guide:
- * Named pipes are enabled only if you start the server with the
- --enable-named-pipe option. It is necessary to use this option
- explicitly because some users have experienced problems with
- shutting down the MySQL server when named pipes were used.
+ * Before any upgrade, back up your databases, including the
+ mysql database that contains the grant tables. See Section
+ 6.1, "Database Backup Methods."
- * For MySQL 5.1.20 and earlier, named-pipe connections are
- allowed only by the mysqld-nt and mysqld-debug servers. For
- MySQL 5.1.21 and later, the mysqld and mysqld-debug servers
- both contain support for named-pipe connections.
+ * Read all the notes in Section 2.4.1.1, "Upgrading from MySQL
+ 5.0 to 5.1." These notes enable you to identify upgrade issues
+ that apply to your current MySQL installation. Some
+ incompatibilities discussed in that section require your
+ attention before upgrading. Others should be dealt with after
+ upgrading.
-Note
+ * Read Appendix C, "MySQL Change History" as well, which
+ provides information about features that are new in MySQL 5.1
+ or differ from those found in MySQL 5.0.
- Most of the examples in this manual use mysqld as the server name.
- If you choose to use a different server, such as mysqld-nt or
- mysqld-debug, make the appropriate substitutions in the commands
- that are shown in the examples.
+ * After you upgrade to a new version of MySQL, run mysql_upgrade
+ (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
+ Upgrade"). This program checks your tables, and attempts to
+ repair them if necessary. It also updates your grant tables to
+ make sure that they have the current structure so that you can
+ take advantage of any new capabilities. (Some releases of
+ MySQL introduce changes to the structure of the grant tables
+ to add new privileges or features.)
-2.3.9. Starting the Server for the First Time
+ * If you are running MySQL Server on Windows, see Section 2.5.7,
+ "Upgrading MySQL on Windows."
- This section gives a general overview of starting the MySQL
- server. The following sections provide more specific information
- for starting the MySQL server from the command line or as a
- Windows service.
+ * If you are using replication, see Section 16.3.3, "Upgrading a
+ Replication Setup," for information on upgrading your
+ replication setup.
- The information here applies primarily if you installed MySQL
- using the Noinstall version, or if you wish to configure and test
- MySQL manually rather than with the GUI tools.
+ * If you are upgrading an installation originally produced by
+ installing multiple RPM packages, it is best to upgrade all
+ the packages, not just some. For example, if you previously
+ installed the server and client RPMs, do not upgrade just the
+ server RPM.
- The examples in these sections assume that MySQL is installed
- under the default location of C:\Program Files\MySQL\MySQL Server
- 5.1. Adjust the path names shown in the examples if you have MySQL
- installed in a different location.
+ * As of MySQL 5.1.9, the mysqld-max server is included in binary
+ distributions. There is no separate MySQL-Max distribution. As
+ of MySQL 5.1.12, there is no mysqld-max server at all in
+ binary distributions. They contain a server that includes the
+ features previously included in mysqld-max.
- Clients have two options. They can use TCP/IP, or they can use a
- named pipe if the server supports named-pipe connections.
+ * If you have created a user-defined function (UDF) with a given
+ name and upgrade MySQL to a version that implements a new
+ built-in function with the same name, the UDF becomes
+ inaccessible. To correct this, use DROP FUNCTION to drop the
+ UDF, and then use CREATE FUNCTION to re-create the UDF with a
+ different nonconflicting name. The same is true if the new
+ version of MySQL implements a built-in function with the same
+ name as an existing stored function. See Section 8.2.4,
+ "Function Name Parsing and Resolution," for the rules
+ describing how the server interprets references to different
+ kinds of functions.
- MySQL for Windows also supports shared-memory connections if the
- server is started with the --shared-memory option. Clients can
- connect through shared memory by using the --protocol=MEMORY
- option.
+ You can always move the MySQL format files and data files between
+ different versions on systems with the same architecture as long
+ as you stay within versions for the same release series of MySQL.
- For information about which server binary to run, see Section
- 2.3.8, "Selecting a MySQL Server Type."
+ If you are cautious about using new versions, you can always
+ rename your old mysqld before installing a newer one. For example,
+ if you are using MySQL 5.0.13 and want to upgrade to 5.1.10,
+ rename your current server from mysqld to mysqld-5.0.13. If your
+ new mysqld then does something unexpected, you can simply shut it
+ down and restart with your old mysqld.
- Testing is best done from a command prompt in a console window (or
- "DOS window"). In this way you can have the server display status
- messages in the window where they are easy to see. If something is
- wrong with your configuration, these messages make it easier for
- you to identify and fix any problems.
+ If, after an upgrade, you experience problems with recompiled
+ client programs, such as Commands out of sync or unexpected core
+ dumps, you probably have used old header or library files when
+ compiling your programs. In this case, you should check the date
+ for your mysql.h file and libmysqlclient.a library to verify that
+ they are from the new MySQL distribution. If not, recompile your
+ programs with the new headers and libraries.
- To start the server, enter this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
+ If problems occur, such as that the new mysqld server does not
+ start or that you cannot connect without a password, verify that
+ you do not have an old my.cnf file from your previous
+ installation. You can check this with the --print-defaults option
+ (for example, mysqld --print-defaults). If this command displays
+ anything other than the program name, you have an active my.cnf
+ file that affects server or client operation.
- For a server that includes InnoDB support, you should see the
- messages similar to those following as it starts (the path names
- and sizes may differ):
-InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
-InnoDB: a new database to be created!
-InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
-InnoDB: Database physically writes the file full: wait...
-InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat
-ed
-InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
-InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat
-ed
-InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
-InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat
-ed
-InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
-InnoDB: Doublewrite buffer not found: creating new
-InnoDB: Doublewrite buffer created
-InnoDB: creating foreign key constraint system tables
-InnoDB: foreign key constraint system tables created
-011024 10:58:25 InnoDB: Started
+ If your MySQL installation contains a large amount of data that
+ might take a long time to convert after an in-place upgrade, you
+ might find it useful to create a "dummy" database instance for
+ assessing what conversions might be needed and the work involved
+ to perform them. Make a copy of your MySQL instance that contains
+ a full copy of the mysql database, plus all other databases
+ without data. Run your upgrade procedure on this dummy instance to
+ see what actions might be needed so that you can better evaluate
+ the work involved when performing actual data conversion on your
+ original database instance.
- When the server finishes its startup sequence, you should see
- something like this, which indicates that the server is ready to
- service client connections:
-mysqld: ready for connections
-Version: '5.1.39' socket: '' port: 3306
+ It is a good idea to rebuild and reinstall the Perl DBD::mysql
+ module whenever you install a new release of MySQL. The same
+ applies to other MySQL interfaces as well, such as PHP mysql
+ extensions and the Python MySQLdb module.
- The server continues to write to the console any further
- diagnostic output it produces. You can open a new console window
- in which to run client programs.
+2.4.1.1. Upgrading from MySQL 5.0 to 5.1
- If you omit the --console option, the server writes diagnostic
- output to the error log in the data directory (C:\Program
- Files\MySQL\MySQL Server 5.1\data by default). The error log is
- the file with the .err extension.
+ After upgrading a 5.0 installation to 5.0.10 or above, it is
+ necessary to upgrade your grant tables. Otherwise, creating stored
+ procedures and functions might not work. To perform this upgrade,
+ run mysql_upgrade.
Note
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ It is good practice to back up your data before installing any new
+ version of software. Although MySQL works very hard to ensure a
+ high level of quality, you should protect your data by making a
+ backup.
-2.3.10. Starting MySQL from the Windows Command Line
+ To upgrade to 5.1 from any previous version, MySQL recommends that
+ you dump your tables with mysqldump before upgrading and reload
+ the dump file after upgrading.
- The MySQL server can be started manually from the command line.
- This can be done on any version of Windows.
+ If you perform a binary (in-place) upgrade without dumping and
+ reloading tables, you cannot upgrade directly from MySQL 4.1 to
+ 5.1. This occurs due to an incompatible change in the MyISAM table
+ index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
+ repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
+ Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
+ and check and repair your tables.
- To start the mysqld server from the command line, you should start
- a console window (or "DOS window") and enter this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
+ In general, you should do the following when upgrading from MySQL
+ 5.0 to 5.1:
- The path to mysqld may vary depending on the install location of
- MySQL on your system.
+ * Read all the items in the following sections to see whether
+ any of them might affect your applications:
- You can stop the MySQL server by executing this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
- shutdown
+ + Section 2.4.1, "Upgrading MySQL," has general update
+ information.
-Note
+ + The items in the change lists found later in this section
+ enable you to identify upgrade issues that apply to your
+ current MySQL installation.
- If the MySQL root user account has a password, you need to invoke
- mysqladmin with the -p option and supply the password when
- prompted.
+ + The MySQL 5.1 change history describes significant new
+ features you can use in 5.1 or that differ from those
+ found in MySQL 5.0. Some of these changes may result in
+ incompatibilities. See Section C.1, "Changes in Release
+ 5.1.x (Production)."
- This command invokes the MySQL administrative utility mysqladmin
- to connect to the server and tell it to shut down. The command
- connects as the MySQL root user, which is the default
- administrative account in the MySQL grant system. Note that users
- in the MySQL grant system are wholly independent from any login
- users under Windows.
+ * Note particularly any changes that are marked Known issue or
+ Incompatible change. These incompatibilities with earlier
+ versions of MySQL may require your attention before you
+ upgrade.
+ Our aim is to avoid these changes, but occasionally they are
+ necessary to correct problems that would be worse than an
+ incompatibility between releases. If any upgrade issue
+ applicable to your installation involves an incompatibility
+ that requires special handling, follow the instructions given
+ in the incompatibility description. Often this will involve a
+ dump and reload, or use of a statement such as CHECK TABLE or
+ REPAIR TABLE.
+ For dump and reload instructions, see Section 2.4.4,
+ "Rebuilding or Repairing Tables or Indexes." Any procedure
+ that involves REPAIR TABLE with the USE_FRM option must be
+ done before upgrading. Use of this statement with a version of
+ MySQL different from the one used to create the table (that
+ is, using it after upgrading) may damage the table. See
+ Section 12.5.2.6, "REPAIR TABLE Syntax."
- If mysqld doesn't start, check the error log to see whether the
- server wrote any messages there to indicate the cause of the
- problem. The error log is located in the C:\Program
- Files\MySQL\MySQL Server 5.1\data directory. It is the file with a
- suffix of .err. You can also try to start the server as mysqld
- --console; in this case, you may get some useful information on
- the screen that may help solve the problem.
+ * After you upgrade to a new version of MySQL, run mysql_upgrade
+ (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
+ Upgrade"). This program checks your tables, and attempts to
+ repair them if necessary. It also updates your grant tables to
+ make sure that they have the current structure so that you can
+ take advantage of any new capabilities. (Some releases of
+ MySQL introduce changes to the structure of the grant tables
+ to add new privileges or features.)
- The last option is to start mysqld with the --standalone and
- --debug options. In this case, mysqld writes a log file
- C:\mysqld.trace that should contain the reason why mysqld doesn't
- start. See MySQL Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
-
- Use mysqld --verbose --help to display all the options that mysqld
- supports.
-
-2.3.11. Starting MySQL as a Windows Service
-
- On Windows, the recommended way to run MySQL is to install it as a
- Windows service, whereby MySQL starts and stops automatically when
- Windows starts and stops. A MySQL server installed as a service
- can also be controlled from the command line using NET commands,
- or with the graphical Services utility. Generally, to install
- MySQL as a Windows service you should be logged in using an
- account that has administrator rights.
+ * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
+ Be Rebuilt," to see whether changes to table formats or to
+ character sets or collations were made between your current
+ version of MySQL and the version to which you are upgrading.
+ If so and these changes result in an incompatibility between
+ MySQL versions, you will need to upgrade the affected tables
+ using the instructions in Section 2.4.4, "Rebuilding or
+ Repairing Tables or Indexes."
- The Services utility (the Windows Service Control Manager) can be
- found in the Windows Control Panel (under Administrative Tools on
- Windows 2000, XP, Vista and Server 2003). To avoid conflicts, it
- is advisable to close the Services utility while performing server
- installation or removal operations from the command line.
+ * If you are running MySQL Server on Windows, see Section 2.5.7,
+ "Upgrading MySQL on Windows."
- Before installing MySQL as a Windows service, you should first
- stop the current server if it is running by using the following
- command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
- -u root shutdown
+ * If you are using replication, see Section 16.3.3, "Upgrading a
+ Replication Setup," for information on upgrading your
+ replication setup.
-Note
+ If your MySQL installation contains a large amount of data that
+ might take a long time to convert after an in-place upgrade, you
+ might find it useful to create a "dummy" database instance for
+ assessing what conversions might be needed and the work involved
+ to perform them. Make a copy of your MySQL instance that contains
+ a full copy of the mysql database, plus all other databases
+ without data. Run your upgrade procedure on this dummy instance to
+ see what actions might be needed so that you can better evaluate
+ the work involved when performing actual data conversion on your
+ original database instance.
- If the MySQL root user account has a password, you need to invoke
- mysqladmin with the -p option and supply the password when
- prompted.
+ MySQL Enterprise MySQL Enterprise subscribers will find more
+ information about upgrading in the Knowledge Base articles found
+ at Upgrading
+ (https://kb.mysql.com/search.php?cat=search&category=41) Access
+ to the MySQL Knowledge Base collection of articles is one of the
+ advantages of subscribing to MySQL Enterprise. For more
+ information, see
+ http://www.mysql.com/products/enterprise/advisors.html.
- This command invokes the MySQL administrative utility mysqladmin
- to connect to the server and tell it to shut down. The command
- connects as the MySQL root user, which is the default
- administrative account in the MySQL grant system. Note that users
- in the MySQL grant system are wholly independent from any login
- users under Windows.
+ The following lists describe changes that may affect applications
+ and that you should watch out for when upgrading to MySQL 5.1.
- Install the server as a service using this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
+ Configuration Changes:
- The service-installation command does not start the server.
- Instructions for that are given later in this section.
+ * Before MySQL 5.1.11, to build MySQL from source with SSL
+ support enabled, you would invoke configure with either the
+ --with-openssl or --with-yassl option. In MySQL 5.1.11, those
+ options both have been replaced by the --with-ssl option. By
+ default, --with-ssl causes the bundled yaSSL library to be
+ used. To select OpenSSL instead, give the option as
+ --with-ssl=path, where path is the directory where the OpenSSL
+ header files and libraries are located.
- To make it easier to invoke MySQL programs, you can add the path
- name of the MySQL bin directory to your Windows system PATH
- environment variable:
+ Server Changes:
- * On the Windows desktop, right-click on the My Computer icon,
- and select Properties.
+ * Known issue: After a binary upgrade to MySQL 5.1 from a MySQL
+ 5.0 installation that contains ARCHIVE tables, accessing those
+ tables will cause the server to crash, even if you have run
+ mysql_upgrade or CHECK TABLE ... FOR UPGRADE. To work around
+ this problem, use mysqldump to dump all ARCHIVE tables before
+ upgrading, and reload them into MySQL 5.1 after upgrading.
+
+ * Known issue: The fix for
+ Bug#23491: http://bugs.mysql.com/23491 introduced a problem
+ with SHOW CREATE VIEW, which is used by mysqldump. This causes
+ an incompatibility when upgrading from versions affected by
+ that bug fix (MySQL 5.0.40 through 5.0.43, MySQL 5.1.18
+ through 5.1.19): If you use mysqldump before upgrading from an
+ affected version and reload the data after upgrading to a
+ higher version, you must drop and recreate your views.
- * Next select the Advanced tab from the System Properties menu
- that appears, and click the Environment Variables button.
+ * Known issue: Dumps performed by using mysqldump to generate a
+ dump file before the upgrade and reloading the file after
+ upgrading are subject to the following problem:
+ Before MySQL 5.0.40, mysqldump displays SPATIAL index
+ definitions using prefix lengths for the indexed columns.
+ These prefix lengths are accepted in MySQL 5.0, but not as of
+ MySQL 5.1. If you use mysqldump from versions of MySQL older
+ than 5.0.40, any table containing SPATIAL indexes will cause
+ an error when the dump file is reloaded into MySQL 5.1 or
+ higher.
+ For example, a table definition might look like this when
+ dumped in MySQL 5.0:
+CREATE TABLE `t` (
+ `g` geometry NOT NULL,
+ SPATIAL KEY `g` (`g`(32))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ The SPATIAL index definition will not be accepted in MySQL
+ 5.1. To work around this, edit the dump file to remove the
+ prefix:
+CREATE TABLE `t` (
+ `g` geometry NOT NULL,
+ SPATIAL KEY `g` (`g`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ Dump files can be large, so it may be preferable to dump table
+ definitions and data separately to make it easier to edit the
+ definitions:
+shell> mysqldump --no-data other_args > definitions.sql
+shell> mysqldump --no-create-info other_args > data.sql
+ Then edit definitions.sql before reloading definitions.sql and
+ data.sql, in that order.
+ If you upgrade to a version of MySQL 5.0 higher than 5.0.40
+ before upgrading to MySQL 5.1, this problem does not occur.
- * Under System Variables, select Path, and then click the Edit
- button. The Edit System Variable dialogue should appear.
+ * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR
+ UPGRADE statement did not check for incompatible collation
+ changes made in MySQL 5.1.24. (This also affects mysqlcheck
+ and mysql_upgrade, which cause that statement to be executed.)
+ Prior to the fix made in 5.1.30, a binary upgrade (performed
+ without dumping tables with mysqldump before the upgrade and
+ reloading the dump file after the upgrade) would corrupt
+ tables. After the fix, CHECK TABLE ... FOR UPGRADE properly
+ detects the problem and warns about tables that need repair.
+ However, the fix is not backward compatible and can result in
+ a downgrading problem under these circumstances:
- * Place your cursor at the end of the text appearing in the
- space marked Variable Value. (Use the End key to ensure that
- your cursor is positioned at the very end of the text in this
- space.) Then enter the complete path name of your MySQL bin
- directory (for example, C:\Program Files\MySQL\MySQL Server
- 5.1\bin), Note that there should be a semicolon separating
- this path from any values present in this field. Dismiss this
- dialogue, and each dialogue in turn, by clicking OK until all
- of the dialogues that were opened have been dismissed. You
- should now be able to invoke any MySQL executable program by
- typing its name at the DOS prompt from any directory on the
- system, without having to supply the path. This includes the
- servers, the mysql client, and all MySQL command-line
- utilities such as mysqladmin and mysqldump.
- You should not add the MySQL bin directory to your Windows
- PATH if you are running multiple MySQL servers on the same
- machine.
+ 1. Perform a binary upgrade to a version of MySQL that
+ includes the fix.
-Warning
+ 2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or
+ mysql_upgrade) to upgrade tables.
- You must exercise great care when editing your system PATH by
- hand; accidental deletion or modification of any portion of the
- existing PATH value can leave you with a malfunctioning or even
- unusable system.
+ 3. Perform a binary downgrade to a version of MySQL that
+ does not include the fix.
+ The solution is to dump tables with mysqldump before the
+ downgrade and reload the dump file after the downgrade.
+ Alternatively, drop and recreate affected indexes.
- The following additional arguments can be used in MySQL 5.1 when
- installing the service:
+ * Known issue: MySQL introduces encoding for table names that
+ have non-ASCII characters (see Section 8.2.3, "Mapping of
+ Identifiers to File Names"). After a binary upgrade from MySQL
+ 5.0 to 5.1 or higher, the server recognizes names that have
+ non-ASCII characters and adds a #mysql50# prefix to them.
+ As of MySQL 5.1.31, mysql_upgrade encodes these names by
+ executing the following command:
+mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table
+-names
+ Prior to MySQL 5.1.31, mysql_upgrade does not execute this
+ command, so you should execute it manually if you have
+ database or table names that contain nonalphanumeric
+ characters.
+ Prior to MySQL 5.1.23, the mysqlcheck command does not perform
+ the name encoding for views. To work around this problem, drop
+ each affected view and recreate it.
+ mysqlcheck cannot fix names that contain literal instances of
+ the @ character that is used for encoding special characters.
+ If you have databases or tables that contain this character,
+ use mysqldump to dump them before upgrading to MySQL 5.1, and
+ then reload the dump file after upgrading.
- * You can specify a service name immediately following the
- --install option. The default service name is MySQL.
+ * Known issue: When upgrading from MySQL 5.0 to versions of 5.1
+ prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which
+ runs mysqlcheck) to upgrade tables fails for names that must
+ be written as quoted identifiers. To work around this problem,
+ rename each affected table to a name that does not require
+ quoting:
+RENAME TABLE `tab``le_a` TO table_a;
+RENAME TABLE `table b` TO table_b;
+ After renaming the tables, run the mysql_upgrade program. Then
+ rename the tables back to their original names:
+RENAME TABLE table_a TO `tab``le_a`;
+RENAME TABLE table_b TO `table b`;
- * If a service name is given, it can be followed by a single
- option. By convention, this should be
- --defaults-file=file_name to specify the name of an option
- file from which the server should read options when it starts.
- The use of a single option other than --defaults-file is
- possible but discouraged. --defaults-file is more flexible
- because it enables you to specify multiple startup options for
- the server by placing them in the named option file.
+ * Known issue: In connection with view creation, the server
+ created arc directories inside database directories and
+ maintained useless copies of .frm files there. Creation and
+ renaming procedures of those copies as well as creation of arc
+ directories has been discontinued in MySQL 5.1.29.
+ This change does cause a problem when downgrading to older
+ server versions which manifests itself under these
+ circumstances:
- * You can also specify a --local-service option following the
- service name. This causes the server to run using the
- LocalService Windows account that has limited system
- privileges. This account is available only for Windows XP or
- newer. If both --defaults-file and --local-service are given
- following the service name, they can be in any order.
+ 1. Create a view v_orig in MySQL 5.1.29 or higher.
- For a MySQL server that is installed as a Windows service, the
- following rules determine the service name and option files that
- the server uses:
+ 2. Rename the view to v_new and then back to v_orig.
- * If the service-installation command specifies no service name
- or the default service name (MySQL) following the --install
- option, the server uses the a service name of MySQL and reads
- options from the [mysqld] group in the standard option files.
+ 3. Downgrade to an older 5.1.x server and run mysql_upgrade.
- * If the service-installation command specifies a service name
- other than MySQL following the --install option, the server
- uses that service name. It reads options from the [mysqld]
- group and the group that has the same name as the service in
- the standard option files. This allows you to use the [mysqld]
- group for options that should be used by all MySQL services,
- and an option group with the service name for use by the
- server installed with that service name.
+ 4. Try to rename v_orig to v_new again. This operation
+ fails.
+ As a workaround to avoid this problem, use either of these
+ approaches:
- * If the service-installation command specifies a
- --defaults-file option after the service name, the server
- reads options only from the [mysqld] group of the named file
- and ignores the standard option files.
+ + Dump your data using mysqldump before downgrading and
+ reload the dump file after downgrading.
- As a more complex example, consider the following command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
- --install MySQL --defaults-file=C:\my-opts.cnf
+ + Instead of renaming a view after the downgrade, drop it
+ and recreate it.
- Here, the default service name (MySQL) is given after the
- --install option. If no --defaults-file option had been given,
- this command would have the effect of causing the server to read
- the [mysqld] group from the standard option files. However,
- because the --defaults-file option is present, the server reads
- options from the [mysqld] option group, and only from the named
- file.
+ * Incompatible change: Character set or collation changes were
+ made in MySQL 5.1.21, 5.1.23, and 5.1.24 that may require
+ table indexes to be rebuilt. For details, see Section 2.4.3,
+ "Checking Whether Tables or Indexes Must Be Rebuilt."
- You can also specify options as Start parameters in the Windows
- Services utility before you start the MySQL service.
+ * Incompatible change: MySQL 5.1 implements support for a plugin
+ API that allows the loading and unloading of components at
+ runtime, without restarting the server. Section 22.2, "The
+ MySQL Plugin Interface." The plugin API requires the
+ mysql.plugin table. After upgrading from an older version of
+ MySQL, you should run the mysql_upgrade command to create this
+ table. See Section 4.4.8, "mysql_upgrade --- Check Tables for
+ MySQL Upgrade."
+ Plugins are installed in the directory named by the plugin_dir
+ system variable. This variable also controls the location from
+ which the server loads user-defined functions (UDFs), which is
+ a change from earlier versions of MySQL. That is, all UDF
+ library files now must be installed in the plugin directory.
+ When upgrading from an older version of MySQL, you must
+ migrate your UDF files to the plugin directory.
- Once a MySQL server has been installed as a service, Windows
- starts the service automatically whenever Windows starts. The
- service also can be started immediately from the Services utility,
- or by using a NET START MySQL command. The NET command is not case
- sensitive.
+ * Incompatible change: The table_cache system variable has been
+ renamed to table_open_cache. Any scripts that refer to
+ table_cache must be updated to use the new name.
- When run as a service, mysqld has no access to a console window,
- so no messages can be seen there. If mysqld does not start, check
- the error log to see whether the server wrote any messages there
- to indicate the cause of the problem. The error log is located in
- the MySQL data directory (for example, C:\Program
- Files\MySQL\MySQL Server 5.1\data). It is the file with a suffix
- of .err.
+ * Incompatible change: In MySQL 5.1.36, options for loading
+ plugins such as pluggable storage engines were changed from
+ boolean to tristate format. The implementations overlap, but
+ if you previously used options of the form --plugin_name=0 or
+ --plugin_name=1, you should instead use --plugin_name=OFF or
+ --plugin_name=ON, respectively. For details, see Section
+ 5.1.3, "Server Options for Loading Plugins."
- When a MySQL server has been installed as a service, and the
- service is running, Windows stops the service automatically when
- Windows shuts down. The server also can be stopped manually by
- using the Services utility, the NET STOP MySQL command, or the
- mysqladmin shutdown command.
+ * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE
+ statement was changed such that assigning NULL to a NOT NULL
+ column caused an error even when strict SQL mode was not
+ enabled. The original behavior before MySQL 5.1.24 was that
+ such assignments caused an error only in strict SQL mode, and
+ otherwise set the column to the implicit default value for the
+ column data type and generated a warning. (For information
+ about implicit default values, see Section 10.1.4, "Data Type
+ Default Values.")
+ The change caused compatibility problems for applications that
+ relied on the original behavior. It also caused replication
+ problems between servers that had the original behavior and
+ those that did not, for applications that assigned NULL to NOT
+ NULL columns in UPDATE statements without strict SQL mode
+ enabled. The change was reverted in MySQL 5.1.32 so that
+ UPDATE again had the original behavior. Problems can still
+ occur if you replicate between servers that have the modified
+ UPDATE behavior and those that do not.
- You also have the choice of installing the server as a manual
- service if you do not wish for the service to be started
- automatically during the boot process. To do this, use the
- --install-manual option rather than the --install option:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install-m
-anual
+ * Incompatible change: As of MySQL 5.1.29, the default binary
+ logging mode has been changed from MIXED to STATEMENT for
+ compatibility with MySQL 5.0.
- To remove a server that is installed as a service, first stop it
- if it is running by executing NET STOP MySQL. Then use the
- --remove option to remove it:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove
+ * Incompatible change: In MySQL 5.1.25, a change was made to the
+ way that the server handles prepared statements. This affects
+ prepared statements processed at the SQL level (using the
+ PREPARE statement) and those processed using the binary
+ client-server protocol (using the mysql_stmt_prepare() C API
+ function).
+ Previously, changes to metadata of tables or views referred to
+ in a prepared statement could cause a server crash when the
+ statement was next executed, or perhaps an error at execute
+ time with a crash occurring later. For example, this could
+ happen after dropping a table and recreating it with a
+ different definition.
+ Now metadata changes to tables or views referred to by
+ prepared statements are detected and cause automatic
+ repreparation of the statement when it is next executed.
+ Metadata changes occur for DDL statements such as those that
+ create, drop, alter, rename, or truncate tables, or that
+ analyze, optimize, or repair tables. Repreparation also occurs
+ after referenced tables or views are flushed from the table
+ definition cache, either implicitly to make room for new
+ entries in the cache, or explicitly due to FLUSH TABLES.
+ Repreparation is automatic, but to the extent that it occurs,
+ performance of prepared statements is diminished.
+ Table content changes (for example, with INSERT or UPDATE) do
+ not cause repreparation, nor do SELECT statements.
+ An incompatibility with previous versions of MySQL is that a
+ prepared statement may now return a different set of columns
+ or different column types from one execution to the next. For
+ example, if the prepared statement is SELECT * FROM t1,
+ altering t1 to contain a different number of columns causes
+ the next execution to return a number of columns different
+ from the previous execution.
+ Older versions of the client library cannot handle this change
+ in behavior. For applications that use prepared statements
+ with the new server, an upgrade to the new client library is
+ strongly recommended.
+ Along with this change to statement repreparation, the default
+ value of the table_definition_cache system variable has been
+ increased from 128 to 256. The purpose of this increase is to
+ lessen the chance that prepared statements will need
+ repreparation due to referred-to tables/views having been
+ flushed from the cache to make room for new entries.
+ A new status variable, Com_stmt_reprepare, has been introduced
+ to track the number of repreparations.
- If mysqld is not running as a service, you can start it from the
- command line. For instructions, see Section 2.3.10, "Starting
- MySQL from the Windows Command Line."
+ * Incompatible change: As of MySQL 5.1.23, within a stored
+ routine, it is no longer allowable to declare a cursor for a
+ SHOW or DESCRIBE statement. This happened to work in some
+ instances, but is no longer supported. In many cases, a
+ workaround for this change is to use the cursor with a SELECT
+ query to read from an INFORMATION_SCHEMA table that produces
+ the same information as the SHOW statement.
- Please see Section 2.3.13, "Troubleshooting a MySQL Installation
- Under Windows," if you encounter difficulties during installation.
+ * Incompatible change: SHOW CREATE VIEW displays view
+ definitions using an AS alias_name clause for each column. If
+ a column is created from an expression, the default alias is
+ the expression text, which can be quite long. As of MySQL
+ 5.1.23, aliases for column names in CREATE VIEW statements are
+ checked against the maximum column length of 64 characters
+ (not the maximum alias length of 256 characters). As a result,
+ views created from the output of SHOW CREATE VIEW fail if any
+ column alias exceeds 64 characters. This can cause problems
+ for replication or loading dump files. For additional
+ information and workarounds, see Section D.4, "Restrictions on
+ Views."
-2.3.12. Testing The MySQL Installation
+ * Incompatible change: Several issues were identified for stored
+ programs (stored procedures and functions, triggers, and
+ events) and views containing non-ASCII symbols. These issues
+ involved conversion errors due to incomplete character set
+ information when translating these objects to and from stored
+ format.
+ To address these problems, the representation for these
+ objects was changed in MySQL 5.1.21. However, the fixes affect
+ all stored programs and views. (For example, you will see
+ warnings about "no creation context.") To avoid warnings from
+ the server about the use of old definitions from any release
+ prior to 5.1.21, you should dump stored programs and views
+ with mysqldump after upgrading to 5.1.21 or higher, and then
+ reload them to recreate them with new definitions. Invoke
+ mysqldump with a --default-character-set option that names the
+ non-ASCII character set that was used for the definitions when
+ the objects were originally defined.
- You can test whether the MySQL server is working by executing any
- of the following commands:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow"
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -u root
-mysql
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" version
- status proc
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test
+ * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports
+ error logging to syslog on systems that support the logger
+ command. The new --syslog and --skip-syslog options can be
+ used instead of the --log-error option to control logging
+ behavior, as described in Section 4.3.2, "mysqld_safe ---
+ MySQL Server Startup Script."
+ In 5.1.21 and up, the default is --skip-syslog, which is
+ compatible with the default behavior of writing an error log
+ file for releases prior to 5.1.20.
+ In 5.1.20 only, the following conditions apply: 1) The default
+ is to use syslog, which is not compatible with releases prior
+ to 5.1.20. 2) Logging to syslog may fail to operate correctly
+ in some cases. For these reasons, avoid using MySQL 5.1.20.
- If mysqld is slow to respond to TCP/IP connections from client
- programs, there is probably a problem with your DNS. In this case,
- start mysqld with the --skip-name-resolve option and use only
- localhost and IP numbers in the Host column of the MySQL grant
- tables.
+ * Incompatible change: As of MySQL 5.1.18, the plugin interface
+ and its handling of system variables was changed. Command-line
+ options such as --skip-innodb now cause an error if InnoDB is
+ not built-in or plugin-loaded. You should use
+ --loose-skip-innodb if you do not want any error even if
+ InnoDB is not available. The --loose prefix modifier should be
+ used for all command-line options where you are uncertain
+ whether the plugin exists and when you want the operation to
+ proceed even if the option is necessarily ignored due to the
+ absence of the plugin. (For a desecription of how --loose
+ works, see Section 4.2.3.1, "Using Options on the Command
+ Line.")
- You can force a MySQL client to use a named-pipe connection rather
- than TCP/IP by specifying the --pipe or --protocol=PIPE option, or
- by specifying . (period) as the host name. Use the --socket option
- to specify the name of the pipe if you do not want to use the
- default pipe name.
+ * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back
+ only the last statement on a transaction timeout. A new
+ option, --innodb_rollback_on_timeout, causes InnoDB to abort
+ and roll back the entire transaction if a transaction timeout
+ occurs (the same behavior as in MySQL 4.1).
- Note that if you have set a password for the root account, deleted
- the anonymous account, or created a new user account, then you
- must use the appropriate -u and -p options with the commands shown
- above in order to connect with the MySQL Server. See Section
- 4.2.2, "Connecting to the MySQL Server."
+ * Incompatible change: As of MySQL 5.1.15, the following
+ conditions apply to enabling the read_only system variable:
- For more information about mysqlshow, see Section 4.5.6,
- "mysqlshow --- Display Database, Table, and Column Information."
+ + If you attempt to enable read_only while you have any
+ explicit locks (acquired with LOCK TABLES or have a
+ pending transaction, an error will occur.
-2.3.13. Troubleshooting a MySQL Installation Under Windows
+ + If other clients hold explicit table locks or have
+ pending transactions, the attempt to enable read_only
+ blocks until the locks are released and the transactions
+ end. While the attempt to enable read_only is pending,
+ requests by other clients for table locks or to begin
+ transactions also block until read_only has been set.
- When installing and running MySQL for the first time, you may
- encounter certain errors that prevent the MySQL server from
- starting. The purpose of this section is to help you diagnose and
- correct some of these errors.
+ + read_only can be enabled while you hold a global read
+ lock (acquired with FLUSH TABLES WITH READ LOCK) because
+ that does not involve table locks.
+ Previously, the attempt to enable read_only would return
+ immediately even if explicit locks or transactions were
+ pending, so some data changes could occur for statements
+ executing in the server at the same time.
- Your first resource when troubleshooting server issues is the
- error log. The MySQL server uses the error log to record
- information relevant to the error that prevents the server from
- starting. The error log is located in the data directory specified
- in your my.ini file. The default data directory location is
- C:\Program Files\MySQL\MySQL Server 5.1\data. See Section 5.2.2,
- "The Error Log."
+ * Incompatible change: The number of function names affected by
+ IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from
+ about 200 to about 30. (For details about IGNORE_SPACE, see
+ Section 8.2.4, "Function Name Parsing and Resolution.") This
+ change improves the consistency of parser operation. However,
+ it also introduces the possibility of incompatibility for old
+ SQL code that relies on the following conditions:
- Another source of information regarding possible errors is the
- console messages displayed when the MySQL service is starting. Use
- the NET START MySQL command from the command line after installing
- mysqld as a service to see any error messages regarding the
- starting of the MySQL server as a service. See Section 2.3.11,
- "Starting MySQL as a Windows Service."
+ + IGNORE_SPACE is disabled.
- The following examples show other common error messages you may
- encounter when installing MySQL and starting the server for the
- first time:
+ + The presence or absence of whitespace following a
+ function name is used to distinguish between a built-in
+ function and stored function that have the same name (for
+ example, PI() versus PI ()).
+ For functions that are no longer affected by IGNORE_SPACE as
+ of MySQL 5.1.13, that strategy no longer works. Either of the
+ following approaches can be used if you have code that is
+ subject to the preceding incompatibility:
- * If the MySQL server cannot find the mysql privileges database
- or other critical files, you may see these messages:
-System error 1067 has occurred.
-Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't
-exist
- These messages often occur when the MySQL base or data
- directories are installed in different locations than the
- default locations (C:\Program Files\MySQL\MySQL Server 5.1 and
- C:\Program Files\MySQL\MySQL Server 5.1\data, respectively).
- This situation may occur when MySQL is upgraded and installed
- to a new location, but the configuration file is not updated
- to reflect the new location. In addition, there may be old and
- new configuration files that conflict. Be sure to delete or
- rename any old configuration files when upgrading MySQL.
- If you have installed MySQL to a directory other than
- C:\Program Files\MySQL\MySQL Server 5.1, you need to ensure
- that the MySQL server is aware of this through the use of a
- configuration (my.ini) file. The my.ini file needs to be
- located in your Windows directory, typically C:\WINDOWS. You
- can determine its exact location from the value of the WINDIR
- environment variable by issuing the following command from the
- command prompt:
-C:\> echo %WINDIR%
- An option file can be created and modified with any text
- editor, such as Notepad. For example, if MySQL is installed in
- E:\mysql and the data directory is D:\MySQLdata, you can
- create the option file and set up a [mysqld] section to
- specify values for the basedir and datadir options:
-[mysqld]
-# set basedir to your installation path
-basedir=E:/mysql
-# set datadir to the location of your data directory
-datadir=D:/MySQLdata
- Note that Windows path names are specified in option files
- using (forward) slashes rather than backslashes. If you do use
- backslashes, you must double them:
-[mysqld]
-# set basedir to your installation path
-basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1
-# set datadir to the location of your data directory
-datadir=D:\\MySQLdata
- If you change the datadir value in your MySQL configuration
- file, you must move the contents of the existing MySQL data
- directory before restarting the MySQL server.
- See Section 2.3.7, "Creating an Option File."
-
- * If you reinstall or upgrade MySQL without first stopping and
- removing the existing MySQL service and install MySQL using
- the MySQL Configuration Wizard, you may see this error:
-Error: Cannot create Windows service for MySql. Error: 0
- This occurs when the Configuration Wizard tries to install the
- service and finds an existing service with the same name.
- One solution to this problem is to choose a service name other
- than mysql when using the configuration wizard. This allows
- the new service to be installed correctly, but leaves the
- outdated service in place. Although this is harmless, it is
- best to remove old services that are no longer in use.
- To permanently remove the old mysql service, execute the
- following command as a user with administrative privileges, on
- the command-line:
-C:\> sc delete mysql
-[SC] DeleteService SUCCESS
- If the sc utility is not available for your version of
- Windows, download the delsrv utility from
- http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi
- sting/delsrv-o.asp and use the delsrv mysql syntax.
-
-2.3.14. Upgrading MySQL on Windows
-
- This section lists some of the steps you should take when
- upgrading MySQL on Windows.
-
- 1. Review Section 2.12.1, "Upgrading MySQL," for additional
- information on upgrading MySQL that is not specific to
- Windows.
-
- 2. You should always back up your current MySQL installation
- before performing an upgrade. See Section 6.1, "Database
- Backups."
-
- 3. Download the latest Windows distribution of MySQL from
- http://dev.mysql.com/downloads/.
-
- 4. Before upgrading MySQL, you must stop the server. If the
- server is installed as a service, stop the service with the
- following command from the command prompt:
-C:\> NET STOP MySQL
- If you are not running the MySQL server as a service, use the
- following command to stop it:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
- shutdown
-
-Note
- If the MySQL root user account has a password, you need to
- invoke mysqladmin with the -p option and supply the password
- when prompted.
-
- 5. When upgrading to MySQL 5.1 from a version previous to 4.1.5,
- or when upgrading from a version of MySQL installed from a Zip
- archive to a version of MySQL installed with the MySQL
- Installation Wizard, you must manually remove the previous
- installation and MySQL service (if the server is installed as
- a service).
- To remove the MySQL service, use the following command:
-C:\> C:\mysql\bin\mysqld --remove
- If you do not remove the existing service, the MySQL
- Installation Wizard may fail to properly install the new MySQL
- service.
-
- 6. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change
- in the default location of the data directory from a directory
- within the MySQL installation to the AppData folder means that
- you must manually copy the data files from your old
- installation to the new location.
-
- 7. If you are using the MySQL Installation Wizard, start the
- wizard as described in Section 2.3.3, "Using the MySQL
- Installation Wizard."
-
- 8. If you are installing MySQL from a Zip archive, extract the
- archive. You may either overwrite your existing MySQL
- installation (usually located at C:\mysql), or install it into
- a different directory, such as C:\mysql5. Overwriting the
- existing installation is recommended.
-
- 9. If you were running MySQL as a Windows service and you had to
- remove the service earlier in this procedure, reinstall the
- service. (See Section 2.3.11, "Starting MySQL as a Windows
- Service.")
- 10. Restart the server. For example, use NET START MySQL if you
- run MySQL as a service, or invoke mysqld directly otherwise.
- 11. If you encounter errors, see Section 2.3.13, "Troubleshooting
- a MySQL Installation Under Windows."
-
-2.3.15. MySQL on Windows Compared to MySQL on Unix
-
- MySQL for Windows has proven itself to be very stable. The Windows
- version of MySQL has the same features as the corresponding Unix
- version, with the following exceptions:
-
- * Limited number of ports
- Windows systems have about 4,000 ports available for client
- connections, and after a connection on a port closes, it takes
- two to four minutes before the port can be reused. In
- situations where clients connect to and disconnect from the
- server at a high rate, it is possible for all available ports
- to be used up before closed ports become available again. If
- this happens, the MySQL server appears to be unresponsive even
- though it is running. Note that ports may be used by other
- applications running on the machine as well, in which case the
- number of ports available to MySQL is lower.
- For more information about this problem, see
- http://support.microsoft.com/default.aspx?scid=kb;en-us;196271
- .
-
- * Concurrent reads
- MySQL depends on the pread() and pwrite() system calls to be
- able to mix INSERT and SELECT. Currently, we use mutexes to
- emulate pread() and pwrite(). We intend to replace the file
- level interface with a virtual interface in the future so that
- we can use the readfile()/writefile() interface to get more
- speed. The current implementation limits the number of open
- files that MySQL 5.1 can use to 2,048, which means that you
- cannot run as many concurrent threads on Windows as on Unix.
-
- * Blocking read
- MySQL uses a blocking read for each connection. That has the
- following implications if named-pipe connections are enabled:
-
- + A connection is not disconnected automatically after
- eight hours, as happens with the Unix version of MySQL.
-
- + If a connection hangs, it is not possible to break it
- without killing MySQL.
-
- + mysqladmin kill does not work on a sleeping connection.
-
- + mysqladmin shutdown cannot abort as long as there are
- sleeping connections.
- We plan to fix this problem in the future.
-
- * ALTER TABLE
- While you are executing an ALTER TABLE statement, the table is
- locked from being used by other threads. This has to do with
- the fact that on Windows, you can't delete a file that is in
- use by another thread. In the future, we may find some way to
- work around this problem.
-
- * DROP TABLE
- DROP TABLE on a table that is in use by a MERGE table does not
- work on Windows because the MERGE handler does the table
- mapping hidden from the upper layer of MySQL. Because Windows
- does not allow dropping files that are open, you first must
- flush all MERGE tables (with FLUSH TABLES) or drop the MERGE
- table before dropping the table.
-
- * DATA DIRECTORY and INDEX DIRECTORY
- The DATA DIRECTORY and INDEX DIRECTORY options for CREATE
- TABLE are ignored on Windows, because Windows doesn't support
- symbolic links. These options also are ignored on systems that
- have a nonfunctional realpath() call.
-
- * DROP DATABASE
- You cannot drop a database that is in use by some thread.
-
- * Case-insensitive names
- File names are not case sensitive on Windows, so MySQL
- database and table names are also not case sensitive on
- Windows. The only restriction is that database and table names
- must be specified using the same case throughout a given
- statement. See Section 8.2.2, "Identifier Case Sensitivity."
-
- * Directory and file names
- On Windows, MySQL Server supports only directory and file
- names that are compatible with the current ANSI code pages.
- For example, the following Japanese directory name will not
- work in the Western locale (code page 1252):
-datadir="C:/维基百科关于中文维基百科"
- The same limitation applies to directory and file names
- referred to in SQL statements, such as the data file path name
- in LOAD DATA INFILE.
-
- * The "\" path name separator character
- Path name components in Windows are separated by the "\"
- character, which is also the escape character in MySQL. If you
- are using LOAD DATA INFILE or SELECT ... INTO OUTFILE, use
- Unix-style file names with "/" characters:
-mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;
-mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
- Alternatively, you must double the "\" character:
-mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;
-mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;
-
- * Problems with pipes
- Pipes do not work reliably from the Windows command-line
- prompt. If the pipe includes the character ^Z / CHAR(24),
- Windows thinks that it has encountered end-of-file and aborts
- the program.
- This is mainly a problem when you try to apply a binary log as
- follows:
-C:\> mysqlbinlog binary_log_file | mysql --user=root
- If you have a problem applying the log and suspect that it is
- because of a ^Z / CHAR(24) character, you can use the
- following workaround:
-C:\> mysqlbinlog binary_log_file --result-file=/tmp/bin.sql
-C:\> mysql --user=root --execute "source /tmp/bin.sql"
- The latter command also can be used to reliably read in any
- SQL file that may contain binary data.
-
- * Access denied for user error
- If MySQL cannot resolve your host name properly, you may get
- the following error when you attempt to run a MySQL client
- program to connect to a server running on the same machine:
-Access denied for user 'some_user'@'unknown'
-to database 'mysql'
- To fix this problem, you should create a file named
- \windows\hosts containing the following information:
-127.0.0.1 localhost
-
- Here are some open issues for anyone who might want to help us
- improve MySQL on Windows:
-
- * Add macros to use the faster thread-safe increment/decrement
- methods provided by Windows.
-
-2.4. Installing MySQL from RPM Packages on Linux
-
- The recommended way to install MySQL on RPM-based Linux
- distributions is by using the RPM packages. The RPMs that we
- provide to the community should work on all versions of Linux that
- support RPM packages and use glibc 2.3. To obtain RPM packages,
- see Section 2.1.3, "How to Get MySQL."
-
- For non-RPM Linux distributions, you can install MySQL using a
- .tar.gz package. See Section 2.9, "Installing MySQL from tar.gz
- Packages on Other Unix-Like Systems."
-
- We do provide some platform-specific RPMs; the difference between
- a platform-specific RPM and a generic RPM is that a
- platform-specific RPM is built on the targeted platform and is
- linked dynamically whereas a generic RPM is linked statically with
- LinuxThreads.
-
-Note
-
- RPM distributions of MySQL often are provided by other vendors. Be
- aware that they may differ in features and capabilities from those
- built by us, and that the instructions in this manual do not
- necessarily apply to installing them. The vendor's instructions
- should be consulted instead.
-
- If you have problems with an RPM file (for example, if you receive
- the error Sorry, the host 'xxxx' could not be looked up), see
- Section 2.13.1.2, "Linux Binary Distribution Notes."
-
- In most cases, you need to install only the MySQL-server and
- MySQL-client packages to get a functional MySQL installation. The
- other packages are not required for a standard installation.
-
- RPMs for MySQL Cluster. Beginning with MySQL 5.1.24, standard
- MySQL server RPMs built by MySQL no longer provide support for the
- NDBCLUSTER storage engine. MySQL Cluster users wanting to upgrade
- MySQL 5.1.23 or earlier installations from RPMs built by MySQL
- should upgrade to MySQL Cluster NDB 6.2 or MySQL Cluster NDB 6.3;
- RPMs that should work with most Linux distributions are available
- for both of these release series.
-
-Important
-
- When upgrading a MySQL Cluster RPM installation, you must upgrade
- all installed RPMs, including the Server and Client RPMs.
-
- For more information about installing MySQL Cluster from RPMs, see
- Section 17.2.2, "MySQL Cluster Multi-Computer Installation."
-
- For upgrades, if your installation was originally produced by
- installing multiple RPM packages, it is best to upgrade all the
- packages, not just some. For example, if you previously installed
- the server and client RPMs, do not upgrade just the server RPM.
-
- If you get a dependency failure when trying to install MySQL
- packages (for example, error: removing these packages would break
- dependencies: libmysqlclient.so.10 is needed by ...), you should
- also install the MySQL-shared-compat package, which includes both
- the shared libraries for backward compatibility
- (libmysqlclient.so.12 for MySQL 4.0 and libmysqlclient.so.10 for
- MySQL 3.23).
-
- Some Linux distributions still ship with MySQL 3.23 and they
- usually link applications dynamically to save disk space. If these
- shared libraries are in a separate package (for example,
- MySQL-shared), it is sufficient to simply leave this package
- installed and just upgrade the MySQL server and client packages
- (which are statically linked and do not depend on the shared
- libraries). For distributions that include the shared libraries in
- the same package as the MySQL server (for example, Red Hat Linux),
- you could either install our 3.23 MySQL-shared RPM, or use the
- MySQL-shared-compat package instead. (Do not install both.)
-
- The RPM packages shown in the following list are available. The
- names shown here use a suffix of .glibc23.i386.rpm, but particular
- packages can have different suffixes, as described later.
-
- * MySQL-server-VERSION.glibc23.i386.rpm
- The MySQL server. You need this unless you only want to
- connect to a MySQL server running on another machine.
-
- * MySQL-client-VERSION.glibc23.i386.rpm
- The standard MySQL client programs. You probably always want
- to install this package.
-
- * MySQL-devel-VERSION.glibc23.i386.rpm
- The libraries and include files that are needed if you want to
- compile other MySQL clients, such as the Perl modules.
-
- * MySQL-debuginfo-VERSION.glibc23.i386.rpm
- This package contains debugging information. debuginfo RPMs
- are never needed to use MySQL software; this is true both for
- the server and for client programs. However, they contain
- additional information that might be needed by a debugger to
- analyze a crash.
-
- * MySQL-shared-VERSION.glibc23.i386.rpm
- This package contains the shared libraries
- (libmysqlclient.so*) that certain languages and applications
- need to dynamically load and use MySQL. It contains
- single-threaded and thread-safe libraries. If you install this
- package, do not install the MySQL-shared-compat package.
-
- * MySQL-shared-compat-VERSION.glibc23.i386.rpm
- This package includes the shared libraries for MySQL 3.23,
- 4.0, and so on, up to the current release. It contains
- single-threaded and thread-safe libraries. Install this
- package instead of MySQL-shared if you have applications
- installed that are dynamically linked against older versions
- of MySQL but you want to upgrade to the current version
- without breaking the library dependencies.
-
- * MySQL-embedded-VERSION.glibc23.i386.rpm
- The embedded MySQL server library.
-
- * MySQL-ndb-management-VERSION.glibc23.i386.rpm,
- MySQL-ndb-storage-VERSION.glibc23.i386.rpm,
- MySQL-ndb-tools-VERSION.glibc23.i386.rpm,
- MySQL-ndb-extra-VERSION.glibc23.i386.rpm
- Packages that contain additional files for MySQL Cluster
- installations.
-
-Note
- The MySQL-ndb-tools RPM requires a working installation of
- perl. Prior to MySQL 5.1.18, the DBI and HTML::Template
- packages were also required. See Section 2.15, "Perl
- Installation Notes," and Section 17.6.21, "ndb_size.pl ---
- NDBCLUSTER Size Requirement Estimator," for more information.
-
- * MySQL-test-VERSION.glibc23.i386.rpm
- This package includes the MySQL test suite.
-
- * MySQL-VERSION.src.rpm
- This contains the source code for all of the previous
- packages. It can also be used to rebuild the RPMs on other
- architectures (for example, Alpha or SPARC).
-
- The suffix of RPM package names (following the VERSION value) has
- the following syntax:
-.PLATFORM.CPU.rpm
-
- The PLATFORM and CPU values indicate the type of system for which
- the package is built. PLATFORM indicates the platform and CPU
- indicates the processor type or family.
-
- All packages are dynamically linked against glibc 2.3. The
- PLATFORM value indicates whether the package is platform
- independent or intended for a specific platform, as shown in the
- following table.
- glibc23 Platform independent, should run on any Linux distribution
- that supports glibc 2.3
- rhel3, rhel4 Red Hat Enterprise Linux 3 or 4
- sles9, sles10 SuSE Linux Enterprise Server 9 or 10
-
- In MySQL 5.1, only glibc23 packages are available currently.
-
- The CPU value indicates the processor type or family for which the
- package is built.
- i386 x86 processor, 386 and up
- i586 x86 processor, Pentium and up
- x86_64 64-bit x86 processor
- ia64 Itanium (IA-64) processor
-
- To see all files in an RPM package (for example, a MySQL-server
- RPM), run a command like this:
-shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm
-
- To perform a standard minimal installation, install the server and
- client RPMs:
-shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm
-shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
-
- To install only the client programs, install just the client RPM:
-shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
-
- RPM provides a feature to verify the integrity and authenticity of
- packages before installing them. If you would like to learn more
- about this feature, see Section 2.1.4, "Verifying Package
- Integrity Using MD5 Checksums or GnuPG."
-
- The server RPM places data under the /var/lib/mysql directory. The
- RPM also creates a login account for a user named mysql (if one
- does not exist) to use for running the MySQL server, and creates
- the appropriate entries in /etc/init.d/ to start the server
- automatically at boot time. (This means that if you have performed
- a previous installation and have made changes to its startup
- script, you may want to make a copy of the script so that you
- don't lose it when you install a newer RPM.) See Section 2.11.2.2,
- "Starting and Stopping MySQL Automatically," for more information
- on how MySQL can be started automatically on system startup.
-
- If you want to install the MySQL RPM on older Linux distributions
- that do not support initialization scripts in /etc/init.d
- (directly or via a symlink), you should create a symbolic link
- that points to the location where your initialization scripts
- actually are installed. For example, if that location is
- /etc/rc.d/init.d, use these commands before installing the RPM to
- create /etc/init.d as a symbolic link that points there:
-shell> cd /etc
-shell> ln -s rc.d/init.d .
-
- However, all current major Linux distributions should support the
- new directory layout that uses /etc/init.d, because it is required
- for LSB (Linux Standard Base) compliance.
-
- If the RPM files that you install include MySQL-server, the mysqld
- server should be up and running after installation. You should be
- able to start using MySQL.
-
- If something goes wrong, you can find more information in the
- binary installation section. See Section 2.9, "Installing MySQL
- from tar.gz Packages on Other Unix-Like Systems."
-
-Note
-
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
-
- During RPM installation, a user named mysql and a group named
- mysql are created on the system. This is done using the useradd,
- groupadd, and usermod commands. Those commands require appropriate
- administrative privileges, which is ensured for locally managed
- users and groups (as listed in the /etc/passwd and /etc/group
- files) by the RPM installation process being run by root.
-
- For nonlocal user management (LDAP, NIS, and so forth), the
- administrative tools may require additional authentication (such
- as a password), and will fail if the installing user does not
- provide this authentication. Even if they fail, the RPM
- installation will not abort but succeed, and this is intentional.
- If they failed, some of the intended transfer of ownership may be
- missing, and it is recommended that the system administrator then
- manually ensures some appropriate user andgroup exists and
- manually transfers ownership following the actions in the RPM spec
- file.
-
-2.5. Installing MySQL on Mac OS X
-
- You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
- using a Mac OS X binary package in PKG format instead of the
- binary tarball distribution. Please note that older versions of
- Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this
- package.
-
- The package is located inside a disk image (.dmg) file that you
- first need to mount by double-clicking its icon in the Finder. It
- should then mount the image and display its contents.
-
- To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
-
-Note
-
- Before proceeding with the installation, be sure to shut down all
- running MySQL server instances by either using the MySQL Manager
- Application (on Mac OS X Server) or via mysqladmin shutdown on the
- command line.
-
- To actually install the MySQL PKG file, double-click on the
- package icon. This launches the Mac OS X Package Installer, which
- guides you through the installation of MySQL.
-
- Due to a bug in the Mac OS X package installer, you may see this
- error message in the destination disk selection dialog:
-You cannot install this software on this disk. (null)
+ + If a stored function has a name that conflicts with a
+ built-in function, refer to the stored function with a
+ schema name qualifier, regardless of whether whitespace
+ is present. For example, write schema_name.PI() or
+ schema_name.PI ().
- If this error occurs, simply click the Go Back button once to
- return to the previous screen. Then click Continue to advance to
- the destination disk selection again, and you should be able to
- choose the destination disk correctly. We have reported this bug
- to Apple and it is investigating this problem.
-
- The Mac OS X PKG of MySQL installs itself into
- /usr/local/mysql-VERSION and also installs a symbolic link,
- /usr/local/mysql, that points to the new location. If a directory
- named /usr/local/mysql exists, it is renamed to
- /usr/local/mysql.bak first. Additionally, the installer creates
- the grant tables in the mysql database by executing
- mysql_install_db.
-
- The installation layout is similar to that of a tar file binary
- distribution; all MySQL binaries are located in the directory
- /usr/local/mysql/bin. The MySQL socket file is created as
- /tmp/mysql.sock by default. See Section 2.1.5, "Installation
- Layouts."
-
- MySQL installation requires a Mac OS X user account named mysql. A
- user account with this name should exist by default on Mac OS X
- 10.2 and up.
+ + Alternatively, rename the stored function to use a
+ nonconflicting name and change invocations of the
+ function to use the new name.
- If you are running Mac OS X Server, a version of MySQL should
- already be installed. The following table shows the versions of
- MySQL that ship with Mac OS X Server versions.
- Mac OS X Server Version MySQL Version
- 10.2-10.2.2 3.23.51
- 10.2.3-10.2.6 3.23.53
- 10.3 4.0.14
- 10.3.2 4.0.16
- 10.4.0 4.1.10a
+ * Incompatible change: For utf8 columns, the full-text parser
+ incorrectly considered several nonword punctuation and
+ whitespace characters as word characters, causing some
+ searches to return incorrect results. The fix involves a
+ change to the full-text parser in MySQL 5.1.12, so as of
+ 5.1.12, any tables that have FULLTEXT indexes on utf8 columns
+ must be repaired with REPAIR TABLE:
+REPAIR TABLE tbl_name QUICK;
- This manual section covers the installation of the official MySQL
- Mac OS X PKG only. Make sure to read Apple's help information
- about installing MySQL: Run the "Help View" application, select
- "Mac OS X Server" help, do a search for "MySQL," and read the item
- entitled "Installing MySQL."
-
- If you previously used Marc Liyanage's MySQL packages for Mac OS X
- from http://www.entropy.ch, you can simply follow the update
- instructions for packages using the binary installation layout as
- given on his pages.
-
- If you are upgrading from Marc's 3.23.x versions or from the Mac
- OS X Server version of MySQL to the official MySQL PKG, you also
- need to convert the existing MySQL privilege tables to the current
- format, because some new security privileges have been added. See
- Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL Upgrade."
-
- If you want MySQL to start automatically during system startup,
- you also need to install the MySQL Startup Item. It is part of the
- Mac OS X installation disk images as a separate installation
- package. Simply double-click the MySQLStartupItem.pkg icon and
- follow the instructions to install it. The Startup Item need be
- installed only once. There is no need to install it each time you
- upgrade the MySQL package later.
+ * Incompatible change: Storage engines can be pluggable at
+ runtime, so the distinction between disabled and invalid
+ storage engines no longer applies. As of MySQL 5.1.12, this
+ affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in
+ Section 5.1.8, "Server SQL Modes."
- The Startup Item for MySQL is installed into
- /Library/StartupItems/MySQLCOM. (Before MySQL 4.1.2, the location
- was /Library/StartupItems/MySQL, but that collided with the MySQL
- Startup Item installed by Mac OS X Server.) Startup Item
- installation adds a variable MYSQLCOM=-YES- to the system
- configuration file /etc/hostconfig. If you want to disable the
- automatic startup of MySQL, simply change this variable to
- MYSQLCOM=-NO-.
-
- On Mac OS X Server, the default MySQL installation uses the
- variable MYSQL in the /etc/hostconfig file. The MySQL Startup Item
- installer disables this variable by setting it to MYSQL=-NO-. This
- avoids boot time conflicts with the MYSQLCOM variable used by the
- MySQL Startup Item. However, it does not shut down a running MySQL
- server. You should do that yourself.
+ * Incompatible change: The structure of FULLTEXT indexes has
+ been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or
+ greater, any tables that have FULLTEXT indexes must be
+ repaired with REPAIR TABLE:
+REPAIR TABLE tbl_name QUICK;
- After the installation, you can start up MySQL by running the
- following commands in a terminal window. You must have
- administrator privileges to perform this task.
+ * Incompatible change: In MySQL 5.1.6, when log tables were
+ implemented, the default log destination for the general query
+ and slow query log was TABLE. As of MySQL 5.1.21, this default
+ has been changed to FILE, which is compatible with MySQL 5.0,
+ but incompatible with earlier releases of MySQL 5.1. If you
+ are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging
+ option changes should be necessary. However, if you are
+ upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and
+ were using TABLE logging, use the --log-output=TABLE option
+ explicitly to preserve your server's table-logging behavior.
- If you have installed the Startup Item, use this command:
-shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
-(Enter your password, if necessary)
-(Press Control-D or enter "exit" to exit the shell)
+ * Incompatible change: For ENUM columns that had enumeration
+ values containing commas, the commas were mapped to 0xff
+ internally. However, this rendered the commas
+ indistinguishable from true 0xff characters in the values.
+ This no longer occurs. However, the fix requires that you dump
+ and reload any tables that have ENUM columns containing true
+ 0xff in their values: Dump the tables using mysqldump with the
+ current server before upgrading from a version of MySQL 5.1
+ older than 5.1.15 to version 5.1.15 or newer.
- If you don't use the Startup Item, enter the following command
- sequence:
-shell> cd /usr/local/mysql
-shell> sudo ./bin/mysqld_safe
-(Enter your password, if necessary)
-(Press Control-Z)
-shell> bg
-(Press Control-D or enter "exit" to exit the shell)
+ * As of MySQL 5.1.12, the lc_time_names system variable
+ specifies the locale that controls the language used to
+ display day and month names and abbreviations. This variable
+ affects the output from the DATE_FORMAT(), DAYNAME() and
+ MONTHNAME() functions. See Section 9.8, "MySQL Server Locale
+ Support."
- You should be able to connect to the MySQL server, for example, by
- running /usr/local/mysql/bin/mysql.
+ * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes
+ mysqld-max if it exists. Instead, it invokes mysqld unless a
+ --mysqld or --mysqld-version option is given to specify
+ another server explicitly. If you previously relied on the
+ implicit invocation of mysqld-max, you should use an
+ appropriate option now. As of MySQL 5.1.12, there is no longer
+ any separate mysqld-max server, so no change should be
+ necessary.
-Note
+ SQL Changes:
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ * Known issue: Prior to MySQL 5.1.17, the parser accepted
+ invalid code in SQL condition handlers, leading to server
+ crashes or unexpected execution behavior in stored programs.
+ Specifically, the parser allowed a condition handler to refer
+ to labels for blocks that enclose the handler declaration.
+ This was incorrect because block label scope does not include
+ the code for handlers declared within the labeled block.
+ As of 5.1.17, the parser rejects this invalid construct, but
+ if you perform a binary upgrade (without dumping and reloading
+ your databases), existing handlers that contain the construct
+ still are invalid and should be rewritten even if they appear
+ to function as you expect.
+ To find affected handlers, use mysqldump to dump all stored
+ procedures and functions, triggers, and events. Then attempt
+ to reload them into an upgraded server. Handlers that contain
+ illegal label references will be rejected.
+ For more information about condition handlers and writing them
+ to avoid invalid jumps, see Section 12.8.4.2, "DECLARE for
+ Handlers."
- You might want to add aliases to your shell's resource file to
- make it easier to access commonly used programs such as mysql and
- mysqladmin from the command line. The syntax for bash is:
-alias mysql=/usr/local/mysql/bin/mysql
-alias mysqladmin=/usr/local/mysql/bin/mysqladmin
+ * Incompatible change: The parser accepted statements that
+ contained /* ... */ that were not properly closed with */,
+ such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that
+ contain unclosed /*-comments now are rejected with a syntax
+ error.
+ This fix has the potential to cause incompatibilities. Because
+ of Bug#26302: http://bugs.mysql.com/26302, which caused the
+ trailing */ to be truncated from comments in views, stored
+ routines, triggers, and events, it is possible that objects of
+ those types may have been stored with definitions that now
+ will be rejected as syntactically invalid. Such objects should
+ be dropped and re-created so that their definitions do not
+ contain truncated comments.
- For tcsh, use:
-alias mysql /usr/local/mysql/bin/mysql
-alias mysqladmin /usr/local/mysql/bin/mysqladmin
+ * Incompatible change: Multiple-table DELETE statements
+ containing ambiguous aliases could have unintended side
+ effects such as deleting rows from the wrong table. Example:
+DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
+ As of MySQL 5.1.23, alias declarations can be declared only in
+ the table_references part. Elsewhere in the statement, alias
+ references are allowed but not alias declarations. Statements
+ containing aliases that are no longer allowed must be
+ rewritten.
- Even better, add /usr/local/mysql/bin to your PATH environment
- variable. You can do this by modifying the appropriate startup
- file for your shell. For more information, see Section 4.2.1,
- "Invoking MySQL Programs."
-
- If you are upgrading an existing installation, note that
- installing a new MySQL PKG does not remove the directory of an
- older installation. Unfortunately, the Mac OS X Installer does not
- yet offer the functionality required to properly upgrade
- previously installed packages.
-
- To use your existing databases with the new installation, you'll
- need to copy the contents of the old data directory to the new
- data directory. Make sure that neither the old server nor the new
- one is running when you do this. After you have copied over the
- MySQL database files from the previous installation and have
- successfully started the new server, you should consider removing
- the old installation files to save disk space. Additionally, you
- should also remove older versions of the Package Receipt
- directories located in /Library/Receipts/mysql-VERSION.pkg.
+ * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is
+ still accepted as a synonym for the ENGINE = engine_name table
+ option but generates a warning. You should note that this
+ option is not available in MySQL 5.1.7, and is removed
+ altogether as of MySQL 5.4 and produces a syntax error.
+ TYPE has been deprecated since MySQL 4.0.
-2.6. Installing MySQL on Solaris
+ * Incompatible change: The namespace for triggers changed in
+ MySQL 5.0.10. Previously, trigger names had to be unique per
+ table. Now they must be unique within the schema (database).
+ An implication of this change is that DROP TRIGGER syntax now
+ uses a schema name instead of a table name (schema name is
+ optional and, if omitted, the current schema will be used).
+ When upgrading from a version of MySQL 5 older than 5.0.10 to
+ MySQL 5.0.10 or newer, you must drop all triggers and
+ re-create them or DROP TRIGGER will not work after the
+ upgrade. Here is a suggested procedure for doing this:
- To obtain a binary MySQL distribution for Solaris in tarball or
- PKG format, http://dev.mysql.com/downloads/mysql/5.1.html.
+ 1. Upgrade to MySQL 5.0.10 or later to be able to access
+ trigger information in the INFORMATION_SCHEMA.TRIGGERS
+ table. (This should work even for pre-5.0.10 triggers.)
- If you install MySQL using a binary tarball distribution on
- Solaris, you may run into trouble even before you get the MySQL
- distribution unpacked, as the Solaris tar cannot handle long file
- names. This means that you may see errors when you try to unpack
- MySQL.
+ 2. Dump all trigger definitions using the following SELECT
+ statement:
+SELECT CONCAT('CREATE TRIGGER ', t.TRIGGER_SCHEMA, '.', t.TRIGGER_NAM
+E,
+ ' ', t.ACTION_TIMING, ' ', t.EVENT_MANIPULATION, ' ON '
+,
+ t.EVENT_OBJECT_SCHEMA, '.', t.EVENT_OBJECT_TABLE,
+ ' FOR EACH ROW ', t.ACTION_STATEMENT, '//' )
+INTO OUTFILE '/tmp/triggers.sql'
+FROM INFORMATION_SCHEMA.TRIGGERS AS t;
+ The statement uses INTO OUTFILE, so you must have the
+ FILE privilege. The file will be created on the server
+ host. Use a different file name if you like. To be 100%
+ safe, inspect the trigger definitions in the triggers.sql
+ file, and perhaps make a backup of the file.
- If this occurs, you must use GNU tar (gtar) to unpack the
- distribution.
+ 3. Stop the server and drop all triggers by removing all
+ .TRG files in your database directories. Change location
+ to your data directory and issue this command:
+shell> rm */*.TRG
- You can install MySQL on Solaris using a binary package in PKG
- format instead of the binary tarball distribution. Before
- installing using the binary PKG format, you should create the
- mysql user and group, for example:
-groupadd mysql
-useradd -g mysql mysql
+ 4. Start the server and re-create all triggers using the
+ triggers.sql file:
+mysql> delimiter // ;
+mysql> source /tmp/triggers.sql //
- Some basic PKG-handling commands follow:
+ 5. Check that all triggers were successfully created using
+ the SHOW TRIGGERS statement.
- * To add a package:
-pkgadd -d package_name.pkg
+ * Incompatible change: MySQL 5.1.6 introduces the TRIGGER
+ privilege. Previously, the SUPER privilege was needed to
+ create or drop triggers. Now those operations require the
+ TRIGGER privilege. This is a security improvement because you
+ no longer need to grant users the SUPER privilege to enable
+ them to create triggers. However, the requirement that the
+ account named in a trigger's DEFINER clause must have the
+ SUPER privilege has changed to a requirement for the TRIGGER
+ privilege. When upgrading from a previous version of MySQL 5.0
+ or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant
+ tables by running mysql_upgrade. This will assign the TRIGGER
+ privilege to all accounts that had the SUPER privilege. If you
+ fail to update the grant tables, triggers may fail when
+ activated. After updating the grant tables, you can revoke the
+ SUPER privilege from those accounts that no longer otherwise
+ require it.
- * To remove a package:
-pkgrm package_name
+ * Some keywords may be reserved in MySQL 5.1 that were not
+ reserved in MySQL 5.0. See Section 8.3, "Reserved Words."
- * To get a full list of installed packages:
-pkginfo
+ * The BACKUP TABLE, and RESTORE TABLE statements are deprecated.
+ mysqldump or mysqlhotcopy can be used as alternatives.
- * To get detailed information for a package:
-pkginfo -l package_name
+ * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER
+ statements are deprecated. See Section 12.6.2.2, "LOAD DATA
+ FROM MASTER Syntax," for recommended alternatives.
- * To list the files belonging to a package:
-pkgchk -v package_name
+ * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are
+ used for the plugin API are new. So is the WITH PARSER clause
+ for FULLTEXT index creation that associates a parser plugin
+ with a full-text index. Section 22.2, "The MySQL Plugin
+ Interface."
- * To get packaging information for an arbitrary file:
-pkgchk -l -p file_name
+ C API Changes:
- For additional information about installing MySQL on Solaris, see
- Section 2.13.3, "Solaris Notes."
+ * Incompatible change: As of MySQL 5.1.7, the
+ mysql_stmt_attr_get() C API function returns a boolean rather
+ than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH.
+ (Bug#16144: http://bugs.mysql.com/16144)
-2.7. Installing MySQL on i5/OS
+2.4.2. Downgrading MySQL
- The i5/OS POWER MySQL package was created in cooperation with IBM.
- MySQL works within the Portable Application Solution Environment
- (PASE) on the System i series of hardware and will also provide
- database services for the Zend Core for i5/OS.
+ This section describes what you should do to downgrade to an older
+ MySQL version in the unlikely case that the previous version
+ worked better than the new one.
- MySQL for i5/OS is provided as a save file (.savf) package that
- can be downloaded and installed directly without any additional
- installation steps required.
+ If you are downgrading within the same release series (for
+ example, from 5.0.13 to 5.0.12) the general rule is that you just
+ have to install the new binaries on top of the old ones. There is
+ no need to do anything with the databases. As always, however, it
+ is always a good idea to make a backup.
- MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS
- PASE must be installed for MySQL to operate. You must be able to
- login as a user in *SECOFR class.
+ The following items form a checklist of things you should do
+ whenever you perform a downgrade:
- You should the installation notes and tips for i5/OS before
- starting installation. See i5/OS Installation Notes.
+ * Read the upgrading section for the release series from which
+ you are downgrading to be sure that it does not have any
+ features you really need. See Section 2.4.1, "Upgrading
+ MySQL."
-Note
+ * If there is a downgrading section for that version, you should
+ read that as well.
- The installation package will use an existing configuration if you
- have previously installed MySQL (which is identified by looking
- for the file /etc/my.cnf). The values for the data directory
- (DATADIR) and owner of the MySQL files (USRPRF) specified during
- the installation will be ignored, and the values determined from
- the /etc/my.cnf will be used instead.
+ * To see which new features were added between the version to
+ which you are downgrading and your current version, see the
+ change logs (Appendix C, "MySQL Change History").
- If you want to change these parameters during a new install, you
- should temporarily rename /etc/my.cnf, install MySQL using the new
- parameters you want to use, and then merge your previous
- /etc/my.cnf configuration settings with the new /etc/my.cnf file
- that is created during installation.
+ * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
+ Be Rebuilt," to see whether changes to table formats or to
+ character sets or collations were made between your current
+ version of MySQL and the version to which you are downgrading.
+ If so and these changes result in an incompatibility between
+ MySQL versions, you will need to downgrade the affected tables
+ using the instructions in Section 2.4.4, "Rebuilding or
+ Repairing Tables or Indexes."
- To install MySQL on i5/OS, follow these steps:
+ In most cases, you can move the MySQL format files and data files
+ between different versions on the same architecture as long as you
+ stay within versions for the same release series of MySQL.
- 1. Create a user profile MYSQL. The MYSQL user profile will own
- all the MySQL files and databases and be the active user used
- when the MySQL server is running. The profile should be
- disabled so that you cannot log in as the MySQL user. To
- create a user profile, use CRTUSRPRF:
-CRTUSRPRF USRPRF(MYSQL) STATUS(*DISABLED) TEXT('MySQL user id')
+ If you downgrade from one release series to another, there may be
+ incompatibilities in table storage formats. In this case, use
+ mysqldump to dump your tables before downgrading. After
+ downgrading, reload the dump file using mysql or mysqlimport to
+ re-create your tables. For examples, see Section 2.4.5, "Copying
+ MySQL Databases to Another Machine."
- 2. On the System i machine, create a save file that will be used
- to receive the downloaded installation save file. The file
- should be located within the General Purpose Library (QGPL):
-CRTSAVF FILE(QGPL/MYSQLINST)
+ A typical symptom of a downward-incompatible table format change
+ when you downgrade is that you cannot open tables. In that case,
+ use the following procedure:
- 3. Download the MySQL installation save file in 32-bit
- (mysql-5.0.42-i5os-power-32bit.savf) or 64-bit
- (mysql-5.0.42-i5os-power-64bit.savf) from MySQL Downloads
- (http://dev.mysql.com/downloads)
+ 1. Stop the older MySQL server that you are downgrading to.
- 4. You need to FTP the downloaded .savf file directly into the
- QGPL/MYSQLINST file on the System i server. You can do this
- through FTP using the following steps after logging in to the
- System i machine:
-ftp> bin
-ftp> cd qgpl
-ftp> put mysql-5.0.42-i5os-power.savf mysqlinst
+ 2. Restart the newer MySQL server you are downgrading from.
- 5. Log into the System i server using a user in the *SECOFR
- class, such as the QSECOFR user ID.
+ 3. Dump any tables that were inaccessible to the older server by
+ using mysqldump to create a dump file.
- 6. You need to restore the installation library stored in the
- .savf save file:
-RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST)
+ 4. Stop the newer MySQL server and restart the older one.
- 7. You need to execute the installation command,
- MYSQLINST/INSMYSQL. You can specify three parameter settings
- during installation:
+ 5. Reload the dump file into the older server. Your tables should
+ be accessible.
- + DIR('/opt/mysql') sets the installation location for the
- MySQL files. The directory will be created if it does not
- already exist.
-
- + DATADIR('/QOpenSys/mysal/data') sets the location of the
- directory that will be used to store the database files
- and binary logs. The default setting is
- /QOpenSys/mysql/data. Note that if the installer detects
- an existing installation (due to the existence of
- /etc/my.cnf), then this parameter will be ignored.
+ It might also be the case that the structure of the system tables
+ in the mysql database has changed and that downgrading introduces
+ some loss of functionality or requires some adjustments. Here are
+ some examples:
- + USRPRF(MYSQL) sets the user profile that will own the
- files that are installed. The profile will be created if
- it does not already exist.
- MySQL can be installed anywhere, for this example we will
- assume MySQL has been installed into /opt/mysql. The MYSQL
- user profile that was created earlier in this sequence should
- be used for the profile:
-MYSQLINST/INSMYSQL DIR('/opt/mysql') DATADIR('/opt/mysqldata') USRPRF
-(MYSQL)
- If you are updating an installation over an existing MySQL
- installation, you should use the same parameter values that
- were used when MySQL was originally installed.
- The installation copies all the necessary files into a
- directory matching the package version (for example
- mysql-5.0.42-i5os-power-32bit), sets the ownership on those
- files, sets up the MySQL environment and creates the MySQL
- configuration file (in /etc/my.cnf) completing all the steps
- in a typical binary installation process automatically. If
- this is a new installation of MySQL, or if the installer
- detects that this is a new version (because the /etc/my.cnf
- file does not exist), then the initial core MySQL databases
- will also be created during installation.
+ * Trigger creation requires the TRIGGER privilege as of MySQL
+ 5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is
+ required instead. If you downgrade from MySQL 5.1 to 5.0, you
+ will need to give the SUPER privilege to those accounts that
+ had the TRIGGER privilege in 5.1.
- 8. Once the installation has completed, you can delete the
- installation file:
-DLTLIB LIB(MYSQLINST)
+ * Triggers were added in MySQL 5.0, so if you downgrade from 5.0
+ to 4.1, you cannot use triggers at all.
- To start MySQL:
+2.4.2.1. Downgrading to MySQL 5.0
- 1. Log into the System i server using a user within the *SECOFR
- class, such as the QSECOFR user ID.
+ When downgrading to MySQL 5.0 from MySQL 5.1, you should keep in
+ mind the following issues relating to features found in MySQL 5.1,
+ but not in MySQL 5.0:
-Note
- You should start mysqld_safe using a user that in the PASE
- environment has the id=0 (the equivalent of the standard Unix
- root user). If you do not use a user with this ID then the
- system will be unable to change the user when executing mysqld
- as set using --user option. If this happens, mysqld may be
- unable to read the files located within the MySQL data
- directory and the execution will fail.
+ * Partitioning. MySQL 5.0 does not support user-defined
+ partitioning. If a table was created as a partitioned table in
+ 5.1 (or if an table created in a previous version of MySQL was
+ altered to include partitions after an upgrade to 5.1), the
+ table is accessible after downgrade only if you do one of the
+ following:
- 2. Enter the PASE environment using call qp2term.
+ + Export the table using mysqldump and then drop it in
+ MySQL 5.1; import the table again following the downgrade
+ to MySQL 5.0.
- 3. Start the MySQL server by changing to the installation
- directory and running mysqld_safe, specifying the user name
- used to install the server. The installer conveniently
- installs a symbolic link to the installation directory
- (mysql-5.0.42-i5os-power-32bit) as /opt/mysql/mysql:
-> cd /opt/mysql/mysql
-> bin/mysqld_safe --user=mysql &
- You should see a message similar to the following:
-Starting mysqld daemon with databases »
- from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data
+ + Prior to the downgrade, remove the table's partitioning
+ using ALTER TABLE table_name REMOVE PARTITIONING.
- If you are having problems starting MySQL server, see Section
- 2.11.2.3, "Starting and Troubleshooting the MySQL Server."
+ * Event Scheduler. MySQL 5.0 does not support scheduled events.
+ If your databases contain scheduled event definitions, you
+ should prevent them from being dumped when you use mysqldump
+ by using the --skip-events option. (See Section 4.5.4,
+ "mysqldump --- A Database Backup Program.")
- To stop MySQL:
+ * Stored routines. MySQL 5.1.21 added a number of new columns
+ to the mysql.proc table in which stored routine definitions
+ are stored. If you are downgrading from MySQL 5.1.21 or later
+ to MySQL 5.0, you cannot import the MySQL 5.1 routine
+ definitions into MySQL 5.0.46 or earlier using the dump of
+ mysql.proc created by mysqldump (such as when using the
+ --all-databases option). Instead, you should run mysqldump
+ --routines prior to performing the downgrade and run the
+ stored routines DDL statements following the downgrade.
+ See Bug#11986: http://bugs.mysql.com/11986,
+ Bug#30029: http://bugs.mysql.com/30029, and
+ Bug#30660: http://bugs.mysql.com/30660, for more information.
- 1. Log into the System i server using the *SECOFR class, such as
- the QSECOFR user ID.
+ * Triggers. Trigger creation requires the TRIGGER privilege as
+ of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and
+ SUPER is required instead. If you downgrade from MySQL 5.1 to
+ 5.0, you will need to give the SUPER privilege to those
+ accounts that had the TRIGGER privilege in 5.1.
- 2. Enter the PASE environment using call qp2term.
+2.4.3. Checking Whether Tables or Indexes Must Be Rebuilt
- 3. Stop the MySQL server by changing into the installation
- directory and running mysqladmin, specifying the user name
- used to install the server:
-> cd /opt/mysql/mysql
-> bin/mysqladmin -u root shutdown
- If the session that you started and stopped MySQL are the
- same, you may get the log output from mysqld:
- STOPPING server from pid file »
- /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.R
-CHLAND.IBM.COM.pid
- 070718 10:34:20 mysqld ended
- If the sessions used to start and stop MySQL are different,
- you will not receive any confirmation of the shutdown.
+ A binary upgrade or downgrade is one that installs one version of
+ MySQL "in place" over an existing version, without dumping and
+ reloading tables:
- Note and tips
+ 1. Stop the server for the existing version if it is running.
- * A problem has been identified with the installation process on
- DBCS systems. If you are having problems install MySQL on a
- DBCS system, you need to change your job's coded character set
- identifier (CSSID) to 37 (EBCDIC) before executing the install
- command, INSMYSQL. To do this, determine your existing CSSID
- (using DSPJOB and selecting option 2), execute CHGJOB
- CSSID(37), run INSMYSQL to install MySQL and then execute
- CHGJOB again with your original CSSID.
+ 2. Install a different version of MySQL. This is an upgrade if
+ the new version is higher than the original version, a
+ downgrade if the version is lower.
- * If you want to use the Perl scripts that are included with
- MySQL, you need to download the iSeries Tools for Developers
- (5799-PTL). See
- http://www-03.ibm.com/servers/enable/site/porting/tools/.
+ 3. Start the server for the new version.
-2.8. Installing MySQL on NetWare
+ In many cases, the tables from the previous version of MySQL can
+ be used without problem by the new version. However, sometimes
+ changes occur that require tables or table indexes to be rebuilt,
+ as described in this section. If you have tables that are affected
+ by any of the issues described here, rebuild the tables or indexes
+ as necessary using the instructions given in Section 2.4.4,
+ "Rebuilding or Repairing Tables or Indexes."
- Porting MySQL to NetWare was an effort spearheaded by Novell.
- Novell customers should be pleased to note that NetWare 6.5 ships
- with bundled MySQL binaries, complete with an automatic commercial
- use license for all servers running that version of NetWare.
-
- MySQL for NetWare is compiled using a combination of Metrowerks
- CodeWarrior for NetWare and special cross-compilation versions of
- the GNU autotools.
+ Table Incompatibilities
- The latest binary packages for NetWare can be obtained at
- http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
- MySQL."
+ After a binary upgrade to MySQL 5.1 from a MySQL 5.0 installation
+ that contains ARCHIVE tables, accessing those tables causes the
+ server to crash, even if you have run mysql_upgrade or CHECK TABLE
+ ... FOR UPGRADE. To work around this problem, use mysqldump to
+ dump all ARCHIVE tables before upgrading, and reload them into
+ MySQL 5.1 after upgrading. The same problem occurs for binary
+ downgrades from MySQL 5.1 to 5.0.
+
+ Index Incompatibilities
+
+ If you perform a binary upgrade without dumping and reloading
+ tables, you cannot upgrade directly from MySQL 4.1 to 5.1 or
+ higher. This occurs due to an incompatible change in the MyISAM
+ table index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
+ repair all MyISAM tables. Then upgrade from MySQL 5.0 to 5.1 and
+ check and repair your tables.
+
+ Modifications to the handling of character sets or collations
+ might change the character sort order, which causes the ordering
+ of entries in any index that uses an affected character set or
+ collation to be incorrect. Such changes result in several possible
+ problems:
- To host MySQL, the NetWare server must meet these requirements:
+ * Comparison results that differ from previous results
- * The latest Support Pack of NetWare 6.5
- (http://support.novell.com/filefinder/18197/index.html) must
- be installed.
+ * Inability to find some index values due to misordered index
+ entries
- * The system must meet Novell's minimum requirements to run the
- respective version of NetWare.
+ * Misordered ORDER BY results
- * MySQL data and the program binaries must be installed on an
- NSS volume; traditional volumes are not supported.
+ * Tables that CHECK TABLE reports as being in need of repair
- To install MySQL for NetWare, use the following procedure:
+ The solution to these problems is to rebuild any indexes that use
+ an affected character set or collation, either by dropping and
+ re-creating the indexes, or by dumping and reloading the entire
+ table. For information about rebuilding indexes, see Section
+ 2.4.4, "Rebuilding or Repairing Tables or Indexes."
- 1. If you are upgrading from a prior installation, stop the MySQL
- server. This is done from the server console, using the
- following command:
-SERVER: mysqladmin -u root shutdown
+ To check whether a table has indexes that must be rebuilt, consult
+ the following list. It indicates which versions of MySQL
+ introduced character set or collation changes that require indexes
+ to be rebuilt. Each entry indicates the version in which the
+ change occurred and the character sets or collations that the
+ change affects. If the change is associated with a particular bug
+ report, the bug number is given.
-Note
- If the MySQL root user account has a password, you need to
- invoke mysqladmin with the -p option and supply the password
- when prompted.
+ The list applies both for binary upgrades and downgrades. For
+ example, Bug#27877: http://bugs.mysql.com/27877 was fixed in MySQL
+ 5.1.24 and 5.4.0, so it applies to upgrades from versions older
+ than 5.1.24 to 5.1.24 or newer, and to downgrades from 5.1.24 or
+ newer to versions older than 5.1.24.
- 2. Log on to the target server from a client machine with access
- to the location where you are installing MySQL.
+ In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify
+ tables for which index rebuilding is required. (It will report:
+ Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or
+ dump/reload to fix it!) In these cases, you can also use
+ mysqlcheck --check-upgrade or mysql_upgrade, which execute CHECK
+ TABLE. However, the use of CHECK TABLE applies only after
+ upgrades, not downgrades. Also, CHECK TABLE is not applicable to
+ all storage engines. For details about which storage engines CHECK
+ TABLE supports, see Section 12.5.2.3, "CHECK TABLE Syntax."
- 3. Extract the binary package Zip file onto the server. Be sure
- to allow the paths in the Zip file to be used. It is safe to
- simply extract the file to SYS:\.
- If you are upgrading from a prior installation, you may need
- to copy the data directory (for example, SYS:MYSQL\DATA), as
- well as my.cnf, if you have customized it. You can then delete
- the old copy of MySQL.
-
- 4. You might want to rename the directory to something more
- consistent and easy to use. The examples in this manual use
- SYS:MYSQL to refer to the installation directory.
- Note that MySQL installation on NetWare does not detect if a
- version of MySQL is already installed outside the NetWare
- release. Therefore, if you have installed the latest MySQL
- version from the Web (for example, MySQL 4.1 or later) in
- SYS:\MYSQL, you must rename the folder before upgrading the
- NetWare server; otherwise, files in SYS:\MySQL are overwritten
- by the MySQL version present in NetWare Support Pack.
-
- 5. At the server console, add a search path for the directory
- containing the MySQL NLMs. For example:
-SERVER: SEARCH ADD SYS:MYSQL\BIN
-
- 6. Initialize the data directory and the grant tables, if
- necessary, by executing mysql_install_db at the server
- console.
-
- 7. Start the MySQL server using mysqld_safe at the server
- console.
-
- 8. To finish the installation, you should also add the following
- commands to autoexec.ncf. For example, if your MySQL
- installation is in SYS:MYSQL and you want MySQL to start
- automatically, you could add these lines:
-#Starts the MySQL 5.1.x database server
-SEARCH ADD SYS:MYSQL\BIN
-MYSQLD_SAFE
- If you are running MySQL on NetWare 6.0, we strongly suggest
- that you use the --skip-external-locking option on the command
- line:
-#Starts the MySQL 5.1.x database server
-SEARCH ADD SYS:MYSQL\BIN
-MYSQLD_SAFE --skip-external-locking
- It is also necessary to use CHECK TABLE and REPAIR TABLE
- instead of myisamchk, because myisamchk makes use of external
- locking. External locking is known to have problems on NetWare
- 6.0; the problem has been eliminated in NetWare 6.5. Note that
- the use of MySQL on Netware 6.0 is not officially supported.
- mysqld_safe on NetWare provides a screen presence. When you
- unload (shut down) the mysqld_safe NLM, the screen does not go
- away by default. Instead, it prompts for user input:
-*<NLM has terminated; Press any key to close the screen>*
- If you want NetWare to close the screen automatically instead,
- use the --autoclose option to mysqld_safe. For example:
-#Starts the MySQL 5.1.x database server
-SEARCH ADD SYS:MYSQL\BIN
-MYSQLD_SAFE --autoclose
- The behavior of mysqld_safe on NetWare is described further in
- Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
-
- 9. When installing MySQL, either for the first time or upgrading
- from a previous version, download and install the latest and
- appropriate Perl module and PHP extensions for NetWare:
-
- + Perl:
- http://forge.novell.com/modules/xfcontent/downloads.php/p
- erl/Modules/
-
- + PHP:
- http://forge.novell.com/modules/xfcontent/downloads.php/p
- hp/Modules/
-
- If there was an existing installation of MySQL on the NetWare
- server, be sure to check for existing MySQL startup commands in
- autoexec.ncf, and edit or delete them as necessary.
+ Changes that cause index rebuilding to be necessary:
-Note
+ * MySQL 5.0.48, 5.1.21 (Bug#29461: http://bugs.mysql.com/29461)
+ Affects indexes for columns that use any of these character
+ sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
+ Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
+ as of MySQL 5.1.29, 5.4.0 (see
+ Bug#39585: http://bugs.mysql.com/39585)
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ * MySQL 5.0.48, 5.1.23 (Bug#27562: http://bugs.mysql.com/27562)
+ Affects indexes that use the ascii_general_ci collation for
+ columns that contain any of these characters: '`' GRAVE
+ ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
+ RIGHT SQUARE BRACKET, '~' TILDE
+ Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
+ as of MySQL 5.1.29, 5.4.0 (see
+ Bug#39585: http://bugs.mysql.com/39585)
-2.9. Installing MySQL from tar.gz Packages on Other Unix-Like Systems
+ * MySQL 5.1.24, 5.4.0 (Bug#27877: http://bugs.mysql.com/27877)
+ Affects indexes that use the utf8_general_ci or
+ ucs2_general_ci collation for columns that contain 'ß' LATIN
+ SMALL LETTER SHARP S (German).
+ Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
+ as of MySQL 5.1.30, 5.4.0 (see
+ Bug#40053: http://bugs.mysql.com/40053)
- This section covers the installation of MySQL binary distributions
- that are provided for various platforms in the form of compressed
- tar files (files with a .tar.gz extension). See Section 2.1.2.4,
- "MySQL Binaries Compiled by Sun Microsystems, Inc.," for a
- detailed list.
+2.4.4. Rebuilding or Repairing Tables or Indexes
- To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
+ This section describes how to rebuild a table. This can be
+ necessitated by changes to MySQL such as how data types are
+ handled or changes to character set handling. For example, an
+ error in a collation might have been corrected, necessitating a
+ table rebuild to rebuild the indexes for character columns that
+ use the collation. It might also be that a table repair or upgrade
+ should be done as indicated by a table check operation such as
+ that performed by CHECK TABLE, mysqlcheck, or mysql_upgrade.
- MySQL tar file binary distributions have names of the form
- mysql-VERSION-OS.tar.gz, where VERSION is a number (for example,
- 5.1.39), and OS indicates the type of operating system for which
- the distribution is intended (for example, pc-linux-i686).
+ Methods for rebuilding a table include dumping and reloading it,
+ or using ALTER TABLE or REPAIR TABLE.
- In addition to these generic packages, we also offer binaries in
- platform-specific package formats for selected platforms. See
- Section 2.2, "Standard MySQL Installation Using a Binary
- Distribution," for more information on how to install these.
+Note
- You need the following tools to install a MySQL tar file binary
- distribution:
+ If you are rebuilding tables because a different version of MySQL
+ will not handle them after a binary (in-place) upgrade or
+ downgrade, you must use the dump-and-reload method. Dump the
+ tables before upgrading or downgrading (using your original
+ version of MySQL), and reload the tables after upgrading or
+ downgrading (after installing the new version).
- * GNU gunzip to uncompress the distribution.
+ If you use the dump-and-reload method of rebuilding tables only
+ for the purpose of rebuilding indexes, you can perform the dump
+ either before or after upgrading or downgrading. Reloading still
+ must be done afterward.
- * A reasonable tar to unpack the distribution. GNU tar is known
- to work. Some operating systems come with a preinstalled
- version of tar that is known to have problems. For example,
- the tar provided with early versions of Mac OS X, SunOS 4.x
- and Solaris 8 and earlier are known to have problems with long
- file names. On Mac OS X, you can use the preinstalled gnutar
- program. On other systems with a deficient tar, you should
- install GNU tar first.
+ To re-create a table by dumping and reloading it, use mysqldump to
+ create a dump file and mysql to reload the file:
+shell> mysqldump db_name t1 > dump.sql
+shell> mysql db_name < dump.sql
- If you run into problems and need to file a bug report, please use
- the instructions in Section 1.6, "How to Report Bugs or Problems."
+ To recreate all the tables in a single database, specify the
+ database name without any following table name:
+shell> mysqldump db_name > dump.sql
+shell> mysql db_name < dump.sql
- The basic commands that you must execute to install and use a
- MySQL binary distribution are:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
-shell> cd /usr/local
-shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
-shell> ln -s full-path-to-mysql-VERSION-OS mysql
-shell> cd mysql
-shell> chown -R mysql .
-shell> chgrp -R mysql .
-shell> scripts/mysql_install_db --user=mysql
-shell> chown -R root .
-shell> chown -R mysql data
-shell> bin/mysqld_safe --user=mysql &
+ To recreate all tables in all databases, use the --all-databases
+ option:
+shell> mysqldump --all-databases > dump.sql
+shell> mysql < dump.sql
-Note
+ To rebuild a table with ALTER TABLE, use a "null" alteration; that
+ is, an ALTER TABLE statement that "changes" the table to use the
+ storage engine that it already has. For example, if t1 is a MyISAM
+ table, use this statement:
+mysql> ALTER TABLE t1 ENGINE = MyISAM;
- This procedure does not set up any passwords for MySQL accounts.
- After following the procedure, proceed to Section 2.11,
- "Post-Installation Setup and Testing."
+ If you are not sure which storage engine to specify in the ALTER
+ TABLE statement, use SHOW CREATE TABLE to display the table
+ definition.
- A more detailed version of the preceding description for
- installing a binary distribution follows:
+ If you must rebuild a table because a table checking operation
+ indicates that the table is corrupt or needs an upgrade, you can
+ use REPAIR TABLE if that statement supports the table's storage
+ engine. For example, to repair a MyISAM table, use this statement:
+mysql> REPAIR TABLE t1;
- 1. Add a login user and group for mysqld to run as:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
- These commands add the mysql group and the mysql user. The
- syntax for useradd and groupadd may differ slightly on
- different versions of Unix, or they may have different names
- such as adduser and addgroup.
- You might want to call the user and group something else
- instead of mysql. If so, substitute the appropriate name in
- the following steps.
+ For storage engines such as InnoDB that REPAIR TABLE does not
+ support, use mysqldump to create a dump file and mysql to reload
+ the file, as described earlier.
- 2. Pick the directory under which you want to unpack the
- distribution and change location into it. In the following
- example, we unpack the distribution under /usr/local. (The
- instructions, therefore, assume that you have permission to
- create files and directories in /usr/local. If that directory
- is protected, you must perform the installation as root.)
-shell> cd /usr/local
+ For specifics about which storage engines REPAIR TABLE supports,
+ see Section 12.5.2.6, "REPAIR TABLE Syntax."
- 3. Obtain a distribution file using the instructions in Section
- 2.1.3, "How to Get MySQL." For a given release, binary
- distributions for all platforms are built from the same MySQL
- source distribution.
+ mysqlcheck --repair provides command-line access to the REPAIR
+ TABLE statement. This can be a more convenient means of repairing
+ tables because you can use the --databases or --all-databases
+ option to repair all tables in specific databases or all
+ databases, respectively:
+shell> mysqlcheck --repair --databases db_name ...
+shell> mysqlcheck --repair --all-databases
- 4. Unpack the distribution, which creates the installation
- directory. Then create a symbolic link to that directory:
-shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
-shell> ln -s full-path-to-mysql-VERSION-OS mysql
- The tar command creates a directory named mysql-VERSION-OS.
- The ln command makes a symbolic link to that directory. This
- lets you refer more easily to the installation directory as
- /usr/local/mysql.
- With GNU tar, no separate invocation of gunzip is necessary.
- You can replace the first line with the following alternative
- command to uncompress and extract the distribution:
-shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
+2.4.5. Copying MySQL Databases to Another Machine
- 5. Change location into the installation directory:
-shell> cd mysql
- You will find several files and subdirectories in the mysql
- directory. The most important for installation purposes are
- the bin and scripts subdirectories:
+ You can copy the .frm, .MYI, and .MYD files for MyISAM tables
+ between different architectures that support the same
+ floating-point format. (MySQL takes care of any byte-swapping
+ issues.) See Section 13.5, "The MyISAM Storage Engine."
- + The bin directory contains client programs and the
- server. You should add the full path name of this
- directory to your PATH environment variable so that your
- shell finds the MySQL programs properly. See Section
- 2.14, "Environment Variables."
+ In cases where you need to transfer databases between different
+ architectures, you can use mysqldump to create a file containing
+ SQL statements. You can then transfer the file to the other
+ machine and feed it as input to the mysql client.
- + The scripts directory contains the mysql_install_db
- script used to initialize the mysql database containing
- the grant tables that store the server access
- permissions.
+ Use mysqldump --help to see what options are available.
- 6. Ensure that the distribution contents are accessible to mysql.
- If you unpacked the distribution as mysql, no further action
- is required. If you unpacked the distribution as root, its
- contents will be owned by root. Change its ownership to mysql
- by executing the following commands as root in the
- installation directory:
-shell> chown -R mysql .
-shell> chgrp -R mysql .
- The first command changes the owner attribute of the files to
- the mysql user. The second changes the group attribute to the
- mysql group.
+ The easiest (although not the fastest) way to move a database
+ between two machines is to run the following commands on the
+ machine on which the database is located:
+shell> mysqladmin -h 'other_hostname' create db_name
+shell> mysqldump db_name | mysql -h 'other_hostname' db_name
- 7. If you have not installed MySQL before, you must create the
- MySQL data directory and initialize the grant tables:
-shell> scripts/mysql_install_db --user=mysql
- If you run the command as root, include the --user option as
- shown. If you run the command while logged in as that user,
- you can omit the --user option.
- The command should create the data directory and its contents
- with mysql as the owner.
- After creating or updating the grant tables, you need to
- restart the server manually.
+ If you want to copy a database from a remote machine over a slow
+ network, you can use these commands:
+shell> mysqladmin create db_name
+shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na
+me
- 8. Most of the MySQL installation can be owned by root if you
- like. The exception is that the data directory must be owned
- by mysql. To accomplish this, run the following commands as
- root in the installation directory:
-shell> chown -R root .
-shell> chown -R mysql data
+ You can also store the dump in a file, transfer the file to the
+ target machine, and then load the file into the database there.
+ For example, you can dump a database to a compressed file on the
+ source machine like this:
+shell> mysqldump --quick db_name | gzip > db_name.gz
- 9. If you want MySQL to start automatically when you boot your
- machine, you can copy support-files/mysql.server to the
- location where your system has its startup files. More
- information can be found in the support-files/mysql.server
- script itself and in Section 2.11.2.2, "Starting and Stopping
- MySQL Automatically."
- 10. You can set up new accounts using the bin/mysql_setpermission
- script if you install the DBI and DBD::mysql Perl modules. See
- Section 4.6.14, "mysql_setpermission --- Interactively Set
- Permissions in Grant Tables." For Perl module installation
- instructions, see Section 2.15, "Perl Installation Notes."
- 11. If you would like to use mysqlaccess and have the MySQL
- distribution in some nonstandard location, you must change the
- location where mysqlaccess expects to find the mysql client.
- Edit the bin/mysqlaccess script at approximately line 18.
- Search for a line that looks like this:
-$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable
- Change the path to reflect the location where mysql actually
- is stored on your system. If you do not do this, a Broken pipe
- error will occur when you run mysqlaccess.
+ Transfer the file containing the database contents to the target
+ machine and run these commands there:
+shell> mysqladmin create db_name
+shell> gunzip < db_name.gz | mysql db_name
- After everything has been unpacked and installed, you should test
- your distribution. To start the MySQL server, use the following
- command:
-shell> bin/mysqld_safe --user=mysql &
+ You can also use mysqldump and mysqlimport to transfer the
+ database. For large tables, this is much faster than simply using
+ mysqldump. In the following commands, DUMPDIR represents the full
+ path name of the directory you use to store the output from
+ mysqldump.
- If you run the command as root, you must use the --user option as
- shown. The value of the option is the name of the login account
- that you created in the first step to use for running the server.
- If you run the command while logged in as mysql, you can omit the
- --user option.
+ First, create the directory for the output files and dump the
+ database:
+shell> mkdir DUMPDIR
+shell> mysqldump --tab=DUMPDIR db_name
- If the command fails immediately and prints mysqld ended, you can
- find some information in the host_name.err file in the data
- directory.
+ Then transfer the files in the DUMPDIR directory to some
+ corresponding directory on the target machine and load the files
+ into MySQL there:
+shell> mysqladmin create db_name # create database
+shell> cat DUMPDIR/*.sql | mysql db_name # create tables in databas
+e
+shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables
- More information about mysqld_safe is given in Section 4.3.2,
- "mysqld_safe --- MySQL Server Startup Script."
+ Do not forget to copy the mysql database because that is where the
+ grant tables are stored. You might have to run commands as the
+ MySQL root user on the new machine until you have the mysql
+ database in place.
-Note
+ After you import the mysql database on the new machine, execute
+ mysqladmin flush-privileges so that the server reloads the grant
+ table information.
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+2.5. Installing MySQL on Windows
-2.10. MySQL Installation Using a Source Distribution
+ This section describes the process for installing MySQL on
+ Windows.
- Before you proceed with an installation from source, first check
- whether our binary is available for your platform and whether it
- works for you. We put a great deal of effort into ensuring that
- our binaries are built with the best possible options.
+ To run MySQL on Windows, you need the following:
- To obtain a source distribution for MySQL, Section 2.1.3, "How to
- Get MySQL." If you want to build MySQL from source on Windows, see
- Section 2.10.6, "Installing MySQL from Source on Windows."
+ * A Windows operating system such as Windows 2000, Windows XP,
+ Windows Vista, Windows Server 2003, or Windows Server 2008.
+ Both 32-bit and 64-bit versions are supported.
+ In addition to running MySQL as a standard application, you
+ can also run the MySQL server as a Windows service. By using a
+ service you can monitor and control the operation of the
+ server through the standard Windows service management tools.
+ For more information, see Section 2.5.5.6, "Starting MySQL as
+ a Windows Service."
+ Generally, you should install MySQL on Windows using an
+ account that has administrator rights. Otherwise, you may
+ encounter problems with certain operations such as editing the
+ PATH environment variable or accessing the Service Control
+ Manager. Once installed, MySQL does not need to be executed
+ using a user with Administrator privileges.
- MySQL source distributions are provided as compressed tar archives
- and have names of the form mysql-VERSION.tar.gz, where VERSION is
- a number like 5.1.39.
+ * TCP/IP protocol support.
- You need the following tools to build and install MySQL from
- source:
+ * Enough space on the hard drive to unpack, install, and create
+ the databases in accordance with your requirements (generally
+ a minimum of 200 megabytes is recommended.)
- * GNU gunzip to uncompress the distribution.
+ For a list of limitations within the Windows version of MySQL, see
+ Section D.7.3, "Windows Platform Limitations."
- * A reasonable tar to unpack the distribution. GNU tar is known
- to work. Some operating systems come with a preinstalled
- version of tar that is known to have problems. For example,
- the tar provided with early versions of Mac OS X, SunOS 4.x
- and Solaris 8 and earlier are known to have problems with long
- file names. On Mac OS X, you can use the preinstalled gnutar
- program. On other systems with a deficient tar, you should
- install GNU tar first.
+ In addition to the MySQL Server package, you may need or want
+ additional components to use MySQL with your application or
+ development environment. These include, but are not limited to:
- * A working ANSI C++ compiler. gcc 2.95.2 or later, SGI C++, and
- SunPro C++ are some of the compilers that are known to work.
- libg++ is not needed when using gcc. gcc 2.7.x has a bug that
- makes it impossible to compile some perfectly legal C++ files,
- such as sql/sql_base.cc. If you have only gcc 2.7.x, you must
- upgrade your gcc to be able to compile MySQL. gcc 2.8.1 is
- also known to have problems on some platforms, so it should be
- avoided if a newer compiler exists for the platform. gcc
- 2.95.2 or later is recommended.
+ * If you plan to connect to the MySQL server via ODBC, you need
+ a Connector/ODBC driver. For more information, including
+ installation and configuration instructions, see Section 21.1,
+ "MySQL Connector/ODBC."
+
+ * If you plan to use MySQL server with .NET applications, you
+ need the Connector/NET driver. For more information, including
+ installation and configuration instructions, see Section 21.2,
+ "MySQL Connector/NET."
- * A good make program. GNU make is always recommended and is
- sometimes required. (BSD make fails, and vendor-provided make
- implementations may fail as well.) If you have problems, use
- GNU make 3.75 or newer.
+ MySQL distributions for Windows can be downloaded from
+ http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
+ MySQL."
- * libtool 1.5.24 or later is also recommended.
+ MySQL for Windows is available in several distribution formats,
+ detailed below. Generally speaking, you should use a binary
+ distribution that includes an installer. It is simpler to use than
+ the others, and you need no additional tools to get MySQL up and
+ running. The installer for the Windows version of MySQL, combined
+ with a GUI Config Wizard, automatically installs MySQL, creates an
+ option file, starts the server, and secures the default user
+ accounts.
- If you are using a version of gcc recent enough to understand the
- -fno-exceptions option, it is very important that you use this
- option. Otherwise, you may compile a binary that crashes randomly.
- Also use -felide-constructors and -fno-rtti along with
- -fno-exceptions. When in doubt, do the following:
-CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
- -fno-exceptions -fno-rtti" ./configure \
- --prefix=/usr/local/mysql --enable-assembler \
- --with-mysqld-ldflags=-all-static
+ * Binary installer distribution. The installable distribution
+ comes packaged as a Microsoft Windows Installer (MSI) package
+ that you can install manually or automatically on your
+ systems. Two formats are available, an essentials package that
+ contains all the files you need to install and configure
+ MySQL, but no additional components, and a complete package
+ that includes MySQL, configuration tools, benchmarks and other
+ components. For more information on the specific differences,
+ see Section 2.5.2, "Choosing An Installation Package"
+ For instructions on installing MySQL using one of the MSI
+ installation packages, see Section 2.5.3, "Installing MySQL
+ with the MSI Package."
+
+ * Standard binary distribution format packaged as a Zip file
+ containing all of the necessary files that you unpack into
+ your chosen location. This package contains all of the files
+ in the full Windows MSI Installer package, but does not
+ including an installation program.
+ For instructions on installing MySQL using the Zip file, see
+ Section 2.5.5, "Installing MySQL from a noinstall Zip
+ Archive."
- On most systems, this gives you a fast and stable binary.
+ * The source distribution contains all the code and support
+ files for building the executables using the Visual Studio
+ compiler system.
+ For instructions on building MySQL from source on Windows, see
+ Section 2.5.10, "Installing MySQL from Source on Windows."
- If you run into problems and need to file a bug report, please use
- the instructions in Section 1.6, "How to Report Bugs or Problems."
+ MySQL on Windows considerations:
-2.10.1. Source Installation Overview
+ * Large Table Support
+ If you need tables with a size larger than 4GB, install MySQL
+ on an NTFS or newer file system. Don't forget to use MAX_ROWS
+ and AVG_ROW_LENGTH when you create tables. See Section
+ 12.1.17, "CREATE TABLE Syntax."
- The basic commands that you must execute to install a MySQL source
- distribution are:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
-shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
-shell> cd mysql-VERSION
-shell> ./configure --prefix=/usr/local/mysql
-shell> make
-shell> make install
-shell> cp support-files/my-medium.cnf /etc/my.cnf
-shell> cd /usr/local/mysql
-shell> chown -R mysql .
-shell> chgrp -R mysql .
-shell> bin/mysql_install_db --user=mysql
-shell> chown -R root .
-shell> chown -R mysql var
-shell> bin/mysqld_safe --user=mysql &
+ * MySQL and Virus Checking Software
+ Using virus scanning software such as Norton/Symantec
+ Anti-Virus on directories containing MySQL data and temporary
+ tables can cause issues, both in terms of the performance of
+ MySQL and the virus-scanning software mis-identifying the
+ contents of the files as containing spam. This is because of
+ the fingerprinting mechanism used by the virus scanning
+ software, and the way in which MySQL rapidly updates different
+ files, which may be identified as a potential security risk.
+ After installing MySQL Server, it is recommended that you
+ disable virus scanning on the main directory (datadir) being
+ used to store your MySQL table data. There is usually a system
+ built into the virus scanning software to allow certain
+ directories to be specifically ignored during virus scanning.
+ In addition, by default, MySQL creates temporary files in the
+ standard Windows temporary directory. To prevent the temporary
+ files also being scanned, you should configure a separate
+ temporary directory for MySQL temporary files and add this to
+ the virus scanning exclusion list. To do this, add a
+ configuration option for the tmpdir parameter to your my.ini
+ configuration file. For more information, see Section 2.5.5.2,
+ "Creating an Option File."
- If you start from a source RPM, do the following:
-shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
+2.5.1. Windows Installation Layout
- This makes a binary RPM that you can install. For older versions
- of RPM, you may have to replace the command rpmbuild with rpm
- instead.
+ For MySQL 5.1 on Windows, the default installation directory is
+ C:\Program Files\MySQL\MySQL Server 5.1. Some Windows users prefer
+ to install in C:\mysql, the directory that formerly was used as
+ the default. However, the layout of the subdirectories remains the
+ same.
+
+ For MySQL 5.1.23 and earlier, all of the files are located within
+ this parent directory, using the following structure:
+
+ Table 2.2. Installation Layout for Windows using MySQL 5.1.23 and
+ earlier
+ Directory Contents of Directory
+ bin Client programs and the mysqld server
+ data Log files, databases
+ Docs Manual in CHM format
+ examples Example programs and scripts
+ include Include (header) files
+ lib Libraries
+ scripts Utility scripts
+ share Error message files
-Note
+ For MySQL 5.1.24 and later, the default location of data directory
+ was changed. The remainder of the directory structure remains the
+ same:
- This procedure does not set up any passwords for MySQL accounts.
- After following the procedure, proceed to Section 2.11,
- "Post-Installation Setup and Testing," for post-installation setup
- and testing.
+ Table 2.3. Installation Layout for Windows using MySQL 5.1.24 and
+ later
+ Directory Contents of Directory
+ bin Client programs and the mysqld server
+ C:\Documents and Settings\All Users\Application Data\MySQL Log
+ files, databases
+ Docs Manual in CHM format
+ examples Example programs and scripts
+ include Include (header) files
+ lib Libraries
+ scripts Utility scripts
+ share Error message files
- A more detailed version of the preceding description for
- installing MySQL from a source distribution follows:
+2.5.2. Choosing An Installation Package
- 1. Add a login user and group for mysqld to run as:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
- These commands add the mysql group and the mysql user. The
- syntax for useradd and groupadd may differ slightly on
- different versions of Unix, or they may have different names
- such as adduser and addgroup.
- You might want to call the user and group something else
- instead of mysql. If so, substitute the appropriate name in
- the following steps.
+ For MySQL 5.1, there are three installation packages to choose
+ from when installing MySQL on Windows:
+ Packaging
+ Feature Essentials Complete Zip (No-install)
+ Installer Yes Yes No
+ Directory-only
+ MySQL Server Instance Config Wizard Yes Yes No
+ Test Suite No Yes Yes
+ MySQL Server Yes Yes Yes
+ MySQL Client Programs Yes Yes Yes
+ C Headers/Libraries Yes Yes Yes
+ Embedded Server No Optional Yes
+ Scripts and Examples No Optional Yes
+
+ In the above table:
+
+ * Yes indiciates that the component is installed by default.
+
+ * No indicates that the component is not installed or included.
+
+ * Optional indicates that the component is included with the
+ package, but not installed unless explicitly requested using
+ the Custom installation mode.
+
+ The workflow for installing using the MSI installer is shown
+ below:
- 2. Perform the following steps as the mysql user, except as
- noted.
+ Figure 2.1. Installation Workflow for Windows using MSI
+ Installation Workflow for Windows using MSI
- 3. Pick the directory under which you want to unpack the
- distribution and change location into it.
+ The workflow for installing using the MSI installer is shown
+ below:
- 4. Obtain a distribution file using the instructions in Section
- 2.1.3, "How to Get MySQL."
+ Figure 2.2. Installation Workflow for Windows using Zip
+ Installation Workflow for Windows using Zip
- 5. Unpack the distribution into the current directory:
-shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
- This command creates a directory named mysql-VERSION.
- With GNU tar, no separate invocation of gunzip is necessary.
- You can use the following alternative command to uncompress
- and extract the distribution:
-shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
+Note
- 6. Change location into the top-level directory of the unpacked
- distribution:
-shell> cd mysql-VERSION
- Note that currently you must configure and build MySQL from
- this top-level directory. You cannot build it in a different
- directory.
+ For the Essentials and Complete packages in the MSI installer, you
+ can select individual components to be installed by using the
+ Custom mode, including disable the components confiurated for
+ installation by default.
+
+ Full details on the components are suggested uses are provided
+ below for reference:
+
+ * Windows Essentials --- this package has a file name similar to
+ mysql-essential-5.1.41-win32.msi and is supplied as a
+ Microsoft Installer (MSI) package. The package includes the
+ minimum set of files needed to install MySQL on Windows,
+ including the MySQL Server Instance Config Wizard. This
+ package does not include optional components such as the
+ embedded server, developer headers and libraries or benchmark
+ suite.
+ To install using this package, see Section 2.5.3, "Installing
+ MySQL with the MSI Package."
+
+ * Windows MSI Installer (Complete) --- this package has a file
+ name similar to mysql-5.1.41-win32.zip and contains all files
+ needed for a complete Windows installation, including the
+ MySQL Server Instance Config Wizard. This package includes
+ optional components such as the embedded server and benchmark
+ suite.
+ To install using this package, see Section 2.5.3, "Installing
+ MySQL with the MSI Package."
- 7. Configure the release and compile everything:
-shell> ./configure --prefix=/usr/local/mysql
-shell> make
- When you run configure, you might want to specify other
- options. Run ./configure --help for a list of options. Section
- 2.10.2, "Typical configure Options," discusses some of the
- more useful options.
- If configure fails and you are going to send mail to a MySQL
- mailing list to ask for assistance, please include any lines
- from config.log that you think can help solve the problem.
- Also include the last couple of lines of output from
- configure. To file a bug report, please use the instructions
- in Section 1.6, "How to Report Bugs or Problems."
- If the compile fails, see Section 2.10.4, "Dealing with
- Problems Compiling MySQL," for help.
+ * Without installer --- this package has a file name similar to
+ mysql-noinstall-5.1.41-win32.zip and contains all the files
+ found in the Complete install package, with the exception of
+ the MySQL Server Instance Config Wizard. This package does not
+ include an automated installer, and must be manually installed
+ and configured.
+
+ The Essentials package is recommended for most users. Both the
+ Essentials and Complete distributions are available as an .msi
+ file for use with the Windows Installer. The Noinstall
+ distribution is packaged as Zip archives. To use Zip archives, you
+ must have a tool that can unpack .zip files.
+
+ When using the MSI installers you can automate the installation
+ process. For more information, see Section 2.5.3.2, "Installing
+ MySQL Automatically using MSI." To automate the creation of a
+ MySQL instance, see Section 2.5.4.13, "Creating an Instance from
+ the Command Line."
- 8. Install the distribution:
-shell> make install
- You might need to run this command as root.
- If you want to set up an option file, use one of those present
- in the support-files directory as a template. For example:
-shell> cp support-files/my-medium.cnf /etc/my.cnf
- You might need to run this command as root.
- If you want to configure support for InnoDB tables, you should
- edit the /etc/my.cnf file, remove the # character before the
- option lines that start with innodb_..., and modify the option
- values to be what you want. See Section 4.2.3.3, "Using Option
- Files," and Section 13.6.2, "InnoDB Configuration."
+ Your choice of install package affects the installation process
+ you must follow. If you choose to install either the Essentials or
+ Complete install packages, see Section 2.5.3, "Installing MySQL
+ with the MSI Package." If you choose to install MySQL from the
+ Noinstall archive, see Section 2.5.5, "Installing MySQL from a
+ noinstall Zip Archive."
- 9. Change location into the installation directory:
-shell> cd /usr/local/mysql
- 10. If you ran the make install command as root, the installed
- files will be owned by root. Ensure that the installation is
- accessible to mysql by executing the following commands as
- root in the installation directory:
-shell> chown -R mysql .
-shell> chgrp -R mysql .
- The first command changes the owner attribute of the files to
- the mysql user. The second changes the group attribute to the
- mysql group.
- 11. If you have not installed MySQL before, you must create the
- MySQL data directory and initialize the grant tables:
-shell> bin/mysql_install_db --user=mysql
- If you run the command as root, include the --user option as
- shown. If you run the command while logged in as mysql, you
- can omit the --user option.
- The command should create the data directory and its contents
- with mysql as the owner.
- After using mysql_install_db to create the grant tables for
- MySQL, you must restart the server manually. The mysqld_safe
- command to do this is shown in a later step.
- 12. Most of the MySQL installation can be owned by root if you
- like. The exception is that the data directory must be owned
- by mysql. To accomplish this, run the following commands as
- root in the installation directory:
-shell> chown -R root .
-shell> chown -R mysql var
- 13. If you want MySQL to start automatically when you boot your
- machine, you can copy support-files/mysql.server to the
- location where your system has its startup files. More
- information can be found in the support-files/mysql.server
- script itself; see also Section 2.11.2.2, "Starting and
- Stopping MySQL Automatically."
- 14. You can set up new accounts using the bin/mysql_setpermission
- script if you install the DBI and DBD::mysql Perl modules. See
- Section 4.6.14, "mysql_setpermission --- Interactively Set
- Permissions in Grant Tables." For Perl module installation
- instructions, see Section 2.15, "Perl Installation Notes."
+2.5.3. Installing MySQL with the MSI Package
+
+ The MSI package are designed to install and configure MySQL in
+ such a way that you can immediately get started using MySQL.
+
+ The MySQL Installation Wizard and MySQL Config Wizard are
+ available in the Essentials and Complete install packages. They
+ are recommended for most standard MySQL installations. Exceptions
+ include users who need to install multiple instances of MySQL on a
+ single server host and advanced users who want complete control of
+ server configuration.
- After everything has been installed, you should test your
- distribution. To start the MySQL server, use the following
- command:
-shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
+ * For information on installing using the GUI MSI installer
+ process, see Section 2.5.3, "Installing MySQL with the MSI
+ Package."
- If you run the command as root, you should use the --user option
- as shown. The value of the option is the name of the login account
- that you created in the first step to use for running the server.
- If you run the command while logged in as that user, you can omit
- the --user option.
+ * For information on installing using the command line using the
+ MSI package, see Section 2.5.3.2, "Installing MySQL
+ Automatically using MSI."
+
+ * If you have previously installed MySQL using the MSI package
+ and want to remove MySQL, see Section 2.5.3.3, "Removing MySQL
+ Installed from the MSI Package."
- If the command fails immediately and prints mysqld ended, you can
- find some information in the host_name.err file in the data
- directory.
+ The workflow sequence for using the installer is shown in the
+ figure below:
- More information about mysqld_safe is given in Section 4.3.2,
- "mysqld_safe --- MySQL Server Startup Script."
+ Figure 2.3. Installation Workflow for Windows using MSI Installer
+ Installation Workflow for Windows using MSI Installer
Note
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ Microsoft Windows XP and later include a firewall which
+ specifically blocks ports. If you plan on using MySQL through a
+ network port then you should open and create an exception for this
+ port before performing the installation. To check and if necessary
+ add an exception to the firewall settings:
-2.10.2. Typical configure Options
+ 1. First ensure that you are logged in as an Administrator or a
+ user with Administrator privileges.
- The configure script gives you a great deal of control over how
- you configure a MySQL source distribution. Typically you do this
- using options on the configure command line. You can also affect
- configure using certain environment variables. See Section 2.14,
- "Environment Variables." For a full list of options supported by
- configure, run this command:
-shell> ./configure --help
+ 2. Go to the Control Panel, and double click the Windows Firewall
+ icon.
- A list of the available configure options is provided in the table
- below.
+ 3. Choose the Allow a program through Windows Firewall option and
+ click the Add port button.
- Table 2.1. Build (configure) Reference
- Formats Description Default Introduced Removed
- --bindir=DIR User executables EPREFIX/bin
- --build=BUILD Configure for building on BUILD guessed
- --cache-file=FILE Cache test results in FILE disabled
- -C Alias for `--cache-file=config.cache'
- --config-cache
- --datadir=DIR Read-only architecture-independent data PREFIX/share
+ 4. Enter MySQL into the Name text box and 3306 (or the port of
+ your choice) into the Port number text box.
- --disable-FEATURE Do not include FEATURE
- --disable-dependency-tracking Disable dependency tracking
- --disable-grant-options Disable GRANT options
- --disable-largefile Omit support for large files
- --disable-libtool-lock Disable libtool lock
- --disable-thread-safe-client Compile the client without threads
- 5.1.7
- --enable-FEATURE Enable FEATURE
- --enable-assembler Use assembler versions of some string functions
- if available
- --enable-dependency-tracking Do not reject slow dependency
- extractors
- --enable-fast-install Optimize for fast installation yes
- --enable-local-infile Enable LOAD DATA LOCAL INFILE disabled
- --enable-shared Build shared libraries yes
- --enable-static Build static libraries yes
- --enable-thread-safe-client Compile the client with threads
- --exec-prefix=EPREFIX Install architecture-dependent files in
- EPREFIX
- -h Display this help and exit
- --help
- --help=short Display options specific to this package
- --help=recursive Display the short help of all the included
- packages
- --host=HOST Cross-compile to build programs to run on HOST
- --includedir=DIR C header files PREFIX/include
- --infodir=DIR Info documentation PREFIX/info
- --libdir=DIR Object code libraries EPREFIX/lib
- --libexecdir=DIR Program executables EPREFIX/libexec
- --localstatedir=DIR Modifiable single-machine data PREFIX/var
- --mandir=DIR man documentation PREFIX/man
- -n Do not create output files
- --no-create
- --oldincludedir=DIR C header files for non-gcc /usr/include
- --prefix=PREFIX Install architecture-independent files in PREFIX
+ 5. Also ensure that the TCP protocol radio button is selected.
- --program-prefix=PREFIX Prepend PREFIX to installed program names
+ 6. If you wish, you can also limit access to the MySQL server by
+ choosing the Change scope button.
- --program-suffix=SUFFIX Append SUFFIX to installed program names
+ 7. Confirm your choices by clicking the OK button.
- --program-transform-name=PROGRAM run sed PROGRAM on installed
- program names
- -q Do not print `checking...' messages
- --quiet
- --sbindir=DIR System admin executables EPREFIX/sbin
- --sharedstatedir=DIR Modifiable architecture-independent data
- PREFIX/com
- --srcdir=DIR Find the sources in DIR configure directory or ..
- --sysconfdir=DIR Read-only single-machine data PREFIX/etc
- --target=TARGET Configure for building compilers for TARGET
- -V Display version information and exit
- --version
- --with-PACKAGE Use PACKAGE
- --with-archive-storage-engine Enable the Archive Storage Engine no
+ Additionally, when running the MySQL Installation Wizard on
+ Windows Vista, ensure that you are logged in as a user with
+ administrative rights.
- --with-atomic-ops Implement atomic operations using pthread
- rwlocks or atomic CPU instructions for multi-processor 5.1.12
- --with-berkeley-db Use BerkeleyDB located in DIR no
- --with-berkeley-db-includes Find Berkeley DB headers in DIR
- --with-berkeley-db-libs Find Berkeley DB libraries in DIR
- --with-big-tables Support tables with more than 4 G rows even on
- 32 bit platforms
- --with-blackhole-storage-engine Enable the Blackhole Storage
- Engine no
- --with-charset Default character set
- --with-client-ldflags Extra linking arguments for clients
- --with-collation Default collation
- --with-comment Comment about compilation environment
- --with-csv-storage-engine Enable the CSV Storage Engine yes
- --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS
- X/Darwin
- --with-debug Add debug code 5.1.7
- --with-debug=full Add debug code (adds memory checker, very slow)
+Note
- --with-embedded-privilege-control Build parts to check user's
- privileges (only affects embedded library)
- --with-embedded-server Build the embedded server
- --with-error-inject Enable error injection in MySQL Server
- 5.1.11
- --with-example-storage-engine Enable the Example Storage Engine no
+ When using Windows Vista, you may want to disable User Account
+ Control (UAC) before performing the installation. If you do not do
+ so, then MySQL may be identified as a security risk, which will
+ mean that you need to enable MySQL. You can disable the security
+ checking by following these instructions:
- --with-extra-charsets Use charsets in addition to default
- --with-fast-mutexes Compile with fast mutexes enabled 5.1.5
- --with-federated-storage-engine Enable federated storage engine no
- 5.1.3 5.1.9
- --with-gnu-ld Assume the C compiler uses GNU ld no
- --with-innodb Enable innobase storage engine no 5.1.3 5.1.9
- --with-lib-ccflags Extra CC options for libraries
- --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
- --with-low-memory Try to use less memory to compile to avoid
- memory limitations
- --with-machine-type Set the machine type, like "powerpc"
- --with-max-indexes=N Sets the maximum number of indexes per table
- 64
- --with-mysqld-ldflags Extra linking arguments for mysqld
- --with-mysqld-libs Extra libraries to link with for mysqld
- --with-mysqld-user What user the mysqld daemon shall be run as
+ 1. Open Control Panel.
- --with-mysqlmanager Build the mysqlmanager binary Build if server
- is built
- --with-named-curses-libs Use specified curses libraries
- --with-named-thread-libs Use specified thread libraries
- --with-ndb-ccflags Extra CC options for ndb compile
- --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi
- documentation
- --with-ndb-port Port for NDB Cluster management server
- --with-ndb-port-base Port for NDB Cluster management server
- --with-ndb-sci=DIR Provide MySQL with a custom location of sci
- library
- --with-ndb-test Include the NDB Cluster ndbapi test programs
- --with-ndbcluster Include the NDB Cluster table handler no
- --with-openssl=DIR Include the OpenSSL support
- --with-openssl-includes Find OpenSSL headers in DIR
- --with-openssl-libs Find OpenSSL libraries in DIR
- --with-other-libc=DIR Link against libc and other standard
- libraries installed in the specified nonstandard location
- --with-pic Try to use only PIC/non-PIC objects Use both
- --with-plugin-PLUGIN Forces the named plugin to be linked into
- mysqld statically 5.1.11
- --with-plugins Plugins to include in mysqld none 5.1.11
- --with-pstack Use the pstack backtrace library
- --with-pthread Force use of pthread library
- --with-row-based-replication Include row-based replication 5.1.5
- 5.1.6
- --with-server-suffix Append value to the version string
- --with-ssl=DIR Include SSL support 5.1.11
- --with-system-type Set the system type, like "sun-solaris10"
- --with-tags Include additional configurations automatic
- --with-tcp-port Which port to use for MySQL services 3306
- --with-unix-socket-path Where to put the unix-domain socket
- --with-yassl Include the yaSSL support
- --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom
- location of compression library
- --without-PACKAGE Do not use PACKAGE
- --without-bench Skip building of the benchmark suite
- --without-debug Build a production version without debugging code
+ 2. Under the User Accounts and Family Safety, select Add or
+ remove user accounts.
- --without-docs Skip building of the documentation
- --without-extra-tools Skip building utilities in the tools
- directory
- --without-geometry Do not build geometry-related parts
- --without-libedit Use system libedit instead of bundled copy
- --without-man Skip building of the man pages
- --without-ndb-binlog Disable ndb binlog 5.1.6
- --without-ndb-debug Disable special ndb debug features
- --without-plugin-PLUGIN Exclude PLUGIN 5.1.11
- --without-query-cache Do not build query cache
- --without-readline Use system readline instead of bundled copy
+ 3. Click on the Got to the main User Accounts page link.
- --without-row-based-replication Don't include row-based
- replication 5.1.7 5.1.14
- --without-server Only build the client
- --without-uca Skip building of the national Unicode collations
+ 4. Click on Turn User Account Control on or off. You may be
+ prompted to provide permission to change this setting. Click
+ Continue.
- Some of the configure options available are described here. For
- options that may be of use if you have difficulties building
- MySQL, see Section 2.10.4, "Dealing with Problems Compiling
- MySQL."
+ 5. Deselect or unceck the checkbox next to Use User Account
+ Control (UAC) to help protect your computer. Click OK to save
+ the setting.
- * To compile just the MySQL client libraries and client programs
- and not the server, use the --without-server option:
-shell> ./configure --without-server
- If you have no C++ compiler, some client programs such as
- mysql cannot be compiled because they require C++.. In this
- case, you can remove the code in configure that tests for the
- C++ compiler and then run ./configure with the
- --without-server option. The compile step should still try to
- build all clients, but you can ignore any warnings about files
- such as mysql.cc. (If make stops, try make -k to tell it to
- continue with the rest of the build even if errors occur.)
+ You will need to restart to complete the process. Click Restart
+ Now to reboot the machine and apply the changes. You can then
+ follow the instructions below for installing Windows.
- * If you want to build the embedded MySQL library (libmysqld.a),
- use the --with-embedded-server option.
+2.5.3.1. Using the MySQL Installation Wizard
- * If you don't want your log files and database directories
- located under /usr/local/var, use a configure command
- something like one of these:
-shell> ./configure --prefix=/usr/local/mysql
-shell> ./configure --prefix=/usr/local \
- --localstatedir=/usr/local/mysql/data
- The first command changes the installation prefix so that
- everything is installed under /usr/local/mysql rather than the
- default of /usr/local. The second command preserves the
- default installation prefix, but overrides the default
- location for database directories (normally /usr/local/var)
- and changes it to /usr/local/mysql/data.
- You can also specify the installation directory and data
- directory locations at server startup time by using the
- --basedir and --datadir options. These can be given on the
- command line or in an MySQL option file, although it is more
- common to use an option file. See Section 4.2.3.3, "Using
- Option Files."
+ MySQL Installation Wizard is an installer for the MySQL server
+ that uses the latest installer technologies for Microsoft Windows.
+ The MySQL Installation Wizard, in combination with the MySQL
+ Config Wizard, allows a user to install and configure a MySQL
+ server that is ready for use immediately after installation.
- * If you are using Unix and you want the MySQL socket file
- location to be somewhere other than the default location
- (normally in the directory /tmp or /var/run), use a configure
- command like this:
-shell> ./configure \
- --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
- The socket file name must be an absolute path name. You can
- also change the location of mysql.sock at server startup by
- using a MySQL option file. See Section B.1.4.5, "How to
- Protect or Change the MySQL Unix Socket File."
+ The MySQL Installation Wizard uses the standard Microsoft
+ Installer Engine (MSI) system is the standard installer for all
+ MySQL server distributions, version 4.1.5 and higher. Users of
+ previous versions of MySQL need to shut down and remove their
+ existing MySQL installations manually before installing MySQL with
+ the MySQL Installation Wizard. See Section 2.5.3.1.6, "Upgrading
+ MySQL with the Installation Wizard," for more information on
+ upgrading from a previous version.
- * If you want to compile statically linked programs (for
- example, to make a binary distribution, to get better
- performance, or to work around problems with some Red Hat
- Linux distributions), run configure like this:
-shell> ./configure --with-client-ldflags=-all-static \
- --with-mysqld-ldflags=-all-static
+ If you are upgrading an installation from MySQL 5.1.31 or earlier
+ to MySQL 5.1.32 or later, read the notes provided in Section
+ 2.5.3.1.6, "Upgrading MySQL with the Installation Wizard."
- * If you are using gcc and don't have libg++ or libstdc++
- installed, you can tell configure to use gcc as your C++
- compiler:
-shell> CC=gcc CXX=gcc ./configure
- When you use gcc as your C++ compiler, it does not attempt to
- link in libg++ or libstdc++. This may be a good thing to do
- even if you have those libraries installed. Some versions of
- them have caused strange problems for MySQL users in the past.
- The following list indicates some compilers and environment
- variable settings that are commonly used with each one.
+ The Microsoft Windows Installer Engine was updated with the
+ release of Windows XP; those using a previous version of Windows
+ can reference this Microsoft Knowledge Base article
+ (http://support.microsoft.com/default.aspx?scid=kb;EN-US;292539)
+ for information on upgrading to the latest version of the Windows
+ Installer Engine.
- + gcc 2.7.2:
-CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
+ In addition, Microsoft has introduced the WiX (Windows Installer
+ XML) toolkit. This is the first highly acknowledged Open Source
+ project from Microsoft. We have switched to WiX because it is an
+ Open Source project and it allows us to handle the complete
+ Windows installation process in a flexible manner using scripts.
- + gcc 2.95.2:
-CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
--felide-constructors -fno-exceptions -fno-rtti"
+ Improving the MySQL Installation Wizard depends on the support and
+ feedback of users like you. If you find that the MySQL
+ Installation Wizard is lacking some feature important to you, or
+ if you discover a bug, please report it in our bugs database using
+ the instructions given in Section 1.6, "How to Report Bugs or
+ Problems."
- + pgcc 2.90.29 or newer:
-CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
-CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
--felide-constructors -fno-exceptions -fno-rtti"
- In most cases, you can get a reasonably optimized MySQL binary
- by using the options from the preceding list and adding the
- following options to the configure line:
---prefix=/usr/local/mysql --enable-assembler \
---with-mysqld-ldflags=-all-static
- The full configure line would, in other words, be something
- like the following for all recent gcc versions:
-CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
--felide-constructors -fno-exceptions -fno-rtti" ./configure \
---prefix=/usr/local/mysql --enable-assembler \
---with-mysqld-ldflags=-all-static
- The binaries we provide on the MySQL Web site at
- http://dev.mysql.com/downloads/ are all compiled with full
- optimization and should be perfect for most users. See Section
- 2.1.2.4, "MySQL Binaries Compiled by Sun Microsystems, Inc.."
- There are some configuration settings you can tweak to build
- an even faster binary, but these are only for advanced users.
- See Section 7.5.1, "How Compiling and Linking Affects the
- Speed of MySQL."
- If the build fails and produces errors about your compiler or
- linker not being able to create the shared library
- libmysqlclient.so.N (where N is a version number), you can
- work around this problem by giving the --disable-shared option
- to configure. In this case, configure does not build a shared
- libmysqlclient.so.N library.
+2.5.3.1.1. Downloading and Starting the MySQL Installation Wizard
- * By default, MySQL uses the latin1 (cp1252 West European)
- character set. To change the default set, use the
- --with-charset option:
-shell> ./configure --with-charset=CHARSET
- CHARSET may be one of binary, armscii8, ascii, big5, cp1250,
- cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8,
- eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8,
- keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce,
- macroman, sjis, swe7, tis620, ucs2, ujis, utf8. See Section
- 9.2, "The Character Set Used for Data and Sorting."
- (Additional character sets might be available. Check the
- output from ./configure --help for the current list.)
- The default collation may also be specified. MySQL uses the
- latin1_swedish_ci collation by default. To change this, use
- the --with-collation option:
-shell> ./configure --with-collation=COLLATION
- To change both the character set and the collation, use both
- the --with-charset and --with-collation options. The collation
- must be a legal collation for the character set. (Use the SHOW
- COLLATION statement to determine which collations are
- available for each character set.)
- With the configure option --with-extra-charsets=LIST, you can
- define which additional character sets should be compiled into
- the server. LIST is one of the following:
+ The MySQL installation packages can be downloaded from
+ http://dev.mysql.com/downloads/. If the package you download is
+ contained within a Zip archive, you need to extract the archive
+ first.
- + A list of character set names separated by spaces
+ The process for starting the wizard depends on the contents of the
+ installation package you download. If there is a setup.exe file
+ present, double-click it to start the installation process. If
+ there is an .msi file present, double-click it to start the
+ installation process.
- + complex to include all character sets that can't be
- dynamically loaded
+2.5.3.1.2. Choosing an Install Type
- + all to include all character sets into the binaries
- Clients that want to convert characters between the server and
- the client should use the SET NAMES statement. See Section
- 5.1.5, "Session System Variables," and Section 9.1.4,
- "Connection Character Sets and Collations."
+ There are three installation types available: Typical, Complete,
+ and Custom.
- * To configure MySQL with debugging code, use the --with-debug
- option:
-shell> ./configure --with-debug
- This causes a safe memory allocator to be included that can
- find some errors and that provides output about what is
- happening. See MySQL Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
- As of MySQL 5.1.12, using --with-debug to configure MySQL with
- debugging support enables you to use the
- --debug="d,parser_debug" option when you start the server.
- This causes the Bison parser that is used to process SQL
- statements to dump a parser trace to the server's standard
- error output. Typically, this output is written to the error
- log.
+ The Typical installation type installs the MySQL server, the mysql
+ command-line client, and the command-line utilities. The
+ command-line clients and utilities include mysqldump, myisamchk,
+ and several other tools to help you manage the MySQL server.
- * If your client programs are using threads, you must compile a
- thread-safe version of the MySQL client library with the
- --enable-thread-safe-client configure option. This creates a
- libmysqlclient_r library with which you should link your
- threaded applications. See Section 21.10.17, "How to Make a
- Threaded Client."
+ The Complete installation type installs all components included in
+ the installation package. The full installation package includes
+ components such as the embedded server library, the benchmark
+ suite, support scripts, and documentation.
- * Some features require that the server be built with
- compression library support, such as the COMPRESS() and
- UNCOMPRESS() functions, and compression of the client/server
- protocol. The --with-zlib-dir=no|bundled|DIR option provides
- control for compression library support. The value no
- explicitly disables compression support. bundled causes the
- zlib library bundled in the MySQL sources to be used. A DIR
- path name specifies where to find the compression library
- sources.
+ The Custom installation type gives you complete control over which
+ packages you wish to install and the installation path that is
+ used. See Section 2.5.3.1.3, "The Custom Install Dialog," for more
+ information on performing a custom install.
- * It is possible to build MySQL with large table support using
- the --with-big-tables option.
- This option causes the variables that store table row counts
- to be declared as unsigned long long rather than unsigned
- long. This enables tables to hold up to approximately
- 1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows.
- Previously it was necessary to pass -DBIG_TABLES to the
- compiler manually in order to enable this feature.
+ If you choose the Typical or Complete installation types and click
+ the Next button, you advance to the confirmation screen to verify
+ your choices and begin the installation. If you choose the Custom
+ installation type and click the Next button, you advance to the
+ custom installation dialog, described in Section 2.5.3.1.3, "The
+ Custom Install Dialog."
- * Run configure with the --disable-grant-options option to cause
- the --bootstrap, --skip-grant-tables, and --init-file options
- for mysqld to be disabled. For Windows, the configure.js
- script recognizes the DISABLE_GRANT_OPTIONS flag, which has
- the same effect. The capability is available as of MySQL
- 5.1.15.
+2.5.3.1.3. The Custom Install Dialog
- * This option allows MySQL Community Server features to be
- enabled. Additional options may be required for individual
- features, such as --enable-profiling to enable statement
- profiling. This option was added in MySQL 5.1.24. It is
- enabled by default as of MySQL 5.1.28; to disable it, use
- --disable-community-features.
+ If you wish to change the installation path or the specific
+ components that are installed by the MySQL Installation Wizard,
+ choose the Custom installation type.
- * When given with --enable-community-features, the
- --enable-profiling option enables the statement profiling
- capability exposed by the SHOW PROFILE and SHOW PROFILES
- statements. (See Section 12.5.5.33, "SHOW PROFILES Syntax.")
- This option was added in MySQL 5.1.24. It is enabled by
- default as of MySQL 5.1.28; to disable it, use
- --disable-profiling.
+ A tree view on the left side of the custom install dialog lists
+ all available components. Components that are not installed have a
+ red X icon; components that are installed have a gray icon. To
+ change whether a component is installed, click on that component's
+ icon and choose a new option from the drop-down list that appears.
- * See Section 2.13, "Operating System-Specific Notes," for
- options that pertain to particular operating systems.
+ You can change the default installation path by clicking the
+ Change... button to the right of the displayed installation path.
- * See Section 5.5.7.2, "Using SSL Connections," for options that
- pertain to configuring MySQL to support secure (encrypted)
- connections.
+ After choosing your installation components and installation path,
+ click the Next button to advance to the confirmation dialog.
- * Several configure options apply to plugin selection and
- building:
---with-plugins=PLUGIN[,PLUGIN]...
---with-plugins=GROUP
---with-plugin-PLUGIN
---without-plugin-PLUGIN
- PLUGIN is an individual plugin name such as csv or archive.
- As shorthand, GROUP is a configuration group name such as none
- (select no plugins) or all (select all plugins).
- You can build a plugin as static (compiled into the server) or
- dynamic (built as a dynamic library that must be installed
- using the INSTALL PLUGIN statement before it can be used).
- Some plugins might not support static or dynamic build.
- configure --help shows the following information pertaining to
- plugins:
+2.5.3.1.4. The Confirmation Dialog
- + The plugin-related options
+ Once you choose an installation type and optionally choose your
+ installation components, you advance to the confirmation dialog.
+ Your installation type and installation path are displayed for you
+ to review.
- + The names of all available plugins
+ To install MySQL if you are satisfied with your settings, click
+ the Install button. To change your settings, click the Back
+ button. To exit the MySQL Installation Wizard without installing
+ MySQL, click the Cancel button.
- + For each plugin, a description of its purpose, which
- build types it supports (static or dynamic), and which
- plugin groups it is a part of.
- --with-plugins can take a list of one or more plugin names
- separated by commas, or a plugin group name. The named plugins
- are configured to be built as static plugins.
- --with-plugin-PLUGIN configures the given plugin to be built
- as a static plugin.
- --without-plugin-PLUGIN disables the given plugin from being
- built.
- If a plugin is named both with a --with and --without option,
- the result is undefined.
- For any plugin that is not explicitly selected or disabled, it
- is selected to be built dynamically if it supports dynamic
- build, and not built if it does not support dynamic build.
- (Thus, in the case that no plugin options are given, all
- plugins that support dynamic build are selected to be built as
- dynamic plugins. Plugins that do not support dynamic build are
- not built.)
+ After installation is complete, you have the option of registering
+ with the MySQL web site. Registration gives you access to post in
+ the MySQL forums at forums.mysql.com (http://forums.mysql.com)
+ along with the ability to report bugs at bugs.mysql.com
+ (http://bugs.mysql.com) and to subscribe to our newsletter. The
+ final screen of the installer provides a summary of the
+ installation and gives you the option to launch the MySQL Config
+ Wizard, which you can use to create a configuration file, install
+ the MySQL service, and configure security settings.
-2.10.3. Installing from the Development Source Tree
+2.5.3.1.5. Changes Made by MySQL Installation Wizard
-Caution
+ Once you click the Install button, the MySQL Installation Wizard
+ begins the installation process and makes certain changes to your
+ system which are described in the sections that follow.
- You should read this section only if you are interested in helping
- us test our new code. If you just want to get MySQL up and running
- on your system, you should use a standard release distribution
- (either a binary or source distribution).
+ Changes to the Registry
- To obtain the most recent development source tree, you first need
- to download and install Bazaar. You can obtain Bazaar from the
- Bazaar VCS Website (http://bazaar-vcs.org) Bazaar is supported by
- any platform that supports Python, and is therefore compatible
- with any Linux, Unix, Windows or Mac OS X host. Instructions for
- downloading and installing Bazaar on the different platforms are
- available on the Bazaar website.
+ The MySQL Installation Wizard creates one Windows registry key in
+ a typical install situation, located in
+ HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.
- All MySQL projects are hosted on Launchpad
- (http://launchpad.net/) MySQL projects, including MySQL server,
- MySQL Workbench and others are available from the Sun/MySQL
- Engineering (http://launchpad.net/~mysql) page. For the
- repositories related only to MySQL server, see the MySQL Server
- (http://launchpad.net/mysql-server) page.
+ The MySQL Installation Wizard creates a key named after the major
+ version of the server that is being installed, such as MySQL
+ Server 5.1. It contains two string values, Location and Version.
+ The Location string contains the path to the installation
+ directory. In a default installation it contains C:\Program
+ Files\MySQL\MySQL Server 5.1\. The Version string contains the
+ release number. For example, for an installation of MySQL Server
+ 5.1.41, the key contains a value of 5.1.41.
- To build under Unix/Linux, you must have the following tools
- installed:
+ These registry keys are used to help external tools identify the
+ installed location of the MySQL server, preventing a complete scan
+ of the hard-disk to determine the installation path of the MySQL
+ server. The registry keys are not required to run the server, and
+ if you install MySQL using the noinstall Zip archive, the registry
+ keys are not created.
+
+ Changes to the Start Menu
+
+ The MySQL Installation Wizard creates a new entry in the Windows
+ Start menu under a common MySQL menu heading named after the major
+ version of MySQL that you have installed. For example, if you
+ install MySQL 5.1, the MySQL Installation Wizard creates a MySQL
+ Server 5.1 section in the Start menu.
- * GNU make, available from http://www.gnu.org/software/make/.
- Although some platforms come with their own make
- implementations, it is highly recommended that you use GNU
- make. It may already be available on your system as gmake.
+ The following entries are created within the new Start menu
+ section:
- * autoconf 2.58 (or newer), available from
- http://www.gnu.org/software/autoconf/.
+ * MySQL Command Line Client: This is a shortcut to the mysql
+ command-line client and is configured to connect as the root
+ user. The shortcut prompts for a root user password when you
+ connect.
- * automake 1.8.1, available from
- http://www.gnu.org/software/automake/.
+ * MySQL Server Instance Config Wizard: This is a shortcut to the
+ MySQL Config Wizard. Use this shortcut to configure a newly
+ installed server, or to reconfigure an existing server.
- * libtool 1.5, available from
- http://www.gnu.org/software/libtool/.
+ * MySQL Documentation: This is a link to the MySQL server
+ documentation that is stored locally in the MySQL server
+ installation directory. This option is not available when the
+ MySQL server is installed using the Essentials installation
+ package.
- * m4, available from http://www.gnu.org/software/m4/.
+ Changes to the File System
- * bison, available from http://www.gnu.org/software/bison/. You
- should use the latest version of bison where possible. Version
- 1.75 and version 2.1 are known to work. There have been
- reported problems with bison 1.875. If you experience
- problems, upgrade to a later, rather than earlier, version.
- Versions of bison older than 1.75 may report this error:
-sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
- The maximum table size is not actually exceeded; the error is
- caused by bugs in older versions of bison.
+ The MySQL Installation Wizard by default installs the MySQL 5.1
+ server to C:\Program Files\MySQL\MySQL Server 5.1, where Program
+ Files is the default location for applications in your system, and
+ 5.1 is the major version of your MySQL server. This is the
+ recommended location for the MySQL server, replacing the former
+ default location C:\mysql.
- To build under Windows you will need a copy of Microsoft Visual
- C++ 2005 Express Edition, Visual Studio .Net 2003 (7.1), or Visual
- Studio 2005 (8.0) compiler system.
+ By default, all MySQL applications are stored in a common
+ directory at C:\Program Files\MySQL, where Program Files is the
+ default location for applications in your Windows installation. A
+ typical MySQL installation on a developer machine might look like
+ this:
+C:\Program Files\MySQL\MySQL Server 5.1
+C:\Program Files\MySQL\MySQL Workbench 5.1 OSS
- Once you have the necessary tools installed, you first need to
- create a local branch of the MySQL source code on your machine:
+ This approach makes it easier to manage and maintain all MySQL
+ applications installed on a particular system.
- 1. To obtain a copy of the MySQL source code, you must create a
- new Bazaar branch. If you do not already have a Bazaar
- repository directory set up, you need to initialize a new
- directory:
-shell> mkdir mysql-server
-shell> bzr init-repo --trees mysql-server
+ In MySQL 5.1.23 and earlier, the default location for the data
+ files used by MySQL is located within the corresponding MySQL
+ Server installation directory. For MySQL 5.1.24 and later, the
+ default location of the data directory is the AppData directory
+ configured for the user that installed the MySQL application.
- 2. Once you have an initialized directory, you can branch from
- the public MySQL server repositories. To create a branch of a
- specific version:
-shell> cd mysql-server
-shell> bzr branch lp:mysql-server/5.1 mysql-5.1
+2.5.3.1.6. Upgrading MySQL with the Installation Wizard
- 3. The initial download will take some time to complete,
- depending on the speed of your connection. Please be patient.
- Once you have downloaded the first tree, additional trees
- should take significantly less time to download.
+ The MySQL Installation Wizard can perform server upgrades
+ automatically using the upgrade capabilities of MSI. That means
+ you do not need to remove a previous installation manually before
+ installing a new release. The installer automatically shuts down
+ and removes the previous MySQL service before installing the new
+ version.
- 4. When building from the Bazaar branch, you may want to create a
- copy of your active branch so that you can make configuration
- and other changes without affecting the original branch
- contents. You can achieve this by branching from the original
- branch:
-shell> bzr branch mysql-5.1 mysql-5.1-build
+ Automatic upgrades are available only when upgrading between
+ installations that have the same major and minor version numbers.
+ For example, you can upgrade automatically from MySQL 5.1.34 to
+ MySQL 5.1.37, but not from MySQL 5.0 to MySQL 5.1.
- Once you have the local branch, you can start to build MySQL
- server from the source code. On Windows, the build process is
- different from Unix/Linux. To continue building MySQL on Windows,
- see Section 2.10.6, "Installing MySQL from Source on Windows."
-
- On Unix/Linux you need to use the autoconf system to create the
- configure script so that you can configure the build environment
- before building.
-
- 1. The following example shows the typical commands required to
- configure a source tree. The first cd command changes location
- into the top-level directory of the tree; replace mysql-5.1
- with the appropriate directory name.
+ In MySQL 5.1.32 and later, the EXE version of the MSI installer
+ packages were removed. When upgrading an existing MySQL
+ installation from the old EXE based installer to the MSI based
+ installer, please keep the following notes in mind:
+
+ * The MSI installer will not identify an existing installation
+ that was installed using the old EXE installer. This means
+ that the installer will not stop the existing server, or
+ detect that the existing password is required before
+ installing the new version. To work around this:
+
+ 1. Stop the current server manually using net stop or
+ mysqladmin shutdown.
+
+ 2. Remove the existing installation manually by using the
+ Add/Remove Programs control panel. This will keep the
+ existing configuration and data files, as these are not
+ removed automatically.
+
+ 3. Install the new version of MySQL using the MSI installer.
+ When running the installation, skip updating the security
+ by deselecting the checkbox on the security screen.
+
+ 4. Complete the installation, and then start the server
+ again. You should be able to login with your existing
+ user and password credentials.
+
+ * You can only upgrade the version and release using the MSI
+ installer. For example, you can upgrade an open source
+ installation with an open source installer. You cannot upgrade
+ an open source installation using the enterprise installer.
+
+ See Section 2.5.7, "Upgrading MySQL on Windows."
+
+2.5.3.2. Installing MySQL Automatically using MSI
+
+ The Microsoft Installer (MSI) supports a both a quiet and a
+ passive mode that can be used to install MySQL automatically
+ without requireing intervention. You can use this either in
+ scripts to automatically install MySQL or through a terminal
+ connection such as Telnet where you do not have access to the
+ standard Windows user interface. The MSI packages can also be used
+ in combination with Microsoft's Group Policy system (part of
+ Windows Server 2003 and Windows Server 2008) to install MySQL
+ across multiple machines.
+
+ To install MySQL from one of the MSI packages automatically from
+ the command line (or within a script), you need to use the
+ msiexec.exe tool. For example, to perform a quiet installation
+ (which shows no dialog boxes or progress):
+shell> msiexec /i /quiet mysql-5.1.39.msi
+
+ The /i indicates that you want to perform an installation. The
+ /quiet option indicates that you want no interactive elements.
+
+ To provide a dialog box showing the progress during installation,
+ and the dialog boxes providing information on the installation and
+ registration of MySQL, use /passive mode instead of /quiet:
+shell> msiexec /i /passive mysql-5.1.39.msi
+
+ Regardless of the mode of the installation, installing the package
+ in this manner performs a 'Typical' installation, and installs the
+ default components into the standard location.
+
+ You can also use this method to uninstall MySQL by using the
+ /uninstall or /x options:
+shell> msiexec /x /quiet mysql-5.1.39.msi
+
+ To install MySQL and configure a MySQL instance from the command
+ line, see Section 2.5.4.13, "Creating an Instance from the Command
+ Line."
+
+ For information on using MSI packages to install software
+ automatically using Group Policy, see How to use Group Policy to
+ remotely install software in Windows Server 2003
+ (http://support.microsoft.com/kb/816102)
-Note
- For MySQL 5.1.12 and earlier, you must separately configure
- the INNODB storage engine. You can do this by running the
- following command from the main source directory:
-shell> (cd storage/innobase; autoreconf --force --install)
-shell> cd mysql-5.1
-shell> autoreconf --force --install
-shell> ./configure # Add your favorite options here
-shell> make
- Or you can use BUILD/autorun.sh as a shortcut for the
- following sequence of commands:
-shell> aclocal; autoheader
-shell> libtoolize --automake --force
-shell> automake --force --add-missing; autoconf
- The command line that changes directory into the
- storage/innobase directory is used to configure the InnoDB
- storage engine. You can omit this lines if you do not require
- InnoDB support.
+2.5.3.3. Removing MySQL Installed from the MSI Package
-Note
- Beginning with MySQL 5.1, code specific to storage engines has
- been moved under a storage directory. For example, InnoDB code
- is now found in storage/innobase and NDBCLUSTER code is in
- storage/ndb.
- If you get some strange errors during this stage, verify that
- you have the correct version of the libtool installed.
- A collection of our standard configuration scripts is located
- in the BUILD/ subdirectory. For example, you may find it more
- convenient to use the BUILD/compile-pentium-debug script than
- the preceding set of shell commands. To compile on a different
- architecture, modify the script by removing flags that are
- Pentium-specific, or use another script that may be more
- appropriate. These scripts are provided on an "as-is" basis.
- They are not officially maintained and their contents may
- change from release to release.
+ To uninstall a MySQL where you have used the MSI packages, you
+ must use the Add/Remove Programs tool within Control Panel. To do
+ this:
- 2. When the build is done, run make install. Be careful with this
- on a production machine; the command may overwrite your live
- release installation. If you have another installation of
- MySQL, run ./configure with different values for the --prefix,
- --with-tcp-port, and --with-unix-socket-path options than
- those used for your production server.
+ 1. Right click on the start menu and choose Control Panel.
- 3. Play hard with your new installation and try to make the new
- features crash. Start by running make test. See Section
- 22.1.2, "MySQL Test Suite."
+ 2. If the Control Panel is set to category mode (you will see
+ Pick a category at the top of the Control Panel window),
+ double click on Add or Remove Programs. If the Control is set
+ to classic mode, doubgle click on the Add or Remove Programs
+ icon.
+
+ 3. Find MySQL in the list of installed software. MySQL Server is
+ installed against major version numbers (MySQL 5.0, MySQL 5.1,
+ etc.). Select the version that you want to remove and click
+ Remove.
+
+ 4. You will be prompted to confirm the removal. Click Yes to
+ remove MySQL.
+
+ When MySQL is removed using this method, only the installed
+ components are removed. Any database information (including the
+ tables and data), import or export files, log files, and binary
+ logs produced during execution are kept in their configured
+ location.
- 4. If you have gotten to the make stage, but the distribution
- does not compile, please enter the problem into our bugs
- database using the instructions given in Section 1.6, "How to
- Report Bugs or Problems." If you have installed the latest
- versions of the required GNU tools, and they crash trying to
- process our configuration files, please report that also.
- However, if you execute aclocal and get a command not found
- error or a similar problem, do not report it. Instead, make
- sure that all the necessary tools are installed and that your
- PATH variable is set correctly so that your shell can find
- them.
+2.5.4. MySQL Server Instance Config Wizard
- 5. After initially copying the repository with bzr to obtain the
- source tree, you should use pull option to periodically update
- your local copy. To do this any time after you have set up the
- repository, use this command:
-shell> bzr pull
+ The MySQL Server Instance Config Wizard helps automate the process
+ of configuring your server. It creates a custom MySQL
+ configuration file (my.ini or my.cnf) by asking you a series of
+ questions and then applying your responses to a template to
+ generate the configuration file that is tuned to your
+ installation.
- 6. You can examine the changeset comments for the tree by using
- the log option to bzr:
-shell> bzr log
- You can also browse changesets, comments, and source code
- online. To browse this information for MySQL 5.1, go to
- http://launchpad.net/mysql-server/.
- If you see diffs or code that you have a question about, do
- not hesitate to send email to the MySQL internals mailing
- list. See Section 1.5.1, "MySQL Mailing Lists." Also, if you
- think you have a better idea on how to do something, send an
- email message to the list with a patch.
+ The complete and essential MSI installation packages include the
+ MySQL Server Instance Config Wizard in the MySQL 5.1 server. The
+ MySQL Server Instance Config Wizard is only available for Windows.
+
+ The workflow sequence for using the MySQL Server Instance Config
+ Wizard is shown in the figure below:
+
+ Figure 2.4. MySQL Server Instance Config Wizard Workflow
+ MySQL Server Instance Config Wizard Workflow
+
+2.5.4.1. Starting the MySQL Server Instance Config Wizard
+
+ The MySQL Server Instance Config Wizard is normally started as
+ part of the installation process. You should only need to run the
+ MySQL Server Instance Config Wizard again when you need to change
+ the configuration parameters of your server.
-2.10.4. Dealing with Problems Compiling MySQL
+ If you chose not to open a port prior to installing MySQL on
+ Windows Vista, you can choose to use the MySQL Server Instance
+ Config Wizard after installation. However, you must open a port in
+ the Windows Firewall. To do this see the instructions given in
+ Section 2.5.3.1.1, "Downloading and Starting the MySQL
+ Installation Wizard." Rather than opening a port, you also have
+ the option of adding MySQL as a program that bypasses the Windows
+ Firewall. One or the other option is sufficient --- you need not
+ do both. Additionally, when running the MySQL Server Config Wizard
+ on Windows Vista ensure that you are logged in as a user with
+ administrative rights.
+ MySQL Server Instance Config Wizard
- All MySQL programs compile cleanly for us with no warnings on
- Solaris or Linux using gcc. On other systems, warnings may occur
- due to differences in system include files. See Section 2.10.5,
- "MIT-pthreads Notes," for warnings that may occur when using
- MIT-pthreads. For other problems, check the following list.
+ You can launch the MySQL Config Wizard by clicking the MySQL
+ Server Instance Config Wizard entry in the MySQL section of the
+ Windows Start menu.
- The solution to many problems involves reconfiguring. If you do
- need to reconfigure, take note of the following:
+ Alternatively, you can navigate to the bin directory of your MySQL
+ installation and launch the MySQLInstanceConfig.exe file directly.
- * If configure is run after it has previously been run, it may
- use information that was gathered during its previous
- invocation. This information is stored in config.cache. When
- configure starts up, it looks for that file and reads its
- contents if it exists, on the assumption that the information
- is still correct. That assumption is invalid when you
- reconfigure.
+ The MySQL Server Instance Config Wizard places the my.ini file in
+ the installation directory for the MySQL server. This helps
+ associate configuration files with particular server instances.
- * Each time you run configure, you must run make again to
- recompile. However, you may want to remove old object files
- from previous builds first because they were compiled using
- different configuration options.
+ To ensure that the MySQL server knows where to look for the my.ini
+ file, an argument similar to this is passed to the MySQL server as
+ part of the service installation:
+--defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
- To prevent old configuration information or object files from
- being used, run these commands before re-running configure:
-shell> rm config.cache
-shell> make clean
+ Here, C:\Program Files\MySQL\MySQL Server 5.1 is replaced with the
+ installation path to the MySQL Server. The --defaults-file option
+ instructs the MySQL server to read the specified file for
+ configuration options when it starts.
- Alternatively, you can run make distclean.
+ Apart from making changes to the my.ini file by running the MySQL
+ Server Instance Config Wizard again, you can modify it by opening
+ it with a text editor and making any necessary changes. You can
+ also modify the server configuration with the MySQL Administrator
+ (http://www.mysql.com/products/administrator/) utility. For more
+ information about server configuration, see Section 5.1.2, "Server
+ Command Options."
- The following list describes some of the problems when compiling
- MySQL that have been found to occur most often:
+ MySQL clients and utilities such as the mysql and mysqldump
+ command-line clients are not able to locate the my.ini file
+ located in the server installation directory. To configure the
+ client and utility applications, create a new my.ini file in the
+ Windows installation directory (for example, C:\WINDOWS).
- * If you get errors such as the ones shown here when compiling
- sql_yacc.cc, you probably have run out of memory or swap
- space:
-Internal compiler error: program cc1plus got fatal signal 11
-Out of virtual memory
-Virtual memory exhausted
- The problem is that gcc requires a huge amount of memory to
- compile sql_yacc.cc with inline functions. Try running
- configure with the --with-low-memory option:
-shell> ./configure --with-low-memory
- This option causes -fno-inline to be added to the compile line
- if you are using gcc and -O0 if you are using something else.
- You should try the --with-low-memory option even if you have
- so much memory and swap space that you think you can't
- possibly have run out. This problem has been observed to occur
- even on systems with generous hardware configurations, and the
- --with-low-memory option usually fixes it.
+ Under Windows Server 2003, Windows Server 2000, Windows XP, and
+ Windows Vista MySQL Server Instance Config Wizard will configure
+ MySQL to work as a Windows service. To start and stop MySQL you
+ use the Services application that is supplied as part of the
+ Windows Administrator Tools.
+
+2.5.4.2. Choosing a Maintenance Option
+
+ If the MySQL Server Instance Config Wizard detects an existing
+ configuration file, you have the option of either reconfiguring
+ your existing server, or removing the server instance by deleting
+ the configuration file and stopping and removing the MySQL
+ service.
- * By default, configure picks c++ as the compiler name and GNU
- c++ links with -lg++. If you are using gcc, that behavior can
- cause problems during configuration such as this:
-configure: error: installation or configuration problem:
-C++ compiler cannot create executables.
- You might also observe problems during compilation related to
- g++, libg++, or libstdc++.
- One cause of these problems is that you may not have g++, or
- you may have g++ but not libg++, or libstdc++. Take a look at
- the config.log file. It should contain the exact reason why
- your C++ compiler didn't work. To work around these problems,
- you can use gcc as your C++ compiler. Try setting the
- environment variable CXX to "gcc -O3". For example:
-shell> CXX="gcc -O3" ./configure
- This works because gcc compiles C++ source files as well as
- g++ does, but does not link in libg++ or libstdc++ by default.
- Another way to fix these problems is to install g++, libg++,
- and libstdc++. However, do not use libg++ or libstdc++ with
- MySQL because this only increases the binary size of mysqld
- without providing any benefits. Some versions of these
- libraries have also caused strange problems for MySQL users in
- the past.
+ To reconfigure an existing server, choose the Re-configure
+ Instance option and click the Next button. Any existing
+ configuration file is not overwritten, but renamed (within the
+ same directory) using a timestamp (Windows) or sequential number
+ (Linux). To remove the existing server instance, choose the Remove
+ Instance option and click the Next button.
- * If your compile fails with errors such as any of the
- following, you must upgrade your version of make to GNU make:
-making all in mit-pthreads
-make: Fatal error in reader: Makefile, line 18:
-Badly formed macro assignment
- Or:
-make: file `Makefile' line 18: Must be a separator (:
- Or:
-pthread.h: No such file or directory
- Solaris and FreeBSD are known to have troublesome make
- programs.
- GNU make 3.75 is known to work.
+ If you choose the Remove Instance option, you advance to a
+ confirmation window. Click the Execute button. The MySQL Server
+ Config Wizard stops and removes the MySQL service, and then
+ deletes the configuration file. The server installation and its
+ data folder are not removed.
- * If you want to define flags to be used by your C or C++
- compilers, do so by adding the flags to the CFLAGS and
- CXXFLAGS environment variables. You can also specify the
- compiler names this way using CC and CXX. For example:
-shell> CC=gcc
-shell> CFLAGS=-O3
-shell> CXX=gcc
-shell> CXXFLAGS=-O3
-shell> export CC CFLAGS CXX CXXFLAGS
- See Section 2.1.2.4, "MySQL Binaries Compiled by Sun
- Microsystems, Inc.," for a list of flag definitions that have
- been found to be useful on various systems.
+ If you choose the Re-configure Instance option, you advance to the
+ Configuration Type dialog where you can choose the type of
+ installation that you wish to configure.
- * If you get errors such as those shown here when compiling
- mysqld, configure did not correctly detect the type of the
- last argument to accept(), getsockname(), or getpeername():
-cxx: Error: mysqld.cc, line 645: In this statement, the referenced
- type of the pointer value ''length'' is ''unsigned long'',
- which is not compatible with ''int''.
-new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
- To fix this, edit the config.h file (which is generated by
- configure). Look for these lines:
-/* Define as the base type of the last arg to accept */
-#define SOCKET_SIZE_TYPE XXX
- Change XXX to size_t or int, depending on your operating
- system. (You must do this each time you run configure because
- configure regenerates config.h.)
+2.5.4.3. Choosing a Configuration Type
- * The sql_yacc.cc file is generated from sql_yacc.yy. Normally,
- the build process does not need to create sql_yacc.cc because
- MySQL comes with a pre-generated copy. However, if you do need
- to re-create it, you might encounter this error:
-"sql_yacc.yy", line xxx fatal: default action causes potential...
- This is a sign that your version of yacc is deficient. You
- probably need to install bison (the GNU version of yacc) and
- use that instead.
+ When you start the MySQL Server Instance Config Wizard for a new
+ MySQL installation, or choose the Re-configure Instance option for
+ an existing installation, you advance to the Configuration Type
+ dialog.
+ MySQL Server Instance Config Wizard: Configuration Type
- * On Debian Linux 3.0, you need to install gawk instead of the
- default mawk.
+ There are two configuration types available: Detailed
+ Configuration and Standard Configuration. The Standard
+ Configuration option is intended for new users who want to get
+ started with MySQL quickly without having to make many decisions
+ about server configuration. The Detailed Configuration option is
+ intended for advanced users who want more fine-grained control
+ over server configuration.
- * If you need to debug mysqld or a MySQL client, run configure
- with the --with-debug option, and then recompile and link your
- clients with the new client library. See MySQL Internals:
- Porting (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
+ If you are new to MySQL and need a server configured as a
+ single-user developer machine, the Standard Configuration should
+ suit your needs. Choosing the Standard Configuration option causes
+ the MySQL Config Wizard to set all configuration options
+ automatically with the exception of Service Options and Security
+ Options.
- * If you get a compilation error on Linux (for example, SuSE
- Linux 8.1 or Red Hat Linux 7.3) similar to the following one,
- you probably do not have g++ installed:
-libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
-incompatible pointer type
-libmysql.c:1329: too few arguments to function `gethostbyname_r'
-libmysql.c:1329: warning: assignment makes pointer from integer
-without a cast
-make[2]: *** [libmysql.lo] Error 1
- By default, the configure script attempts to determine the
- correct number of arguments by using g++ (the GNU C++
- compiler). This test yields incorrect results if g++ is not
- installed. There are two ways to work around this problem:
+ The Standard Configuration sets options that may be incompatible
+ with systems where there are existing MySQL installations. If you
+ have an existing MySQL installation on your system in addition to
+ the installation you wish to configure, the Detailed Configuration
+ option is recommended.
- + Make sure that the GNU C++ g++ is installed. On some
- Linux distributions, the required package is called gpp;
- on others, it is named gcc-c++.
+ To complete the Standard Configuration, please refer to the
+ sections on Service Options and Security Options in Section
+ 2.5.4.10, "The Service Options Dialog," and Section 2.5.4.11, "The
+ Security Options Dialog," respectively.
- + Use gcc as your C++ compiler by setting the CXX
- environment variable to gcc:
-export CXX="gcc"
- You must run configure again after making either of those
- changes.
+2.5.4.4. The Server Type Dialog
-2.10.5. MIT-pthreads Notes
+ There are three different server types available to choose from.
+ The server type that you choose affects the decisions that the
+ MySQL Server Instance Config Wizard makes with regard to memory,
+ disk, and processor usage.
+ MySQL Server Instance Config Wizard: Server Type
- This section describes some of the issues involved in using
- MIT-pthreads.
+ * Developer Machine: Choose this option for a typical desktop
+ workstation where MySQL is intended only for personal use. It
+ is assumed that many other desktop applications are running.
+ The MySQL server is configured to use minimal system
+ resources.
- On Linux, you should not use MIT-pthreads. Use the installed
- LinuxThreads implementation instead. See Section 2.13.1, "Linux
- Notes."
+ * Server Machine: Choose this option for a server machine where
+ the MySQL server is running alongside other server
+ applications such as FTP, email, and Web servers. The MySQL
+ server is configured to use a moderate portion of the system
+ resources.
- If your system does not provide native thread support, you should
- build MySQL using the MIT-pthreads package. This includes older
- FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some
- others. See Section 2.1.1, "Operating Systems Supported by MySQL
- Community Server."
+ * Dedicated MySQL Server Machine: Choose this option for a
+ server machine that is intended to run only the MySQL server.
+ It is assumed that no other applications are running. The
+ MySQL server is configured to use all available system
+ resources.
- MIT-pthreads is not part of the MySQL 5.1 source distribution. If
- you require this package, you need to download it separately from
- http://dev.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.t
- ar.gz
+Note
- After downloading, extract this source archive into the top level
- of the MySQL source directory. It creates a new subdirectory named
- mit-pthreads.
+ By selecting one of the preconfigured configurations, the values
+ and settings of various options in your my.cnf or my.ini will be
+ altered accordingly. The default values and options as described
+ in the reference manual may therefore be different to the options
+ and values that were created during the execution of the Config
+ Wizard.
- * On most systems, you can force MIT-pthreads to be used by
- running configure with the --with-mit-threads option:
-shell> ./configure --with-mit-threads
- Building in a nonsource directory is not supported when using
- MIT-pthreads because we want to minimize our changes to this
- code.
+2.5.4.5. The Database Usage Dialog
- * The checks that determine whether to use MIT-pthreads occur
- only during the part of the configuration process that deals
- with the server code. If you have configured the distribution
- using --without-server to build only the client code, clients
- do not know whether MIT-pthreads is being used and use Unix
- socket file connections by default. Because Unix socket files
- do not work under MIT-pthreads on some platforms, this means
- you need to use -h or --host with a value other than localhost
- when you run client programs.
+ The Database Usage dialog allows you to indicate the storage
+ engines that you expect to use when creating MySQL tables. The
+ option you choose determines whether the InnoDB storage engine is
+ available and what percentage of the server resources are
+ available to InnoDB.
+ MySQL Server Instance Config Wizard: Usage Dialog
- * When MySQL is compiled using MIT-pthreads, system locking is
- disabled by default for performance reasons. You can tell the
- server to use system locking with the --external-locking
- option. This is needed only if you want to be able to run two
- MySQL servers against the same data files, but that is not
- recommended, anyway.
+ * Multifunctional Database: This option enables both the InnoDB
+ and MyISAM storage engines and divides resources evenly
+ between the two. This option is recommended for users who use
+ both storage engines on a regular basis.
- * Sometimes the pthread bind() command fails to bind to a socket
- without any error message (at least on Solaris). The result is
- that all connections to the server fail. For example:
-shell> mysqladmin version
-mysqladmin: connect to server at '' failed;
-error: 'Can't connect to mysql server on localhost (146)'
- The solution to this problem is to kill the mysqld server and
- restart it. This has happened to us only when we have forcibly
- stopped the server and restarted it immediately.
+ * Transactional Database Only: This option enables both the
+ InnoDB and MyISAM storage engines, but dedicates most server
+ resources to the InnoDB storage engine. This option is
+ recommended for users who use InnoDB almost exclusively and
+ make only minimal use of MyISAM.
- * With MIT-pthreads, the sleep() system call isn't interruptible
- with SIGINT (break). This is noticeable only when you run
- mysqladmin --sleep. You must wait for the sleep() call to
- terminate before the interrupt is served and the process
- stops.
+ * Non-Transactional Database Only: This option disables the
+ InnoDB storage engine completely and dedicates all server
+ resources to the MyISAM storage engine. This option is
+ recommended for users who do not use InnoDB.
- * When linking, you might receive warning messages like these
- (at least on Solaris); they can be ignored:
-ld: warning: symbol `_iob' has differing sizes:
- (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
-file /usr/lib/libc.so value=0x140);
- /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
-ld: warning: symbol `__iob' has differing sizes:
- (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
-file /usr/lib/libc.so value=0x140);
- /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
+ The Config Wizard uses a template to generate the server
+ configuration file. The Database Usage dialog sets one of the
+ following option strings:
+Multifunctional Database: MIXED
+Transactional Database Only: INNODB
+Non-Transactional Database Only: MYISAM
- * Some other warnings also can be ignored:
-implicit declaration of function `int strtoll(...)'
-implicit declaration of function `int strtoul(...)'
+ When these options are processed through the default template
+ (my-template.ini) the result is:
+Multifunctional Database:
+default-storage-engine=InnoDB
+_myisam_pct=50
- * We have not been able to make readline work with MIT-pthreads.
- (This is not necessary, but may be of interest to some.)
+Transactional Database Only:
+default-storage-engine=InnoDB
+_myisam_pct=5
-2.10.6. Installing MySQL from Source on Windows
+Non-Transactional Database Only:
+default-storage-engine=MyISAM
+_myisam_pct=100
+skip-innodb
- These instructions describe how to build binaries from source for
- MySQL 5.1 on Windows. Instructions are provided for building
- binaries from a standard source distribution or from the Bazaar
- tree that contains the latest development source.
+ The _myisam_pct value is used to calculate the percentage of
+ resources dedicated to MyISAM. The remaining resources are
+ allocated to InnoDB.
-Note
+2.5.4.6. The InnoDB Tablespace Dialog
- The instructions here are strictly for users who want to test
- MySQL on Microsoft Windows from the latest source distribution or
- from the Bazaar tree. For production use, we do not advise using a
- MySQL server built by yourself from source. Normally, it is best
- to use precompiled binary distributions of MySQL that are built
- specifically for optimal performance on Windows by Sun
- Microsystems, Inc. Instructions for installing binary
- distributions are available in Section 2.3, "Installing MySQL on
- Windows."
+ Some users may want to locate the InnoDB tablespace files in a
+ different location than the MySQL server data directory. Placing
+ the tablespace files in a separate location can be desirable if
+ your system has a higher capacity or higher performance storage
+ device available, such as a RAID storage system.
+ MySQL Server Instance Config Wizard: InnoDB Data Tablespace
- To build MySQL on Windows from source, you must satisfy the
- following system, compiler, and resource requirements:
+ To change the default location for the InnoDB tablespace files,
+ choose a new drive from the drop-down list of drive letters and
+ choose a new path from the drop-down list of paths. To create a
+ custom path, click the ... button.
- * Windows 2000, Windows XP, or newer version.
- Windows Vista is supported when using Visual Studio 2005
- provided you have installed the following updates:
+ If you are modifying the configuration of an existing server, you
+ must click the Modify button before you change the path. In this
+ situation you must move the existing tablespace files to the new
+ location manually before starting the server.
- + Microsoft Visual Studio 2005 Professional Edition - ENU
- Service Pack 1 (KB926601)
- (http://support.microsoft.com/?kbid=926601)
+2.5.4.7. The Concurrent Connections Dialog
- + Security Update for Microsoft Visual Studio 2005
- Professional Edition - ENU (KB937061)
- (http://support.microsoft.com/?kbid=937061)
+ To prevent the server from running out of resources, it is
+ important to limit the number of concurrent connections to the
+ MySQL server that can be established. The Concurrent Connections
+ dialog allows you to choose the expected usage of your server, and
+ sets the limit for concurrent connections accordingly. It is also
+ possible to set the concurrent connection limit manually.
+ MySQL Server Instance Config Wizard: Connections
- + Update for Microsoft Visual Studio 2005 Professional
- Edition - ENU (KB932232)
- (http://support.microsoft.com/?kbid=932232)
+ * Decision Support (DSS)/OLAP: Choose this option if your server
+ does not require a large number of concurrent connections. The
+ maximum number of connections is set at 100, with an average
+ of 20 concurrent connections assumed.
- * CMake, which can be downloaded from http://www.cmake.org.
- After installing, modify your path to include the cmake
- binary.
+ * Online Transaction Processing (OLTP): Choose this option if
+ your server requires a large number of concurrent connections.
+ The maximum number of connections is set at 500.
- * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net
- 2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
+ * Manual Setting: Choose this option to set the maximum number
+ of concurrent connections to the server manually. Choose the
+ number of concurrent connections from the drop-down box
+ provided, or enter the maximum number of connections into the
+ drop-down box if the number you desire is not listed.
- * If you are using Visual C++ 2005 Express Edition, you must
- also install an appropriate Platform SDK. More information and
- links to downloads for various Windows platforms is available
- from
- http://www.microsoft.com/downloads/details.aspx?familyid=0baf2
- b35-c656-4969-ace8-e4c0c0716adb.
+2.5.4.8. The Networking and Strict Mode Options Dialog
- * If you are compiling from a Bazaar tree or making changes to
- the parser, you need bison for Windows, which can be
- downloaded from
- http://gnuwin32.sourceforge.net/packages/bison.htm. Download
- the package labeled "Complete package, excluding sources".
- After installing the package, modify your path to include the
- bison binary and ensure that this binary is accessible from
- Visual Studio.
+ Use the Networking Options dialog to enable or disable TCP/IP
+ networking and to configure the port number that is used to
+ connect to the MySQL server.
+ MySQL Server Instance Config Wizard: Network Configuration
- * Cygwin might be necessary if you want to run the test script
- or package the compiled binaries and support files into a Zip
- archive. (Cygwin is needed only to test or package the
- distribution, not to build it.) Cygwin is available from
- http://cygwin.com.
+ TCP/IP networking is enabled by default. To disable TCP/IP
+ networking, uncheck the box next to the Enable TCP/IP Networking
+ option.
- * 3GB to 5GB of disk space.
+ Port 3306 is used by default. To change the port used to access
+ MySQL, choose a new port number from the drop-down box or type a
+ new port number directly into the drop-down box. If the port
+ number you choose is in use, you are prompted to confirm your
+ choice of port number.
- The exact system requirements can be found here:
- http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as
- px and
- http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx
+ Set the Server SQL Mode to either enable or disable strict mode.
+ Enabling strict mode (default) makes MySQL behave more like other
+ database management systems. If you run applications that rely on
+ MySQL's old "forgiving" behavior, make sure to either adapt those
+ applications or to disable strict mode. For more information about
+ strict mode, see Section 5.1.8, "Server SQL Modes."
- You also need a MySQL source distribution for Windows, which can
- be obtained two ways:
+2.5.4.9. The Character Set Dialog
- * Obtain a source distribution packaged by Sun Microsystems,
- Inc. These are available from http://dev.mysql.com/downloads/.
+ The MySQL server supports multiple character sets and it is
+ possible to set a default server character set that is applied to
+ all tables, columns, and databases unless overridden. Use the
+ Character Set dialog to change the default character set of the
+ MySQL server.
+ MySQL Server Instance Config Wizard: Character Set
- * Package a source distribution yourself from the latest Bazaar
- developer source tree. For instructions on pulling the latest
- source files, see Section 2.10.3, "Installing from the
- Development Source Tree."
+ * Standard Character Set: Choose this option if you want to use
+ latin1 as the default server character set. latin1 is used for
+ English and many Western European languages.
- If you find something not working as expected, or you have
- suggestions about ways to improve the current build process on
- Windows, please send a message to the win32 mailing list. See
- Section 1.5.1, "MySQL Mailing Lists."
+ * Best Support For Multilingualism: Choose this option if you
+ want to use utf8 as the default server character set. This is
+ a Unicode character set that can store characters from many
+ different languages.
-2.10.6.1. Building MySQL from Source Using CMake and Visual Studio
+ * Manual Selected Default Character Set / Collation: Choose this
+ option if you want to pick the server's default character set
+ manually. Choose the desired character set from the provided
+ drop-down list.
- You can build MySQL on Windows by using a combination of cmake and
- Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio
- 2005 (8.0) or Microsoft Visual C++ 2005 Express Edition. You must
- have the appropriate Microsoft Platform SDK installed.
+2.5.4.10. The Service Options Dialog
-Note
+ On Windows platforms, the MySQL server can be installed as a
+ Windows service. When installed this way, the MySQL server can be
+ started automatically during system startup, and even restarted
+ automatically by Windows in the event of a service failure.
- To compile from the source code on Windows you must use the
- standard source distribution (for example, mysql-5.0.45.tar.gz).
- You build from the same distribution as used to build MySQL on
- Unix, Linux and other platforms. Do not use the Windows Source
- distributions as they do not contain the necessary configuration
- script and other files.
+ The MySQL Server Instance Config Wizard installs the MySQL server
+ as a service by default, using the service name MySQL. If you do
+ not wish to install the service, uncheck the box next to the
+ Install As Windows Service option. You can change the service name
+ by picking a new service name from the drop-down box provided or
+ by entering a new service name into the drop-down box.
- Follow this procedure to build MySQL:
+Note
- 1. If you are installing from a packaged source distribution,
- create a work directory (for example, C:\workdir), and unpack
- the source distribution there using WinZip or another Windows
- tool that can read .zip files. This directory is the work
- directory in the following instructions.
+ Service names can include any legal character except forward (/)
+ or backward (\) slashes, and must be less than 256 characters
+ long.
- 2. Using a command shell, navigate to the work directory and run
- the following command:
-C:\workdir>win\configure.js options
- If you have associated the .js file extension with an
- application such as a text editor, then you may need to use
- the following command to force configure.js to be executed as
- a script:
-C:\workdir>cscript win\configure.js options
- These options are available for configure.js:
+Warning
- + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage
- engine.
+ If you are installing multiple versions of MySQL onto the same
+ machine, you must choose a different service name for each version
+ that you install. If you do not choose a different service for
+ each installed version then the service manager information will
+ be inconsistent and this will cause problems when you try to
+ uninstall a previous version.
- + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined
- partitioning.
+ If you have already installed multiple versions using the same
+ service name, you must manually edit the contents of the
+ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters
+ within the Windows registry to update the association of the
+ service name with the correct server version.
- + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage
- engine.
+ Typically, when installing multiple versions you create a service
+ name based on the version information. For example, you might
+ install MySQL 5.x as mysql5, or specific versions such as MySQL
+ 5.1.30 as mysql50130.
- + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE
- storage engine.
+ To install the MySQL server as a service but not have it started
+ automatically at startup, uncheck the box next to the Launch the
+ MySQL Server Automatically option.
- + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage
- engine.
+2.5.4.11. The Security Options Dialog
- + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
- storage engine.
+ It is strongly recommended that you set a root password for your
+ MySQL server, and the MySQL Server Instance Config Wizard requires
+ by default that you do so. If you do not wish to set a root
+ password, uncheck the box next to the Modify Security Settings
+ option.
+ MySQL Server Instance Config Wizard: Security
- + WITH_NDBCLUSTER_STORAGE_ENGINE (experimental): Enable the
- NDBCLUSTER storage engine in the MySQL server; cause
- binaries for the MySQL Cluster management and data node,
- management client, and other programs to be built.
- This option is supported only in MySQL Cluster NDB 7.0
- (NDBCLUSTER storage engine versions 6.4.0 and later)
- using the MySQL Cluster sources. It cannot be used to
- enable clustering support in other MySQL source trees or
- distributions.
+ To set the root password, enter the desired password into both the
+ New root password and Confirm boxes. If you are reconfiguring an
+ existing server, you need to enter the existing root password into
+ the Current root password box.
- + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.
+ To allow root logins from across the network, check the box next
+ to the Enable root access from remote machines option. This
+ decreases the security of your root account.
- + COMPILATION_COMMENT=comment: Server comment, default
- "Source distribution".
+ To create an anonymous user account, check the box next to the
+ Create An Anonymous Account option. Creating an anonymous account
+ can decrease server security and cause login and permission
+ difficulties. For this reason, it is not recommended.
- + MYSQL_TCP_PORT=port: Server port, default 3306.
+2.5.4.12. The Confirmation Dialog
- + DISABLE_GRANT_OPTIONS: Disables the --bootstrap,
- --skip-grant-tables, and --init-file options for mysqld.
- This option is available as of MySQL 5.1.15.
- For example (type the command on one line):
-C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE
- WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
+ The final dialog in the MySQL Server Instance Config Wizard is the
+ Confirmation Dialog. To start the configuration process, click the
+ Execute button. To return to a previous dialog, click the Back
+ button. To exit the MySQL Server Instance Config Wizard without
+ configuring the server, click the Cancel button.
+ MySQL Server Instance Config Wizard: Confirmation
- 3. From the work directory, execute the win\build-vs8.bat or
- win\build-vs71.bat file, depending on the version of Visual
- Studio you have installed. The script invokes CMake, which
- generates the mysql.sln solution file.
- You can also use win\build-vs8_x64.bat to build the 64-bit
- version of MySQL. However, you cannot build the 64-bit version
- with Visual Studio Express Edition. You must use Visual Studio
- 2005 (8.0) or higher.
+ After you click the Execute button, the MySQL Server Instance
+ Config Wizard performs a series of tasks and displays the progress
+ onscreen as the tasks are performed.
- 4. From the work directory, open the generated mysql.sln file
- with Visual Studio and select the proper configuration using
- the Configuration menu. The menu provides Debug, Release,
- RelwithDebInfo, MinRelInfo options. Then select Solution >
- Build to build the solution.
- Remember the configuration that you use in this step. It is
- important later when you run the test script because that
- script needs to know which configuration you used.
+ The MySQL Server Instance Config Wizard first determines
+ configuration file options based on your choices using a template
+ prepared by MySQL developers and engineers. This template is named
+ my-template.ini and is located in your server installation
+ directory.
- 5. Test the server. The server built using the preceding
- instructions expects that the MySQL base directory and data
- directory are C:\mysql and C:\mysql\data by default. If you
- want to test your server using the source tree root directory
- and its data directory as the base directory and data
- directory, you need to tell the server their path names. You
- can either do this on the command line with the --basedir and
- --datadir options, or by placing appropriate options in an
- option file. (See Section 4.2.3.3, "Using Option Files.") If
- you have an existing data directory elsewhere that you want to
- use, you can specify its path name instead.
- When the server is running in standalone fashion or as a
- service based on your configuration, try to connect to it from
- the mysql interactive command-line utility.
- You can also run the standard test script, mysql-test-run.pl.
- This script is written in Perl, so you'll need either Cygwin
- or ActiveState Perl to run it. You may also need to install
- the modules required by the script. To run the test script,
- change location into the mysql-test directory under the work
- directory, set the MTR_VS_CONFIG environment variable to the
- configuration you selected earlier (or use the --vs-config
- option), and invoke mysql-test-run.pl. For example (using
- Cygwin and the bash shell):
-shell> cd mysql-test
-shell> export MTR_VS_CONFIG=debug
-shell> ./mysql-test-run.pl --force --timer
-shell> ./mysql-test-run.pl --force --timer --ps-protocol
+ The MySQL Config Wizard then writes these options to the
+ corresponding configuration file.
- When you are satisfied that the programs you have built are
- working correctly, stop the server. Now you can install the
- distribution. One way to do this is to use the make_win_bin_dist
- script in the scripts directory of the MySQL source distribution
- (see Section 4.4.2, "make_win_bin_dist --- Package MySQL
- Distribution as ZIP Archive"). This is a shell script, so you must
- have Cygwin installed if you want to use it. It creates a Zip
- archive of the built executables and support files that you can
- unpack in the location at which you want to install MySQL.
+ If you chose to create a service for the MySQL server, the MySQL
+ Server Instance Config Wizard creates and starts the service. If
+ you are reconfiguring an existing service, the MySQL Server
+ Instance Config Wizard restarts the service to apply your
+ configuration changes.
+
+ If you chose to set a root password, the MySQL Config Wizard
+ connects to the server, sets your new root password, and applies
+ any other security settings you may have selected.
+
+ After the MySQL Server Instance Config Wizard has completed its
+ tasks, it displays a summary. Click the Finish button to exit the
+ MySQL Server Config Wizard.
+
+2.5.4.13. Creating an Instance from the Command Line
+
+ In addition to using the GUI interface to the MySQL Server
+ Instance Config Wizard, you can also create instances
+ automatically from the command line.
+
+ To use the MySQL Server Instance Config Wizard on the command
+ line, you need to use the MySQLInstanceConfig.exe command that is
+ installed with MySQL in the bin directory within the installation
+ directory. MySQLInstanceConfig.exe takes a number of command-line
+ arguments the set the properties that would normally be selected
+ through the GUI interface, and then creates a new configuration
+ file (my.ini) by combining these selections with a template
+ configuration file to produce the working configuration file.
+
+ The main command line options are provided in the table below.
+ Some of the options are required, while some options are optional.
+
+ Table 2.4. MySQL Server Instance Config Wizard Command Line
+ Options
+ Option Description
+ Required Parameters
+ -nPRODUCTNAME The name of the instance when installed
+ -pPATH Path of the base directory for installation. This is
+ equivalent to the directory when using the basedir configuration
+ parameter
+ -vVERSION The version tag to use for this installation
+ Action to Perform
+ -i Install an instance
+ -r Remove an instance
+ -s Stop an existing instance
+ -q Perform the operation quietly
+ -lFILENAME Sae the installation progress in a logfile
+ Config File to Use
+ -tFILENAME Path to the template config file that will be used to
+ generate the installed configuration file
+ -cFILENAME Path to a config file to be generated
+
+ The -t and -c options work together to set the configuration
+ parameters for a new instance. The -t option specifies the
+ template configuration file to use as the basic configuration,
+ which are then merged with the configuration parameters generated
+ by the MySQL Server Instance Config Wizard into the configuration
+ file specified by the -c option.
+
+ A sample template file, my-template.ini is provided in the
+ toplevel MySQL installation directory. The file contains elements
+ are replaced automatically by the MySQL Server Instance Config
+ Wizard during configuration.
+
+ If you specify a configuration file that already exists, the
+ existing configuration file will be saved in the file with the
+ original, with the date and time added. For example, the mysql.ini
+ will be copied to mysql 2009-10-27 1646.ini.bak.
+
+ The parameters that you can specify on the command line are listed
+ in the table below.
+
+ Table 2.5. MySQL Server Instance Config Wizard Parameters
+ Parameter Description
+ ServiceName=$ Specify the name of the service to be created
+ AddBinToPath={yes | no} Specifies whether to add the binary
+ directory of MySQL to the standard PATH environment variable
+ ServerType={DEVELOPMENT | SERVER | DEDICATED} Specify the server
+ type. For more information, see Section 2.5.4.4, "The Server Type
+ Dialog"
+ DatabaseType={MIXED | INNODB | MYISAM} Specify the default
+ database type. For more information, see Section 2.5.4.5, "The
+ Database Usage Dialog"
+ ConnectionUsage={DSS | OLTP} Specify the type of connection
+ support, this automates the setting for the number of concurrent
+ connections (see the ConnectionCount parameter). For more
+ information, see Section 2.5.4.7, "The Concurrent Connections
+ Dialog"
+ ConnectionCount=# Specify the number of concurrent connections to
+ support. For more information, see Section 2.5.4.4, "The Server
+ Type Dialog"
+ SkipNetworking={yes | no} Specify whether network support should
+ be supported. Specifying yes disables network access altogether
+ Port=# Specify the network port number to use for network
+ connections. For more information, see Section 2.5.4.8, "The
+ Networking and Strict Mode Options Dialog"
+ StrictMode={yes | no} Specify whether to use the strict SQL mode.
+ For more information, see Section 2.5.4.8, "The Networking and
+ Strict Mode Options Dialog"
+ Charset=$ Specify the default character set. For more information,
+ see Section 2.5.4.9, "The Character Set Dialog"
+ RootPassword=$ Specify the root password
+ RootCurrentPassword=$ Specify the current root password then
+ stopping and/or reconfiguring an existing service
- It is also possible to install MySQL by copying directories and
- files directly:
+Note
- 1. Create the directories where you want to install MySQL. For
- example, to install into C:\mysql, use these commands:
-C:\> mkdir C:\mysql
-C:\> mkdir C:\mysql\bin
-C:\> mkdir C:\mysql\data
-C:\> mkdir C:\mysql\share
-C:\> mkdir C:\mysql\scripts
- If you want to compile other clients and link them to MySQL,
- you should also create several additional directories:
-C:\> mkdir C:\mysql\include
-C:\> mkdir C:\mysql\lib
-C:\> mkdir C:\mysql\lib\debug
-C:\> mkdir C:\mysql\lib\opt
- If you want to benchmark MySQL, create this directory:
-C:\> mkdir C:\mysql\sql-bench
- Benchmarking requires Perl support. See Section 2.15, "Perl
- Installation Notes."
+ When specifying options on the command line, you can enclose the
+ entire command-line option and the value you are specifying using
+ double quotes. This enables you to use spaces in the options. For
+ example, "-cC:\mysql.ini".
+
+ The following command installs a MySQL Server 5.1 instance from
+ the directory C:\Program Files\MySQL\MySQL Server 5.1 using the
+ service name MySQL51 and setting the root password to 1234.
+shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" »
+ "-nMySQL Server 5.1" "-pC:\Program Files\MySQL\MySQL Server 5.1" -
+v5.1.39 »
+ "-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT Datab
+aseType=MIXED »
+ ConnectionUsage=DSS Port=3311 ServiceName=MySQL51 RootPassword=123
+4
+
+ In the above example, a log file will be generated in
+ mysql_install_log.txt containing the information about the
+ instance creation process. The log file generated by the above
+ example is shown below:
+Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0
+Date: 2009-10-27 17:07:21
+
+Installing service ...
+
+Product Name: MySQL Server 5.1
+Version: 5.1.39
+Installation Path: C:\Program Files\MySQL\MySQL Server 5.1\
+
+Creating configuration file C:\mytest.ini using template my-template.
+ini.
+Options:
+DEVELOPMENT
+MIXED
+DSS
+STRICTMODE
+
+Variables:
+port: 3311
+default-character-set: latin1
+basedir: "C:/Program Files/MySQL/MySQL Server 5.1/"
+datadir: "C:/Program Files/MySQL/MySQL Server 5.1/Data/"
+
+
+Creating Windows service entry.
+Service name: "MySQL51"
+Parameters: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --
+defaults-file="C:\mytest.ini" MySQL51.
+Windows service MySQL51 installed.
+
+ When using the command-line, the return values in the following
+ table indicate an error performing the specified option.
+
+ Table 2.6. Return Value from MySQL Server Instance Config Wizard
+ Value Description
+ 2 Configuration template file cannot be found
+ 3 The Windows service entry cannot be created
+ 4 Could not connect to the Service Control Manager
+ 5 The MySQL service cannot be started
+ 6 The MySQL service cannot be stopped
+ 7 The security settings cannot be applied
+ 8 The configuration file cannot be written
+ 9 The Windows service entry cannot be removed
+
+ You can perform an installation of MySQL automatically using the
+ MSI packe. For more information, see Section 2.5.3.2, "Installing
+ MySQL Automatically using MSI."
- 2. From the work directory, copy into the C:\mysql directory the
- following directories:
-C:\> cd \workdir
-C:\workdir> copy client_release\*.exe C:\mysql\bin
-C:\workdir> copy client_debug\mysqld.exe C:\mysql\bin\mysqld-debug.ex
-e
-C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
-C:\workdir> xcopy share\*.* C:\mysql\share /E
- If you want to compile other clients and link them to MySQL,
- you should also copy several libraries and header files:
-C:\workdir> copy lib_debug\mysqlclient.lib C:\mysql\lib\debug
-C:\workdir> copy lib_debug\libmysql.* C:\mysql\lib\debug
-C:\workdir> copy lib_debug\zlib.* C:\mysql\lib\debug
-C:\workdir> copy lib_release\mysqlclient.lib C:\mysql\lib\opt
-C:\workdir> copy lib_release\libmysql.* C:\mysql\lib\opt
-C:\workdir> copy lib_release\zlib.* C:\mysql\lib\opt
-C:\workdir> copy include\*.h C:\mysql\include
-C:\workdir> copy libmysql\libmysql.def C:\mysql\include
- If you want to benchmark MySQL, you should also do this:
-C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
+2.5.5. Installing MySQL from a noinstall Zip Archive
- After installation, set up and start the server in the same way as
- for binary Windows distributions. See Section 2.3, "Installing
- MySQL on Windows."
+ Users who are installing from the noinstall package can use the
+ instructions in this section to manually install MySQL. The
+ process for installing MySQL from a Zip archive is as follows:
-2.10.7. Compiling MySQL Clients on Windows
+ 1. Extract the archive to the desired install directory
- In your source files, you should include my_global.h before
- mysql.h:
-#include <my_global.h>
-#include <mysql.h>
+ 2. Create an option file
+
+ 3. Choose a MySQL server type
- my_global.h includes any other files needed for Windows
- compatibility (such as windows.h) if you compile your program on
- Windows.
+ 4. Start the MySQL server
- You can either link your code with the dynamic libmysql.lib
- library, which is just a wrapper to load in libmysql.dll on
- demand, or link with the static mysqlclient.lib library.
+ 5. Secure the default user accounts
- The MySQL client libraries are compiled as threaded libraries, so
- you should also compile your code to be multi-threaded.
+ This process is described in the sections that follow.
-2.11. Post-Installation Setup and Testing
+2.5.5.1. Extracting the Install Archive
- After installing MySQL, there are some issues that you should
- address. For example, on Unix, you should initialize the data
- directory and create the MySQL grant tables. On all platforms, an
- important security concern is that the initial accounts in the
- grant tables have no passwords. You should assign passwords to
- prevent unauthorized access to the MySQL server. Optionally, you
- can create time zone tables to enable recognition of named time
- zones.
+ To install MySQL manually, do the following:
- The following sections include post-installation procedures that
- are specific to Windows systems and to Unix systems. Another
- section, Section 2.11.2.3, "Starting and Troubleshooting the MySQL
- Server," applies to all platforms; it describes what to do if you
- have trouble getting the server to start. Section 2.11.3,
- "Securing the Initial MySQL Accounts," also applies to all
- platforms. You should follow its instructions to make sure that
- you have properly protected your MySQL accounts by assigning
- passwords to them.
+ 1. If you are upgrading from a previous version please refer to
+ Section 2.5.7, "Upgrading MySQL on Windows," before beginning
+ the upgrade process.
- When you are ready to create additional user accounts, you can
- find information on the MySQL access control system and account
- management in Section 5.4, "The MySQL Access Privilege System,"
- and Section 5.5, "MySQL User Account Management."
+ 2. Make sure that you are logged in as a user with administrator
+ privileges.
-2.11.1. Windows Post-Installation Procedures
+ 3. Choose an installation location. Traditionally, the MySQL
+ server is installed in C:\mysql. The MySQL Installation Wizard
+ installs MySQL under C:\Program Files\MySQL. If you do not
+ install MySQL at C:\mysql, you must specify the path to the
+ install directory during startup or in an option file. See
+ Section 2.5.5.2, "Creating an Option File."
- On Windows, the data directory and the grant tables do not have to
- be created. MySQL Windows distributions include the grant tables
- with a set of preinitialized accounts in the mysql database under
- the data directory. It is unnecessary to run the mysql_install_db
- script that is used on Unix. Regarding passwords, if you installed
- MySQL using the Windows Installation Wizard, you may have already
- assigned passwords to the accounts. (See Section 2.3.3, "Using the
- MySQL Installation Wizard.") Otherwise, use the
- password-assignment procedure given in Section 2.11.3, "Securing
- the Initial MySQL Accounts."
+ 4. Extract the install archive to the chosen installation
+ location using your preferred Zip archive tool. Some tools may
+ extract the archive to a folder within your chosen
+ installation location. If this occurs, you can move the
+ contents of the subfolder into the chosen installation
+ location.
- Before setting up passwords, you might want to try running some
- client programs to make sure that you can connect to the server
- and that it is operating properly. Make sure that the server is
- running (see Section 2.3.9, "Starting the Server for the First
- Time"), and then issue the following commands to verify that you
- can retrieve information from the server. The output should be
- similar to what is shown here:
-C:\> C:\mysql\bin\mysqlshow
-+--------------------+
-| Databases |
-+--------------------+
-| information_schema |
-| mysql |
-| test |
-+--------------------+
+2.5.5.2. Creating an Option File
-C:\> C:\mysql\bin\mysqlshow mysql
-Database: mysql
-+---------------------------+
-| Tables |
-+---------------------------+
-| columns_priv |
-| db |
-| event |
-| func |
-| general_log |
-| help_category |
-| help_keyword |
-| help_relation |
-| help_topic |
-| host |
-| plugin |
-| proc |
-| procs_priv |
-| servers |
-| slow_log |
-| tables_priv |
-| time_zone |
-| time_zone_leap_second |
-| time_zone_name |
-| time_zone_transition |
-| time_zone_transition_type |
-| user |
-+---------------------------+
+ If you need to specify startup options when you run the server,
+ you can indicate them on the command line or place them in an
+ option file. For options that are used every time the server
+ starts, you may find it most convenient to use an option file to
+ specify your MySQL configuration. This is particularly true under
+ the following circumstances:
+ * The installation or data directory locations are different
+ from the default locations (C:\Program Files\MySQL\MySQL
+ Server 5.1 and C:\Program Files\MySQL\MySQL Server 5.1\data).
-C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
-+------+-------+------+
-| host | db | user |
-+------+-------+------+
-| % | test% | |
-+------+-------+------+
+ * You need to tune the server settings, such as memory, cache,
+ or InnoDB configuration information.
- You may need to specify a different directory from the one shown;
- if you used the Windows Installation Wizard, then the default
- directory is C:\Program Files\MySQL\MySQL Server 5.1, and the
- mysql and mysqlshow client programs are in C:\Program
- Files\MySQL\MySQL Server 5.1\bin. See Section 2.3.3, "Using the
- MySQL Installation Wizard," for more information.
+ When the MySQL server starts on Windows, it looks for option files
+ in several locations, such as the Windows directory, C:\, and the
+ MySQL installation directory (for the full list of locations, see
+ Section 4.2.3.3, "Using Option Files"). The Windows directory
+ typically is named something like C:\WINDOWS. You can determine
+ its exact location from the value of the WINDIR environment
+ variable using the following command:
+C:\> echo %WINDIR%
- If you have already secured the initial MySQL accounts, you may
- need to use the -u and -p options to supply a user name and
- password to the mysqlshow and mysql client programs; otherwise the
- programs may fail with an error, or you may not be able to view
- all databases. For example, if you have assigned the password
- "secretpass" to the MySQL root account, then you can invoke
- mysqlshow and mysql as shown here:
-C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass
-+--------------------+
-| Databases |
-+--------------------+
-| information_schema |
-| mysql |
-| test |
-+--------------------+
+ MySQL looks for options in each location first in the my.ini file,
+ and then in the my.cnf file. However, to avoid confusion, it is
+ best if you use only one file. If your PC uses a boot loader where
+ C: is not the boot drive, your only option is to use the my.ini
+ file. Whichever option file you use, it must be a plain text file.
-C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
-Database: mysql
-+---------------------------+
-| Tables |
-+---------------------------+
-| columns_priv |
-| db |
-| event |
-| func |
-| general_log |
-| help_category |
-| help_keyword |
-| help_relation |
-| help_topic |
-| host |
-| plugin |
-| proc |
-| procs_priv |
-| servers |
-| slow_log |
-| tables_priv |
-| time_zone |
-| time_zone_leap_second |
-| time_zone_name |
-| time_zone_transition |
-| time_zone_transition_type |
-| user |
-+---------------------------+
+ You can also make use of the example option files included with
+ your MySQL distribution; see Section 4.2.3.3.2, "Preconfigured
+ Option Files."
+ An option file can be created and modified with any text editor,
+ such as Notepad. For example, if MySQL is installed in E:\mysql
+ and the data directory is in E:\mydata\data, you can create an
+ option file containing a [mysqld] section to specify values for
+ the basedir and datadir options:
+[mysqld]
+# set basedir to your installation path
+basedir=E:/mysql
+# set datadir to the location of your data directory
+datadir=E:/mydata/data
-C:\> C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User F
-ROM db" mysql
-+------+-------+------+
-| host | db | user |
-+------+-------+------+
-| % | test% | |
-+------+-------+------+
+ Note that Windows path names are specified in option files using
+ (forward) slashes rather than backslashes. If you do use
+ backslashes, double them:
+[mysqld]
+# set basedir to your installation path
+basedir=E:\\mysql
+# set datadir to the location of your data directory
+datadir=E:\\mydata\\data
- For more information about these programs, see Section 4.5.6,
- "mysqlshow --- Display Database, Table, and Column Information,"
- and Section 4.5.1, "mysql --- The MySQL Command-Line Tool."
+ The rules for use of backslash in option file values are given in
+ Section 4.2.3.3, "Using Option Files."
- If you are running a version of Windows that supports services and
- you want the MySQL server to run automatically when Windows
- starts, see Section 2.3.11, "Starting MySQL as a Windows Service."
+ MySQL Enterprise For expert advice on the start-up options
+ appropriate to your circumstances, subscribe to the MySQL
+ Enterprise Monitor. For more information, see
+ http://www.mysql.com/products/enterprise/advisors.html.
-2.11.2. Unix Post-Installation Procedures
+ In MySQL 5.1.23 and earlier, the MySQL installer places the data
+ directory directly under the directory where you install MySQL. On
+ MySQL 5.1.24 and later, the data directory is located within the
+ AppData directory for the user running MySQL.
- After installing MySQL on Unix, you need to initialize the grant
- tables, start the server, and make sure that the server works
- satisfactorily. You may also wish to arrange for the server to be
- started and stopped automatically when your system starts and
- stops. You should also assign passwords to the accounts in the
- grant tables.
+ If you would like to use a data directory in a different location,
+ you should copy the entire contents of the data directory to the
+ new location. For example, if you want to use E:\mydata as the
+ data directory instead, you must do two things:
- On Unix, the grant tables are set up by the mysql_install_db
- program. For some installation methods, this program is run for
- you automatically:
+ 1. Move the entire data directory and all of its contents from
+ the default location (for example C:\Program Files\MySQL\MySQL
+ Server 5.1\data) to E:\mydata.
- * If you install MySQL on Linux using RPM distributions, the
- server RPM runs mysql_install_db.
+ 2. Use a --datadir option to specify the new data directory
+ location each time you start the server.
- * If you install MySQL on Mac OS X using a PKG distribution, the
- installer runs mysql_install_db.
+2.5.5.3. Selecting a MySQL Server Type
- Otherwise, you'll need to run mysql_install_db yourself.
+ The following table shows the available servers for Windows in
+ MySQL 5.1.20 and earlier.
+ Binary Description
+ mysqld-nt Optimized binary with named-pipe support
+ mysqld Optimized binary without named-pipe support
+ mysqld-debug Like mysqld-nt, but compiled with full debugging and
+ automatic memory allocation checking
- The following procedure describes how to initialize the grant
- tables (if that has not previously been done) and then start the
- server. It also suggests some commands that you can use to test
- whether the server is accessible and working properly. For
- information about starting and stopping the server automatically,
- see Section 2.11.2.2, "Starting and Stopping MySQL Automatically."
+ The following table shows the available servers for Windows in
+ MySQL 5.1.21 and later.
+ Binary Description
+ mysqld Optimized binary with named-pipe support
+ mysqld-debug Like mysqld, but compiled with full debugging and
+ automatic memory allocation checking
- After you complete the procedure and have the server running, you
- should assign passwords to the accounts created by
- mysql_install_db. Instructions for doing so are given in Section
- 2.11.3, "Securing the Initial MySQL Accounts."
+ All of the preceding binaries are optimized for modern Intel
+ processors, but should work on any Intel i386-class or higher
+ processor.
- In the examples shown here, the server runs under the user ID of
- the mysql login account. This assumes that such an account exists.
- Either create the account if it does not exist, or substitute the
- name of a different existing login account that you plan to use
- for running the server.
+ Each of the servers in a distribution support the same set of
+ storage engines. The SHOW ENGINES statement displays which engines
+ a given server supports.
- 1. Change location into the top-level directory of your MySQL
- installation, represented here by BASEDIR:
-shell> cd BASEDIR
- BASEDIR is likely to be something like /usr/local/mysql or
- /usr/local. The following steps assume that you are located in
- this directory.
+ All Windows MySQL 5.1 servers have support for symbolic linking of
+ database directories.
- 2. If necessary, run the mysql_install_db program to set up the
- initial MySQL grant tables containing the privileges that
- determine how users are allowed to connect to the server.
- You'll need to do this if you used a distribution type for
- which the installation procedure doesn't run the program for
- you.
- Typically, mysql_install_db needs to be run only the first
- time you install MySQL, so you can skip this step if you are
- upgrading an existing installation, However, mysql_install_db
- does not overwrite any existing privilege tables, so it should
- be safe to run in any circumstances.
- To initialize the grant tables, use one of the following
- commands, depending on whether mysql_install_db is located in
- the bin or scripts directory:
-shell> bin/mysql_install_db --user=mysql
-shell> scripts/mysql_install_db --user=mysql
- It might be necessary to specify other options such as
- --basedir or --datadir if mysql_install_db does not use the
- correct locations for the installation directory or data
- directory. For example:
-shell> bin/mysql_install_db --user=mysql \
- --basedir=/opt/mysql/mysql \
- --datadir=/opt/mysql/mysql/data
- The mysql_install_db script creates the server's data
- directory. Under the data directory, it creates directories
- for the mysql database that holds all database privileges and
- the test database that you can use to test MySQL. The script
- also creates privilege table entries for root and
- anonymous-user accounts. The accounts have no passwords
- initially. A description of their initial privileges is given
- in Section 2.11.3, "Securing the Initial MySQL Accounts."
- Briefly, these privileges allow the MySQL root user to do
- anything, and allow anybody to create or use databases with a
- name of test or starting with test_.
- It is important to make sure that the database directories and
- files are owned by the mysql login account so that the server
- has read and write access to them when you run it later. To
- ensure this, the --user option should be used as shown if you
- run mysql_install_db as root. Otherwise, you should execute
- the script while logged in as mysql, in which case you can
- omit the --user option from the command.
- mysql_install_db creates several tables in the mysql database,
- including user, db, host, tables_priv, columns_priv, func, and
- others. See Section 5.4, "The MySQL Access Privilege System,"
- for a complete listing and description of these tables.
- If you don't want to have the test database, you can remove it
- with mysqladmin -u root drop test after starting the server.
- If you have trouble with mysql_install_db at this point, see
- Section 2.11.2.1, "Problems Running mysql_install_db."
+ MySQL supports TCP/IP on all Windows platforms. MySQL servers on
+ Windows support named pipes as indicated in the following list.
+ However, the default is to use TCP/IP regardless of platform.
+ (Named pipes are slower than TCP/IP in many Windows
+ configurations.)
- 3. Start the MySQL server:
-shell> bin/mysqld_safe --user=mysql &
- It is important that the MySQL server be run using an
- unprivileged (non-root) login account. To ensure this, the
- --user option should be used as shown if you run mysqld_safe
- as system root. Otherwise, you should execute the script while
- logged in to the system as mysql, in which case you can omit
- the --user option from the command.
- Further instructions for running MySQL as an unprivileged user
- are given in Section 5.3.5, "How to Run MySQL as a Normal
- User."
- If you neglected to create the grant tables before proceeding
- to this step, the following message appears in the error log
- file when you start the server:
-mysqld: Can't find file: 'host.frm'
- If you have other problems starting the server, see Section
- 2.11.2.3, "Starting and Troubleshooting the MySQL Server."
+ Use of named pipes is subject to these conditions:
- 4. Use mysqladmin to verify that the server is running. The
- following commands provide simple tests to check whether the
- server is up and responding to connections:
-shell> bin/mysqladmin version
-shell> bin/mysqladmin variables
- The output from mysqladmin version varies slightly depending
- on your platform and version of MySQL, but should be similar
- to that shown here:
-shell> bin/mysqladmin version
-mysqladmin Ver 14.12 Distrib 5.1.39, for pc-linux-gnu on i686
-...
+ * Named pipes are enabled only if you start the server with the
+ --enable-named-pipe option. It is necessary to use this option
+ explicitly because some users have experienced problems with
+ shutting down the MySQL server when named pipes were used.
-Server version 5.1.39
-Protocol version 10
-Connection Localhost via UNIX socket
-UNIX socket /var/lib/mysql/mysql.sock
-Uptime: 14 days 5 hours 5 min 21 sec
+ * For MySQL 5.1.20 and earlier, named-pipe connections are
+ allowed only by the mysqld-nt and mysqld-debug servers. For
+ MySQL 5.1.21 and later, the mysqld and mysqld-debug servers
+ both contain support for named-pipe connections.
-Threads: 1 Questions: 366 Slow queries: 0
-Opens: 0 Flush tables: 1 Open tables: 19
-Queries per second avg: 0.000
- To see what else you can do with mysqladmin, invoke it with
- the --help option.
+Note
- 5. Verify that you can shut down the server:
-shell> bin/mysqladmin -u root shutdown
+ Most of the examples in this manual use mysqld as the server name.
+ If you choose to use a different server, such as mysqld-nt or
+ mysqld-debug, make the appropriate substitutions in the commands
+ that are shown in the examples.
- 6. Verify that you can start the server again. Do this by using
- mysqld_safe or by invoking mysqld directly. For example:
-shell> bin/mysqld_safe --user=mysql --log &
- If mysqld_safe fails, see Section 2.11.2.3, "Starting and
- Troubleshooting the MySQL Server."
+2.5.5.4. Starting the Server for the First Time
- 7. Run some simple tests to verify that you can retrieve
- information from the server. The output should be similar to
- what is shown here:
-shell> bin/mysqlshow
-+-----------+
-| Databases |
-+-----------+
-| mysql |
-| test |
-+-----------+
+ This section gives a general overview of starting the MySQL
+ server. The following sections provide more specific information
+ for starting the MySQL server from the command line or as a
+ Windows service.
-shell> bin/mysqlshow mysql
-Database: mysql
-+---------------------------+
-| Tables |
-+---------------------------+
-| columns_priv |
-| db |
-| func |
-| help_category |
-| help_keyword |
-| help_relation |
-| help_topic |
-| host |
-| proc |
-| procs_priv |
-| tables_priv |
-| time_zone |
-| time_zone_leap_second |
-| time_zone_name |
-| time_zone_transition |
-| time_zone_transition_type |
-| user |
-+---------------------------+
+ The information here applies primarily if you installed MySQL
+ using the Noinstall version, or if you wish to configure and test
+ MySQL manually rather than with the GUI tools.
-shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
-+------+--------+------+
-| host | db | user |
-+------+--------+------+
-| % | test | |
-| % | test_% | |
-+------+--------+------+
+ The examples in these sections assume that MySQL is installed
+ under the default location of C:\Program Files\MySQL\MySQL Server
+ 5.1. Adjust the path names shown in the examples if you have MySQL
+ installed in a different location.
- 8. There is a benchmark suite in the sql-bench directory (under
- the MySQL installation directory) that you can use to compare
- how MySQL performs on different platforms. The benchmark suite
- is written in Perl. It requires the Perl DBI module that
- provides a database-independent interface to the various
- databases, and some other additional Perl modules:
-DBI
-DBD::mysql
-Data::Dumper
-Data::ShowTable
- These modules can be obtained from CPAN
- (http://www.cpan.org/) See also Section 2.15.1, "Installing
- Perl on Unix."
- The sql-bench/Results directory contains the results from many
- runs against different databases and platforms. To run all
- tests, execute these commands:
-shell> cd sql-bench
-shell> perl run-all-tests
- If you don't have the sql-bench directory, you probably
- installed MySQL using RPM files other than the source RPM.
- (The source RPM includes the sql-bench benchmark directory.)
- In this case, you must first install the benchmark suite
- before you can use it. There are separate benchmark RPM files
- named mysql-bench-VERSION.i386.rpm that contain benchmark code
- and data.
- If you have a source distribution, there are also tests in its
- tests subdirectory that you can run. For example, to run
- auto_increment.tst, execute this command from the top-level
- directory of your source distribution:
-shell> mysql -vvf test < ./tests/auto_increment.tst
- The expected result of the test can be found in the
- ./tests/auto_increment.res file.
+ Clients have two options. They can use TCP/IP, or they can use a
+ named pipe if the server supports named-pipe connections.
- 9. At this point, you should have the server running. However,
- none of the initial MySQL accounts have a password, so you
- should assign passwords using the instructions found in
- Section 2.11.3, "Securing the Initial MySQL Accounts."
+ MySQL for Windows also supports shared-memory connections if the
+ server is started with the --shared-memory option. Clients can
+ connect through shared memory by using the --protocol=MEMORY
+ option.
- The MySQL 5.1 installation procedure creates time zone tables in
- the mysql database. However, you must populate the tables manually
- using the instructions in Section 9.7, "MySQL Server Time Zone
- Support."
+ For information about which server binary to run, see Section
+ 2.5.5.3, "Selecting a MySQL Server Type."
-2.11.2.1. Problems Running mysql_install_db
+ Testing is best done from a command prompt in a console window (or
+ "DOS window"). In this way you can have the server display status
+ messages in the window where they are easy to see. If something is
+ wrong with your configuration, these messages make it easier for
+ you to identify and fix any problems.
- The purpose of the mysql_install_db script is to generate new
- MySQL privilege tables. It does not overwrite existing MySQL
- privilege tables, and it does not affect any other data.
+ To start the server, enter this command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
- If you want to re-create your privilege tables, first stop the
- mysqld server if it is running. Then rename the mysql directory
- under the data directory to save it, and then run
- mysql_install_db. Suppose that your current directory is the MySQL
- installation directory and that mysql_install_db is located in the
- bin directory and the data directory is named data. To rename the
- mysql database and re-run mysql_install_db, use these commands.
-shell> mv data/mysql data/mysql.old
-shell> bin/mysql_install_db --user=mysql
+ For a server that includes InnoDB support, you should see the
+ messages similar to those following as it starts (the path names
+ and sizes may differ):
+InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
+InnoDB: a new database to be created!
+InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
+InnoDB: Database physically writes the file full: wait...
+InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat
+ed
+InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
+InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat
+ed
+InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
+InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat
+ed
+InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
+InnoDB: Doublewrite buffer not found: creating new
+InnoDB: Doublewrite buffer created
+InnoDB: creating foreign key constraint system tables
+InnoDB: foreign key constraint system tables created
+011024 10:58:25 InnoDB: Started
- When you run mysql_install_db, you might encounter the following
- problems:
+ When the server finishes its startup sequence, you should see
+ something like this, which indicates that the server is ready to
+ service client connections:
+mysqld: ready for connections
+Version: '5.1.41' socket: '' port: 3306
- * mysql_install_db fails to install the grant tables
- You may find that mysql_install_db fails to install the grant
- tables and terminates after displaying the following messages:
-Starting mysqld daemon with databases from XXXXXX
-mysqld ended
- In this case, you should examine the error log file very
- carefully. The log should be located in the directory XXXXXX
- named by the error message and should indicate why mysqld
- didn't start. If you do not understand what happened, include
- the log when you post a bug report. See Section 1.6, "How to
- Report Bugs or Problems."
+ The server continues to write to the console any further
+ diagnostic output it produces. You can open a new console window
+ in which to run client programs.
- * There is a mysqld process running
- This indicates that the server is running, in which case the
- grant tables have probably been created already. If so, there
- is no need to run mysql_install_db at all because it needs to
- be run only once (when you install MySQL the first time).
+ If you omit the --console option, the server writes diagnostic
+ output to the error log in the data directory (C:\Program
+ Files\MySQL\MySQL Server 5.1\data by default). The error log is
+ the file with the .err extension.
- * Installing a second mysqld server does not work when one
- server is running
- This can happen when you have an existing MySQL installation,
- but want to put a new installation in a different location.
- For example, you might have a production installation, but you
- want to create a second installation for testing purposes.
- Generally the problem that occurs when you try to run a second
- server is that it tries to use a network interface that is in
- use by the first server. In this case, you should see one of
- the following error messages:
-Can't start server: Bind on TCP/IP port:
-Address already in use
-Can't start server: Bind on unix socket...
- For instructions on setting up multiple servers, see Section
- 5.6, "Running Multiple MySQL Servers on the Same Machine."
+Note
- * You do not have write access to the /tmp directory
- If you do not have write access to create temporary files or a
- Unix socket file in the default location (the /tmp directory),
- an error occurs when you run mysql_install_db or the mysqld
- server.
- You can specify different locations for the temporary
- directory and Unix socket file by executing these commands
- prior to starting mysql_install_db or mysqld, where
- some_tmp_dir is the full path name to some directory for which
- you have write permission:
-shell> TMPDIR=/some_tmp_dir/
-shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock
-shell> export TMPDIR MYSQL_UNIX_PORT
- Then you should be able to run mysql_install_db and start the
- server with these commands:
-shell> bin/mysql_install_db --user=mysql
-shell> bin/mysqld_safe --user=mysql &
- If mysql_install_db is located in the scripts directory,
- modify the first command to scripts/mysql_install_db.
- See Section B.1.4.5, "How to Protect or Change the MySQL Unix
- Socket File," and Section 2.14, "Environment Variables."
+ The accounts that are listed in the MySQL grant tables initially
+ have no passwords. After starting the server, you should set up
+ passwords for them using the instructions in Section 2.13,
+ "Post-Installation Setup and Testing."
- There are some alternatives to running the mysql_install_db script
- provided in the MySQL distribution:
+2.5.5.5. Starting MySQL from the Windows Command Line
- * If you want the initial privileges to be different from the
- standard defaults, you can modify mysql_install_db before you
- run it. However, it is preferable to use GRANT and REVOKE to
- change the privileges after the grant tables have been set up.
- In other words, you can run mysql_install_db, and then use
- mysql -u root mysql to connect to the server as the MySQL root
- user so that you can issue the necessary GRANT and REVOKE
- statements.
- If you want to install MySQL on several machines with the same
- privileges, you can put the GRANT and REVOKE statements in a
- file and execute the file as a script using mysql after
- running mysql_install_db. For example:
-shell> bin/mysql_install_db --user=mysql
-shell> bin/mysql -u root < your_script_file
- By doing this, you can avoid having to issue the statements
- manually on each machine.
+ The MySQL server can be started manually from the command line.
+ This can be done on any version of Windows.
- * It is possible to re-create the grant tables completely after
- they have previously been created. You might want to do this
- if you're just learning how to use GRANT and REVOKE and have
- made so many modifications after running mysql_install_db that
- you want to wipe out the tables and start over.
- To re-create the grant tables, remove all the .frm, .MYI, and
- .MYD files in the mysql database directory. Then run the
- mysql_install_db script again.
+ To start the mysqld server from the command line, you should start
+ a console window (or "DOS window") and enter this command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
- * You can start mysqld manually using the --skip-grant-tables
- option and add the privilege information yourself using mysql:
-shell> bin/mysqld_safe --user=mysql --skip-grant-tables &
-shell> bin/mysql mysql
- From mysql, manually execute the SQL commands contained in
- mysql_install_db. Make sure that you run mysqladmin
- flush-privileges or mysqladmin reload afterward to tell the
- server to reload the grant tables.
- Note that by not using mysql_install_db, you not only have to
- populate the grant tables manually, you also have to create
- them first.
+ The path to mysqld may vary depending on the install location of
+ MySQL on your system.
-2.11.2.2. Starting and Stopping MySQL Automatically
+ You can stop the MySQL server by executing this command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
+ shutdown
- Generally, you start the mysqld server in one of these ways:
+Note
- * Invoke mysqld directly. This works on any platform.
+ If the MySQL root user account has a password, you need to invoke
+ mysqladmin with the -p option and supply the password when
+ prompted.
- * Run the MySQL server as a Windows service. The service can be
- set to start the server automatically when Windows starts, or
- as a manual service that you start on request. For
- instructions, see Section 2.3.11, "Starting MySQL as a Windows
- Service."
+ This command invokes the MySQL administrative utility mysqladmin
+ to connect to the server and tell it to shut down. The command
+ connects as the MySQL root user, which is the default
+ administrative account in the MySQL grant system. Note that users
+ in the MySQL grant system are wholly independent from any login
+ users under Windows.
- * Invoke mysqld_safe, which tries to determine the proper
- options for mysqld and then runs it with those options. This
- script is used on Unix and Unix-like systems. See Section
- 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
+ If mysqld doesn't start, check the error log to see whether the
+ server wrote any messages there to indicate the cause of the
+ problem. The error log is located in the C:\Program
+ Files\MySQL\MySQL Server 5.1\data directory. It is the file with a
+ suffix of .err. You can also try to start the server as mysqld
+ --console; in this case, you may get some useful information on
+ the screen that may help solve the problem.
- * Invoke mysql.server. This script is used primarily at system
- startup and shutdown on systems that use System V-style run
- directories, where it usually is installed under the name
- mysql. The mysql.server script starts the server by invoking
- mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server
- Startup Script."
+ The last option is to start mysqld with the --standalone and
+ --debug options. In this case, mysqld writes a log file
+ C:\mysqld.trace that should contain the reason why mysqld doesn't
+ start. See MySQL Internals: Porting
+ (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
- * On Mac OS X, install a separate MySQL Startup Item package to
- enable the automatic startup of MySQL on system startup. The
- Startup Item starts the server by invoking mysql.server. See
- Section 2.5, "Installing MySQL on Mac OS X," for details.
+ Use mysqld --verbose --help to display all the options that mysqld
+ supports.
- The mysqld_safe and mysql.server scripts and the Mac OS X Startup
- Item can be used to start the server manually, or automatically at
- system startup time. mysql.server and the Startup Item also can be
- used to stop the server.
+2.5.5.6. Starting MySQL as a Windows Service
- To start or stop the server manually using the mysql.server
- script, invoke it with start or stop arguments:
-shell> mysql.server start
-shell> mysql.server stop
+ On Windows, the recommended way to run MySQL is to install it as a
+ Windows service, whereby MySQL starts and stops automatically when
+ Windows starts and stops. A MySQL server installed as a service
+ can also be controlled from the command line using NET commands,
+ or with the graphical Services utility. Generally, to install
+ MySQL as a Windows service you should be logged in using an
+ account that has administrator rights.
- Before mysql.server starts the server, it changes location to the
- MySQL installation directory, and then invokes mysqld_safe. If you
- want the server to run as some specific user, add an appropriate
- user option to the [mysqld] group of the /etc/my.cnf option file,
- as shown later in this section. (It is possible that you will need
- to edit mysql.server if you've installed a binary distribution of
- MySQL in a nonstandard location. Modify it to change location into
- the proper directory before it runs mysqld_safe. If you do this,
- your modified version of mysql.server may be overwritten if you
- upgrade MySQL in the future, so you should make a copy of your
- edited version that you can reinstall.)
+ The Services utility (the Windows Service Control Manager) can be
+ found in the Windows Control Panel (under Administrative Tools on
+ Windows 2000, XP, Vista and Server 2003). To avoid conflicts, it
+ is advisable to close the Services utility while performing server
+ installation or removal operations from the command line.
- mysql.server stop stops the server by sending a signal to it. You
- can also stop the server manually by executing mysqladmin
- shutdown.
+ Before installing MySQL as a Windows service, you should first
+ stop the current server if it is running by using the following
+ command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
+ -u root shutdown
- To start and stop MySQL automatically on your server, you need to
- add start and stop commands to the appropriate places in your
- /etc/rc* files.
+Note
- If you use the Linux server RPM package
- (MySQL-server-VERSION.rpm), the mysql.server script is installed
- in the /etc/init.d directory with the name mysql. You need not
- install it manually. See Section 2.4, "Installing MySQL from RPM
- Packages on Linux," for more information on the Linux RPM
- packages.
+ If the MySQL root user account has a password, you need to invoke
+ mysqladmin with the -p option and supply the password when
+ prompted.
- Some vendors provide RPM packages that install a startup script
- under a different name such as mysqld.
+ This command invokes the MySQL administrative utility mysqladmin
+ to connect to the server and tell it to shut down. The command
+ connects as the MySQL root user, which is the default
+ administrative account in the MySQL grant system. Note that users
+ in the MySQL grant system are wholly independent from any login
+ users under Windows.
- If you install MySQL from a source distribution or using a binary
- distribution format that does not install mysql.server
- automatically, you can install it manually. The script can be
- found in the support-files directory under the MySQL installation
- directory or in a MySQL source tree.
+ Install the server as a service using this command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
- To install mysql.server manually, copy it to the /etc/init.d
- directory with the name mysql, and then make it executable. Do
- this by changing location into the appropriate directory where
- mysql.server is located and executing these commands:
-shell> cp mysql.server /etc/init.d/mysql
-shell> chmod +x /etc/init.d/mysql
+ The service-installation command does not start the server.
+ Instructions for that are given later in this section.
- Older Red Hat systems use the /etc/rc.d/init.d directory rather
- than /etc/init.d. Adjust the preceding commands accordingly.
- Alternatively, first create /etc/init.d as a symbolic link that
- points to /etc/rc.d/init.d:
-shell> cd /etc
-shell> ln -s rc.d/init.d .
+ To make it easier to invoke MySQL programs, you can add the path
+ name of the MySQL bin directory to your Windows system PATH
+ environment variable:
- After installing the script, the commands needed to activate it to
- run at system startup depend on your operating system. On Linux,
- you can use chkconfig:
-shell> chkconfig --add mysql
+ * On the Windows desktop, right-click on the My Computer icon,
+ and select Properties.
- On some Linux systems, the following command also seems to be
- necessary to fully enable the mysql script:
-shell> chkconfig --level 345 mysql on
+ * Next select the Advanced tab from the System Properties menu
+ that appears, and click the Environment Variables button.
- On FreeBSD, startup scripts generally should go in
- /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in
- this directory are executed only if their basename matches the
- *.sh shell file name pattern. Any other files or directories
- present within the directory are silently ignored. In other words,
- on FreeBSD, you should install the mysql.server script as
- /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup.
+ * Under System Variables, select Path, and then click the Edit
+ button. The Edit System Variable dialogue should appear.
- As an alternative to the preceding setup, some operating systems
- also use /etc/rc.local or /etc/init.d/boot.local to start
- additional services on startup. To start up MySQL using this
- method, you could append a command like the one following to the
- appropriate startup file:
-/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
+ * Place your cursor at the end of the text appearing in the
+ space marked Variable Value. (Use the End key to ensure that
+ your cursor is positioned at the very end of the text in this
+ space.) Then enter the complete path name of your MySQL bin
+ directory (for example, C:\Program Files\MySQL\MySQL Server
+ 5.1\bin), Note that there should be a semicolon separating
+ this path from any values present in this field. Dismiss this
+ dialogue, and each dialogue in turn, by clicking OK until all
+ of the dialogues that were opened have been dismissed. You
+ should now be able to invoke any MySQL executable program by
+ typing its name at the DOS prompt from any directory on the
+ system, without having to supply the path. This includes the
+ servers, the mysql client, and all MySQL command-line
+ utilities such as mysqladmin and mysqldump.
+ You should not add the MySQL bin directory to your Windows
+ PATH if you are running multiple MySQL servers on the same
+ machine.
- For other systems, consult your operating system documentation to
- see how to install startup scripts.
+Warning
- You can add options for mysql.server in a global /etc/my.cnf file.
- A typical /etc/my.cnf file might look like this:
-[mysqld]
-datadir=/usr/local/mysql/var
-socket=/var/tmp/mysql.sock
-port=3306
-user=mysql
+ You must exercise great care when editing your system PATH by
+ hand; accidental deletion or modification of any portion of the
+ existing PATH value can leave you with a malfunctioning or even
+ unusable system.
-[mysql.server]
-basedir=/usr/local/mysql
+ The following additional arguments can be used in MySQL 5.1 when
+ installing the service:
- The mysql.server script supports the following options: basedir,
- datadir, and pid-file. If specified, they must be placed in an
- option file, not on the command line. mysql.server supports only
- start and stop as command-line arguments.
+ * You can specify a service name immediately following the
+ --install option. The default service name is MySQL.
- The following table shows which option groups the server and each
- startup script read from option files.
- Script Option Groups
- mysqld [mysqld], [server], [mysqld-major_version]
- mysqld_safe [mysqld], [server], [mysqld_safe]
- mysql.server [mysqld], [mysql.server], [server]
+ * If a service name is given, it can be followed by a single
+ option. By convention, this should be
+ --defaults-file=file_name to specify the name of an option
+ file from which the server should read options when it starts.
+ The use of a single option other than --defaults-file is
+ possible but discouraged. --defaults-file is more flexible
+ because it enables you to specify multiple startup options for
+ the server by placing them in the named option file.
- [mysqld-major_version] means that groups with names like
- [mysqld-5.0] and [mysqld-5.1] are read by servers having versions
- 5.0.x, 5.1.x, and so forth. This feature can be used to specify
- options that can be read only by servers within a given release
- series.
+ * You can also specify a --local-service option following the
+ service name. This causes the server to run using the
+ LocalService Windows account that has limited system
+ privileges. This account is available only for Windows XP or
+ newer. If both --defaults-file and --local-service are given
+ following the service name, they can be in any order.
- For backward compatibility, mysql.server also reads the
- [mysql_server] group and mysqld_safe also reads the [safe_mysqld]
- group. However, you should update your option files to use the
- [mysql.server] and [mysqld_safe] groups instead when using MySQL
- 5.1.
+ For a MySQL server that is installed as a Windows service, the
+ following rules determine the service name and option files that
+ the server uses:
- See Section 4.2.3.3, "Using Option Files."
+ * If the service-installation command specifies no service name
+ or the default service name (MySQL) following the --install
+ option, the server uses the a service name of MySQL and reads
+ options from the [mysqld] group in the standard option files.
-2.11.2.3. Starting and Troubleshooting the MySQL Server
+ * If the service-installation command specifies a service name
+ other than MySQL following the --install option, the server
+ uses that service name. It reads options from the [mysqld]
+ group and the group that has the same name as the service in
+ the standard option files. This allows you to use the [mysqld]
+ group for options that should be used by all MySQL services,
+ and an option group with the service name for use by the
+ server installed with that service name.
- This section provides troubleshooting suggestions for problems
- starting the server on Unix. If you are using Windows, see Section
- 2.3.13, "Troubleshooting a MySQL Installation Under Windows."
+ * If the service-installation command specifies a
+ --defaults-file option after the service name, the server
+ reads options only from the [mysqld] group of the named file
+ and ignores the standard option files.
- If you have problems starting the server, here are some things to
- try:
+ As a more complex example, consider the following command:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
+ --install MySQL --defaults-file=C:\my-opts.cnf
- * Check the error log to see why the server does not start.
+ Here, the default service name (MySQL) is given after the
+ --install option. If no --defaults-file option had been given,
+ this command would have the effect of causing the server to read
+ the [mysqld] group from the standard option files. However,
+ because the --defaults-file option is present, the server reads
+ options from the [mysqld] option group, and only from the named
+ file.
- * Specify any special options needed by the storage engines you
- are using.
+ You can also specify options as Start parameters in the Windows
+ Services utility before you start the MySQL service.
- * Make sure that the server knows where to find the data
- directory.
+ Once a MySQL server has been installed as a service, Windows
+ starts the service automatically whenever Windows starts. The
+ service also can be started immediately from the Services utility,
+ or by using a NET START MySQL command. The NET command is not case
+ sensitive.
- * Make sure that the server can access the data directory. The
- ownership and permissions of the data directory and its
- contents must be set such that the server can read and modify
- them.
+ When run as a service, mysqld has no access to a console window,
+ so no messages can be seen there. If mysqld does not start, check
+ the error log to see whether the server wrote any messages there
+ to indicate the cause of the problem. The error log is located in
+ the MySQL data directory (for example, C:\Program
+ Files\MySQL\MySQL Server 5.1\data). It is the file with a suffix
+ of .err.
- * Verify that the network interfaces the server wants to use are
- available.
+ When a MySQL server has been installed as a service, and the
+ service is running, Windows stops the service automatically when
+ Windows shuts down. The server also can be stopped manually by
+ using the Services utility, the NET STOP MySQL command, or the
+ mysqladmin shutdown command.
- Some storage engines have options that control their behavior. You
- can create a my.cnf file and specify startup options for the
- engines that you plan to use. If you are going to use storage
- engines that support transactional tables (InnoDB, NDB), be sure
- that you have them configured the way you want before starting the
- server:
+ You also have the choice of installing the server as a manual
+ service if you do not wish for the service to be started
+ automatically during the boot process. To do this, use the
+ --install-manual option rather than the --install option:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install-m
+anual
- * If you are using InnoDB tables, see Section 13.6.2, "InnoDB
- Configuration."
+ To remove a server that is installed as a service, first stop it
+ if it is running by executing NET STOP MySQL. Then use the
+ --remove option to remove it:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove
- * If you are using MySQL Cluster, see Section 17.3, "MySQL
- Cluster Configuration."
+ If mysqld is not running as a service, you can start it from the
+ command line. For instructions, see Section 2.5.5.5, "Starting
+ MySQL from the Windows Command Line."
- MySQL Enterprise For expert advice on start-up options appropriate
- to your circumstances, subscribe to The MySQL Enterprise Monitor.
- For more information, see
- http://www.mysql.com/products/enterprise/advisors.html.
+ Please see Section 2.5.6, "Troubleshooting a MySQL Installation
+ Under Windows," if you encounter difficulties during installation.
- Storage engines will use default option values if you specify
- none, but it is recommended that you review the available options
- and specify explicit values for those for which the defaults are
- not appropriate for your installation.
+2.5.5.7. Testing The MySQL Installation
- When the mysqld server starts, it changes location to the data
- directory. This is where it expects to find databases and where it
- expects to write log files. The server also writes the pid
- (process ID) file in the data directory.
+ You can test whether the MySQL server is working by executing any
+ of the following commands:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow"
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -u root
+mysql
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" version
+ status proc
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test
- The data directory location is hardwired in when the server is
- compiled. This is where the server looks for the data directory by
- default. If the data directory is located somewhere else on your
- system, the server will not work properly. You can determine what
- the default path settings are by invoking mysqld with the
- --verbose and --help options.
+Note
- If the default locations don't match the MySQL installation layout
- on your system, you can override them by specifying options to
- mysqld or mysqld_safe on the command line or in an option file.
+ By default, mysqlshow will try to connect using the ODBC user.
+ This user is not created by default. You should specify a valid
+ user, or root with the right password to check the operation of
+ the server.
- To specify the location of the data directory explicitly, use the
- --datadir option. However, normally you can tell mysqld the
- location of the base directory under which MySQL is installed and
- it looks for the data directory there. You can do this with the
- --basedir option.
+ If mysqld is slow to respond to TCP/IP connections from client
+ programs, there is probably a problem with your DNS. In this case,
+ start mysqld with the --skip-name-resolve option and use only
+ localhost and IP numbers in the Host column of the MySQL grant
+ tables.
- To check the effect of specifying path options, invoke mysqld with
- those options followed by the --verbose and --help options. For
- example, if you change location into the directory where mysqld is
- installed and then run the following command, it shows the effect
- of starting the server with a base directory of /usr/local:
-shell> ./mysqld --basedir=/usr/local --verbose --help
+ You can force a MySQL client to use a named-pipe connection rather
+ than TCP/IP by specifying the --pipe or --protocol=PIPE option, or
+ by specifying . (period) as the host name. Use the --socket option
+ to specify the name of the pipe if you do not want to use the
+ default pipe name.
- You can specify other options such as --datadir as well, but
- --verbose and --help must be the last options.
+ Note that if you have set a password for the root account, deleted
+ the anonymous account, or created a new user account, then you
+ must use the appropriate -u and -p options with the commands shown
+ above in order to connect with the MySQL Server. See Section
+ 4.2.2, "Connecting to the MySQL Server."
- Once you determine the path settings you want, start the server
- without --verbose and --help.
+ For more information about mysqlshow, see Section 4.5.6,
+ "mysqlshow --- Display Database, Table, and Column Information."
- If mysqld is currently running, you can find out what path
- settings it is using by executing this command:
-shell> mysqladmin variables
+2.5.6. Troubleshooting a MySQL Installation Under Windows
- Or:
-shell> mysqladmin -h host_name variables
+ When installing and running MySQL for the first time, you may
+ encounter certain errors that prevent the MySQL server from
+ starting. The purpose of this section is to help you diagnose and
+ correct some of these errors.
- host_name is the name of the MySQL server host.
+ Your first resource when troubleshooting server issues is the
+ error log. The MySQL server uses the error log to record
+ information relevant to the error that prevents the server from
+ starting. The error log is located in the data directory specified
+ in your my.ini file. The default data directory location is
+ C:\Program Files\MySQL\MySQL Server 5.1\data. See Section 5.2.2,
+ "The Error Log."
- If you get Errcode 13 (which means Permission denied) when
- starting mysqld, this means that the privileges of the data
- directory or its contents do not allow the server access. In this
- case, you change the permissions for the involved files and
- directories so that the server has the right to use them. You can
- also start the server as root, but this raises security issues and
- should be avoided.
+ Another source of information regarding possible errors is the
+ console messages displayed when the MySQL service is starting. Use
+ the NET START MySQL command from the command line after installing
+ mysqld as a service to see any error messages regarding the
+ starting of the MySQL server as a service. See Section 2.5.5.6,
+ "Starting MySQL as a Windows Service."
+
+ The following examples show other common error messages you may
+ encounter when installing MySQL and starting the server for the
+ first time:
- On Unix, change location into the data directory and check the
- ownership of the data directory and its contents to make sure the
- server has access. For example, if the data directory is
- /usr/local/mysql/var, use this command:
-shell> ls -la /usr/local/mysql/var
+ * If the MySQL server cannot find the mysql privileges database
+ or other critical files, you may see these messages:
+System error 1067 has occurred.
+Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't
+exist
+ These messages often occur when the MySQL base or data
+ directories are installed in different locations than the
+ default locations (C:\Program Files\MySQL\MySQL Server 5.1 and
+ C:\Program Files\MySQL\MySQL Server 5.1\data, respectively).
+ This situation may occur when MySQL is upgraded and installed
+ to a new location, but the configuration file is not updated
+ to reflect the new location. In addition, there may be old and
+ new configuration files that conflict. Be sure to delete or
+ rename any old configuration files when upgrading MySQL.
+ If you have installed MySQL to a directory other than
+ C:\Program Files\MySQL\MySQL Server 5.1, you need to ensure
+ that the MySQL server is aware of this through the use of a
+ configuration (my.ini) file. The my.ini file needs to be
+ located in your Windows directory, typically C:\WINDOWS. You
+ can determine its exact location from the value of the WINDIR
+ environment variable by issuing the following command from the
+ command prompt:
+C:\> echo %WINDIR%
+ An option file can be created and modified with any text
+ editor, such as Notepad. For example, if MySQL is installed in
+ E:\mysql and the data directory is D:\MySQLdata, you can
+ create the option file and set up a [mysqld] section to
+ specify values for the basedir and datadir options:
+[mysqld]
+# set basedir to your installation path
+basedir=E:/mysql
+# set datadir to the location of your data directory
+datadir=D:/MySQLdata
+ Note that Windows path names are specified in option files
+ using (forward) slashes rather than backslashes. If you do use
+ backslashes, double them:
+[mysqld]
+# set basedir to your installation path
+basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1
+# set datadir to the location of your data directory
+datadir=D:\\MySQLdata
+ The rules for use of backslash in option file values are given
+ in Section 4.2.3.3, "Using Option Files."
+ If you change the datadir value in your MySQL configuration
+ file, you must move the contents of the existing MySQL data
+ directory before restarting the MySQL server.
+ See Section 2.5.5.2, "Creating an Option File."
- If the data directory or its files or subdirectories are not owned
- by the login account that you use for running the server, change
- their ownership to that account. If the account is named mysql,
- use these commands:
-shell> chown -R mysql /usr/local/mysql/var
-shell> chgrp -R mysql /usr/local/mysql/var
+ * If you reinstall or upgrade MySQL without first stopping and
+ removing the existing MySQL service and install MySQL using
+ the MySQL Config Wizard, you may see this error:
+Error: Cannot create Windows service for MySql. Error: 0
+ This occurs when the Config Wizard tries to install the
+ service and finds an existing service with the same name.
+ One solution to this problem is to choose a service name other
+ than mysql when using the configuration wizard. This allows
+ the new service to be installed correctly, but leaves the
+ outdated service in place. Although this is harmless, it is
+ best to remove old services that are no longer in use.
+ To permanently remove the old mysql service, execute the
+ following command as a user with administrative privileges, on
+ the command-line:
+C:\> sc delete mysql
+[SC] DeleteService SUCCESS
+ If the sc utility is not available for your version of
+ Windows, download the delsrv utility from
+ http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi
+ sting/delsrv-o.asp and use the delsrv mysql syntax.
- If the server fails to start up correctly, check the error log.
- Log files are located in the data directory (typically C:\Program
- Files\MySQL\MySQL Server 5.1\data on Windows,
- /usr/local/mysql/data for a Unix binary distribution, and
- /usr/local/var for a Unix source distribution). Look in the data
- directory for files with names of the form host_name.err and
- host_name.log, where host_name is the name of your server host.
- Then examine the last few lines of these files. On Unix, you can
- use tail to display them:
-shell> tail host_name.err
-shell> tail host_name.log
+2.5.7. Upgrading MySQL on Windows
- The error log should contain information that indicates why the
- server couldn't start.
+ This section lists some of the steps you should take when
+ upgrading MySQL on Windows.
- If either of the following errors occur, it means that some other
- program (perhaps another mysqld server) is using the TCP/IP port
- or Unix socket file that mysqld is trying to use:
-Can't start server: Bind on TCP/IP port: Address already in use
-Can't start server: Bind on unix socket...
+ 1. Review Section 2.4.1, "Upgrading MySQL," for additional
+ information on upgrading MySQL that is not specific to
+ Windows.
- Use ps to determine whether you have another mysqld server
- running. If so, shut down the server before starting mysqld again.
- (If another server is running, and you really want to run multiple
- servers, you can find information about how to do so in Section
- 5.6, "Running Multiple MySQL Servers on the Same Machine.")
+ 2. You should always back up your current MySQL installation
+ before performing an upgrade. See Section 6.1, "Database
+ Backup Methods."
- If no other server is running, try to execute the command telnet
- your_host_name tcp_ip_port_number. (The default MySQL port number
- is 3306.) Then press Enter a couple of times. If you don't get an
- error message like telnet: Unable to connect to remote host:
- Connection refused, some other program is using the TCP/IP port
- that mysqld is trying to use. You'll need to track down what
- program this is and disable it, or else tell mysqld to listen to a
- different port with the --port option. In this case, you'll also
- need to specify the port number for client programs when
- connecting to the server via TCP/IP.
+ 3. Download the latest Windows distribution of MySQL from
+ http://dev.mysql.com/downloads/.
- Another reason the port might be inaccessible is that you have a
- firewall running that blocks connections to it. If so, modify the
- firewall settings to allow access to the port.
+ 4. Before upgrading MySQL, you must stop the server. If the
+ server is installed as a service, stop the service with the
+ following command from the command prompt:
+C:\> NET STOP MySQL
+ If you are not running the MySQL server as a service, use the
+ following command to stop it:
+C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
+ shutdown
- If the server starts but you can't connect to it, you should make
- sure that you have an entry in /etc/hosts that looks like this:
-127.0.0.1 localhost
+Note
+ If the MySQL root user account has a password, you need to
+ invoke mysqladmin with the -p option and supply the password
+ when prompted.
- This problem occurs only on systems that do not have a working
- thread library and for which MySQL must be configured to use
- MIT-pthreads.
+ 5. When upgrading to MySQL 5.1 from a version previous to 4.1.5,
+ or when upgrading from a version of MySQL installed from a Zip
+ archive to a version of MySQL installed with the MySQL
+ Installation Wizard, you must manually remove the previous
+ installation and MySQL service (if the server is installed as
+ a service).
+ To remove the MySQL service, use the following command:
+C:\> C:\mysql\bin\mysqld --remove
+ If you do not remove the existing service, the MySQL
+ Installation Wizard may fail to properly install the new MySQL
+ service.
- If you cannot get mysqld to start, you can try to make a trace
- file to find the problem by using the --debug option. See MySQL
- Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
+ 6. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change
+ in the default location of the data directory from a directory
+ within the MySQL installation to the AppData folder means that
+ you must manually copy the data files from your old
+ installation to the new location.
-2.11.3. Securing the Initial MySQL Accounts
+ 7. If you are using the MySQL Installation Wizard, start the
+ wizard as described in Section 2.5.3.1, "Using the MySQL
+ Installation Wizard."
- Part of the MySQL installation process is to set up the mysql
- database that contains the grant tables:
+ 8. If you are installing MySQL from a Zip archive, extract the
+ archive. You may either overwrite your existing MySQL
+ installation (usually located at C:\mysql), or install it into
+ a different directory, such as C:\mysql5. Overwriting the
+ existing installation is recommended.
- * Windows distributions contain preinitialized grant tables that
- are installed automatically.
+ 9. If you were running MySQL as a Windows service and you had to
+ remove the service earlier in this procedure, reinstall the
+ service. (See Section 2.5.5.6, "Starting MySQL as a Windows
+ Service.")
+ 10. Restart the server. For example, use NET START MySQL if you
+ run MySQL as a service, or invoke mysqld directly otherwise.
+ 11. If you encounter errors, see Section 2.5.6, "Troubleshooting a
+ MySQL Installation Under Windows."
- * On Unix, the grant tables are populated by the
- mysql_install_db program. Some installation methods run this
- program for you. Others require that you execute it manually.
- For details, see Section 2.11.2, "Unix Post-Installation
- Procedures."
+2.5.8. Windows Post-Installation Procedures
- The grant tables define the initial MySQL user accounts and their
- access privileges. These accounts are set up as follows:
+ On Windows, the data directory and the grant tables do not have to
+ be created. MySQL Windows distributions include the grant tables
+ with a set of preinitialized accounts in the mysql database under
+ the data directory. It is unnecessary to run the mysql_install_db
+ script that is used on Unix. Regarding passwords, if you installed
+ MySQL using the Windows Installation Wizard, you may have already
+ assigned passwords to the accounts. (See Section 2.5.3.1, "Using
+ the MySQL Installation Wizard.") Otherwise, use the
+ password-assignment procedure given in Section 2.13.2, "Securing
+ the Initial MySQL Accounts."
- * Accounts with the user name root are created. These are
- superuser accounts that can do anything. The initial root
- account passwords are empty, so anyone can connect to the
- MySQL server as root --- without a password --- and be granted
- all privileges.
+ Before setting up passwords, you might want to try running some
+ client programs to make sure that you can connect to the server
+ and that it is operating properly. Make sure that the server is
+ running (see Section 2.5.5.4, "Starting the Server for the First
+ Time"), and then issue the following commands to verify that you
+ can retrieve information from the server. The output should be
+ similar to what is shown here:
+C:\> C:\mysql\bin\mysqlshow
++--------------------+
+| Databases |
++--------------------+
+| information_schema |
+| mysql |
+| test |
++--------------------+
- + On Windows, one root account is created; this account
- allows connecting from the local host only. The Windows
- installer will optionally create an account allowing for
- connections from any host only if the user selects the
- Enable root access from remote machines option during
- installation.
+Note
- + On Unix, both root accounts are for connections from the
- local host. Connections must be made from the local host
- by specifying a host name of localhost for one of the
- accounts, or the actual host name or IP number for the
- other.
+ The above may not work if the correct user does not exist. If you
+ installed using the MSI packages and used the MySQL Server
+ Instance Config Wizard, then the root will haqve been created
+ automatically with the password you supplied. In this case, you
+ should use the -u and -p options where you will be prompted for
+ the password.
- * Two anonymous-user accounts are created, each with an empty
- user name. The anonymous accounts have no password, so anyone
- can use them to connect to the MySQL server.
+Note
- + On Windows, one anonymous account is for connections from
- the local host. It has no global privileges. (Before
- MySQL 5.1.16, it has all global privileges, just like the
- root accounts.) The other is for connections from any
- host and has all privileges for the test database and for
- other databases with names that start with test.
+ The list of installed databases may vary, but will always include
+ the minimum of mysql and information_schema. In most cases, the
+ test database will also be installed automatically.
+
+ If you specify the name of the database, then a list of the tables
+ within a given database will be displayed:
+C:\> C:\mysql\bin\mysqlshow mysql
+Database: mysql
++---------------------------+
+| Tables |
++---------------------------+
+| columns_priv |
+| db |
+| event |
+| func |
+| general_log |
+| help_category |
+| help_keyword |
+| help_relation |
+| help_topic |
+| host |
+| plugin |
+| proc |
+| procs_priv |
+| servers |
+| slow_log |
+| tables_priv |
+| time_zone |
+| time_zone_leap_second |
+| time_zone_name |
+| time_zone_transition |
+| time_zone_transition_type |
+| user |
++---------------------------+
- + On Unix, both anonymous accounts are for connections from
- the local host. Connections must be made from the local
- host by specifying a host name of localhost for one of
- the accounts, or the actual host name or IP number for
- the other. These accounts have all privileges for the
- test database and for other databases with names that
- start with test_.
- As noted, none of the initial accounts have passwords. This means
- that your MySQL installation is unprotected until you do something
- about it:
+C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
++------+-------+------+
+| host | db | user |
++------+-------+------+
+| % | test% | |
++------+-------+------+
- * If you want to prevent clients from connecting as anonymous
- users without a password, you should either assign a password
- to each anonymous account or else remove the accounts.
+ You may need to specify a different directory from the one shown;
+ if you used the Windows Installation Wizard, then the default
+ directory is C:\Program Files\MySQL\MySQL Server 5.1, and the
+ mysql and mysqlshow client programs are in C:\Program
+ Files\MySQL\MySQL Server 5.1\bin. See Section 2.5.3.1, "Using the
+ MySQL Installation Wizard," for more information.
- * You should assign a password to each MySQL root account.
+ If you have already secured the initial MySQL accounts, you may
+ need to use the -u and -p options to supply a user name and
+ password to the mysqlshow and mysql client programs; otherwise the
+ programs may fail with an error, or you may not be able to view
+ all databases. For example, if you have assigned the password
+ "secretpass" to the MySQL root account, then you can invoke
+ mysqlshow and mysql as shown here:
+C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass
++--------------------+
+| Databases |
++--------------------+
+| information_schema |
+| mysql |
+| test |
++--------------------+
- The following instructions describe how to set up passwords for
- the initial MySQL accounts, first for the anonymous accounts and
- then for the root accounts. Replace "newpwd" in the examples with
- the actual password that you want to use. The instructions also
- cover how to remove the anonymous accounts, should you prefer not
- to allow anonymous access at all.
+C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
+Database: mysql
++---------------------------+
+| Tables |
++---------------------------+
+| columns_priv |
+| db |
+| event |
+| func |
+| general_log |
+| help_category |
+| help_keyword |
+| help_relation |
+| help_topic |
+| host |
+| plugin |
+| proc |
+| procs_priv |
+| servers |
+| slow_log |
+| tables_priv |
+| time_zone |
+| time_zone_leap_second |
+| time_zone_name |
+| time_zone_transition |
+| time_zone_transition_type |
+| user |
++---------------------------+
- You might want to defer setting the passwords until later, so that
- you don't need to specify them while you perform additional setup
- or testing. However, be sure to set them before using your
- installation for production purposes.
- Anonymous Account Password Assignment
+C:\> C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User F
+ROM db" mysql
++------+-------+------+
+| host | db | user |
++------+-------+------+
+| % | test% | |
++------+-------+------+
- To assign passwords to the anonymous accounts, connect to the
- server as root and then use either SET PASSWORD or UPDATE. In
- either case, be sure to encrypt the password using the PASSWORD()
- function.
+ For more information about these programs, see Section 4.5.6,
+ "mysqlshow --- Display Database, Table, and Column Information,"
+ and Section 4.5.1, "mysql --- The MySQL Command-Line Tool."
- To use SET PASSWORD on Windows, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR ''@'%' = PASSWORD('newpwd');
+ If you are running a version of Windows that supports services and
+ you want the MySQL server to run automatically when Windows
+ starts, see Section 2.5.5.6, "Starting MySQL as a Windows
+ Service."
- To use SET PASSWORD on Unix, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
+2.5.9. MySQL on Windows Compared to MySQL on Unix
- In the second SET PASSWORD statement, replace host_name with the
- name of the server host. This is the name that is specified in the
- Host column of the non-localhost record for root in the user
- table. If you don't know what host name this is, issue the
- following statement before using SET PASSWORD:
-mysql> SELECT Host, User FROM mysql.user;
+ MySQL for Windows has proven itself to be very stable. The Windows
+ version of MySQL has the same features as the corresponding Unix
+ version, with the following exceptions:
- Look for the record that has root in the User column and something
- other than localhost in the Host column. Then use that Host value
- in the second SET PASSWORD statement.
+ * Limited number of ports
+ Windows systems have about 4,000 ports available for client
+ connections, and after a connection on a port closes, it takes
+ two to four minutes before the port can be reused. In
+ situations where clients connect to and disconnect from the
+ server at a high rate, it is possible for all available ports
+ to be used up before closed ports become available again. If
+ this happens, the MySQL server appears to be unresponsive even
+ though it is running. Note that ports may be used by other
+ applications running on the machine as well, in which case the
+ number of ports available to MySQL is lower.
+ For more information about this problem, see
+ http://support.microsoft.com/default.aspx?scid=kb;en-us;196271
+ .
- Anonymous Account Removal
+ * Concurrent reads
+ MySQL depends on the pread() and pwrite() system calls to be
+ able to mix INSERT and SELECT. Currently, we use mutexes to
+ emulate pread() and pwrite(). We intend to replace the file
+ level interface with a virtual interface in the future so that
+ we can use the readfile()/writefile() interface to get more
+ speed. The current implementation limits the number of open
+ files that MySQL 5.1 can use to 2,048, which means that you
+ cannot run as many concurrent threads on Windows as on Unix.
- If you prefer to remove the anonymous accounts instead, do so as
- follows:
-shell> mysql -u root
-mysql> DROP USER '';
+ * Blocking read
+ MySQL uses a blocking read for each connection. That has the
+ following implications if named-pipe connections are enabled:
- The DROP statement applies both to Windows and to Unix. On
- Windows, if you want to remove only the anonymous account that has
- the same privileges as root, do this instead:
-shell> mysql -u root
-mysql> DROP USER ''@'localhost';
+ + A connection is not disconnected automatically after
+ eight hours, as happens with the Unix version of MySQL.
- That account allows anonymous access but has full privileges, so
- removing it improves security.
+ + If a connection hangs, it is not possible to break it
+ without killing MySQL.
- root Account Password Assignment
+ + mysqladmin kill does not work on a sleeping connection.
- You can assign passwords to the root accounts in several ways. The
- following discussion demonstrates three methods:
+ + mysqladmin shutdown cannot abort as long as there are
+ sleeping connections.
+ We plan to fix this problem in the future.
- * Use the SET PASSWORD statement
+ * ALTER TABLE
+ While you are executing an ALTER TABLE statement, the table is
+ locked from being used by other threads. This has to do with
+ the fact that on Windows, you can't delete a file that is in
+ use by another thread. In the future, we may find some way to
+ work around this problem.
- * Use the mysqladmin command-line client program
+ * DATA DIRECTORY and INDEX DIRECTORY
+ The DATA DIRECTORY and INDEX DIRECTORY options for CREATE
+ TABLE are ignored on Windows, because Windows doesn't support
+ symbolic links. These options also are ignored on systems that
+ have a nonfunctional realpath() call.
- * Use the UPDATE statement
+ * DROP DATABASE
+ You cannot drop a database that is in use by another thread.
- To assign passwords using SET PASSWORD, connect to the server as
- root and issue SET PASSWORD statements. Be sure to encrypt the
- password using the PASSWORD() function.
+ * Case-insensitive names
+ File names are not case sensitive on Windows, so MySQL
+ database and table names are also not case sensitive on
+ Windows. The only restriction is that database and table names
+ must be specified using the same case throughout a given
+ statement. See Section 8.2.2, "Identifier Case Sensitivity."
- For Windows, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');
+ * Directory and file names
+ On Windows, MySQL Server supports only directory and file
+ names that are compatible with the current ANSI code pages.
+ For example, the following Japanese directory name will not
+ work in the Western locale (code page 1252):
+datadir="C:/维基百科关于中文维基百科"
+ The same limitation applies to directory and file names
+ referred to in SQL statements, such as the data file path name
+ in LOAD DATA INFILE.
- For Unix, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
+ * The "\" path name separator character
+ Path name components in Windows are separated by the "\"
+ character, which is also the escape character in MySQL. If you
+ are using LOAD DATA INFILE or SELECT ... INTO OUTFILE, use
+ Unix-style file names with "/" characters:
+mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;
+mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
+ Alternatively, you must double the "\" character:
+mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;
+mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;
- In the second SET PASSWORD statement, replace host_name with the
- name of the server host. This is the same host name that you used
- when you assigned the anonymous account passwords.
+ * Problems with pipes
+ Pipes do not work reliably from the Windows command-line
+ prompt. If the pipe includes the character ^Z / CHAR(24),
+ Windows thinks that it has encountered end-of-file and aborts
+ the program.
+ This is mainly a problem when you try to apply a binary log as
+ follows:
+C:\> mysqlbinlog binary_log_file | mysql --user=root
+ If you have a problem applying the log and suspect that it is
+ because of a ^Z / CHAR(24) character, you can use the
+ following workaround:
+C:\> mysqlbinlog binary_log_file --result-file=/tmp/bin.sql
+C:\> mysql --user=root --execute "source /tmp/bin.sql"
+ The latter command also can be used to reliably read in any
+ SQL file that may contain binary data.
- If the user table contains an account with User and Host values of
- 'root' and '127.0.0.1', use an additional SET PASSWORD statement
- to set that account's password:
-mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
+ * Access denied for user error
+ If MySQL cannot resolve your host name properly, you may get
+ the following error when you attempt to run a MySQL client
+ program to connect to a server running on the same machine:
+Access denied for user 'some_user'@'unknown'
+to database 'mysql'
+ To fix this problem, you should create a file named
+ \windows\hosts containing the following information:
+127.0.0.1 localhost
- To assign passwords to the root accounts using mysqladmin, execute
- the following commands:
-shell> mysqladmin -u root password "newpwd"
-shell> mysqladmin -u root -h host_name password "newpwd"
+ Here are some open issues for anyone who might want to help us
+ improve MySQL on Windows:
+
+ * Add macros to use the faster thread-safe increment/decrement
+ methods provided by Windows.
+
+2.5.10. Installing MySQL from Source on Windows
- These commands apply both to Windows and to Unix. In the second
- command, replace host_name with the name of the server host. The
- double quotes around the password are not always necessary, but
- you should use them if the password contains spaces or other
- characters that are special to your command interpreter.
+ These instructions describe how to build binaries from source for
+ MySQL 5.1 on Windows. Instructions are provided for building
+ binaries from a standard source distribution or from the Bazaar
+ tree that contains the latest development source.
- The mysqladmin method of setting the root account passwords does
- not set the password for the 'root'@'127.0.0.1' account. To do so,
- use SET PASSWORD as shown earlier.
+Note
- You can also use UPDATE to modify the user table directly. The
- following UPDATE statement assigns a password to all root
- accounts:
-shell> mysql -u root
-mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
- -> WHERE User = 'root';
-mysql> FLUSH PRIVILEGES;
+ The instructions here are strictly for users who want to test
+ MySQL on Microsoft Windows from the latest source distribution or
+ from the Bazaar tree. For production use, we do not advise using a
+ MySQL server built by yourself from source. Normally, it is best
+ to use precompiled binary distributions of MySQL that are built
+ specifically for optimal performance on Windows by Sun
+ Microsystems, Inc. Instructions for installing binary
+ distributions are available in Section 2.5, "Installing MySQL on
+ Windows."
- The UPDATE statement applies both to Windows and to Unix.
+ To build MySQL on Windows from source, you must satisfy the
+ following system, compiler, and resource requirements:
- After the passwords have been set, you must supply the appropriate
- password whenever you connect to the server. For example, if you
- want to use mysqladmin to shut down the server, you can do so
- using this command:
-shell> mysqladmin -u root -p shutdown
-Enter password: (enter root password here)
+ * Windows 2000, Windows XP, or newer version.
+ Windows Vista is supported when using Visual Studio 2005
+ provided you have installed the following updates:
-Note
+ + Microsoft Visual Studio 2005 Professional Edition - ENU
+ Service Pack 1 (KB926601)
+ (http://support.microsoft.com/?kbid=926601)
- If you forget your root password after setting it up, Section
- B.1.4.1, "How to Reset the Root Password," covers the procedure
- for resetting it.
+ + Security Update for Microsoft Visual Studio 2005
+ Professional Edition - ENU (KB937061)
+ (http://support.microsoft.com/?kbid=937061)
- To set up additional accounts, you can use the GRANT statement.
- For instructions, see Section 5.5.2, "Adding User Accounts."
+ + Update for Microsoft Visual Studio 2005 Professional
+ Edition - ENU (KB932232)
+ (http://support.microsoft.com/?kbid=932232)
-2.12. Upgrading or Downgrading MySQL
+ * CMake, which can be downloaded from http://www.cmake.org.
+ After installing, modify your path to include the cmake
+ binary.
-2.12.1. Upgrading MySQL
+ * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net
+ 2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
- As a general rule, to upgrade from one release series to another,
- you should go to the next series rather than skipping a series. To
- upgrade from a release series previous to MySQL 5.0, upgrade to
- each successive release series in turn until you have reached
- MySQL 5.0, and then proceed with the upgrade to MySQL 5.1. For
- example, if you currently are running MySQL 4.0 and wish to
- upgrade to a newer series, upgrade to MySQL 4.1 first before
- upgrading to 5.0, and so forth. For information on upgrading to
- MySQL 5.0, see the MySQL 5.0 Reference Manual; for earlier
- releases, see the MySQL 3.23, 4.0, 4.1 Reference Manual.
+ * If you are using Visual C++ 2005 Express Edition, you must
+ also install an appropriate Platform SDK. More information and
+ links to downloads for various Windows platforms is available
+ from
+ http://www.microsoft.com/downloads/details.aspx?familyid=0baf2
+ b35-c656-4969-ace8-e4c0c0716adb.
- To upgrade from MySQL 5.0 to 5.1, use the items in the following
- checklist as a guide:
+ * If you are compiling from a Bazaar tree or making changes to
+ the parser, you need bison for Windows, which can be
+ downloaded from
+ http://gnuwin32.sourceforge.net/packages/bison.htm. Download
+ the package labeled "Complete package, excluding sources".
+ After installing the package, modify your path to include the
+ bison binary and ensure that this binary is accessible from
+ Visual Studio.
- * Before any upgrade, back up your databases, including the
- mysql database that contains the grant tables. See Section
- 6.1, "Database Backups."
+ * Cygwin might be necessary if you want to run the test script
+ or package the compiled binaries and support files into a Zip
+ archive. (Cygwin is needed only to test or package the
+ distribution, not to build it.) Cygwin is available from
+ http://cygwin.com.
- * Read all the notes in Section 2.12.1.1, "Upgrading from MySQL
- 5.0 to 5.1." These notes enable you to identify upgrade issues
- that apply to your current MySQL installation. Some
- incompatibilities discussed in that section require your
- attention before upgrading. Others should be dealt with after
- upgrading.
+ * 3GB to 5GB of disk space.
- * Read Appendix C, "MySQL Change History" as well, which
- provides information about features that are new in MySQL 5.1
- or differ from those found in MySQL 5.0.
+ The exact system requirements for Visual Studio can be found here:
+ http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as
+ px and
+ http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx
- * After you upgrade to a new version of MySQL, run mysql_upgrade
- (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
- Upgrade"). This program checks your tables, and attempts to
- repair them if necessary. It also updates your grant tables to
- make sure that they have the current structure so that you can
- take advantage of any new capabilities. (Some releases of
- MySQL introduce changes to the structure of the grant tables
- to add new privileges or features.)
+ You also need a MySQL source distribution for Windows, which can
+ be obtained two ways:
- * If you are running MySQL Server on Windows, see Section
- 2.3.14, "Upgrading MySQL on Windows."
+ * Obtain a source distribution packaged by Sun Microsystems,
+ Inc. These are available from http://dev.mysql.com/downloads/.
- * If you are using replication, see Section 16.3.3, "Upgrading a
- Replication Setup," for information on upgrading your
- replication setup.
+ * Package a source distribution yourself from the latest Bazaar
+ developer source tree. For instructions on pulling the latest
+ source files, see Section 2.3.3, "Installing from the
+ Development Source Tree."
- * If you are upgrading an installation originally produced by
- installing multiple RPM packages, it is best to upgrade all
- the packages, not just some. For example, if you previously
- installed the server and client RPMs, do not upgrade just the
- server RPM.
+ If you find something not working as expected, or you have
+ suggestions about ways to improve the current build process on
+ Windows, please send a message to the win32 mailing list. See
+ Section 1.5.1, "MySQL Mailing Lists."
- * As of MySQL 5.1.9, the mysqld-max server is included in binary
- distributions. There is no separate MySQL-Max distribution. As
- of MySQL 5.1.12, there is no mysqld-max server at all in
- binary distributions. They contain a server that includes the
- features previously included in mysqld-max.
+2.5.10.1. Building MySQL from Source Using CMake and Visual Studio
- * If you have created a user-defined function (UDF) with a given
- name and upgrade MySQL to a version that implements a new
- built-in function with the same name, the UDF becomes
- inaccessible. To correct this, use DROP FUNCTION to drop the
- UDF, and then use CREATE FUNCTION to re-create the UDF with a
- different nonconflicting name. The same is true if the new
- version of MySQL implements a built-in function with the same
- name as an existing stored function. See Section 8.2.4,
- "Function Name Parsing and Resolution," for the rules
- describing how the server interprets references to different
- kinds of functions.
+ You can build MySQL on Windows by using a combination of cmake and
+ Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio
+ 2005 (8.0) or Microsoft Visual C++ 2005 Express Edition. You must
+ have the appropriate Microsoft Platform SDK installed.
- You can always move the MySQL format files and data files between
- different versions on systems with the same architecture as long
- as you stay within versions for the same release series of MySQL.
+Note
- If you are cautious about using new versions, you can always
- rename your old mysqld before installing a newer one. For example,
- if you are using MySQL 5.0.13 and want to upgrade to 5.1.10,
- rename your current server from mysqld to mysqld-5.0.13. If your
- new mysqld then does something unexpected, you can simply shut it
- down and restart with your old mysqld.
+ To compile from the source code on Windows you must use the
+ standard source distribution (for example, mysql-5.1.41.tar.gz).
+ You build from the same distribution as used to build MySQL on
+ Unix, Linux and other platforms. Do not use the Windows Source
+ distributions as they do not contain the necessary configuration
+ script and other files.
- If, after an upgrade, you experience problems with recompiled
- client programs, such as Commands out of sync or unexpected core
- dumps, you probably have used old header or library files when
- compiling your programs. In this case, you should check the date
- for your mysql.h file and libmysqlclient.a library to verify that
- they are from the new MySQL distribution. If not, recompile your
- programs with the new headers and libraries.
+ Follow this procedure to build MySQL:
- If problems occur, such as that the new mysqld server does not
- start or that you cannot connect without a password, verify that
- you do not have an old my.cnf file from your previous
- installation. You can check this with the --print-defaults option
- (for example, mysqld --print-defaults). If this command displays
- anything other than the program name, you have an active my.cnf
- file that affects server or client operation.
+ 1. If you are installing from a packaged source distribution,
+ create a work directory (for example, C:\workdir), and unpack
+ the source distribution there using WinZip or another Windows
+ tool that can read .zip files. This directory is the work
+ directory in the following instructions.
- If your MySQL installation contains a large amount of data that
- might take a long time to convert after an in-place upgrade, you
- might find it useful to create a "dummy" database instance for
- assessing what conversions might be needed and the work involved
- to perform them. Make a copy of your MySQL instance that contains
- a full copy of the mysql database, plus all other databases
- without data. Run your upgrade procedure on this dummy instance to
- see what actions might be needed so that you can better evaluate
- the work involved when performing actual data conversion on your
- original database instance.
+ 2. Using a command shell, navigate to the work directory and run
+ the following command:
+C:\workdir>win\configure.js options
+ If you have associated the .js file extension with an
+ application such as a text editor, then you may need to use
+ the following command to force configure.js to be executed as
+ a script:
+C:\workdir>cscript win\configure.js options
+ These options are available for configure.js:
- It is a good idea to rebuild and reinstall the Perl DBD::mysql
- module whenever you install a new release of MySQL. The same
- applies to other MySQL interfaces as well, such as PHP mysql
- extensions and the Python MySQLdb module.
+ + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage
+ engine.
-2.12.1.1. Upgrading from MySQL 5.0 to 5.1
+ + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined
+ partitioning.
- After upgrading a 5.0 installation to 5.0.10 or above, it is
- necessary to upgrade your grant tables. Otherwise, creating stored
- procedures and functions might not work. To perform this upgrade,
- run mysql_upgrade.
+ + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage
+ engine.
-Note
+ + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE
+ storage engine.
- It is good practice to back up your data before installing any new
- version of software. Although MySQL works very hard to ensure a
- high level of quality, you should protect your data by making a
- backup.
+ + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage
+ engine.
- To upgrade to 5.1 from any previous version, MySQL recommends that
- you dump your tables with mysqldump before upgrading and reload
- the dump file after upgrading.
+ + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
+ storage engine.
- In general, you should do the following when upgrading from MySQL
- 5.0 to 5.1:
+ + WITH_NDBCLUSTER_STORAGE_ENGINE (experimental): Enable the
+ NDBCLUSTER storage engine in the MySQL server; cause
+ binaries for the MySQL Cluster management and data node,
+ management client, and other programs to be built.
+ This option is supported only in MySQL Cluster NDB 7.0
+ (NDBCLUSTER storage engine versions 6.4.0 and later)
+ using the MySQL Cluster sources. It cannot be used to
+ enable clustering support in other MySQL source trees or
+ distributions.
- * Read all the items in the following sections to see whether
- any of them might affect your applications:
+ + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.
- + Section 2.12.1, "Upgrading MySQL," has general update
- information.
+ + COMPILATION_COMMENT=comment: Server comment, default
+ "Source distribution".
- + The items in the change lists found later in this section
- enable you to identify upgrade issues that apply to your
- current MySQL installation.
+ + MYSQL_TCP_PORT=port: Server port, default 3306.
+
+ + DISABLE_GRANT_OPTIONS: Disables the --bootstrap,
+ --skip-grant-tables, and --init-file options for mysqld.
+ This option is available as of MySQL 5.1.15.
+ For example (type the command on one line):
+C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE
+ WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
- + The MySQL 5.1 change history describes significant new
- features you can use in 5.1 or that differ from those
- found in MySQL 5.0. Some of these changes may result in
- incompatibilities. See Section C.1, "Changes in Release
- 5.1.x (Production)."
+ 3. From the work directory, execute the win\build-vs8.bat or
+ win\build-vs71.bat file, depending on the version of Visual
+ Studio you have installed. The script invokes CMake, which
+ generates the mysql.sln solution file.
+ You can also use win\build-vs8_x64.bat to build the 64-bit
+ version of MySQL. However, you cannot build the 64-bit version
+ with Visual Studio Express Edition. You must use Visual Studio
+ 2005 (8.0) or higher.
- * Note particularly any changes that are marked Known issue or
- Incompatible change. These incompatibilities with earlier
- versions of MySQL may require your attention before you
- upgrade.
- Our aim is to avoid these changes, but occasionally they are
- necessary to correct problems that would be worse than an
- incompatibility between releases. If any upgrade issue
- applicable to your installation involves an incompatibility
- that requires special handling, follow the instructions given
- in the incompatibility description. Often this will involve a
- dump and reload, or use of a statement such as CHECK TABLE or
- REPAIR TABLE.
- For dump and reload instructions, see Section 2.12.4,
- "Rebuilding or Repairing Tables or Indexes." Any procedure
- that involves REPAIR TABLE with the USE_FRM option must be
- done before upgrading. Use of this statement with a version of
- MySQL different from the one used to create the table (that
- is, using it after upgrading) may damage the table. See
- Section 12.5.2.6, "REPAIR TABLE Syntax."
+ 4. From the work directory, open the generated mysql.sln file
+ with Visual Studio and select the proper configuration using
+ the Configuration menu. The menu provides Debug, Release,
+ RelwithDebInfo, MinRelInfo options. Then select Solution >
+ Build to build the solution.
+ Remember the configuration that you use in this step. It is
+ important later when you run the test script because that
+ script needs to know which configuration you used.
- * After you upgrade to a new version of MySQL, run mysql_upgrade
- (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
- Upgrade"). This program checks your tables, and attempts to
- repair them if necessary. It also updates your grant tables to
- make sure that they have the current structure so that you can
- take advantage of any new capabilities. (Some releases of
- MySQL introduce changes to the structure of the grant tables
- to add new privileges or features.)
+ 5. Test the server. The server built using the preceding
+ instructions expects that the MySQL base directory and data
+ directory are C:\mysql and C:\mysql\data by default. If you
+ want to test your server using the source tree root directory
+ and its data directory as the base directory and data
+ directory, you need to tell the server their path names. You
+ can either do this on the command line with the --basedir and
+ --datadir options, or by placing appropriate options in an
+ option file. (See Section 4.2.3.3, "Using Option Files.") If
+ you have an existing data directory elsewhere that you want to
+ use, you can specify its path name instead.
+ When the server is running in standalone fashion or as a
+ service based on your configuration, try to connect to it from
+ the mysql interactive command-line utility.
+ You can also run the standard test script, mysql-test-run.pl.
+ This script is written in Perl, so you'll need either Cygwin
+ or ActiveState Perl to run it. You may also need to install
+ the modules required by the script. To run the test script,
+ change location into the mysql-test directory under the work
+ directory, set the MTR_VS_CONFIG environment variable to the
+ configuration you selected earlier (or use the --vs-config
+ option), and invoke mysql-test-run.pl. For example (using
+ Cygwin and the bash shell):
+shell> cd mysql-test
+shell> export MTR_VS_CONFIG=debug
+shell> ./mysql-test-run.pl --force --timer
+shell> ./mysql-test-run.pl --force --timer --ps-protocol
- * Check Section 2.12.3, "Checking Whether Table Indexes Must Be
- Rebuilt," to see whether changes to character sets or
- collations were made that affect your table indexes. If so,
- you will need to rebuild the affected indexes using the
- instructions in Section 2.12.4, "Rebuilding or Repairing
- Tables or Indexes."
+ When you are satisfied that the programs you have built are
+ working correctly, stop the server. Now you can install the
+ distribution. One way to do this is to use the make_win_bin_dist
+ script in the scripts directory of the MySQL source distribution
+ (see Section 4.4.2, "make_win_bin_dist --- Package MySQL
+ Distribution as ZIP Archive"). This is a shell script, so you must
+ have Cygwin installed if you want to use it. It creates a Zip
+ archive of the built executables and support files that you can
+ unpack in the location at which you want to install MySQL.
- * If you are running MySQL Server on Windows, see Section
- 2.3.14, "Upgrading MySQL on Windows."
+ It is also possible to install MySQL by copying directories and
+ files directly:
- * If you are using replication, see Section 16.3.3, "Upgrading a
- Replication Setup," for information on upgrading your
- replication setup.
+ 1. Create the directories where you want to install MySQL. For
+ example, to install into C:\mysql, use these commands:
+C:\> mkdir C:\mysql
+C:\> mkdir C:\mysql\bin
+C:\> mkdir C:\mysql\data
+C:\> mkdir C:\mysql\share
+C:\> mkdir C:\mysql\scripts
+ If you want to compile other clients and link them to MySQL,
+ you should also create several additional directories:
+C:\> mkdir C:\mysql\include
+C:\> mkdir C:\mysql\lib
+C:\> mkdir C:\mysql\lib\debug
+C:\> mkdir C:\mysql\lib\opt
+ If you want to benchmark MySQL, create this directory:
+C:\> mkdir C:\mysql\sql-bench
+ Benchmarking requires Perl support. See Section 2.15, "Perl
+ Installation Notes."
- If your MySQL installation contains a large amount of data that
- might take a long time to convert after an in-place upgrade, you
- might find it useful to create a "dummy" database instance for
- assessing what conversions might be needed and the work involved
- to perform them. Make a copy of your MySQL instance that contains
- a full copy of the mysql database, plus all other databases
- without data. Run your upgrade procedure on this dummy instance to
- see what actions might be needed so that you can better evaluate
- the work involved when performing actual data conversion on your
- original database instance.
+ 2. From the work directory, copy into the C:\mysql directory the
+ following directories:
+C:\> cd \workdir
+C:\workdir> copy client_release\*.exe C:\mysql\bin
+C:\workdir> copy client_debug\mysqld.exe C:\mysql\bin\mysqld-debug.ex
+e
+C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
+C:\workdir> xcopy share\*.* C:\mysql\share /E
+ If you want to compile other clients and link them to MySQL,
+ you should also copy several libraries and header files:
+C:\workdir> copy lib_debug\mysqlclient.lib C:\mysql\lib\debug
+C:\workdir> copy lib_debug\libmysql.* C:\mysql\lib\debug
+C:\workdir> copy lib_debug\zlib.* C:\mysql\lib\debug
+C:\workdir> copy lib_release\mysqlclient.lib C:\mysql\lib\opt
+C:\workdir> copy lib_release\libmysql.* C:\mysql\lib\opt
+C:\workdir> copy lib_release\zlib.* C:\mysql\lib\opt
+C:\workdir> copy include\*.h C:\mysql\include
+C:\workdir> copy libmysql\libmysql.def C:\mysql\include
+ If you want to benchmark MySQL, you should also do this:
+C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
- MySQL Enterprise MySQL Enterprise subscribers will find more
- information about upgrading in the Knowledge Base articles found
- at Upgrading
- (https://kb.mysql.com/search.php?cat=search&category=41) Access
- to the MySQL Knowledge Base collection of articles is one of the
- advantages of subscribing to MySQL Enterprise. For more
- information, see
- http://www.mysql.com/products/enterprise/advisors.html.
+ After installation, set up and start the server in the same way as
+ for binary Windows distributions. See Section 2.5, "Installing
+ MySQL on Windows."
- The following lists describe changes that may affect applications
- and that you should watch out for when upgrading to MySQL 5.1.
+2.5.11. Compiling MySQL Clients on Windows
- Configuration Changes:
+ In your source files, you should include my_global.h before
+ mysql.h:
+#include <my_global.h>
+#include <mysql.h>
- * Before MySQL 5.1.11, to build MySQL from source with SSL
- support enabled, you would invoke configure with either the
- --with-openssl or --with-yassl option. In MySQL 5.1.11, those
- options both have been replaced by the --with-ssl option. By
- default, --with-ssl causes the bundled yaSSL library to be
- used. To select OpenSSL instead, give the option as
- --with-ssl=path, where path is the directory where the OpenSSL
- header files and libraries are located.
+ my_global.h includes any other files needed for Windows
+ compatibility (such as windows.h) if you compile your program on
+ Windows.
- Server Changes:
+ You can either link your code with the dynamic libmysql.lib
+ library, which is just a wrapper to load in libmysql.dll on
+ demand, or link with the static mysqlclient.lib library.
- * Known issue: Dumps performed by using mysqldump to generate a
- dump file before the upgrade and reloading the file after
- upgrading are subject to the following problem:
- Before MySQL 5.0.40, mysqldump displays SPATIAL index
- definitions using prefix lengths for the indexed columns.
- These prefix lengths are accepted in MySQL 5.0, but not as of
- MySQL 5.1. If you use mysqldump from versions of MySQL older
- than 5.0.40, any table containing SPATIAL indexes will cause
- an error when the dump file is reloaded into MySQL 5.1 or
- higher.
- For example, a table definition might look like this when
- dumped in MySQL 5.0:
-CREATE TABLE `t` (
- `g` geometry NOT NULL,
- SPATIAL KEY `g` (`g`(32))
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- The SPATIAL index definition will not be accepted in MySQL
- 5.1. To work around this, edit the dump file to remove the
- prefix:
-CREATE TABLE `t` (
- `g` geometry NOT NULL,
- SPATIAL KEY `g` (`g`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- Dump files can be large, so it may be preferable to dump table
- definitions and data separately to make it easier to edit the
- definitions:
-shell> mysqldump --no-data other_args > definitions.sql
-shell> mysqldump --no-create-info other_args > data.sql
- Then edit definitions.sql before reloading definitions.sql and
- data.sql, in that order.
- If you upgrade to a version of MySQL 5.0 higher than 5.0.40
- before upgrading to MySQL 5.1, this problem does not occur.
+ The MySQL client libraries are compiled as threaded libraries, so
+ you should also compile your code to be multi-threaded.
- * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR
- UPGRADE statement did not check for incompatible collation
- changes made in MySQL 5.1.24. (This also affects mysqlcheck
- and mysql_upgrade, which cause that statement to be executed.)
- Prior to the fix made in 5.1.30, a binary upgrade (performed
- without dumping tables with mysqldump before the upgrade and
- reloading the dump file after the upgrade) would corrupt
- tables. After the fix, CHECK TABLE ... FOR UPGRADE properly
- detects the problem and warns about tables that need repair.
- However, the fix is not backward compatible and can result in
- a downgrading problem under these circumstances:
+2.6. Installing MySQL on Linux
- 1. Perform a binary upgrade to a version of MySQL that
- includes the fix.
+ The following sections covers the installation of Linux using
+ RPMs. For information on using a generic binary package using tar,
+ see Section 2.2, "Installing MySQL from Generic Binaries on
+ Unix/Linux." For information on installing from source, see
+ Section 2.3, "MySQL Installation Using a Source Distribution."
- 2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or
- mysql_upgrade) to upgrade tables.
+ mysql.server can be found in the support-files directory under the
+ MySQL installation directory or in a MySQL source tree. You can
+ install it as /etc/init.d/mysql for automatic MySQL startup and
+ shutdown. See Section 2.13.1.2, "Starting and Stopping MySQL
+ Automatically."
- 3. Perform a binary downgrade to a version of MySQL that
- does not include the fix.
- The solution is to dump tables with mysqldump before the
- downgrade and reload the dump file after the downgrade.
- Alternatively, drop and recreate affected indexes.
+2.6.1. Installing MySQL from RPM Packages on Linux
- * Known issue: MySQL introduces encoding for table names that
- have non-ASCII characters (see Section 8.2.3, "Mapping of
- Identifiers to File Names"). After a binary upgrade from MySQL
- 5.0 to 5.1 or higher, the server recognizes names that have
- non-ASCII characters and adds a #mysql50# prefix to them.
- As of MySQL 5.1.31, mysql_upgrade encodes these names by
- executing the following command:
-mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table
--names
- Prior to MySQL 5.1.31, mysql_upgrade does not execute this
- command, so you should execute it manually if you have
- database or table names that contain nonalphanumeric
- characters.
- Prior to MySQL 5.1.23, the mysqlcheck command does not perform
- the name encoding for views. To work around this problem, drop
- each affected view and recreate it.
- mysqlcheck cannot fix names that contain literal instances of
- the @ character that is used for encoding special characters.
- If you have databases or tables that contain this character,
- use mysqldump to dump them before upgrading to MySQL 5.1, and
- then reload the dump file after upgrading.
+ The recommended way to install MySQL on RPM-based Linux
+ distributions is by using the RPM packages. The RPMs that we
+ provide to the community should work on all versions of Linux that
+ support RPM packages and use glibc 2.3. To obtain RPM packages,
+ see Section 2.1.3, "How to Get MySQL."
- * Known issue: When upgrading from MySQL 5.0 to versions of 5.1
- prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which
- runs mysqlcheck) to upgrade tables fails for names that must
- be written as quoted identifiers. To work around this problem,
- rename each affected table to a name that does not require
- quoting:
-RENAME TABLE `tab``le_a` TO table_a;
-RENAME TABLE `table b` TO table_b;
- After renaming the tables, run the mysql_upgrade program. Then
- rename the tables back to their original names:
-RENAME TABLE table_a TO `tab``le_a`;
-RENAME TABLE table_b TO `table b`;
+ For non-RPM Linux distributions, you can install MySQL using a
+ .tar.gz package. See Section 2.2, "Installing MySQL from Generic
+ Binaries on Unix/Linux."
- * Known issue: In connection with view creation, the server
- created arc directories inside database directories and
- maintained useless copies of .frm files there. Creation and
- renaming procedures of those copies as well as creation of arc
- directories has been discontinued in MySQL 5.1.29.
- This change does cause a problem when downgrading to older
- server versions which manifests itself under these
- circumstances:
+ We do provide some platform-specific RPMs; the difference between
+ a platform-specific RPM and a generic RPM is that a
+ platform-specific RPM is built on the targeted platform and is
+ linked dynamically whereas a generic RPM is linked statically with
+ LinuxThreads.
- 1. Create a view v_orig in MySQL 5.1.29 or higher.
+Note
- 2. Rename the view to v_new and then back to v_orig.
+ RPM distributions of MySQL often are provided by other vendors. Be
+ aware that they may differ in features and capabilities from those
+ built by us, and that the instructions in this manual do not
+ necessarily apply to installing them. The vendor's instructions
+ should be consulted instead.
- 3. Downgrade to an older 5.1.x server and run mysql_upgrade.
+ In most cases, you need to install only the MySQL-server and
+ MySQL-client packages to get a functional MySQL installation. The
+ other packages are not required for a standard installation.
- 4. Try to rename v_orig to v_new again. This operation
- fails.
- As a workaround to avoid this problem, use either of these
- approaches:
+ RPMs for MySQL Cluster. Beginning with MySQL 5.1.24, standard
+ MySQL server RPMs built by MySQL no longer provide support for the
+ NDBCLUSTER storage engine. MySQL Cluster users wanting to upgrade
+ MySQL 5.1.23 or earlier installations from RPMs built by MySQL
+ should upgrade to MySQL Cluster NDB 6.2 or MySQL Cluster NDB 6.3;
+ RPMs that should work with most Linux distributions are available
+ for both of these release series.
- + Dump your data using mysqldump before downgrading and
- reload the dump file after downgrading.
+Important
- + Instead of renaming a view after the downgrade, drop it
- and recreate it.
+ When upgrading a MySQL Cluster RPM installation, you must upgrade
+ all installed RPMs, including the Server and Client RPMs.
- * Incompatible change: Character set or collation changes were
- made in MySQL 5.1.21, 5.1.23, and 5.1.24 that may require
- table indexes to be rebuilt. For details, see Section 2.12.3,
- "Checking Whether Table Indexes Must Be Rebuilt."
+ For more information about installing MySQL Cluster from RPMs, see
+ Section 17.2.1, "MySQL Cluster Multi-Computer Installation."
- * Incompatible change: In MySQL 5.1.36, options for loading
- plugins such as pluggable storage engines were changed from
- boolean to tristate format. The implementations overlap, but
- if you previously used options of the form --plugin_name=0 or
- --plugin_name=1, you should instead use --plugin_name=OFF or
- --plugin_name=ON, respectively. For details, see Section
- 5.1.3, "Server Options for Loading Plugins."
+ For upgrades, if your installation was originally produced by
+ installing multiple RPM packages, it is best to upgrade all the
+ packages, not just some. For example, if you previously installed
+ the server and client RPMs, do not upgrade just the server RPM.
- * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE
- statement was changed such that assigning NULL to a NOT NULL
- column caused an error even when strict SQL mode was not
- enabled. The original behavior before MySQL 5.1.24 was that
- such assignments caused an error only in strict SQL mode, and
- otherwise set the column to the implicit default value for the
- column data type and generated a warning. (For information
- about implicit default values, see Section 10.1.4, "Data Type
- Default Values.")
- The change caused compatibility problems for applications that
- relied on the original behavior. It also caused replication
- problems between servers that had the original behavior and
- those that did not, for applications that assigned NULL to NOT
- NULL columns in UPDATE statements without strict SQL mode
- enabled. The change was reverted in MySQL 5.1.32 so that
- UPDATE again had the original behavior. Problems can still
- occur if you replicate between servers that have the modified
- UPDATE behavior and those that do not.
+ The RPM packages shown in the following list are available. The
+ names shown here use a suffix of .glibc23.i386.rpm, but particular
+ packages can have different suffixes, described later.
- * Incompatible change: As of MySQL 5.1.29, the default binary
- logging mode has been changed from MIXED to STATEMENT for
- compatibility with MySQL 5.0.
+ * MySQL-server-VERSION.glibc23.i386.rpm
+ The MySQL server. You need this unless you only want to
+ connect to a MySQL server running on another machine.
- * Incompatible change: In MySQL 5.1.25, a change was made to the
- way that the server handles prepared statements. This affects
- prepared statements processed at the SQL level (using the
- PREPARE statement) and those processed using the binary
- client-server protocol (using the mysql_stmt_prepare() C API
- function).
- Previously, changes to metadata of tables or views referred to
- in a prepared statement could cause a server crash when the
- statement was next executed, or perhaps an error at execute
- time with a crash occurring later. For example, this could
- happen after dropping a table and recreating it with a
- different definition.
- Now metadata changes to tables or views referred to by
- prepared statements are detected and cause automatic
- repreparation of the statement when it is next executed.
- Metadata changes occur for DDL statements such as those that
- create, drop, alter, rename, or truncate tables, or that
- analyze, optimize, or repair tables. Repreparation also occurs
- after referenced tables or views are flushed from the table
- definition cache, either implicitly to make room for new
- entries in the cache, or explicitly due to FLUSH TABLES.
- Repreparation is automatic, but to the extent that it occurs,
- performance of prepared statements is diminished.
- Table content changes (for example, with INSERT or UPDATE) do
- not cause repreparation, nor do SELECT statements.
- An incompatibility with previous versions of MySQL is that a
- prepared statement may now return a different set of columns
- or different column types from one execution to the next. For
- example, if the prepared statement is SELECT * FROM t1,
- altering t1 to contain a different number of columns causes
- the next execution to return a number of columns different
- from the previous execution.
- Older versions of the client library cannot handle this change
- in behavior. For applications that use prepared statements
- with the new server, an upgrade to the new client library is
- strongly recommended.
- Along with this change to statement repreparation, the default
- value of the table_definition_cache system variable has been
- increased from 128 to 256. The purpose of this increase is to
- lessen the chance that prepared statements will need
- repreparation due to referred-to tables/views having been
- flushed from the cache to make room for new entries.
- A new status variable, Com_stmt_reprepare, has been introduced
- to track the number of repreparations.
+ * MySQL-client-VERSION.glibc23.i386.rpm
+ The standard MySQL client programs. You probably always want
+ to install this package.
- * Incompatible change: As of MySQL 5.1.23, within a stored
- routine, it is no longer allowable to declare a cursor for a
- SHOW or DESCRIBE statement. This happened to work in some
- instances, but is no longer supported. In many cases, a
- workaround for this change is to use the cursor with a SELECT
- query to read from an INFORMATION_SCHEMA table that produces
- the same information as the SHOW statement.
+ * MySQL-devel-VERSION.glibc23.i386.rpm
+ The libraries and include files that are needed if you want to
+ compile other MySQL clients, such as the Perl modules.
- * Incompatible change: SHOW CREATE VIEW displays view
- definitions using an AS alias_name clause for each column. If
- a column is created from an expression, the default alias is
- the expression text, which can be quite long. As of MySQL
- 5.1.23, aliases for column names in CREATE VIEW statements are
- checked against the maximum column length of 64 characters
- (not the maximum alias length of 256 characters). As a result,
- views created from the output of SHOW CREATE VIEW fail if any
- column alias exceeds 64 characters. This can cause problems
- for replication or loading dump files. For additional
- information and workarounds, see Section D.4, "Restrictions on
- Views."
+ * MySQL-debuginfo-VERSION.glibc23.i386.rpm
+ This package contains debugging information. debuginfo RPMs
+ are never needed to use MySQL software; this is true both for
+ the server and for client programs. However, they contain
+ additional information that might be needed by a debugger to
+ analyze a crash.
- * Incompatible change: MySQL 5.1 implements support for a plugin
- API that allows the loading and unloading of components at
- runtime, without restarting the server. Section 22.2, "The
- MySQL Plugin Interface." The plugin API requires the
- mysql.plugin table. After upgrading from an older version of
- MySQL, you should run the mysql_upgrade command to create this
- table. See Section 4.4.8, "mysql_upgrade --- Check Tables for
- MySQL Upgrade."
- Plugins are installed in the directory named by the plugin_dir
- system variable. This variable also controls the location from
- which the server loads user-defined functions (UDFs), which is
- a change from earlier versions of MySQL. That is, all UDF
- library files now must be installed in the plugin directory.
- When upgrading from an older version of MySQL, you must
- migrate your UDF files to the plugin directory.
+ * MySQL-shared-VERSION.glibc23.i386.rpm
+ This package contains the shared libraries
+ (libmysqlclient.so*) that certain languages and applications
+ need to dynamically load and use MySQL. It contains
+ single-threaded and thread-safe libraries. If you install this
+ package, do not install the MySQL-shared-compat package.
- * Incompatible change: The table_cache system variable has been
- renamed to table_open_cache. Any scripts that refer to
- table_cache must be updated to use the new name.
+ * MySQL-shared-compat-VERSION.glibc23.i386.rpm
+ This package includes the shared libraries for MySQL 3.23,
+ 4.0, and so on, up to the current release. It contains
+ single-threaded and thread-safe libraries. Install this
+ package instead of MySQL-shared if you have applications
+ installed that are dynamically linked against older versions
+ of MySQL but you want to upgrade to the current version
+ without breaking the library dependencies.
- * Incompatible change: Several issues were identified for stored
- programs (stored procedures and functions, triggers, and
- events) and views containing non-ASCII symbols. These issues
- involved conversion errors due to incomplete character set
- information when translating these objects to and from stored
- format.
- To address these problems, the representation for these
- objects was changed in MySQL 5.1.21. However, the fixes affect
- all stored programs and views. (For example, you will see
- warnings about "no creation context.") To avoid warnings from
- the server about the use of old definitions from any release
- prior to 5.1.21, you should dump stored programs and views
- with mysqldump after upgrading to 5.1.21 or higher, and then
- reload them to recreate them with new definitions. Invoke
- mysqldump with a --default-character-set option that names the
- non-ASCII character set that was used for the definitions when
- the objects were originally defined.
+ * MySQL-shared-compat-advanced-gpl-VERSION.glibc23.i386.rpm,
+ MySQL-shared-compat-advanced-VERSION.glibc23.i386.rpm
+ These are like the MySQL-shared-compat package, but are for
+ the "MySQL Enterprise Server - Advanced Edition" products.
+ Install these packages rather than the normal
+ MySQL-shared-compat package if you want to included shared
+ client libraries for older MySQL versions.
- * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports
- error logging to syslog on systems that support the logger
- command. The new --syslog and --skip-syslog options can be
- used instead of the --log-error option to control logging
- behavior, as described in Section 4.3.2, "mysqld_safe ---
- MySQL Server Startup Script."
- In 5.1.21 and up, the default is --skip-syslog, which is
- compatible with the default behavior of writing an error log
- file for releases prior to 5.1.20.
- In 5.1.20 only, the following conditions apply: 1) The default
- is to use syslog, which is not compatible with releases prior
- to 5.1.20. 2) Logging to syslog may fail to operate correctly
- in some cases. For these reasons, avoid using MySQL 5.1.20.
+ * MySQL-embedded-VERSION.glibc23.i386.rpm
+ The embedded MySQL server library.
- * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back
- only the last statement on a transaction timeout. A new
- option, --innodb_rollback_on_timeout, causes InnoDB to abort
- and roll back the entire transaction if a transaction timeout
- occurs (the same behavior as in MySQL 4.1).
+ * MySQL-ndb-management-VERSION.glibc23.i386.rpm,
+ MySQL-ndb-storage-VERSION.glibc23.i386.rpm,
+ MySQL-ndb-tools-VERSION.glibc23.i386.rpm,
+ MySQL-ndb-extra-VERSION.glibc23.i386.rpm
+ Packages that contain additional files for MySQL Cluster
+ installations.
+
+Note
+ The MySQL-ndb-tools RPM requires a working installation of
+ perl. Prior to MySQL 5.1.18, the DBI and HTML::Template
+ packages were also required. See Section 2.15, "Perl
+ Installation Notes," and Section 17.4.21, "ndb_size.pl ---
+ NDBCLUSTER Size Requirement Estimator," for more information.
+
+ * MySQL-test-VERSION.glibc23.i386.rpm
+ This package includes the MySQL test suite.
+
+ * MySQL-VERSION.src.rpm
+ This contains the source code for all of the previous
+ packages. It can also be used to rebuild the RPMs on other
+ architectures (for example, Alpha or SPARC).
- * Incompatible change: As of MySQL 5.1.15, the following
- conditions apply to enabling the read_only system variable:
+ The suffix of RPM package names (following the VERSION value) has
+ the following syntax:
+.PLATFORM.CPU.rpm
- + If you attempt to enable read_only while you have any
- explicit locks (acquired with LOCK TABLES or have a
- pending transaction, an error will occur.
+ The PLATFORM and CPU values indicate the type of system for which
+ the package is built. PLATFORM indicates the platform and CPU
+ indicates the processor type or family.
- + If other clients hold explicit table locks or have
- pending transactions, the attempt to enable read_only
- blocks until the locks are released and the transactions
- end. While the attempt to enable read_only is pending,
- requests by other clients for table locks or to begin
- transactions also block until read_only has been set.
+ All packages are dynamically linked against glibc 2.3. The
+ PLATFORM value indicates whether the package is platform
+ independent or intended for a specific platform, as shown in the
+ following table.
+ glibc23 Platform independent, should run on any Linux distribution
+ that supports glibc 2.3
+ rhel3, rhel4 Red Hat Enterprise Linux 3 or 4
+ sles9, sles10 SuSE Linux Enterprise Server 9 or 10
- + read_only can be enabled while you hold a global read
- lock (acquired with FLUSH TABLES WITH READ LOCK) because
- that does not involve table locks.
- Previously, the attempt to enable read_only would return
- immediately even if explicit locks or transactions were
- pending, so some data changes could occur for statements
- executing in the server at the same time.
+ In MySQL 5.1, only glibc23 packages are available currently.
- * Incompatible change: The number of function names affected by
- IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from
- about 200 to about 30. (For details about IGNORE_SPACE, see
- Section 8.2.4, "Function Name Parsing and Resolution.") This
- change improves the consistency of parser operation. However,
- it also introduces the possibility of incompatibility for old
- SQL code that relies on the following conditions:
+ The CPU value indicates the processor type or family for which the
+ package is built.
+ i386 x86 processor, 386 and up
+ i586 x86 processor, Pentium and up
+ x86_64 64-bit x86 processor
+ ia64 Itanium (IA-64) processor
- + IGNORE_SPACE is disabled.
+ To see all files in an RPM package (for example, a MySQL-server
+ RPM), run a command like this:
+shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm
- + The presence or absence of whitespace following a
- function name is used to distinguish between a built-in
- function and stored function that have the same name (for
- example, PI() versus PI ()).
- For functions that are no longer affected by IGNORE_SPACE as
- of MySQL 5.1.13, that strategy no longer works. Either of the
- following approaches can be used if you have code that is
- subject to the preceding incompatibility:
+ To perform a standard minimal installation, install the server and
+ client RPMs:
+shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm
+shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
- + If a stored function has a name that conflicts with a
- built-in function, refer to the stored function with a
- schema name qualifier, regardless of whether whitespace
- is present. For example, write schema_name.PI() or
- schema_name.PI ().
+ To install only the client programs, install just the client RPM:
+shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
- + Alternatively, rename the stored function to use a
- nonconflicting name and change invocations of the
- function to use the new name.
+ RPM provides a feature to verify the integrity and authenticity of
+ packages before installing them. If you would like to learn more
+ about this feature, see Section 2.1.4, "Verifying Package
+ Integrity Using MD5 Checksums or GnuPG."
- * Incompatible change: For utf8 columns, the full-text parser
- incorrectly considered several nonword punctuation and
- whitespace characters as word characters, causing some
- searches to return incorrect results. The fix involves a
- change to the full-text parser in MySQL 5.1.12, so as of
- 5.1.12, any tables that have FULLTEXT indexes on utf8 columns
- must be repaired with REPAIR TABLE:
-REPAIR TABLE tbl_name QUICK;
+ The server RPM places data under the /var/lib/mysql directory. The
+ RPM also creates a login account for a user named mysql (if one
+ does not exist) to use for running the MySQL server, and creates
+ the appropriate entries in /etc/init.d/ to start the server
+ automatically at boot time. (This means that if you have performed
+ a previous installation and have made changes to its startup
+ script, you may want to make a copy of the script so that you
+ don't lose it when you install a newer RPM.) See Section 2.13.1.2,
+ "Starting and Stopping MySQL Automatically," for more information
+ on how MySQL can be started automatically on system startup.
- * Incompatible change: Storage engines can be pluggable at
- runtime, so the distinction between disabled and invalid
- storage engines no longer applies. As of MySQL 5.1.12, this
- affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in
- Section 5.1.8, "Server SQL Modes."
+ If you want to install the MySQL RPM on older Linux distributions
+ that do not support initialization scripts in /etc/init.d
+ (directly or via a symlink), you should create a symbolic link
+ that points to the location where your initialization scripts
+ actually are installed. For example, if that location is
+ /etc/rc.d/init.d, use these commands before installing the RPM to
+ create /etc/init.d as a symbolic link that points there:
+shell> cd /etc
+shell> ln -s rc.d/init.d .
- * Incompatible change: The structure of FULLTEXT indexes has
- been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or
- greater, any tables that have FULLTEXT indexes must be
- repaired with REPAIR TABLE:
-REPAIR TABLE tbl_name QUICK;
+ However, all current major Linux distributions should support the
+ new directory layout that uses /etc/init.d, because it is required
+ for LSB (Linux Standard Base) compliance.
- * Incompatible change: In MySQL 5.1.6, when log tables were
- implemented, the default log destination for the general query
- and slow query log was TABLE. As of MySQL 5.1.21, this default
- has been changed to FILE, which is compatible with MySQL 5.0,
- but incompatible with earlier releases of MySQL 5.1. If you
- are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging
- option changes should be necessary. However, if you are
- upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and
- were using TABLE logging, use the --log-output=TABLE option
- explicitly to preserve your server's table-logging behavior.
+ If the RPM files that you install include MySQL-server, the mysqld
+ server should be up and running after installation. You should be
+ able to start using MySQL.
- * Incompatible change: For ENUM columns that had enumeration
- values containing commas, the commas were mapped to 0xff
- internally. However, this rendered the commas
- indistinguishable from true 0xff characters in the values.
- This no longer occurs. However, the fix requires that you dump
- and reload any tables that have ENUM columns containing true
- 0xff in their values: Dump the tables using mysqldump with the
- current server before upgrading from a version of MySQL 5.1
- older than 5.1.15 to version 5.1.15 or newer.
+ If something goes wrong, you can find more information in the
+ binary installation section. See Section 2.2, "Installing MySQL
+ from Generic Binaries on Unix/Linux."
- * As of MySQL 5.1.12, the lc_time_names system variable
- specifies the locale that controls the language used to
- display day and month names and abbreviations. This variable
- affects the output from the DATE_FORMAT(), DAYNAME() and
- MONTHNAME() functions. See Section 9.8, "MySQL Server Locale
- Support."
+Note
- * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes
- mysqld-max if it exists. Instead, it invokes mysqld unless a
- --mysqld or --mysqld-version option is given to specify
- another server explicitly. If you previously relied on the
- implicit invocation of mysqld-max, you should use an
- appropriate option now. As of MySQL 5.1.12, there is no longer
- any separate mysqld-max server, so no change should be
- necessary.
+ The accounts that are listed in the MySQL grant tables initially
+ have no passwords. After starting the server, you should set up
+ passwords for them using the instructions in Section 2.13,
+ "Post-Installation Setup and Testing."
- SQL Changes:
+ During RPM installation, a user named mysql and a group named
+ mysql are created on the system. This is done using the useradd,
+ groupadd, and usermod commands. Those commands require appropriate
+ administrative privileges, which is ensured for locally managed
+ users and groups (as listed in the /etc/passwd and /etc/group
+ files) by the RPM installation process being run by root.
- * Known issue: Prior to MySQL 5.1.17, the parser accepted
- invalid code in SQL condition handlers, leading to server
- crashes or unexpected execution behavior in stored programs.
- Specifically, the parser allowed a condition handler to refer
- to labels for blocks that enclose the handler declaration.
- This was incorrect because block label scope does not include
- the code for handlers declared within the labeled block.
- As of 5.1.17, the parser rejects this invalid construct, but
- if you perform a binary upgrade (without dumping and reloading
- your databases), existing handlers that contain the construct
- still are invalid and should be rewritten even if they appear
- to function as you expect.
- To find affected handlers, use mysqldump to dump all stored
- procedures and functions, triggers, and events. Then attempt
- to reload them into an upgraded server. Handlers that contain
- illegal label references will be rejected.
- For more information about condition handlers and writing them
- to avoid invalid jumps, see Section 12.8.4.2, "DECLARE for
- Handlers."
+ For nonlocal user management (LDAP, NIS, and so forth), the
+ administrative tools may require additional authentication (such
+ as a password), and will fail if the installing user does not
+ provide this authentication. Even if they fail, the RPM
+ installation will not abort but succeed, and this is intentional.
+ If they failed, some of the intended transfer of ownership may be
+ missing, and it is recommended that the system administrator then
+ manually ensures some appropriate user andgroup exists and
+ manually transfers ownership following the actions in the RPM spec
+ file.
- * Incompatible change: The parser accepted statements that
- contained /* ... */ that were not properly closed with */,
- such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that
- contain unclosed /*-comments now are rejected with a syntax
- error.
- This fix has the potential to cause incompatibilities. Because
- of Bug#26302: http://bugs.mysql.com/26302, which caused the
- trailing */ to be truncated from comments in views, stored
- routines, triggers, and events, it is possible that objects of
- those types may have been stored with definitions that now
- will be rejected as syntactically invalid. Such objects should
- be dropped and re-created so that their definitions do not
- contain truncated comments.
+2.7. Installing MySQL on Mac OS X
- * Incompatible change: Multiple-table DELETE statements
- containing ambiguous aliases could have unintended side
- effects such as deleting rows from the wrong table. Example:
-DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
- As of MySQL 5.1.23, alias declarations can be declared only in
- the table_references part. Elsewhere in the statement, alias
- references are allowed but not alias declarations. Statements
- containing aliases that are no longer allowed must be
- rewritten.
+ MySQL for Mac OS X is available in a number of different forms:
- * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is
- still accepted as a synonym for the ENGINE = engine_name table
- option but generates a warning. You should note that this
- option is not available in MySQL 5.1.7, and is removed
- altogether as of MySQL 6.0 and produces a syntax error.
- TYPE has been deprecated since MySQL 4.0.
+ * Native Package Installer format, which uses the native Mac OS
+ X installer to walk you through the installation of MySQL. For
+ more information, see Section 2.7.1, "Installing MySQL Using
+ the Installation Package." You can use the package installer
+ with Mac OS X 10.3 and later, and available for both PowerPC
+ and Intel architectures, and both 32-bit and 64-bit
+ architectures. There is no Universal Binary available using
+ the package installation method. The user you use to perform
+ the installation must have administrator privileges.
+
+ * Tar package format, which uses a file packaged using the Unix
+ tar and gzip commands. To use this method, you will need to
+ open a Terminal window. You do not need administrator
+ privileges using this method, as you can install the MySQL
+ server anywhere using this method. For more information on
+ using this method, you can use the generic instructions for
+ using a tarball, Section 2.2, "Installing MySQL from Generic
+ Binaries on Unix/Linux."You can use the package installer with
+ Mac OS X 10.3 and later, and available for both PowerPC and
+ Intel architectures, and both 32-bit and 64-bit architectures.
+ A Universal Binary, incorporating both Power PC and Intel
+ architectures and 32-bit and 64-bit binaries is available.
+ In addition to the core installation, the Package Installer
+ also includes Section 2.7.2, "Installing the MySQL Startup
+ Item" and Section 2.7.3, "Installing and Using the MySQL
+ Preference Pane," both of which simplify the management of
+ your installation.
+
+ * Mac OS X server includes a version of MySQL as standard. If
+ you want to use a more recent version than that supplied with
+ the Mac OS X server release, you can make use of the package
+ or tar formats. For more information on using the MySQL
+ bundled with Mac OS X, see Section 2.7.4, "Using MySQL on Mac
+ OS X Server."
- * Incompatible change: The namespace for triggers changed in
- MySQL 5.0.10. Previously, trigger names had to be unique per
- table. Now they must be unique within the schema (database).
- An implication of this change is that DROP TRIGGER syntax now
- uses a schema name instead of a table name (schema name is
- optional and, if omitted, the current schema will be used).
- When upgrading from a version of MySQL 5 older than 5.0.10 to
- MySQL 5.0.10 or newer, you must drop all triggers and
- re-create them or DROP TRIGGER will not work after the
- upgrade. Here is a suggested procedure for doing this:
+ For additional information on using MySQL on Mac OS X, see Section
+ 2.7.5, "MySQL Installation on Mac OS X Notes."
- 1. Upgrade to MySQL 5.0.10 or later to be able to access
- trigger information in the INFORMATION_SCHEMA.TRIGGERS
- table. (This should work even for pre-5.0.10 triggers.)
+2.7.1. Installing MySQL Using the Installation Package
- 2. Dump all trigger definitions using the following SELECT
- statement:
-SELECT CONCAT('CREATE TRIGGER ', t.TRIGGER_SCHEMA, '.', t.TRIGGER_NAM
-E,
- ' ', t.ACTION_TIMING, ' ', t.EVENT_MANIPULATION, ' ON '
-,
- t.EVENT_OBJECT_SCHEMA, '.', t.EVENT_OBJECT_TABLE,
- ' FOR EACH ROW ', t.ACTION_STATEMENT, '//' )
-INTO OUTFILE '/tmp/triggers.sql'
-FROM INFORMATION_SCHEMA.TRIGGERS AS t;
- The statement uses INTO OUTFILE, so you must have the
- FILE privilege. The file will be created on the server
- host. Use a different file name if you like. To be 100%
- safe, inspect the trigger definitions in the triggers.sql
- file, and perhaps make a backup of the file.
+ You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
+ using a Mac OS X binary package in PKG format instead of the
+ binary tarball distribution. Please note that older versions of
+ Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this
+ package.
- 3. Stop the server and drop all triggers by removing all
- .TRG files in your database directories. Change location
- to your data directory and issue this command:
-shell> rm */*.TRG
+ The package is located inside a disk image (.dmg) file that you
+ first need to mount by double-clicking its icon in the Finder. It
+ should then mount the image and display its contents.
- 4. Start the server and re-create all triggers using the
- triggers.sql file:
-mysql> delimiter // ;
-mysql> source /tmp/triggers.sql //
+Note
- 5. Check that all triggers were successfully created using
- the SHOW TRIGGERS statement.
+ Before proceeding with the installation, be sure to shut down all
+ running MySQL server instances by either using the MySQL Manager
+ Application (on Mac OS X Server) or via mysqladmin shutdown on the
+ command line.
- * Incompatible change: MySQL 5.1.6 introduces the TRIGGER
- privilege. Previously, the SUPER privilege was needed to
- create or drop triggers. Now those operations require the
- TRIGGER privilege. This is a security improvement because you
- no longer need to grant users the SUPER privilege to enable
- them to create triggers. However, the requirement that the
- account named in a trigger's DEFINER clause must have the
- SUPER privilege has changed to a requirement for the TRIGGER
- privilege. When upgrading from a previous version of MySQL 5.0
- or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant
- tables by running mysql_upgrade. This will assign the TRIGGER
- privilege to all accounts that had the SUPER privilege. If you
- fail to update the grant tables, triggers may fail when
- activated. After updating the grant tables, you can revoke the
- SUPER privilege from those accounts that no longer otherwise
- require it.
+ When installing from the package version, you should also install
+ the MySQL Preference Pane, which will allow you to control the
+ startup and execution of your MySQL server from System
+ Preferences. For more information, see Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+ When installing using the package installer, the files are
+ installed into a directory within /usr/local matching the name of
+ the installation version and platform. For example, the installer
+ file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
+ /usr/local/mysql-5.1.39-osx10.5-x86_64 . The installation layout
+ of the directory is as shown in the following table:
+ Directory Contents of Directory
+ bin Client programs and the mysqld server
+ data Log files, databases
+ docs Manual in Info format
+ include Include (header) files
+ lib Libraries
+ man Unix manual pages
+ mysql-test MySQL test suite
+ scripts Contains the mysql_install_db script
+ share/mysql Error message files
+ sql-bench Benchmarks
+ support-files Scripts and sample configuration files
+ /tmp/mysql.sock The location of the MySQL Unix socket
+
+ During the package installer process, a symbolic link from
+ /usr/local/mysql to the version/platform specific directory
+ created during installation will be created automatically.
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQL installer package. It will be named
+ according to the version of MySQL you have downloaded. For
+ example, if you have downloaded MySQL 5.1.39, double-click
+ mysql-5.1.39-osx10.5-x86.pkg.
+
+ 3. You will be presented with the openin installer dialog. Click
+ Continue to begihn installation.
+ MySQL Package Installer: Step 1
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. If you have downloaded the community version of MySQL, you
+ will be shown a copy of the relevent GNU General Public
+ License. Click Continue .
+
+ 6. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Package Installer: Step 4
+
+ 7. You will be asked to confirm the details of the installation,
+ including the space required for the installation. To change
+ the drive on which the startup item is installed you can click
+ either Go Back or Change Install Location.... To install the
+ startup item, click Install.
- * Some keywords are reserved in MySQL 5.1 that were not reserved
- in MySQL 5.0. See Section 8.3, "Reserved Words."
+ 8. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
- * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER
- statements are deprecated. See Section 12.6.2.2, "LOAD DATA
- FROM MASTER Syntax," for recommended alternatives.
+ Once you have completed the basic installation, you must complete
+ the post-installation steps as specifed in Section 2.13,
+ "Post-Installation Setup and Testing."
- * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are
- used for the plugin API are new. So is the WITH PARSER clause
- for FULLTEXT index creation that associates a parser plugin
- with a full-text index. Section 22.2, "The MySQL Plugin
- Interface."
+ For convenience, you may also want to install the Section 2.7.2,
+ "Installing the MySQL Startup Item" and Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+2.7.2. Installing the MySQL Startup Item
+
+ The MySQL Installation Package includes a startup item that can be
+ used to automatically startup and shutdown MySQL during boot.
+
+ To install the MySQL Startup Item:
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQLStartItem.pkg file to start the
+ installation process.
+
+ 3. You will be presented with the Install MySQL Startup Item
+ dialog.
+ MySQL Startup Item Installer: Step 1
+ Click Continue to continue the installation process.
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Startup Item Installer: Step 3
+
+ 6. You will be asked to confirm the details of the installation.
+ To change the drive on which the startup item is installed you
+ can click either Go Back or Change Install Location.... To
+ install the startup item, click Install.
+
+ 7. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
+ MySQL Startup Item Installer: Step 5
- C API Changes:
+ The Startup Item for MySQL is installed into
+ /Library/StartupItems/MySQLCOM. The Startup Item installation adds
+ a variable MYSQLCOM=-YES- to the system configuration file
+ /etc/hostconfig. If you want to disable the automatic startup of
+ MySQL, simply change this variable to MYSQLCOM=-NO-.
- * Incompatible change: As of MySQL 5.1.7, the
- mysql_stmt_attr_get() C API function returns a boolean rather
- than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH.
- (Bug#16144: http://bugs.mysql.com/16144)
+ After the installation, you can start up MySQL by running the
+ following commands in a terminal window. You must have
+ administrator privileges to perform this task.
-2.12.2. Downgrading MySQL
+ If you have installed the Startup Item, use this command to start
+ the server:
+shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
- This section describes what you should do to downgrade to an older
- MySQL version in the unlikely case that the previous version
- worked better than the new one.
+ You may be prompted for your password to complete the startup.
- If you are downgrading within the same release series (for
- example, from 5.0.13 to 5.0.12) the general rule is that you just
- have to install the new binaries on top of the old ones. There is
- no need to do anything with the databases. As always, however, it
- is always a good idea to make a backup.
+ If you have installed the Startup Item, use this command to stop
+ the server:
+shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
+
+ You may be prompted for your password to complete the shutdown.
+
+2.7.3. Installing and Using the MySQL Preference Pane
+
+ The MySQL Package installer disk image also includes a custom
+ MySQL Preference Pane that enables you to start, stop and control
+ automated startup during boot of your MySQL installation.
+
+ To install the MySQL Preference Pane:
+
+ 1. Download and open the MySQL package installer package, which
+ is provided on a disk image (.dmg). Double-click to open the
+ disk image, which includes the main MySQL installation
+ package, the MySQLStartupItem.pkg installation package, and
+ the MySQL.prefPane.
+
+ 2. Double click on MySQL.prefPane. The MySQL System Preferences
+ will open.
+
+ 3. If this is the first time you have installed the preference
+ pane, you will be asked to confirm installation and whether
+ you want to install the preference pane for all users, or only
+ the current user. To install the preference pane for all users
+ you will need administrator privileges. If necessary, you will
+ be prompted for the username and password for a user with
+ administrator privileges.
+
+ 4. If you already have the MySQL Preference Pane installed, you
+ will be asked to confirm whether you want to overwrite the
+ existing MySQL Preference Pane.
- The following items form a checklist of things you should do
- whenever you perform a downgrade:
+Note
- * Read the upgrading section for the release series from which
- you are downgrading to be sure that it does not have any
- features you really need. See Section 2.12.1, "Upgrading
- MySQL."
+ The MySQL Preference Pane only starts and stops MySQL installation
+ installed from the MySQL package installation that have been
+ installed in the default location.
+
+ Once the MySQL Preference Pane has been installed, you can control
+ your MySQL server instance using the preference pane. To use the
+ preference pane, open the System Preferences... from the Apple
+ menu. Select the MySQL preference pane by clicking on the MySQL
+ logo within the Other section of the preference panes list.
+ MySQL Preference Pane
+
+ The MySQL Preference Pane shows the current status of the MySQL
+ server, showing stopped (in red) if the server is not running and
+ running (in green) if the server has already been started. The
+ preference pane will also show the current setting for whether the
+ MySQL server has been set to start up automatically.
+
+ * To start MySQL using the preference pane:
+ Click Start MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to start
+ the MySQL server.
+
+ * To stop MySQL using the preference pane:
+ Click Stop MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to
+ shutdown the MySQL server.
+
+ * To automatically start the MySQL server when the system boots:
+ Check the checkbox next to Automatically Start MySQL Server on
+ Startup.
+
+ * To disable the automatic starting of the MySQL server when the
+ system boots:
+ Uncheck the checkbox next to Automatically Start MySQL Server
+ on Startup.
- * If there is a downgrading section for that version, you should
- read that as well.
+ You can close the System Preferences... once you have completed
+ your settings.
- * To see which new features were added between the version to
- which you are downgrading and your current version, see the
- change logs (Appendix C, "MySQL Change History").
+2.7.4. Using MySQL on Mac OS X Server
- * Check Section 2.12.3, "Checking Whether Table Indexes Must Be
- Rebuilt," to see whether changes to character sets or
- collations were made between your current version of MySQL and
- the version to which you are downgrading. If so and these
- changes affect your table indexes, you will need to rebuild
- the affected indexes using the instructions in Section 2.12.4,
- "Rebuilding or Repairing Tables or Indexes."
+ If you are running Mac OS X Server, a version of MySQL should
+ already be installed. The following table shows the versions of
+ MySQL that ship with Mac OS X Server versions.
+ Mac OS X Server Version MySQL Version
+ 10.2-10.2.2 3.23.51
+ 10.2.3-10.2.6 3.23.53
+ 10.3 4.0.14
+ 10.3.2 4.0.16
+ 10.4.0 4.1.10a
+ 10.5.0 5.0.45
+ 10.6.0 5.0.82
- In most cases, you can move the MySQL format files and data files
- between different versions on the same architecture as long as you
- stay within versions for the same release series of MySQL.
+ The installation layout of MySQL on Mac OS X Server is as shown in
+ the table below:
+ Directory Contents of Directory
+ /usr/bin Client programs
+ /var/mysql Log files, databases
+ /usr/libexec The mysqld server
+ /usr/share/man Unix manual pages
+ /usr/share/mysql/mysql-test MySQL test suite
+ /usr/share/mysql Contains the mysql_install_db script
+ /var/mysql/mysql.sock The location of the MySQL Unix socket
- If you downgrade from one release series to another, there may be
- incompatibilities in table storage formats. In this case, use
- mysqldump to dump your tables before downgrading. After
- downgrading, reload the dump file using mysql or mysqlimport to
- re-create your tables. For examples, see Section 2.12.5, "Copying
- MySQL Databases to Another Machine."
+Note
- A typical symptom of a downward-incompatible table format change
- when you downgrade is that you cannot open tables. In that case,
- use the following procedure:
+ The MySQL server bundled with Mac OS X Server does not include the
+ MySQL client libraries and header files required if you want to
+ access and use MySQL from a third-party driver, such as Perl DBI
+ or PHP. For more information on obtaining and installing MySQL
+ libraries, see Mac OS X Server version 10.5: MySQL libraries
+ available for download (http://support.apple.com/kb/TA25017)
+ Alternatively, you can ignore the bundled MySQL server and install
+ MySQL from the package or tarball installation.
+
+ For more information on managing the bundled MySQL instance in Mac
+ OS X Server 10.5, see Mac OS X Server: Web Technologies
+ Administration For Version 10.5 Leopard
+ (http://images.apple.com/server/macosx/docs/Web_Technologies_Admin
+ _v10.5.pdf). For more information on managing the bundled MySQL
+ instance in Mac OS X Server 10.6, see Mac OS X Server: Web
+ Technologies Administration Version 10.6 Snow Leopard
+ (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf)
+
+2.7.5. MySQL Installation on Mac OS X Notes
+
+ You should keep the following issues and notes in mind:
+
+ * The default location for the MySQL Unix socket is different on
+ Mac OS X and Mac OS X Server depending on the installation
+ type you chose. The default locations by installation are as
+ follows:
- 1. Stop the older MySQL server that you are downgrading to.
+ Package Installer from MySQL /tmp/mysql.sock
+ Tarball from MySQL /tmp/mysql.sock
+ MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
+ To prevent issues, you should either change the configuration
+ of the socket used within your application (for example,
+ changing php.ini), or you should configure the socket location
+ using a MySQL configuration file and the socket option. For
+ more information, see Section 5.1.2, "Server Command Options."
+
+ * You may need (or want) to create a specific mysql user to own
+ the MySQL directory and data. On Mac OS X 10.4 and lower you
+ can do this by using the Netinfo Manager application, located
+ within the Utilities folder within the Applications folder. On
+ Mac OS X 10.5 and later you can do this through the Directory
+ Utility. From Mac OS X 10.5 and later (including Mac OS X
+ Server 10.5) the mysql should already exist. For use in single
+ user mode, an entry for _mysql (note the underscore prefix)
+ should already exist within the system /etc/passwd file.
- 2. Restart the newer MySQL server you are downgrading from.
+ * Due to a bug in the Mac OS X package installer, you may see
+ this error message in the destination disk selection dialog:
+You cannot install this software on this disk. (null)
+ If this error occurs, simply click the Go Back button once to
+ return to the previous screen. Then click Continue to advance
+ to the destination disk selection again, and you should be
+ able to choose the destination disk correctly. We have
+ reported this bug to Apple and it is investigating this
+ problem.
+
+ * Because the MySQL package installer installs the MySQL
+ contents into a version and platform specific directory, you
+ can use this to upgrade and migrate your database between
+ versions. You will need to either copy the data directory from
+ the old version to the new version, or alternatively specify
+ an alternative datadir value to set location of the data
+ directory.
- 3. Dump any tables that were inaccessible to the older server by
- using mysqldump to create a dump file.
+ * You might want to add aliases to your shell's resource file to
+ make it easier to access commonly used programs such as mysql
+ and mysqladmin from the command line. The syntax for bash is:
+alias mysql=/usr/local/mysql/bin/mysql
+alias mysqladmin=/usr/local/mysql/bin/mysqladmin
+ For tcsh, use:
+alias mysql /usr/local/mysql/bin/mysql
+alias mysqladmin /usr/local/mysql/bin/mysqladmin
+ Even better, add /usr/local/mysql/bin to your PATH environment
+ variable. You can do this by modifying the appropriate startup
+ file for your shell. For more information, see Section 4.2.1,
+ "Invoking MySQL Programs."
+
+ * After you have copied over the MySQL database files from the
+ previous installation and have successfully started the new
+ server, you should consider removing the old installation
+ files to save disk space. Additionally, you should also remove
+ older versions of the Package Receipt directories located in
+ /Library/Receipts/mysql-VERSION.pkg.
- 4. Stop the newer MySQL server and restart the older one.
+2.8. Installing MySQL on Solaris
- 5. Reload the dump file into the older server. Your tables should
- be accessible.
+ To obtain a binary MySQL distribution for Solaris in tarball or
+ PKG format, http://dev.mysql.com/downloads/mysql/5.1.html.
- It might also be the case that the structure of the system tables
- in the mysql database has changed and that downgrading introduces
- some loss of functionality or requires some adjustments. Here are
- some examples:
+ If you install MySQL using a binary tarball distribution on
+ Solaris, you may run into trouble even before you get the MySQL
+ distribution unpacked, as the Solaris tar cannot handle long file
+ names. This means that you may see errors when you try to unpack
+ MySQL.
- * Trigger creation requires the TRIGGER privilege as of MySQL
- 5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is
- required instead. If you downgrade from MySQL 5.1 to 5.0, you
- will need to give the SUPER privilege to those accounts that
- had the TRIGGER privilege in 5.1.
+ If this occurs, you must use GNU tar (gtar) to unpack the
+ distribution.
- * Triggers were added in MySQL 5.0, so if you downgrade from 5.0
- to 4.1, you cannot use triggers at all.
+ You can install MySQL on Solaris using a binary package in PKG
+ format instead of the binary tarball distribution. Before
+ installing using the binary PKG format, you should create the
+ mysql user and group, for example:
+groupadd mysql
+useradd -g mysql mysql
-2.12.2.1. Downgrading to MySQL 5.0
+ Some basic PKG-handling commands follow:
- When downgrading to MySQL 5.0 from MySQL 5.1 or a later version,
- you should keep in mind the following issues relating to features
- found in MySQL 5.1 and later, but not in MySQL 5.0:
+ * To add a package:
+pkgadd -d package_name.pkg
- * Partitioning. MySQL 5.0 does not support user-defined
- partitioning. If a table was created as a partitioned table in
- 5.1 (or if an table created in a previous version of MySQL was
- altered to include partitions after an upgrade to 5.1), the
- table is accessible after downgrade only if you do one of the
- following:
+ * To remove a package:
+pkgrm package_name
- + Export the table using mysqldump and then drop it in
- MySQL 5.1; import the table again following the downgrade
- to MySQL 5.0.
+ * To get a full list of installed packages:
+pkginfo
- + Prior to the downgrade, remove the table's partitioning
- using ALTER TABLE table_name REMOVE PARTITIONING.
+ * To get detailed information for a package:
+pkginfo -l package_name
- * Event Scheduler. MySQL 5.0 does not support scheduled events.
- If your databases contain scheduled event definitions, you
- should prevent them from being dumped when you use mysqldump
- by using the --skip-events option. (See Section 4.5.4,
- "mysqldump --- A Database Backup Program.")
+ * To list the files belonging to a package:
+pkgchk -v package_name
- * Stored routines. MySQL 5.1.21 added a number of new columns
- to the mysql.proc table in which stored routine definitions
- are stored. If you are downgrading from MySQL 5.1.21 or later
- to MySQL 5.0, you cannot import the MySQL 5.1 routine
- definitions into MySQL 5.0.46 or earlier using the dump of
- mysql.proc created by mysqldump (such as when using the
- --all-databases option). Instead, you should run mysqldump
- --routines prior to performing the downgrade and run the
- stored routines DDL statements following the downgrade.
- See Bug#11986: http://bugs.mysql.com/11986,
- Bug#30029: http://bugs.mysql.com/30029, and
- Bug#30660: http://bugs.mysql.com/30660, for more information.
+ * To get packaging information for an arbitrary file:
+pkgchk -l -p file_name
- * Triggers. Trigger creation requires the TRIGGER privilege as
- of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and
- SUPER is required instead. If you downgrade from MySQL 5.1 to
- 5.0, you will need to give the SUPER privilege to those
- accounts that had the TRIGGER privilege in 5.1.
+2.8.1. Solaris Notes
-2.12.3. Checking Whether Table Indexes Must Be Rebuilt
+ For information about installing MySQL on Solaris using PKG
+ distributions, see Section 2.8, "Installing MySQL on Solaris."
- A binary upgrade or downgrade is one that installs one version of
- MySQL "in place" over an existing version, without dumping and
- reloading tables:
+ On Solaris, you may run into trouble even before you get the MySQL
+ distribution unpacked, as the Solaris tar cannot handle long file
+ names. This means that you may see errors when you try to unpack
+ MySQL.
- 1. Stop the server for the existing version if it is running.
+ If this occurs, you must use GNU tar (gtar) to unpack the
+ distribution.
- 2. Install a different version of MySQL. This is an upgrade if
- the new version is higher than the original version, a
- downgrade if the version is lower.
+ If you have an UltraSPARC system, you can get 4% better
+ performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the CFLAGS
+ and CXXFLAGS environment variables.
- 3. Start the server for the new version.
+ If you have Sun's Forte 5.0 (or newer) compiler, you can run
+ configure like this:
+CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
+CXX=CC CXXFLAGS="-noex -mt" \
+./configure --prefix=/usr/local/mysql --enable-assembler
- In many cases, the tables from the previous version of MySQL can
- be used without change by the new version. However, sometimes
- modifications are made to the handling of character sets or
- collations that change the character sort order, which causes the
- ordering of entries in any index that uses an affected character
- set or collation to be incorrect. Such changes result in several
- possible problems:
+ To create a 64-bit binary with Sun's Forte compiler, use the
+ following configuration options:
+CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
+CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
+./configure --prefix=/usr/local/mysql --enable-assembler
- * Comparison results that differ from previous results
+ To create a 64-bit Solaris binary using gcc, add -m64 to CFLAGS
+ and CXXFLAGS and remove --enable-assembler from the configure
+ line.
- * Inability to find some index values due to misordered index
- entries
+ In the MySQL benchmarks, we obtained a 4% speed increase on
+ UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
+ using gcc 3.2 with the -mcpu flag.
- * Misordered ORDER BY results
+ If you create a 64-bit mysqld binary, it is 4% slower than the
+ 32-bit binary, but can handle more threads and memory.
- * Tables that CHECK TABLE reports as being in need of repair
+ When using Solaris 10 for x86_64, you should mount any file
+ systems on which you intend to store InnoDB files with the
+ forcedirectio option. (By default mounting is done without this
+ option.) Failing to do so will cause a significant drop in
+ performance when using the InnoDB storage engine on this platform.
- The solution to these problems is to rebuild any indexes that use
- an affected character set or collation, either by dropping and
- re-creating the indexes, or by dumping and reloading the entire
- table. For information about rebuilding indexes, see Section
- 2.12.4, "Rebuilding or Repairing Tables or Indexes."
+ If you get a problem with fdatasync or sched_yield, you can fix
+ this by adding LIBS=-lrt to the configure line
- To check whether a table has indexes that must be rebuilt, consult
- the following list. It indicates which versions of MySQL
- introduced character set or collation changes that require indexes
- to be rebuilt. Each entry indicates the version in which the
- change occurred and the character sets or collations that the
- change affects. If the change is associated with a particular bug
- report, the bug number is given.
+ Solaris does not provide static versions of all system libraries
+ (libpthreads and libdl), so you cannot compile MySQL with
+ --static. If you try to do so, you get one of the following
+ errors:
+ld: fatal: library -ldl: not found
+undefined reference to `dlopen'
+cannot find -lrt
+
+ If you link your own MySQL client programs, you may see the
+ following error at runtime:
+ld.so.1: fatal: libmysqlclient.so.#:
+open failed: No such file or directory
+
+ This problem can be avoided by one of the following methods:
+
+ * Link clients with the -Wl,r/full/path/to/libmysqlclient.so
+ flag rather than with -Lpath).
- The list applies both for binary upgrades and downgrades. For
- example, Bug#29461: http://bugs.mysql.com/29461 was fixed in MySQL
- 5.0.48, so it applies to upgrades from versions older than 5.0.48
- to 5.0.48 or newer, and also to downgrades from 5.0.48 or newer to
- versions older than 5.0.48.
+ * Copy libmysqclient.so to /usr/lib.
- If you have tables with indexes that are affected, rebuild the
- indexes using the instructions given in Section 2.12.4,
- "Rebuilding or Repairing Tables or Indexes."
+ * Add the path name of the directory where libmysqlclient.so is
+ located to the LD_RUN_PATH environment variable before running
+ your client.
- In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify
- tables for which index rebuilding is required. (It will report:
- Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or
- dump/reload to fix it!) In these cases, you can also use
- mysqlcheck --check-upgrade or mysql_upgrade, which execute CHECK
- TABLE. However, the use of CHECK TABLE applies only after
- upgrades, not downgrades. Also, CHECK TABLE is not applicable to
- all storage engines. For details about which storage engines CHECK
- TABLE supports, see Section 12.5.2.3, "CHECK TABLE Syntax."
+ If you have problems with configure trying to link with -lz when
+ you don't have zlib installed, you have two options:
- Changes that cause index rebuilding to be necessary:
+ * If you want to be able to use the compressed communication
+ protocol, you need to get and install zlib from ftp.gnu.org.
- * MySQL 5.0.48 (Bug#29461: http://bugs.mysql.com/29461)
- Affects indexes for columns that use any of these character
- sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 6.0.8 (see
- Bug#39585: http://bugs.mysql.com/39585)
+ * Run configure with the --with-named-z-libs=no option when
+ building MySQL.
- * MySQL 5.0.48 (Bug#27562: http://bugs.mysql.com/27562)
- Affects indexes that use the ascii_general_ci collation for
- columns that contain any of these characters: '`' GRAVE
- ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
- RIGHT SQUARE BRACKET, '~' TILDE
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 6.0.8 (see
- Bug#39585: http://bugs.mysql.com/39585)
+ If you are using gcc and have problems with loading user-defined
+ functions (UDFs) into MySQL, try adding -lgcc to the link line for
+ the UDF.
- * MySQL 5.1.21 (Bug#29461: http://bugs.mysql.com/29461)
- Affects indexes for columns that use any of these character
- sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 6.0.8 (see
- Bug#39585: http://bugs.mysql.com/39585)
+ If you would like MySQL to start automatically, you can copy
+ support-files/mysql.server to /etc/init.d and create a symbolic
+ link to it named /etc/rc3.d/S99mysql.server.
- * MySQL 5.1.23 (Bug#27562: http://bugs.mysql.com/27562)
- Affects indexes that use the ascii_general_ci collation for
- columns that contain any of these characters: '`' GRAVE
- ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
- RIGHT SQUARE BRACKET, '~' TILDE
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 6.0.8 (see
- Bug#39585: http://bugs.mysql.com/39585)
+ If too many processes try to connect very rapidly to mysqld, you
+ should see this error in the MySQL log:
+Error in accept: Protocol error
- * MySQL 5.1.24 (Bug#27877: http://bugs.mysql.com/27877)
- Affects indexes that use the utf8_general_ci or
- ucs2_general_ci collation for columns that contain 'ß' LATIN
- SMALL LETTER SHARP S (German).
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.30, 6.0.8 (see
- Bug#40053: http://bugs.mysql.com/40053)
+ You might try starting the server with the --back_log=50 option as
+ a workaround for this. (Use -O back_log=50 before MySQL 4.)
- * * MySQL 6.0.1 (WL#3664)
- Affects indexes that use the latin2_czech_cs collation.
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.4.4, 6.0.9 (see
- Bug#40054: http://bugs.mysql.com/40054)
- MySQL 6.0.5 (Bug#33452: http://bugs.mysql.com/33452)
- Affects indexes that use the latin2_czech_cs collation.
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.4.4, 6.0.9 (see
- Bug#40054: http://bugs.mysql.com/40054)
+ To configure the generation of core files on Solaris you should
+ use the coreadm command. Because of the security implications of
+ generating a core on a setuid() application, by default, Solaris
+ does not support core files on setuid() programs. However, you can
+ modify this behavior using coreadm. If you enable setuid() core
+ files for the current user, they will be generated using the mode
+ 600 and owned by the superuser.
- * MySQL 6.0.5 (Bug#27877: http://bugs.mysql.com/27877)
- Affects indexes that use the utf8_general_ci or
- ucs2_general_ci collation for columns that contain 'ß' LATIN
- SMALL LETTER SHARP S (German).
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 6.0.8 (see
- Bug#40053: http://bugs.mysql.com/40053)
+2.9. Installing MySQL on i5/OS
- * MySQL 6.0.6 (Bug#25420: http://bugs.mysql.com/25420)
- Affects indexes for columns that use the following collations,
- if the columns contain the indicated characters:
- big5_chinese_ci: '~' TILDE or '`' GRAVE ACCENT;
- cp866_general_ci: j LATIN SMALL LETTER J; gb2312_chinese_ci:
- '~' TILDE; gbk_chinese_ci: '~' TILDE
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.4.4, 6.0.9 (see
- Bug#40054: http://bugs.mysql.com/40054)
+ The i5/OS POWER MySQL package was created in cooperation with IBM.
+ MySQL works within the Portable Application Solution Environment
+ (PASE) on the System i series of hardware and will also provide
+ database services for the Zend Core for i5/OS.
-2.12.4. Rebuilding or Repairing Tables or Indexes
+ MySQL for i5/OS is provided both as a tar file and as a save file
+ (.savf) package that can be downloaded and installed directly
+ without any additional installation steps required. To install
+ MySQL using the tar file, see Section 2.2, "Installing MySQL from
+ Generic Binaries on Unix/Linux."
- This section describes how to rebuild a table. This can be
- necessitated by changes to MySQL such as how data types are
- handled or changes to character set handling. For example, an
- error in a collation might have been corrected, necessitating a
- table rebuild to rebuild the indexes for character columns that
- use the collation. It might also be that a table repair or upgrade
- should be done as indicated by a table check operation such as
- that performed by CHECK TABLE, mysqlcheck, or mysql_upgrade.
+ MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS
+ PASE must be installed for MySQL to operate. You must be able to
+ login as a user in *SECOFR class.
- Methods for rebuilding a table include dumping and reloading it,
- or using ALTER TABLE or REPAIR TABLE.
+ You should the installation notes and tips for i5/OS before
+ starting installation. See i5/OS Installation Notes.
+
+ Before Installation:
Note
- If you are rebuilding tables because a different version of MySQL
- will not handle them after a binary upgrade or downgrade, you must
- use the dump-and-reload method. Dump the tables before upgrading
- or downgrading (using your original version of MySQL), and reload
- the tables after upgrading or downgrading (after installing the
- new version).
+ The installation package will use an existing configuration if you
+ have previously installed MySQL (which is identified by looking
+ for the file /etc/my.cnf). The values for the data directory
+ (DATADIR) and owner of the MySQL files (USRPRF) specified during
+ the installation will be ignored, and the values determined from
+ the /etc/my.cnf will be used instead.
- If you use the dump-and-reload method of rebuilding tables only
- for the purpose of rebuilding indexes, you can perform the dump
- either before or after upgrading or downgrading. Reloading still
- must be done afterward.
+ If you want to change these parameters during a new install, you
+ should temporarily rename /etc/my.cnf, install MySQL using the new
+ parameters you want to use, and then merge your previous
+ /etc/my.cnf configuration settings with the new /etc/my.cnf file
+ that is created during installation.
- To re-create a table by dumping and reloading it, use mysqldump to
- create a dump file and mysql to reload the file:
-shell> mysqldump db_name t1 > dump.sql
-shell> mysql db_name < dump.sql
+ * You must have a user profile with PASE with suitable
+ privileges. The user should be within the *SECOFR class, such
+ as the QSECOFR user ID. You can use the WRKUSRPRF command to
+ check your user profile.
+
+ * For network connections to MySQL, you must have TCP/IP
+ enabled. You should also check the following:
+
+ + Ensure that a name has defined for the system. Run the
+ Configure TCP/IP (CFGTCP) command and select option 12
+ (Change TCP/IP domain information) to display this
+ setting. Make sure that a value is listed in the Host
+ name field.
- To recreate all the tables in a single database, specify the
- database name without any following table name:
-shell> mysqldump db_name > dump.sql
-shell> mysql db_name < dump.sql
+ + Make sure that the system has a loopback entry which
+ represents the localhost or 127.0.0.1.
- To recreate all tables in all databases, use the --all-databases
- option:
-shell> mysqldump --all-databases > dump.sql
-shell> mysql < dump.sql
+ + Ensure that the IP address of the IBM i machine is mapped
+ correctly to the host name.
- To rebuild a table with ALTER TABLE, use a statement that
- "changes" the table to use the storage engine that it already has.
- For example, if t1 is a MyISAM table, use this statement:
-mysql> ALTER TABLE t1 ENGINE = MyISAM;
+ To install MySQL on i5/OS, follow these steps:
- If you are not sure which storage engine to specify in the ALTER
- TABLE statement, use SHOW CREATE TABLE to display the table
- definition.
+ 1. On the System i machine, create a save file that will be used
+ to receive the downloaded installation save file. The file
+ should be located within the General Purpose Library (QGPL):
+CRTSAVF FILE(QGPL/MYSQLINST) TESXT('MySQL Save file')
- If you must rebuild a table because a table checking operation
- indicates that the table is corrupt or needs an upgrade, you can
- use REPAIR TABLE if that statement supports the table's storage
- engine. For example, to repair a MyISAM table, use this statement:
-mysql> REPAIR TABLE t1;
+ 2. Download the MySQL installation save file in 32-bit
+ (mysql-5.1.39-i5os-power-32bit.savf) or 64-bit
+ (mysql-5.1.39-i5os-power-64bit.savf) from MySQL Downloads
+ (http://dev.mysql.com/downloads)
- For storage engines such as InnoDB that REPAIR TABLE does not
- support, use mysqldump to create a dump file and mysql to reload
- the file, as described earlier.
+ 3. You need to FTP the downloaded .savf file directly into the
+ QGPL/MYSQLINST file on the System i server. You can do this
+ through FTP using the following steps after logging in to the
+ System i machine:
+ftp> bin
+ftp> cd qgpl
+ftp> put mysql-5.1.39-i5os-power.savf mysqlinst
- For specifics about which storage engines REPAIR TABLE supports,
- see Section 12.5.2.6, "REPAIR TABLE Syntax."
+ 4. Log into the System i server using a user in the *SECOFR
+ class, such as the QSECOFR user ID.
-2.12.5. Copying MySQL Databases to Another Machine
+ 5. You need to restore the installation library stored in the
+ .savf save file:
+RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST) MBROPT(*ALL) ALWOBJD
+IF(*ALL)
- You can copy the .frm, .MYI, and .MYD files for MyISAM tables
- between different architectures that support the same
- floating-point format. (MySQL takes care of any byte-swapping
- issues.) See Section 13.5, "The MyISAM Storage Engine."
+Note
+ You can ignore the security changes-type message at the bottom
+ of the installation panel.
- In cases where you need to transfer databases between different
- architectures, you can use mysqldump to create a file containing
- SQL statements. You can then transfer the file to the other
- machine and feed it as input to the mysql client.
+ 6. Once you have finished restoring the MYSQLINST library, check
+ that all the necessary objects for installation are on the
+ system by using the Display Library (DSPLIB) command:
+DSPLIB LIB(MYSQLINST)
- Use mysqldump --help to see what options are available.
+ 7. You need to execute the installation command,
+ MYSQLINST/INSMYSQL. You can specify three parameter settings
+ during installation:
- The easiest (although not the fastest) way to move a database
- between two machines is to run the following commands on the
- machine on which the database is located:
-shell> mysqladmin -h 'other_hostname' create db_name
-shell> mysqldump db_name | mysql -h 'other_hostname' db_name
+ + DIR('/QOpenSys/usr/local/mysql') sets the installation
+ location for the MySQL files. The directory will be
+ created if it does not already exist.
+
+ + DATADIR('/QOpenSys/usr/local/mysql/data') sets the
+ location of the directory that will be used to store the
+ database files and binary logs. The default setting is
+ /QOpenSys/usr/local/mysql/data. Note that if the
+ installer detects an existing installation (due to the
+ existence of /etc/my.cnf), then the existing setting will
+ be used instead of the default.
- If you want to copy a database from a remote machine over a slow
- network, you can use these commands:
-shell> mysqladmin create db_name
-shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na
-me
+ + USRPRF(MYSQL) sets the user profile that will own the
+ files that are installed. The profile will be created if
+ it does not already exist.
- You can also store the dump in a file, transfer the file to the
- target machine, and then load the file into the database there.
- For example, you can dump a database to a compressed file on the
- source machine like this:
-shell> mysqldump --quick db_name | gzip > db_name.gz
+Note
+ You should choose an appropriate user for using the MySQL
+ server installation. The user will be used whenever you
+ need to do any administration on the MySQL server.
+ Once you have set the appropriate parameters, you can begin
+ the installation.
+ The installation copies all the necessary files into a
+ directory matching the DIR configuration value; sets the
+ ownership on those files, sets up the MySQL environment and
+ creates the MySQL configuration file (in /etc/my.cnf)
+ completing all the steps in a typical binary installation
+ process automatically. If this is a new installation of MySQL,
+ or if the installer detects that this is a new version
+ (because the /etc/my.cnf file does not exist), then the
+ initial core MySQL databases will also be created during
+ installation.
+ Once the installation has been completed, you will get a
+ notice advising you to set the password for the root user. For
+ more information, Section 2.13, "Post-Installation Setup and
+ Testing."
- Transfer the file containing the database contents to the target
- machine and run these commands there:
-shell> mysqladmin create db_name
-shell> gunzip < db_name.gz | mysql db_name
+ 8. Once the installation has completed, you can delete the
+ installation file:
+DLTLIB LIB(MYSQLINST)
- You can also use mysqldump and mysqlimport to transfer the
- database. For large tables, this is much faster than simply using
- mysqldump. In the following commands, DUMPDIR represents the full
- path name of the directory you use to store the output from
- mysqldump.
+ Upgrading an existing MySQL instance
- First, create the directory for the output files and dump the
- database:
-shell> mkdir DUMPDIR
-shell> mysqldump --tab=DUMPDIR db_name
+ You need to execute the upgrade command, MYSQLINST/UPGMYSQL. You
+ must specify 6 parameters to perform an upgrade:
- Then transfer the files in the DUMPDIR directory to some
- corresponding directory on the target machine and load the files
- into MySQL there:
-shell> mysqladmin create db_name # create database
-shell> cat DUMPDIR/*.sql | mysql db_name # create tables in databas
-e
-shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables
+ * DIR('/QOpenSys/usr/local/') --- sets the installation location
+ for the MySQL files. The directory will be created if it does
+ not already exist. This is the directory that the MySQL server
+ will be installed into, inside a directory with a name
+ matching the version and release. For example if installing
+ MySQL 5.1.39 with the DIR set to /QOpenSys/usr/local/ would
+ result in /QOpenSys/usr/local/mysql-5.1.39-i5os-power64 and a
+ symbolic link to this directory will be created in
+ /QOpenSys/usr/local/mysql.
+
+ * DATADIR('/QOpenSys/mysql/data') --- sets the location of the
+ directory that will be upgraded.
+
+ * USRPRF('MYSQL') --- sets the user profile that will own the
+ files that are installed. The profile will be created if it
+ does not already exist; if it is created as part of the
+ upgrade process, it will be disabled initially. You may wish
+ to enable this user profile so that it can be used to start
+ the MySQL server later. It is best practice to use the one
+ previously created during the first installation.
+
+ * MYSQLUSR('root user') --- any user account in the current
+ MySQL server with SUPER privileges.
+
+ * PASSWORD('root user password') --- the password for the above
+ account. This is necessary as the upgrade starts the MySQL
+ server to upgrade the tables and the password is need to be
+ able to shutdown the MySQL server.
+
+ * CURINST('path to previous install') --- the full path to the
+ installation that is being upgraded. For example an
+ installation in /QOpenSys/usr/local/ will be
+ /QOpenSys/usr/local/msyql-5.1.30-i5os-power64. Failure to
+ specify this option may result in corruption of your existing
+ data files.
+
+ For example:
+MYSQLINST/UPGMYSQL DIR('/QOpenSys/usr/local/') DATADIR('/QOpenSys/mys
+ql/data') »
+ USERPRF(MYSQL) MYSQLUSR('root') PASSWORD('root') CURINST('/QOpen
+Sys/usr/local/mysql-5.1.30-i5os-power64')
+
+ You should receive a Program Message indicating UPGRADE
+ SUCCESSFUL! upon completion or an error message if there is a
+ problem.You can view the upgrade programs progression and the
+ error in the text file upgrade.log in the installation directory.
- Do not forget to copy the mysql database because that is where the
- grant tables are stored. You might have to run commands as the
- MySQL root user on the new machine until you have the mysql
- database in place.
+ To start MySQL:
- After you import the mysql database on the new machine, execute
- mysqladmin flush-privileges so that the server reloads the grant
- table information.
+ 1. Log into the System i server using the user profile create or
+ specified during installation. By default, this is MYSQL.
-2.13. Operating System-Specific Notes
+Note
+ You should start mysqld_safe using a user that in the PASE
+ environment has the id=0 (the equivalent of the standard Unix
+ root user). If you do not use a user with this ID then the
+ system will be unable to change the user when executing mysqld
+ as set using --user option. If this happens, mysqld may be
+ unable to read the files located within the MySQL data
+ directory and the execution will fail.
-2.13.1. Linux Notes
+ 2. Enter the PASE environment using call qp2term.
- This section discusses issues that have been found to occur on
- Linux. The first few subsections describe general operating
- system-related issues, problems that can occur when using binary
- or source distributions, and post-installation issues. The
- remaining subsections discuss problems that occur with Linux on
- specific platforms.
+ 3. Start the MySQL server by changing to the installation
+ directory and running mysqld_safe, specifying the user name
+ used to install the server. The installer conveniently
+ installs a symbolic link to the installation directory
+ (mysql-5.0.42-i5os-power-32bit) as /opt/mysql/mysql:
+> cd /opt/mysql/mysql
+> bin/mysqld_safe --user=mysql &
+ You should see a message similar to the following:
+Starting mysqld daemon with databases »
+ from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data
- Note that most of these problems occur on older versions of Linux.
- If you are running a recent version, you may see none of them.
+ If you are having problems starting MySQL server, see Section
+ 2.13.1.3, "Starting and Troubleshooting the MySQL Server."
-2.13.1.1. Linux Operating System Notes
+ To stop MySQL:
- MySQL needs at least Linux version 2.0.
+ 1. Log into the System i server using the user profile create or
+ specified during installation. By default, this is MYSQL.
-Warning
+ 2. Enter the PASE environment using call qp2term.
- We have seen some strange problems with Linux 2.2.14 and MySQL on
- SMP systems. We also have reports from some MySQL users that they
- have encountered serious stability problems using MySQL with
- kernel 2.2.14. If you are using this kernel, you should upgrade to
- 2.2.19 (or newer) or to a 2.4 kernel. If you have a multiple-CPU
- box, you should seriously consider using 2.4 because it gives you
- a significant speed boost. Your system should be more stable.
-
- When using LinuxThreads, you should see a minimum of three mysqld
- processes running. These are in fact threads. There is one thread
- for the LinuxThreads manager, one thread to handle connections,
- and one thread to handle alarms and signals.
-
-2.13.1.2. Linux Binary Distribution Notes
-
- The Linux-Intel binary and RPM releases of MySQL are configured
- for the highest possible speed. We are always trying to use the
- fastest stable compiler available.
-
- The binary release is linked with -static, which means you do not
- normally need to worry about which version of the system libraries
- you have. You need not install LinuxThreads, either. A program
- linked with -static is slightly larger than a dynamically linked
- program, but also slightly faster (3-5%). However, one problem
- with a statically linked program is that you can't use
- user-defined functions (UDFs). If you are going to write or use
- UDFs (this is something for C or C++ programmers only), you must
- compile MySQL yourself using dynamic linking.
-
- A known issue with binary distributions is that on older Linux
- systems that use libc (such as Red Hat 4.x or Slackware), you get
- some (nonfatal) issues with host name resolution. If your system
- uses libc rather than glibc2, you probably will encounter some
- difficulties with host name resolution and getpwnam(). This
- happens because glibc (unfortunately) depends on some external
- libraries to implement host name resolution and getpwent(), even
- when compiled with -static. These problems manifest themselves in
- two ways:
-
- * You may see the following error message when you run
- mysql_install_db:
-Sorry, the host 'xxxx' could not be looked up
- You can deal with this by executing mysql_install_db --force,
- which does not execute the resolveip test in mysql_install_db.
- The downside is that you cannot use host names in the grant
- tables: except for localhost, you must use IP numbers instead.
- If you are using an old version of MySQL that does not support
- --force, you must manually remove the resolveip test in
- mysql_install_db using a text editor.
-
- * You also may see the following error when you try to run
- mysqld with the --user option:
-getpwnam: No such file or directory
- To work around this problem, start mysqld by using the su
- command rather than by specifying the --user option. This
- causes the system itself to change the user ID of the mysqld
- process so that mysqld need not do so.
-
- Another solution, which solves both problems, is not to use a
- binary distribution. Obtain a MySQL source distribution (in RPM or
- tar.gz format) and install that instead.
-
- On some Linux 2.2 versions, you may get the error Resource
- temporarily unavailable when clients make a great many new
- connections to a mysqld server over TCP/IP. The problem is that
- Linux has a delay between the time that you close a TCP/IP socket
- and the time that the system actually frees it. There is room for
- only a finite number of TCP/IP slots, so you encounter the
- resource-unavailable error if clients attempt too many new TCP/IP
- connections over a short period of time. For example, you may see
- the error when you run the MySQL test-connect benchmark over
- TCP/IP.
-
- We have inquired about this problem a few times on different Linux
- mailing lists but have never been able to find a suitable
- resolution. The only known "fix" is for clients to use persistent
- connections, or, if you are running the database server and
- clients on the same machine, to use Unix socket file connections
- rather than TCP/IP connections.
-
-2.13.1.3. Linux Source Distribution Notes
-
- The following notes regarding glibc apply only to the situation
- when you build MySQL yourself. If you are running Linux on an x86
- machine, in most cases it is much better for you to use our
- binary. We link our binaries against the best patched version of
- glibc we can find and with the best compiler options, in an
- attempt to make it suitable for a high-load server. For a typical
- user, even for setups with a lot of concurrent connections or
- tables exceeding the 2GB limit, our binary is the best choice in
- most cases. After reading the following text, if you are in doubt
- about what to do, try our binary first to determine whether it
- meets your needs. If you discover that it is not good enough, you
- may want to try your own build. In that case, we would appreciate
- a note about it so that we can build a better binary next time.
-
- MySQL uses LinuxThreads on Linux. If you are using an old Linux
- version that doesn't have glibc2, you must install LinuxThreads
- before trying to compile MySQL. You can obtain LinuxThreads from
- http://dev.mysql.com/downloads/os-linux.html.
-
- Note that glibc versions before and including version 2.1.1 have a
- fatal bug in pthread_mutex_timedwait() handling, which is used
- when INSERT DELAYED statements are issued. Do not use INSERT
- DELAYED before upgrading glibc.
-
- Note that Linux kernel and the LinuxThread library can by default
- handle a maximum of 1,024 threads. If you plan to have more than
- 1,000 concurrent connections, you need to make some changes to
- LinuxThreads, as follows:
-
- * Increase PTHREAD_THREADS_MAX in
- sysdeps/unix/sysv/linux/bits/local_lim.h to 4096 and decrease
- STACK_SIZE in linuxthreads/internals.h to 256KB. The paths are
- relative to the root of glibc. (Note that MySQL is not stable
- with 600-1000 connections if STACK_SIZE is the default of
- 2MB.)
-
- * Recompile LinuxThreads to produce a new libpthread.a library,
- and relink MySQL against it.
-
- There is another issue that greatly hurts MySQL performance,
- especially on SMP systems. The mutex implementation in
- LinuxThreads in glibc 2.1 is very poor for programs with many
- threads that hold the mutex only for a short time. This produces a
- paradoxical result: If you link MySQL against an unmodified
- LinuxThreads, removing processors from an SMP actually improves
- MySQL performance in many cases. We have made a patch available
- for glibc 2.1.3 to correct this behavior
- (http://dev.mysql.com/Downloads/Linux/linuxthreads-2.1-patch)
-
- With glibc 2.2.2, MySQL uses the adaptive mutex, which is much
- better than even the patched one in glibc 2.1.3. Be warned,
- however, that under some conditions, the current mutex code in
- glibc 2.2.2 overspins, which hurts MySQL performance. The
- likelihood that this condition occurs can be reduced by re-nicing
- the mysqld process to the highest priority. We have also been able
- to correct the overspin behavior with a patch, available at
- http://dev.mysql.com/Downloads/Linux/linuxthreads-2.2.2.patch. It
- combines the correction of overspin, maximum number of threads,
- and stack spacing all in one. You need to apply it in the
- linuxthreads directory with patch -p0
- </tmp/linuxthreads-2.2.2.patch. We hope it is included in some
- form in future releases of glibc 2.2. In any case, if you link
- against glibc 2.2.2, you still need to correct STACK_SIZE and
- PTHREAD_THREADS_MAX. We hope that the defaults is corrected to
- some more acceptable values for high-load MySQL setup in the
- future, so that the commands needed to produce your own build can
- be reduced to ./configure; make; make install.
-
- If you use these patches to build a special static version of
- libpthread.a, use it only for statically linking against MySQL. We
- know that these patches are safe for MySQL and significantly
- improve its performance, but we cannot say anything about their
- effects on other applications. If you link other applications that
- require LinuxThreads against the patched static version of the
- library, or build a patched shared version and install it on your
- system, you do so at your own risk.
-
- If you experience any strange problems during the installation of
- MySQL, or with some common utilities hanging, it is very likely
- that they are either library or compiler related. If this is the
- case, using our binary resolves them.
+ 3. Stop the MySQL server by changing into the installation
+ directory and running mysqladmin, specifying the user name
+ used to install the server:
+> cd /opt/mysql/mysql
+> bin/mysqladmin -u root shutdown
+ If the session that you started and stopped MySQL are the
+ same, you may get the log output from mysqld:
+ STOPPING server from pid file »
+ /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.R
+CHLAND.IBM.COM.pid
+ 070718 10:34:20 mysqld ended
+ If the sessions used to start and stop MySQL are different,
+ you will not receive any confirmation of the shutdown.
- If you link your own MySQL client programs, you may see the
- following error at runtime:
-ld.so.1: fatal: libmysqlclient.so.#:
-open failed: No such file or directory
+ Note and tips
- This problem can be avoided by one of the following methods:
+ * A problem has been identified with the installation process on
+ DBCS systems. If you are having problems install MySQL on a
+ DBCS system, you need to change your job's coded character set
+ identifier (CSSID) to 37 (EBCDIC) before executing the install
+ command, INSMYSQL. To do this, determine your existing CSSID
+ (using DSPJOB and selecting option 2), execute CHGJOB
+ CSSID(37), run INSMYSQL to install MySQL and then execute
+ CHGJOB again with your original CSSID.
- * Link clients with the -Wl,r/full/path/to/libmysqlclient.so
- flag rather than with -Lpath).
+ * If you want to use the Perl scripts that are included with
+ MySQL, you need to download the iSeries Tools for Developers
+ (5799-PTL). See
+ http://www-03.ibm.com/servers/enable/site/porting/tools/.
- * Copy libmysqclient.so to /usr/lib.
+2.10. Installing MySQL on FreeBSD
- * Add the path name of the directory where libmysqlclient.so is
- located to the LD_RUN_PATH environment variable before running
- your client.
+ This section provides information about using MySQL on variants of
+ FreeBSD Unix.
- If you are using the Fujitsu compiler (fcc/FCC), you may have some
- problems compiling MySQL because the Linux header files are very
- gcc oriented. The following configure line should work with
- fcc/FCC:
-CC=fcc CFLAGS="-O -K fast -K lib -K omitfp -Kpreex -D_GNU_SOURCE \
- -DCONST=const -DNO_STRTOLL_PROTO" \
-CXX=FCC CXXFLAGS="-O -K fast -K lib \
- -K omitfp -K preex --no_exceptions --no_rtti -D_GNU_SOURCE \
- -DCONST=const -Dalloca=__builtin_alloca -DNO_STRTOLL_PROTO \
- '-D_EXTERN_INLINE=static __inline'" \
-./configure \
- --prefix=/usr/local/mysql --enable-assembler \
- --with-mysqld-ldflags=-all-static --disable-shared \
- --with-low-memory
+ The easiest (and preferred) way to install MySQL is to use the
+ mysql-server and mysql-client ports available at
+ http://www.freebsd.org/. Using these ports gives you the following
+ benefits:
-2.13.1.4. Linux Post-Installation Notes
+ * A working MySQL with all optimizations enabled that are known
+ to work on your version of FreeBSD.
- mysql.server can be found in the support-files directory under the
- MySQL installation directory or in a MySQL source tree. You can
- install it as /etc/init.d/mysql for automatic MySQL startup and
- shutdown. See Section 2.11.2.2, "Starting and Stopping MySQL
- Automatically."
+ * Automatic configuration and build.
- If MySQL cannot open enough files or connections, it may be that
- you have not configured Linux to handle enough files.
+ * Startup scripts installed in /usr/local/etc/rc.d.
- In Linux 2.2 and onward, you can check the number of allocated
- file handles as follows:
-shell> cat /proc/sys/fs/file-max
-shell> cat /proc/sys/fs/dquot-max
-shell> cat /proc/sys/fs/super-max
-
- If you have more than 16MB of memory, you should add something
- like the following to your init scripts (for example,
- /etc/init.d/boot.local on SuSE Linux):
-echo 65536 > /proc/sys/fs/file-max
-echo 8192 > /proc/sys/fs/dquot-max
-echo 1024 > /proc/sys/fs/super-max
-
- You can also run the echo commands from the command line as root,
- but these settings are lost the next time your computer restarts.
-
- Alternatively, you can set these parameters on startup by using
- the sysctl tool, which is used by many Linux distributions
- (including SuSE Linux 8.0 and later). Put the following values
- into a file named /etc/sysctl.conf:
-# Increase some values for MySQL
-fs.file-max = 65536
-fs.dquot-max = 8192
-fs.super-max = 1024
-
- You should also add the following to /etc/my.cnf:
-[mysqld_safe]
-open-files-limit=8192
-
- This should allow the server a limit of 8,192 for the combined
- number of connections and open files.
-
- The STACK_SIZE constant in LinuxThreads controls the spacing of
- thread stacks in the address space. It needs to be large enough so
- that there is plenty of room for each individual thread stack, but
- small enough to keep the stack of some threads from running into
- the global mysqld data. Unfortunately, as we have experimentally
- discovered, the Linux implementation of mmap() successfully unmaps
- a mapped region if you ask it to map out an address currently in
- use, zeroing out the data on the entire page instead of returning
- an error. So, the safety of mysqld or any other threaded
- application depends on the "gentlemanly" behavior of the code that
- creates threads. The user must take measures to make sure that the
- number of running threads at any given time is sufficiently low
- for thread stacks to stay away from the global heap. With mysqld,
- you should enforce this behavior by setting a reasonable value for
- the max_connections variable.
-
- If you build MySQL yourself, you can patch LinuxThreads for better
- stack use. See Section 2.13.1.3, "Linux Source Distribution
- Notes." If you do not want to patch LinuxThreads, you should set
- max_connections to a value no higher than 500. It should be even
- less if you have a large key buffer, large heap tables, or some
- other things that make mysqld allocate a lot of memory, or if you
- are running a 2.2 kernel with a 2GB patch. If you are using our
- binary or RPM version, you can safely set max_connections at 1500,
- assuming no large key buffer or heap tables with lots of data. The
- more you reduce STACK_SIZE in LinuxThreads the more threads you
- can safely create. Values between 128KB and 256KB are recommended.
-
- If you use a lot of concurrent connections, you may suffer from a
- "feature" in the 2.2 kernel that attempts to prevent fork bomb
- attacks by penalizing a process for forking or cloning a child.
- This causes MySQL not to scale well as you increase the number of
- concurrent clients. On single-CPU systems, we have seen this
- manifest as very slow thread creation; it may take a long time to
- connect to MySQL (as long as one minute), and it may take just as
- long to shut it down. On multiple-CPU systems, we have observed a
- gradual drop in query speed as the number of clients increases. In
- the process of trying to find a solution, we have received a
- kernel patch from one of our users who claimed it helped for his
- site. This patch is available at
- http://dev.mysql.com/Downloads/Patches/linux-fork.patch. We have
- done rather extensive testing of this patch on both development
- and production systems. It has significantly improved MySQL
- performance without causing any problems and is recommended for
- users who still run high-load servers on 2.2 kernels.
-
- This issue has been fixed in the 2.4 kernel, so if you are not
- satisfied with the current performance of your system, rather than
- patching your 2.2 kernel, it might be easier to upgrade to 2.4. On
- SMP systems, upgrading also gives you a nice SMP boost in addition
- to fixing the fairness bug.
-
- We have tested MySQL on the 2.4 kernel on a two-CPU machine and
- found MySQL scales much better. There was virtually no slowdown on
- query throughput all the way up to 1,000 clients, and the MySQL
- scaling factor (computed as the ratio of maximum throughput to the
- throughput for one client) was 180%. We have observed similar
- results on a four-CPU system: Virtually no slowdown as the number
- of clients was increased up to 1,000, and a 300% scaling factor.
- Based on these results, for a high-load SMP server using a 2.2
- kernel, it is definitely recommended to upgrade to the 2.4 kernel
- at this point.
-
- We have discovered that it is essential to run the mysqld process
- with the highest possible priority on the 2.4 kernel to achieve
- maximum performance. This can be done by adding a renice -20 $$
- command to mysqld_safe. In our testing on a four-CPU machine,
- increasing the priority resulted in a 60% throughput increase with
- 400 clients.
-
- We are currently also trying to collect more information on how
- well MySQL performs with a 2.4 kernel on four-way and eight-way
- systems. If you have access such a system and have done some
- benchmarks, please send an email message to benchmarks(a)mysql.com
- with the results. We will review them for inclusion in the manual.
-
- If you see a dead mysqld server process with ps, this usually
- means that you have found a bug in MySQL or you have a corrupted
- table. See Section B.1.4.2, "What to Do If MySQL Keeps Crashing."
-
- To get a core dump on Linux if mysqld dies with a SIGSEGV signal,
- you can start mysqld with the --core-file option. Note that you
- also probably need to raise the core file size by adding ulimit -c
- 1000000 to mysqld_safe or starting mysqld_safe with
- --core-file-size=1000000. See Section 4.3.2, "mysqld_safe ---
- MySQL Server Startup Script."
-
-2.13.1.5. Linux x86 Notes
-
- MySQL requires libc 5.4.12 or newer. It is known to work with libc
- 5.4.46. glibc 2.0.6 and later should also work. There have been
- some problems with the glibc RPMs from Red Hat, so if you have
- problems, check whether there are any updates. The glibc 2.0.7-19
- and 2.0.7-29 RPMs are known to work.
-
- If you are using Red Hat 8.0 or a new glibc 2.2.x library, you may
- see mysqld die in gethostbyaddr(). This happens because the new
- glibc library requires a stack size greater than 128KB for this
- call. To fix the problem, start mysqld with the
- --thread-stack=192K option. (Use -O thread_stack=192K before MySQL
- 4.) This stack size is the default on MySQL 4.0.10 and above, so
- you should not see the problem.
-
- If you are using gcc 3.0 and above to compile MySQL, you must
- install the libstdc++v3 library before compiling MySQL; if you
- don't do this, you get an error about a missing __cxa_pure_virtual
- symbol during linking.
-
- On some older Linux distributions, configure may produce an error
- like this:
-Syntax error in sched.h. Change _P to __P in the
-/usr/include/sched.h file.
-See the Installation chapter in the Reference Manual.
-
- Just do what the error message says. Add an extra underscore to
- the _P macro name that has only one underscore, and then try
- again.
-
- You may get some warnings when compiling. Those shown here can be
- ignored:
-mysqld.cc -o objs-thread/mysqld.o
-mysqld.cc: In function `void init_signals()':
-mysqld.cc:315: warning: assignment of negative value `-1' to
-`long unsigned int'
-mysqld.cc: In function `void * signal_hand(void *)':
-mysqld.cc:346: warning: assignment of negative value `-1' to
-`long unsigned int'
-
- If mysqld always dumps core when it starts, the problem may be
- that you have an old /lib/libc.a. Try renaming it, and then remove
- sql/mysqld and do a new make install and try again. This problem
- has been reported on some Slackware installations.
-
- If you get the following error when linking mysqld, it means that
- your libg++.a is not installed correctly:
-/usr/lib/libc.a(putc.o): In function `_IO_putc':
-putc.o(.text+0x0): multiple definition of `_IO_putc'
-
- You can avoid using libg++.a by running configure like this:
-shell> CXX=gcc ./configure
-
-2.13.1.6. Linux SPARC Notes
-
- In some implementations, readdir_r() is broken. The symptom is
- that the SHOW DATABASES statement always returns an empty set.
- This can be fixed by removing HAVE_READDIR_R from config.h after
- configuring and before compiling.
-
-2.13.1.7. Linux Alpha Notes
-
- We have tested MySQL 5.1 on Alpha with our benchmarks and test
- suite, and it appears to work well.
-
- We currently build the MySQL binary packages on SuSE Linux 7.0 for
- AXP, kernel 2.4.4-SMP, Compaq C compiler (V6.2-505) and Compaq C++
- compiler (V6.3-006) on a Compaq DS20 machine with an Alpha EV6
- processor.
+ * The ability to use pkg_info -L to see which files are
+ installed.
- You can find the preceding compilers at
- http://www.support.compaq.com/alpha-tools/. By using these
- compilers rather than gcc, we get about 9-14% better MySQL
- performance.
-
- For MySQL on Alpha, we use the -arch generic flag to our compile
- options, which ensures that the binary runs on all Alpha
- processors. We also compile statically to avoid library problems.
- The configure command looks like this:
-CC=ccc CFLAGS="-fast -arch generic" CXX=cxx \
-CXXFLAGS="-fast -arch generic -noexceptions -nortti" \
-./configure --prefix=/usr/local/mysql --disable-shared \
- --with-extra-charsets=complex --enable-thread-safe-client \
- --with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shar
-ed
+ * The ability to use pkg_delete to remove MySQL if you no longer
+ want it on your machine.
- Some known problems when running MySQL on Linux-Alpha:
+ The MySQL build process requires GNU make (gmake) to work. If GNU
+ make is not available, you must install it first before compiling
+ MySQL.
- * Debugging threaded applications like MySQL does not work with
- gdb 4.18. You should use gdb 5.1 instead.
+ The recommended way to compile and install MySQL on FreeBSD with
+ gcc (2.95.2 and up) is:
+CC=gcc CFLAGS="-O2 -fno-strength-reduce" \
+ CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions \
+ -felide-constructors -fno-strength-reduce" \
+ ./configure --prefix=/usr/local/mysql --enable-assembler
+gmake
+gmake install
+cd /usr/local/mysql
+bin/mysql_install_db --user=mysql
+bin/mysqld_safe &
- * If you try linking mysqld statically when using gcc, the
- resulting image dumps core at startup time. In other words, do
- not use --with-mysqld-ldflags=-all-static with gcc.
-
-2.13.1.8. Linux PowerPC Notes
-
- MySQL should work on MkLinux with the newest glibc package (tested
- with glibc 2.0.7).
-
-2.13.1.9. Linux MIPS Notes
-
- To get MySQL to work on Qube2 (Linux Mips), you need the newest
- glibc libraries. glibc-2.0.7-29C2 is known to work. You must also
- use gcc 2.95.2 or newer).
-
-2.13.1.10. Linux IA-64 Notes
-
- To get MySQL to compile on Linux IA-64, we use the following
- configure command for building with gcc 2.96:
-CC=gcc \
-CFLAGS="-O3 -fno-omit-frame-pointer" \
-CXX=gcc \
-CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
- -fno-exceptions -fno-rtti" \
- ./configure --prefix=/usr/local/mysql \
- "--with-comment=Official MySQL binary" \
- --with-extra-charsets=complex
-
- On IA-64, the MySQL client binaries use shared libraries. This
- means that if you install our binary distribution at a location
- other than /usr/local/mysql, you need to add the path of the
- directory where you have libmysqlclient.so installed either to the
- /etc/ld.so.conf file or to the value of your LD_LIBRARY_PATH
- environment variable.
-
- See Section B.1.3.1, "Problems Linking to the MySQL Client
- Library."
-
-2.13.1.11. SELinux Notes
-
- RHEL4 comes with SELinux, which supports tighter access control
- for processes. If SELinux is enabled (SELINUX in
- /etc/selinux/config is set to enforcing, SELINUXTYPE is set to
- either targeted or strict), you might encounter problems
- installing Sun Microsystems, Inc. RPM packages.
-
- Red Hat has an update that solves this. It involves an update of
- the "security policy" specification to handle the install
- structure of the RPMs provided by Sun Microsystems, Inc. For
- further information, see
- https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=167551 and
- http://rhn.redhat.com/errata/RHBA-2006-0049.html.
-
- The preceding discussion applies only to RHEL4. The patch is
- unnecessary for RHEL5.
-
-2.13.2. Mac OS X Notes
-
- On Mac OS X, tar cannot handle long file names. If you need to
- unpack a .tar.gz distribution, use gnutar instead.
-
-2.13.2.1. Mac OS X 10.x (Darwin)
-
- MySQL should work without major problems on Mac OS X 10.x
- (Darwin).
-
- Known issues:
-
- * If you have problems with performance under heavy load, try
- using the --skip-thread-priority option to mysqld. This runs
- all threads with the same priority. On Mac OS X, this gives
- better performance, at least until Apple fixes its thread
- scheduler.
-
- * The connection times (wait_timeout, interactive_timeout and
- net_read_timeout) values are not honored.
- This is probably a signal handling problem in the thread
- library where the signal doesn't break a pending read and we
- hope that a future update to the thread libraries will fix
- this.
-
- Our binary for Mac OS X is compiled on Darwin 6.3 with the
- following configure line:
-CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
-CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
- -fno-exceptions -fno-rtti" \
- ./configure --prefix=/usr/local/mysql \
- --with-extra-charsets=complex --enable-thread-safe-client \
- --enable-local-infile --disable-shared
-
- See Section 2.5, "Installing MySQL on Mac OS X."
-
-2.13.2.2. Mac OS X Server 1.2 (Rhapsody)
-
- For current versions of Mac OS X Server, no operating system
- changes are necessary before compiling MySQL. Compiling for the
- Server platform is the same as for the client version of Mac OS X.
+ FreeBSD is known to have a very low default file handle limit. See
+ Section B.5.2.18, "'File' Not Found and Similar Errors." Start the
+ server by using the --open-files-limit option for mysqld_safe, or
+ raise the limits for the mysqld user in /etc/login.conf and
+ rebuild it with cap_mkdb /etc/login.conf. Also be sure that you
+ set the appropriate class for this user in the password file if
+ you are not using the default (use chpass mysqld-user-name). See
+ Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
- For older versions (Mac OS X Server 1.2, a.k.a. Rhapsody), you
- must first install a pthread package before trying to configure
- MySQL.
+ In current versions of FreeBSD (at least 4.x and greater), you may
+ increase the limit on the amount of memory available for a process
+ by adding the following entries to the /boot/loader.conf file and
+ rebooting the machine (these are not settings that can be changed
+ at run time with the sysctl command):
+kern.maxdsiz="1073741824" # 1GB
+kern.dfldsiz="1073741824" # 1GB
+kern.maxssiz="134217728" # 128MB
- See Section 2.5, "Installing MySQL on Mac OS X."
+ For older versions of FreeBSD, you must recompile your kernel to
+ change the maximum data segment size for a process. In this case,
+ you should look at the MAXDSIZ option in the LINT config file for
+ more information.
-2.13.3. Solaris Notes
+ If you get problems with the current date in MySQL, setting the TZ
+ variable should help. See Section 2.14, "Environment Variables."
- For information about installing MySQL on Solaris using PKG
- distributions, see Section 2.6, "Installing MySQL on Solaris."
+2.11. Installing MySQL on HP-UX
- On Solaris, you may run into trouble even before you get the MySQL
- distribution unpacked, as the Solaris tar cannot handle long file
+ If you install MySQL using a binary tarball distribution on HP-UX,
+ you may run into trouble even before you get the MySQL
+ distribution unpacked, as the HP-UX tar cannot handle long file
names. This means that you may see errors when you try to unpack
MySQL.
If this occurs, you must use GNU tar (gtar) to unpack the
distribution.
- Sun native threads work only on Solaris 2.5 and higher. For
- Solaris 2.4 and earlier, MySQL automatically uses MIT-pthreads.
- See Section 2.10.5, "MIT-pthreads Notes."
-
- If you get the following error from configure, it means that you
- have something wrong with your compiler installation:
-checking for restartable system calls... configure: error can not
-run test programs while cross compiling
-
- In this case, you should upgrade your compiler to a newer version.
- You may also be able to solve this problem by inserting the
- following row into the config.cache file:
-ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls='no'}
-
- If you are using Solaris on a SPARC, the recommended compiler is
- gcc 2.95.2 or 3.2. You can find this at http://gcc.gnu.org/. Note
- that gcc 2.8.1 does not work reliably on SPARC.
-
- The recommended configure line when using gcc 2.95.2 is:
-CC=gcc CFLAGS="-O3" \
-CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
- \
-./configure --prefix=/usr/local/mysql --with-low-memory \
- --enable-assembler
+ Because of some critical bugs in the standard HP-UX libraries, you
+ should install the following patches before trying to run MySQL on
+ HP-UX 11.0:
+PHKL_22840 Streams cumulative
+PHNE_22397 ARPA cumulative
- If you have an UltraSPARC system, you can get 4% better
- performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the CFLAGS
- and CXXFLAGS environment variables.
+ This solves the problem of getting EWOULDBLOCK from recv() and
+ EBADF from accept() in threaded applications.
- If you have Sun's Forte 5.0 (or newer) compiler, you can run
- configure like this:
-CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
-CXX=CC CXXFLAGS="-noex -mt" \
-./configure --prefix=/usr/local/mysql --enable-assembler
+ If you are using gcc 2.95.1 on an unpatched HP-UX 11.x system, you
+ may get the following error:
+In file included from /usr/include/unistd.h:11,
+ from ../include/global.h:125,
+ from mysql_priv.h:15,
+ from item.cc:19:
+/usr/include/sys/unistd.h:184: declaration of C function ...
+/usr/include/sys/pthread.h:440: previous declaration ...
+In file included from item.h:306,
+ from mysql_priv.h:158,
+ from item.cc:19:
- To create a 64-bit binary with Sun's Forte compiler, use the
- following configuration options:
-CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
-CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
-./configure --prefix=/usr/local/mysql --enable-assembler
+ The problem is that HP-UX does not define pthreads_atfork()
+ consistently. It has conflicting prototypes in
+ /usr/include/sys/unistd.h:184 and /usr/include/sys/pthread.h:440.
- To create a 64-bit Solaris binary using gcc, add -m64 to CFLAGS
- and CXXFLAGS and remove --enable-assembler from the configure
- line.
+ One solution is to copy /usr/include/sys/unistd.h into
+ mysql/include and edit unistd.h and change it to match the
+ definition in pthread.h. Look for this line:
+extern int pthread_atfork(void (*prepare)(), void (*parent)(),
+ void (*child)());
- In the MySQL benchmarks, we obtained a 4% speed increase on
- UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
- using gcc 3.2 with the -mcpu flag.
+ Change it to look like this:
+extern int pthread_atfork(void (*prepare)(void), void (*parent)(void)
+,
+ void (*child)(void));
- If you create a 64-bit mysqld binary, it is 4% slower than the
- 32-bit binary, but can handle more threads and memory.
+ After making the change, the following configure line should work:
+CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \
+CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \
+./configure --prefix=/usr/local/mysql --disable-shared
- When using Solaris 10 for x86_64, you should mount any file
- systems on which you intend to store InnoDB files with the
- forcedirectio option. (By default mounting is done without this
- option.) Failing to do so will cause a significant drop in
- performance when using the InnoDB storage engine on this platform.
+ If you are using HP-UX compiler, you can use the following command
+ (which has been tested with cc B.11.11.04):
+CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
+ --with-extra-character-set=complex
- If you get a problem with fdatasync or sched_yield, you can fix
- this by adding LIBS=-lrt to the configure line
+ You can ignore any errors of the following type:
+aCC: warning 901: unknown option: `-3': use +help for online
+documentation
- For compilers older than WorkShop 5.3, you might have to edit the
- configure script. Change this line:
-#if !defined(__STDC__) || __STDC__ != 1
-
- To this:
-#if !defined(__STDC__)
-
- If you turn on __STDC__ with the -Xc option, the Sun compiler
- can't compile with the Solaris pthread.h header file. This is a
- Sun bug (broken compiler or broken include file).
-
- If mysqld issues the following error message when you run it, you
- have tried to compile MySQL with the Sun compiler without enabling
- the -mt multi-thread option:
-libc internal error: _rmutex_unlock: rmutex not held
-
- Add -mt to CFLAGS and CXXFLAGS and recompile.
-
- If you are using the SFW version of gcc (which comes with Solaris
- 8), you must add /opt/sfw/lib to the environment variable
- LD_LIBRARY_PATH before running configure.
-
- If you are using the gcc available from sunfreeware.com, you may
- have many problems. To avoid this, you should recompile gcc and
- GNU binutils on the machine where you are running them.
-
- If you get the following error when compiling MySQL with gcc, it
- means that your gcc is not configured for your version of Solaris:
-shell> gcc -O3 -g -O2 -DDBUG_OFF -o thr_alarm ...
-./thr_alarm.c: In function `signal_hand':
-./thr_alarm.c:556: too many arguments to function `sigwait'
-
- The proper thing to do in this case is to get the newest version
- of gcc and compile it with your current gcc compiler. At least for
- Solaris 2.5, almost all binary versions of gcc have old, unusable
- include files that break all programs that use threads, and
- possibly other programs as well.
+ If you get the following error from configure, verify that you
+ don't have the path to the K&R compiler before the path to the
+ HP-UX C and C++ compiler:
+checking for cc option to accept ANSI C... no
+configure: error: MySQL requires an ANSI C compiler (and a C++ compil
+er).
+Try gcc. See the Installation chapter in the Reference Manual.
- Solaris does not provide static versions of all system libraries
- (libpthreads and libdl), so you cannot compile MySQL with
- --static. If you try to do so, you get one of the following
- errors:
-ld: fatal: library -ldl: not found
-undefined reference to `dlopen'
-cannot find -lrt
+ Another reason for not being able to compile is that you didn't
+ define the +DD64 flags as just described.
- If you link your own MySQL client programs, you may see the
- following error at runtime:
-ld.so.1: fatal: libmysqlclient.so.#:
-open failed: No such file or directory
+ Another possibility for HP-UX 11 is to use the MySQL binaries
+ provided at http://dev.mysql.com/downloads/, which we have built
+ and tested ourselves. We have also received reports that the HP-UX
+ 10.20 binaries supplied by MySQL can be run successfully on HP-UX
+ 11. If you encounter problems, you should be sure to check your
+ HP-UX patch level.
- This problem can be avoided by one of the following methods:
+2.12. Installing MySQL on AIX
- * Link clients with the -Wl,r/full/path/to/libmysqlclient.so
- flag rather than with -Lpath).
+ Automatic detection of xlC is missing from Autoconf, so a number
+ of variables need to be set before running configure. The
+ following example uses the IBM compiler:
+export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 "
+export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192"
+export CFLAGS="-I /usr/local/include"
+export LDFLAGS="-L /usr/local/lib"
+export CPPFLAGS=$CFLAGS
+export CXXFLAGS=$CFLAGS
- * Copy libmysqclient.so to /usr/lib.
+./configure --prefix=/usr/local \
+ --localstatedir=/var/mysql \
+ --sbindir='/usr/local/bin' \
+ --libexecdir='/usr/local/bin' \
+ --enable-thread-safe-client \
+ --enable-large-files
- * Add the path name of the directory where libmysqlclient.so is
- located to the LD_RUN_PATH environment variable before running
- your client.
+ The preceding options are used to compile the MySQL distribution
+ that can be found at http://www-frec.bull.com/.
- If you have problems with configure trying to link with -lz when
- you don't have zlib installed, you have two options:
+ If you change the -O3 to -O2 in the preceding configure line, you
+ must also remove the -qstrict option. This is a limitation in the
+ IBM C compiler.
- * If you want to be able to use the compressed communication
- protocol, you need to get and install zlib from ftp.gnu.org.
+ If you are using gcc to compile MySQL, you must use the
+ -fno-exceptions flag, because the exception handling in gcc is not
+ thread-safe! There are also some known problems with IBM's
+ assembler that may cause it to generate bad code when used with
+ gcc.
- * Run configure with the --with-named-z-libs=no option when
- building MySQL.
+ Use the following configure line with gcc 2.95 on AIX:
+CC="gcc -pipe -mcpu=power -Wa,-many" \
+CXX="gcc -pipe -mcpu=power -Wa,-many" \
+CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \
+./configure --prefix=/usr/local/mysql --with-low-memory
- If you are using gcc and have problems with loading user-defined
- functions (UDFs) into MySQL, try adding -lgcc to the link line for
- the UDF.
+ The -Wa,-many option is necessary for the compile to be
+ successful. IBM is aware of this problem but is in no hurry to fix
+ it because of the workaround that is available. We don't know if
+ the -fno-exceptions is required with gcc 2.95, but because MySQL
+ doesn't use exceptions and the option generates faster code, you
+ should always use it with gcc.
- If you would like MySQL to start automatically, you can copy
- support-files/mysql.server to /etc/init.d and create a symbolic
- link to it named /etc/rc3.d/S99mysql.server.
+ If you get a problem with assembler code, try changing the
+ -mcpu=xxx option to match your CPU. Typically power2, power, or
+ powerpc may need to be used. Alternatively, you might need to use
+ 604 or 604e. We are not positive but suspect that power would
+ likely be safe most of the time, even on a power2 machine.
- If too many processes try to connect very rapidly to mysqld, you
- should see this error in the MySQL log:
-Error in accept: Protocol error
+ If you don't know what your CPU is, execute a uname -m command. It
+ produces a string that looks like 000514676700, with a format of
+ xxyyyyyymmss where xx and ss are always 00, yyyyyy is a unique
+ system ID and mm is the ID of the CPU Planar. A chart of these
+ values can be found at
+ http://www16.boulder.ibm.com/pseries/en_US/cmds/aixcmds5/uname.htm
+ .
- You might try starting the server with the --back_log=50 option as
- a workaround for this. (Use -O back_log=50 before MySQL 4.)
+ This gives you a machine type and a machine model you can use to
+ determine what type of CPU you have.
- Solaris doesn't support core files for setuid() applications, so
- you can't get a core file from mysqld if you are using the --user
- option.
+ If you have problems with threads on AIX 5.3, you should upgrade
+ AIX 5.3 to technology level 7 (5300-07).
+
+ If you have problems with signals (MySQL dies unexpectedly under
+ high load), you may have found an OS bug with threads and signals.
+ In this case, you can tell MySQL not to use signals by configuring
+ as follows:
+CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
+CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \
+-DDONT_USE_THR_ALARM" \
+./configure --prefix=/usr/local/mysql --with-debug \
+ --with-low-memory
+
+ This doesn't affect the performance of MySQL, but has the side
+ effect that you can't kill clients that are "sleeping" on a
+ connection with mysqladmin kill or mysqladmin shutdown. Instead,
+ the client dies when it issues its next command.
+
+ On some versions of AIX, linking with libbind.a makes
+ getservbyname() dump core. This is an AIX bug and should be
+ reported to IBM.
+
+ For AIX 4.2.1 and gcc, you have to make the following changes.
-2.13.3.1. Solaris 2.7/2.8 Notes
+ After configuring, edit config.h and include/my_config.h and
+ change the line that says this:
+#define HAVE_SNPRINTF 1
- Normally, you can use a Solaris 2.6 binary on Solaris 2.7 and 2.8.
- Most of the Solaris 2.6 issues also apply for Solaris 2.7 and 2.8.
+ to this:
+#undef HAVE_SNPRINTF
- MySQL should be able to detect new versions of Solaris
- automatically and enable workarounds for the following problems.
+ And finally, in mysqld.cc, you need to add a prototype for
+ initgroups().
+#ifdef _AIX41
+extern "C" int initgroups(const char *,int);
+#endif
- Solaris 2.7 / 2.8 has some bugs in the include files. You may see
- the following error when you use gcc:
-/usr/include/widec.h:42: warning: `getwc' redefined
-/usr/include/wchar.h:326: warning: this is the location of the previo
-us
-definition
+ For 32-bit binaries, if you need to allocate a lot of memory to
+ the mysqld process, it is not enough to just use ulimit -d
+ unlimited. You may also have to modify mysqld_safe to add a line
+ something like this:
+export LDR_CNTRL='MAXDATA=0x80000000'
- If this occurs, you can fix the problem by copying
- /usr/include/widec.h to .../lib/gcc-lib/os/gcc-version/include and
- changing line 41 from this:
-#if !defined(lint) && !defined(__lint)
+ You can find more information about using a lot of memory at
+ http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lr
+ g_prg_support.htm.
- To this:
-#if !defined(lint) && !defined(__lint) && !defined(getwc)
+ Users of AIX 4.3 should use gmake instead of the make utility
+ included with AIX.
- Alternatively, you can edit /usr/include/widec.h directly. Either
- way, after you make the fix, you should remove config.cache and
- run configure again.
+ As of AIX 4.1, the C compiler has been unbundled from AIX as a
+ separate product. gcc 3.3.2 can be obtained here:
+ ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gc
+ c/
- If you get the following errors when you run make, it is because
- configure didn't detect the curses.h file (probably because of the
- error in /usr/include/widec.h):
-In file included from mysql.cc:50:
-/usr/include/term.h:1060: syntax error before `,'
-/usr/include/term.h:1081: syntax error before `;'
+ The steps for compiling MySQL on AIX with gcc 3.3.2 are similar to
+ those for using gcc 2.95 (in particular, the need to edit config.h
+ and my_config.h after running configure). However, before running
+ configure, you should also patch the curses.h file as follows:
+/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/curses
+.h.ORIG
+ Mon Dec 26 02:17:28 2005
+--- /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/cu
+rses.h
+Mon Dec 26 02:40:13 2005
+***************
+*** 2023,2029 ****
- The solution to this problem is to do one of the following:
- 1. Configure with CFLAGS=-DHAVE_CURSES_H CXXFLAGS=-DHAVE_CURSES_H
- ./configure.
+ #endif /* _AIX32_CURSES */
+! #if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || de
+fined
+(__STRICT_ANSI__)
+ extern int delwin (WINDOW *);
+ extern int endwin (void);
+ extern int getcurx (WINDOW *);
+--- 2023,2029 ----
- 2. Edit /usr/include/widec.h as indicated in the preceding
- discussion and re-run configure.
- 3. Remove the #define HAVE_TERM line from the config.h file and
- run make again.
+ #endif /* _AIX32_CURSES */
+! #if 0 && (defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus)
+|| defined
+(__STRICT_ANSI__))
+ extern int delwin (WINDOW *);
+ extern int endwin (void);
+ extern int getcurx (WINDOW *);
- If your linker cannot find -lz when linking client programs, the
- problem is probably that your libz.so file is installed in
- /usr/local/lib. You can fix this problem by one of the following
- methods:
+2.13. Post-Installation Setup and Testing
- * Add /usr/local/lib to LD_LIBRARY_PATH.
+ After installing MySQL, there are some issues that you should
+ address. For example, on Unix, you should initialize the data
+ directory and create the MySQL grant tables. On all platforms, an
+ important security concern is that the initial accounts in the
+ grant tables have no passwords. You should assign passwords to
+ prevent unauthorized access to the MySQL server. Optionally, you
+ can create time zone tables to enable recognition of named time
+ zones.
- * Add a link to libz.so from /lib.
+ The following sections include post-installation procedures that
+ are specific to Windows systems and to Unix systems. Another
+ section, Section 2.13.1.3, "Starting and Troubleshooting the MySQL
+ Server," applies to all platforms; it describes what to do if you
+ have trouble getting the server to start. Section 2.13.2,
+ "Securing the Initial MySQL Accounts," also applies to all
+ platforms. You should follow its instructions to make sure that
+ you have properly protected your MySQL accounts by assigning
+ passwords to them.
- * If you are using Solaris 8, you can install the optional zlib
- from your Solaris 8 CD distribution.
+ When you are ready to create additional user accounts, you can
+ find information on the MySQL access control system and account
+ management in Section 5.4, "The MySQL Access Privilege System,"
+ and Section 5.5, "MySQL User Account Management."
- * Run configure with the --with-named-z-libs=no option when
- building MySQL.
+2.13.1. Unix Post-Installation Procedures
-2.13.3.2. Solaris x86 Notes
+ After installing MySQL on Unix, you need to initialize the grant
+ tables, start the server, and make sure that the server works
+ satisfactorily. You may also wish to arrange for the server to be
+ started and stopped automatically when your system starts and
+ stops. You should also assign passwords to the accounts in the
+ grant tables.
- On Solaris 8 on x86, mysqld dumps core if you remove the debug
- symbols using strip.
+ On Unix, the grant tables are set up by the mysql_install_db
+ program. For some installation methods, this program is run for
+ you automatically:
- If you are using gcc on Solaris x86 and you experience problems
- with core dumps under load, you should use the following configure
- command:
-CC=gcc CFLAGS="-O3 -fomit-frame-pointer -DHAVE_CURSES_H" \
-CXX=gcc \
-CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors \
- -fno-exceptions -fno-rtti -DHAVE_CURSES_H" \
-./configure --prefix=/usr/local/mysql
+ * If you install MySQL on Linux using RPM distributions, the
+ server RPM runs mysql_install_db.
- This avoids problems with the libstdc++ library and with C++
- exceptions.
+ * If you install MySQL on Mac OS X using a PKG distribution, the
+ installer runs mysql_install_db.
- If this doesn't help, you should compile a debug version and run
- it with a trace file or under gdb. See MySQL Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
+ Otherwise, you'll need to run mysql_install_db yourself.
-2.13.4. BSD Notes
+ The following procedure describes how to initialize the grant
+ tables (if that has not previously been done) and then start the
+ server. It also suggests some commands that you can use to test
+ whether the server is accessible and working properly. For
+ information about starting and stopping the server automatically,
+ see Section 2.13.1.2, "Starting and Stopping MySQL Automatically."
- This section provides information about using MySQL on variants of
- BSD Unix.
+ After you complete the procedure and have the server running, you
+ should assign passwords to the accounts created by
+ mysql_install_db. Instructions for doing so are given in Section
+ 2.13.2, "Securing the Initial MySQL Accounts."
-2.13.4.1. FreeBSD Notes
+ In the examples shown here, the server runs under the user ID of
+ the mysql login account. This assumes that such an account exists.
+ Either create the account if it does not exist, or substitute the
+ name of a different existing login account that you plan to use
+ for running the server.
- FreeBSD 4.x or newer is recommended for running MySQL, because the
- thread package is much more integrated. To get a secure and stable
- system, you should use only FreeBSD kernels that are marked
- -RELEASE.
+ 1. Change location into the top-level directory of your MySQL
+ installation, represented here by BASEDIR:
+shell> cd BASEDIR
+ BASEDIR is likely to be something like /usr/local/mysql or
+ /usr/local. The following steps assume that you are located in
+ this directory.
- The easiest (and preferred) way to install MySQL is to use the
- mysql-server and mysql-client ports available at
- http://www.freebsd.org/. Using these ports gives you the following
- benefits:
+ 2. If necessary, run the mysql_install_db program to set up the
+ initial MySQL grant tables containing the privileges that
+ determine how users are allowed to connect to the server.
+ You'll need to do this if you used a distribution type for
+ which the installation procedure doesn't run the program for
+ you.
+ Typically, mysql_install_db needs to be run only the first
+ time you install MySQL, so you can skip this step if you are
+ upgrading an existing installation, However, mysql_install_db
+ does not overwrite any existing privilege tables, so it should
+ be safe to run in any circumstances.
+ To initialize the grant tables, use one of the following
+ commands, depending on whether mysql_install_db is located in
+ the bin or scripts directory:
+shell> bin/mysql_install_db --user=mysql
+shell> scripts/mysql_install_db --user=mysql
+ It might be necessary to specify other options such as
+ --basedir or --datadir if mysql_install_db does not use the
+ correct locations for the installation directory or data
+ directory. For example:
+shell> bin/mysql_install_db --user=mysql \
+ --basedir=/opt/mysql/mysql \
+ --datadir=/opt/mysql/mysql/data
+ The mysql_install_db script creates the server's data
+ directory. Under the data directory, it creates directories
+ for the mysql database that holds all database privileges and
+ the test database that you can use to test MySQL. The script
+ also creates privilege table entries for root and
+ anonymous-user accounts. The accounts have no passwords
+ initially. A description of their initial privileges is given
+ in Section 2.13.2, "Securing the Initial MySQL Accounts."
+ Briefly, these privileges allow the MySQL root user to do
+ anything, and allow anybody to create or use databases with a
+ name of test or starting with test_.
+ It is important to make sure that the database directories and
+ files are owned by the mysql login account so that the server
+ has read and write access to them when you run it later. To
+ ensure this, the --user option should be used as shown if you
+ run mysql_install_db as root. Otherwise, you should execute
+ the script while logged in as mysql, in which case you can
+ omit the --user option from the command.
+ mysql_install_db creates several tables in the mysql database,
+ including user, db, host, tables_priv, columns_priv, func, and
+ others. See Section 5.4, "The MySQL Access Privilege System,"
+ for a complete listing and description of these tables.
+ If you don't want to have the test database, you can remove it
+ with mysqladmin -u root drop test after starting the server.
+ If you have trouble with mysql_install_db at this point, see
+ Section 2.13.1.1, "Problems Running mysql_install_db."
- * A working MySQL with all optimizations enabled that are known
- to work on your version of FreeBSD.
+ 3. Start the MySQL server:
+shell> bin/mysqld_safe --user=mysql &
+ It is important that the MySQL server be run using an
+ unprivileged (non-root) login account. To ensure this, the
+ --user option should be used as shown if you run mysqld_safe
+ as system root. Otherwise, you should execute the script while
+ logged in to the system as mysql, in which case you can omit
+ the --user option from the command.
+ Further instructions for running MySQL as an unprivileged user
+ are given in Section 5.3.5, "How to Run MySQL as a Normal
+ User."
+ If you neglected to create the grant tables before proceeding
+ to this step, the following message appears in the error log
+ file when you start the server:
+mysqld: Can't find file: 'host.frm'
+ If you have other problems starting the server, see Section
+ 2.13.1.3, "Starting and Troubleshooting the MySQL Server."
- * Automatic configuration and build.
+ 4. Use mysqladmin to verify that the server is running. The
+ following commands provide simple tests to check whether the
+ server is up and responding to connections:
+shell> bin/mysqladmin version
+shell> bin/mysqladmin variables
+ The output from mysqladmin version varies slightly depending
+ on your platform and version of MySQL, but should be similar
+ to that shown here:
+shell> bin/mysqladmin version
+mysqladmin Ver 14.12 Distrib 5.1.41, for pc-linux-gnu on i686
+...
- * Startup scripts installed in /usr/local/etc/rc.d.
+Server version 5.1.41
+Protocol version 10
+Connection Localhost via UNIX socket
+UNIX socket /var/lib/mysql/mysql.sock
+Uptime: 14 days 5 hours 5 min 21 sec
- * The ability to use pkg_info -L to see which files are
- installed.
+Threads: 1 Questions: 366 Slow queries: 0
+Opens: 0 Flush tables: 1 Open tables: 19
+Queries per second avg: 0.000
+ To see what else you can do with mysqladmin, invoke it with
+ the --help option.
- * The ability to use pkg_delete to remove MySQL if you no longer
- want it on your machine.
+ 5. Verify that you can shut down the server:
+shell> bin/mysqladmin -u root shutdown
- It is recommended you use MIT-pthreads on FreeBSD 2.x, and native
- threads on FreeBSD 3 and up. It is possible to run with native
- threads on some late 2.2.x versions, but you may encounter
- problems shutting down mysqld.
-
- Unfortunately, certain function calls on FreeBSD are not yet fully
- thread-safe. Most notably, this includes the gethostbyname()
- function, which is used by MySQL to convert host names into IP
- addresses. Under certain circumstances, the mysqld process
- suddenly causes 100% CPU load and is unresponsive. If you
- encounter this problem, try to start MySQL using the
- --skip-name-resolve option.
-
- Alternatively, you can link MySQL on FreeBSD 4.x against the
- LinuxThreads library, which avoids a few of the problems that the
- native FreeBSD thread implementation has. For a very good
- comparison of LinuxThreads versus native threads, see Jeremy
- Zawodny's article FreeBSD or Linux for your MySQL Server? at
- http://jeremy.zawodny.com/blog/archives/000697.html.
-
- Known problem when using LinuxThreads on FreeBSD is:
-
- * The connection times (wait_timeout, interactive_timeout and
- net_read_timeout) values are not honored. The symptom is that
- persistent connections can hang for a very long time without
- getting closed down and that a 'kill' for a thread will not
- take affect until the thread does it a new command
- This is probably a signal handling problem in the thread
- library where the signal doesn't break a pending read. This is
- supposed to be fixed in FreeBSD 5.0
+ 6. Verify that you can start the server again. Do this by using
+ mysqld_safe or by invoking mysqld directly. For example:
+shell> bin/mysqld_safe --user=mysql --log &
+ If mysqld_safe fails, see Section 2.13.1.3, "Starting and
+ Troubleshooting the MySQL Server."
- The MySQL build process requires GNU make (gmake) to work. If GNU
- make is not available, you must install it first before compiling
- MySQL.
+ 7. Run some simple tests to verify that you can retrieve
+ information from the server. The output should be similar to
+ what is shown here:
+shell> bin/mysqlshow
++-----------+
+| Databases |
++-----------+
+| mysql |
+| test |
++-----------+
- The recommended way to compile and install MySQL on FreeBSD with
- gcc (2.95.2 and up) is:
-CC=gcc CFLAGS="-O2 -fno-strength-reduce" \
- CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions \
- -felide-constructors -fno-strength-reduce" \
- ./configure --prefix=/usr/local/mysql --enable-assembler
-gmake
-gmake install
-cd /usr/local/mysql
-bin/mysql_install_db --user=mysql
-bin/mysqld_safe &
+shell> bin/mysqlshow mysql
+Database: mysql
++---------------------------+
+| Tables |
++---------------------------+
+| columns_priv |
+| db |
+| func |
+| help_category |
+| help_keyword |
+| help_relation |
+| help_topic |
+| host |
+| proc |
+| procs_priv |
+| tables_priv |
+| time_zone |
+| time_zone_leap_second |
+| time_zone_name |
+| time_zone_transition |
+| time_zone_transition_type |
+| user |
++---------------------------+
- If you notice that configure uses MIT-pthreads, you should read
- the MIT-pthreads notes. See Section 2.10.5, "MIT-pthreads Notes."
+shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
++------+--------+------+
+| host | db | user |
++------+--------+------+
+| % | test | |
+| % | test_% | |
++------+--------+------+
- If you get an error from make install that it can't find
- /usr/include/pthreads, configure didn't detect that you need
- MIT-pthreads. To fix this problem, remove config.cache, and then
- re-run configure with the --with-mit-threads option.
-
- Be sure that your name resolver setup is correct. Otherwise, you
- may experience resolver delays or failures when connecting to
- mysqld. Also make sure that the localhost entry in the /etc/hosts
- file is correct. The file should start with a line similar to
- this:
-127.0.0.1 localhost localhost.your.domain
+ 8. There is a benchmark suite in the sql-bench directory (under
+ the MySQL installation directory) that you can use to compare
+ how MySQL performs on different platforms. The benchmark suite
+ is written in Perl. It requires the Perl DBI module that
+ provides a database-independent interface to the various
+ databases, and some other additional Perl modules:
+DBI
+DBD::mysql
+Data::Dumper
+Data::ShowTable
+ These modules can be obtained from CPAN
+ (http://www.cpan.org/) See also Section 2.15.1, "Installing
+ Perl on Unix."
+ The sql-bench/Results directory contains the results from many
+ runs against different databases and platforms. To run all
+ tests, execute these commands:
+shell> cd sql-bench
+shell> perl run-all-tests
+ If you don't have the sql-bench directory, you probably
+ installed MySQL using RPM files other than the source RPM.
+ (The source RPM includes the sql-bench benchmark directory.)
+ In this case, you must first install the benchmark suite
+ before you can use it. There are separate benchmark RPM files
+ named mysql-bench-VERSION.i386.rpm that contain benchmark code
+ and data.
+ If you have a source distribution, there are also tests in its
+ tests subdirectory that you can run. For example, to run
+ auto_increment.tst, execute this command from the top-level
+ directory of your source distribution:
+shell> mysql -vvf test < ./tests/auto_increment.tst
+ The expected result of the test can be found in the
+ ./tests/auto_increment.res file.
- FreeBSD is known to have a very low default file handle limit. See
- Section B.1.2.18, "'File' Not Found and Similar Errors." Start the
- server by using the --open-files-limit option for mysqld_safe, or
- raise the limits for the mysqld user in /etc/login.conf and
- rebuild it with cap_mkdb /etc/login.conf. Also be sure that you
- set the appropriate class for this user in the password file if
- you are not using the default (use chpass mysqld-user-name). See
- Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
+ 9. At this point, you should have the server running. However,
+ none of the initial MySQL accounts have a password, so you
+ should assign passwords using the instructions found in
+ Section 2.13.2, "Securing the Initial MySQL Accounts."
- FreeBSD limits the size of a process to 512MB, even if you have
- much more RAM available on the system. So you may get an error
- such as this:
-Out of memory (Needed 16391 bytes)
+ The MySQL 5.1 installation procedure creates time zone tables in
+ the mysql database. However, you must populate the tables manually
+ using the instructions in Section 9.7, "MySQL Server Time Zone
+ Support."
- In current versions of FreeBSD (at least 4.x and greater), you may
- increase this limit by adding the following entries to the
- /boot/loader.conf file and rebooting the machine (these are not
- settings that can be changed at run time with the sysctl command):
-kern.maxdsiz="1073741824" # 1GB
-kern.dfldsiz="1073741824" # 1GB
-kern.maxssiz="134217728" # 128MB
+2.13.1.1. Problems Running mysql_install_db
- For older versions of FreeBSD, you must recompile your kernel to
- change the maximum data segment size for a process. In this case,
- you should look at the MAXDSIZ option in the LINT config file for
- more information.
+ The purpose of the mysql_install_db script is to generate new
+ MySQL privilege tables. It does not overwrite existing MySQL
+ privilege tables, and it does not affect any other data.
- If you get problems with the current date in MySQL, setting the TZ
- variable should help. See Section 2.14, "Environment Variables."
+ If you want to re-create your privilege tables, first stop the
+ mysqld server if it is running. Then rename the mysql directory
+ under the data directory to save it, and then run
+ mysql_install_db. Suppose that your current directory is the MySQL
+ installation directory and that mysql_install_db is located in the
+ bin directory and the data directory is named data. To rename the
+ mysql database and re-run mysql_install_db, use these commands.
+shell> mv data/mysql data/mysql.old
+shell> bin/mysql_install_db --user=mysql
-2.13.4.2. NetBSD Notes
+ When you run mysql_install_db, you might encounter the following
+ problems:
- To compile on NetBSD, you need GNU make. Otherwise, the build
- process fails when make tries to run lint on C++ files.
+ * mysql_install_db fails to install the grant tables
+ You may find that mysql_install_db fails to install the grant
+ tables and terminates after displaying the following messages:
+Starting mysqld daemon with databases from XXXXXX
+mysqld ended
+ In this case, you should examine the error log file very
+ carefully. The log should be located in the directory XXXXXX
+ named by the error message and should indicate why mysqld
+ didn't start. If you do not understand what happened, include
+ the log when you post a bug report. See Section 1.6, "How to
+ Report Bugs or Problems."
-2.13.4.3. OpenBSD 2.5 Notes
+ * There is a mysqld process running
+ This indicates that the server is running, in which case the
+ grant tables have probably been created already. If so, there
+ is no need to run mysql_install_db at all because it needs to
+ be run only once (when you install MySQL the first time).
- On OpenBSD 2.5, you can compile MySQL with native threads with the
- following options:
-CFLAGS=-pthread CXXFLAGS=-pthread ./configure --with-mit-threads=no
+ * Installing a second mysqld server does not work when one
+ server is running
+ This can happen when you have an existing MySQL installation,
+ but want to put a new installation in a different location.
+ For example, you might have a production installation, but you
+ want to create a second installation for testing purposes.
+ Generally the problem that occurs when you try to run a second
+ server is that it tries to use a network interface that is in
+ use by the first server. In this case, you should see one of
+ the following error messages:
+Can't start server: Bind on TCP/IP port:
+Address already in use
+Can't start server: Bind on unix socket...
+ For instructions on setting up multiple servers, see Section
+ 5.6, "Running Multiple MySQL Servers on the Same Machine."
-2.13.4.4. BSD/OS Version 2.x Notes
+ * You do not have write access to the /tmp directory
+ If you do not have write access to create temporary files or a
+ Unix socket file in the default location (the /tmp directory),
+ an error occurs when you run mysql_install_db or the mysqld
+ server.
+ You can specify different locations for the temporary
+ directory and Unix socket file by executing these commands
+ prior to starting mysql_install_db or mysqld, where
+ some_tmp_dir is the full path name to some directory for which
+ you have write permission:
+shell> TMPDIR=/some_tmp_dir/
+shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock
+shell> export TMPDIR MYSQL_UNIX_PORT
+ Then you should be able to run mysql_install_db and start the
+ server with these commands:
+shell> bin/mysql_install_db --user=mysql
+shell> bin/mysqld_safe --user=mysql &
+ If mysql_install_db is located in the scripts directory,
+ modify the first command to scripts/mysql_install_db.
+ See Section B.5.4.5, "How to Protect or Change the MySQL Unix
+ Socket File," and Section 2.14, "Environment Variables."
- If you get the following error when compiling MySQL, your ulimit
- value for virtual memory is too low:
-item_func.h: In method
-`Item_func_ge::Item_func_ge(const Item_func_ge &)':
-item_func.h:28: virtual memory exhausted
-make[2]: *** [item_func.o] Error 1
+ There are some alternatives to running the mysql_install_db script
+ provided in the MySQL distribution:
- Try using ulimit -v 80000 and run make again. If this doesn't work
- and you are using bash, try switching to csh or sh; some BSDI
- users have reported problems with bash and ulimit.
+ * If you want the initial privileges to be different from the
+ standard defaults, you can modify mysql_install_db before you
+ run it. However, it is preferable to use GRANT and REVOKE to
+ change the privileges after the grant tables have been set up.
+ In other words, you can run mysql_install_db, and then use
+ mysql -u root mysql to connect to the server as the MySQL root
+ user so that you can issue the necessary GRANT and REVOKE
+ statements.
+ If you want to install MySQL on several machines with the same
+ privileges, you can put the GRANT and REVOKE statements in a
+ file and execute the file as a script using mysql after
+ running mysql_install_db. For example:
+shell> bin/mysql_install_db --user=mysql
+shell> bin/mysql -u root < your_script_file
+ By doing this, you can avoid having to issue the statements
+ manually on each machine.
- If you are using gcc, you may also use have to use the
- --with-low-memory flag for configure to be able to compile
- sql_yacc.cc.
+ * It is possible to re-create the grant tables completely after
+ they have previously been created. You might want to do this
+ if you're just learning how to use GRANT and REVOKE and have
+ made so many modifications after running mysql_install_db that
+ you want to wipe out the tables and start over.
+ To re-create the grant tables, remove all the .frm, .MYI, and
+ .MYD files in the mysql database directory. Then run the
+ mysql_install_db script again.
- If you get problems with the current date in MySQL, setting the TZ
- variable should help. See Section 2.14, "Environment Variables."
+ * You can start mysqld manually using the --skip-grant-tables
+ option and add the privilege information yourself using mysql:
+shell> bin/mysqld_safe --user=mysql --skip-grant-tables &
+shell> bin/mysql mysql
+ From mysql, manually execute the SQL commands contained in
+ mysql_install_db. Make sure that you run mysqladmin
+ flush-privileges or mysqladmin reload afterward to tell the
+ server to reload the grant tables.
+ Note that by not using mysql_install_db, you not only have to
+ populate the grant tables manually, you also have to create
+ them first.
-2.13.4.5. BSD/OS Version 3.x Notes
+2.13.1.2. Starting and Stopping MySQL Automatically
- Upgrade to BSD/OS 3.1. If that is not possible, install BSDIpatch
- M300-038.
+ Generally, you start the mysqld server in one of these ways:
- Use the following command when configuring MySQL:
-env CXX=shlicc++ CC=shlicc2 \
-./configure \
- --prefix=/usr/local/mysql \
- --localstatedir=/var/mysql \
- --without-perl \
- --with-unix-socket-path=/var/mysql/mysql.sock
-
- The following is also known to work:
-env CC=gcc CXX=gcc CXXFLAGS=-O3 \
-./configure \
- --prefix=/usr/local/mysql \
- --with-unix-socket-path=/var/mysql/mysql.sock
-
- You can change the directory locations if you wish, or just use
- the defaults by not specifying any locations.
-
- If you have problems with performance under heavy load, try using
- the --skip-thread-priority option to mysqld. This runs all threads
- with the same priority. On BSDI 3.1, this gives better
- performance, at least until BSDI fixes its thread scheduler.
-
- If you get the error virtual memory exhausted while compiling, you
- should try using ulimit -v 80000 and running make again. If this
- doesn't work and you are using bash, try switching to csh or sh;
- some BSDI users have reported problems with bash and ulimit.
-
-2.13.4.6. BSD/OS Version 4.x Notes
-
- BSDI 4.x has some thread-related bugs. If you want to use MySQL on
- this, you should install all thread-related patches. At least
- M400-023 should be installed.
-
- On some BSDI 4.x systems, you may get problems with shared
- libraries. The symptom is that you can't execute any client
- programs, for example, mysqladmin. In this case, you need to
- reconfigure not to use shared libraries with the --disable-shared
- option to configure.
-
- Some customers have had problems on BSDI 4.0.1 that the mysqld
- binary after a while can't open tables. This occurs because some
- library/system-related bug causes mysqld to change current
- directory without having asked for that to happen.
-
- The fix is to either upgrade MySQL to at least version 3.23.34 or,
- after running configure, remove the line #define HAVE_REALPATH
- from config.h before running make.
-
- Note that this means that you can't symbolically link a database
- directories to another database directory or symbolic link a table
- to another database on BSDI. (Making a symbolic link to another
- disk is okay).
+ * Invoke mysqld directly. This works on any platform.
-2.13.5. Other Unix Notes
+ * Run the MySQL server as a Windows service. The service can be
+ set to start the server automatically when Windows starts, or
+ as a manual service that you start on request. For
+ instructions, see Section 2.5.5.6, "Starting MySQL as a
+ Windows Service."
-2.13.5.1. HP-UX Version 10.20 Notes
+ * Invoke mysqld_safe, which tries to determine the proper
+ options for mysqld and then runs it with those options. This
+ script is used on Unix and Unix-like systems. See Section
+ 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
- If you install MySQL using a binary tarball distribution on HP-UX,
- you may run into trouble even before you get the MySQL
- distribution unpacked, as the HP-UX tar cannot handle long file
- names. This means that you may see errors when you try to unpack
- MySQL.
+ * Invoke mysql.server. This script is used primarily at system
+ startup and shutdown on systems that use System V-style run
+ directories, where it usually is installed under the name
+ mysql. The mysql.server script starts the server by invoking
+ mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server
+ Startup Script."
- If this occurs, you must use GNU tar (gtar) to unpack the
- distribution.
+ * On Mac OS X, install a separate MySQL Startup Item package to
+ enable the automatic startup of MySQL on system startup. The
+ Startup Item starts the server by invoking mysql.server. See
+ Section 2.7, "Installing MySQL on Mac OS X," for details.
- There are a couple of small problems when compiling MySQL on
- HP-UX. Use gcc instead of the HP-UX native compiler, because gcc
- produces better code.
-
- Use gcc 2.95 on HP-UX. Don't use high optimization flags (such as
- -O6) because they may not be safe on HP-UX.
-
- The following configure line should work with gcc 2.95:
-CFLAGS="-I/opt/dce/include -fpic" \
-CXXFLAGS="-I/opt/dce/include -felide-constructors -fno-exceptions \
--fno-rtti" \
-CXX=gcc \
-./configure --with-pthread \
- --with-named-thread-libs='-ldce' \
- --prefix=/usr/local/mysql --disable-shared
-
- The following configure line should work with gcc 3.1:
-CFLAGS="-DHPUX -I/opt/dce/include -O3 -fPIC" CXX=gcc \
-CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors \
- -fno-exceptions -fno-rtti -O3 -fPIC" \
-./configure --prefix=/usr/local/mysql \
- --with-extra-charsets=complex --enable-thread-safe-client \
- --enable-local-infile --with-pthread \
- --with-named-thread-libs=-ldce --with-lib-ccflags=-fPIC
- --disable-shared
+ The mysqld_safe and mysql.server scripts and the Mac OS X Startup
+ Item can be used to start the server manually, or automatically at
+ system startup time. mysql.server and the Startup Item also can be
+ used to stop the server.
-2.13.5.2. HP-UX Version 11.x Notes
+ To start or stop the server manually using the mysql.server
+ script, invoke it with start or stop arguments:
+shell> mysql.server start
+shell> mysql.server stop
- If you install MySQL using a binary tarball distribution on HP-UX,
- you may run into trouble even before you get the MySQL
- distribution unpacked, as the HP-UX tar cannot handle long file
- names. This means that you may see errors when you try to unpack
- MySQL.
+ Before mysql.server starts the server, it changes location to the
+ MySQL installation directory, and then invokes mysqld_safe. If you
+ want the server to run as some specific user, add an appropriate
+ user option to the [mysqld] group of the /etc/my.cnf option file,
+ as shown later in this section. (It is possible that you will need
+ to edit mysql.server if you've installed a binary distribution of
+ MySQL in a nonstandard location. Modify it to change location into
+ the proper directory before it runs mysqld_safe. If you do this,
+ your modified version of mysql.server may be overwritten if you
+ upgrade MySQL in the future, so you should make a copy of your
+ edited version that you can reinstall.)
- If this occurs, you must use GNU tar (gtar) to unpack the
- distribution.
+ mysql.server stop stops the server by sending a signal to it. You
+ can also stop the server manually by executing mysqladmin
+ shutdown.
- Because of some critical bugs in the standard HP-UX libraries, you
- should install the following patches before trying to run MySQL on
- HP-UX 11.0:
-PHKL_22840 Streams cumulative
-PHNE_22397 ARPA cumulative
+ To start and stop MySQL automatically on your server, you need to
+ add start and stop commands to the appropriate places in your
+ /etc/rc* files.
- This solves the problem of getting EWOULDBLOCK from recv() and
- EBADF from accept() in threaded applications.
+ If you use the Linux server RPM package
+ (MySQL-server-VERSION.rpm), the mysql.server script is installed
+ in the /etc/init.d directory with the name mysql. You need not
+ install it manually. See Section 2.6.1, "Installing MySQL from RPM
+ Packages on Linux," for more information on the Linux RPM
+ packages.
- If you are using gcc 2.95.1 on an unpatched HP-UX 11.x system, you
- may get the following error:
-In file included from /usr/include/unistd.h:11,
- from ../include/global.h:125,
- from mysql_priv.h:15,
- from item.cc:19:
-/usr/include/sys/unistd.h:184: declaration of C function ...
-/usr/include/sys/pthread.h:440: previous declaration ...
-In file included from item.h:306,
- from mysql_priv.h:158,
- from item.cc:19:
+ Some vendors provide RPM packages that install a startup script
+ under a different name such as mysqld.
- The problem is that HP-UX does not define pthreads_atfork()
- consistently. It has conflicting prototypes in
- /usr/include/sys/unistd.h:184 and /usr/include/sys/pthread.h:440.
+ If you install MySQL from a source distribution or using a binary
+ distribution format that does not install mysql.server
+ automatically, you can install it manually. The script can be
+ found in the support-files directory under the MySQL installation
+ directory or in a MySQL source tree.
- One solution is to copy /usr/include/sys/unistd.h into
- mysql/include and edit unistd.h and change it to match the
- definition in pthread.h. Look for this line:
-extern int pthread_atfork(void (*prepare)(), void (*parent)(),
- void (*child)());
+ To install mysql.server manually, copy it to the /etc/init.d
+ directory with the name mysql, and then make it executable. Do
+ this by changing location into the appropriate directory where
+ mysql.server is located and executing these commands:
+shell> cp mysql.server /etc/init.d/mysql
+shell> chmod +x /etc/init.d/mysql
- Change it to look like this:
-extern int pthread_atfork(void (*prepare)(void), void (*parent)(void)
-,
- void (*child)(void));
+ Older Red Hat systems use the /etc/rc.d/init.d directory rather
+ than /etc/init.d. Adjust the preceding commands accordingly.
+ Alternatively, first create /etc/init.d as a symbolic link that
+ points to /etc/rc.d/init.d:
+shell> cd /etc
+shell> ln -s rc.d/init.d .
- After making the change, the following configure line should work:
-CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \
-CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \
-./configure --prefix=/usr/local/mysql --disable-shared
+ After installing the script, the commands needed to activate it to
+ run at system startup depend on your operating system. On Linux,
+ you can use chkconfig:
+shell> chkconfig --add mysql
- If you are using HP-UX compiler, you can use the following command
- (which has been tested with cc B.11.11.04):
-CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
- --with-extra-character-set=complex
+ On some Linux systems, the following command also seems to be
+ necessary to fully enable the mysql script:
+shell> chkconfig --level 345 mysql on
- You can ignore any errors of the following type:
-aCC: warning 901: unknown option: `-3': use +help for online
-documentation
+ On FreeBSD, startup scripts generally should go in
+ /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in
+ this directory are executed only if their basename matches the
+ *.sh shell file name pattern. Any other files or directories
+ present within the directory are silently ignored. In other words,
+ on FreeBSD, you should install the mysql.server script as
+ /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup.
- If you get the following error from configure, verify that you
- don't have the path to the K&R compiler before the path to the
- HP-UX C and C++ compiler:
-checking for cc option to accept ANSI C... no
-configure: error: MySQL requires an ANSI C compiler (and a C++ compil
-er).
-Try gcc. See the Installation chapter in the Reference Manual.
+ As an alternative to the preceding setup, some operating systems
+ also use /etc/rc.local or /etc/init.d/boot.local to start
+ additional services on startup. To start up MySQL using this
+ method, you could append a command like the one following to the
+ appropriate startup file:
+/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
- Another reason for not being able to compile is that you didn't
- define the +DD64 flags as just described.
+ For other systems, consult your operating system documentation to
+ see how to install startup scripts.
- Another possibility for HP-UX 11 is to use the MySQL binaries
- provided at http://dev.mysql.com/downloads/, which we have built
- and tested ourselves. We have also received reports that the HP-UX
- 10.20 binaries supplied by MySQL can be run successfully on HP-UX
- 11. If you encounter problems, you should be sure to check your
- HP-UX patch level.
+ You can add options for mysql.server in a global /etc/my.cnf file.
+ A typical /etc/my.cnf file might look like this:
+[mysqld]
+datadir=/usr/local/mysql/var
+socket=/var/tmp/mysql.sock
+port=3306
+user=mysql
-2.13.5.3. IBM-AIX notes
+[mysql.server]
+basedir=/usr/local/mysql
- Automatic detection of xlC is missing from Autoconf, so a number
- of variables need to be set before running configure. The
- following example uses the IBM compiler:
-export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 "
-export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192"
-export CFLAGS="-I /usr/local/include"
-export LDFLAGS="-L /usr/local/lib"
-export CPPFLAGS=$CFLAGS
-export CXXFLAGS=$CFLAGS
+ The mysql.server script supports the following options: basedir,
+ datadir, and pid-file. If specified, they must be placed in an
+ option file, not on the command line. mysql.server supports only
+ start and stop as command-line arguments.
-./configure --prefix=/usr/local \
- --localstatedir=/var/mysql \
- --sbindir='/usr/local/bin' \
- --libexecdir='/usr/local/bin' \
- --enable-thread-safe-client \
- --enable-large-files
+ The following table shows which option groups the server and each
+ startup script read from option files.
+ Script Option Groups
+ mysqld [mysqld], [server], [mysqld-major_version]
+ mysqld_safe [mysqld], [server], [mysqld_safe]
+ mysql.server [mysqld], [mysql.server], [server]
- The preceding options are used to compile the MySQL distribution
- that can be found at http://www-frec.bull.com/.
+ [mysqld-major_version] means that groups with names like
+ [mysqld-5.0] and [mysqld-5.1] are read by servers having versions
+ 5.0.x, 5.1.x, and so forth. This feature can be used to specify
+ options that can be read only by servers within a given release
+ series.
- If you change the -O3 to -O2 in the preceding configure line, you
- must also remove the -qstrict option. This is a limitation in the
- IBM C compiler.
+ For backward compatibility, mysql.server also reads the
+ [mysql_server] group and mysqld_safe also reads the [safe_mysqld]
+ group. However, you should update your option files to use the
+ [mysql.server] and [mysqld_safe] groups instead when using MySQL
+ 5.1.
- If you are using gcc to compile MySQL, you must use the
- -fno-exceptions flag, because the exception handling in gcc is not
- thread-safe! There are also some known problems with IBM's
- assembler that may cause it to generate bad code when used with
- gcc.
+ See Section 4.2.3.3, "Using Option Files."
- Use the following configure line with gcc 2.95 on AIX:
-CC="gcc -pipe -mcpu=power -Wa,-many" \
-CXX="gcc -pipe -mcpu=power -Wa,-many" \
-CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \
-./configure --prefix=/usr/local/mysql --with-low-memory
+2.13.1.3. Starting and Troubleshooting the MySQL Server
- The -Wa,-many option is necessary for the compile to be
- successful. IBM is aware of this problem but is in no hurry to fix
- it because of the workaround that is available. We don't know if
- the -fno-exceptions is required with gcc 2.95, but because MySQL
- doesn't use exceptions and the option generates faster code, you
- should always use it with gcc.
+ This section provides troubleshooting suggestions for problems
+ starting the server on Unix. If you are using Windows, see Section
+ 2.5.6, "Troubleshooting a MySQL Installation Under Windows."
- If you get a problem with assembler code, try changing the
- -mcpu=xxx option to match your CPU. Typically power2, power, or
- powerpc may need to be used. Alternatively, you might need to use
- 604 or 604e. We are not positive but suspect that power would
- likely be safe most of the time, even on a power2 machine.
+ If you have problems starting the server, here are some things to
+ try:
- If you don't know what your CPU is, execute a uname -m command. It
- produces a string that looks like 000514676700, with a format of
- xxyyyyyymmss where xx and ss are always 00, yyyyyy is a unique
- system ID and mm is the ID of the CPU Planar. A chart of these
- values can be found at
- http://www16.boulder.ibm.com/pseries/en_US/cmds/aixcmds5/uname.htm
- .
+ * Check the error log to see why the server does not start.
- This gives you a machine type and a machine model you can use to
- determine what type of CPU you have.
+ * Specify any special options needed by the storage engines you
+ are using.
- If you have problems with signals (MySQL dies unexpectedly under
- high load), you may have found an OS bug with threads and signals.
- In this case, you can tell MySQL not to use signals by configuring
- as follows:
-CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
-CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \
--DDONT_USE_THR_ALARM" \
-./configure --prefix=/usr/local/mysql --with-debug \
- --with-low-memory
+ * Make sure that the server knows where to find the data
+ directory.
- This doesn't affect the performance of MySQL, but has the side
- effect that you can't kill clients that are "sleeping" on a
- connection with mysqladmin kill or mysqladmin shutdown. Instead,
- the client dies when it issues its next command.
+ * Make sure that the server can access the data directory. The
+ ownership and permissions of the data directory and its
+ contents must be set such that the server can read and modify
+ them.
- On some versions of AIX, linking with libbind.a makes
- getservbyname() dump core. This is an AIX bug and should be
- reported to IBM.
+ * Verify that the network interfaces the server wants to use are
+ available.
- For AIX 4.2.1 and gcc, you have to make the following changes.
+ Some storage engines have options that control their behavior. You
+ can create a my.cnf file and specify startup options for the
+ engines that you plan to use. If you are going to use storage
+ engines that support transactional tables (InnoDB, NDB), be sure
+ that you have them configured the way you want before starting the
+ server:
- After configuring, edit config.h and include/my_config.h and
- change the line that says this:
-#define HAVE_SNPRINTF 1
+ * If you are using InnoDB tables, see Section 13.6.2, "InnoDB
+ Configuration."
- to this:
-#undef HAVE_SNPRINTF
+ * If you are using MySQL Cluster, see Section 17.3, "MySQL
+ Cluster Configuration."
- And finally, in mysqld.cc, you need to add a prototype for
- initgroups().
-#ifdef _AIX41
-extern "C" int initgroups(const char *,int);
-#endif
+ MySQL Enterprise For expert advice on start-up options appropriate
+ to your circumstances, subscribe to The MySQL Enterprise Monitor.
+ For more information, see
+ http://www.mysql.com/products/enterprise/advisors.html.
- For 32-bit binaries, if you need to allocate a lot of memory to
- the mysqld process, it is not enough to just use ulimit -d
- unlimited. You may also have to modify mysqld_safe to add a line
- something like this:
-export LDR_CNTRL='MAXDATA=0x80000000'
+ Storage engines will use default option values if you specify
+ none, but it is recommended that you review the available options
+ and specify explicit values for those for which the defaults are
+ not appropriate for your installation.
- You can find more information about using a lot of memory at
- http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lr
- g_prg_support.htm.
+ When the mysqld server starts, it changes location to the data
+ directory. This is where it expects to find databases and where it
+ expects to write log files. The server also writes the pid
+ (process ID) file in the data directory.
- Users of AIX 4.3 should use gmake instead of the make utility
- included with AIX.
+ The data directory location is hardwired in when the server is
+ compiled. This is where the server looks for the data directory by
+ default. If the data directory is located somewhere else on your
+ system, the server will not work properly. You can determine what
+ the default path settings are by invoking mysqld with the
+ --verbose and --help options.
- As of AIX 4.1, the C compiler has been unbundled from AIX as a
- separate product. gcc 3.3.2 can be obtained here:
- ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gc
- c/
+ If the default locations don't match the MySQL installation layout
+ on your system, you can override them by specifying options to
+ mysqld or mysqld_safe on the command line or in an option file.
- The steps for compiling MySQL on AIX with gcc 3.3.2 are similar to
- those for using gcc 2.95 (in particular, the need to edit config.h
- and my_config.h after running configure). However, before running
- configure, you should also patch the curses.h file as follows:
-/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/curses
-.h.ORIG
- Mon Dec 26 02:17:28 2005
---- /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/cu
-rses.h
-Mon Dec 26 02:40:13 2005
-***************
-*** 2023,2029 ****
+ To specify the location of the data directory explicitly, use the
+ --datadir option. However, normally you can tell mysqld the
+ location of the base directory under which MySQL is installed and
+ it looks for the data directory there. You can do this with the
+ --basedir option.
+
+ To check the effect of specifying path options, invoke mysqld with
+ those options followed by the --verbose and --help options. For
+ example, if you change location into the directory where mysqld is
+ installed and then run the following command, it shows the effect
+ of starting the server with a base directory of /usr/local:
+shell> ./mysqld --basedir=/usr/local --verbose --help
+ You can specify other options such as --datadir as well, but
+ --verbose and --help must be the last options.
- #endif /* _AIX32_CURSES */
-! #if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || de
-fined
-(__STRICT_ANSI__)
- extern int delwin (WINDOW *);
- extern int endwin (void);
- extern int getcurx (WINDOW *);
---- 2023,2029 ----
+ Once you determine the path settings you want, start the server
+ without --verbose and --help.
+ If mysqld is currently running, you can find out what path
+ settings it is using by executing this command:
+shell> mysqladmin variables
- #endif /* _AIX32_CURSES */
-! #if 0 && (defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus)
-|| defined
-(__STRICT_ANSI__))
- extern int delwin (WINDOW *);
- extern int endwin (void);
- extern int getcurx (WINDOW *);
+ Or:
+shell> mysqladmin -h host_name variables
-2.13.5.4. SunOS 4 Notes
+ host_name is the name of the MySQL server host.
- On SunOS 4, MIT-pthreads is needed to compile MySQL. This in turn
- means you need GNU make.
+ If you get Errcode 13 (which means Permission denied) when
+ starting mysqld, this means that the privileges of the data
+ directory or its contents do not allow the server access. In this
+ case, you change the permissions for the involved files and
+ directories so that the server has the right to use them. You can
+ also start the server as root, but this raises security issues and
+ should be avoided.
- Some SunOS 4 systems have problems with dynamic libraries and
- libtool. You can use the following configure line to avoid this
- problem:
-./configure --disable-shared --with-mysqld-ldflags=-all-static
-
- When compiling readline, you may get warnings about duplicate
- defines. These can be ignored.
-
- When compiling mysqld, there are some implicit declaration of
- function warnings. These can be ignored.
-
-2.13.5.5. Alpha-DEC-UNIX Notes (Tru64)
-
- If you are using egcs 1.1.2 on Digital Unix, you should upgrade to
- gcc 2.95.2, because egcs on DEC has some serious bugs!
-
- When compiling threaded programs under Digital Unix, the
- documentation recommends using the -pthread option for cc and cxx
- and the -lmach -lexc libraries (in addition to -lpthread). You
- should run configure something like this:
-CC="cc -pthread" CXX="cxx -pthread -O" \
-./configure --with-named-thread-libs="-lpthread -lmach -lexc -lc"
-
- When compiling mysqld, you may see a couple of warnings like this:
-mysqld.cc: In function void handle_connections()':
-mysqld.cc:626: passing long unsigned int *' as argument 3 of
-accept(int,sockadddr *, int *)'
-
- You can safely ignore these warnings. They occur because configure
- can detect only errors, not warnings.
-
- If you start the server directly from the command line, you may
- have problems with it dying when you log out. (When you log out,
- your outstanding processes receive a SIGHUP signal.) If so, try
- starting the server like this:
-nohup mysqld [options] &
-
- nohup causes the command following it to ignore any SIGHUP signal
- sent from the terminal. Alternatively, start the server by running
- mysqld_safe, which invokes mysqld using nohup for you. See Section
- 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
-
- If you get a problem when compiling mysys/get_opt.c, just remove
- the #define _NO_PROTO line from the start of that file.
-
- If you are using Compaq's CC compiler, the following configure
- line should work:
-CC="cc -pthread"
-CFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all -arch host"
-CXX="cxx -pthread"
-CXXFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all -arch host -noexceptions -nortti"
-export CC CFLAGS CXX CXXFLAGS
-./configure \
- --prefix=/usr/local/mysql \
- --with-low-memory \
- --enable-large-files \
- --enable-shared=yes \
- --with-named-thread-libs="-lpthread -lmach -lexc -lc"
-gnumake
-
- If you get a problem with libtool when compiling with shared
- libraries as just shown, when linking mysql, you should be able to
- get around this by issuing these commands:
-cd mysql
-/bin/sh ../libtool --mode=link cxx -pthread -O3 -DDBUG_OFF \
- -O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all \ -arch host -DUNDEF_HAVE_GETHOSTBYNAME_R \
- -o mysql mysql.o readline.o sql_string.o completion_hash.o \
- ../readline/libreadline.a -lcurses \
- ../libmysql/.libs/libmysqlclient.so -lm
-cd ..
-gnumake
-gnumake install
-scripts/mysql_install_db
-
-2.13.5.6. Alpha-DEC-OSF/1 Notes
-
- If you have problems compiling and have DEC CC and gcc installed,
- try running configure like this:
-CC=cc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 \
-./configure --prefix=/usr/local/mysql
-
- If you get problems with the c_asm.h file, you can create and use
- a 'dummy' c_asm.h file with:
-touch include/c_asm.h
-CC=gcc CFLAGS=-I./include \
-CXX=gcc CXXFLAGS=-O3 \
-./configure --prefix=/usr/local/mysql
-
- Note that the following problems with the ld program can be fixed
- by downloading the latest DEC (Compaq) patch kit from:
- http://ftp.support.compaq.com/public/unix/.
-
- On OSF/1 V4.0D and compiler "DEC C V5.6-071 on Digital Unix V4.0
- (Rev. 878)," the compiler had some strange behavior (undefined asm
- symbols). /bin/ld also appears to be broken (problems with _exit
- undefined errors occurring while linking mysqld). On this system,
- we have managed to compile MySQL with the following configure
- line, after replacing /bin/ld with the version from OSF 4.0C:
-CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql
-
- With the Digital compiler "C++ V6.1-029," the following should
- work:
-CC=cc -pthread
-CFLAGS=-O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all -arch host
-CXX=cxx -pthread
-CXXFLAGS=-O4 -ansi_alias -ansi_args -fast -inline speed \
- -speculate all -arch host -noexceptions -nortti
-export CC CFLAGS CXX CXXFLAGS
-./configure --prefix=/usr/mysql/mysql \
- --with-mysqld-ldflags=-all-static --disable-shared \
- --with-named-thread-libs="-lmach -lexc -lc"
-
- In some versions of OSF/1, the alloca() function is broken. Fix
- this by removing the line in config.h that defines 'HAVE_ALLOCA'.
-
- The alloca() function also may have an incorrect prototype in
- /usr/include/alloca.h. This warning resulting from this can be
- ignored.
+ On Unix, change location into the data directory and check the
+ ownership of the data directory and its contents to make sure the
+ server has access. For example, if the data directory is
+ /usr/local/mysql/var, use this command:
+shell> ls -la /usr/local/mysql/var
- configure uses the following thread libraries automatically:
- --with-named-thread-libs="-lpthread -lmach -lexc -lc".
+ If the data directory or its files or subdirectories are not owned
+ by the login account that you use for running the server, change
+ their ownership to that account. If the account is named mysql,
+ use these commands:
+shell> chown -R mysql /usr/local/mysql/var
+shell> chgrp -R mysql /usr/local/mysql/var
- When using gcc, you can also try running configure like this:
-CFLAGS=-D_PTHREAD_USE_D4 CXX=gcc CXXFLAGS=-O3 ./configure ...
+ If it possible that even with correct ownership, MySQL may fail to
+ start up if there is other security software running on your
+ system that manages application access to various parts of the
+ file system. In this case, you may need to reconfigure that
+ software to enable mysqld to access the directories it uses during
+ normal operation.
- If you have problems with signals (MySQL dies unexpectedly under
- high load), you may have found an OS bug with threads and signals.
- In this case, you can tell MySQL not to use signals by configuring
- with:
-CFLAGS=-DDONT_USE_THR_ALARM \
-CXXFLAGS=-DDONT_USE_THR_ALARM \
-./configure ...
+ If the server fails to start up correctly, check the error log.
+ Log files are located in the data directory (typically C:\Program
+ Files\MySQL\MySQL Server 5.1\data on Windows,
+ /usr/local/mysql/data for a Unix binary distribution, and
+ /usr/local/var for a Unix source distribution). Look in the data
+ directory for files with names of the form host_name.err and
+ host_name.log, where host_name is the name of your server host.
+ Then examine the last few lines of these files. On Unix, you can
+ use tail to display them:
+shell> tail host_name.err
+shell> tail host_name.log
- This does not affect the performance of MySQL, but has the side
- effect that you can't kill clients that are "sleeping" on a
- connection with mysqladmin kill or mysqladmin shutdown. Instead,
- the client dies when it issues its next command.
+ The error log should contain information that indicates why the
+ server couldn't start.
+
+ If either of the following errors occur, it means that some other
+ program (perhaps another mysqld server) is using the TCP/IP port
+ or Unix socket file that mysqld is trying to use:
+Can't start server: Bind on TCP/IP port: Address already in use
+Can't start server: Bind on unix socket...
- With gcc 2.95.2, you may encounter the following compile error:
-sql_acl.cc:1456: Internal compiler error in `scan_region',
-at except.c:2566
-Please submit a full bug report.
-
- To fix this, you should change to the sql directory and do a
- cut-and-paste of the last gcc line, but change -O3 to -O0 (or add
- -O0 immediately after gcc if you don't have any -O option on your
- compile line). After this is done, you can just change back to the
- top-level directory and run make again.
-
-2.13.5.7. SGI Irix Notes
-
- As of MySQL 5.0, we don't provide binaries for Irix any more.
-
- If you are using Irix 6.5.3 or newer, mysqld is able to create
- threads only if you run it as a user that has CAP_SCHED_MGT
- privileges (such as root) or give the mysqld server this privilege
- with the following shell command:
-chcap "CAP_SCHED_MGT+epi" /opt/mysql/libexec/mysqld
-
- You may have to undefine some symbols in config.h after running
- configure and before compiling.
-
- In some Irix implementations, the alloca() function is broken. If
- the mysqld server dies on some SELECT statements, remove the lines
- from config.h that define HAVE_ALLOC and HAVE_ALLOCA_H. If
- mysqladmin create doesn't work, remove the line from config.h that
- defines HAVE_READDIR_R. You may have to remove the HAVE_TERM_H
- line as well.
-
- SGI recommends that you install all the patches on this page as a
- set:
- http://support.sgi.com/surfzone/patches/patchset/6.2_indigo.rps.ht
- ml
-
- At the very minimum, you should install the latest kernel rollup,
- the latest rld rollup, and the latest libc rollup.
-
- You definitely need all the POSIX patches on this page, for
- pthreads support:
-
- http://support.sgi.com/surfzone/patches/patchset/6.2_posix.rps.htm
- l
-
- If you get the something like the following error when compiling
- mysql.cc:
-"/usr/include/curses.h", line 82: error(1084):
-invalid combination of type
-
- Type the following in the top-level directory of your MySQL source
- tree:
-extra/replace bool curses_bool < /usr/include/curses.h > include/curs
-es.h
-make
-
- There have also been reports of scheduling problems. If only one
- thread is running, performance is slow. Avoid this by starting
- another client. This may lead to a two-to-tenfold increase in
- execution speed thereafter for the other thread. This is a poorly
- understood problem with Irix threads; you may have to improvise to
- find solutions until this can be fixed.
+ Use ps to determine whether you have another mysqld server
+ running. If so, shut down the server before starting mysqld again.
+ (If another server is running, and you really want to run multiple
+ servers, you can find information about how to do so in Section
+ 5.6, "Running Multiple MySQL Servers on the Same Machine.")
- If you are compiling with gcc, you can use the following configure
- command:
-CC=gcc CXX=gcc CXXFLAGS=-O3 \
-./configure --prefix=/usr/local/mysql --enable-thread-safe-client \
- --with-named-thread-libs=-lpthread
-
- On Irix 6.5.11 with native Irix C and C++ compilers ver. 7.3.1.2,
- the following is reported to work
-CC=cc CXX=CC CFLAGS='-O3 -n32 -TARG:platform=IP22 -I/usr/local/includ
-e \
--L/usr/local/lib' CXXFLAGS='-O3 -n32 -TARG:platform=IP22 \
--I/usr/local/include -L/usr/local/lib' \
-./configure --prefix=/usr/local/mysql --with-innodb \
- --with-libwrap=/usr/local \
- --with-named-curses-libs=/usr/local/lib/libncurses.a
-
-2.13.5.8. SCO UNIX and OpenServer 5.0.x Notes
-
- The current port is tested only on sco3.2v5.0.5, sco3.2v5.0.6, and
- sco3.2v5.0.7 systems. There has also been progress on a port to
- sco3.2v4.2. Open Server 5.0.8 (Legend) has native threads and
- allows files greater than 2GB. The current maximum file size is
- 2GB.
-
- We have been able to compile MySQL with the following configure
- command on OpenServer with gcc 2.95.3.
-CC=gcc CFLAGS="-D_FILE_OFFSET_BITS=64 -O3" \
-CXX=gcc CXXFLAGS="-D_FILE_OFFSET_BITS=64 -O3" \
-./configure --prefix=/usr/local/mysql \
- --enable-thread-safe-client --with-innodb \
- --with-openssl --with-vio --with-extra-charsets=complex
-
- gcc is available at
- ftp://ftp.sco.com/pub/openserver5/opensrc/gnutools-5.0.7Kj.
-
- This development system requires the OpenServer Execution
- Environment Supplement oss646B on OpenServer 5.0.6 and oss656B and
- The OpenSource libraries found in gwxlibs. All OpenSource tools
- are in the opensrc directory. They are available at
- ftp://ftp.sco.com/pub/openserver5/opensrc/.
-
- Use the latest production release of MySQL.
-
- SCO provides operating system patches at
- ftp://ftp.sco.com/pub/openserver5 for OpenServer 5.0.[0-6] and
- ftp://ftp.sco.com/pub/openserverv5/507 for OpenServer 5.0.7.
-
- SCO provides information about security fixes at
- ftp://ftp.sco.com/pub/security/OpenServer for OpenServer 5.0.x.
-
- The maximum file size on an OpenServer 5.0.x system is 2GB.
-
- The total memory which can be allocated for streams buffers,
- clists, and lock records cannot exceed 60MB on OpenServer 5.0.x.
-
- Streams buffers are allocated in units of 4096 byte pages, clists
- are 70 bytes each, and lock records are 64 bytes each, so:
-(NSTRPAGES x 4096) + (NCLIST x 70) + (MAX_FLCKREC x 64) <= 62914560
-
- Follow this procedure to configure the Database Services option.
- If you are unsure whether an application requires this, see the
- documentation provided with the application.
-
- 1. Log in as root.
-
- 2. Enable the SUDS driver by editing the /etc/conf/sdevice.d/suds
- file. Change the N in the second field to a Y.
-
- 3. Use mkdev aio or the Hardware/Kernel Manager to enable support
- for asynchronous I/O and relink the kernel. To allow users to
- lock down memory for use with this type of I/O, update the
- aiomemlock(F) file. This file should be updated to include the
- names of users that can use AIO and the maximum amounts of
- memory they can lock down.
-
- 4. Many applications use setuid binaries so that you need to
- specify only a single user. See the documentation provided
- with the application to determine whether this is the case for
- your application.
+ If no other server is running, try to execute the command telnet
+ your_host_name tcp_ip_port_number. (The default MySQL port number
+ is 3306.) Then press Enter a couple of times. If you don't get an
+ error message like telnet: Unable to connect to remote host:
+ Connection refused, some other program is using the TCP/IP port
+ that mysqld is trying to use. You'll need to track down what
+ program this is and disable it, or else tell mysqld to listen to a
+ different port with the --port option. In this case, you'll also
+ need to specify the port number for client programs when
+ connecting to the server via TCP/IP.
- After you complete this process, reboot the system to create a new
- kernel incorporating these changes.
+ Another reason the port might be inaccessible is that you have a
+ firewall running that blocks connections to it. If so, modify the
+ firewall settings to allow access to the port.
- By default, the entries in /etc/conf/cf.d/mtune are set as
- follows:
-Value Default Min Max
------ ------- --- ---
-NBUF 0 24 450000
-NHBUF 0 32 524288
-NMPBUF 0 12 512
-MAX_INODE 0 100 64000
-MAX_FILE 0 100 64000
-CTBUFSIZE 128 0 256
-MAX_PROC 0 50 16000
-MAX_REGION 0 500 160000
-NCLIST 170 120 16640
-MAXUP 100 15 16000
-NOFILES 110 60 11000
-NHINODE 128 64 8192
-NAUTOUP 10 0 60
-NGROUPS 8 0 128
-BDFLUSHR 30 1 300
-MAX_FLCKREC 0 50 16000
-PUTBUFSZ 8000 2000 20000
-MAXSLICE 100 25 100
-ULIMIT 4194303 2048 4194303
-* Streams Parameters
-NSTREAM 64 1 32768
-NSTRPUSH 9 9 9
-NMUXLINK 192 1 4096
-STRMSGSZ 16384 4096 524288
-STRCTLSZ 1024 1024 1024
-STRMAXBLK 524288 4096 524288
-NSTRPAGES 500 0 8000
-STRSPLITFRAC 80 50 100
-NLOG 3 3 3
-NUMSP 64 1 256
-NUMTIM 16 1 8192
-NUMTRW 16 1 8192
-* Semaphore Parameters
-SEMMAP 10 10 8192
-SEMMNI 10 10 8192
-SEMMNS 60 60 8192
-SEMMNU 30 10 8192
-SEMMSL 25 25 150
-SEMOPM 10 10 1024
-SEMUME 10 10 25
-SEMVMX 32767 32767 32767
-SEMAEM 16384 16384 16384
-* Shared Memory Parameters
-SHMMAX 524288 131072 2147483647
-SHMMIN 1 1 1
-SHMMNI 100 100 2000
-FILE 0 100 64000
-NMOUNT 0 4 256
-NPROC 0 50 16000
-NREGION 0 500 160000
-
- Set these values as follows:
-
- * NOFILES should be 4096 or 2048.
-
- * MAXUP should be 2048.
-
- To make changes to the kernel, use the idtune name parameter
- command. idtune modifies the /etc/conf/cf.d/stune file for you.
- For example, to change SEMMS to 200, execute this command as root:
-# /etc/conf/bin/idtune SEMMNS 200
-
- Then rebuild and reboot the kernel by issuing this command:
-# /etc/conf/bin/idbuild -B && init 6
-
- To tune the system, the proper parameter values to use depend on
- the number of users accessing the application or database and size
- the of the database (that is, the used buffer pool). The following
- kernel parameters can be set with idtune:
-
- * SHMMAX (recommended setting: 128MB) and SHMSEG (recommended
- setting: 15). These parameters have an influence on the MySQL
- database engine to create user buffer pools.
-
- * NOFILES and MAXUP should be set to at least 2048.
-
- * MAXPROC should be set to at least 3000/4000 (depends on number
- of users) or more.
-
- * The following formulas are recommended to calculate values for
- SEMMSL, SEMMNS, and SEMMNU:
-SEMMSL = 13
- 13 is what has been found to be the best for both Progress and
- MySQL.
-SEMMNS = SEMMSL x number of db servers to be run on the system
- Set SEMMNS to the value of SEMMSL multiplied by the number of
- database servers (maximum) that you are running on the system
- at one time.
-SEMMNU = SEMMNS
- Set the value of SEMMNU to equal the value of SEMMNS. You
- could probably set this to 75% of SEMMNS, but this is a
- conservative estimate.
-
- You need to at least install the SCO OpenServer Linker and
- Application Development Libraries or the OpenServer Development
- System to use gcc. You cannot use the GCC Dev system without
- installing one of these.
-
- You should get the FSU Pthreads package and install it first. This
- can be found at
- http://moss.csc.ncsu.edu/~mueller/ftp/pub/PART/pthreads.tar.gz.
- You can also get a precompiled package from
- ftp://ftp.zenez.com/pub/zenez/prgms/FSU-threads-3.14.tar.gz.
-
- FSU Pthreads can be compiled with SCO Unix 4.2 with tcpip, or
- using OpenServer 3.0 or Open Desktop 3.0 (OS 3.0 ODT 3.0) with the
- SCO Development System installed using a good port of GCC 2.5.x.
- For ODT or OS 3.0, you need a good port of GCC 2.5.x. There are a
- lot of problems without a good port. The port for this product
- requires the SCO Unix Development system. Without it, you are
- missing the libraries and the linker that is needed. You also need
- SCO-3.2v4.2-includes.tar.gz. This file contains the changes to the
- SCO Development include files that are needed to get MySQL to
- build. You need to replace the existing system include files with
- these modified header files. They can be obtained from
- ftp://ftp.zenez.com/pub/zenez/prgms/SCO-3.2v4.2-includes.tar.gz.
-
- To build FSU Pthreads on your system, all you should need to do is
- run GNU make. The Makefile in FSU-threads-3.14.tar.gz is set up to
- make FSU-threads.
-
- You can run ./configure in the threads/src directory and select
- the SCO OpenServer option. This command copies Makefile.SCO5 to
- Makefile. Then run make.
+ If the server starts but you can't connect to it, you should make
+ sure that you have an entry in /etc/hosts that looks like this:
+127.0.0.1 localhost
- To install in the default /usr/include directory, log in as root,
- and then cd to the thread/src directory and run make install.
+ This problem occurs only on systems that do not have a working
+ thread library and for which MySQL must be configured to use
+ MIT-pthreads.
- Remember that you must use GNU make to build MySQL.
+ If you cannot get mysqld to start, you can try to make a trace
+ file to find the problem by using the --debug option. See MySQL
+ Internals: Porting
+ (http://forge.mysql.com/wiki/MySQL_Internals_Porting)
-Note
+2.13.2. Securing the Initial MySQL Accounts
- If you don't start mysqld_safe as root, you should get only the
- default 110 open files per process. mysqld writes a note about
- this in the log file.
+ Part of the MySQL installation process is to set up the mysql
+ database that contains the grant tables:
+
+ * Windows distributions contain preinitialized grant tables that
+ are installed automatically.
- With SCO 3.2V4.2, you should use FSU Pthreads version 3.14 or
- newer. The following configure command should work:
-CFLAGS="-D_XOPEN_XPG4" CXX=gcc CXXFLAGS="-D_XOPEN_XPG4" \
-./configure \
- --prefix=/usr/local/mysql \
- --with-named-thread-libs="-lgthreads -lsocket -lgen -lgthreads" \
- --with-named-curses-libs="-lcurses"
+ * On Unix, the grant tables are populated by the
+ mysql_install_db program. Some installation methods run this
+ program for you. Others require that you execute it manually.
+ For details, see Section 2.13.1, "Unix Post-Installation
+ Procedures."
- You may have problems with some include files. In this case, you
- can find new SCO-specific include files at
- ftp://ftp.zenez.com/pub/zenez/prgms/SCO-3.2v4.2-includes.tar.gz.
+ The grant tables define the initial MySQL user accounts and their
+ access privileges. These accounts are set up as follows:
- You should unpack this file in the include directory of your MySQL
- source tree.
+ * Accounts with the user name root are created. These are
+ superuser accounts that can do anything. The initial root
+ account passwords are empty, so anyone can connect to the
+ MySQL server as root --- without a password --- and be granted
+ all privileges.
- SCO development notes:
+ + On Windows, one root account is created; this account
+ allows connecting from the local host only. The Windows
+ installer will optionally create an account allowing for
+ connections from any host only if the user selects the
+ Enable root access from remote machines option during
+ installation.
- * MySQL should automatically detect FSU Pthreads and link mysqld
- with -lgthreads -lsocket -lgthreads.
+ + On Unix, both root accounts are for connections from the
+ local host. Connections must be made from the local host
+ by specifying a host name of localhost for one of the
+ accounts, or the actual host name or IP number for the
+ other.
- * The SCO development libraries are re-entrant in FSU Pthreads.
- SCO claims that its library functions are re-entrant, so they
- must be re-entrant with FSU Pthreads. FSU Pthreads on
- OpenServer tries to use the SCO scheme to make re-entrant
- libraries.
+ * Two anonymous-user accounts are created, each with an empty
+ user name. The anonymous accounts have no password, so anyone
+ can use them to connect to the MySQL server.
- * FSU Pthreads (at least the version at ftp://ftp.zenez.com)
- comes linked with GNU malloc. If you encounter problems with
- memory usage, make sure that gmalloc.o is included in
- libgthreads.a and libgthreads.so.
+ + On Windows, one anonymous account is for connections from
+ the local host. It has no global privileges. (Before
+ MySQL 5.1.16, it has all global privileges, just like the
+ root accounts.) The other is for connections from any
+ host and has all privileges for the test database and for
+ other databases with names that start with test.
- * In FSU Pthreads, the following system calls are
- pthreads-aware: read(), write(), getmsg(), connect(),
- accept(), select(), and wait().
+ + On Unix, both anonymous accounts are for connections from
+ the local host. Connections must be made from the local
+ host by specifying a host name of localhost for one of
+ the accounts, or the actual host name or IP number for
+ the other. These accounts have all privileges for the
+ test database and for other databases with names that
+ start with test_.
- * The CSSA-2001-SCO.35.2 (the patch is listed in custom as
- erg711905-dscr_remap security patch (version 2.0.0)) breaks
- FSU threads and makes mysqld unstable. You have to remove this
- one if you want to run mysqld on an OpenServer 5.0.6 machine.
+ As noted, none of the initial accounts have passwords. This means
+ that your MySQL installation is unprotected until you do something
+ about it:
- * If you use SCO OpenServer 5, you may need to recompile FSU
- pthreads with -DDRAFT7 in CFLAGS. Otherwise, InnoDB may hang
- at a mysqld startup.
+ * If you want to prevent clients from connecting as anonymous
+ users without a password, you should either assign a password
+ to each anonymous account or else remove the accounts.
- * SCO provides operating system patches at
- ftp://ftp.sco.com/pub/openserver5 for OpenServer 5.0.x.
+ * You should assign a password to each MySQL root account.
- * SCO provides security fixes and libsocket.so.2 at
- ftp://ftp.sco.com/pub/security/OpenServer and
- ftp://ftp.sco.com/pub/security/sse for OpenServer 5.0.x.
+ The following instructions describe how to set up passwords for
+ the initial MySQL accounts, first for the anonymous accounts and
+ then for the root accounts. Replace "newpwd" in the examples with
+ the actual password that you want to use. The instructions also
+ cover how to remove the anonymous accounts, should you prefer not
+ to allow anonymous access at all.
- * Pre-OSR506 security fixes. Also, the telnetd fix at
- ftp://stage.caldera.com/pub/security/openserver/ or
- ftp://stage.caldera.com/pub/security/openserver/CSSA-2001-SCO.
- 10/ as both libsocket.so.2 and libresolv.so.1 with
- instructions for installing on pre-OSR506 systems.
- It is probably a good idea to install these patches before
- trying to compile/use MySQL.
+ You might want to defer setting the passwords until later, so that
+ you don't need to specify them while you perform additional setup
+ or testing. However, be sure to set them before using your
+ installation for production purposes.
- Beginning with Legend/OpenServer 6.0.0, there are native threads
- and no 2GB file size limit.
+ Anonymous Account Password Assignment
-2.13.5.9. SCO OpenServer 6.0.x Notes
+ To assign passwords to the anonymous accounts, connect to the
+ server as root and then use either SET PASSWORD or UPDATE. In
+ either case, be sure to encrypt the password using the PASSWORD()
+ function.
- OpenServer 6 includes these key improvements:
+ To use SET PASSWORD on Windows, do this:
+shell> mysql -u root
+mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
+mysql> SET PASSWORD FOR ''@'%' = PASSWORD('newpwd');
- * Larger file support up to 1 TB
+ To use SET PASSWORD on Unix, do this:
+shell> mysql -u root
+mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
+mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
- * Multiprocessor support increased from 4 to 32 processors
+ In the second SET PASSWORD statement, replace host_name with the
+ name of the server host. This is the name that is specified in the
+ Host column of the non-localhost record for root in the user
+ table. If you don't know what host name this is, issue the
+ following statement before using SET PASSWORD:
+mysql> SELECT Host, User FROM mysql.user;
- * Increased memory support up to 64GB
+ Look for the record that has root in the User column and something
+ other than localhost in the Host column. Then use that Host value
+ in the second SET PASSWORD statement.
- * Extending the power of UnixWare into OpenServer 6
+ Anonymous Account Removal
- * Dramatic performance improvement
+ If you prefer to remove the anonymous accounts instead, do so as
+ follows:
+shell> mysql -u root
+mysql> DROP USER '';
- OpenServer 6.0.0 commands are organized as follows:
+ The DROP statement applies both to Windows and to Unix. On
+ Windows, if you want to remove only the anonymous account that has
+ the same privileges as root, do this instead:
+shell> mysql -u root
+mysql> DROP USER ''@'localhost';
- * /bin is for commands that behave exactly the same as on
- OpenServer 5.0.x.
+ That account allows anonymous access but has full privileges, so
+ removing it improves security.
- * /u95/bin is for commands that have better standards
- conformance, for example Large File System (LFS) support.
+ root Account Password Assignment
- * /udk/bin is for commands that behave the same as on UnixWare
- 7.1.4. The default is for the LFS support.
+ You can assign passwords to the root accounts in several ways. The
+ following discussion demonstrates three methods:
- The following is a guide to setting PATH on OpenServer 6. If the
- user wants the traditional OpenServer 5.0.x then PATH should be
- /bin first. If the user wants LFS support, the path should be
- /u95/bin:/bin. If the user wants UnixWare 7 support first, the
- path would be /udk/bin:/u95/bin:/bin:.
+ * Use the SET PASSWORD statement
- Use the latest production release of MySQL. Should you choose to
- use an older release of MySQL on OpenServer 6.0.x, you must use a
- version of MySQL at least as recent as 3.22.13 to get fixes for
- some portability and OS problems.
+ * Use the mysqladmin command-line client program
- MySQL distribution files with names of the following form are tar
- archives of media are tar archives of media images suitable for
- installation with the SCO Software Manager (/etc/custom) on SCO
- OpenServer 6:
-mysql-PRODUCT-5.1.39-sco-osr6-i686.VOLS.tar
+ * Use the UPDATE statement
- A distribution where PRODUCT is pro-cert is the Commercially
- licensed MySQL Pro Certified server. A distribution where PRODUCT
- is pro-gpl-cert is the MySQL Pro Certified server licensed under
- the terms of the General Public License (GPL).
+ To assign passwords using SET PASSWORD, connect to the server as
+ root and issue SET PASSWORD statements. Be sure to encrypt the
+ password using the PASSWORD() function.
- Select whichever distribution you wish to install and, after
- download, extract the tar archive into an empty directory. For
- example:
-shell> mkdir /tmp/mysql-pro
-shell> cd /tmp/mysql-pro
-shell> tar xf /tmp/mysql-pro-cert-5.1.39-sco-osr6-i686.VOLS.tar
+ For Windows, do this:
+shell> mysql -u root
+mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
+mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');
- Prior to installation, back up your data in accordance with the
- procedures outlined in Section 2.12.1, "Upgrading MySQL."
+ For Unix, do this:
+shell> mysql -u root
+mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
+mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
- Remove any previously installed pkgadd version of MySQL:
-shell> pkginfo mysql 2>&1 > /dev/null && pkgrm mysql
+ In the second SET PASSWORD statement, replace host_name with the
+ name of the server host. This is the same host name that you used
+ when you assigned the anonymous account passwords.
- Install MySQL Pro from media images using the SCO Software
- Manager:
-shell> /etc/custom -p SCO:MySQL -i -z /tmp/mysql-pro
+ If the user table contains an account with User and Host values of
+ 'root' and '127.0.0.1', use an additional SET PASSWORD statement
+ to set that account's password:
+mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
- Alternatively, the SCO Software Manager can be displayed
- graphically by clicking on the Software Manager icon on the
- desktop, selecting Software -> Install New, selecting the host,
- selecting Media Images for the Media Device, and entering
- /tmp/mysql-pro as the Image Directory.
+ To assign passwords to the root accounts using mysqladmin, execute
+ the following commands:
+shell> mysqladmin -u root password "newpwd"
+shell> mysqladmin -u root -h host_name password "newpwd"
- After installation, run mkdev mysql as the root user to configure
- your newly installed MySQL Pro Certified server.
+ These commands apply both to Windows and to Unix. In the second
+ command, replace host_name with the name of the server host. The
+ double quotes around the password are not always necessary, but
+ you should use them if the password contains spaces or other
+ characters that are special to your command interpreter.
-Note
+ The mysqladmin method of setting the root account passwords does
+ not set the password for the 'root'@'127.0.0.1' account. To do so,
+ use SET PASSWORD as shown earlier.
- The installation procedure for VOLS packages does not create the
- mysql user and group that the package uses by default. You should
- either create the mysql user and group, or else select a different
- user and group using an option in mkdev mysql.
-
- If you wish to configure your MySQL Pro server to interface with
- the Apache Web server via PHP, download and install the PHP update
- from SCO at
- ftp://ftp.sco.com/pub/updates/OpenServer/SCOSA-2006.17/.
-
- We have been able to compile MySQL with the following configure
- command on OpenServer 6.0.x:
-CC=cc CFLAGS="-D_FILE_OFFSET_BITS=64 -O3" \
-CXX=CC CXXFLAGS="-D_FILE_OFFSET_BITS=64 -O3" \
-./configure --prefix=/usr/local/mysql \
- --enable-thread-safe-client \
- --with-extra-charsets=complex \
- --build=i686-unknown-sysv5SCO_SV6.0.0
-
- If you use gcc, you must use gcc 2.95.3 or newer.
-CC=gcc CXX=g++ ... ./configure ...
-
- SCO provides OpenServer 6 operating system patches at
- ftp://ftp.sco.com/pub/openserver6.
-
- SCO provides information about security fixes at
- ftp://ftp.sco.com/pub/security/OpenServer.
-
- By default, the maximum file size on a OpenServer 6.0.0 system is
- 1TB. Some operating system utilities have a limitation of 2GB. The
- maximum possible file size on UnixWare 7 is 1TB with VXFS or HTFS.
+ You can also use UPDATE to modify the user table directly. The
+ following UPDATE statement assigns a password to all root
+ accounts:
+shell> mysql -u root
+mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
+ -> WHERE User = 'root';
+mysql> FLUSH PRIVILEGES;
- OpenServer 6 can be configured for large file support (file sizes
- greater than 2GB) by tuning the UNIX kernel.
+ The UPDATE statement applies both to Windows and to Unix.
- By default, the entries in /etc/conf/cf.d/mtune are set as
- follows:
-Value Default Min Max
------ ------- --- ---
-SVMMLIM 0x9000000 0x1000000 0x7FFFFFFF
-HVMMLIM 0x9000000 0x1000000 0x7FFFFFFF
-
- To make changes to the kernel, use the idtune name parameter
- command. idtune modifies the /etc/conf/cf.d/stune file for you. To
- set the kernel values, execute the following commands as root:
-# /etc/conf/bin/idtune SDATLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune HDATLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune SVMMLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune HVMMLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune SFNOLIM 2048
-# /etc/conf/bin/idtune HFNOLIM 2048
-
- Then rebuild and reboot the kernel by issuing this command:
-# /etc/conf/bin/idbuild -B && init 6
-
- To tune the system, the proper parameter values to use depend on
- the number of users accessing the application or database and size
- the of the database (that is, the used buffer pool). The following
- kernel parameters can be set with idtune:
-
- * SHMMAX (recommended setting: 128MB) and SHMSEG (recommended
- setting: 15). These parameters have an influence on the MySQL
- database engine to create user buffer pools.
-
- * SFNOLIM and HFNOLIM should be at maximum 2048.
-
- * NPROC should be set to at least 3000/4000 (depends on number
- of users).
-
- * The following formulas are recommended to calculate values for
- SEMMSL, SEMMNS, and SEMMNU:
-SEMMSL = 13
- 13 is what has been found to be the best for both Progress and
- MySQL.
-SEMMNS = SEMMSL x number of db servers to be run on the system
- Set SEMMNS to the value of SEMMSL multiplied by the number of
- database servers (maximum) that you are running on the system
- at one time.
-SEMMNU = SEMMNS
- Set the value of SEMMNU to equal the value of SEMMNS. You
- could probably set this to 75% of SEMMNS, but this is a
- conservative estimate.
-
-2.13.5.10. SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
-
- Use the latest production release of MySQL. Should you choose to
- use an older release of MySQL on UnixWare 7.1.x, you must use a
- version of MySQL at least as recent as 3.22.13 to get fixes for
- some portability and OS problems.
-
- We have been able to compile MySQL with the following configure
- command on UnixWare 7.1.x:
-CC="cc" CFLAGS="-I/usr/local/include" \
-CXX="CC" CXXFLAGS="-I/usr/local/include" \
-./configure --prefix=/usr/local/mysql \
- --enable-thread-safe-client \
- --with-innodb --with-openssl --with-extra-charsets=complex
-
- If you want to use gcc, you must use gcc 2.95.3 or newer.
-CC=gcc CXX=g++ ... ./configure ...
-
- SCO provides operating system patches at
- ftp://ftp.sco.com/pub/unixware7 for UnixWare 7.1.1,
- ftp://ftp.sco.com/pub/unixware7/713/ for UnixWare 7.1.3,
- ftp://ftp.sco.com/pub/unixware7/714/ for UnixWare 7.1.4, and
- ftp://ftp.sco.com/pub/openunix8 for OpenUNIX 8.0.0.
-
- SCO provides information about security fixes at
- ftp://ftp.sco.com/pub/security/OpenUNIX for OpenUNIX and
- ftp://ftp.sco.com/pub/security/UnixWare for UnixWare.
-
- The UnixWare 7 file size limit is 1 TB with VXFS. Some OS
- utilities have a limitation of 2GB.
-
- On UnixWare 7.1.4 you do not need to do anything to get large file
- support, but to enable large file support on prior versions of
- UnixWare 7.1.x, run fsadm.
-# fsadm -Fvxfs -o largefiles /
-# fsadm / * Note
-# ulimit unlimited
-# /etc/conf/bin/idtune SFSZLIM 0x7FFFFFFF ** Note
-# /etc/conf/bin/idtune HFSZLIM 0x7FFFFFFF ** Note
-# /etc/conf/bin/idbuild -B
+ After the passwords have been set, you must supply the appropriate
+ password whenever you connect to the server. For example, if you
+ want to use mysqladmin to shut down the server, you can do so
+ using this command:
+shell> mysqladmin -u root -p shutdown
+Enter password: (enter root password here)
-* This should report "largefiles".
-** 0x7FFFFFFF represents infinity for these values.
+Note
- Reboot the system using shutdown.
+ If you forget your root password after setting it up, Section
+ B.5.4.1, "How to Reset the Root Password," covers the procedure
+ for resetting it.
- By default, the entries in /etc/conf/cf.d/mtune are set as
- follows:
-Value Default Min Max
------ ------- --- ---
-SVMMLIM 0x9000000 0x1000000 0x7FFFFFFF
-HVMMLIM 0x9000000 0x1000000 0x7FFFFFFF
-
- To make changes to the kernel, use the idtune name parameter
- command. idtune modifies the /etc/conf/cf.d/stune file for you. To
- set the kernel values, execute the following commands as root:
-# /etc/conf/bin/idtune SDATLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune HDATLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune SVMMLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune HVMMLIM 0x7FFFFFFF
-# /etc/conf/bin/idtune SFNOLIM 2048
-# /etc/conf/bin/idtune HFNOLIM 2048
-
- Then rebuild and reboot the kernel by issuing this command:
-# /etc/conf/bin/idbuild -B && init 6
-
- To tune the system, the proper parameter values to use depend on
- the number of users accessing the application or database and size
- the of the database (that is, the used buffer pool). The following
- kernel parameters can be set with idtune:
-
- * SHMMAX (recommended setting: 128MB) and SHMSEG (recommended
- setting: 15). These parameters have an influence on the MySQL
- database engine to create user buffer pools.
-
- * SFNOLIM and HFNOLIM should be at maximum 2048.
-
- * NPROC should be set to at least 3000/4000 (depends on number
- of users).
-
- * The following formulas are recommended to calculate values for
- SEMMSL, SEMMNS, and SEMMNU:
-SEMMSL = 13
- 13 is what has been found to be the best for both Progress and
- MySQL.
-SEMMNS = SEMMSL x number of db servers to be run on the system
- Set SEMMNS to the value of SEMMSL multiplied by the number of
- database servers (maximum) that you are running on the system
- at one time.
-SEMMNU = SEMMNS
- Set the value of SEMMNU to equal the value of SEMMNS. You
- could probably set this to 75% of SEMMNS, but this is a
- conservative estimate.
+ To set up additional accounts, you can use the GRANT statement.
+ For instructions, see Section 5.5.2, "Adding User Accounts."
2.14. Environment Variables
@@ -9003,7 +7980,7 @@ SEMMNU = SEMMNS
PATH Used by the shell to find MySQL programs.
TMPDIR The directory where temporary files are created.
TZ This should be set to your local time zone. See Section
- B.1.4.6, "Time Zone Problems."
+ B.5.4.6, "Time Zone Problems."
UMASK The user-file creation mode when creating files. See note
following table.
UMASK_DIR The user-directory creation mode when creating
@@ -9047,9 +8024,9 @@ SEMMNU = SEMMNS
sections describe how to do this.
Perl support for MySQL must be installed if you want to run the
- MySQL benchmark scripts; see Section 7.1.4, "The MySQL Benchmark
+ MySQL benchmark scripts; see Section 7.1.3, "The MySQL Benchmark
Suite." It is also required for the MySQL Cluster ndb_size.pl
- utility; see Section 17.6.21, "ndb_size.pl --- NDBCLUSTER Size
+ utility; see Section 17.4.21, "ndb_size.pl --- NDBCLUSTER Size
Requirement Estimator."
2.15.1. Installing Perl on Unix
=== modified file 'INSTALL-WIN-SOURCE'
--- a/INSTALL-WIN-SOURCE 2009-09-16 12:03:18 +0000
+++ b/INSTALL-WIN-SOURCE 2009-12-01 07:24:05 +0000
@@ -1,5 +1,5 @@
-2.10.6. Installing MySQL from Source on Windows
+2.5.10. Installing MySQL from Source on Windows
These instructions describe how to build binaries from source for
MySQL 5.1 on Windows. Instructions are provided for building
@@ -15,7 +15,7 @@ Note
to use precompiled binary distributions of MySQL that are built
specifically for optimal performance on Windows by Sun
Microsystems, Inc. Instructions for installing binary
- distributions are available in Section 2.3, "Installing MySQL on
+ distributions are available in Section 2.5, "Installing MySQL on
Windows."
To build MySQL on Windows from source, you must satisfy the
@@ -68,7 +68,7 @@ Note
* 3GB to 5GB of disk space.
- The exact system requirements can be found here:
+ The exact system requirements for Visual Studio can be found here:
http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as
px and
http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx
@@ -81,7 +81,7 @@ Note
* Package a source distribution yourself from the latest Bazaar
developer source tree. For instructions on pulling the latest
- source files, see Section 2.10.3, "Installing from the
+ source files, see Section 2.3.3, "Installing from the
Development Source Tree."
If you find something not working as expected, or you have
@@ -89,7 +89,7 @@ Note
Windows, please send a message to the win32 mailing list. See
Section 1.5.1, "MySQL Mailing Lists."
-2.10.6.1. Building MySQL from Source Using CMake and Visual Studio
+2.5.10.1. Building MySQL from Source Using CMake and Visual Studio
You can build MySQL on Windows by using a combination of cmake and
Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio
@@ -99,7 +99,7 @@ Note
Note
To compile from the source code on Windows you must use the
- standard source distribution (for example, mysql-5.0.45.tar.gz).
+ standard source distribution (for example, mysql-5.1.41.tar.gz).
You build from the same distribution as used to build MySQL on
Unix, Linux and other platforms. Do not use the Windows Source
distributions as they do not contain the necessary configuration
@@ -264,5 +264,5 @@ C:\workdir> copy libmysql\libmysql.def C
C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
After installation, set up and start the server in the same way as
- for binary Windows distributions. See Section 2.3, "Installing
+ for binary Windows distributions. See Section 2.5, "Installing
MySQL on Windows."
=== modified file 'man/comp_err.1'
--- a/man/comp_err.1 2009-09-16 12:03:18 +0000
+++ b/man/comp_err.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBcomp_err\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBCOMP_ERR\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBCOMP_ERR\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -91,7 +91,8 @@ Display a help message and exit\&.
.\}
.\" comp_err: charset option
.\" charset option: comp_err
-\fB\-\-charset=\fR\fB\fIpath\fR\fR\fB, \-C \fR\fB\fIpath\fR\fR
+\fB\-\-charset=\fR\fB\fIpath\fR\fR,
+\fB\-C \fR\fB\fIpath\fR\fR
.sp
The character set directory\&. The default is
\&.\&./sql/share/charsets\&.
@@ -107,7 +108,8 @@ The character set directory\&. The defau
.\}
.\" comp_err: debug option
.\" debug option: comp_err
-\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR\fB, \-# \fR\fB\fIdebug_options\fR\fR
+\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
+\fB\-# \fR\fB\fIdebug_options\fR\fR
.sp
Write a debugging log\&. A typical
\fIdebug_options\fR
@@ -142,7 +144,8 @@ Print some debugging information when th
.\}
.\" comp_err: header_file option
.\" header_file option: comp_err
-\fB\-\-header_file=\fR\fB\fIfile_name\fR\fR\fB, \-H \fR\fB\fIfile_name\fR\fR
+\fB\-\-header_file=\fR\fB\fIfile_name\fR\fR,
+\fB\-H \fR\fB\fIfile_name\fR\fR
.sp
The name of the error header file\&. The default is
mysqld_error\&.h\&.
@@ -158,7 +161,8 @@ mysqld_error\&.h\&.
.\}
.\" comp_err: in_file option
.\" in_file option: comp_err
-\fB\-\-in_file=\fR\fB\fIfile_name\fR\fR\fB, \-F \fR\fB\fIfile_name\fR\fR
+\fB\-\-in_file=\fR\fB\fIfile_name\fR\fR,
+\fB\-F \fR\fB\fIfile_name\fR\fR
.sp
The name of the input file\&. The default is
\&.\&./sql/share/errmsg\&.txt\&.
@@ -174,7 +178,8 @@ The name of the input file\&. The defaul
.\}
.\" comp_err: name_file option
.\" name_file option: comp_err
-\fB\-\-name_file=\fR\fB\fIfile_name\fR\fR\fB, \-N \fR\fB\fIfile_name\fR\fR
+\fB\-\-name_file=\fR\fB\fIfile_name\fR\fR,
+\fB\-N \fR\fB\fIfile_name\fR\fR
.sp
The name of the error name file\&. The default is
mysqld_ername\&.h\&.
@@ -190,7 +195,8 @@ mysqld_ername\&.h\&.
.\}
.\" comp_err: out_dir option
.\" out_dir option: comp_err
-\fB\-\-out_dir=\fR\fB\fIpath\fR\fR\fB, \-D \fR\fB\fIpath\fR\fR
+\fB\-\-out_dir=\fR\fB\fIpath\fR\fR,
+\fB\-D \fR\fB\fIpath\fR\fR
.sp
The name of the output base directory\&. The default is
\&.\&./sql/share/\&.
@@ -206,7 +212,8 @@ The name of the output base directory\&.
.\}
.\" comp_err: out_file option
.\" out_file option: comp_err
-\fB\-\-out_file=\fR\fB\fIfile_name\fR\fR\fB, \-O \fR\fB\fIfile_name\fR\fR
+\fB\-\-out_file=\fR\fB\fIfile_name\fR\fR,
+\fB\-O \fR\fB\fIfile_name\fR\fR
.sp
The name of the output file\&. The default is
errmsg\&.sys\&.
@@ -222,7 +229,8 @@ errmsg\&.sys\&.
.\}
.\" comp_err: statefile option
.\" statefile option: comp_err
-\fB\-\-statefile=\fR\fB\fIfile_name\fR\fR\fB, \-S \fR\fB\fIfile_name\fR\fR
+\fB\-\-statefile=\fR\fB\fIfile_name\fR\fR,
+\fB\-S \fR\fB\fIfile_name\fR\fR
.sp
The name for the SQLSTATE header file\&. The default is
sql_state\&.h\&.
=== modified file 'man/innochecksum.1'
--- a/man/innochecksum.1 2009-09-16 12:03:18 +0000
+++ b/man/innochecksum.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBinnochecksum\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBINNOCHECKSUM\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBINNOCHECKSUM\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -29,7 +29,20 @@ innochecksum \- offline InnoDB file chec
\fBinnochecksum\fR
prints checksums for
InnoDB
-files\&.
+files\&. This tool reads an
+InnoDB
+tablespace file, calculates the checksum for each page, compares the calculated checksum to the stored checksum, and reports mismatches, which indicate damaged pages\&. It was originally developed to speed up verifying the integrity of tablespace files after power outages but can also be used after file copies\&. Because checksum mismatches will cause
+InnoDB
+to deliberately shut down a running server, it can be preferable to use this tool rather than waiting for a server in production usage to encounter the damaged pages\&.
+.PP
+\fBinnochecksum\fR
+cannot be used on tablespace files that the server already has open\&. For such files, you should use
+CHECK TABLE
+to check tables within the tablespace\&.
+.PP
+If checksum mismatches are found, you would normally restore the tablespace from backup or start the server and attempt to use
+\fBmysqldump\fR
+to make a backup of the tables within the tablespace\&.
.PP
Invoke
\fBinnochecksum\fR
=== modified file 'man/make_win_bin_dist.1'
--- a/man/make_win_bin_dist.1 2009-09-16 12:03:18 +0000
+++ b/man/make_win_bin_dist.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmake_win_bin_dist\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMAKE_WIN_BIN_DIST" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMAKE_WIN_BIN_DIST" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/msql2mysql.1'
--- a/man/msql2mysql.1 2009-09-16 12:03:18 +0000
+++ b/man/msql2mysql.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmsql2mysql\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMSQL2MYSQL\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMSQL2MYSQL\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/my_print_defaults.1'
--- a/man/my_print_defaults.1 2009-09-16 12:03:18 +0000
+++ b/man/my_print_defaults.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmy_print_defaults\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMY_PRINT_DEFAULTS" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMY_PRINT_DEFAULTS" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -100,7 +100,8 @@ Read only the given option file\&.
.\}
.\" my_print_defaults: debug option
.\" debug option: my_print_defaults
-\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR\fB, \-# \fR\fB\fIdebug_options\fR\fR
+\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
+\fB\-# \fR\fB\fIdebug_options\fR\fR
.sp
Write a debugging log\&. A typical
\fIdebug_options\fR
=== modified file 'man/myisam_ftdump.1'
--- a/man/myisam_ftdump.1 2009-09-16 12:03:18 +0000
+++ b/man/myisam_ftdump.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmyisam_ftdump\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYISAM_FTDUMP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYISAM_FTDUMP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/myisamchk.1'
--- a/man/myisamchk.1 2009-09-16 12:03:18 +0000
+++ b/man/myisamchk.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmyisamchk\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYISAMCHK\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYISAMCHK\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -275,7 +275,8 @@ Display a help message and exit\&. Optio
.\}
.\" myisamchk: debug option
.\" debug option: myisamchk
-\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR\fB, \-# \fR\fB\fIdebug_options\fR\fR
+\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
+\fB\-# \fR\fB\fIdebug_options\fR\fR
.sp
Write a debugging log\&. A typical
\fIdebug_options\fR
@@ -520,7 +521,7 @@ system variable\&. For more information,
myisam_stats_method
in
Section\ \&5.1.4, \(lqServer System Variables\(rq, and
-Section\ \&7.4.6, \(lqMyISAM Index Statistics Collection\(rq\&. For MySQL 5\&.1,
+Section\ \&7.4.7, \(lqMyISAM Index Statistics Collection\(rq\&. For MySQL 5\&.1,
stats_method
was added in MySQL 5\&.0\&.14\&. For older versions, the statistics collection method is equivalent to
nulls_equal\&.
@@ -662,6 +663,9 @@ If you are using
and have plenty of memory, setting the
key_buffer_size
variable to a large value helps the repair operation run faster\&.
+.sp
+For a description of the output format, see
+the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&.
.RE
.sp
.RS 4
@@ -782,7 +786,11 @@ server is using the table and you are ru
.\" files: repairing
.PP
\fBmyisamchk\fR
-supports the following options for table repair operations:
+supports the following options for table repair operations (operations performed when an option such as
+\fB\-\-recover\fR
+or
+\fB\-\-safe\-recover\fR
+is given):
.sp
.RS 4
.ie n \{\
@@ -844,7 +852,8 @@ Correct the checksum information for the
.\}
.\" myisamchk: data-file-length option
.\" data-file-length option: myisamchk
-\fB\-\-data\-file\-length=\fR\fB\fIlen\fR\fR\fB, \-D \fR\fB\fIlen\fR\fR
+\fB\-\-data\-file\-length=\fR\fB\fIlen\fR\fR,
+\fB\-D \fR\fB\fIlen\fR\fR
.sp
The maximum length of the data file (when re\-creating data file when it is
\(lqfull\(rq)\&.
@@ -864,6 +873,9 @@ The maximum length of the data file (whe
\fB\-e\fR
.sp
Do a repair that tries to recover every possible row from the data file\&. Normally, this also finds a lot of garbage rows\&. Do not use this option unless you are desperate\&.
+.sp
+For a description of the output format, see
+the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&.
.RE
.sp
.RS 4
@@ -1172,7 +1184,10 @@ Find the record that a block at the give
\fB\-\-description\fR,
\fB\-d\fR
.sp
-Print some descriptive information about the table\&.
+Print some descriptive information about the table\&. Specifying the
+\fB\-\-verbose\fR
+option once or twice produces additional information\&. See
+the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&.
.RE
.sp
.RS 4
@@ -1243,47 +1258,187 @@ sorts and moves records, it just overwri
\fBmyisamchk\fR
must unpack key blocks first, then re\-create indexes and pack the key blocks again\&. (In this case, re\-creating indexes is faster than updating offsets for each index\&.)
.RE
-.SH "MYISAMCHK MEMORY USAGE"
-.\" memory usage: myisamchk
+.SH "MYISAMCHK TABLE INFORMATION"
+.\" table description: myisamchk
+.\" tables: information
+.\" examples: myisamchk output
+.\" myisamchk: example output
.PP
-Memory allocation is important when you run
-\fBmyisamchk\fR\&.
+To obtain a description of a
+MyISAM
+table or statistics about it, use the commands shown here\&. The output from these commands is explained later in this section\&.
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBmyisamchk \-d \fR\fB\fItbl_name\fR\fR
+.sp
+Runs
\fBmyisamchk\fR
-uses no more memory than its memory\-related variables are set to\&. If you are going to use
+in
+\(lqdescribe mode\(rq
+to produce a description of your table\&. If you start the MySQL server with external locking disabled,
\fBmyisamchk\fR
-on very large tables, you should first decide how much memory you want it to use\&. The default is to use only about 3MB to perform repairs\&. By using larger values, you can get
+may report an error for a table that is updated while it runs\&. However, because
\fBmyisamchk\fR
-to operate faster\&. For example, if you have more than 32MB RAM, you could use options such as these (in addition to any other options you might specify):
+does not change the table in describe mode, there is no risk of destroying data\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR
+.sp
+Adding
+\fB\-v\fR
+runs
+\fBmyisamchk\fR
+in verbose mode so that it produces more information about the table\&. Adding
+\fB\-v\fR
+a second time produces even more information\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBmyisamchk \-eis \fR\fB\fItbl_name\fR\fR
+.sp
+Shows only the most important information from a table\&. This operation is slow because it must read the entire table\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBmyisamchk \-eiv \fR\fB\fItbl_name\fR\fR
+.sp
+This is like
+\fB\-eis\fR, but tells you what is being done\&.
+.RE
+.PP
+The
+\fItbl_name\fR
+argument can be either the name of a
+MyISAM
+table or the name of its index file, as described in
+\fBmyisamchk\fR(1)\&. Multiple
+\fItbl_name\fR
+arguments can be given\&.
+.PP
+Suppose that a table named
+person
+has the following structure\&. (The
+MAX_ROWS
+table option is included so that in the example output from
+\fBmyisamchk\fR
+shown later, some values are smaller and fit the output format more easily\&.)
.sp
.if n \{\
.RS 4
.\}
.nf
-shell> \fBmyisamchk \-\-sort_buffer_size=16M \-\-key_buffer_size=16M \e\fR
- \fB\-\-read_buffer_size=1M \-\-write_buffer_size=1M \&.\&.\&.\fR
+CREATE TABLE person
+(
+ id INT NOT NULL AUTO_INCREMENT,
+ last_name VARCHAR(20) NOT NULL,
+ first_name VARCHAR(20) NOT NULL,
+ birth DATE,
+ death DATE,
+ PRIMARY KEY (id),
+ INDEX (last_name, first_name),
+ INDEX (birth)
+) MAX_ROWS = 1000000;
.fi
.if n \{\
.RE
.\}
.PP
-Using
-\fB\-\-sort_buffer_size=16M\fR
-should probably be enough for most cases\&.
+Suppose also that the table has these data and index file sizes:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+\-rw\-rw\-\-\-\- 1 mysql mysql 9347072 Aug 19 11:47 person\&.MYD
+\-rw\-rw\-\-\-\- 1 mysql mysql 6066176 Aug 19 11:47 person\&.MYI
+.fi
+.if n \{\
+.RE
+.\}
.PP
-Be aware that
-\fBmyisamchk\fR
-uses temporary files in
-TMPDIR\&. If
-TMPDIR
-points to a memory file system, you may easily get out of memory errors\&. If this happens, run
-\fBmyisamchk\fR
-with the
-\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR
-option to specify some directory located on a file system that has more space\&.
+Example of
+\fBmyisamchk \-dvv\fR
+output:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+MyISAM file: person
+Record format: Packed
+Character set: latin1_swedish_ci (8)
+File\-version: 1
+Creation time: 2009\-08\-19 16:47:41
+Recover time: 2009\-08\-19 16:47:56
+Status: checked,analyzed,optimized keys
+Auto increment key: 1 Last value: 306688
+Data records: 306688 Deleted blocks: 0
+Datafile parts: 306688 Deleted data: 0
+Datafile pointer (bytes): 4 Keyfile pointer (bytes): 3
+Datafile length: 9347072 Keyfile length: 6066176
+Max datafile length: 4294967294 Max keyfile length: 17179868159
+Recordlength: 54
+table description:
+Key Start Len Index Type Rec/key Root Blocksize
+1 2 4 unique long 1 99328 1024
+2 6 20 multip\&. varchar prefix 512 3563520 1024
+ 27 20 varchar 512
+3 48 3 multip\&. uint24 NULL 306688 6065152 1024
+Field Start Length Nullpos Nullbit Type
+1 1 1
+2 2 4 no zeros
+3 6 21 varchar
+4 27 21 varchar
+5 48 3 1 1 no zeros
+6 51 3 1 2 no zeros
+.fi
+.if n \{\
+.RE
+.\}
.PP
-When repairing,
+Explanations for the types of information
\fBmyisamchk\fR
-also needs a lot of disk space:
+produces are given here\&.
+\(lqKeyfile\(rq
+refers to the index file\&.
+\(lqRecord\(rq
+and
+\(lqrow\(rq
+are synonymous, as are
+\(lqfield\(rq
+and
+\(lqcolumn\&.\(rq
+.PP
+The initial part of the table description contains these values:
.sp
.RS 4
.ie n \{\
@@ -1293,9 +1448,11 @@ also needs a lot of disk space:
.sp -1
.IP \(bu 2.3
.\}
-Double the size of the data file (the original file and a copy)\&. This space is not needed if you do a repair with
-\fB\-\-quick\fR; in this case, only the index file is re\-created\&.
-\fIThis space must be available on the same file system as the original data file\fR, as the copy is created in the same directory as the original\&.
+MyISAM file
+.sp
+Name of the
+MyISAM
+(index) file\&.
.RE
.sp
.RS 4
@@ -1306,7 +1463,13 @@ Double the size of the data file (the or
.sp -1
.IP \(bu 2.3
.\}
-Space for the new index file that replaces the old one\&. The old index file is truncated at the start of the repair operation, so you usually ignore this space\&. This space must be available on the same file system as the original data file\&.
+Record format
+.sp
+The format used to store table rows\&. The preceding examples use
+Fixed length\&. Other possible values are
+Compressed
+and
+Packed\&.
.RE
.sp
.RS 4
@@ -1317,30 +1480,964 @@ Space for the new index file that replac
.sp -1
.IP \(bu 2.3
.\}
-When using
-\fB\-\-recover\fR
-or
-\fB\-\-sort\-recover\fR
-(but not when using
-\fB\-\-safe\-recover\fR), you need space for a sort buffer\&. The following formula yields the amount of space required:
+Chararacter set
+.sp
+The table default character set\&.
+.RE
.sp
-.if n \{\
.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
.\}
-.nf
-(\fIlargest_key\fR + \fIrow_pointer_length\fR) \(mu \fInumber_of_rows\fR \(mu 2
-.fi
-.if n \{\
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+File\-version
+.sp
+Version of
+MyISAM
+format\&. Currently always 1\&.
.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
.\}
+Creation time
.sp
-You can check the length of the keys and the
-row_pointer_length
-with
-\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR\&. This space is allocated in the temporary directory (specified by
-TMPDIR
-or
-\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR)\&.
+When the data file was created\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recover time
+.sp
+When the index/data file was last reconstructed\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Status
+.sp
+Table status flags\&. Possible values are
+crashed,
+open,
+changed,
+analyzed,
+optimized keys, and
+sorted index pages\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Auto increment key,
+Last value
+.sp
+The key number associated the table\'s
+AUTO_INCREMENT
+column, and the most recently generated value for this column\&. These fields do not appear if there is no such column\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Data records
+.sp
+The number of rows in the table\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleted blocks
+.sp
+How many deleted blocks still have reserved space\&. You can optimize your table to minimize this space\&. See
+Section\ \&6.4.4, \(lqTable Optimization\(rq\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Datafile parts
+.sp
+For dynamic\-row format, this indicates how many data blocks there are\&. For an optimized table without fragmented rows, this is the same as
+Data records\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleted data
+.sp
+How many bytes of unreclaimed deleted data there are\&. You can optimize your table to minimize this space\&. See
+Section\ \&6.4.4, \(lqTable Optimization\(rq\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Datafile pointer
+.sp
+The size of the data file pointer, in bytes\&. It is usually 2, 3, 4, or 5 bytes\&. Most tables manage with 2 bytes, but this cannot be controlled from MySQL yet\&. For fixed tables, this is a row address\&. For dynamic tables, this is a byte address\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Keyfile pointer
+.sp
+The size of the index file pointer, in bytes\&. It is usually 1, 2, or 3 bytes\&. Most tables manage with 2 bytes, but this is calculated automatically by MySQL\&. It is always a block address\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Max datafile length
+.sp
+How long the table data file can become, in bytes\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Max keyfile length
+.sp
+How long the table index file can become, in bytes\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recordlength
+.sp
+How much space each row takes, in bytes\&.
+.RE
+.PP
+The
+table description
+part of the output includes a list of all keys in the table\&. For each key,
+\fBmyisamchk\fR
+displays some low\-level information:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Key
+.sp
+This key\'s number\&. This value is shown only for the first column of the key\&. If this value is missing, the line corresponds to the second or later column of a multiple\-column key\&. For the table shown in the example, there are two
+table description
+lines for the second index\&. This indicates that it is a multiple\-part index with two parts\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Start
+.sp
+Where in the row this portion of the index starts\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Len
+.sp
+How long this portion of the index is\&. For packed numbers, this should always be the full length of the column\&. For strings, it may be shorter than the full length of the indexed column, because you can index a prefix of a string column\&. The total length of a multiple\-part key is the sum of the
+Len
+values for all key parts\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Index
+.sp
+Whether a key value can exist multiple times in the index\&. Possible values are
+unique
+or
+multip\&.
+(multiple)\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Type
+.sp
+What data type this portion of the index has\&. This is a
+MyISAM
+data type with the possible values
+packed,
+stripped, or
+empty\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Root
+.sp
+Address of the root index block\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Blocksize
+.sp
+The size of each index block\&. By default this is 1024, but the value may be changed at compile time when MySQL is built from source\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Rec/key
+.sp
+This is a statistical value used by the optimizer\&. It tells how many rows there are per value for this index\&. A unique index always has a value of 1\&. This may be updated after a table is loaded (or greatly changed) with
+\fBmyisamchk \-a\fR\&. If this is not updated at all, a default value of 30 is given\&.
+.RE
+.PP
+The last part of the output provides information about each column:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Field
+.sp
+The column number\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Start
+.sp
+The byte position of the column within table rows\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Length
+.sp
+The length of the column in bytes\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Nullpos,
+Nullbit
+.sp
+For columns that can be
+NULL,
+MyISAM
+stores
+NULL
+values as a flag in a byte\&. Depending on how many nullable columns there are, there can be one or more bytes used for this purpose\&. The
+Nullpos
+and
+Nullbit
+values, if nonempty, indicate which byte and bit contains that flag indicating whether the column is
+NULL\&.
+.sp
+The position and number of bytes used to store
+NULL
+flags is shown in the line for field 1\&. This is why there are six
+Field
+lines for the
+person
+table even though it has only five columns\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Type
+.sp
+The data type\&. The value may contain any of the following descriptors:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+constant
+.sp
+All rows have the same value\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+no endspace
+.sp
+Do not store endspace\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+no endspace, not_always
+.sp
+Do not store endspace and do not do endspace compression for all values\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+no endspace, no empty
+.sp
+Do not store endspace\&. Do not store empty values\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+table\-lookup
+.sp
+The column was converted to an
+ENUM\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+zerofill(\fIN\fR)
+.sp
+The most significant
+\fIN\fR
+bytes in the value are always 0 and are not stored\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+no zeros
+.sp
+Do not store zeros\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+always zero
+.sp
+Zero values are stored using one bit\&.
+.RE
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Huff tree
+.sp
+The number of the Huffman tree associated with the column\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Bits
+.sp
+The number of bits used in the Huffman tree\&.
+.RE
+.PP
+The
+Huff tree
+and
+Bits
+fields are displayed if the table has been compressed with
+\fBmyisampack\fR\&. See
+\fBmyisampack\fR(1), for an example of this information\&.
+.PP
+Example of
+\fBmyisamchk \-eiv\fR
+output:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Checking MyISAM file: person
+Data records: 306688 Deleted blocks: 0
+\- check file\-size
+\- check record delete\-chain
+No recordlinks
+\- check key delete\-chain
+block_size 1024:
+\- check index reference
+\- check data record references index: 1
+Key: 1: Keyblocks used: 98% Packed: 0% Max levels: 3
+\- check data record references index: 2
+Key: 2: Keyblocks used: 99% Packed: 97% Max levels: 3
+\- check data record references index: 3
+Key: 3: Keyblocks used: 98% Packed: \-14% Max levels: 3
+Total: Keyblocks used: 98% Packed: 89%
+\- check records and index references
+\fI*** LOTS OF ROW NUMBERS DELETED ***\fR
+Records: 306688 M\&.recordlength: 25 Packed: 83%
+Recordspace used: 97% Empty space: 2% Blocks/Record: 1\&.00
+Record blocks: 306688 Delete blocks: 0
+Record data: 7934464 Deleted data: 0
+Lost space: 256512 Linkdata: 1156096
+User time 43\&.08, System time 1\&.68
+Maximum resident set size 0, Integral resident set size 0
+Non\-physical pagefaults 0, Physical pagefaults 0, Swaps 0
+Blocks in 0 out 7, Messages in 0 out 0, Signals 0
+Voluntary context switches 0, Involuntary context switches 0
+Maximum memory usage: 1046926 bytes (1023k)
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fBmyisamchk \-eiv\fR
+output includes the following information:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Data records
+.sp
+The number of rows in the table\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleted blocks
+.sp
+How many deleted blocks still have reserved space\&. You can optimize your table to minimize this space\&. See
+Section\ \&6.4.4, \(lqTable Optimization\(rq\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Key
+.sp
+The key number\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Keyblocks used
+.sp
+What percentage of the keyblocks are used\&. When a table has just been reorganized with
+\fBmyisamchk\fR, the values are very high (very near theoretical maximum)\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Packed
+.sp
+MySQL tries to pack key values that have a common suffix\&. This can only be used for indexes on
+CHAR
+and
+VARCHAR
+columns\&. For long indexed strings that have similar leftmost parts, this can significantly reduce the space used\&. In the preceding example, the second key is 40 bytes long and a 97% reduction in space is achieved\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Max levels
+.sp
+How deep the B\-tree for this key is\&. Large tables with long key values get high values\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Records
+.sp
+How many rows are in the table\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+M\&.recordlength
+.sp
+The average row length\&. This is the exact row length for tables with fixed\-length rows, because all rows have the same length\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Packed
+.sp
+MySQL strips spaces from the end of strings\&. The
+Packed
+value indicates the percentage of savings achieved by doing this\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recordspace used
+.sp
+What percentage of the data file is used\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Empty space
+.sp
+What percentage of the data file is unused\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Blocks/Record
+.sp
+Average number of blocks per row (that is, how many links a fragmented row is composed of)\&. This is always 1\&.0 for fixed\-format tables\&. This value should stay as close to 1\&.0 as possible\&. If it gets too large, you can reorganize the table\&. See
+Section\ \&6.4.4, \(lqTable Optimization\(rq\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recordblocks
+.sp
+How many blocks (links) are used\&. For fixed\-format tables, this is the same as the number of rows\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleteblocks
+.sp
+How many blocks (links) are deleted\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Recorddata
+.sp
+How many bytes in the data file are used\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Deleted data
+.sp
+How many bytes in the data file are deleted (unused)\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Lost space
+.sp
+If a row is updated to a shorter length, some space is lost\&. This is the sum of all such losses, in bytes\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Linkdata
+.sp
+When the dynamic table format is used, row fragments are linked with pointers (4 to 7 bytes each)\&.
+Linkdata
+is the sum of the amount of storage used by all such pointers\&.
+.RE
+.SH "MYISAMCHK MEMORY USAGE"
+.\" memory usage: myisamchk
+.PP
+Memory allocation is important when you run
+\fBmyisamchk\fR\&.
+\fBmyisamchk\fR
+uses no more memory than its memory\-related variables are set to\&. If you are going to use
+\fBmyisamchk\fR
+on very large tables, you should first decide how much memory you want it to use\&. The default is to use only about 3MB to perform repairs\&. By using larger values, you can get
+\fBmyisamchk\fR
+to operate faster\&. For example, if you have more than 32MB RAM, you could use options such as these (in addition to any other options you might specify):
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+shell> \fBmyisamchk \-\-sort_buffer_size=16M \e\fR
+ \fB\-\-key_buffer_size=16M \e\fR
+ \fB\-\-read_buffer_size=1M \e\fR
+ \fB\-\-write_buffer_size=1M \&.\&.\&.\fR
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+Using
+\fB\-\-sort_buffer_size=16M\fR
+should probably be enough for most cases\&.
+.PP
+Be aware that
+\fBmyisamchk\fR
+uses temporary files in
+TMPDIR\&. If
+TMPDIR
+points to a memory file system, out of memory errors can easily occur\&. If this happens, run
+\fBmyisamchk\fR
+with the
+\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR
+option to specify a directory located on a file system that has more space\&.
+.PP
+When performing repair operations,
+\fBmyisamchk\fR
+also needs a lot of disk space:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Twice the size of the data file (the original file and a copy)\&. This space is not needed if you do a repair with
+\fB\-\-quick\fR; in this case, only the index file is re\-created\&.
+\fIThis space must be available on the same file system as the original data file\fR, as the copy is created in the same directory as the original\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Space for the new index file that replaces the old one\&. The old index file is truncated at the start of the repair operation, so you usually ignore this space\&. This space must be available on the same file system as the original data file\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+When using
+\fB\-\-recover\fR
+or
+\fB\-\-sort\-recover\fR
+(but not when using
+\fB\-\-safe\-recover\fR), you need space on disk for sorting\&. This space is allocated in the temporary directory (specified by
+TMPDIR
+or
+\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR)\&. The following formula yields the amount of space required:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+(\fIlargest_key\fR + \fIrow_pointer_length\fR) \(mu \fInumber_of_rows\fR \(mu 2
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+You can check the length of the keys and the
+\fIrow_pointer_length\fR
+with
+\fBmyisamchk \-dv \fR\fB\fItbl_name\fR\fR
+(see
+the section called \(lqMYISAMCHK TABLE INFORMATION\(rq)\&. The
+\fIrow_pointer_length\fR
+and
+\fInumber_of_rows\fR
+values are the
+Datafile pointer
+and
+Data records
+values in the table description\&. To determine the
+\fIlargest_key\fR
+value, check the
+Key
+lines in the table description\&. The
+Len
+column indicates the number of bytes for each key part\&. For a multiple\-column index, the key size is the sum of the
+Len
+values for all key parts\&.
.RE
.PP
If you have a problem with disk space during repair, you can try
=== modified file 'man/myisamlog.1'
--- a/man/myisamlog.1 2009-09-16 12:03:18 +0000
+++ b/man/myisamlog.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmyisamlog\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYISAMLOG\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYISAMLOG\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/myisampack.1'
--- a/man/myisampack.1 2009-09-16 12:03:18 +0000
+++ b/man/myisampack.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmyisampack\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYISAMPACK\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYISAMPACK\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -652,9 +652,11 @@ After join
The number of distinct Huffman trees left after joining trees to save some header space\&.
.RE
.PP
-After a table has been compressed,
+After a table has been compressed, the
+Field
+lines displayed by
\fBmyisamchk \-dvv\fR
-prints additional information about each column:
+include additional information about each column:
.sp
.RS 4
.ie n \{\
=== modified file 'man/mysql-stress-test.pl.1'
--- a/man/mysql-stress-test.pl.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql-stress-test.pl.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql-stress-test.pl\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/08/2009
+.\" Date: 10/29/2009
.\" Manual: MySQL Database System
.\" Source: MySQL
.\" Language: English
.\"
-.TH "\FBMYSQL\-STRESS\-TE" "1" "08/08/2009" "MySQL" "MySQL Database System"
+.TH "\FBMYSQL\-STRESS\-TE" "1" "10/29/2009" "MySQL" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql-test-run.pl.1'
--- a/man/mysql-test-run.pl.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql-test-run.pl.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql-test-run.pl\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/08/2009
+.\" Date: 10/29/2009
.\" Manual: MySQL Database System
.\" Source: MySQL
.\" Language: English
.\"
-.TH "\FBMYSQL\-TEST\-RUN\" "1" "08/08/2009" "MySQL" "MySQL Database System"
+.TH "\FBMYSQL\-TEST\-RUN\" "1" "10/29/2009" "MySQL" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -700,6 +700,9 @@ Specify a file that contains a list of t
code rather than
[ fail ]
if they fail\&. This option was added in MySQL 5\&.1\&.33/6\&.0\&.11\&.
+.sp
+For an example of a file that might be specified via this option, see
+mysql\-test/collections/default\&.experimental\&.
.RE
.sp
.RS 4
@@ -1132,6 +1135,26 @@ not to generate a timing file\&.
.sp -1
.IP \(bu 2.3
.\}
+.\" mysql-test-run.pl: parallel option
+.\" parallel option: mysql-test-run.pl
+\fB\-\-parallel={\fR\fB\fIN\fR\fR\fB|auto}\fR
+.sp
+Run tests using
+\fIN\fR
+parallel threads\&. By default, 1 thread is used\&. Use
+\fB\-\-parallel=auto\fR
+for auto\-setting of
+\fIN\fR\&. This option was added in MySQL 5\&.1\&.36\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.\" mysql-test-run.pl: ps-protocol option
.\" ps-protocol option: mysql-test-run.pl
\fB\-\-ps\-protocol\fR
=== modified file 'man/mysql.1'
--- a/man/mysql.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -334,8 +334,18 @@ to display result set metadata\&.
.sp
Use
\fIcharset_name\fR
-as the default character set\&. See
-Section\ \&9.2, \(lqThe Character Set Used for Data and Sorting\(rq\&.
+as the default character set for the client and connection\&.
+.sp
+A common issue that can occur when the operating system uses
+utf8
+or another multi\-byte character set is that output from the
+\fBmysql\fR
+client is formatted incorrectly, due to the fact that the MySQL client uses the
+latin1
+character set by default\&. You can usually fix such issues by using this option to force the client to use the system character set instead\&.
+.sp
+See
+Section\ \&9.2, \(lqThe Character Set Used for Data and Sorting\(rq, for more information\&.
.RE
.sp
.RS 4
@@ -648,7 +658,7 @@ PAGER
environment variable\&. Valid pagers are
\fBless\fR,
\fBmore\fR,
-\fBcat [> filename]\fR, and so forth\&. This option works only on Unix\&. It does not work in batch mode\&. To disable paging, use
+\fBcat [> filename]\fR, and so forth\&. This option works only on Unix and only in interactive mode\&. To disable paging, use
\fB\-\-skip\-pager\fR\&.
the section called \(lqMYSQL COMMANDS\(rq, discusses output paging further\&.
.RE
@@ -1026,7 +1036,7 @@ Display output in table format\&. This i
.\" tee option: mysql
\fB\-\-tee=\fR\fB\fIfile_name\fR\fR
.sp
-Append a copy of output to the given file\&. This option does not work in batch mode\&.
+Append a copy of output to the given file\&. This option works only in interactive mode\&.
the section called \(lqMYSQL COMMANDS\(rq, discusses tee files further\&.
.RE
.sp
@@ -1523,7 +1533,7 @@ is set to something other than the defau
\(lq;\(rq, instances of that character are sent to the server without interpretation\&. However, the server itself still interprets
\(lq;\(rq
as a statement delimiter and processes statements accordingly\&. This behavior on the server side comes into play for multiple\-statement execution (see
-Section\ \&21.10.12, \(lqC API Support for Multiple Statement Execution\(rq), and for parsing the body of stored procedures and functions, triggers, and events (see
+Section\ \&21.9.12, \(lqC API Support for Multiple Statement Execution\(rq), and for parsing the body of stored procedures and functions, triggers, and events (see
Section\ \&19.1, \(lqDefining Stored Programs\(rq)\&.
.RE
.sp
@@ -1680,7 +1690,7 @@ option when you invoke
\fBmysql\fR
checks the value of the
PAGER
-environment variable and sets the pager to that\&.
+environment variable and sets the pager to that\&. Pager functionality works only in interactive mode\&.
.sp
Output paging can be enabled interactively with the
\fBpager\fR
@@ -1853,7 +1863,7 @@ By using the
option when you invoke
\fBmysql\fR, you can log statements and their output\&. All the data displayed on the screen is appended into a given file\&. This can be very useful for debugging purposes also\&.
\fBmysql\fR
-flushes results to the file after each statement, just before it prints its next prompt\&.
+flushes results to the file after each statement, just before it prints its next prompt\&. Tee functionality works only in interactive mode\&.
.sp
You can enable this feature interactively with the
\fBtee\fR
@@ -2334,7 +2344,7 @@ prompt=(\e\eu@\e\eh) [\e\ed]>\e\e_
.sp
In this example, note that the backslashes are doubled\&. If you set the prompt using the
prompt
-option in an option file, it is advisable to double the backslashes when using the special prompt options\&. There is some overlap in the set of allowable prompt options and the set of special escape sequences that are recognized in option files\&. (These sequences are listed in
+option in an option file, it is advisable to double the backslashes when using the special prompt options\&. There is some overlap in the set of allowable prompt options and the set of special escape sequences that are recognized in option files\&. (The rules for escape sequences in option files are listed in
Section\ \&4.2.3.3, \(lqUsing Option Files\(rq\&.) The overlap may cause you problems if you use single backslashes\&. For example,
\es
is interpreted as a space rather than as the current seconds value\&. The following example shows how to define a prompt within an option file to include the current time in
@@ -2586,6 +2596,12 @@ SELECT \'<info_to_display>\' AS \' \';
The statement shown outputs
<info_to_display>\&.
.PP
+You can also invoke
+\fBmysql\fR
+with the
+\fB\-\-verbose\fR
+option, which causes each statement to be displayed before the result that it produces\&.
+.PP
As of MySQL 5\&.1\&.23,
\fBmysql\fR
ignores Unicode byte order mark (BOM) characters at the beginning of input files\&. Previously, it read them and sent them to the server, resulting in a syntax error\&. Presence of a BOM does not cause
@@ -2785,7 +2801,7 @@ client with the
option\&.
.PP
For more information about auto\-reconnect and its effect on state information when a reconnection occurs, see
-Section\ \&21.10.11, \(lqControlling Automatic Reconnection Behavior\(rq\&.
+Section\ \&21.9.11, \(lqControlling Automatic Reconnection Behavior\(rq\&.
.SH "COPYRIGHT"
.br
.PP
=== modified file 'man/mysql.server.1'
--- a/man/mysql.server.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql.server.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql.server\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL\&.SERVER\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL\&.SERVER\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -40,7 +40,7 @@ script will be installed in the
/etc/init\&.d
directory with the name
mysql\&. You need not install it manually\&. See
-Section\ \&2.4, \(lqInstalling MySQL from RPM Packages on Linux\(rq, for more information on the Linux RPM packages\&.
+Section\ \&2.6.1, \(lqInstalling MySQL from RPM Packages on Linux\(rq, for more information on the Linux RPM packages\&.
.PP
Some vendors provide RPM packages that install a startup script under a different name such as
\fBmysqld\fR\&.
@@ -48,7 +48,7 @@ Some vendors provide RPM packages that i
If you install MySQL from a source distribution or using a binary distribution format that does not install
\fBmysql\&.server\fR
automatically, you can install it manually\&. Instructions are provided in
-Section\ \&2.11.2.2, \(lqStarting and Stopping MySQL Automatically\(rq\&.
+Section\ \&2.13.1.2, \(lqStarting and Stopping MySQL Automatically\(rq\&.
.PP
\fBmysql\&.server\fR
reads options from the
=== modified file 'man/mysql_client_test.1'
--- a/man/mysql_client_test.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_client_test.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_client_test\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/08/2009
+.\" Date: 10/29/2009
.\" Manual: MySQL Database System
.\" Source: MySQL
.\" Language: English
.\"
-.TH "\FBMYSQL_CLIENT_TEST" "1" "08/08/2009" "MySQL" "MySQL Database System"
+.TH "\FBMYSQL_CLIENT_TEST" "1" "10/29/2009" "MySQL" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_config.1'
--- a/man/mysql_config.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_config.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_config\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_CONFIG\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_CONFIG\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_convert_table_format.1'
--- a/man/mysql_convert_table_format.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_convert_table_format.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_convert_table_format\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_CONVERT_TAB" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_CONVERT_TAB" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_find_rows.1'
--- a/man/mysql_find_rows.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_find_rows.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_find_rows\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_FIND_ROWS\F" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_FIND_ROWS\F" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_fix_extensions.1'
--- a/man/mysql_fix_extensions.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_fix_extensions.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_fix_extensions\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_FIX_EXTENSI" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_FIX_EXTENSI" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_fix_privilege_tables.1'
--- a/man/mysql_fix_privilege_tables.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_fix_privilege_tables.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_fix_privilege_tables\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_FIX_PRIVILE" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_FIX_PRIVILE" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_install_db.1'
--- a/man/mysql_install_db.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_install_db.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_install_db\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_INSTALL_DB\" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_INSTALL_DB\" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -81,7 +81,7 @@ with the
and
\fB\-\-skip\-grant\-tables\fR
options (see
-Section\ \&2.10.2, \(lqTypical configure Options\(rq)\&. If MySQL was configured with the
+Section\ \&2.3.2, \(lqTypical configure Options\(rq)\&. If MySQL was configured with the
\fB\-\-disable\-grant\-options\fR
option,
\fB\-\-bootstrap\fR
=== modified file 'man/mysql_secure_installation.1'
--- a/man/mysql_secure_installation.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_secure_installation.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_secure_installation\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_SECURE_INST" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_SECURE_INST" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_setpermission.1'
--- a/man/mysql_setpermission.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_setpermission.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_setpermission\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_SETPERMISSI" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_SETPERMISSI" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_tzinfo_to_sql.1'
--- a/man/mysql_tzinfo_to_sql.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_tzinfo_to_sql.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_tzinfo_to_sql\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_TZINFO_TO_S" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_TZINFO_TO_S" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_upgrade.1'
--- a/man/mysql_upgrade.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_upgrade.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_upgrade\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_UPGRADE\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_UPGRADE\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -41,7 +41,7 @@ script, which should no longer be used\&
If a table is found to have a possible incompatibility,
\fBmysql_upgrade\fR
performs a table check\&. If any problems are found, a table repair is attempted\&. If the table cannot be repaired, see
-Section\ \&2.12.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
+Section\ \&2.4.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
for manual table repair strategies\&.
.if n \{\
.sp
@@ -59,11 +59,11 @@ for manual table repair strategies\&.
You should always back up your current MySQL installation
\fIbefore\fR
performing an upgrade\&. See
-Section\ \&6.1, \(lqDatabase Backups\(rq\&.
+Section\ \&6.1, \(lqDatabase Backup Methods\(rq\&.
.PP
Some upgrade incompatibilities may require special handling before you upgrade your MySQL installation and run
\fBmysql_upgrade\fR\&. See
-Section\ \&2.12.1, \(lqUpgrading MySQL\(rq, for instructions on determining whether any such incompatibilities apply to your installation and how to handle them\&.
+Section\ \&2.4.1, \(lqUpgrading MySQL\(rq, for instructions on determining whether any such incompatibilities apply to your installation and how to handle them\&.
.sp .5v
.RE
.PP
@@ -189,7 +189,7 @@ If you install MySQL from RPM packages o
\fBmysql_upgrade\fR
is included in the server RPM but requires the client RPM because the latter includes
\fBmysqlcheck\fR\&. (See
-Section\ \&2.4, \(lqInstalling MySQL from RPM Packages on Linux\(rq\&.)
+Section\ \&2.6.1, \(lqInstalling MySQL from RPM Packages on Linux\(rq\&.)
.PP
In MySQL 5\&.1\&.7,
\fBmysql_upgrade \fR
@@ -352,6 +352,26 @@ root\&.
.sp
Verbose mode\&. Print more information about what the program does\&.
.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+.\" mysql_upgrade: write-binlog option
+.\" write-binlog option: mysql_upgrade
+\fB\-\-write\-binlog\fR
+.sp
+Cause binary logging to be enabled while
+\fBmysql_upgrade\fR
+runs\&. This is the default behavior; to disable binary logging during the upgrade, use the inverse of this option (that is, start the program with
+\fB\-\-skip\-write\-binlog\fR)\&.
+.sp
+This option was introduced in MySQL 5\&.1\&.40\&.
+.RE
.SH "COPYRIGHT"
.br
.PP
=== modified file 'man/mysql_waitpid.1'
--- a/man/mysql_waitpid.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_waitpid.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_waitpid\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_WAITPID\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_WAITPID\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysql_zap.1'
--- a/man/mysql_zap.1 2009-09-16 12:03:18 +0000
+++ b/man/mysql_zap.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysql_zap\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQL_ZAP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQL_ZAP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlaccess.1'
--- a/man/mysqlaccess.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlaccess.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlaccess\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLACCESS\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLACCESS\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqladmin.1'
--- a/man/mysqladmin.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqladmin.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqladmin\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLADMIN\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLADMIN\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlbinlog.1'
--- a/man/mysqlbinlog.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlbinlog.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlbinlog\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLBINLOG\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLBINLOG\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -855,7 +855,7 @@ You can pipe the output of
into the
\fBmysql\fR
client to execute the statements contained in the binary log\&. This is used to recover from a crash when you have an old backup (see
-Section\ \&6.1, \(lqDatabase Backups\(rq)\&. For example:
+Section\ \&6.1, \(lqDatabase Backup Methods\(rq)\&. For example:
.sp
.if n \{\
.RS 4
=== modified file 'man/mysqlbug.1'
--- a/man/mysqlbug.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlbug.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlbug\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLBUG\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLBUG\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlcheck.1'
--- a/man/mysqlcheck.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlcheck.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlcheck\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLCHECK\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLCHECK\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -34,7 +34,14 @@ The
\fBmysqlcheck\fR
client performs table maintenance: It checks, repairs, optimizes, or analyzes tables\&.
.PP
-Each table is locked and therefore unavailable to other sessions while it is being processed\&. Table maintenance operations can be time\-consuming, particularly for large tables\&. If you use the
+Each table is locked and therefore unavailable to other sessions while it is being processed, although for check operations, the table is locked with a
+READ
+lock only (see
+Section\ \&12.4.5, \(lqLOCK TABLES and UNLOCK TABLES Syntax\(rq, for more information about
+READ
+and
+WRITE
+locks)\&. Table maintenance operations can be time\-consuming, particularly for large tables\&. If you use the
\fB\-\-databases\fR
or
\fB\-\-all\-databases\fR
@@ -94,7 +101,7 @@ note : The storage engine for the ta
If
\fBmysqlcheck\fR
is unable to repair a table, see
-Section\ \&2.12.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
+Section\ \&2.4.4, \(lqRebuilding or Repairing Tables or Indexes\(rq
for manual table repair strategies\&. This will be the case, for example, for
InnoDB
tables, which can be checked with
=== modified file 'man/mysqld.8'
--- a/man/mysqld.8 2009-09-16 12:03:18 +0000
+++ b/man/mysqld.8 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqld\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLD\FR" "8" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLD\FR" "8" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqld_multi.1'
--- a/man/mysqld_multi.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqld_multi.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqld_multi\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLD_MULTI\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLD_MULTI\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -51,7 +51,7 @@ to specify which servers you want to sta
[mysqld]
group used for starting
\fBmysqld\fR\&. (See, for example,
-Section\ \&2.11.2.2, \(lqStarting and Stopping MySQL Automatically\(rq\&.) However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number\&. For more information on which options must be unique per server in a multiple\-server environment, see
+Section\ \&2.13.1.2, \(lqStarting and Stopping MySQL Automatically\(rq\&.) However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number\&. For more information on which options must be unique per server in a multiple\-server environment, see
Section\ \&5.6, \(lqRunning Multiple MySQL Servers on the Same Machine\(rq\&.
.PP
To invoke
@@ -183,12 +183,6 @@ Otherwise, option files in the standard
option, if one is given\&. (If the option is given multiple times, the last value is used\&.)
.RE
.PP
-Option files read are searched for
-[mysqld_multi]
-and
-[mysqld\fIN\fR]
-option groups\&.
-.PP
Before MySQL 5\&.1\&.18, the preceding options are not recognized\&. Files in the standard locations are read, and any file named by the
\fB\-\-config\-file=\fR\fB\fIfile_name\fR\fR
option, if one is given\&. A file named by
@@ -199,6 +193,39 @@ option groups, not the
[mysqld_multi]
group\&.
.PP
+Option files read are searched for
+[mysqld_multi]
+and
+[mysqld\fIN\fR]
+option groups\&. The
+[mysqld_multi]
+group can be used for options to
+\fBmysqld_multi\fR
+itself\&.
+[mysqld\fIN\fR]
+groups can be used for options passed to specific
+\fBmysqld\fR
+instances\&.
+.PP
+As of MySQL 5\&.1\&.35, the
+[mysqld]
+or
+[mysqld_safe]
+groups can be used for common options read by all instances of
+\fBmysqld\fR
+or
+\fBmysqld_safe\fR\&. You can specify a
+\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR
+option to use a different configuration file for that instance, in which case the
+[mysqld]
+or
+[mysqld_safe]
+groups from that file will be used for that instance\&. Before MySQL 5\&.1\&.35, some versions of
+\fBmysqld_multi\fR
+pass the
+\fB\-\-no\-defaults\fR
+options to instances, so these techniques are inapplicable\&.
+.PP
\fBmysqld_multi\fR
supports the following options:
.sp
=== modified file 'man/mysqld_safe.1'
--- a/man/mysqld_safe.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqld_safe.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqld_safe\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLD_SAFE\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLD_SAFE\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqldump.1'
--- a/man/mysqldump.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqldump.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqldump\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLDUMP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLDUMP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -575,7 +575,7 @@ uses
utf8, and earlier versions use
latin1\&.
.sp
-This option has no effect for output data files produced by using the
+Prior to MySQL 5\&.1\&.38, this option has no effect for output data files produced by using the
\fB\-\-tab\fR
option\&. See the description for that option\&.
.RE
@@ -1232,7 +1232,8 @@ statement for the table\&.
\fB\-\-no\-set\-names\fR
.sp
This option is deprecated\&. Use
-\fB\-\-skip\-set\-charset\fR\&. instead\&.
+\fB\-\-skip\-set\-charset\fR
+instead\&.
.RE
.sp
.RS 4
@@ -1657,11 +1658,11 @@ and
\fB\-\-lines\-terminated\-by\fR
options\&.
.sp
-Column values are dumped using the
-binary
-character set and the
+As of MySQL 5\&.1\&.38, column values are written converted to the character set specified by the
\fB\-\-default\-character\-set\fR
-option is ignored\&. In effect, there is no character set conversion\&. If a table contains columns in several character sets, the output data file will as well and you may not be able to reload the file correctly\&.
+option\&. Prior to 5\&.1\&.38 or if no such option is present, values are dumped using the
+binary
+character set\&. In effect, there is no character set conversion\&. If a table contains columns in several character sets, the output data file will as well and you may not be able to reload the file correctly\&.
.if n \{\
.sp
.\}
@@ -2110,7 +2111,7 @@ InnoDB
storage engine\&.
.PP
For more information on making backups, see
-Section\ \&6.1, \(lqDatabase Backups\(rq, and
+Section\ \&6.1, \(lqDatabase Backup Methods\(rq, and
Section\ \&6.2, \(lqExample Backup and Recovery Strategy\(rq\&.
.\" mysqldump: views
.\" mysqldump: problems
=== modified file 'man/mysqldumpslow.1'
--- a/man/mysqldumpslow.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqldumpslow.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqldumpslow\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLDUMPSLOW\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLDUMPSLOW\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlhotcopy.1'
--- a/man/mysqlhotcopy.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlhotcopy.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlhotcopy\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLHOTCOPY\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLHOTCOPY\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlimport.1'
--- a/man/mysqlimport.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlimport.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlimport\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLIMPORT\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLIMPORT\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlmanager.8'
--- a/man/mysqlmanager.8 2009-09-16 12:03:18 +0000
+++ b/man/mysqlmanager.8 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlmanager\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLMANAGER\FR" "8" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLMANAGER\FR" "8" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -274,7 +274,8 @@ Drop all users from the password file\&.
.\}
.\" mysqlmanager: debug option
.\" debug option: mysqlmanager
-\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR\fB, \-# \fR\fB\fIdebug_options\fR\fR
+\fB\-\-debug=\fR\fB\fIdebug_options\fR\fR,
+\fB\-# \fR\fB\fIdebug_options\fR\fR
.sp
Write a debugging log\&. A typical
\fIdebug_options\fR
=== modified file 'man/mysqlshow.1'
--- a/man/mysqlshow.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlshow.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlshow\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLSHOW\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLSHOW\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqlslap.1'
--- a/man/mysqlslap.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqlslap.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqlslap\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBMYSQLSLAP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBMYSQLSLAP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/mysqltest.1'
--- a/man/mysqltest.1 2009-09-16 12:03:18 +0000
+++ b/man/mysqltest.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBmysqltest\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/08/2009
+.\" Date: 10/29/2009
.\" Manual: MySQL Database System
.\" Source: MySQL
.\" Language: English
.\"
-.TH "\FBMYSQLTEST\FR" "1" "08/08/2009" "MySQL" "MySQL Database System"
+.TH "\FBMYSQLTEST\FR" "1" "10/29/2009" "MySQL" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/ndbd.8'
--- a/man/ndbd.8 2009-09-16 12:03:18 +0000
+++ b/man/ndbd.8 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBndbd\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBNDBD\FR" "8" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBNDBD\FR" "8" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -41,8 +41,9 @@ processes cooperate in handling data\&.
.\" command options (MySQL Cluster): ndbd
.\" MySQL Cluster: ndbd process
.PP
-The following list describes command options specific to the MySQL Cluster data node program
-\fBndbd\fR\&.
+The following table includes command options specific to the MySQL Cluster data node program
+\fBndbd\fR\&. Additional descriptions follow the table\&. For options common to all MySQL Cluster programs, see
+Section\ \&17.4.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&.
.if n \{\
.sp
.\}
@@ -68,7 +69,7 @@ wherever the latter occurs in this secti
For options common to all
NDBCLUSTER
programs, see
-Section\ \&17.6.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&.
+Section\ \&17.4.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&.
.sp
.RS 4
.ie n \{\
@@ -81,9 +82,11 @@ Section\ \&17.6.2, \(lqOptions Common to
\fB\-\-bind\-address\fR
.TS
allbox tab(:);
-l l
-l l
-l l.
+l l s
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBVersion Introduced\fR
T}:T{
@@ -95,28 +98,16 @@ T}:T{
\-\-bind\-address=name
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
string
T}
-T{
+:T{
\fBDefault\fR
T}:T{
T}
@@ -141,36 +132,26 @@ This option was added in MySQL 5\&.1\&.1
\fB\-d\fR
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-\-daemon
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
TRUE
@@ -182,6 +163,12 @@ Instructs
to execute as a daemon process\&. This is the default behavior\&.
\fB\-\-nodaemon\fR
can be used to prevent the process from running as a daemon\&.
+.sp
+This option has no effect when running
+\fBndbd\fR
+or
+\fBndbmtd\fR
+on Windows platforms\&.
.RE
.sp
.RS 4
@@ -197,36 +184,26 @@ can be used to prevent the process from
\fB\-\-initial\fR
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-\-initial
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
@@ -321,9 +298,11 @@ Backup files that have already been crea
.IP \(bu 2.3
.\}
MySQL Cluster Disk Data files (see
-Section\ \&17.10, \(lqMySQL Cluster Disk Data Tables\(rq)\&.
+Section\ \&17.5.9, \(lqMySQL Cluster Disk Data Tables\(rq)\&.
.RE
.RS 4
+.sp
+This option also has no effect on recovery of data by a data node that is just starting (or restarting) from data nodes that are already running\&. This recovery of data occurs automatically, and requires no user intervention in a MySQL Cluster that is running normally\&.
.sp .5v
.RE
It is permissible to use this option when starting the cluster for the very first time (that is, before any data node files have been created); however, it is
@@ -344,9 +323,11 @@ necessary to do so\&.
\fB\-\-initial\-start\fR
.TS
allbox tab(:);
-l l
-l l
-l l.
+l l s
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBVersion Introduced\fR
T}:T{
@@ -358,28 +339,16 @@ T}:T{
\-\-initial\-start
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
@@ -435,9 +404,11 @@ Prior to MySQL 5\&.1\&.19, it was not po
\fB\-\-nowait\-nodes=\fR\fB\fInode_id_1\fR\fR\fB[, \fR\fB\fInode_id_2\fR\fR\fB[, \&.\&.\&.]]\fR
.TS
allbox tab(:);
-l l
-l l
-l l.
+l l s
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBVersion Introduced\fR
T}:T{
@@ -449,28 +420,16 @@ T}:T{
\-\-nowait\-nodes=list
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
string
T}
-T{
+:T{
\fBDefault\fR
T}:T{
T}
@@ -508,36 +467,26 @@ This option was added in MySQL 5\&.1\&.9
\fB\-\-nodaemon\fR
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-\-nodaemon
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
@@ -549,6 +498,12 @@ Instructs
not to start as a daemon process\&. This is useful when
\fBndbd\fR
is being debugged and you want output to be redirected to the screen\&.
+.sp
+As of MySQL Cluster NDB 7\&.0\&.8, the default behavior for
+\fBndbd\fR
+and
+\fBndbmtd\fR
+on Windows is to run in the foreground, making this option unnecessary on Windows platforms\&. (\m[blue]\fBBug#45588\fR\m[]\&\s-2\u[2]\d\s+2)
.RE
.sp
.RS 4
@@ -567,36 +522,26 @@ is being debugged and you want output to
\fB\-n\fR
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-\-nostart
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
@@ -610,7 +555,7 @@ not to start automatically\&. When this
connects to the management server, obtains configuration data from it, and initializes communication objects\&. However, it does not actually start the execution engine until specifically requested to do so by the management server\&. This can be accomplished by issuing the proper
START
command in the management client (see
-Section\ \&17.7.2, \(lqCommands in the MySQL Cluster Management Client\(rq)\&.
+Section\ \&17.5.2, \(lqCommands in the MySQL Cluster Management Client\(rq)\&.
.RE
.\" MySQL Cluster: log files
.\" log files (MySQL Cluster)
@@ -668,7 +613,7 @@ TraceFile: ndb_2_trace\&.log\&.2
Listings of possible
\fBndbd\fR
exit codes and messages generated when a data node process shuts down prematurely can be found in
-\m[blue]\fBndbd Error Messages\fR\m[]\&\s-2\u[2]\d\s+2\&.
+\m[blue]\fBndbd Error Messages\fR\m[]\&\s-2\u[3]\d\s+2\&.
.if n \{\
.sp
.\}
@@ -784,7 +729,7 @@ shell> \fBndbd \-\-connect\-string="node
.\}
.PP
See
-Section\ \&17.3.4.3, \(lqThe MySQL Cluster Connectstring\(rq, for additional information about this issue\&.
+Section\ \&17.3.2.3, \(lqThe MySQL Cluster Connectstring\(rq, for additional information about this issue\&.
\fBndbd\fR(8), describes other options for
\fBndbd\fR\&.
.PP
@@ -810,7 +755,7 @@ process can consume up to 2 CPUs if perm
For a machine with many CPUs it is possible to use several
\fBndbd\fR
processes which belong to different node groups; however, such a configuration is still considered experimental and is not supported for MySQL 5\&.1 in a production setting\&. See
-Section\ \&17.12, \(lqKnown Limitations of MySQL Cluster\(rq\&.
+Section\ \&17.1.5, \(lqKnown Limitations of MySQL Cluster\(rq\&.
.SH "COPYRIGHT"
.br
.PP
@@ -829,6 +774,11 @@ Bug#24631
\%http://bugs.mysql.com/24631
.RE
.IP " 2." 4
+Bug#45588
+.RS 4
+\%http://bugs.mysql.com/45588
+.RE
+.IP " 3." 4
ndbd Error Messages
.RS 4
\%http://dev.mysql.com/doc/ndbapi/en/ndbd-error-messages.html
=== modified file 'man/ndbd_redo_log_reader.1'
--- a/man/ndbd_redo_log_reader.1 2009-09-16 12:03:18 +0000
+++ b/man/ndbd_redo_log_reader.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBndbd_redo_log_reader\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBNDBD_REDO_LOG_REA" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBNDBD_REDO_LOG_REA" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -37,6 +37,10 @@ The C++ source files for
can be found in the directory
/storage/ndb/src/kernel/blocks/dblqh/redoLogReader\&.
.PP
+The following table includes options that are specific to the MySQL Cluster program
+\fBndbd_redo_log_reader\fR\&. Additional descriptions follow the table\&. For options common to all MySQL Cluster programs, see
+Section\ \&17.4.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&.
+.PP
\fBUsage\fR:
.sp
.if n \{\
@@ -56,105 +60,83 @@ ndb_\fI#\fR_fs/D\fI#\fR/LCP/\fI#\fR/T\fI
represents a number (not necessarily the same number)\&. For more information, see
\m[blue]\fBCluster Data Node FileSystemDir Files\fR\m[]\&\s-2\u[1]\d\s+2\&.
.PP
-\fBAdditional Options\fR:
+The name of the file to be read may be followed by one or more of the options listed here:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-noprint
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
T}
.TE
.sp 1
+\fB\-noprint\fR: Do not print the contents of the log file\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.TS
allbox tab(:);
-l l
-l l.
+l l s
+l l s
+^ l l
+^ l l.
T{
\fBCommand Line Format\fR
T}:T{
\-nocheck
T}
T{
-\fBPermitted Values \fR
+\ \&
T}:T{
-[\fInested\ table\fR]*
+\fBPermitted Values \fR
T}
-.TE
-.sp 1
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.B *[nested\ table]
-.TS
-allbox tab(:);
-l l
-l l.
-T{
+:T{
\fBType\fR
T}:T{
boolean
T}
-T{
+:T{
\fBDefault\fR
T}:T{
FALSE
T}
.TE
.sp 1
-.PP
-The name of the file to be read may be followed by one or more of the options listed here:
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-\fB\-noprint\fR: Do not print the contents of the log file\&.
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
\fB\-nocheck\fR: Do not check the log file for errors\&.
.RE
.sp
@@ -184,7 +166,7 @@ You should have received a copy of the G
.IP " 1." 4
Cluster Data Node FileSystemDir Files
.RS 4
-\%http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndbd-filesystem.html#ndb-internals-ndbd-filesystemdir-files
+\%http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndbd-filesystemdir-files.html
.RE
.SH "SEE ALSO"
For more information, please refer to the MySQL Reference Manual,
=== modified file 'man/ndbmtd.8'
--- a/man/ndbmtd.8 2009-09-16 12:03:18 +0000
+++ b/man/ndbmtd.8 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBndbmtd\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBNDBMTD\FR" "8" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBNDBMTD\FR" "8" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -49,8 +49,8 @@ Command\-line options and configuration
\fBndbd\fR
also apply to
\fBndbmtd\fR\&. For more information about these options and parameters, see
-Section\ \&17.6.3.2, \(lqProgram Options for ndbd and ndbmtd\(rq, and
-Section\ \&17.3.4.6, \(lqDefining MySQL Cluster Data Nodes\(rq, respectively\&.
+\fBndbd\fR(8), and
+Section\ \&17.3.2.6, \(lqDefining MySQL Cluster Data Nodes\(rq, respectively\&.
.PP
\fBndbmtd\fR
is also file system\-compatible with
@@ -69,25 +69,13 @@ simply by stopping the node and then sta
\fBndbd\fR
in place of the multi\-threaded binary\&. It is not necessary when switching between the two to start the data node binary using
\fB\-\-initial\fR\&.
-.if n \{\
-.sp
-.\}
-.RS 4
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fBImportant\fR
-.ps -1
-.br
.PP
-We do not currently recommend using
+Prior to MySQL Cluster NDB 7\&.0\&.6, there were known issues when using
\fBndbmtd\fR
-with MySQL Cluster Disk Data tables in production, due to known issues which we are working to fix in a future MySQL Cluster release\&. (\m[blue]\fBBug#41915\fR\m[]\&\s-2\u[1]\d\s+2,
+with MySQL Cluster Disk Data tables\&. If you wish to use multi\-threaded data nodes with disk\-based
+NDB
+tables, you should insure that you are running MySQL Cluster NDB 7\&.0\&.6 or later\&. (\m[blue]\fBBug#41915\fR\m[]\&\s-2\u[1]\d\s+2,
\m[blue]\fBBug#44915\fR\m[]\&\s-2\u[2]\d\s+2)
-.sp .5v
-.RE
.PP
Using
\fBndbmtd\fR
@@ -129,6 +117,8 @@ failures\&.
.RE
.PP
These differences are discussed in more detail in the next few paragraphs\&.
+.\" execution threads (MySQL Cluster)
+.\" MySQL Cluster: execution threads
.\" ndbmtd: MaxNoOfExecutionThreads
.\" MaxNoOfExecutionThreads: ndbmtd
.\" ndbmtd: trace files
@@ -148,7 +138,7 @@ file, it is exclusive to
and does not apply to
\fBndbd\fR\&.
.PP
-This parameter takes an integer value from 2 to 8 inclusive\&. Generally, you should set this to the number of CPU cores on the data node host, as shown in the following table:
+This parameter takes an integer value from 2 to 8 inclusive\&. Generally, you should set this parameter equal to the number of CPU cores on the data node host, as shown in the following table:
.TS
allbox tab(:);
lB lB.
=== modified file 'man/perror.1'
--- a/man/perror.1 2009-09-16 12:03:18 +0000
+++ b/man/perror.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBperror\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBPERROR\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBPERROR\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/replace.1'
--- a/man/replace.1 2009-09-16 12:03:18 +0000
+++ b/man/replace.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBreplace\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBREPLACE\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBREPLACE\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/resolve_stack_dump.1'
--- a/man/resolve_stack_dump.1 2009-09-16 12:03:18 +0000
+++ b/man/resolve_stack_dump.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBresolve_stack_dump\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBRESOLVE_STACK_DUM" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBRESOLVE_STACK_DUM" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'man/resolveip.1'
--- a/man/resolveip.1 2009-09-16 12:03:18 +0000
+++ b/man/resolveip.1 2009-12-01 07:24:05 +0000
@@ -2,12 +2,12 @@
.\" Title: \fBresolveip\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 08/12/2009
+.\" Date: 11/04/2009
.\" Manual: MySQL Database System
.\" Source: MySQL 5.1
.\" Language: English
.\"
-.TH "\FBRESOLVEIP\FR" "1" "08/12/2009" "MySQL 5\&.1" "MySQL Database System"
+.TH "\FBRESOLVEIP\FR" "1" "11/04/2009" "MySQL 5\&.1" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
=== modified file 'scripts/fill_help_tables.sql'
--- a/scripts/fill_help_tables.sql 2009-09-16 12:03:18 +0000
+++ b/scripts/fill_help_tables.sql 2009-12-01 07:24:05 +0000
@@ -87,7 +87,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (18,25,'SHOW CREATE PROCEDURE','Syntax:\nSHOW CREATE PROCEDURE proc_name\n\nThis statement is a MySQL extension. It returns the exact string that\ncan be used to re-create the named stored procedure. A similar\nstatement, SHOW CREATE FUNCTION, displays information about stored\nfunctions (see [HELP SHOW CREATE FUNCTION]).\n\nBoth statements require that you be the owner of the routine or have\nSELECT access to the mysql.proc table. If you do not have privileges\nfor the routine itself, the value displayed for the Create Procedure or\nCreate Function field will be NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-procedure.html\n\n','mysql> SHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row ***************************\n Procedure: simpleproc\n sql_mode:\n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)\n BEGIN\n SELECT COUNT(*) INTO param1 FROM t;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nmysql> SHOW CREATE FUNCTION test.hello\\G\n*************************** 1. row ***************************\n Function: hello\n sql_mode:\n Create Function: CREATE FUNCTION `hello`(s CHAR(20))\n RETURNS CHAR(50)\n RETURN CONCAT(\'Hello, \',s,\'!\')\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.1/en/show-create-procedure.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (19,20,'INTEGER','INTEGER[(M)] [UNSIGNED] [ZEROFILL]\n\nThis type is a synonym for INT.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (20,35,'LOWER','Syntax:\nLOWER(str)\n\nReturns the string str with all characters changed to lowercase\naccording to the current character set mapping. The default is latin1\n(cp1252 West European).\n\nmysql> SELECT LOWER(\'QUADRATICALLY\');\n -> \'quadratically\'\n\nLOWER() (and UPPER()) are ineffective when applied to binary strings\n(BINARY, VARBINARY, BLOB). To perform lettercase conversion, convert\nthe string to a nonbinary string:\n\nmysql> SET @str = BINARY \'New York\';\nmysql> SELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));\n+-------------+-----------------------------------+\n| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |\n+-------------+-----------------------------------+\n| New York | new york |\n+-------------+-----------------------------------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,25,'SHOW COLUMNS','Syntax:\nSHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW COLUMNS displays information about the columns in a given table.\nIt also works for views. The LIKE clause, if present, indicates which\ncolumn names to match. The WHERE clause can be given to select rows\nusing more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nmysql> SHOW COLUMNS FROM City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nIf the data types differ from what you expect them to be based on a\nCREATE TABLE statement, note that MySQL sometimes changes data types\nwhen you create or alter a table. The conditions under which this\noccurs are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/silent-column-changes.html.\n\nT… FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. In other words, these two statements are equivalent:\n\nmysql> SHOW COLUMNS FROM mytable FROM mydb;\nmysql> SHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for nonbinary string columns, or NULL\nfor other columns. This value is displayed only if you use the FULL\nkeyword.\n\nThe Null field contains YES if NULL values can be stored in the column,\nNO if not.\n\nThe Key field indicates whether the column is indexed:\n\no If Key is empty, the column either is not indexed or is indexed only\n as a secondary column in a multiple-column, nonunique index.\n\no If Key is PRI, the column is a PRIMARY KEY or is one of the columns\n in a multiple-column PRIMARY KEY.\n\no If Key is UNI, the column is the first column of a unique-valued\n index that cannot contain NULL values.\n\no If Key is MUL, multiple occurrences of a given value are allowed\n within the column. The column is the first column of a nonunique\n index or a unique-valued index that can contain NULL values.\n\nIf more than one of the Key values applies to a given column of a\ntable, Key displays the one with the highest priority, in the order\nPRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values\nand there is no PRIMARY KEY in the table. A UNIQUE index may display as\nMUL if several columns form a composite UNIQUE index; although the\ncombination of the columns is unique, each column can still hold\nmultiple occurrences of a given value.\n\nThe Default field indicates the default value that is assigned to the\ncolumn.\n\nThe Extra field contains any additional information that is available\nabout a given column. The value is auto_increment if the column was\ncreated with the AUTO_INCREMENT keyword and empty otherwise.\n\nPrivileges indicates the privileges you have for the column. This value\nis displayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed\nonly if you use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. You can also list a table\'s\ncolumns with the mysqlshow db_name tbl_name command.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS.\nSee [HELP DESCRIBE].\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements\nalso provide information about tables. See [HELP SHOW].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-columns.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-columns.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (21,25,'SHOW COLUMNS','Syntax:\nSHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW COLUMNS displays information about the columns in a given table.\nIt also works for views. The LIKE clause, if present, indicates which\ncolumn names to match. The WHERE clause can be given to select rows\nusing more general conditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nmysql> SHOW COLUMNS FROM City;\n+------------+----------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+----------+------+-----+---------+----------------+\n| Id | int(11) | NO | PRI | NULL | auto_increment |\n| Name | char(35) | NO | | | |\n| Country | char(3) | NO | UNI | | |\n| District | char(20) | YES | MUL | | |\n| Population | int(11) | NO | | 0 | |\n+------------+----------+------+-----+---------+----------------+\n5 rows in set (0.00 sec)\n\nIf the data types differ from what you expect them to be based on a\nCREATE TABLE statement, note that MySQL sometimes changes data types\nwhen you create or alter a table. The conditions under which this\noccurs are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/silent-column-changes.html.\n\nT… FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM\ndb_name syntax. In other words, these two statements are equivalent:\n\nmysql> SHOW COLUMNS FROM mytable FROM mydb;\nmysql> SHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for nonbinary string columns, or NULL\nfor other columns. This value is displayed only if you use the FULL\nkeyword.\n\nThe Null field contains YES if NULL values can be stored in the column,\nNO if not.\n\nThe Key field indicates whether the column is indexed:\n\no If Key is empty, the column either is not indexed or is indexed only\n as a secondary column in a multiple-column, nonunique index.\n\no If Key is PRI, the column is a PRIMARY KEY or is one of the columns\n in a multiple-column PRIMARY KEY.\n\no If Key is UNI, the column is the first column of a unique-valued\n index that cannot contain NULL values.\n\no If Key is MUL, multiple occurrences of a given value are allowed\n within the column. The column is the first column of a nonunique\n index or a unique-valued index that can contain NULL values.\n\nIf more than one of the Key values applies to a given column of a\ntable, Key displays the one with the highest priority, in the order\nPRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values\nand there is no PRIMARY KEY in the table. A UNIQUE index may display as\nMUL if several columns form a composite UNIQUE index; although the\ncombination of the columns is unique, each column can still hold\nmultiple occurrences of a given value.\n\nThe Default field indicates the default value that is assigned to the\ncolumn.\n\nThe Extra field contains any additional information that is available\nabout a given column. The value is nonempty in these cases:\nauto_increment for columns that have the AUTO_INCREMENT attribute; as\nof MySQL 5.1.23, on update CURRENT_TIMESTAMP for TIMESTAMP columns that\nhave the ON UPDATE CURRENT_TIMESTAMP attribute.\n\nPrivileges indicates the privileges you have for the column. This value\nis displayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed\nonly if you use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. You can also list a table\'s\ncolumns with the mysqlshow db_name tbl_name command.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS.\nSee [HELP DESCRIBE].\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements\nalso provide information about tables. See [HELP SHOW].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-columns.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-columns.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (22,37,'CREATE TRIGGER','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n TRIGGER trigger_name trigger_time trigger_event\n ON tbl_name FOR EACH ROW trigger_stmt\n\nThis statement creates a new trigger. A trigger is a named database\nobject that is associated with a table, and that activates when a\nparticular event occurs for the table. The trigger becomes associated\nwith the table named tbl_name, which must refer to a permanent table.\nYou cannot associate a trigger with a TEMPORARY table or a view.\n\nCREATE TRIGGER requires the TRIGGER privilege for the table associated\nwith the trigger. (Before MySQL 5.1.6, this statement requires the\nSUPER privilege.)\n\nThe DEFINER clause determines the security context to be used when\nchecking access privileges at trigger activation time.\n\ntrigger_time is the trigger action time. It can be BEFORE or AFTER to\nindicate that the trigger activates before or after each row to be\nmodified.\n\ntrigger_event indicates the kind of statement that activates the\ntrigger. The trigger_event can be one of the following:\n\no INSERT: The trigger is activated whenever a new row is inserted into\n the table; for example, through INSERT, LOAD DATA, and REPLACE\n statements.\n\no UPDATE: The trigger is activated whenever a row is modified; for\n example, through UPDATE statements.\n\no DELETE: The trigger is activated whenever a row is deleted from the\n table; for example, through DELETE and REPLACE statements. However,\n DROP TABLE and TRUNCATE statements on the table do not activate this\n trigger, because they do not use DELETE. Dropping a partition does\n not activate DELETE triggers, either. See [HELP TRUNCATE TABLE].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (23,30,'MONTH','Syntax:\nMONTH(date)\n\nReturns the month for date, in the range 1 to 12 for January to\nDecember, or 0 for dates such as \'0000-00-00\' or \'2008-00-00\' that have\na zero month part.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MONTH(\'2008-02-03\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (24,20,'TINYINT','TINYINT[(M)] [UNSIGNED] [ZEROFILL]\n\nA very small integer. The signed range is -128 to 127. The unsigned\nrange is 0 to 255.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
@@ -153,7 +153,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (84,25,'EXECUTE STATEMENT','Syntax:\nEXECUTE stmt_name\n [USING @var_name [, @var_name] ...]\n\nAfter preparing a statement with PREPARE, you execute it with an\nEXECUTE statement that refers to the prepared statement name. If the\nprepared statement contains any parameter markers, you must supply a\nUSING clause that lists user variables containing the values to be\nbound to the parameters. Parameter values can be supplied only by user\nvariables, and the USING clause must name exactly as many variables as\nthe number of parameter markers in the statement.\n\nYou can execute a given prepared statement multiple times, passing\ndifferent variables to it or setting the variables to different values\nbefore each execution.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/execute.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/execute.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (85,37,'DROP INDEX','Syntax:\nDROP [ONLINE|OFFLINE] INDEX index_name ON tbl_name\n\nDROP INDEX drops the index named index_name from the table tbl_name.\nThis statement is mapped to an ALTER TABLE statement to drop the index.\nSee [HELP ALTER TABLE].\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-index.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-index.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (86,35,'MATCH AGAINST','Syntax:\nMATCH (col1,col2,...) AGAINST (expr [search_modifier])\n\nMySQL has support for full-text indexing and searching:\n\no A full-text index in MySQL is an index of type FULLTEXT.\n\no Full-text indexes can be used only with MyISAM tables, and can be\n created only for CHAR, VARCHAR, or TEXT columns.\n\no A FULLTEXT index definition can be given in the CREATE TABLE\n statement when a table is created, or added later using ALTER TABLE\n or CREATE INDEX.\n\no For large data sets, it is much faster to load your data into a table\n that has no FULLTEXT index and then create the index after that, than\n to load data into a table that has an existing FULLTEXT index.\n\nFull-text searching is performed using MATCH() ... AGAINST syntax.\nMATCH() takes a comma-separated list that names the columns to be\nsearched. AGAINST takes a string to search for, and an optional\nmodifier that indicates what type of search to perform. The search\nstring must be a literal string, not a variable or a column name. There\nare three types of full-text searches:\n\no A boolean search interprets the search string using the rules of a\n special query language. The string contains the words to search for.\n It can also contain operators that specify requirements such that a\n word must be present or absent in matching rows, or that it should be\n weighted higher or lower than usual. Common words such as "some" or\n "then" are stopwords and do not match if present in the search\n string. The IN BOOLEAN MODE modifier specifies a boolean search. For\n more information, see\n http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html.\n\no A natural language search interprets the search string as a phrase in\n natural human language (a phrase in free text). There are no special\n operators. The stopword list applies. In addition, words that are\n present in 50% or more of the rows are considered common and do not\n match. Full-text searches are natural language searches if the IN\n NATURAL LANGUAGE MODE modifier is given or if no modifier is given.\n\no A query expansion search is a modification of a natural language\n search. The search string is used to perform a natural language\n search. Then words from the most relevant rows returned by the search\n are added to the search string and the search is done again. The\n query returns the rows from the second search. The IN NATURAL\n LANGUAGE MODE WITH QUERY EXPANSION or WITH QUERY EXPANSION modifier\n specifies a query expansion search. For more information, see\n http://dev.mysql.com/doc/refman/5.1/en/fulltext-query-expansion.html.\n\nThe IN NATURAL LANGUAGE MODE and IN NATURAL LANGUAGE MODE WITH QUERY\nEXPANSION modifiers were added in MySQL 5.1.7.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html\n\n','mysql> SELECT id, body, MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE) AS score\n -> FROM articles WHERE MATCH (title,body) AGAINST\n -> (\'Security implications of running MySQL as root\'\n -> IN NATURAL LANGUAGE MODE);\n+----+-------------------------------------+-----------------+\n| id | body | score |\n+----+-------------------------------------+-----------------+\n| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |\n| 6 | When configured properly, MySQL ... | 1.3114095926285 |\n+----+-------------------------------------+-----------------+\n2 rows in set (0.00 sec)\n','http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,37,'CREATE EVENT','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n EVENT\n [IF NOT EXISTS]\n event_name\n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO sql_statement;\n\nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval\n [STARTS timestamp [+ INTERVAL interval] ...]\n [ENDS timestamp [+ INTERVAL interval] ...]\n\ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n\nThis statement creates and schedules a new event. It requires the EVENT\nprivilege for the schema in which the event is to be created.\n\nThe minimum requirements for a valid CREATE EVENT statement are as\nfollows:\n\no The keywords CREATE EVENT plus an event name, which uniquely\n identifies the event in the current schema. (Prior to MySQL 5.1.12,\n the event name needed to be unique only among events created by the\n same user on a given database.)\n\no An ON SCHEDULE clause, which determines when and how often the event\n executes.\n\no A DO clause, which contains the SQL statement to be executed by an\n event.\n\nThis is an example of a minimal CREATE EVENT statement:\n\nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n\nThe previous statement creates an event named myevent. This event\nexecutes once --- one hour following its creation --- by running an SQL\nstatement that increments the value of the myschema.mytable table\'s\nmycol column by 1.\n\nThe event_name must be a valid MySQL identifier with a maximum length\nof 64 characters. It may be delimited using back ticks, and may be\nqualified with the name of a database schema. An event is associated\nwith both a MySQL user (the definer) and a schema, and its name must be\nunique among names of events within that schema. In general, the rules\ngoverning event names are the same as those for names of stored\nroutines. See http://dev.mysql.com/doc/refman/5.1/en/identifiers.html.\n\nIf no schema is indicated as part of event_name, the default (current)\nschema is assumed.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-event.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-event.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (87,37,'CREATE EVENT','Syntax:\nCREATE\n [DEFINER = { user | CURRENT_USER }]\n EVENT\n [IF NOT EXISTS]\n event_name\n ON SCHEDULE schedule\n [ON COMPLETION [NOT] PRESERVE]\n [ENABLE | DISABLE | DISABLE ON SLAVE]\n [COMMENT \'comment\']\n DO sql_statement;\n\nschedule:\n AT timestamp [+ INTERVAL interval] ...\n | EVERY interval\n [STARTS timestamp [+ INTERVAL interval] ...]\n [ENDS timestamp [+ INTERVAL interval] ...]\n\ninterval:\n quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |\n WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |\n DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}\n\nThis statement creates and schedules a new event. It requires the EVENT\nprivilege for the schema in which the event is to be created.\n\nThe minimum requirements for a valid CREATE EVENT statement are as\nfollows:\n\no The keywords CREATE EVENT plus an event name, which uniquely\n identifies the event within a database schema. (Prior to MySQL\n 5.1.12, the event name needed to be unique only among events created\n by the same user within a schema.)\n\no An ON SCHEDULE clause, which determines when and how often the event\n executes.\n\no A DO clause, which contains the SQL statement to be executed by an\n event.\n\nThis is an example of a minimal CREATE EVENT statement:\n\nCREATE EVENT myevent\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR\n DO\n UPDATE myschema.mytable SET mycol = mycol + 1;\n\nThe previous statement creates an event named myevent. This event\nexecutes once --- one hour following its creation --- by running an SQL\nstatement that increments the value of the myschema.mytable table\'s\nmycol column by 1.\n\nThe event_name must be a valid MySQL identifier with a maximum length\nof 64 characters. Event names are not case sensitive, so you cannot\nhave two events named myevent and MyEvent in the same schema. In\ngeneral, the rules governing event names are the same as those for\nnames of stored routines. See\nhttp://dev.mysql.com/doc/refman/5.1/en/identifiers.html.\n\nAn event is associated with a schema. If no schema is indicated as part\nof event_name, the default (current) schema is assumed. To create an\nevent in a specific schema, qualify the event name with a schema using\nschema_name.event_name syntax.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-event.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-event.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (88,4,'ABS','Syntax:\nABS(X)\n\nReturns the absolute value of X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ABS(2);\n -> 2\nmysql> SELECT ABS(-32);\n -> 32\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (89,31,'POLYFROMWKB','PolyFromWKB(wkb[,srid]), PolygonFromWKB(wkb[,srid])\n\nConstructs a POLYGON value using its WKB representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb…','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkb…');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (90,35,'NOT LIKE','Syntax:\nexpr NOT LIKE pat [ESCAPE \'escape_char\']\n\nThis is the same as NOT (expr LIKE pat [ESCAPE \'escape_char\']).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html');
@@ -163,7 +163,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (94,16,'MAX','Syntax:\nMAX([DISTINCT] expr)\n\nReturns the maximum value of expr. MAX() may take a string argument; in\nsuch cases, it returns the maximum string value. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html. The DISTINCT\nkeyword can be used to find the maximum of the distinct values of expr,\nhowever, this produces the same result as omitting DISTINCT.\n\nMAX() returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT student_name, MIN(test_score), MAX(test_score)\n -> FROM student\n -> GROUP BY student_name;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (95,21,'CREATE FUNCTION UDF','Syntax:\nCREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING|INTEGER|REAL|DECIMAL}\n SONAME shared_library_name\n\nA user-defined function (UDF) is a way to extend MySQL with a new\nfunction that works like a native (built-in) MySQL function such as\nABS() or CONCAT().\n\nfunction_name is the name that should be used in SQL statements to\ninvoke the function. The RETURNS clause indicates the type of the\nfunction\'s return value. DECIMAL is a legal value after RETURNS, but\ncurrently DECIMAL functions return string values and should be written\nlike STRING functions.\n\nshared_library_name is the basename of the shared object file that\ncontains the code that implements the function. The file must be\nlocated in the plugin directory. This directory is given by the value\nof the plugin_dir system variable.\n\n*Note*: This is a change in MySQL 5.1. For earlier versions of MySQL,\nthe shared object can be located in any directory that is searched by\nyour system\'s dynamic linker.\n\nTo create a function, you must have the INSERT privilege for the mysql\ndatabase. This is necessary because CREATE FUNCTION adds a row to the\nmysql.func system table that records the function\'s name, type, and\nshared library name. If you do not have this table, you should run the\nmysql_upgrade command to create it. See\nhttp://dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-function-udf.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-function-udf.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (96,4,'*','Syntax:\n*\n\nMultiplication:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT 3*5;\n -> 15\nmysql> SELECT 18014398509481984*18014398509481984.0;\n -> 324518553658426726783156020576256.0\nmysql> SELECT 18014398509481984*18014398509481984;\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,20,'TIMESTAMP','TIMESTAMP\n\nA timestamp. The range is \'1970-01-01 00:00:01\' UTC to \'2038-01-09\n03:14:07\' UTC. TIMESTAMP values are stored as the number of seconds\nsince the epoch (\'1970-01-01 00:00:00\' UTC). A TIMESTAMP cannot\nrepresent the value \'1970-01-01 00:00:00\' because that is equivalent to\n0 seconds from the epoch and the value 0 is reserved for representing\n\'0000-00-00 00:00:00\', the "zero" TIMESTAMP value.\n\nA TIMESTAMP column is useful for recording the date and time of an\nINSERT or UPDATE operation. By default, the first TIMESTAMP column in a\ntable is automatically set to the date and time of the most recent\noperation if you do not assign it a value yourself. You can also set\nany TIMESTAMP column to the current date and time by assigning it a\nNULL value. Variations on automatic initialization and update\nproperties are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/timestamp.html.\n\nA TIMESTAMP value is returned as a string in the format \'YYYY-MM-DD\nHH:MM:SS\' with a display width fixed at 19 characters. To obtain the\nvalue as a number, you should add +0 to the timestamp column.\n\n*Note*: The TIMESTAMP format that was used prior to MySQL 4.1 is not\nsupported in MySQL 5.1; see MySQL 3.23, 4.0, 4.1 Reference Manual for\ninformation regarding the old format.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (97,20,'TIMESTAMP','TIMESTAMP\n\nA timestamp. The range is \'1970-01-01 00:00:01\' UTC to \'2038-01-19\n03:14:07\' UTC. TIMESTAMP values are stored as the number of seconds\nsince the epoch (\'1970-01-01 00:00:00\' UTC). A TIMESTAMP cannot\nrepresent the value \'1970-01-01 00:00:00\' because that is equivalent to\n0 seconds from the epoch and the value 0 is reserved for representing\n\'0000-00-00 00:00:00\', the "zero" TIMESTAMP value.\n\nA TIMESTAMP column is useful for recording the date and time of an\nINSERT or UPDATE operation. By default, the first TIMESTAMP column in a\ntable is automatically set to the date and time of the most recent\noperation if you do not assign it a value yourself. You can also set\nany TIMESTAMP column to the current date and time by assigning it a\nNULL value. Variations on automatic initialization and update\nproperties are described in\nhttp://dev.mysql.com/doc/refman/5.1/en/timestamp.html.\n\nA TIMESTAMP value is returned as a string in the format \'YYYY-MM-DD\nHH:MM:SS\' with a display width fixed at 19 characters. To obtain the\nvalue as a number, you should add +0 to the timestamp column.\n\n*Note*: The TIMESTAMP format that was used prior to MySQL 4.1 is not\nsupported in MySQL 5.1; see MySQL 3.23, 4.0, 4.1 Reference Manual for\ninformation regarding the old format.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (98,11,'DES_DECRYPT','Syntax:\nDES_DECRYPT(crypt_str[,key_str])\n\nDecrypts a string encrypted with DES_ENCRYPT(). If an error occurs,\nthis function returns NULL.\n\nThis function works only if MySQL has been configured with SSL support.\nSee http://dev.mysql.com/doc/refman/5.1/en/secure-connections.html.\n\nIf no key_str argument is given, DES_DECRYPT() examines the first byte\nof the encrypted string to determine the DES key number that was used\nto encrypt the original string, and then reads the key from the DES key\nfile to decrypt the message. For this to work, the user must have the\nSUPER privilege. The key file can be specified with the --des-key-file\nserver option.\n\nIf you pass this function a key_str argument, that string is used as\nthe key for decrypting the message.\n\nIf the crypt_str argument does not appear to be an encrypted string,\nMySQL returns the given crypt_str.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (99,25,'CACHE INDEX','Syntax:\nCACHE INDEX\n tbl_index_list [, tbl_index_list] ...\n IN key_cache_name\n\ntbl_index_list:\n tbl_name [[INDEX|KEY] (index_name[, index_name] ...)]\n\nThe CACHE INDEX statement assigns table indexes to a specific key\ncache. It is used only for MyISAM tables.\n\nThe following statement assigns indexes from the tables t1, t2, and t3\nto the key cache named hot_cache:\n\nmysql> CACHE INDEX t1, t2, t3 IN hot_cache;\n+---------+--------------------+----------+----------+\n| Table | Op | Msg_type | Msg_text |\n+---------+--------------------+----------+----------+\n| test.t1 | assign_to_keycache | status | OK |\n| test.t2 | assign_to_keycache | status | OK |\n| test.t3 | assign_to_keycache | status | OK |\n+---------+--------------------+----------+----------+\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/cache-index.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/cache-index.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (100,12,'ENDPOINT','EndPoint(ls)\n\nReturns the Point that is the endpoint of the LineString value ls.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#lin…','mysql> SET @ls = \'LineString(1 1,2 2,3 3)\';\nmysql> SELECT AsText(EndPoint(GeomFromText(@ls)));\n+-------------------------------------+\n| AsText(EndPoint(GeomFromText(@ls))) |\n+-------------------------------------+\n| POINT(3 3) |\n+-------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#lin…');
@@ -202,7 +202,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (133,25,'SHOW STATUS','Syntax:\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW STATUS provides server status information. This information also\ncan be obtained using the mysqladmin extended-status command. The LIKE\nclause, if present, indicates which variable names to match. The WHERE\nclause can be given to select rows using more general conditions, as\ndiscussed in http://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\nThis statement does not require any privilege. It requires only the\nability to connect to the server.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern:\n\nmysql> SHOW STATUS LIKE \'Key%\';\n+--------------------+----------+\n| Variable_name | Value |\n+--------------------+----------+\n| Key_blocks_used | 14955 |\n| Key_read_requests | 96854827 |\n| Key_reads | 162040 |\n| Key_write_requests | 7589728 |\n| Key_writes | 3813196 |\n+--------------------+----------+\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for\nall connections to MySQL. With SESSION, it displays the status values\nfor the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION.\n\nSome status variables have only a global value. For these, you get the\nsame value for both GLOBAL and SESSION. The scope for each status\nvariable is listed at\nhttp://dev.mysql.com/doc/refman/5.1/en/server-status-variables.html.\n\…: http://dev.mysql.com/doc/refman/5.1/en/show-status.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-status.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (134,35,'EXTRACTVALUE','Syntax:\nExtractValue(xml_frag, xpath_expr)\n\nExtractValue() takes two string arguments, a fragment of XML markup\nxml_frag and an XPath expression xpath_expr (also known as a locator);\nit returns the text (CDATA) of the first text node which is a child of\nthe element(s) matched by the XPath expression. It is the equivalent of\nperforming a match using the xpath_expr after appending /text(). In\nother words, ExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b\') and\nExtractValue(\'<a><b>Sakila</b></a>\', \'/a/b/text()\') produce the same\nresult.\n\nIf multiple matches are found, then the content of the first child text\nnode of each matching element is returned (in the order matched) as a\nsingle, space-delimited string.\n\nIf no matching text node is found for the expression (including the\nimplicit /text()) --- for whatever reason, as long as xpath_expr is\nvalid, and xml_frag consists of elements which are properly nested and\nclosed --- an empty string is returned. No distinction is made between\na match on an empty element and no match at all. This is by design.\n\nIf you need to determine whether no matching element was found in\nxml_frag or such an element was found but contained no child text\nnodes, you should test the result of an expression that uses the XPath\ncount() function. For example, both of these statements return an empty\nstring, as shown here:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'/a/b\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'/a/b\') |\n+-------------------------------------+\n| |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nHowever, you can determine whether there was actually a matching\nelement using the following:\n\nmysql> SELECT ExtractValue(\'<a><b/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><b/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 1 |\n+-------------------------------------+\n1 row in set (0.00 sec)\n\nmysql> SELECT ExtractValue(\'<a><c/></a>\', \'count(/a/b)\');\n+-------------------------------------+\n| ExtractValue(\'<a><c/></a>\', \'count(/a/b)\') |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n1 row in set (0.01 sec)\n\n*Important*: ExtractValue() returns only CDATA, and does not return any\ntags that might be contained within a matching tag, nor any of their\ncontent (see the result returned as val1 in the following example).\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html\n\n','mysql> SELECT\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a\') AS val1,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/a/b\') AS val2,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'//b\') AS val3,\n -> ExtractValue(\'<a>ccc<b>ddd</b></a>\', \'/b\') AS val4,\n -> ExtractValue(\'<a>ccc<b>ddd</b><b>eee</b></a>\', \'//b\') AS val5;\n\n+------+------+------+------+---------+\n| val1 | val2 | val3 | val4 | val5 |\n+------+------+------+------+---------+\n| ccc | ddd | ddd | | ddd eee |\n+------+------+------+------+---------+\n','http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (135,11,'OLD_PASSWORD','Syntax:\nOLD_PASSWORD(str)\n\nOLD_PASSWORD() was added to MySQL when the implementation of PASSWORD()\nwas changed to improve security. OLD_PASSWORD() returns the value of\nthe old (pre-4.1) implementation of PASSWORD() as a binary string, and\nis intended to permit you to reset passwords for any pre-4.1 clients\nthat need to connect to your version 5.1 MySQL server without locking\nthem out. See\nhttp://dev.mysql.com/doc/refman/5.1/en/password-hashing.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,22,'SET VARIABLE','Syntax:\nSET var_name = expr [, var_name = expr] ...\n\nThe SET statement in stored programs is an extended version of the\ngeneral SET statement (see [HELP SET]). Referenced variables may be\nones declared inside a stored program, global system variables, or\nuser-defined variables.\n\nThe SET statement in stored programs is implemented as part of the\npre-existing SET syntax. This allows an extended syntax of SET a=x,\nb=y, ... where different variable types (locally declared variables,\nglobal and session server variables, user-defined variables) can be\nmixed. This also allows combinations of local variables and some\noptions that make sense only for system variables; in that case, the\noptions are recognized but ignored.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-statement.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (136,22,'SET VARIABLE','Syntax:\nSET var_name = expr [, var_name = expr] ...\n\nThe SET statement in stored programs is an extended version of the\ngeneral SET statement (see [HELP SET]). Each var_name may refer to a\nlocal variable declared inside a stored program, a system variable, or\na user-defined variable.\n\nThe SET statement in stored programs is implemented as part of the\npre-existing SET syntax. This allows an extended syntax of SET a=x,\nb=y, ... where different variable types (locally declared variables,\nglobal and session system variables, user-defined variables) can be\nmixed. This also allows combinations of local variables and some\noptions that make sense only for system variables; in that case, the\noptions are recognized but ignored.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/set-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/set-statement.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,35,'FORMAT','Syntax:\nFORMAT(X,D)\n\nFormats the number X to a format like \'#,###,###.##\', rounded to D\ndecimal places, and returns the result as a string. If D is 0, the\nresult has no decimal point or fractional part.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT FORMAT(12332.123456, 4);\n -> \'12,332.1235\'\nmysql> SELECT FORMAT(12332.1,4);\n -> \'12,332.1000\'\nmysql> SELECT FORMAT(12332.2,0);\n -> \'12,332\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,13,'||','Syntax:\nOR, ||\n\nLogical OR. When both operands are non-NULL, the result is 1 if any\noperand is nonzero, and 0 otherwise. With a NULL operand, the result is\n1 if the other operand is nonzero, and NULL otherwise. If both operands\nare NULL, the result is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html\n\n','mysql> SELECT 1 || 1;\n -> 1\nmysql> SELECT 1 || 0;\n -> 1\nmysql> SELECT 0 || 0;\n -> 0\nmysql> SELECT 0 || NULL;\n -> NULL\nmysql> SELECT 1 || NULL;\n -> 1\n','http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (139,35,'BIT_LENGTH','Syntax:\nBIT_LENGTH(str)\n\nReturns the length of the string str in bits.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT BIT_LENGTH(\'text\');\n -> 32\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
@@ -233,7 +233,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (164,30,'SEC_TO_TIME','Syntax:\nSEC_TO_TIME(seconds)\n\nReturns the seconds argument, converted to hours, minutes, and seconds,\nas a TIME value. The range of the result is constrained to that of the\nTIME data type. A warning occurs if the argument corresponds to a value\noutside that range.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT SEC_TO_TIME(2378);\n -> \'00:39:38\'\nmysql> SELECT SEC_TO_TIME(2378) + 0;\n -> 3938\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (165,20,'FLOAT','FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]\n\nA small (single-precision) floating-point number. Allowable values are\n-3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to\n3.402823466E+38. These are the theoretical limits, based on the IEEE\nstandard. The actual range might be slightly smaller depending on your\nhardware or operating system.\n\nM is the total number of digits and D is the number of digits following\nthe decimal point. If M and D are omitted, values are stored to the\nlimits allowed by the hardware. A single-precision floating-point\nnumber is accurate to approximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all\ncalculations in MySQL are done with double precision. See\nhttp://dev.mysql.com/doc/refman/5.1/en/no-matching-rows.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (166,35,'LOCATE','Syntax:\nLOCATE(substr,str), LOCATE(substr,str,pos)\n\nThe first syntax returns the position of the first occurrence of\nsubstring substr in string str. The second syntax returns the position\nof the first occurrence of substring substr in string str, starting at\nposition pos. Returns 0 if substr is not in str.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT LOCATE(\'bar\', \'foobarbar\');\n -> 4\nmysql> SELECT LOCATE(\'xbar\', \'foobar\');\n -> 0\nmysql> SELECT LOCATE(\'bar\', \'foobarbar\', 5);\n -> 7\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,25,'SHOW EVENTS','Syntax:\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nIn its simplest form, SHOW EVENTS lists all of the events in the\ncurrent schema:\n\nmysql> SELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n1 row in set (0.00 sec)\n\nmysql> SHOW EVENTS\\G\n*************************** 1. row ***************************\n Db: myschema\n Name: e_daily\n Definer: jon@ghidora\n Time zone: SYSTEM\n Type: RECURRING\n Execute at: NULL\n Interval value: 10\n Interval field: SECOND\n Starts: 2006-02-09 10:41:23\n Ends: 0000-00-00 00:00:00\n Status: ENABLED\n Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nThe LIKE clause, if present, indicates which event names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-events.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-events.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (167,25,'SHOW EVENTS','Syntax:\nSHOW EVENTS [{FROM | IN} schema_name]\n [LIKE \'pattern\' | WHERE expr]\n\nIn its simplest form, SHOW EVENTS lists all of the events in the\ncurrent schema:\n\nmysql> SELECT CURRENT_USER(), SCHEMA();\n+----------------+----------+\n| CURRENT_USER() | SCHEMA() |\n+----------------+----------+\n| jon@ghidora | myschema |\n+----------------+----------+\n1 row in set (0.00 sec)\n\nmysql> SHOW EVENTS\\G\n*************************** 1. row ***************************\n Db: myschema\n Name: e_daily\n Definer: jon@ghidora\n Time zone: SYSTEM\n Type: RECURRING\n Execute at: NULL\n Interval value: 10\n Interval field: SECOND\n Starts: 2006-02-09 10:41:23\n Ends: NULL\n Status: ENABLED\n Originator: 0\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n\nTo see events for a specific schema, use the FROM clause. For example,\nto see events for the test schema, use the following statement:\n\nSHOW EVENTS FROM test;\n\nThe LIKE clause, if present, indicates which event names to match. The\nWHERE clause can be given to select rows using more general conditions,\nas discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-events.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-events.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (168,15,'CHARSET','Syntax:\nCHARSET(str)\n\nReturns the character set of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT CHARSET(\'abc\');\n -> \'latin1\'\nmysql> SELECT CHARSET(CONVERT(\'abc\' USING utf8));\n -> \'utf8\'\nmysql> SELECT CHARSET(USER());\n -> \'utf8\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (169,30,'SUBDATE','Syntax:\nSUBDATE(date,INTERVAL expr unit), SUBDATE(expr,days)\n\nWhen invoked with the INTERVAL form of the second argument, SUBDATE()\nis a synonym for DATE_SUB(). For information on the INTERVAL unit\nargument, see the discussion for DATE_ADD().\n\nmysql> SELECT DATE_SUB(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\nmysql> SELECT SUBDATE(\'2008-01-02\', INTERVAL 31 DAY);\n -> \'2007-12-02\'\n\nThe second form allows the use of an integer value for days. In such\ncases, it is interpreted as the number of days to be subtracted from\nthe date or datetime expression expr.\n\nmysql> SELECT SUBDATE(\'2008-01-02 12:00:00\', 31);\n -> \'2007-12-02 12:00:00\'\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (170,30,'DAYOFYEAR','Syntax:\nDAYOFYEAR(date)\n\nReturns the day of the year for date, in the range 1 to 366.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DAYOFYEAR(\'2007-02-03\');\n -> 34\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
@@ -250,7 +250,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (181,24,'NUMGEOMETRIES','NumGeometries(gc)\n\nReturns the number of geometries in the GeometryCollection value gc.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#geo…','mysql> SET @gc = \'GeometryCollection(Point(1 1),LineString(2 2, 3 3))\';\nmysql> SELECT NumGeometries(GeomFromText(@gc));\n+----------------------------------+\n| NumGeometries(GeomFromText(@gc)) |\n+----------------------------------+\n| 2 |\n+----------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#geo…');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (182,30,'MONTHNAME','Syntax:\nMONTHNAME(date)\n\nReturns the full name of the month for date. As of MySQL 5.1.12, the\nlanguage used for the name is controlled by the value of the\nlc_time_names system variable\n(http://dev.mysql.com/doc/refman/5.1/en/locale-support.html).\n\n…: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MONTHNAME(\'2008-02-03\');\n -> \'February\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (183,36,'PROCEDURE ANALYSE','Syntax:\nANALYSE([max_elements[,max_memory]])\n\nANALYSE() is defined in the sql/sql_analyse.cc source file, which\nserves as an example of how to create a procedure for use with the\nPROCEDURE clause of SELECT statements. ANALYSE() is built in and is\navailable by default; other procedures can be created using the format\ndemonstrated in the source file.\n\nANALYSE() examines the result from a query and returns an analysis of\nthe results that suggests optimal data types for each column that may\nhelp reduce table sizes. To obtain this analysis, append PROCEDURE\nANALYSE to the end of a SELECT statement:\n\nSELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])\n\nFor example:\n\nSELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);\n\nThe results show some statistics for the values returned by the query,\nand propose an optimal data type for the columns. This can be helpful\nfor checking your existing tables, or after importing new data. You may\nneed to try different settings for the arguments so that PROCEDURE\nANALYSE() does not suggest the ENUM data type when it is not\nappropriate.\n\nThe arguments are optional and are used as follows:\n\no max_elements (default 256) is the maximum number of distinct values\n that ANALYSE() notices per column. This is used by ANALYSE() to check\n whether the optimal data type should be of type ENUM; if there are\n more than max_elements distinct values, then ENUM is not a suggested\n type.\n\no max_memory (default 8192) is the maximum amount of memory that\n ANALYSE() should allocate per column while trying to find all\n distinct values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/procedure-analyse.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/procedure-analyse.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,25,'CHANGE MASTER TO','Syntax:\nCHANGE MASTER TO master_def [, master_def] ...\n\nmaster_def:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n\nCHANGE MASTER TO changes the parameters that the slave server uses for\nconnecting to and communicating with the master server. It also updates\nthe contents of the master.info and relay-log.info files.\n\nMASTER_USER, MASTER_PASSWORD, MASTER_SSL, MASTER_SSL_CA,\nMASTER_SSL_CAPATH, MASTER_SSL_CERT, MASTER_SSL_KEY, MASTER_SSL_CIPHER,\nand MASTER_SSL_VERIFY_SERVER_CERT provide information to the slave\nabout how to connect to its master. MASTER_SSL_VERIFY_SERVER_CERT was\nadded in MySQL 5.1.18. It is used as described for the\n--ssl-verify-server-cert option in\nhttp://dev.mysql.com/doc/refman/5.1/en/ssl-options.html.\n\nMASTER_CONN… specifies how many seconds to wait between connect\nretries. The default is 60. The number of reconnection attempts is\nlimited by the --master-retry-count server option; for more\ninformation, see\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-options.html.\n\nThe SSL options (MASTER_SSL, MASTER_SSL_CA, MASTER_SSL_CAPATH,\nMASTER_SSL_CERT, MASTER_SSL_KEY, MASTER_SSL_CIPHER), and\nMASTER_SSL_VERIFY_SERVER_CERT can be changed even on slaves that are\ncompiled without SSL support. They are saved to the master.info file,\nbut are ignored unless you use a server that has SSL support enabled.\n\nIf you don\'t specify a given parameter, it keeps its old value, except\nas indicated in the following discussion. For example, if the password\nto connect to your MySQL master has changed, you just need to issue\nthese statements to tell the slave about the new password:\n\nSTOP SLAVE; -- if replication was running\nCHANGE MASTER TO MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE; -- if you want to restart replication\n\nThere is no need to specify the parameters that do not change (host,\nport, user, and so forth).\n\nMASTER_HOST and MASTER_PORT are the host name (or IP address) of the\nmaster host and its TCP/IP port.\n\nThe next two options are available only in MySQL Cluster NDB 6.3 and\n6.4; they are not supported in mainline MySQL 5.1:\n\no MASTER_BIND is for use on replication slaves having multiple network\n interfaces, and determines which of the slave\'s network interfaces is\n chosen for connecting to the master. It is also possible to determine\n which network interface is to be used in such cases by starting the\n slave mysqld process with the --master-bind option.\n\n The ability to bind a replication slave to specific network interface\n was added in MySQL Cluster NDB 6.3.4.\n\no MASTER_HEARTBEAT_PERIOD is used to set the interval in seconds\n between replication heartbeats. Whenever the master\'s binlog is\n updated with an event, the waiting period for the next heartbeat is\n reset. interval is a decimal value having the range 0 to 4294967\n seconds and a resolution to hundredths of a second; the smallest\n nonzero value is 0.001. Heartbeats are sent by the master only if\n there are no unsent events in the binlog file for a period longer\n than interval.\n\n Setting interval to 0 disables heartbeats altogether. The default\n value for interval is equal to the value of slave_net_timeout divided\n by 2.\n\n *Note*: Setting @@global.slave_net_timeout to a value less than that\n of the current heartbeat interval results in a warning being issued.\n\n Issuing RESET SLAVE resets the heartbeat interval to the default.\n\n MASTER_HEARTBEAT_PERIOD was added in MySQL Cluster NDB 6.3.4.\n\n*Note*: Replication cannot use Unix socket files. You must be able to\nconnect to the master MySQL server using TCP/IP.\n\nIf you specify MASTER_HOST or MASTER_PORT, the slave assumes that the\nmaster server is different from before (even if you specify a host or\nport value that is the same as the current value.) In this case, the\nold values for the master binary log name and position are considered\nno longer applicable, so if you do not specify MASTER_LOG_FILE and\nMASTER_LOG_POS in the statement, MASTER_LOG_FILE=\'\' and\nMASTER_LOG_POS=4 are silently appended to it.\n\nSetting MASTER_HOST=\'\' --- that is, setting its value explicitly to an\nempty string --- is not the same as not setting it at all. Setting this\noption to an empty string causes START SLAVE subsequently to fail. This\nissue is addressed in MySQL 6.0. (Bug#28796\n(http://bugs.mysql.com/28796))\n\nMASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the\nslave I/O thread should begin reading from the master the next time the\nthread starts. If you specify either of them, you cannot specify\nRELAY_LOG_FILE or RELAY_LOG_POS. If neither of MASTER_LOG_FILE or\nMASTER_LOG_POS are specified, the slave uses the last coordinates of\nthe slave SQL thread before CHANGE MASTER TO was issued. This ensures\nthat there is no discontinuity in replication, even if the slave SQL\nthread was late compared to the slave I/O thread, when you merely want\nto change, say, the password to use.\n\nCHANGE MASTER TO deletes all relay log files and starts a new one,\nunless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay\nlogs are kept; the relay_log_purge global variable is set silently to\n0.\n\nCHANGE MASTER TO is useful for setting up a slave when you have the\nsnapshot of the master and have recorded the log and the offset\ncorresponding to it. After loading the snapshot into the slave, you can\nrun CHANGE MASTER TO MASTER_LOG_FILE=\'log_name_on_master\',\nMASTER_LOG_POS=log_offset_on_master on the slave.\n\nThe following example changes the master and master\'s binary log\ncoordinates. This is used when you want to set up the slave to\nreplicate the master:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\n\nThe next example shows an operation that is less frequently employed.\nIt is used when the slave has relay logs that you want it to execute\nagain for some reason. To do this, the master need not be reachable.\nYou need only use CHANGE MASTER TO and start the SQL thread (START\nSLAVE SQL_THREAD):\n\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (184,25,'CHANGE MASTER TO','Syntax:\nCHANGE MASTER TO master_def [, master_def] ...\n\nmaster_def:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n\nCHANGE MASTER TO changes the parameters that the slave server uses for\nconnecting to and communicating with the master server. It also updates\nthe contents of the master.info and relay-log.info files.\n\nMASTER_USER, MASTER_PASSWORD, MASTER_SSL, MASTER_SSL_CA,\nMASTER_SSL_CAPATH, MASTER_SSL_CERT, MASTER_SSL_KEY, MASTER_SSL_CIPHER,\nand MASTER_SSL_VERIFY_SERVER_CERT provide information to the slave\nabout how to connect to its master. MASTER_SSL_VERIFY_SERVER_CERT was\nadded in MySQL 5.1.18. It is used as described for the\n--ssl-verify-server-cert option in\nhttp://dev.mysql.com/doc/refman/5.1/en/ssl-options.html.\n\nMASTER_CONN… specifies how many seconds to wait between connect\nretries. The default is 60. The number of reconnection attempts is\nlimited by the --master-retry-count server option; for more\ninformation, see\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-options.html.\n\nThe SSL options (MASTER_SSL, MASTER_SSL_CA, MASTER_SSL_CAPATH,\nMASTER_SSL_CERT, MASTER_SSL_KEY, MASTER_SSL_CIPHER), and\nMASTER_SSL_VERIFY_SERVER_CERT can be changed even on slaves that are\ncompiled without SSL support. They are saved to the master.info file,\nbut are ignored unless you use a server that has SSL support enabled.\n\nIf you do not specify a given parameter, it keeps its old value, except\nas indicated in the following discussion. For example, if the password\nto connect to your MySQL master has changed, you just need to issue\nthese statements to tell the slave about the new password:\n\nSTOP SLAVE; -- if replication was running\nCHANGE MASTER TO MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE; -- if you want to restart replication\n\nThere is no need to specify the parameters that do not change (host,\nport, user, and so forth).\n\nMASTER_HOST and MASTER_PORT are the host name (or IP address) of the\nmaster host and its TCP/IP port.\n\nThe next two options (MASTER_BIND and MASTER_HEARTBEAT_PERIOD) are\navailable in MySQL Cluster NDB 6.3 and later, but are not supported in\nmainline MySQL 5.1:\n\no MASTER_BIND is for use on replication slaves having multiple network\n interfaces, and determines which of the slave\'s network interfaces is\n chosen for connecting to the master. It is also possible to determine\n which network interface is to be used in such cases by starting the\n slave mysqld process with the --master-bind option.\n\n The ability to bind a replication slave to specific network interface\n was added in MySQL Cluster NDB 6.3.4.\n\no MASTER_HEARTBEAT_PERIOD is used to set the interval in seconds\n between replication heartbeats. Whenever the master\'s binlog is\n updated with an event, the waiting period for the next heartbeat is\n reset. interval is a decimal value having the range 0 to 4294967\n seconds and a resolution to hundredths of a second; the smallest\n nonzero value is 0.001. Heartbeats are sent by the master only if\n there are no unsent events in the binlog file for a period longer\n than interval.\n\n Setting interval to 0 disables heartbeats altogether. The default\n value for interval is equal to the value of slave_net_timeout divided\n by 2.\n\n Setting @@global.slave_net_timeout to a value less than that of the\n current heartbeat interval results in a warning being issued. The\n effect of issuing RESET SLAVE on the heartbeat interval is to reset\n it to the default value.\n\n MASTER_HEARTBEAT_PERIOD was added in MySQL Cluster NDB 6.3.4.\n\n*Note*: Replication cannot use Unix socket files. You must be able to\nconnect to the master MySQL server using TCP/IP.\n\nIf you specify MASTER_HOST or MASTER_PORT, the slave assumes that the\nmaster server is different from before (even if you specify a host or\nport value that is the same as the current value.) In this case, the\nold values for the master binary log name and position are considered\nno longer applicable, so if you do not specify MASTER_LOG_FILE and\nMASTER_LOG_POS in the statement, MASTER_LOG_FILE=\'\' and\nMASTER_LOG_POS=4 are silently appended to it.\n\nSetting MASTER_HOST=\'\' --- that is, setting its value explicitly to an\nempty string --- is not the same as not setting it at all. Setting this\noption to an empty string causes START SLAVE subsequently to fail. This\nissue is addressed in MySQL 5.5. (Bug#28796\n(http://bugs.mysql.com/28796))\n\nMASTER_LOG_FILE and MASTER_LOG_POS are the coordinates at which the\nslave I/O thread should begin reading from the master the next time the\nthread starts. If you specify either of them, you cannot specify\nRELAY_LOG_FILE or RELAY_LOG_POS. If neither of MASTER_LOG_FILE or\nMASTER_LOG_POS are specified, the slave uses the last coordinates of\nthe slave SQL thread before CHANGE MASTER TO was issued. This ensures\nthat there is no discontinuity in replication, even if the slave SQL\nthread was late compared to the slave I/O thread, when you merely want\nto change, say, the password to use.\n\nCHANGE MASTER TO deletes all relay log files and starts a new one,\nunless you specify RELAY_LOG_FILE or RELAY_LOG_POS. In that case, relay\nlogs are kept; the relay_log_purge global variable is set silently to\n0.\n\nCHANGE MASTER TO is useful for setting up a slave when you have the\nsnapshot of the master and have recorded the log and the offset\ncorresponding to it. After loading the snapshot into the slave, you can\nrun CHANGE MASTER TO MASTER_LOG_FILE=\'log_name_on_master\',\nMASTER_LOG_POS=log_offset_on_master on the slave.\n\nThe following example changes the master and master\'s binary log\ncoordinates. This is used when you want to set up the slave to\nreplicate the master:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\n\nThe next example shows an operation that is less frequently employed.\nIt is used when the slave has relay logs that you want it to execute\nagain for some reason. To do this, the master need not be reachable.\nYou need only use CHANGE MASTER TO and start the SQL thread (START\nSLAVE SQL_THREAD):\n\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (185,37,'DROP DATABASE','Syntax:\nDROP {DATABASE | SCHEMA} [IF EXISTS] db_name\n\nDROP DATABASE drops all tables in the database and deletes the\ndatabase. Be very careful with this statement! To use DROP DATABASE,\nyou need the DROP privilege on the database. DROP SCHEMA is a synonym\nfor DROP DATABASE.\n\n*Important*: When a database is dropped, user privileges on the\ndatabase are not automatically dropped. See [HELP GRANT].\n\nIF EXISTS is used to prevent an error from occurring if the database\ndoes not exist.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/drop-database.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/drop-database.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (186,6,'MBREQUAL','MBREqual(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangles of\nthe two geometries g1 and g2 are the same.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (187,30,'TIMESTAMP FUNCTION','Syntax:\nTIMESTAMP(expr), TIMESTAMP(expr1,expr2)\n\nWith a single argument, this function returns the date or datetime\nexpression expr as a datetime value. With two arguments, it adds the\ntime expression expr2 to the date or datetime expression expr1 and\nreturns the result as a datetime value.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMP(\'2003-12-31\');\n -> \'2003-12-31 00:00:00\'\nmysql> SELECT TIMESTAMP(\'2003-12-31 12:00:00\',\'12:00:00\');\n -> \'2004-01-01 00:00:00\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
@@ -322,7 +322,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (253,20,'VARCHAR','[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA variable-length string. M represents the maximum column length in\ncharacters. The range of M is 0 to 65,535. The effective maximum length\nof a VARCHAR is subject to the maximum row size (65,535 bytes, which is\nshared among all columns) and the character set used. For example, utf8\ncharacters can require up to three bytes per character, so a VARCHAR\ncolumn that uses the utf8 character set can be declared to be a maximum\nof 21,844 characters.\n\nMySQL stores VARCHAR values as a one-byte or two-byte length prefix\nplus data. The length prefix indicates the number of bytes in the\nvalue. A VARCHAR column uses one length byte if values require no more\nthan 255 bytes, two length bytes if values may require more than 255\nbytes.\n\n*Note*: MySQL 5.1 follows the standard SQL specification, and does not\nremove trailing spaces from VARCHAR values.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the\nstandard SQL way to define that a VARCHAR column should use some\npredefined character set. MySQL 4.1 and up uses utf8 as this predefined\ncharacter set.\nhttp://dev.mysql.com/doc/refman/5.1/en/charset-national.html. NVARCHAR\nis shorthand for NATIONAL VARCHAR.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (254,35,'UNHEX','Syntax:\n\nUNHEX(str)\n\nPerforms the inverse operation of HEX(str). That is, it interprets each\npair of hexadecimal digits in the argument as a number and converts it\nto the character represented by the number. The resulting characters\nare returned as a binary string.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT UNHEX(\'4D7953514C\');\n -> \'MySQL\'\nmysql> SELECT 0x4D7953514C;\n -> \'MySQL\'\nmysql> SELECT UNHEX(HEX(\'string\'));\n -> \'string\'\nmysql> SELECT HEX(UNHEX(\'1267\'));\n -> \'1267\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (255,4,'- UNARY','Syntax:\n-\n\nUnary minus. This operator changes the sign of the argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html\n\n','mysql> SELECT - 2;\n -> -2\n','http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,22,'SELECT INTO','Syntax:\nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n\nSELECT ... INTO syntax enables selected columns to be stored directly\ninto variables. The query should return a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No data), and\nthe variable values remain unchanged. If the query returns multiple\nrows, error 1172 occurs (Result consisted of more than one row). If it\nis possible that the statement may retrieve multiple rows, you can use\nLIMIT 1 to limit the result set to a single row.\n\nIn the context of such statements that occur as part of events executed\nby the Event Scheduler, diagnostics messages (not only errors, but also\nwarnings) are written to the error log, and, on Windows, to the\napplication event log. For additional information, see\nhttp://dev.mysql.com/doc/refman/5.1/en/events-status-info.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html\n\n','SELECT id,data INTO x,y FROM test.t1 LIMIT 1;\n','http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (256,22,'SELECT INTO','Syntax:\nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n\nSELECT ... INTO syntax enables selected columns to be stored directly\ninto variables. The query should return a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No data), and\nthe variable values remain unchanged. If the query returns multiple\nrows, error 1172 occurs (Result consisted of more than one row). If it\nis possible that the statement may retrieve multiple rows, you can use\nLIMIT 1 to limit the result set to a single row.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html\n\n','SELECT id,data INTO x,y FROM test.t1 LIMIT 1;\n','http://dev.mysql.com/doc/refman/5.1/en/select-into-statement.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (257,16,'STD','Syntax:\nSTD(expr)\n\nReturns the population standard deviation of expr. This is an extension\nto standard SQL. The standard SQL function STDDEV_POP() can be used\ninstead.\n\nThis function returns NULL if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (258,4,'COS','Syntax:\nCOS(X)\n\nReturns the cosine of X, where X is given in radians.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT COS(PI());\n -> -1\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (259,30,'DATE FUNCTION','Syntax:\nDATE(expr)\n\nExtracts the date part of the date or datetime expression expr.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT DATE(\'2003-12-31 01:02:03\');\n -> \'2003-12-31\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
@@ -384,7 +384,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (315,15,'FOUND_ROWS','Syntax:\nFOUND_ROWS()\n\nA SELECT statement may include a LIMIT clause to restrict the number of\nrows the server returns to the client. In some cases, it is desirable\nto know how many rows the statement would have returned without the\nLIMIT, but without running the statement again. To obtain this row\ncount, include a SQL_CALC_FOUND_ROWS option in the SELECT statement,\nand then invoke FOUND_ROWS() afterward:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name\n -> WHERE id > 100 LIMIT 10;\nmysql> SELECT FOUND_ROWS();\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (316,15,'SYSTEM_USER','Syntax:\nSYSTEM_USER()\n\nSYSTEM_USER() is a synonym for USER().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (317,29,'CROSSES','Crosses(g1,g2)\n\nReturns 1 if g1 spatially crosses g2. Returns NULL if g1 is a Polygon\nor a MultiPolygon, or if g2 is a Point or a MultiPoint. Otherwise,\nreturns 0.\n\nThe term spatially crosses denotes a spatial relation between two given\ngeometries that has the following properties:\n\no The two geometries intersect\n\no Their intersection results in a geometry that has a dimension that is\n one less than the maximum dimension of the two given geometries\n\no Their intersection is not equal to either of the two given geometries\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relation…','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relation…');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,26,'TRUNCATE TABLE','Syntax:\nTRUNCATE [TABLE] tbl_name\n\nTRUNCATE TABLE empties a table completely. Logically, this is\nequivalent to a DELETE statement that deletes all rows, but there are\npractical differences under some circumstances.\n\nFor an InnoDB table, InnoDB processes TRUNCATE TABLE by deleting rows\none by one if there are any FOREIGN KEY constraints that reference the\ntable. If there are no FOREIGN KEY constraints, InnoDB performs fast\ntruncation by dropping the original table and creating an empty one\nwith the same definition, which is much faster than deleting rows one\nby one. The AUTO_INCREMENT counter is reset by TRUNCATE TABLE,\nregardless of whether there is a FOREIGN KEY constraint.\n\nIn the case that FOREIGN KEY constraints reference the table, InnoDB\ndeletes rows one by one and processes the constraints on each one. If\nthe FOREIGN KEY constraint specifies DELETE CASCADE, rows from the\nchild (referenced) table are deleted, and the truncated table becomes\nempty. If the FOREIGN KEY constraint does not specify CASCADE, the\nTRUNCATE statement deletes rows one by one and stops if it encounters a\nparent row that is referenced by the child, returning this error:\n\nERROR 1451 (23000): Cannot delete or update a parent row: a foreign\nkey constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1`\nFOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))\n\nThis is the same as a DELETE statement with no WHERE clause.\n\nBeginning with MySQL 5.1.32, TRUNCATE is treated for purposes of binary\nlogging and replication as DROP TABLE followed by CREATE TABLE --- that\nis, as DDL rather than DML. This is due to the fact that, when using\nInnoDB and other transactional storage engines where the transaction\nisolation level does not allow for statement-based logging (READ\nCOMMITTED or READ UNCOMMITTED), the statement was not logged and\nreplicated when using STATEMENT or MIXED logging mode. (Bug#36763\n(http://bugs.mysql.com/36763)) However, it is still applied on\nreplication slaves using InnoDB in the manner described previously.\n\nThe count of rows affected by TRUNCATE TABLE is accurate only when it\nis mapped to a DELETE statement.\n\nFor other storage engines, TRUNCATE TABLE differs from DELETE in the\nfollowing ways in MySQL 5.1:\n\no Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n\no Truncate operations cause an implicit commit.\n\no Truncation operations cannot be performed if the session holds an\n active table lock.\n\no Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is "0 rows affected," which should\n be interpreted as "no information."\n\no As long as the table format file tbl_name.frm is valid, the table can\n be re-created as an empty table with TRUNCATE TABLE, even if the data\n or index files have become corrupted.\n\no The table handler does not remember the last used AUTO_INCREMENT\n value, but starts counting from the beginning. This is true even for\n MyISAM and InnoDB, which normally do not reuse sequence values.\n\no When used with partitioned tables, TRUNCATE TABLE preserves the\n partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n\no Since truncation of a table does not make any use of DELETE, the\n TRUNCATE statement does not invoke ON DELETE triggers.\n\nTRUNCATE TABLE requires the DROP privilege as of MySQL 5.1.16. (Before\n5.1.16, it requires the DELETE privilege.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/truncate.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/truncate.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (318,26,'TRUNCATE TABLE','Syntax:\nTRUNCATE [TABLE] tbl_name\n\nTRUNCATE TABLE empties a table completely. It requires the DROP\nprivilege as of MySQL 5.1.16. (Before 5.1.16, it requires the DELETE\nprivilege.\n\nLogically, TRUNCATE TABLE is equivalent to a DELETE statement that\ndeletes all rows, but there are practical differences under some\ncircumstances.\n\nFor an InnoDB table, InnoDB processes TRUNCATE TABLE by deleting rows\none by one if there are any FOREIGN KEY constraints that reference the\ntable. If there are no FOREIGN KEY constraints, InnoDB performs fast\ntruncation by dropping the original table and creating an empty one\nwith the same definition, which is much faster than deleting rows one\nby one. The AUTO_INCREMENT counter is reset by TRUNCATE TABLE,\nregardless of whether there is a FOREIGN KEY constraint.\n\nIn the case that FOREIGN KEY constraints reference the table, InnoDB\ndeletes rows one by one and processes the constraints on each one. If\nthe FOREIGN KEY constraint specifies DELETE CASCADE, rows from the\nchild (referenced) table are deleted, and the truncated table becomes\nempty. If the FOREIGN KEY constraint does not specify CASCADE, the\nTRUNCATE statement deletes rows one by one and stops if it encounters a\nparent row that is referenced by the child, returning this error:\n\nERROR 1451 (23000): Cannot delete or update a parent row: a foreign\nkey constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1`\nFOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))\n\nThis is the same as a DELETE statement with no WHERE clause.\n\nThe count of rows affected by TRUNCATE TABLE is accurate only when it\nis mapped to a DELETE statement.\n\nFor other storage engines, TRUNCATE TABLE differs from DELETE in the\nfollowing ways in MySQL 5.1:\n\no Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n\no Truncate operations cause an implicit commit.\n\no Truncation operations cannot be performed if the session holds an\n active table lock.\n\no Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is "0 rows affected," which should\n be interpreted as "no information."\n\no As long as the table format file tbl_name.frm is valid, the table can\n be re-created as an empty table with TRUNCATE TABLE, even if the data\n or index files have become corrupted.\n\no The table handler does not remember the last used AUTO_INCREMENT\n value, but starts counting from the beginning. This is true even for\n MyISAM and InnoDB, which normally do not reuse sequence values.\n\no When used with partitioned tables, TRUNCATE TABLE preserves the\n partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n\no Since truncation of a table does not make any use of DELETE, the\n TRUNCATE statement does not invoke ON DELETE triggers.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/truncate.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/truncate.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (319,16,'BIT_XOR','Syntax:\nBIT_XOR(expr)\n\nReturns the bitwise XOR of all bits in expr. The calculation is\nperformed with 64-bit (BIGINT) precision.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (320,30,'CURRENT_DATE','Syntax:\nCURRENT_DATE, CURRENT_DATE()\n\nCURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (321,25,'START SLAVE','Syntax:\nSTART SLAVE [thread_type [, thread_type] ... ]\nSTART SLAVE [SQL_THREAD] UNTIL\n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos\nSTART SLAVE [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos\n\nthread_type: IO_THREAD | SQL_THREAD\n\nSTART SLAVE with no thread_type options starts both of the slave\nthreads. The I/O thread reads queries from the master server and stores\nthem in the relay log. The SQL thread reads the relay log and executes\nthe queries. START SLAVE requires the SUPER privilege.\n\nIf START SLAVE succeeds in starting the slave threads, it returns\nwithout any error. However, even in that case, it might be that the\nslave threads start and then later stop (for example, because they do\nnot manage to connect to the master or read its binary logs, or some\nother problem). START SLAVE does not warn you about this. You must\ncheck the slave\'s error log for error messages generated by the slave\nthreads, or check that they are running satisfactorily with SHOW SLAVE\nSTATUS.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/start-slave.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/start-slave.html');
@@ -410,7 +410,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,22,'LOOP','Syntax:\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nLOOP implements a simple loop construct, enabling repeated execution of\nthe statement list, which consists of one or more statements, each\nterminated by a semicolon (;) statement delimiter. The statements\nwithin the loop are repeated until the loop is exited; usually this is\naccomplished with a LEAVE statement.\n\nA LOOP statement can be labeled. end_label cannot be given unless\nbegin_label also is present. If both are present, they must be the\nsame.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/loop-statement.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/loop-statement.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,4,'TRUNCATE','Syntax:\nTRUNCATE(X,D)\n\nReturns the number X, truncated to D decimal places. If D is 0, the\nresult has no decimal point or fractional part. D can be negative to\ncause D digits left of the decimal point of the value X to become zero.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT TRUNCATE(1.223,1);\n -> 1.2\nmysql> SELECT TRUNCATE(1.999,1);\n -> 1.9\nmysql> SELECT TRUNCATE(1.999,0);\n -> 1\nmysql> SELECT TRUNCATE(-1.999,1);\n -> -1.9\nmysql> SELECT TRUNCATE(122,-2);\n -> 100\nmysql> SELECT TRUNCATE(10.28*100,0);\n -> 1028\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,30,'TIMESTAMPADD','Syntax:\nTIMESTAMPADD(unit,interval,datetime_expr)\n\nAdds the integer expression interval to the date or datetime expression\ndatetime_expr. The unit for interval is given by the unit argument,\nwhich should be one of the following values: FRAC_SECOND\n(microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or\nYEAR.\n\nBeginning with MySQL 5.1.24, it is possible to use MICROSECOND in place\nof FRAC_SECOND with this function, and FRAC_SECOND is deprecated.\n\nThe unit value may be specified using one of keywords as shown, or with\na prefix of SQL_TSI_. For example, DAY and SQL_TSI_DAY both are legal.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT TIMESTAMPADD(MINUTE,1,\'2003-01-02\');\n -> \'2003-01-02 00:01:00\'\nmysql> SELECT TIMESTAMPADD(WEEK,1,\'2003-01-02\');\n -> \'2003-01-09\'\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,25,'SHOW','SHOW has many forms that provide information about databases, tables,\ncolumns, or status information about the server. This section describes\nthose following:\n\nSHOW AUTHORS\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE FUNCTION func_name\nSHOW CREATE PROCEDURE proc_name\nSHOW CREATE TABLE tbl_name\nSHOW CREATE TRIGGER trigger_name\nSHOW CREATE VIEW view_name\nSHOW DATABASES [like_or_where]\nSHOW ENGINE engine_name {STATUS | MUTEX}\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW [FULL] EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW INNODB STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW SCHEDULER STATUS\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW TABLES [FROM db_name] [like_or_where]\nSHOW TRIGGERS [FROM db_name] [like_or_where]\nSHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\nSHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\'\npart, \'pattern\' is a string that can contain the SQL "%" and "_"\nwildcard characters. The pattern is useful for restricting statement\noutput to matching values.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,25,'SHOW','SHOW has many forms that provide information about databases, tables,\ncolumns, or status information about the server. This section describes\nthose following:\n\nSHOW AUTHORS\nSHOW CHARACTER SET [like_or_where]\nSHOW COLLATION [like_or_where]\nSHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]\nSHOW CONTRIBUTORS\nSHOW CREATE DATABASE db_name\nSHOW CREATE EVENT event_name\nSHOW CREATE FUNCTION func_name\nSHOW CREATE PROCEDURE proc_name\nSHOW CREATE TABLE tbl_name\nSHOW CREATE TRIGGER trigger_name\nSHOW CREATE VIEW view_name\nSHOW DATABASES [like_or_where]\nSHOW ENGINE engine_name {STATUS | MUTEX}\nSHOW [STORAGE] ENGINES\nSHOW ERRORS [LIMIT [offset,] row_count]\nSHOW EVENTS\nSHOW FUNCTION CODE func_name\nSHOW FUNCTION STATUS [like_or_where]\nSHOW GRANTS FOR user\nSHOW INDEX FROM tbl_name [FROM db_name]\nSHOW INNODB STATUS\nSHOW OPEN TABLES [FROM db_name] [like_or_where]\nSHOW PLUGINS\nSHOW PROCEDURE CODE proc_name\nSHOW PROCEDURE STATUS [like_or_where]\nSHOW PRIVILEGES\nSHOW [FULL] PROCESSLIST\nSHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]\nSHOW PROFILES\nSHOW SCHEDULER STATUS\nSHOW [GLOBAL | SESSION] STATUS [like_or_where]\nSHOW TABLE STATUS [FROM db_name] [like_or_where]\nSHOW TABLES [FROM db_name] [like_or_where]\nSHOW TRIGGERS [FROM db_name] [like_or_where]\nSHOW [GLOBAL | SESSION] VARIABLES [like_or_where]\nSHOW WARNINGS [LIMIT [offset,] row_count]\n\nlike_or_where:\n LIKE \'pattern\'\n | WHERE expr\n\nIf the syntax for a given SHOW statement includes a LIKE \'pattern\'\npart, \'pattern\' is a string that can contain the SQL "%" and "_"\nwildcard characters. The pattern is useful for restricting statement\noutput to matching values.\n\nSeveral SHOW statements also accept a WHERE clause that provides more\nflexibility in specifying which rows to display. See\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,17,'GREATEST','Syntax:\nGREATEST(value1,value2,...)\n\nWith two or more arguments, returns the largest (maximum-valued)\nargument. The arguments are compared using the same rules as for\nLEAST().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT GREATEST(2,0);\n -> 2\nmysql> SELECT GREATEST(34.0,3.0,5.0,767.0);\n -> 767.0\nmysql> SELECT GREATEST(\'B\',\'A\',\'C\');\n -> \'C\'\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,25,'SHOW VARIABLES','Syntax:\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nSHOW VARIABLES shows the values of MySQL system variables. This\ninformation also can be obtained using the mysqladmin variables\ncommand. The LIKE clause, if present, indicates which variable names to\nmatch. The WHERE clause can be given to select rows using more general\nconditions, as discussed in\nhttp://dev.mysql.com/doc/refman/5.1/en/extended-show.html. This\nstatement does not require any privilege. It requires only the ability\nto connect to the server.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are\nused for new connections to MySQL. With SESSION, it displays the values\nthat are in effect for the current connection. If no modifier is\npresent, the default is SESSION. LOCAL is a synonym for SESSION.\nWith a LIKE clause, the statement displays only rows for those\nvariables with names that match the pattern. To obtain the row for a\nspecific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'max_join_size\';\nSHOW SESSION VARIABLES LIKE \'max_join_size\';\n\nTo get a list of variables whose name match a pattern, use the "%"\nwildcard character in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%size%\';\nSHOW GLOBAL VARIABLES LIKE \'%size%\';\n\nWildcard characters can be used in any position within the pattern to\nbe matched. Strictly speaking, because "_" is a wildcard that matches\nany single character, you should escape it as "\\_" to match it\nliterally. In practice, this is rarely necessary.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-variables.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-variables.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,25,'BINLOG','Syntax:\nBINLOG \'str\'\n\nBINLOG is an internal-use statement. It is generated by the mysqlbinlog\nprogram as the printable representation of certain events in binary log\nfiles. (See http://dev.mysql.com/doc/refman/5.1/en/mysqlbinlog.html.)\nThe \'str\' value is a base 64-encoded string the that server decodes to\ndetermine the data change indicated by the corresponding event. This\nstatement requires the SUPER privilege. It was added in MySQL 5.1.5.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/binlog.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/binlog.html');
@@ -419,7 +419,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,4,'ATAN2','Syntax:\nATAN(Y,X), ATAN2(Y,X)\n\nReturns the arc tangent of the two variables X and Y. It is similar to\ncalculating the arc tangent of Y / X, except that the signs of both\narguments are used to determine the quadrant of the result.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT ATAN(-2,2);\n -> -0.78539816339745\nmysql> SELECT ATAN2(PI(),0);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,6,'MBRCONTAINS','MBRContains(g1,g2)\n\nReturns 1 or 0 to indicate whether the Minimum Bounding Rectangle of g1\ncontains the Minimum Bounding Rectangle of g2. This tests the opposite\nrelationship as MBRWithin().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html\n\n','mysql> SET @g1 = GeomFromText(\'Polygon((0 0,0 3,3 3,3 0,0 0))\');\nmysql> SET @g2 = GeomFromText(\'Point(1 1)\');\nmysql> SELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);\n----------------------+----------------------+\n| MBRContains(@g1,@g2) | MBRContains(@g2,@g1) |\n+----------------------+----------------------+\n| 1 | 0 |\n+----------------------+----------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/relations-on-geometry-mbr.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,30,'HOUR','Syntax:\nHOUR(time)\n\nReturns the hour for time. The range of the return value is 0 to 23 for\ntime-of-day values. However, the range of TIME values actually is much\nlarger, so HOUR can return values greater than 23.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT HOUR(\'10:05:03\');\n -> 10\nmysql> SELECT HOUR(\'272:59:59\');\n -> 272\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SELECT','Syntax:\nSELECT\n [ALL | DISTINCT | DISTINCTROW ]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr [, select_expr ...]\n [FROM table_references\n [WHERE where_condition]\n [GROUP BY {col_name | expr | position}\n [ASC | DESC], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position}\n [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\' export_options\n | INTO DUMPFILE \'file_name\'\n | INTO var_name [, var_name]]\n [FOR UPDATE | LOCK IN SHARE MODE]]\n\nSELECT is used to retrieve rows selected from one or more tables, and\ncan include UNION statements and subqueries. See [HELP UNION], and\nhttp://dev.mysql.com/doc/refman/5.1/en/subqueries.html.\n\nThe most commonly used clauses of SELECT statements are these:\n\no Each select_expr indicates a column that you want to retrieve. There\n must be at least one select_expr.\n\no table_references indicates the table or tables from which to retrieve\n rows. Its syntax is described in [HELP JOIN].\n\no The WHERE clause, if given, indicates the condition or conditions\n that rows must satisfy to be selected. where_condition is an\n expression that evaluates to true for each row to be selected. The\n statement selects all rows if there is no WHERE clause.\n\n In the WHERE clause, you can use any of the functions and operators\n that MySQL supports, except for aggregate (summary) functions. See\n http://dev.mysql.com/doc/refman/5.1/en/functions.html.\n\nSELECT can also be used to retrieve rows computed without reference to\nany table.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/select.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (353,26,'SELECT','Syntax:\nSELECT\n [ALL | DISTINCT | DISTINCTROW ]\n [HIGH_PRIORITY]\n [STRAIGHT_JOIN]\n [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]\n [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]\n select_expr [, select_expr ...]\n [FROM table_references\n [WHERE where_condition]\n [GROUP BY {col_name | expr | position}\n [ASC | DESC], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position}\n [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}]\n [PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\'\n [CHARACTER SET charset_name]\n export_options\n | INTO DUMPFILE \'file_name\'\n | INTO var_name [, var_name]]\n [FOR UPDATE | LOCK IN SHARE MODE]]\n\nSELECT is used to retrieve rows selected from one or more tables, and\ncan include UNION statements and subqueries. See [HELP UNION], and\nhttp://dev.mysql.com/doc/refman/5.1/en/subqueries.html.\n\nThe most commonly used clauses of SELECT statements are these:\n\no Each select_expr indicates a column that you want to retrieve. There\n must be at least one select_expr.\n\no table_references indicates the table or tables from which to retrieve\n rows. Its syntax is described in [HELP JOIN].\n\no The WHERE clause, if given, indicates the condition or conditions\n that rows must satisfy to be selected. where_condition is an\n expression that evaluates to true for each row to be selected. The\n statement selects all rows if there is no WHERE clause.\n\n In the WHERE clause, you can use any of the functions and operators\n that MySQL supports, except for aggregate (summary) functions. See\n http://dev.mysql.com/doc/refman/5.1/en/functions.html.\n\nSELECT can also be used to retrieve rows computed without reference to\nany table.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/select.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/select.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (354,4,'COT','Syntax:\nCOT(X)\n\nReturns the cotangent of X.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT COT(12);\n -> -1.5726734063977\nmysql> SELECT COT(0);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (355,25,'SHOW CREATE EVENT','Syntax:\nSHOW CREATE EVENT event_name\n\nThis statement displays the CREATE EVENT statement needed to re-create\na given event. For example (using the same event e_daily defined and\nthen altered in [HELP SHOW EVENTS]):\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-event.html\n\n','mysql> SHOW CREATE EVENT test.e_daily\\G\n*************************** 1. row ***************************\n Event: e_daily\n sql_mode:\n time_zone: SYSTEM\n Create Event: CREATE EVENT `e_daily`\n ON SCHEDULE EVERY 1 DAY\n STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR\n ON COMPLETION NOT PRESERVE\n ENABLE\n COMMENT \'Saves total number of sessions then\n clears the table each day\'\n DO BEGIN\n INSERT INTO site_activity.totals (time, total)\n SELECT CURRENT_TIMESTAMP, COUNT(*)\n FROM site_activity.sessions;\n DELETE FROM site_activity.sessions;\n END\ncharacter_set_client: latin1\ncollation_connection: latin1_swedish_ci\n Database Collation: latin1_swedish_ci\n','http://dev.mysql.com/doc/refman/5.1/en/show-create-event.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (356,19,'BACKUP TABLE','Syntax:\nBACKUP TABLE tbl_name [, tbl_name] ... TO \'/path/to/backup/directory\'\n\n*Note*: This statement is deprecated. We are working on a better\nreplacement for it that will provide online backup capabilities. In the\nmeantime, the mysqlhotcopy script can be used instead.\n\nBACKUP TABLE copies to the backup directory the minimum number of table\nfiles needed to restore the table, after flushing any buffered changes\nto disk. The statement works only for MyISAM tables. It copies the .frm\ndefinition and .MYD data files. The .MYI index file can be rebuilt from\nthose two files. The directory should be specified as a full path name.\nTo restore the table, use RESTORE TABLE.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/backup-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/backup-table.html');
@@ -486,7 +486,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,35,'BIN','Syntax:\nBIN(N)\n\nReturns a string representation of the binary value of N, where N is a\nlonglong (BIGINT) number. This is equivalent to CONV(N,10,2). Returns\nNULL if N is NULL.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT BIN(12);\n -> \'1100\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,5,'INSTALL PLUGIN','Syntax:\nINSTALL PLUGIN plugin_name SONAME \'plugin_library\'\n\nThis statement installs a plugin.\n\nplugin_name is the name of the plugin as defined in the plugin\ndeclaration structure contained in the library file. Plugin names are\nnot case sensitive. For maximal compatibility, plugin names should be\nlimited to ASCII letters, digits, and underscore, because they are used\nin C source files, shell command lines, M4 and Bourne shell scripts,\nand SQL environments.\n\nplugin_library is the name of the shared library that contains the\nplugin code. The name includes the file name extension (for example,\nlibmyplugin.so or libmyplugin.dylib).\n\nThe shared library must be located in the plugin directory (that is,\nthe directory named by the plugin_dir system variable). The library\nmust be in the plugin directory itself, not in a subdirectory. By\ndefault, plugin_dir is plugin directory under the directory named by\nthe pkglibdir configuration variable, but it can be changed by setting\nthe value of plugin_dir at server startup. For example, set its value\nin a my.cnf file:\n\n[mysqld]\nplugin_dir=/path/to/plugin/directory\n\nIf the value of plugin_dir is a relative path name, it is taken to be\nrelative to the MySQL base directory (the value of the basedir system\nvariable).\n\nINSTALL PLUGIN adds a line to the mysql.plugin table that describes the\nplugin. This table contains the plugin name and library file name.\n\nAs of MySQL 5.1.33, INSTALL PLUGIN causes the server to read option\n(my.cnf) files just as during server startup. This enables the plugin\nto pick up any relevant options from those files. It is possible to add\nplugin options to an option file even before loading a plugin (if the\nloose prefix is used). It is also possible to uninstall a plugin, edit\nmy.cnf, and install the plugin again. Restarting the plugin this way\nenables it to the new option values without a server restart.\n\nBefore MySQL 5.1.33, a plugin is started with each option set to its\ndefault value.\n\nINSTALL PLUGIN also loads and initializes the plugin code to make the\nplugin available for use. A plugin is initialized by executing its\ninitialization function, which handles any setup that the plugin must\nperform before it can be used.\n\nTo use INSTALL PLUGIN, you must have the INSERT privilege for the\nmysql.plugin table.\n\nAt server startup, the server loads and initializes any plugin that is\nlisted in the mysql.plugin table. This means that a plugin is installed\nwith INSTALL PLUGIN only once, not every time the server starts. Plugin\nloading at startup does not occur if the server is started with the\n--skip-grant-tables option.\n\nWhen the server shuts down, it executes the deinitialization function\nfor each plugin that is loaded so that the plugin has a change to\nperform any final cleanup.\n\nFor options that control individual plugin loading at server startup,\nsee http://dev.mysql.com/doc/refman/5.1/en/server-plugin-options.html.\nIf you need to load plugins for a single server startup when the\n--skip-grant-tables option is given (which tells the server not to read\nsystem tables), use the --plugin-load option. See\nhttp://dev.mysql.com/doc/refman/5.1/en/server-options.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/install-plugin.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/install-plugin.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,22,'DECLARE CURSOR','Syntax:\nDECLARE cursor_name CURSOR FOR select_statement\n\nThis statement declares a cursor. Multiple cursors may be declared in a\nstored program, but each cursor in a given block must have a unique\nname.\n\nThe SELECT statement cannot have an INTO clause.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/declare-cursor.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/declare-cursor.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,26,'LOAD DATA','Syntax:\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD DATA INFILE statement reads rows from a text file into a table\nat a very high speed. The file name must be given as a literal string.\n\nLOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See\nhttp://dev.mysql.com/doc/refman/5.1/en/select.html.) To write data from\na table to a file, use SELECT ... INTO OUTFILE. To read the file back\ninto a table, use LOAD DATA INFILE. The syntax of the FIELDS and LINES\nclauses is the same for both statements. Both clauses are optional, but\nFIELDS must precede LINES if both are specified.\n\nFor more information about the efficiency of INSERT versus LOAD DATA\nINFILE and speeding up LOAD DATA INFILE, see\nhttp://dev.mysql.com/doc/refman/5.1/en/insert-speed.html.\n\nThe character set indicated by the character_set_database system\nvariable is used to interpret the information in the file. SET NAMES\nand the setting of character_set_client do not affect interpretation of\ninput. If the contents of the input file use a character set that\ndiffers from the default, it is usually preferable to specify the\ncharacter set of the file by using the CHARACTER SET clause, which is\navailable as of MySQL 5.1.17. A character set of binary specifies "no\nconversion."\n\nLOAD DATA INFILE interprets all fields in the file as having the same\ncharacter set, regardless of the data types of the columns into which\nfield values are loaded. For proper interpretation of file contents,\nyou must ensure that it was written with the correct character set. For\nexample, if you write a data file with mysqldump -T or by issuing a\nSELECT ... INTO OUTFILE statement in mysql, be sure to use a\n--default-character-set option with mysqldump or mysql so that output\nis written in the character set to be used when the file is loaded with\nLOAD DATA INFILE.\n\nNote that it is currently not possible to load data files that use the\nucs2, utf16, or utf32 character set.\n\nAs of MySQL 5.1.6, the character_set_filesystem system variable\ncontrols the interpretation of the file name.\n\nYou can also load data files by using the mysqlimport utility; it\noperates by sending a LOAD DATA INFILE statement to the server. The\n--local option causes mysqlimport to read data files from the client\nhost. You can specify the --compress option to get better performance\nover slow networks if the client and server support the compressed\nprotocol. See http://dev.mysql.com/doc/refman/5.1/en/mysqlimport.html.\n\nIf you use LOW_PRIORITY, execution of the LOAD DATA statement is\ndelayed until no other clients are reading from the table. This affects\nonly storage engines that use only table-level locking (MyISAM, MEMORY,\nMERGE).\n\nIf you specify CONCURRENT with a MyISAM table that satisfies the\ncondition for concurrent inserts (that is, it contains no free blocks\nin the middle), other threads can retrieve data from the table while\nLOAD DATA is executing. Using this option affects the performance of\nLOAD DATA a bit, even if no other thread is using the table at the same\ntime.\n\nCONCURRENT is not replicated when using statement-based replication;\nhowever, it is replicated when using row-based replication. See\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-features-load-data.…, for more information.\n\n*Note*: Prior to MySQL 5.1.23, LOAD DATA performed very poorly when\nimporting into partitioned tables. The statement now uses buffering to\nimprove performance; however, the buffer uses 130 KB memory per\npartition to achieve this. (Bug#26527 (http://bugs.mysql.com/26527))\n\nThe LOCAL keyword, if specified, is interpreted with respect to the\nclient end of the connection:\n\no If LOCAL is specified, the file is read by the client program on the\n client host and sent to the server. The file can be given as a full\n path name to specify its exact location. If given as a relative path\n name, the name is interpreted relative to the directory in which the\n client program was started.\n\no If LOCAL is not specified, the file must be located on the server\n host and is read directly by the server. The server uses the\n following rules to locate the file:\n\n o If the file name is an absolute path name, the server uses it as\n given.\n\n o If the file name is a relative path name with one or more leading\n components, the server searches for the file relative to the\n server\'s data directory.\n\n o If a file name with no leading components is given, the server\n looks for the file in the database directory of the default\n database.\n\nNote that, in the non-LOCAL case, these rules mean that a file named as\n./myfile.txt is read from the server\'s data directory, whereas the file\nnamed as myfile.txt is read from the database directory of the default\ndatabase. For example, if db1 is the default database, the following\nLOAD DATA statement reads the file data.txt from the database directory\nfor db1, even though the statement explicitly loads the file into a\ntable in the db2 database:\n\nLOAD DATA INFILE \'data.txt\' INTO TABLE db2.my_table;\n\nWindows path names are specified using forward slashes rather than\nbackslashes. If you do use backslashes, you must double them.\n\nFor security reasons, when reading text files located on the server,\nthe files must either reside in the database directory or be readable\nby all. Also, to use LOAD DATA INFILE on server files, you must have\nthe FILE privilege. See\nhttp://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html. For\nnon-LOCAL load operations, if the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/load-data.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/load-data.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,26,'LOAD DATA','Syntax:\nLOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE \'file_name\'\n [REPLACE | IGNORE]\n INTO TABLE tbl_name\n [CHARACTER SET charset_name]\n [{FIELDS | COLUMNS}\n [TERMINATED BY \'string\']\n [[OPTIONALLY] ENCLOSED BY \'char\']\n [ESCAPED BY \'char\']\n ]\n [LINES\n [STARTING BY \'string\']\n [TERMINATED BY \'string\']\n ]\n [IGNORE number LINES]\n [(col_name_or_user_var,...)]\n [SET col_name = expr,...]\n\nThe LOAD DATA INFILE statement reads rows from a text file into a table\nat a very high speed. The file name must be given as a literal string.\n\nLOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See\nhttp://dev.mysql.com/doc/refman/5.1/en/select.html.) To write data from\na table to a file, use SELECT ... INTO OUTFILE. To read the file back\ninto a table, use LOAD DATA INFILE. The syntax of the FIELDS and LINES\nclauses is the same for both statements. Both clauses are optional, but\nFIELDS must precede LINES if both are specified.\n\nFor more information about the efficiency of INSERT versus LOAD DATA\nINFILE and speeding up LOAD DATA INFILE, see\nhttp://dev.mysql.com/doc/refman/5.1/en/insert-speed.html.\n\nThe character set indicated by the character_set_database system\nvariable is used to interpret the information in the file. SET NAMES\nand the setting of character_set_client do not affect interpretation of\ninput. If the contents of the input file use a character set that\ndiffers from the default, it is usually preferable to specify the\ncharacter set of the file by using the CHARACTER SET clause, which is\navailable as of MySQL 5.1.17. A character set of binary specifies "no\nconversion."\n\nLOAD DATA INFILE interprets all fields in the file as having the same\ncharacter set, regardless of the data types of the columns into which\nfield values are loaded. For proper interpretation of file contents,\nyou must ensure that it was written with the correct character set. For\nexample, if you write a data file with mysqldump -T or by issuing a\nSELECT ... INTO OUTFILE statement in mysql, be sure to use a\n--default-character-set option with mysqldump or mysql so that output\nis written in the character set to be used when the file is loaded with\nLOAD DATA INFILE.\n\nNote that it is currently not possible to load data files that use the\nucs2, utf16, or utf32 character set.\n\nAs of MySQL 5.1.6, the character_set_filesystem system variable\ncontrols the interpretation of the file name.\n\nYou can also load data files by using the mysqlimport utility; it\noperates by sending a LOAD DATA INFILE statement to the server. The\n--local option causes mysqlimport to read data files from the client\nhost. You can specify the --compress option to get better performance\nover slow networks if the client and server support the compressed\nprotocol. See http://dev.mysql.com/doc/refman/5.1/en/mysqlimport.html.\n\nIf you use LOW_PRIORITY, execution of the LOAD DATA statement is\ndelayed until no other clients are reading from the table. This affects\nonly storage engines that use only table-level locking (MyISAM, MEMORY,\nMERGE).\n\nIf you specify CONCURRENT with a MyISAM table that satisfies the\ncondition for concurrent inserts (that is, it contains no free blocks\nin the middle), other threads can retrieve data from the table while\nLOAD DATA is executing. Using this option affects the performance of\nLOAD DATA a bit, even if no other thread is using the table at the same\ntime.\n\nCONCURRENT is not replicated when using statement-based replication;\nhowever, it is replicated when using row-based replication. See\nhttp://dev.mysql.com/doc/refman/5.1/en/replication-features-load-data.…, for more information.\n\n*Note*: Prior to MySQL 5.1.23, LOAD DATA performed very poorly when\nimporting into partitioned tables. The statement now uses buffering to\nimprove performance; however, the buffer uses 130 KB memory per\npartition to achieve this. (Bug#26527 (http://bugs.mysql.com/26527))\n\nThe LOCAL keyword, if specified, is interpreted with respect to the\nclient end of the connection:\n\no If LOCAL is specified, the file is read by the client program on the\n client host and sent to the server. The file can be given as a full\n path name to specify its exact location. If given as a relative path\n name, the name is interpreted relative to the directory in which the\n client program was started.\n\no If LOCAL is not specified, the file must be located on the server\n host and is read directly by the server. The server uses the\n following rules to locate the file:\n\n o If the file name is an absolute path name, the server uses it as\n given.\n\n o If the file name is a relative path name with one or more leading\n components, the server searches for the file relative to the\n server\'s data directory.\n\n o If a file name with no leading components is given, the server\n looks for the file in the database directory of the default\n database.\n\nNote that, in the non-LOCAL case, these rules mean that a file named as\n./myfile.txt is read from the server\'s data directory, whereas the file\nnamed as myfile.txt is read from the database directory of the default\ndatabase. For example, if db1 is the default database, the following\nLOAD DATA statement reads the file data.txt from the database directory\nfor db1, even though the statement explicitly loads the file into a\ntable in the db2 database:\n\nLOAD DATA INFILE \'data.txt\' INTO TABLE db2.my_table;\n\nWindows path names are specified using forward slashes rather than\nbackslashes. If you do use backslashes, you must double them.\n\n*Note*: A regression in MySQL 5.1.40 caused the database referenced in\na fully qualified table name to be ignored by LOAD DATA when using\nreplication with either STATEMENT or MIXED as the binary logging\nformat; this could lead to problems if the table was not in the current\ndatabase. As a workaround, you can specify the correct database with\nthe USE statement prior to executing LOAD DATA. If necessary, you can\nreset the current database with a second USE statement following the\nLOAD DATA statement. This issue was fixed in MySQL 5.1.41. (Bug#48297\n(http://bugs.mysql.com/48297))\n\nFor security reasons, when reading text files located on the server,\nthe files must either reside in the database directory or be readable\nby all. Also, to use LOAD DATA INFILE on server files, you must have\nthe FILE privilege. See\nhttp://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html. For\nnon-LOCAL load operations, if the secure_file_priv system variable is\nset to a nonempty directory name, the file to be loaded must be located\nin that directory.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/load-data.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/load-data.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,23,'MULTILINESTRING','MultiLineString(ls1,ls2,...)\n\nConstructs a MultiLineString value using LineString or WKB LineString\narguments.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mys…','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-mys…');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,30,'LOCALTIME','Syntax:\nLOCALTIME, LOCALTIME()\n\nLOCALTIME and LOCALTIME() are synonyms for NOW().\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (423,3,'MPOINTFROMTEXT','MPointFromText(wkt[,srid]), MultiPointFromText(wkt[,srid])\n\nConstructs a MULTIPOINT value using its WKT representation and SRID.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt…','','http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html#gis-wkt…');
@@ -497,7 +497,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,20,'CHAR','[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE\ncollation_name]\n\nA fixed-length string that is always right-padded with spaces to the\nspecified length when stored. M represents the column length in\ncharacters. The range of M is 0 to 255. If M is omitted, the length is\n1.\n\n*Note*: Trailing spaces are removed when CHAR values are retrieved\nunless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (429,30,'UTC_DATE','Syntax:\nUTC_DATE, UTC_DATE()\n\nReturns the current UTC date as a value in \'YYYY-MM-DD\' or YYYYMMDD\nformat, depending on whether the function is used in a string or\nnumeric context.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT UTC_DATE(), UTC_DATE() + 0;\n -> \'2003-08-14\', 20030814\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (430,34,'DIMENSION','Dimension(g)\n\nReturns the inherent dimension of the geometry value g. The result can\nbe -1, 0, 1, or 2. The meaning of these values is given in\nhttp://dev.mysql.com/doc/refman/5.1/en/gis-class-geometry.html.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#gen…','mysql> SELECT Dimension(GeomFromText(\'LineString(1 1,2 2)\'));\n+------------------------------------------------+\n| Dimension(GeomFromText(\'LineString(1 1,2 2)\')) |\n+------------------------------------------------+\n| 1 |\n+------------------------------------------------+\n','http://dev.mysql.com/doc/refman/5.1/en/geometry-property-functions.html#gen…');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,16,'COUNT DISTINCT','Syntax:\nCOUNT(DISTINCT expr,[expr...])\n\nReturns a count of the number of different non-NULL values.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT COUNT(DISTINCT results) FROM student;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (431,16,'COUNT DISTINCT','Syntax:\nCOUNT(DISTINCT expr,[expr...])\n\nReturns a count of the number of rows with different non-NULL expr\nvalues.\n\nCOUNT(DISTINCT) returns 0 if there were no matching rows.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html\n\n','mysql> SELECT COUNT(DISTINCT results) FROM student;\n','http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (432,20,'BIT','BIT[(M)]\n\nA bit-field type. M indicates the number of bits per value, from 1 to\n64. The default is 1 if M is omitted.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (433,29,'EQUALS','Equals(g1,g2)\n\nReturns 1 or 0 to indicate whether g1 is spatially equal to g2.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relation…','','http://dev.mysql.com/doc/refman/5.1/en/functions-that-test-spatial-relation…');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (434,25,'SHOW CREATE VIEW','Syntax:\nSHOW CREATE VIEW view_name\n\nThis statement shows a CREATE VIEW statement that creates the given\nview.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/show-create-view.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/show-create-view.html');
@@ -532,7 +532,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (463,37,'MERGE','The MERGE storage engine, also known as the MRG_MyISAM engine, is a\ncollection of identical MyISAM tables that can be used as one.\n"Identical" means that all tables have identical column and index\ninformation. You cannot merge MyISAM tables in which the columns are\nlisted in a different order, do not have exactly the same columns, or\nhave the indexes in different order. However, any or all of the MyISAM\ntables can be compressed with myisampack. See\nhttp://dev.mysql.com/doc/refman/5.1/en/myisampack.html. Differences in\ntable options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS do not\nmatter.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/merge-storage-engine.html\n\n','mysql> CREATE TABLE t1 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> CREATE TABLE t2 (\n -> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> message CHAR(20)) ENGINE=MyISAM;\nmysql> INSERT INTO t1 (message) VALUES (\'Testing\'),(\'table\'),(\'t1\');\nmysql> INSERT INTO t2 (message) VALUES (\'Testing\'),(\'table\'),(\'t2\');\nmysql> CREATE TABLE total (\n -> a INT NOT NULL AUTO_INCREMENT,\n -> message CHAR(20), INDEX(a))\n -> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;\n','http://dev.mysql.com/doc/refman/5.1/en/merge-storage-engine.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,37,'CREATE TABLE','Syntax:\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n (create_definition,...)\n [table_options]\n [partition_options]\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)]\n [table_options]\n [partition_options]\n select_statement\n\nOr:\n\nCREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n { LIKE old_tbl_name | (LIKE old_tbl_name) }\n\ncreate_definition:\n col_name column_definition\n | [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n [index_option] ...\n | {INDEX|KEY} [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY]\n [index_name] [index_type] (index_col_name,...)\n [index_option] ...\n | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n [index_option] ...\n | [CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name,...) reference_definition\n | CHECK (expr)\n\ncolumn_definition:\n data_type [NOT NULL | NULL] [DEFAULT default_value]\n [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]\n [COMMENT \'string\']\n [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}]\n [STORAGE {DISK|MEMORY|DEFAULT}]\n [reference_definition]\n\ndata_type:\n BIT[(length)]\n | TINYINT[(length)] [UNSIGNED] [ZEROFILL]\n | SMALLINT[(length)] [UNSIGNED] [ZEROFILL]\n | MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]\n | INT[(length)] [UNSIGNED] [ZEROFILL]\n | INTEGER[(length)] [UNSIGNED] [ZEROFILL]\n | BIGINT[(length)] [UNSIGNED] [ZEROFILL]\n | REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]\n | DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | NUMERIC[(length[,decimals])] [UNSIGNED] [ZEROFILL]\n | DATE\n | TIME\n | TIMESTAMP\n | DATETIME\n | YEAR\n | CHAR[(length)]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | VARCHAR(length)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | BINARY[(length)]\n | VARBINARY(length)\n | TINYBLOB\n | BLOB\n | MEDIUMBLOB\n | LONGBLOB\n | TINYTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | TEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | MEDIUMTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | LONGTEXT [BINARY]\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | ENUM(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | SET(value1,value2,value3,...)\n [CHARACTER SET charset_name] [COLLATE collation_name]\n | spatial_type\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH | RTREE}\n\nindex_option:\n KEY_BLOCK_SIZE [=] value\n | index_type\n | WITH PARSER parser_name\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\ntable_options:\n table_option [[,] table_option] ...\n\ntable_option:\n ENGINE [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DEFAULT] CHARACTER SET [=] charset_name\n | CHECKSUM [=] {0 | 1}\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'string\'\n | CONNECTION [=] \'connect_string\'\n | DATA DIRECTORY [=] \'absolute path to directory\'\n | DELAY_KEY_WRITE [=] {0 | 1}\n | INDEX DIRECTORY [=] \'absolute path to directory\'\n | INSERT_METHOD [=] { NO | FIRST | LAST }\n | KEY_BLOCK_SIZE [=] value\n | MAX_ROWS [=] value\n | MIN_ROWS [=] value\n | PACK_KEYS [=] {0 | 1 | DEFAULT}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT}\n | TABLESPACE tablespace_name [STORAGE {DISK|MEMORY|DEFAULT}]\n | UNION [=] (tbl_name[,tbl_name]...)\n\npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE(expr)\n | LIST(expr) }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\n\npartition_definition:\n PARTITION partition_name\n [VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\n\nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n\nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some legal select statement)\n\nCREATE TABLE creates a table with the given name. You must have the\nCREATE privilege for the table.\n\nRules for allowable table names are given in\nhttp://dev.mysql.com/doc/refman/5.1/en/identifiers.html. By default,\nthe table is created in the default database. An error occurs if the\ntable exists, if there is no default database, or if the database does\nnot exist.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/create-table.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (465,17,'>','Syntax:\n>\n\nGreater than:\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT 2 > 2;\n -> 0\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,19,'ANALYZE TABLE','Syntax:\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nANALYZE TABLE analyzes and stores the key distribution for a table.\nDuring the analysis, the table is locked with a read lock for MyISAM.\nFor InnoDB the table is locked with a write lock. This statement works\nwith MyISAM, and InnoDB tables. For MyISAM tables, this statement is\nequivalent to using myisamchk --analyze.\n\nFor more information on how the analysis works within InnoDB, see\nhttp://dev.mysql.com/doc/refman/5.1/en/innodb-restrictions.html.\n\nMy… uses the stored key distribution to decide the order in which\ntables should be joined when you perform a join on something other than\na constant. In addition, key distributions can be used when deciding\nwhich indexes to use for a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBeginning with MySQL 5.1.27, ANALYZE TABLE is also supported for\npartitioned tables. Also beginning with MySQL 5.1.27, you can use ALTER\nTABLE ... ANALYZE PARTITION to analyze one or more partitions; for more\ninformation, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.1/en/partitioning-maintenance.html.\…: http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (466,19,'ANALYZE TABLE','Syntax:\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n\nANALYZE TABLE analyzes and stores the key distribution for a table.\nDuring the analysis, the table is locked with a read lock for MyISAM.\nFor InnoDB the table is locked with a write lock. This statement works\nwith MyISAM and InnoDB tables. For MyISAM tables, this statement is\nequivalent to using myisamchk --analyze.\n\nFor more information on how the analysis works within InnoDB, see\nhttp://dev.mysql.com/doc/refman/5.1/en/innodb-restrictions.html.\n\nMy… uses the stored key distribution to decide the order in which\ntables should be joined when you perform a join on something other than\na constant. In addition, key distributions can be used when deciding\nwhich indexes to use for a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBeginning with MySQL 5.1.27, ANALYZE TABLE is also supported for\npartitioned tables. Also beginning with MySQL 5.1.27, you can use ALTER\nTABLE ... ANALYZE PARTITION to analyze one or more partitions; for more\ninformation, see [HELP ALTER TABLE], and\nhttp://dev.mysql.com/doc/refman/5.1/en/partitioning-maintenance.html.\…: http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html\n\n','','http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (467,30,'MICROSECOND','Syntax:\nMICROSECOND(expr)\n\nReturns the microseconds from the time or datetime expression expr as a\nnumber in the range from 0 to 999999.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html\n\n','mysql> SELECT MICROSECOND(\'12:00:00.123456\');\n -> 123456\nmysql> SELECT MICROSECOND(\'2009-12-31 23:59:59.000010\');\n -> 10\n','http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,37,'CONSTRAINT','InnoDB supports foreign key constraints. The syntax for a foreign key\nconstraint definition in InnoDB looks like this:\n\n[CONSTRAINT [symbol]] FOREIGN KEY\n [index_name] (index_col_name, ...)\n REFERENCES tbl_name (index_col_name,...)\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\…','CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,\n price DECIMAL,\n PRIMARY KEY(category, id)) ENGINE=INNODB;\nCREATE TABLE customer (id INT NOT NULL,\n PRIMARY KEY (id)) ENGINE=INNODB;\nCREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,\n product_category INT NOT NULL,\n product_id INT NOT NULL,\n customer_id INT NOT NULL,\n PRIMARY KEY(no),\n INDEX (product_category, product_id),\n FOREIGN KEY (product_category, product_id)\n REFERENCES product(category, id)\n ON UPDATE CASCADE ON DELETE RESTRICT,\n INDEX (customer_id),\n FOREIGN KEY (customer_id)\n REFERENCES customer(id)) ENGINE=INNODB;\n','http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,37,'CREATE SERVER','Syntax:\nCREATE SERVER server_name\n FOREIGN DATA WRAPPER wrapper_name\n OPTIONS (option [, option] ...)\n\noption:\n { HOST character-literal\n | DATABASE character-literal\n | USER character-literal\n | PASSWORD character-literal\n | SOCKET character-literal\n | OWNER character-literal\n | PORT numeric-literal }\n\nThis statement creates the definition of a server for use with the\nFEDERATED storage engine. The CREATE SERVER statement creates a new row\nwithin the servers table within the mysql database. This statement\nrequires the SUPER privilege.\n\nThe server_name should be a unique reference to the server. Server\ndefinitions are global within the scope of the server, it is not\npossible to qualify the server definition to a specific database.\nserver_name has a maximum length of 64 characters (names longer than 64\ncharacters are silently truncated), and is case insensitive. You may\nspecify the name as a quoted string.\n\nThe wrapper_name should be mysql, and may be quoted with single quotes.\nOther values for wrapper_name are not currently supported.\n\nFor each option you must specify either a character literal or numeric\nliteral. Character literals are UTF-8, support a maximum length of 64\ncharacters and default to a blank (empty) string. String literals are\nsilently truncated to 64 characters. Numeric literals must be a number\nbetween 0 and 9999, default value is 0.\n\n*Note*: Note that the OWNER option is currently not applied, and has no\neffect on the ownership or operation of the server connection that is\ncreated.\n\nThe CREATE SERVER statement creates an entry in the mysql.server table\nthat can later be used with the CREATE TABLE statement when creating a\nFEDERATED table. The options that you specify will be used to populate\nthe columns in the mysql.server table. The table columns are\nServer_name, Host, Db, Username, Password, Port and Socket.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/create-server.html\n\n','CREATE SERVER s\nFOREIGN DATA WRAPPER mysql\nOPTIONS (USER \'Remote\', HOST \'192.168.1.106\', DATABASE \'test\');\n','http://dev.mysql.com/doc/refman/5.1/en/create-server.html');
@@ -567,7 +567,7 @@ insert into help_topic (help_topic_id,he
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (498,4,'RADIANS','Syntax:\nRADIANS(X)\n\nReturns the argument X, converted from degrees to radians. (Note that\nπ radians equals 180 degrees.)\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html\n\n','mysql> SELECT RADIANS(90);\n -> 1.5707963267949\n','http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (499,15,'COLLATION','Syntax:\nCOLLATION(str)\n\nReturns the collation of the string argument.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT COLLATION(\'abc\');\n -> \'latin1_swedish_ci\'\nmysql> SELECT COLLATION(_utf8\'abc\');\n -> \'utf8_general_ci\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (500,17,'COALESCE','Syntax:\nCOALESCE(value,...)\n\nReturns the first non-NULL value in the list, or NULL if there are no\nnon-NULL values.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html\n\n','mysql> SELECT COALESCE(NULL,1);\n -> 1\nmysql> SELECT COALESCE(NULL,NULL,NULL);\n -> NULL\n','http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html');
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,15,'VERSION','Syntax:\nVERSION()\n\nReturns a string that indicates the MySQL server version. The string\nuses the utf8 character set.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT VERSION();\n -> \'5.1.39-standard\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (501,15,'VERSION','Syntax:\nVERSION()\n\nReturns a string that indicates the MySQL server version. The string\nuses the utf8 character set.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html\n\n','mysql> SELECT VERSION();\n -> \'5.1.41-standard\'\n','http://dev.mysql.com/doc/refman/5.1/en/information-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (502,35,'MAKE_SET','Syntax:\nMAKE_SET(bits,str1,str2,...)\n\nReturns a set value (a string containing substrings separated by ","\ncharacters) consisting of the strings that have the corresponding bit\nin bits set. str1 corresponds to bit 0, str2 to bit 1, and so on. NULL\nvalues in str1, str2, ... are not appended to the result.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT MAKE_SET(1,\'a\',\'b\',\'c\');\n -> \'a\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',\'world\');\n -> \'hello,world\'\nmysql> SELECT MAKE_SET(1 | 4,\'hello\',\'nice\',NULL,\'world\');\n -> \'hello\'\nmysql> SELECT MAKE_SET(0,\'a\',\'b\',\'c\');\n -> \'\'\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (503,35,'FIND_IN_SET','Syntax:\nFIND_IN_SET(str,strlist)\n\nReturns a value in the range of 1 to N if the string str is in the\nstring list strlist consisting of N substrings. A string list is a\nstring composed of substrings separated by "," characters. If the first\nargument is a constant string and the second is a column of type SET,\nthe FIND_IN_SET() function is optimized to use bit arithmetic. Returns\n0 if str is not in strlist or if strlist is the empty string. Returns\nNULL if either argument is NULL. This function does not work properly\nif the first argument contains a comma (",") character.\n\nURL: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html\n\n','mysql> SELECT FIND_IN_SET(\'b\',\'a,b,c,d\');\n -> 2\n','http://dev.mysql.com/doc/refman/5.1/en/string-functions.html');
@@ -1293,6 +1293,7 @@ insert into help_relation (help_topic_id
insert into help_relation (help_topic_id,help_keyword_id) values (143,115);
insert into help_relation (help_topic_id,help_keyword_id) values (468,115);
insert into help_relation (help_topic_id,help_keyword_id) values (180,115);
+insert into help_relation (help_topic_id,help_keyword_id) values (353,115);
insert into help_relation (help_topic_id,help_keyword_id) values (420,115);
insert into help_relation (help_topic_id,help_keyword_id) values (473,115);
insert into help_relation (help_topic_id,help_keyword_id) values (197,116);
@@ -1550,11 +1551,12 @@ insert into help_relation (help_topic_id
insert into help_relation (help_topic_id,help_keyword_id) values (383,238);
insert into help_relation (help_topic_id,help_keyword_id) values (330,239);
insert into help_relation (help_topic_id,help_keyword_id) values (344,239);
-insert into help_relation (help_topic_id,help_keyword_id) values (253,239);
insert into help_relation (help_topic_id,help_keyword_id) values (152,239);
insert into help_relation (help_topic_id,help_keyword_id) values (428,239);
insert into help_relation (help_topic_id,help_keyword_id) values (464,239);
+insert into help_relation (help_topic_id,help_keyword_id) values (253,239);
insert into help_relation (help_topic_id,help_keyword_id) values (209,239);
+insert into help_relation (help_topic_id,help_keyword_id) values (353,239);
insert into help_relation (help_topic_id,help_keyword_id) values (420,239);
insert into help_relation (help_topic_id,help_keyword_id) values (184,240);
insert into help_relation (help_topic_id,help_keyword_id) values (273,241);
=== modified file 'support-files/MacOSX/ReadMe.txt'
--- a/support-files/MacOSX/ReadMe.txt 2009-05-25 09:59:47 +0000
+++ b/support-files/MacOSX/ReadMe.txt 2009-12-01 07:24:05 +0000
@@ -1,5 +1,47 @@
-2.5. Installing MySQL on Mac OS X
+2.7. Installing MySQL on Mac OS X
+
+ MySQL for Mac OS X is available in a number of different forms:
+
+ * Native Package Installer format, which uses the native Mac OS
+ X installer to walk you through the installation of MySQL. For
+ more information, see Section 2.7.1, "Installing MySQL Using
+ the Installation Package." You can use the package installer
+ with Mac OS X 10.3 and later, and available for both PowerPC
+ and Intel architectures, and both 32-bit and 64-bit
+ architectures. There is no Universal Binary available using
+ the package installation method. The user you use to perform
+ the installation must have administrator privileges.
+
+ * Tar package format, which uses a file packaged using the Unix
+ tar and gzip commands. To use this method, you will need to
+ open a Terminal window. You do not need administrator
+ privileges using this method, as you can install the MySQL
+ server anywhere using this method. For more information on
+ using this method, you can use the generic instructions for
+ using a tarball, Section 2.2, "Installing MySQL from Generic
+ Binaries on Unix/Linux."You can use the package installer with
+ Mac OS X 10.3 and later, and available for both PowerPC and
+ Intel architectures, and both 32-bit and 64-bit architectures.
+ A Universal Binary, incorporating both Power PC and Intel
+ architectures and 32-bit and 64-bit binaries is available.
+ In addition to the core installation, the Package Installer
+ also includes Section 2.7.2, "Installing the MySQL Startup
+ Item" and Section 2.7.3, "Installing and Using the MySQL
+ Preference Pane," both of which simplify the management of
+ your installation.
+
+ * Mac OS X server includes a version of MySQL as standard. If
+ you want to use a more recent version than that supplied with
+ the Mac OS X server release, you can make use of the package
+ or tar formats. For more information on using the MySQL
+ bundled with Mac OS X, see Section 2.7.4, "Using MySQL on Mac
+ OS X Server."
+
+ For additional information on using MySQL on Mac OS X, see Section
+ 2.7.5, "MySQL Installation on Mac OS X Notes."
+
+2.7.1. Installing MySQL Using the Installation Package
You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
using a Mac OS X binary package in PKG format instead of the
@@ -11,8 +53,6 @@
first need to mount by double-clicking its icon in the Finder. It
should then mount the image and display its contents.
- To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
-
Note
Before proceeding with the installation, be sure to shut down all
@@ -20,144 +60,319 @@ Note
Application (on Mac OS X Server) or via mysqladmin shutdown on the
command line.
- To actually install the MySQL PKG file, double-click on the
- package icon. This launches the Mac OS X Package Installer, which
- guides you through the installation of MySQL.
+ When installing from the package version, you should also install
+ the MySQL Preference Pane, which will allow you to control the
+ startup and execution of your MySQL server from System
+ Preferences. For more information, see Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+ When installing using the package installer, the files are
+ installed into a directory within /usr/local matching the name of
+ the installation version and platform. For example, the installer
+ file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
+ /usr/local/mysql-5.1.39-osx10.5-x86_64 . The installation layout
+ of the directory is as shown in the following table:
+ Directory Contents of Directory
+ bin Client programs and the mysqld server
+ data Log files, databases
+ docs Manual in Info format
+ include Include (header) files
+ lib Libraries
+ man Unix manual pages
+ mysql-test MySQL test suite
+ scripts Contains the mysql_install_db script
+ share/mysql Error message files
+ sql-bench Benchmarks
+ support-files Scripts and sample configuration files
+ /tmp/mysql.sock The location of the MySQL Unix socket
+
+ During the package installer process, a symbolic link from
+ /usr/local/mysql to the version/platform specific directory
+ created during installation will be created automatically.
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQL installer package. It will be named
+ according to the version of MySQL you have downloaded. For
+ example, if you have downloaded MySQL 5.1.39, double-click
+ mysql-5.1.39-osx10.5-x86.pkg.
+
+ 3. You will be presented with the openin installer dialog. Click
+ Continue to begihn installation.
+ MySQL Package Installer: Step 1
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. If you have downloaded the community version of MySQL, you
+ will be shown a copy of the relevent GNU General Public
+ License. Click Continue .
+
+ 6. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Package Installer: Step 4
+
+ 7. You will be asked to confirm the details of the installation,
+ including the space required for the installation. To change
+ the drive on which the startup item is installed you can click
+ either Go Back or Change Install Location.... To install the
+ startup item, click Install.
- Due to a bug in the Mac OS X package installer, you may see this
- error message in the destination disk selection dialog:
-You cannot install this software on this disk. (null)
-
- If this error occurs, simply click the Go Back button once to
- return to the previous screen. Then click Continue to advance to
- the destination disk selection again, and you should be able to
- choose the destination disk correctly. We have reported this bug
- to Apple and it is investigating this problem.
-
- The Mac OS X PKG of MySQL installs itself into
- /usr/local/mysql-VERSION and also installs a symbolic link,
- /usr/local/mysql, that points to the new location. If a directory
- named /usr/local/mysql exists, it is renamed to
- /usr/local/mysql.bak first. Additionally, the installer creates
- the grant tables in the mysql database by executing
- mysql_install_db.
-
- The installation layout is similar to that of a tar file binary
- distribution; all MySQL binaries are located in the directory
- /usr/local/mysql/bin. The MySQL socket file is created as
- /tmp/mysql.sock by default. See Section 2.1.5, "Installation
- Layouts."
-
- MySQL installation requires a Mac OS X user account named mysql. A
- user account with this name should exist by default on Mac OS X
- 10.2 and up.
+ 8. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
- If you are running Mac OS X Server, a version of MySQL should
- already be installed. The following table shows the versions of
- MySQL that ship with Mac OS X Server versions.
- Mac OS X Server Version MySQL Version
- 10.2-10.2.2 3.23.51
- 10.2.3-10.2.6 3.23.53
- 10.3 4.0.14
- 10.3.2 4.0.16
- 10.4.0 4.1.10a
+ Once you have completed the basic installation, you must complete
+ the post-installation steps as specifed in Section 2.13,
+ "Post-Installation Setup and Testing."
- This manual section covers the installation of the official MySQL
- Mac OS X PKG only. Make sure to read Apple's help information
- about installing MySQL: Run the "Help View" application, select
- "Mac OS X Server" help, do a search for "MySQL," and read the item
- entitled "Installing MySQL."
-
- If you previously used Marc Liyanage's MySQL packages for Mac OS X
- from http://www.entropy.ch, you can simply follow the update
- instructions for packages using the binary installation layout as
- given on his pages.
-
- If you are upgrading from Marc's 3.23.x versions or from the Mac
- OS X Server version of MySQL to the official MySQL PKG, you also
- need to convert the existing MySQL privilege tables to the current
- format, because some new security privileges have been added. See
- Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL Upgrade."
-
- If you want MySQL to start automatically during system startup,
- you also need to install the MySQL Startup Item. It is part of the
- Mac OS X installation disk images as a separate installation
- package. Simply double-click the MySQLStartupItem.pkg icon and
- follow the instructions to install it. The Startup Item need be
- installed only once. There is no need to install it each time you
- upgrade the MySQL package later.
+ For convenience, you may also want to install the Section 2.7.2,
+ "Installing the MySQL Startup Item" and Section 2.7.3, "Installing
+ and Using the MySQL Preference Pane."
+
+2.7.2. Installing the MySQL Startup Item
+
+ The MySQL Installation Package includes a startup item that can be
+ used to automatically startup and shutdown MySQL during boot.
+
+ To install the MySQL Startup Item:
+
+ 1. Download and open the MySQL package installer, which is
+ provided on a disk image (.dmg). Double-click to open the disk
+ image, which includes the main MySQL installation package, the
+ MySQLStartupItem.pkg installation package, and the
+ MySQL.prefPane.
+
+ 2. Double-click on the MySQLStartItem.pkg file to start the
+ installation process.
+
+ 3. You will be presented with the Install MySQL Startup Item
+ dialog.
+ MySQL Startup Item Installer: Step 1
+ Click Continue to continue the installation process.
+
+ 4. A copy of the installation instructions and other important
+ information relevant to this installation are display. Click
+ Continue .
+
+ 5. Select the drive you want to use to install the MySQL Startup
+ Item. The drive must have a valid, bootable, Mac OS X
+ operating system installed. Click Continue.
+ MySQL Startup Item Installer: Step 3
+
+ 6. You will be asked to confirm the details of the installation.
+ To change the drive on which the startup item is installed you
+ can click either Go Back or Change Install Location.... To
+ install the startup item, click Install.
+
+ 7. Once the installation has been completed successfully, you
+ will be given an Install Succeeded message.
+ MySQL Startup Item Installer: Step 5
The Startup Item for MySQL is installed into
- /Library/StartupItems/MySQLCOM. (Before MySQL 4.1.2, the location
- was /Library/StartupItems/MySQL, but that collided with the MySQL
- Startup Item installed by Mac OS X Server.) Startup Item
- installation adds a variable MYSQLCOM=-YES- to the system
- configuration file /etc/hostconfig. If you want to disable the
- automatic startup of MySQL, simply change this variable to
- MYSQLCOM=-NO-.
-
- On Mac OS X Server, the default MySQL installation uses the
- variable MYSQL in the /etc/hostconfig file. The MySQL Startup Item
- installer disables this variable by setting it to MYSQL=-NO-. This
- avoids boot time conflicts with the MYSQLCOM variable used by the
- MySQL Startup Item. However, it does not shut down a running MySQL
- server. You should do that yourself.
+ /Library/StartupItems/MySQLCOM. The Startup Item installation adds
+ a variable MYSQLCOM=-YES- to the system configuration file
+ /etc/hostconfig. If you want to disable the automatic startup of
+ MySQL, simply change this variable to MYSQLCOM=-NO-.
After the installation, you can start up MySQL by running the
following commands in a terminal window. You must have
administrator privileges to perform this task.
- If you have installed the Startup Item, use this command:
+ If you have installed the Startup Item, use this command to start
+ the server:
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
-(Enter your password, if necessary)
-(Press Control-D or enter "exit" to exit the shell)
- If you don't use the Startup Item, enter the following command
- sequence:
-shell> cd /usr/local/mysql
-shell> sudo ./bin/mysqld_safe
-(Enter your password, if necessary)
-(Press Control-Z)
-shell> bg
-(Press Control-D or enter "exit" to exit the shell)
+ You may be prompted for your password to complete the startup.
- You should be able to connect to the MySQL server, for example, by
- running /usr/local/mysql/bin/mysql.
+ If you have installed the Startup Item, use this command to stop
+ the server:
+shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
+
+ You may be prompted for your password to complete the shutdown.
+
+2.7.3. Installing and Using the MySQL Preference Pane
+
+ The MySQL Package installer disk image also includes a custom
+ MySQL Preference Pane that enables you to start, stop and control
+ automated startup during boot of your MySQL installation.
+
+ To install the MySQL Preference Pane:
+
+ 1. Download and open the MySQL package installer package, which
+ is provided on a disk image (.dmg). Double-click to open the
+ disk image, which includes the main MySQL installation
+ package, the MySQLStartupItem.pkg installation package, and
+ the MySQL.prefPane.
+
+ 2. Double click on MySQL.prefPane. The MySQL System Preferences
+ will open.
+
+ 3. If this is the first time you have installed the preference
+ pane, you will be asked to confirm installation and whether
+ you want to install the preference pane for all users, or only
+ the current user. To install the preference pane for all users
+ you will need administrator privileges. If necessary, you will
+ be prompted for the username and password for a user with
+ administrator privileges.
+
+ 4. If you already have the MySQL Preference Pane installed, you
+ will be asked to confirm whether you want to overwrite the
+ existing MySQL Preference Pane.
Note
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.11,
- "Post-Installation Setup and Testing."
+ The MySQL Preference Pane only starts and stops MySQL installation
+ installed from the MySQL package installation that have been
+ installed in the default location.
+
+ Once the MySQL Preference Pane has been installed, you can control
+ your MySQL server instance using the preference pane. To use the
+ preference pane, open the System Preferences... from the Apple
+ menu. Select the MySQL preference pane by clicking on the MySQL
+ logo within the Other section of the preference panes list.
+ MySQL Preference Pane
+
+ The MySQL Preference Pane shows the current status of the MySQL
+ server, showing stopped (in red) if the server is not running and
+ running (in green) if the server has already been started. The
+ preference pane will also show the current setting for whether the
+ MySQL server has been set to start up automatically.
+
+ * To start MySQL using the preference pane:
+ Click Start MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to start
+ the MySQL server.
+
+ * To stop MySQL using the preference pane:
+ Click Stop MySQL Server. You may be prompted for the username
+ and password of a user with administrator privileges to
+ shutdown the MySQL server.
+
+ * To automatically start the MySQL server when the system boots:
+ Check the checkbox next to Automatically Start MySQL Server on
+ Startup.
+
+ * To disable the automatic starting of the MySQL server when the
+ system boots:
+ Uncheck the checkbox next to Automatically Start MySQL Server
+ on Startup.
+
+ You can close the System Preferences... once you have completed
+ your settings.
- You might want to add aliases to your shell's resource file to
- make it easier to access commonly used programs such as mysql and
- mysqladmin from the command line. The syntax for bash is:
+2.7.4. Using MySQL on Mac OS X Server
+
+ If you are running Mac OS X Server, a version of MySQL should
+ already be installed. The following table shows the versions of
+ MySQL that ship with Mac OS X Server versions.
+ Mac OS X Server Version MySQL Version
+ 10.2-10.2.2 3.23.51
+ 10.2.3-10.2.6 3.23.53
+ 10.3 4.0.14
+ 10.3.2 4.0.16
+ 10.4.0 4.1.10a
+ 10.5.0 5.0.45
+ 10.6.0 5.0.82
+
+ The installation layout of MySQL on Mac OS X Server is as shown in
+ the table below:
+ Directory Contents of Directory
+ /usr/bin Client programs
+ /var/mysql Log files, databases
+ /usr/libexec The mysqld server
+ /usr/share/man Unix manual pages
+ /usr/share/mysql/mysql-test MySQL test suite
+ /usr/share/mysql Contains the mysql_install_db script
+ /var/mysql/mysql.sock The location of the MySQL Unix socket
+
+Note
+
+ The MySQL server bundled with Mac OS X Server does not include the
+ MySQL client libraries and header files required if you want to
+ access and use MySQL from a third-party driver, such as Perl DBI
+ or PHP. For more information on obtaining and installing MySQL
+ libraries, see Mac OS X Server version 10.5: MySQL libraries
+ available for download (http://support.apple.com/kb/TA25017)
+ Alternatively, you can ignore the bundled MySQL server and install
+ MySQL from the package or tarball installation.
+
+ For more information on managing the bundled MySQL instance in Mac
+ OS X Server 10.5, see Mac OS X Server: Web Technologies
+ Administration For Version 10.5 Leopard
+ (http://images.apple.com/server/macosx/docs/Web_Technologies_Admin
+ _v10.5.pdf). For more information on managing the bundled MySQL
+ instance in Mac OS X Server 10.6, see Mac OS X Server: Web
+ Technologies Administration Version 10.6 Snow Leopard
+ (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf)
+
+2.7.5. MySQL Installation on Mac OS X Notes
+
+ You should keep the following issues and notes in mind:
+
+ * The default location for the MySQL Unix socket is different on
+ Mac OS X and Mac OS X Server depending on the installation
+ type you chose. The default locations by installation are as
+ follows:
+
+ Package Installer from MySQL /tmp/mysql.sock
+ Tarball from MySQL /tmp/mysql.sock
+ MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
+ To prevent issues, you should either change the configuration
+ of the socket used within your application (for example,
+ changing php.ini), or you should configure the socket location
+ using a MySQL configuration file and the socket option. For
+ more information, see Section 5.1.2, "Server Command Options."
+
+ * You may need (or want) to create a specific mysql user to own
+ the MySQL directory and data. On Mac OS X 10.4 and lower you
+ can do this by using the Netinfo Manager application, located
+ within the Utilities folder within the Applications folder. On
+ Mac OS X 10.5 and later you can do this through the Directory
+ Utility. From Mac OS X 10.5 and later (including Mac OS X
+ Server 10.5) the mysql should already exist. For use in single
+ user mode, an entry for _mysql (note the underscore prefix)
+ should already exist within the system /etc/passwd file.
+
+ * Due to a bug in the Mac OS X package installer, you may see
+ this error message in the destination disk selection dialog:
+You cannot install this software on this disk. (null)
+ If this error occurs, simply click the Go Back button once to
+ return to the previous screen. Then click Continue to advance
+ to the destination disk selection again, and you should be
+ able to choose the destination disk correctly. We have
+ reported this bug to Apple and it is investigating this
+ problem.
+
+ * Because the MySQL package installer installs the MySQL
+ contents into a version and platform specific directory, you
+ can use this to upgrade and migrate your database between
+ versions. You will need to either copy the data directory from
+ the old version to the new version, or alternatively specify
+ an alternative datadir value to set location of the data
+ directory.
+
+ * You might want to add aliases to your shell's resource file to
+ make it easier to access commonly used programs such as mysql
+ and mysqladmin from the command line. The syntax for bash is:
alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
-
- For tcsh, use:
+ For tcsh, use:
alias mysql /usr/local/mysql/bin/mysql
alias mysqladmin /usr/local/mysql/bin/mysqladmin
-
- Even better, add /usr/local/mysql/bin to your PATH environment
- variable. You can do this by modifying the appropriate startup
- file for your shell. For more information, see Section 4.2.1,
- "Invoking MySQL Programs."
-
- If you are upgrading an existing installation, note that
- installing a new MySQL PKG does not remove the directory of an
- older installation. Unfortunately, the Mac OS X Installer does not
- yet offer the functionality required to properly upgrade
- previously installed packages.
-
- To use your existing databases with the new installation, you'll
- need to copy the contents of the old data directory to the new
- data directory. Make sure that neither the old server nor the new
- one is running when you do this. After you have copied over the
- MySQL database files from the previous installation and have
- successfully started the new server, you should consider removing
- the old installation files to save disk space. Additionally, you
- should also remove older versions of the Package Receipt
- directories located in /Library/Receipts/mysql-VERSION.pkg.
+ Even better, add /usr/local/mysql/bin to your PATH environment
+ variable. You can do this by modifying the appropriate startup
+ file for your shell. For more information, see Section 4.2.1,
+ "Invoking MySQL Programs."
+
+ * After you have copied over the MySQL database files from the
+ previous installation and have successfully started the new
+ server, you should consider removing the old installation
+ files to save disk space. Additionally, you should also remove
+ older versions of the Package Receipt directories located in
+ /Library/Receipts/mysql-VERSION.pkg.
1
0
Wouldn't it be nice to run .sql -scripts just like:
mysql> @script.sql
I have found many Oracle/MySQL dbas have a tendency to use '@' to run a script.
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2770)
by Michael Widenius 30 Nov '09
by Michael Widenius 30 Nov '09
30 Nov '09
#At lp:maria based on revid:monty@askmonty.org-20091126201933-dgoynszp2z90gknl
2770 Michael Widenius 2009-11-30
Remove compiler warnings (Including some warnings from -Wstrict-aliasing)
Don't use static link by default (in compile-pentium) as some new systems doesn't have all static libraries available
Change type for functions in plugin.h:str_mysql_ftparser_param() to const unsigned char and string lengths to size_t.
One effect of the above change is that one needs to include mysql_global.h or define size_t before including plugin.h
This fixes a case where mysql_client_test failed with newer gcc that enables strict-aliasing by default
modified:
BUILD/compile-pentium
client/mysql_upgrade.c
cmd-line-utils/readline/config_readline.h
cmd-line-utils/readline/display.c
cmd-line-utils/readline/history.c
cmd-line-utils/readline/rlmbutil.h
cmd-line-utils/readline/text.c
cmd-line-utils/readline/xmalloc.c
configure.in
include/mysql/plugin.h
include/mysql/plugin.h.pp
libmysql/libmysql.c
mysql-test/t/information_schema.test
mysql-test/t/not_partition.test
mysys/lf_hash.c
mysys/my_redel.c
regex/engine.c
regex/engine.ih
sql/sp_head.cc
sql/sql_base.cc
sql/sql_builtin.cc.in
sql/sql_parse.cc
sql/sql_select.cc
sql/sql_show.cc
sql/table.cc
storage/maria/ha_maria.cc
storage/maria/lockman.c
storage/maria/ma_check.c
storage/maria/ma_check_standalone.h
storage/maria/ma_ft_boolean_search.c
storage/maria/ma_ft_nlq_search.c
storage/maria/ma_ft_parser.c
storage/maria/ma_ftdefs.h
storage/maria/ma_sort.c
storage/maria/ma_state.c
storage/maria/maria_def.h
storage/maria/maria_ftdump.c
storage/maria/trnman.c
storage/myisam/ft_boolean_search.c
storage/myisam/ft_nlq_search.c
storage/myisam/ft_parser.c
storage/myisam/ft_stopwords.c
storage/myisam/ftdefs.h
storage/myisam/ha_myisam.cc
storage/myisam/mi_check.c
storage/myisam/myisam_ftdump.c
storage/myisam/myisamchk.c
storage/myisam/myisamdef.h
storage/myisam/myisamlog.c
storage/myisam/sort.c
storage/xtradb/fil/fil0fil.c
storage/xtradb/trx/trx0i_s.c
per-file messages:
BUILD/compile-pentium
Don't use static link by default as some new systems doesn't have all static libraries available
client/mysql_upgrade.c
Remove not used variable
cmd-line-utils/readline/config_readline.h
Define some constants to get rid of compiler warnings on Linux
cmd-line-utils/readline/display.c
Get rid of compiler warnings
cmd-line-utils/readline/history.c
Got rid of compiler warnings:
- Defining some strings as const
- Added cast
cmd-line-utils/readline/rlmbutil.h
Added cast to get rid of compiler warnings
cmd-line-utils/readline/text.c
Remove not needed initialization to get rid of compiler warnings
cmd-line-utils/readline/xmalloc.c
Changed types to 'const char* to get rid of compiler warnings
configure.in
Ensure that we use MariaDB as suffix
include/mysql/plugin.h
Changed types to 'const unsigned char* to get rid of compiler warnings (in other parts of the code)
Change length for not \0 terminated string to size_t
include/mysql/plugin.h.pp
Update related to plugin.h
libmysql/libmysql.c
Fixed bug that caused core dump with newer gcc when strict aliasing is not turned off
mysql-test/t/information_schema.test
Test is depending on innodb
mysql-test/t/not_partition.test
Fixed wrong directory name
(Not noticed before as we don't ususally run this test)
mysys/lf_hash.c
Got rid of compiler warnings from -Wstrict-aliasing
mysys/my_redel.c
Removed not used variable
regex/engine.c
Changed types to 'const char* to get rid of compiler warnings
regex/engine.ih
Changed types to 'const char* to get rid of compiler warnings
sql/sp_head.cc
Got rid of compiler warning from -Wstrict-aliasing
sql/sql_base.cc
Got rid of compiler warnings from -Wstrict-aliasing
(The original code was probably wrong as nj_col->table_field was
sql/sql_builtin.cc.in
plugin.h needs to have size_t defined
sql/sql_parse.cc
Remove used variable
sql/sql_select.cc
Got rid of compiler warnings from -Wstrict-aliasing
sql/sql_show.cc
Added #ifdef to get rid of compiler warning when not using partition engine
sql/table.cc
Got rid of compiler warning from -Wstrict-aliasing
storage/maria/ha_maria.cc
Got rid of compiler warnings from -Wstrict-aliasing:
- Use the thd_killed() API function
storage/maria/lockman.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/ma_check.c
Got rid of compiler warnings from -Wstrict-aliasing
Change to use new version of _ma_killed_ptr; Don't call it as often as before
storage/maria/ma_check_standalone.h
Update to compatible _ma_killed_ptr() from ha_maria.cc
storage/maria/ma_ft_boolean_search.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_ft_nlq_search.c
Got rid of compiler warnings from -Wstrict-aliasing
Ensure that 'subkeys' is 32 bit
storage/maria/ma_ft_parser.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_ftdefs.h
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_sort.c
Change to use new version of _ma_killed_ptr; Don't call it as often as before
storage/maria/ma_state.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/maria_def.h
Redefine ma_killed_ptr()
storage/maria/maria_ftdump.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/trnman.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/ft_boolean_search.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ft_nlq_search.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/ft_parser.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ft_stopwords.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ftdefs.h
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ha_myisam.cc
Got rid of compiler warnings from -Wstrict-aliasing:
- Use the thd_killed() API function
storage/myisam/mi_check.c
Use new killed_ptr() function
storage/myisam/myisam_ftdump.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/myisamchk.c
Update to compatible killed_ptr() from ha_myisam.cc
storage/myisam/myisamdef.h
Redefine killed_ptr()
storage/myisam/myisamlog.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/sort.c
Change to use new version of killed_ptr; Don't call it as often as before
storage/xtradb/fil/fil0fil.c
Fixedc ompiler warning
storage/xtradb/trx/trx0i_s.c
Include mysql_plugin.h later to ensure that size_t is defined
=== modified file 'BUILD/compile-pentium'
--- a/BUILD/compile-pentium 2007-04-11 12:12:00 +0000
+++ b/BUILD/compile-pentium 2009-11-29 23:08:56 +0000
@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $fast_cflags"
-extra_configs="$pentium_configs $static_link"
+extra_configs="$pentium_configs"
strip=yes
. "$path/FINISH.sh"
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c 2009-11-06 17:22:32 +0000
+++ b/client/mysql_upgrade.c 2009-11-29 23:08:56 +0000
@@ -552,7 +552,6 @@ static int upgrade_already_done(void)
FILE *in;
char upgrade_info_file[FN_REFLEN]= {0};
char buf[sizeof(MYSQL_SERVER_VERSION)+1];
- char *res;
if (get_upgrade_info_file_name(upgrade_info_file))
return 0; /* Could not get filename => not sure */
=== modified file 'cmd-line-utils/readline/config_readline.h'
--- a/cmd-line-utils/readline/config_readline.h 2005-04-20 10:02:07 +0000
+++ b/cmd-line-utils/readline/config_readline.h 2009-11-29 23:08:56 +0000
@@ -7,6 +7,11 @@
# include <config.h>
#endif
+/* to get wcwidth() defined */
+#define _XOPEN_SOURCE 600
+#define _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_
+
/*
Ultrix botches type-ahead when switching from canonical to
non-canonical mode, at least through version 4.3
=== modified file 'cmd-line-utils/readline/display.c'
--- a/cmd-line-utils/readline/display.c 2009-09-07 20:50:10 +0000
+++ b/cmd-line-utils/readline/display.c 2009-11-29 23:08:56 +0000
@@ -461,12 +461,12 @@ rl_redisplay ()
register char *line;
int inv_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, modmark;
- char *prompt_this_line;
+ const char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
- int num, n0;
+ int num, n0= 0;
wchar_t wc;
size_t wc_bytes;
- int wc_width;
+ int wc_width= 0;
mbstate_t ps;
int _rl_wrapped_multicolumn = 0;
#endif
@@ -824,7 +824,7 @@ rl_redisplay ()
cpos_buffer_position = out;
lb_linenum = newlines;
}
- for (i = in; i < in+wc_bytes; i++)
+ for (i = in; (size_t) i < in+wc_bytes; i++)
line[out++] = rl_line_buffer[i];
for (i = 0; i < wc_width; i++)
CHECK_LPOS();
=== modified file 'cmd-line-utils/readline/history.c'
--- a/cmd-line-utils/readline/history.c 2008-04-28 16:24:05 +0000
+++ b/cmd-line-utils/readline/history.c 2009-11-29 23:08:56 +0000
@@ -211,14 +211,14 @@ history_get (offset)
HIST_ENTRY *
alloc_history_entry (string, ts)
- char *string;
+ const char *string;
char *ts;
{
HIST_ENTRY *temp;
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
- temp->line = string ? savestring (string) : string;
+ temp->line = string ? savestring ((char*) string) : (char*) string;
temp->data = (char *)NULL;
temp->timestamp = ts;
=== modified file 'cmd-line-utils/readline/rlmbutil.h'
--- a/cmd-line-utils/readline/rlmbutil.h 2007-11-19 13:38:08 +0000
+++ b/cmd-line-utils/readline/rlmbutil.h 2009-11-29 23:08:56 +0000
@@ -109,8 +109,8 @@ extern int _rl_is_mbchar_matched PARAMS(
extern wchar_t _rl_char_value PARAMS((char *, int));
extern int _rl_walphabetic PARAMS((wchar_t));
-#define _rl_to_wupper(wc) (iswlower (wc) ? towupper (wc) : (wc))
-#define _rl_to_wlower(wc) (iswupper (wc) ? towlower (wc) : (wc))
+#define _rl_to_wupper(wc) (iswlower (wc) ? (wchar_t) towupper (wc) : (wc))
+#define _rl_to_wlower(wc) (iswupper (wc) ? (wchar_t) towlower (wc) : (wc))
#define MB_NEXTCHAR(b,s,c,f) \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) \
=== modified file 'cmd-line-utils/readline/text.c'
--- a/cmd-line-utils/readline/text.c 2009-09-07 20:50:10 +0000
+++ b/cmd-line-utils/readline/text.c 2009-11-29 23:08:56 +0000
@@ -614,7 +614,7 @@ rl_arrow_keys (count, c)
#ifdef HANDLE_MULTIBYTE
static char pending_bytes[MB_LEN_MAX];
static int pending_bytes_length = 0;
-static mbstate_t ps = {0};
+static mbstate_t ps;
#endif
/* Insert the character C at the current location, moving point forward.
=== modified file 'cmd-line-utils/readline/xmalloc.c'
--- a/cmd-line-utils/readline/xmalloc.c 2008-01-23 16:43:46 +0000
+++ b/cmd-line-utils/readline/xmalloc.c 2009-11-29 23:08:56 +0000
@@ -42,7 +42,7 @@
static void
memory_error_and_abort (fname)
- char *fname;
+ const char *fname;
{
fprintf (stderr, "%s: out of virtual memory\n", fname);
exit (2);
=== modified file 'configure.in'
--- a/configure.in 2009-11-07 15:56:51 +0000
+++ b/configure.in 2009-11-29 23:08:56 +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.39-maria-beta)
+AM_INIT_AUTOMAKE(mysql, 5.1.39-MariaDB-beta)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h 2009-09-07 20:50:10 +0000
+++ b/include/mysql/plugin.h 2009-11-29 23:08:56 +0000
@@ -567,9 +567,9 @@ typedef struct st_mysql_ftparser_boolean
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- char *doc, int doc_len);
+ const unsigned char *doc, size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- char *word, int word_len,
+ const unsigned char *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
=== modified file 'include/mysql/plugin.h.pp'
--- a/include/mysql/plugin.h.pp 2008-10-10 15:28:41 +0000
+++ b/include/mysql/plugin.h.pp 2009-11-29 23:08:56 +0000
@@ -73,9 +73,9 @@ typedef struct st_mysql_ftparser_boolean
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- char *doc, int doc_len);
+ const unsigned char *doc, size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- char *word, int word_len,
+ const unsigned char *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c 2009-11-06 17:22:32 +0000
+++ b/libmysql/libmysql.c 2009-11-29 23:08:56 +0000
@@ -2284,7 +2284,7 @@ mysql_stmt_param_metadata(MYSQL_STMT *st
/* Store type of parameter in network buffer. */
-static void store_param_type(char **pos, MYSQL_BIND *param)
+static void store_param_type(uchar **pos, MYSQL_BIND *param)
{
uint typecode= param->buffer_type | (param->is_unsigned ? 32768 : 0);
int2store(*pos, typecode);
@@ -2564,7 +2564,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
that is sent to the server.
*/
for (param= stmt->params; param < param_end ; param++)
- store_param_type((char**) &net->write_pos, param);
+ store_param_type(&net->write_pos, param);
}
for (param= stmt->params; param < param_end; param++)
=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test 2009-09-29 20:19:43 +0000
+++ b/mysql-test/t/information_schema.test 2009-11-29 23:08:56 +0000
@@ -5,6 +5,9 @@
# on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
+# Check that innodb/xtradb is incompiled in as result depends on it
+-- source include/have_innodb.inc
+
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
=== modified file 'mysql-test/t/not_partition.test'
--- a/mysql-test/t/not_partition.test 2009-01-08 14:16:44 +0000
+++ b/mysql-test/t/not_partition.test 2009-11-29 23:08:56 +0000
@@ -15,7 +15,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
# Bug#39893: Crash if select on a partitioned table,
# when partitioning is disabled
FLUSH TABLES;
---copy_file $MYSQLTEST_VARDIR/std_data_ln/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
+--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
SELECT * FROM t1;
TRUNCATE TABLE t1;
ANALYZE TABLE t1;
=== modified file 'mysys/lf_hash.c'
--- a/mysys/lf_hash.c 2009-01-15 21:27:36 +0000
+++ b/mysys/lf_hash.c 2009-11-29 23:08:56 +0000
@@ -124,8 +124,8 @@ retry:
we found a deleted node - be nice, help the other thread
and remove this deleted node
*/
- if (my_atomic_casptr((void **)cursor->prev,
- (void **)&cursor->curr, cursor->next))
+ if (my_atomic_casptr((void **) cursor->prev,
+ (void **)(char*) &cursor->curr, cursor->next))
_lf_alloc_free(pins, cursor->curr);
else
{
@@ -171,7 +171,8 @@ static LF_SLIST *linsert(LF_SLIST * vola
node->link= (intptr)cursor.curr;
DBUG_ASSERT(node->link != (intptr)node); /* no circular references */
DBUG_ASSERT(cursor.prev != &node->link); /* no circular references */
- if (my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+ if (my_atomic_casptr((void **) cursor.prev,
+ (void **)(char*) &cursor.curr, node))
{
res= 1; /* inserted ok */
break;
@@ -218,13 +219,13 @@ static int ldelete(LF_SLIST * volatile *
else
{
/* mark the node deleted */
- if (my_atomic_casptr((void **)&(cursor.curr->link),
- (void **)&cursor.next,
+ if (my_atomic_casptr((void **) (char*) &(cursor.curr->link),
+ (void **) (char*) &cursor.next,
(void *)(((intptr)cursor.next) | 1)))
{
/* and remove it from the list */
if (my_atomic_casptr((void **)cursor.prev,
- (void **)&cursor.curr, cursor.next))
+ (void **)(char*)&cursor.curr, cursor.next))
_lf_alloc_free(pins, cursor.curr);
else
{
@@ -493,7 +494,7 @@ static int initialize_bucket(LF_HASH *ha
my_free((void *)dummy, MYF(0));
dummy= cur;
}
- my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+ my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
/*
note that if the CAS above failed (after linsert() succeeded),
it would mean that some other thread has executed linsert() for
=== modified file 'mysys/my_redel.c'
--- a/mysys/my_redel.c 2009-11-06 17:22:32 +0000
+++ b/mysys/my_redel.c 2009-11-29 23:08:56 +0000
@@ -77,9 +77,6 @@ end:
int my_copystat(const char *from, const char *to, int MyFlags)
{
struct stat statbuf;
-#if !defined(__WIN__) && !defined(__NETWARE__)
- int res;
-#endif
if (stat((char*) from, &statbuf))
{
=== modified file 'regex/engine.c'
--- a/regex/engine.c 2005-09-29 01:20:31 +0000
+++ b/regex/engine.c 2009-11-29 23:08:56 +0000
@@ -33,11 +33,11 @@ struct match {
struct re_guts *g;
int eflags;
my_regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
+ const char *offp; /* offsets work from here */
+ const char *beginp; /* start of string -- virtual NUL precedes */
+ const char *endp; /* end of string -- virtual NUL here */
+ const char *coldp; /* can be no match starting before here */
+ const char **lastpos; /* [nplus+1] */
STATEVARS;
states st; /* current states */
states fresh; /* states for a fresh start */
@@ -66,20 +66,20 @@ static int /* 0 success, REG_NOMATCH f
matcher(charset,g, str, nmatch, pmatch, eflags)
CHARSET_INFO *charset;
register struct re_guts *g;
-char *str;
+const char *str;
size_t nmatch;
my_regmatch_t pmatch[];
int eflags;
{
- register char *endp;
+ register const char *endp;
register uint i;
struct match mv;
register struct match *m = &mv;
- register char *dp;
+ register const char *dp;
register const sopno gf = g->firststate+1; /* +1 for OEND */
register const sopno gl = g->laststate;
- char *start;
- char *stop;
+ const char *start;
+ const char *stop;
/* simplify the situation where possible */
if (g->cflags®_NOSUB)
@@ -163,7 +163,7 @@ int eflags;
dp = dissect(charset, m, m->coldp, endp, gf, gl);
} else {
if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
+ m->lastpos = (const char **)malloc((g->nplus+1) *
sizeof(char *));
if (g->nplus > 0 && m->lastpos == NULL) {
free(m->pmatch);
@@ -235,28 +235,28 @@ int eflags;
== static char *dissect(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* == stop (success) always */
+static const char * /* == stop (success) always */
dissect(charset, m, start, stop, startst, stopst)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
{
register uint i;
register sopno ss; /* start sop of current subRE */
register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
+ register const char *sp; /* start of string matched by it */
+ register const char *stp; /* string matched by it cannot pass here */
+ register const char *rest; /* start of rest of string */
+ register const char *tail; /* string unmatched by rest of RE */
register sopno ssub; /* start sop of subsubRE */
register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp; /* used in debug mode to check asserts */
+ register const char *ssp; /* start of string matched by subsubRE */
+ register const char *sep; /* end of string matched by subsubRE */
+ register const char *oldssp; /* previous ssp */
+ register const char *dp; /* used in debug mode to check asserts */
AT("diss", start, stop, startst, stopst);
sp = start;
@@ -424,23 +424,23 @@ sopno stopst;
== static char *backref(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst, sopno lev);
*/
-static char * /* == stop (success) or NULL (failure) */
+static const char * /* == stop (success) or NULL (failure) */
backref(charset,m, start, stop, startst, stopst, lev)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
sopno lev; /* PLUS nesting level */
{
register uint i;
register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
+ register const char *sp; /* start of string matched by it */
register sopno ssub; /* start sop of subsubRE */
register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
+ register const char *ssp; /* start of string matched by subsubRE */
+ register const char *dp;
register size_t len;
register int hard;
register sop s;
@@ -630,24 +630,24 @@ sopno lev; /* PLUS nesting level */
== static char *fast(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* where tentative match ended, or NULL */
+static const char * /* where tentative match ended, or NULL */
fast(charset, m, start, stop, startst, stopst)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
{
register states st = m->st;
register states fresh = m->fresh;
register states tmp = m->tmp;
- register char *p = start;
+ register const char *p = start;
register int c = (start == m->beginp) ? OUT : *(start-1);
register int lastc; /* previous c */
register int flagch;
register int i;
- register char *coldp; /* last p after which no match was underway */
+ register const char *coldp; /* last p after which no match was underway */
CLEAR(st);
SET1(st, startst);
@@ -722,24 +722,24 @@ sopno stopst;
== static char *slow(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* where it ended */
+static const char * /* where it ended */
slow(charset, m, start, stop, startst, stopst)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
{
register states st = m->st;
register states empty = m->empty;
register states tmp = m->tmp;
- register char *p = start;
+ register const char *p = start;
register int c = (start == m->beginp) ? OUT : *(start-1);
register int lastc; /* previous c */
register int flagch;
register int i;
- register char *matchp; /* last p at which a match ended */
+ register const char *matchp; /* last p at which a match ended */
AT("slow", start, stop, startst, stopst);
CLEAR(st);
=== modified file 'regex/engine.ih'
--- a/regex/engine.ih 2005-09-29 00:08:24 +0000
+++ b/regex/engine.ih 2009-11-29 23:08:56 +0000
@@ -4,11 +4,11 @@ extern "C" {
#endif
/* === engine.c === */
-static int matcher(CHARSET_INFO *charset,register struct re_guts *g, char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
-static char *dissect(CHARSET_INFO *charset,register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
+static int matcher(CHARSET_INFO *charset,register struct re_guts *g, const char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
+static const char *dissect(CHARSET_INFO *charset,register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *backref(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev);
+static const char *fast(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *slow(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
#define BOL (OUT+1)
#define EOL (BOL+1)
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2009-09-15 10:46:35 +0000
+++ b/sql/sp_head.cc 2009-11-29 23:08:56 +0000
@@ -1924,9 +1924,10 @@ sp_head::execute_procedure(THD *thd, Lis
if (spvar->mode == sp_param_out)
{
Item_null *null_item= new Item_null();
+ Item *tmp_item= (Item*) null_item;
if (!null_item ||
- nctx->set_variable(thd, i, (Item **)&null_item))
+ nctx->set_variable(thd, i, &tmp_item))
{
err_status= TRUE;
break;
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_base.cc 2009-11-29 23:08:56 +0000
@@ -5823,6 +5823,7 @@ find_field_in_natural_join(THD *thd, TAB
{
/* This is a base table. */
DBUG_ASSERT(nj_col->view_field == NULL);
+ Item *ref= 0;
/*
This fix_fields is not necessary (initially this item is fixed by
the Item_field constructor; after reopen_tables the Item_func_eq
@@ -5830,12 +5831,13 @@ find_field_in_natural_join(THD *thd, TAB
reopening for columns that was dropped by the concurrent connection.
*/
if (!nj_col->table_field->fixed &&
- nj_col->table_field->fix_fields(thd, (Item **)&nj_col->table_field))
+ nj_col->table_field->fix_fields(thd, &ref))
{
DBUG_PRINT("info", ("column '%s' was dropped by the concurrent connection",
nj_col->table_field->name));
DBUG_RETURN(NULL);
}
+ DBUG_ASSERT(ref == 0); // Should not have changed
DBUG_ASSERT(nj_col->table_ref->table == nj_col->table_field->field->table);
found_field= nj_col->table_field->field;
update_field_dependencies(thd, found_field, nj_col->table_ref->table);
=== modified file 'sql/sql_builtin.cc.in'
--- a/sql/sql_builtin.cc.in 2006-12-31 01:29:11 +0000
+++ b/sql/sql_builtin.cc.in 2009-11-29 23:08:56 +0000
@@ -13,6 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include <my_global.h>
#include <mysql/plugin.h>
typedef struct st_mysql_plugin builtin_plugin[];
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2009-11-06 17:22:32 +0000
+++ b/sql/sql_parse.cc 2009-11-29 23:08:56 +0000
@@ -464,7 +464,7 @@ pthread_handler_t handle_bootstrap(void
thd->init_for_queries();
while (fgets(buff, thd->net.max_packet, file))
{
- char *query, *res;
+ char *query;
/* strlen() can't be deleted because fgets() doesn't return length */
ulong length= (ulong) strlen(buff);
while (buff[length-1] != '\n' && !feof(file))
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-11-06 17:22:32 +0000
+++ b/sql/sql_select.cc 2009-11-29 23:08:56 +0000
@@ -3586,8 +3586,9 @@ add_key_fields(JOIN *join, KEY_FIELD **k
{
if (!field->eq(item->field))
{
+ Item *tmp_item= (Item*) item;
add_key_field(key_fields, *and_level, cond_func, field,
- TRUE, (Item **) &item, 1, usable_tables,
+ TRUE, &tmp_item, 1, usable_tables,
sargables);
}
}
@@ -15748,7 +15749,11 @@ static bool add_ref_to_table_cond(THD *t
DBUG_RETURN(TRUE);
if (!cond->fixed)
- cond->fix_fields(thd, (Item**)&cond);
+ {
+ Item *tmp_item= (Item*) cond;
+ cond->fix_fields(thd, &tmp_item);
+ DBUG_ASSERT(cond == tmp_item);
+ }
if (join_tab->select)
{
error=(int) cond->add(join_tab->select->cond);
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2009-11-26 20:19:33 +0000
+++ b/sql/sql_show.cc 2009-11-29 23:08:56 +0000
@@ -3551,7 +3551,9 @@ static int get_schema_tables_record(THD
TABLE_SHARE *share= show_table->s;
handler *file= show_table->file;
handlerton *tmp_db_type= share->db_type();
+#ifdef WITH_PARTITION_STORAGE_ENGINE
bool is_partitioned= FALSE;
+#endif
if (share->tmp_table == SYSTEM_TMP_TABLE)
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
else if (share->tmp_table)
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2009-10-15 21:38:29 +0000
+++ b/sql/table.cc 2009-11-29 23:08:56 +0000
@@ -2077,8 +2077,9 @@ ulong get_form_pos(File file, uchar *hea
else
{
char *str;
+ const char **tmp = (const char**) (char*) buf;
str=(char *) (buf+a_length);
- fix_type_pointers((const char ***) &buf,save_names,1,&str);
+ fix_type_pointers(&tmp, save_names, 1, &str);
}
DBUG_RETURN(ret_value);
}
=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc 2009-11-07 10:34:19 +0000
+++ b/storage/maria/ha_maria.cc 2009-11-29 23:08:56 +0000
@@ -665,10 +665,9 @@ int maria_check_definition(MARIA_KEYDEF
extern "C" {
-volatile int *_ma_killed_ptr(HA_CHECK *param)
+int _ma_killed_ptr(HA_CHECK *param)
{
- /* In theory Unsafe conversion, but should be ok for now */
- return (int*) &(((THD *) (param->thd))->killed);
+ return thd_killed((THD*)param->thd);
}
=== modified file 'storage/maria/lockman.c'
--- a/storage/maria/lockman.c 2008-02-21 00:51:51 +0000
+++ b/storage/maria/lockman.c 2009-11-29 23:08:56 +0000
@@ -360,7 +360,7 @@ retry:
else
{
if (my_atomic_casptr((void **)cursor->prev,
- (void **)&cursor->curr, cursor->next))
+ (void **)(char*) &cursor->curr, cursor->next))
_lf_alloc_free(pins, cursor->curr);
else
{
@@ -421,7 +421,8 @@ static int lockinsert(LOCK * volatile *h
node->link= (intptr)cursor.curr;
DBUG_ASSERT(node->link != (intptr)node);
DBUG_ASSERT(cursor.prev != &node->link);
- if (!my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+ if (!my_atomic_casptr((void **)cursor.prev,
+ (void **)(char*) &cursor.curr, node))
{
res= REPEAT_ONCE_MORE;
node->flags&= ~ACTIVE;
@@ -498,11 +499,11 @@ static int lockdelete(LOCK * volatile *h
then we can delete. Good news is - this is only required when rolling
back a savepoint.
*/
- if (my_atomic_casptr((void **)&(cursor.curr->link),
- (void **)&cursor.next, 1+(char *)cursor.next))
+ if (my_atomic_casptr((void **)(char*)&(cursor.curr->link),
+ (void **)(char*)&cursor.next, 1+(char *)cursor.next))
{
if (my_atomic_casptr((void **)cursor.prev,
- (void **)&cursor.curr, cursor.next))
+ (void **)(char*)&cursor.curr, cursor.next))
_lf_alloc_free(pins, cursor.curr);
else
lockfind(head, node, &cursor, pins);
@@ -573,7 +574,7 @@ static void initialize_bucket(LOCKMAN *l
my_free((void *)dummy, MYF(0));
dummy= cur;
}
- my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+ my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
}
static inline uint calc_hash(uint64 resource)
=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c 2009-05-06 12:03:24 +0000
+++ b/storage/maria/ma_check.c 2009-11-29 23:08:56 +0000
@@ -215,7 +215,7 @@ int maria_chk_del(HA_CHECK *param, regis
empty=0;
for (i= share->state.state.del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(1);
if (test_flag & T_VERBOSE)
printf(" %9s",llstr(next_link,buff));
@@ -310,7 +310,7 @@ static int check_k_link(HA_CHECK *param,
records= (ha_rows) (share->state.state.key_file_length / block_size);
while (next_link != HA_OFFSET_ERROR && records > 0)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(1);
if (param->testflag & T_VERBOSE)
printf("%16s",llstr(next_link,llbuff));
@@ -876,10 +876,10 @@ static int chk_index(HA_CHECK *param, MA
tmp_key.data= tmp_key_buff;
for ( ;; )
{
- if (*_ma_killed_ptr(param))
- goto err;
if (nod_flag)
{
+ if (_ma_killed_ptr(param))
+ goto err;
next_page= _ma_kpos(nod_flag,keypos);
if (chk_index_down(param,info,keyinfo,next_page,
temp_buff,keys,key_checksum,level+1))
@@ -1180,7 +1180,7 @@ static int check_static_record(HA_CHECK
pos= 0;
while (pos < share->state.state.data_file_length)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
return -1;
if (my_b_read(¶m->read_cache, record,
share->base.pack_reclength))
@@ -1230,7 +1230,7 @@ static int check_dynamic_record(HA_CHECK
{
my_bool got_error= 0;
int flag;
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(-1);
flag= block_info.second_read=0;
@@ -1451,7 +1451,7 @@ static int check_compressed_record(HA_CH
pos= share->pack.header_length; /* Skip header */
while (pos < share->state.state.data_file_length)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(-1);
if (_ma_read_cache(¶m->read_cache, block_info.header, pos,
@@ -1815,7 +1815,7 @@ static int check_block_record(HA_CHECK *
LINT_INIT(row_count);
LINT_INIT(empty_space);
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
{
_ma_scan_end_block_record(info);
return -1;
@@ -4631,7 +4631,7 @@ static int sort_get_next_record(MARIA_SO
char llbuff[22],llbuff2[22];
DBUG_ENTER("sort_get_next_record");
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(1);
switch (sort_info->org_data_file_type) {
=== modified file 'storage/maria/ma_check_standalone.h'
--- a/storage/maria/ma_check_standalone.h 2007-10-03 16:10:32 +0000
+++ b/storage/maria/ma_check_standalone.h 2009-11-29 23:08:56 +0000
@@ -30,11 +30,9 @@
Check if check/repair operation was killed by a signal
*/
-static int not_killed= 0;
-
-volatile int *_ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
+int _ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
{
- return ¬_killed; /* always NULL */
+ return 0;
}
/* print warnings and errors */
=== modified file 'storage/maria/ma_ft_boolean_search.c'
--- a/storage/maria/ma_ft_boolean_search.c 2009-02-19 09:01:25 +0000
+++ b/storage/maria/ma_ft_boolean_search.c 2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- char *query, int len)
+ const uchar *query, size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
- uchar **start= (uchar**) &query;
- uchar *end= (uchar*) query + len;
+ const uchar **start= &query;
+ const uchar *end= query + len;
FT_WORD w;
info.prev= ' ';
info.quot= 0;
while (maria_ft_get_word(cs, start, end, &w, &info))
- param->mysql_add_word(param, (char *) w.pos, w.len, &info);
+ param->mysql_add_word(param, w.pos, w.len, &info);
return(0);
}
@@ -615,7 +615,7 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -647,15 +647,15 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- char *document, int len)
+ const uchar *document, size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
- const uchar *docend= (uchar*) document + len;
- while (maria_ft_simple_get_word(phrase_param->cs, (uchar**) &document,
+ const uchar *docend= document + len;
+ while (maria_ft_simple_get_word(phrase_param->cs, &document,
docend, &word, FALSE))
{
- param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+ param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match)
break;
}
@@ -872,7 +872,7 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int len,
+ const uchar *word, size_t len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -933,15 +933,14 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- char *doc, int len)
+ const uchar *doc, size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
- uchar *end= (uchar*) doc + len;
+ const uchar *end= doc + len;
FT_WORD w;
- while (maria_ft_simple_get_word(ftb->charset, (uchar**) &doc,
- end, &w, TRUE))
- param->mysql_add_word(param, (char *) w.pos, w.len, 0);
+ while (maria_ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+ param->mysql_add_word(param, w.pos, w.len, 0);
return(0);
}
=== modified file 'storage/maria/ma_ft_nlq_search.c'
--- a/storage/maria/ma_ft_nlq_search.c 2009-01-09 04:23:25 +0000
+++ b/storage/maria/ma_ft_nlq_search.c 2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int subkeys, r;
+ int32 subkeys;
+ int r;
uint doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
@@ -127,7 +128,7 @@ static int walk_and_match(FT_WORD *word,
goto do_skip;
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
- tmp_weight=*(float*)&subkeys;
+ tmp_weight=*(float*) (char*) &subkeys;
#else
#error
#endif
=== modified file 'storage/maria/ma_ft_parser.c'
--- a/storage/maria/ma_ft_parser.c 2009-02-19 09:01:25 +0000
+++ b/storage/maria/ma_ft_parser.c 2009-11-29 23:08:56 +0000
@@ -109,10 +109,11 @@ my_bool maria_ft_boolean_check_syntax_st
3 - right bracket
4 - stopword found
*/
-uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar maria_ft_get_word(CHARSET_INFO *cs, const uchar **start,
+ const uchar *end,
FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{
- uchar *doc=*start;
+ const uchar *doc= *start;
int ctype;
uint mwc, length;
int mbl;
@@ -203,11 +204,11 @@ ret:
return param->type;
}
-uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
+uchar maria_ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
const uchar *end, FT_WORD *word,
my_bool skip_stopwords)
{
- uchar *doc= *start;
+ const uchar *doc= *start;
uint mwc, length;
int ctype, mbl;
DBUG_ENTER("maria_ft_simple_get_word");
@@ -259,8 +260,9 @@ void maria_ft_parse_init(TREE *wtree, CH
static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+ __attribute__((unused)))
{
TREE *wtree;
FT_WORD w;
@@ -276,7 +278,7 @@ static int maria_ft_add_word(MYSQL_FTPAR
w.pos= ptr;
}
else
- w.pos= (uchar *) word;
+ w.pos= word;
w.len= word_len;
if (!tree_insert(wtree, &w, 0, wtree->custom_arg))
{
@@ -288,17 +290,17 @@ static int maria_ft_add_word(MYSQL_FTPAR
static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- char *doc_arg, int doc_len)
+ const uchar *doc_arg, size_t doc_len)
{
- uchar *doc= (uchar*) doc_arg;
- uchar *end= doc + doc_len;
+ const uchar *doc= doc_arg;
+ const uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
DBUG_ENTER("maria_ft_parse_internal");
while (maria_ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE))
- if (param->mysql_add_word(param, (char *) w.pos, w.len, 0))
+ if (param->mysql_add_word(param, w.pos, w.len, 0))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
@@ -378,7 +380,7 @@ MYSQL_FTPARSER_PARAM *maria_ftparser_cal
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, char *, int,
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
=== modified file 'storage/maria/ma_ftdefs.h'
--- a/storage/maria/ma_ftdefs.h 2009-02-12 17:51:00 +0000
+++ b/storage/maria/ma_ftdefs.h 2009-11-29 23:08:56 +0000
@@ -96,7 +96,7 @@
#define FTB_RQUOT (ft_boolean_syntax[11])
typedef struct st_maria_ft_word {
- uchar * pos;
+ const uchar * pos;
uint len;
double weight;
} FT_WORD;
@@ -106,9 +106,9 @@ int is_stopword(char *word, uint len);
MARIA_KEY *_ma_ft_make_key(MARIA_HA *, MARIA_KEY *, uint , uchar *, FT_WORD *,
my_off_t);
-uchar maria_ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
- MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar maria_ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar maria_ft_get_word(CHARSET_INFO *, const uchar **, const uchar *,
+ FT_WORD *, MYSQL_FTPARSER_BOOLEAN_INFO *);
+uchar maria_ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
FT_WORD *, my_bool);
typedef struct _st_maria_ft_seg_iterator {
=== modified file 'storage/maria/ma_sort.c'
--- a/storage/maria/ma_sort.c 2009-01-09 04:23:25 +0000
+++ b/storage/maria/ma_sort.c 2009-11-29 23:08:56 +0000
@@ -920,7 +920,6 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
uchar *strpos;
BUFFPEK *buffpek,**refpek;
QUEUE queue;
- volatile int *killed= _ma_killed_ptr(info->sort_info->param);
DBUG_ENTER("merge_buffers");
count=error=0;
@@ -953,10 +952,6 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
{
for (;;)
{
- if (*killed)
- {
- error=1; goto err;
- }
buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file)
{
@@ -976,6 +971,12 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
buffpek->key+=sort_length;
if (! --buffpek->mem_count)
{
+ /* It's enough to check for killedptr before a slow operation */
+ if (_ma_killed_ptr(info->sort_info->param))
+ {
+ error=1;
+ goto err;
+ }
if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
{
uchar *base= buffpek->base;
=== modified file 'storage/maria/ma_state.c'
--- a/storage/maria/ma_state.c 2009-10-06 06:57:22 +0000
+++ b/storage/maria/ma_state.c 2009-11-29 23:08:56 +0000
@@ -528,7 +528,7 @@ void _ma_remove_table_from_trnman(MARIA_
safe_mutex_assert_owner(&share->intern_lock);
- for (prev= (MARIA_USED_TABLES**) &trn->used_tables, tables= *prev;
+ for (prev= (MARIA_USED_TABLES**) (char*) &trn->used_tables, tables= *prev;
tables;
tables= *prev)
{
=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h 2009-10-06 06:57:22 +0000
+++ b/storage/maria/maria_def.h 2009-11-29 23:08:56 +0000
@@ -1160,7 +1160,7 @@ int _ma_flush_table_files(MARIA_HA *info
Functions needed by _ma_check (are overridden in MySQL/ha_maria.cc).
See ma_check_standalone.h .
*/
-volatile int *_ma_killed_ptr(HA_CHECK *param);
+int _ma_killed_ptr(HA_CHECK *param);
void _ma_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...))
ATTRIBUTE_FORMAT(printf, 2, 3);
void _ma_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...))
=== modified file 'storage/maria/maria_ftdump.c'
--- a/storage/maria/maria_ftdump.c 2008-08-25 11:49:47 +0000
+++ b/storage/maria/maria_ftdump.c 2009-11-29 23:08:56 +0000
@@ -116,7 +116,7 @@ int main(int argc,char *argv[])
subkeys=ft_sintXkorr(info->lastkey_buff + keylen + 1);
if (subkeys >= 0)
- weight=*(float*)&subkeys;
+ weight=*(float*) (char*) &subkeys;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);
=== modified file 'storage/maria/trnman.c'
--- a/storage/maria/trnman.c 2009-03-05 13:46:45 +0000
+++ b/storage/maria/trnman.c 2009-11-29 23:08:56 +0000
@@ -300,8 +300,8 @@ TRN *trnman_new_trn(WT_THD *wt)
(ABA isn't possible, we're behind a mutex
*/
my_atomic_rwlock_wrlock(&LOCK_pool);
- while (tmp.trn && !my_atomic_casptr((void **)&pool, &tmp.v,
- (void *)tmp.trn->next))
+ while (tmp.trn && !my_atomic_casptr((void **)(char*) &pool, &tmp.v,
+ (void *)tmp.trn->next))
/* no-op */;
my_atomic_rwlock_wrunlock(&LOCK_pool);
@@ -545,7 +545,7 @@ static void trnman_free_trn(TRN *trn)
down after the loop at -O2
*/
*(TRN * volatile *)&(trn->next)= tmp.trn;
- } while (!my_atomic_casptr((void **)&pool, &tmp.v, trn));
+ } while (!my_atomic_casptr((void **)(char*)&pool, &tmp.v, trn));
my_atomic_rwlock_wrunlock(&LOCK_pool);
}
=== modified file 'storage/myisam/ft_boolean_search.c'
--- a/storage/myisam/ft_boolean_search.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/ft_boolean_search.c 2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- char *query, int len)
+ const uchar *query, size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
- uchar **start= (uchar**) &query;
- uchar *end= (uchar*) query + len;
+ const uchar **start= &query;
+ const uchar *end= query + len;
FT_WORD w;
info.prev= ' ';
info.quot= 0;
while (ft_get_word(cs, start, end, &w, &info))
- param->mysql_add_word(param, (char*) w.pos, w.len, &info);
+ param->mysql_add_word(param, w.pos, w.len, &info);
return(0);
}
@@ -616,7 +616,7 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -648,15 +648,15 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- char *document, int len)
+ const uchar *document, size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
const uchar *docend= (uchar*) document + len;
- while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend,
+ while (ft_simple_get_word(phrase_param->cs, &document, docend,
&word, FALSE))
{
- param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+ param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match)
break;
}
@@ -874,7 +874,7 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int len,
+ const uchar *word, size_t len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -888,8 +888,8 @@ static int ftb_find_relevance_add_word(M
for (a= 0, b= ftb->queue.elements, c= (a+b)/2; b-a>1; c= (a+b)/2)
{
ftbw= ftb->list[c];
- if (ha_compare_text(ftb->charset, (uchar*)word, len,
- (uchar*)ftbw->word+1, ftbw->len-1,
+ if (ha_compare_text(ftb->charset, word, len,
+ ftbw->word+1, ftbw->len-1,
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0)
b= c;
else
@@ -915,8 +915,8 @@ static int ftb_find_relevance_add_word(M
for (; c >= 0; c--)
{
ftbw= ftb->list[c];
- if (ha_compare_text(ftb->charset, (uchar*)word, len,
- (uchar*)ftbw->word + 1,ftbw->len - 1,
+ if (ha_compare_text(ftb->charset, word, len,
+ ftbw->word + 1,ftbw->len - 1,
(my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0))
{
if (ftb->with_scan & FTB_FLAG_TRUNC)
@@ -935,14 +935,14 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- char *doc, int len)
+ const uchar *doc, size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
- uchar *end= (uchar*) doc + len;
+ const uchar *end= doc + len;
FT_WORD w;
- while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
- param->mysql_add_word(param, (char*) w.pos, w.len, 0);
+ while (ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+ param->mysql_add_word(param, w.pos, w.len, 0);
return(0);
}
=== modified file 'storage/myisam/ft_nlq_search.c'
--- a/storage/myisam/ft_nlq_search.c 2008-04-28 16:24:05 +0000
+++ b/storage/myisam/ft_nlq_search.c 2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int subkeys, r;
+ int32 subkeys;
+ int r;
uint keylen, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
@@ -123,7 +124,8 @@ static int walk_and_match(FT_WORD *word,
goto do_skip;
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
- tmp_weight=*(float*)&subkeys;
+ /* The weight we read was actually a float */
+ tmp_weight=*(float*) (char*) &subkeys;
#else
#error
#endif
=== modified file 'storage/myisam/ft_parser.c'
--- a/storage/myisam/ft_parser.c 2009-02-12 14:08:56 +0000
+++ b/storage/myisam/ft_parser.c 2009-11-29 23:08:56 +0000
@@ -106,10 +106,10 @@ my_bool ft_boolean_check_syntax_string(c
3 - right bracket
4 - stopword found
*/
-uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end,
FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{
- uchar *doc=*start;
+ const uchar *doc= *start;
int ctype;
uint mwc, length;
int mbl;
@@ -201,10 +201,11 @@ ret:
return param->type;
}
-uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
- FT_WORD *word, my_bool skip_stopwords)
+uchar ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
+ const uchar *end, FT_WORD *word,
+ my_bool skip_stopwords)
{
- uchar *doc= *start;
+ const uchar *doc= *start;
uint mwc, length;
int mbl;
int ctype;
@@ -216,7 +217,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
{
if (doc >= end)
DBUG_RETURN(0);
- mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+ mbl= cs->cset->ctype(cs, &ctype, doc, end);
if (true_word_char(ctype, *doc))
break;
}
@@ -225,7 +226,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
for (word->pos= doc; doc < end; length++,
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
{
- mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+ mbl= cs->cset->ctype(cs, &ctype, doc, end);
if (true_word_char(ctype, *doc))
mwc= 0;
else if (!misc_word_char(*doc) || mwc)
@@ -238,7 +239,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
if (skip_stopwords == FALSE ||
(length >= ft_min_word_len && length < ft_max_word_len &&
- !is_stopword((char*) word->pos, word->len)))
+ !is_stopword(word->pos, word->len)))
{
*start= doc;
DBUG_RETURN(1);
@@ -257,8 +258,9 @@ void ft_parse_init(TREE *wtree, CHARSET_
static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+ __attribute__((unused)))
{
TREE *wtree;
FT_WORD w;
@@ -286,10 +288,10 @@ static int ft_add_word(MYSQL_FTPARSER_PA
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- char *doc_arg, int doc_len)
+ const uchar *doc_arg, size_t doc_len)
{
- uchar *doc= (uchar*) doc_arg;
- uchar *end= doc + doc_len;
+ const uchar *doc= doc_arg;
+ const uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
@@ -302,7 +304,7 @@ static int ft_parse_internal(MYSQL_FTPAR
}
-int ft_parse(TREE *wtree, uchar *doc, int doclen,
+int ft_parse(TREE *wtree, const uchar *doc, int doclen,
struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
@@ -377,7 +379,7 @@ MYSQL_FTPARSER_PARAM *ftparser_call_init
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, char *, int,
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
=== modified file 'storage/myisam/ft_stopwords.c'
--- a/storage/myisam/ft_stopwords.c 2008-04-28 16:24:05 +0000
+++ b/storage/myisam/ft_stopwords.c 2009-11-29 23:08:56 +0000
@@ -66,7 +66,8 @@ int ft_init_stopwords()
{
File fd;
uint len;
- uchar *buffer, *start, *end;
+ uchar *buffer;
+ const uchar *start, *end;
FT_WORD w;
int error=-1;
@@ -109,7 +110,7 @@ err0:
}
-int is_stopword(char *word, uint len)
+int is_stopword(const uchar *word, size_t len)
{
FT_STOPWORD sw;
sw.pos=word;
=== modified file 'storage/myisam/ftdefs.h'
--- a/storage/myisam/ftdefs.h 2009-01-26 06:35:15 +0000
+++ b/storage/myisam/ftdefs.h 2009-11-29 23:08:56 +0000
@@ -96,18 +96,18 @@
#define FTB_RQUOT (ft_boolean_syntax[11])
typedef struct st_ft_word {
- uchar * pos;
+ const uchar *pos;
uint len;
double weight;
} FT_WORD;
-int is_stopword(char *word, uint len);
+int is_stopword(const uchar *word, size_t len);
uint _ft_make_key(MI_INFO *, uint , uchar *, FT_WORD *, my_off_t);
-uchar ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
+uchar ft_get_word(CHARSET_INFO *, const uchar **, const uchar *, FT_WORD *,
MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
FT_WORD *, my_bool);
typedef struct _st_ft_seg_iterator {
@@ -121,7 +121,7 @@ void _mi_ft_segiterator_dummy_init(const
uint _mi_ft_segiterator(FT_SEG_ITERATOR *);
void ft_parse_init(TREE *, CHARSET_INFO *);
-int ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
+int ft_parse(TREE *, const uchar *, int, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * ft_linearize(TREE *, MEM_ROOT *);
FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const uchar *, MEM_ROOT *);
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2009-10-06 14:53:46 +0000
+++ b/storage/myisam/ha_myisam.cc 2009-11-29 23:08:56 +0000
@@ -497,10 +497,9 @@ int check_definition(MI_KEYDEF *t1_keyin
extern "C" {
-volatile int *killed_ptr(HA_CHECK *param)
+int killed_ptr(HA_CHECK *param)
{
- /* In theory Unsafe conversion, but should be ok for now */
- return (int*) &(((THD *)(param->thd))->killed);
+ return thd_killed((THD*)param->thd);
}
void mi_check_print_error(HA_CHECK *param, const char *fmt,...)
=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/mi_check.c 2009-11-29 23:08:56 +0000
@@ -166,7 +166,7 @@ int chk_del(HA_CHECK *param, register MI
empty=0;
for (i= info->state->del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
DBUG_RETURN(1);
if (test_flag & T_VERBOSE)
printf(" %9s",llstr(next_link,buff));
@@ -261,7 +261,7 @@ static int check_k_link(HA_CHECK *param,
records= (ha_rows) (info->state->key_file_length / block_size);
while (next_link != HA_OFFSET_ERROR && records > 0)
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
DBUG_RETURN(1);
if (param->testflag & T_VERBOSE)
printf("%16s",llstr(next_link,llbuff));
@@ -778,7 +778,7 @@ static int chk_index(HA_CHECK *param, MI
}
for ( ;; )
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
goto err;
memcpy((char*) info->lastkey,(char*) key,key_length);
info->lastkey_length=key_length;
@@ -990,7 +990,7 @@ int chk_data_link(HA_CHECK *param, MI_IN
bzero((char*) key_checksum, info->s->base.keys * sizeof(key_checksum[0]));
while (pos < info->state->data_file_length)
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
goto err2;
switch (info->s->data_file_type) {
case BLOCK_RECORD:
@@ -3247,7 +3247,7 @@ static int sort_get_next_record(MI_SORT_
char llbuff[22],llbuff2[22];
DBUG_ENTER("sort_get_next_record");
- if (*killed_ptr(param))
+ if (killed_ptr(param))
DBUG_RETURN(1);
switch (share->data_file_type) {
=== modified file 'storage/myisam/myisam_ftdump.c'
--- a/storage/myisam/myisam_ftdump.c 2007-05-10 09:59:39 +0000
+++ b/storage/myisam/myisam_ftdump.c 2009-11-29 23:08:56 +0000
@@ -113,7 +113,7 @@ int main(int argc,char *argv[])
subkeys=ft_sintXkorr(info->lastkey+keylen+1);
if (subkeys >= 0)
- weight=*(float*)&subkeys;
+ weight= *(float*) (char*) &subkeys;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c 2009-09-19 21:21:29 +0000
+++ b/storage/myisam/myisamchk.c 2009-11-29 23:08:56 +0000
@@ -1745,11 +1745,9 @@ err:
sorting
*/
-static int not_killed= 0;
-
-volatile int *killed_ptr(HA_CHECK *param __attribute__((unused)))
+int killed_ptr(HA_CHECK *param __attribute__((unused)))
{
- return ¬_killed; /* always NULL */
+ return 0;
}
/* print warnings and errors */
=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h 2009-10-06 06:57:22 +0000
+++ b/storage/myisam/myisamdef.h 2009-11-29 23:08:56 +0000
@@ -725,7 +725,7 @@ my_bool mi_dynmap_file(MI_INFO *info, my
void mi_remap_file(MI_INFO *info, my_off_t size);
/* Functions needed by mi_check */
-volatile int *killed_ptr(HA_CHECK *param);
+int killed_ptr(HA_CHECK *param);
void mi_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...));
void mi_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...));
void mi_check_print_info _VARARGS((HA_CHECK *param, const char *fmt, ...));
=== modified file 'storage/myisam/myisamlog.c'
--- a/storage/myisam/myisamlog.c 2008-02-18 22:35:17 +0000
+++ b/storage/myisam/myisamlog.c 2009-11-29 23:08:56 +0000
@@ -385,7 +385,7 @@ static int examine_log(char * file_name,
file_info.name=0;
file_info.show_name=0;
file_info.record=0;
- if (read_string(&cache,(uchar**) &file_info.name,
+ if (read_string(&cache,(uchar**) (char*) &file_info.name,
(uint) mi_uint2korr(head)))
goto err;
{
=== modified file 'storage/myisam/sort.c'
--- a/storage/myisam/sort.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/sort.c 2009-11-29 23:08:56 +0000
@@ -900,7 +900,6 @@ merge_buffers(MI_SORT_PARAM *info, uint
uchar *strpos;
BUFFPEK *buffpek,**refpek;
QUEUE queue;
- volatile int *killed= killed_ptr(info->sort_info->param);
DBUG_ENTER("merge_buffers");
count=error=0;
@@ -933,10 +932,6 @@ merge_buffers(MI_SORT_PARAM *info, uint
{
for (;;)
{
- if (*killed)
- {
- error=1; goto err;
- }
buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file)
{
@@ -956,6 +951,12 @@ merge_buffers(MI_SORT_PARAM *info, uint
buffpek->key+=sort_length;
if (! --buffpek->mem_count)
{
+ /* It's enough to check for killedptr before a slow operation */
+ if (killed_ptr(info->sort_info->param))
+ {
+ error=1;
+ goto err;
+ }
if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
{
uchar *base= buffpek->base;
=== modified file 'storage/xtradb/fil/fil0fil.c'
--- a/storage/xtradb/fil/fil0fil.c 2009-11-13 21:26:08 +0000
+++ b/storage/xtradb/fil/fil0fil.c 2009-11-29 23:08:56 +0000
@@ -3139,7 +3139,7 @@ skip_info:
if (mach_read_from_4(page + FIL_PAGE_OFFSET) || !offset) {
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
- for (i = 0; i < n_index; i++) {
+ for (i = 0; (ulint) i < n_index; i++) {
if (offset / UNIV_PAGE_SIZE == root_page[i]) {
/* this is index root page */
mach_write_to_4(page + FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
=== modified file 'storage/xtradb/trx/trx0i_s.c'
--- a/storage/xtradb/trx/trx0i_s.c 2009-09-07 10:22:53 +0000
+++ b/storage/xtradb/trx/trx0i_s.c 2009-11-29 23:08:56 +0000
@@ -28,11 +28,11 @@ table cache" for later retrieval.
Created July 17, 2007 Vasil Dimov
*******************************************************/
-#include <mysql/plugin.h>
#include "mysql_addons.h"
#include "univ.i"
+#include <mysql/plugin.h>
#include "buf0buf.h"
#include "dict0dict.h"
#include "ha0storage.h"
3
5
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2770)
by Michael Widenius 30 Nov '09
by Michael Widenius 30 Nov '09
30 Nov '09
#At lp:maria based on revid:monty@askmonty.org-20091130111302-6zcyj6ucz6rnphdq
2770 Michael Widenius 2009-11-30
Fixes after comments from last push:
- Removed some not needed casts
- Change plugin.h to be 'binary compatible' with old versions
- Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change
- Made some fixes suggested by Kristian to make things more portable and future safe (when it comes to strict aliasing)
modified:
include/ft_global.h
include/mysql/plugin.h
include/mysql/plugin.h.pp
mysql-test/t/information_schema.test
sql/sp_head.cc
sql/sql_select.cc
sql/table.cc
storage/maria/ma_ft_boolean_search.c
storage/maria/ma_ft_nlq_search.c
storage/maria/ma_ft_parser.c
storage/maria/ma_ftdefs.h
storage/maria/maria_ftdump.c
storage/myisam/ft_boolean_search.c
storage/myisam/ft_nlq_search.c
storage/myisam/ft_parser.c
storage/myisam/myisam_ftdump.c
per-file messages:
include/ft_global.h
Introduced FT_WEIGTH, to handle fulltext weights in a slightly more portable manner
include/mysql/plugin.h
Change plugin.h to be 'binary compatible' with old versions
Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change
Changed flags to unsigned (as flags should always be unsigned)
mysql-test/t/information_schema.test
Fixed typo
sql/sp_head.cc
Removed cast
sql/sql_select.cc
Removed cast
sql/table.cc
Removed cast
storage/maria/ma_ft_boolean_search.c
Use mysql_ft_size_t instead of size_t for plugin.h code
Changed some other string lengths to size_t
storage/maria/ma_ft_nlq_search.c
Use FT_WEIGTH to make code more portable
storage/maria/ma_ft_parser.c
Use mysql_ft_size_t instead of size_t for plugin.h code
Changed some other string lengths to size_t
storage/maria/ma_ftdefs.h
Changed some string lengths to size_t
storage/maria/maria_ftdump.c
Use FT_WEIGTH to make code more portable
storage/myisam/ft_boolean_search.c
Use mysql_ft_size_t instead of size_t for plugin.h code
storage/myisam/ft_nlq_search.c
Use FT_WEIGTH to make code more portable
storage/myisam/ft_parser.c
Use mysql_ft_size_t instead of size_t for plugin.h code
storage/myisam/myisam_ftdump.c
Use FT_WEIGTH to make code more portable
=== modified file 'include/ft_global.h'
--- a/include/ft_global.h 2007-06-27 14:49:12 +0000
+++ b/include/ft_global.h 2009-11-30 13:36:06 +0000
@@ -76,6 +76,8 @@ my_bool ft_boolean_check_syntax_string(c
extern const HA_KEYSEG ft_keysegs[FT_SEGS];
+typedef union {int32 i; float f;} FT_WEIGTH;
+
#ifdef __cplusplus
}
#endif
=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h 2009-11-29 23:08:56 +0000
+++ b/include/mysql/plugin.h 2009-11-30 13:36:06 +0000
@@ -564,19 +564,22 @@ typedef struct st_mysql_ftparser_boolean
nothing. See enum_ftparser_mode above.
*/
+/* TODO: Change the following int to size_t at next ABI update */
+typedef int mysql_ft_size_t;
+
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- const unsigned char *doc, size_t doc_len);
+ const unsigned char *doc, mysql_ft_size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- const unsigned char *word, size_t word_len,
+ const unsigned char *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
struct charset_info_st *cs;
- char *doc;
- int length;
- int flags;
+ const unsigned char *doc;
+ mysql_ft_size_t length;
+ unsigned int flags;
enum enum_ftparser_mode mode;
} MYSQL_FTPARSER_PARAM;
=== modified file 'include/mysql/plugin.h.pp'
--- a/include/mysql/plugin.h.pp 2009-11-29 23:08:56 +0000
+++ b/include/mysql/plugin.h.pp 2009-11-30 13:36:06 +0000
@@ -70,19 +70,20 @@ typedef struct st_mysql_ftparser_boolean
char prev;
char *quot;
} MYSQL_FTPARSER_BOOLEAN_INFO;
+typedef int mysql_ft_size_t;
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- const unsigned char *doc, size_t doc_len);
+ const unsigned char *doc, mysql_ft_size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- const unsigned char *word, size_t word_len,
+ const unsigned char *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
struct charset_info_st *cs;
- char *doc;
- int length;
- int flags;
+ const unsigned char *doc;
+ mysql_ft_size_t length;
+ unsigned int flags;
enum enum_ftparser_mode mode;
} MYSQL_FTPARSER_PARAM;
struct st_mysql_ftparser
=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test 2009-11-29 23:08:56 +0000
+++ b/mysql-test/t/information_schema.test 2009-11-30 13:36:06 +0000
@@ -5,7 +5,7 @@
# on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
-# Check that innodb/xtradb is incompiled in as result depends on it
+# Check that InnoDB/XtraDB was compiled in as result depends on it
-- source include/have_innodb.inc
# Save the initial number of concurrent sessions
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2009-11-29 23:08:56 +0000
+++ b/sql/sp_head.cc 2009-11-30 13:36:06 +0000
@@ -1924,7 +1924,7 @@ sp_head::execute_procedure(THD *thd, Lis
if (spvar->mode == sp_param_out)
{
Item_null *null_item= new Item_null();
- Item *tmp_item= (Item*) null_item;
+ Item *tmp_item= null_item;
if (!null_item ||
nctx->set_variable(thd, i, &tmp_item))
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-11-29 23:08:56 +0000
+++ b/sql/sql_select.cc 2009-11-30 13:36:06 +0000
@@ -3586,7 +3586,7 @@ add_key_fields(JOIN *join, KEY_FIELD **k
{
if (!field->eq(item->field))
{
- Item *tmp_item= (Item*) item;
+ Item *tmp_item= item;
add_key_field(key_fields, *and_level, cond_func, field,
TRUE, &tmp_item, 1, usable_tables,
sargables);
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2009-11-29 23:08:56 +0000
+++ b/sql/table.cc 2009-11-30 13:36:06 +0000
@@ -2077,7 +2077,7 @@ ulong get_form_pos(File file, uchar *hea
else
{
char *str;
- const char **tmp = (const char**) (char*) buf;
+ const char **tmp = (const char**) buf;
str=(char *) (buf+a_length);
fix_type_pointers(&tmp, save_names, 1, &str);
}
=== modified file 'storage/maria/ma_ft_boolean_search.c'
--- a/storage/maria/ma_ft_boolean_search.c 2009-11-29 23:08:56 +0000
+++ b/storage/maria/ma_ft_boolean_search.c 2009-11-30 13:36:06 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,7 +282,7 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *query, size_t len)
+ const uchar *query, mysql_ft_size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
@@ -299,7 +299,7 @@ static int ftb_parse_query_internal(MYSQ
}
-static int _ftb_parse_query(FTB *ftb, uchar *query, uint len,
+static int _ftb_parse_query(FTB *ftb, uchar *query, size_t len,
struct st_mysql_ftparser *parser)
{
MYSQL_FTPARSER_PARAM *param;
@@ -321,7 +321,7 @@ static int _ftb_parse_query(FTB *ftb, uc
param->mysql_add_word= ftb_query_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= (char*) query;
+ param->doc= query;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO;
@@ -539,8 +539,8 @@ static void _ftb_init_index_search(FT_IN
FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr,
- uchar *query,
- uint query_len, CHARSET_INFO *cs)
+ uchar *query, size_t query_len,
+ CHARSET_INFO *cs)
{
FTB *ftb;
FTB_EXPR *ftbe;
@@ -615,8 +615,9 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, mysql_ft_size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO
+ *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
FT_WORD *w= (FT_WORD *)phrase_param->document->data;
@@ -647,7 +648,8 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *document, size_t len)
+ const uchar *document,
+ mysql_ft_size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -678,8 +680,8 @@ static int ftb_check_phrase_internal(MYS
-1 is returned if error occurs.
*/
-static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
- FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
+static int _ftb_check_phrase(FTB *ftb, const uchar *document, size_t len,
+ FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
{
MY_FTB_PHRASE_PARAM ftb_param;
MYSQL_FTPARSER_PARAM *param;
@@ -699,7 +701,7 @@ static int _ftb_check_phrase(FTB *ftb, c
param->mysql_add_word= ftb_phrase_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= (char *) document;
+ param->doc= document;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
@@ -872,8 +874,9 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, mysql_ft_size_t len,
+ MYSQL_FTPARSER_BOOLEAN_INFO
+ *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
@@ -933,7 +936,7 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc, size_t len)
+ const uchar *doc, mysql_ft_size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
@@ -997,7 +1000,7 @@ float maria_ft_boolean_find_relevance(FT
{
if (!ftsi.pos)
continue;
- param->doc= (char *)ftsi.pos;
+ param->doc= ftsi.pos;
param->length= ftsi.len;
if (unlikely(parser->parse(param)))
return 0;
=== modified file 'storage/maria/ma_ft_nlq_search.c'
--- a/storage/maria/ma_ft_nlq_search.c 2009-11-29 23:08:56 +0000
+++ b/storage/maria/ma_ft_nlq_search.c 2009-11-30 13:36:06 +0000
@@ -51,6 +51,7 @@ typedef struct st_ft_superdoc
double tmp_weight;
} FT_SUPERDOC;
+
static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)),
FT_SUPERDOC *p1, FT_SUPERDOC *p2)
{
@@ -63,7 +64,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int32 subkeys;
+ FT_WEIGTH subkeys;
int r;
uint doc_cnt;
FT_SUPERDOC sdoc, *sptr;
@@ -91,9 +92,9 @@ static int walk_and_match(FT_WORD *word,
/* Skip rows inserted by current inserted */
for (r= _ma_search(info, &key, SEARCH_FIND, key_root) ;
!r &&
- (subkeys=ft_sintXkorr(info->last_key.data +
- info->last_key.data_length +
- info->last_key.ref_length - extra)) > 0 &&
+ (subkeys.i= ft_sintXkorr(info->last_key.data +
+ info->last_key.data_length +
+ info->last_key.ref_length - extra)) > 0 &&
info->cur_row.lastpos >= info->state->data_file_length ;
r= _ma_search_next(info, &info->last_key, SEARCH_BIGGER, key_root))
;
@@ -112,7 +113,7 @@ static int walk_and_match(FT_WORD *word,
key.data+1, key.data_length-1, 0, 0))
break;
- if (subkeys<0)
+ if (subkeys.i < 0)
{
if (doc_cnt)
DBUG_RETURN(1); /* index is corrupted */
@@ -128,7 +129,8 @@ static int walk_and_match(FT_WORD *word,
goto do_skip;
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
- tmp_weight=*(float*) (char*) &subkeys;
+ /* The weight we read was actually a float */
+ tmp_weight= subkeys.f;
#else
#error
#endif
@@ -163,9 +165,9 @@ static int walk_and_match(FT_WORD *word,
else
r= _ma_search(info, &info->last_key, SEARCH_BIGGER, key_root);
do_skip:
- while ((subkeys=ft_sintXkorr(info->last_key.data +
- info->last_key.data_length +
- info->last_key.ref_length - extra)) > 0 &&
+ while ((subkeys.i= ft_sintXkorr(info->last_key.data +
+ info->last_key.data_length +
+ info->last_key.ref_length - extra)) > 0 &&
!r && info->cur_row.lastpos >= info->state->data_file_length)
r= _ma_search_next(info, &info->last_key, SEARCH_BIGGER, key_root);
@@ -206,7 +208,7 @@ static int FT_DOC_cmp(void *unused __att
FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
- uint query_len, uint flags, uchar *record)
+ size_t query_len, uint flags, uchar *record)
{
TREE wtree;
ALL_IN_ONE aio;
=== modified file 'storage/maria/ma_ft_parser.c'
--- a/storage/maria/ma_ft_parser.c 2009-11-29 23:08:56 +0000
+++ b/storage/maria/ma_ft_parser.c 2009-11-30 13:36:06 +0000
@@ -260,7 +260,7 @@ void maria_ft_parse_init(TREE *wtree, CH
static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
__attribute__((unused)))
{
@@ -290,7 +290,8 @@ static int maria_ft_add_word(MYSQL_FTPAR
static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc_arg, size_t doc_len)
+ const uchar *doc_arg,
+ mysql_ft_size_t doc_len)
{
const uchar *doc= doc_arg;
const uchar *end= doc + doc_len;
@@ -306,8 +307,8 @@ static int maria_ft_parse_internal(MYSQL
}
-int maria_ft_parse(TREE *wtree, uchar *doc, int doclen,
- struct st_mysql_ftparser *parser,
+int maria_ft_parse(TREE *wtree, uchar *doc, size_t doclen,
+ struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
MY_FT_PARSER_PARAM my_param;
@@ -320,7 +321,7 @@ int maria_ft_parse(TREE *wtree, uchar *d
param->mysql_add_word= maria_ft_add_word;
param->mysql_ftparam= &my_param;
param->cs= wtree->custom_arg;
- param->doc= (char *) doc;
+ param->doc= doc;
param->length= doclen;
param->mode= MYSQL_FTPARSER_SIMPLE_MODE;
DBUG_RETURN(parser->parse(param));
@@ -380,8 +381,8 @@ MYSQL_FTPARSER_PARAM *maria_ftparser_cal
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
- MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *,
+ mysql_ft_size_t, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
}
=== modified file 'storage/maria/ma_ftdefs.h'
--- a/storage/maria/ma_ftdefs.h 2009-11-29 23:08:56 +0000
+++ b/storage/maria/ma_ftdefs.h 2009-11-30 13:36:06 +0000
@@ -122,15 +122,17 @@ void _ma_ft_segiterator_dummy_init(const
uint _ma_ft_segiterator(FT_SEG_ITERATOR *);
void maria_ft_parse_init(TREE *, CHARSET_INFO *);
-int maria_ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
+int maria_ft_parse(TREE *, uchar *, size_t, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * maria_ft_linearize(TREE *, MEM_ROOT *);
FT_WORD * _ma_ft_parserecord(MARIA_HA *, uint, const uchar *, MEM_ROOT *);
uint _ma_ft_parse(TREE *, MARIA_HA *, uint, const uchar *,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
-FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, uint, uint, uchar *);
-FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, uint, CHARSET_INFO *);
+FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, size_t, uint,
+ uchar *);
+FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, size_t,
+ CHARSET_INFO *);
extern const struct _ft_vft _ma_ft_vft_nlq;
int maria_ft_nlq_read_next(FT_INFO *, char *);
=== modified file 'storage/maria/maria_ftdump.c'
--- a/storage/maria/maria_ftdump.c 2009-11-29 23:08:56 +0000
+++ b/storage/maria/maria_ftdump.c 2009-11-30 13:36:06 +0000
@@ -53,7 +53,7 @@ static struct my_option my_long_options[
int main(int argc,char *argv[])
{
- int error=0, subkeys;
+ int error=0;
uint keylen, keylen2=0, inx, doc_cnt=0;
float weight= 1.0;
double gws, min_gws=0, avg_gws=0;
@@ -112,11 +112,12 @@ int main(int argc,char *argv[])
while (!(error=maria_rnext(info,NULL,inx)))
{
+ FT_WEIGTH subkeys;
keylen=*(info->lastkey_buff);
- subkeys=ft_sintXkorr(info->lastkey_buff + keylen + 1);
- if (subkeys >= 0)
- weight=*(float*) (char*) &subkeys;
+ subkeys.i= ft_sintXkorr(info->lastkey_buff + keylen + 1);
+ if (subkeys.i >= 0)
+ weight= subkeys.f;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);
@@ -153,14 +154,15 @@ int main(int argc,char *argv[])
keylen2=keylen;
doc_cnt=0;
}
- doc_cnt+= (subkeys >= 0 ? 1 : -subkeys);
+ doc_cnt+= (subkeys.i >= 0 ? 1 : -subkeys.i);
}
if (dump)
{
- if (subkeys>=0)
+ if (subkeys.i >= 0)
printf("%9lx %20.7f %s\n", (long) info->cur_row.lastpos,weight,buf);
else
- printf("%9lx => %17d %s\n",(long) info->cur_row.lastpos,-subkeys,buf);
+ printf("%9lx => %17d %s\n",(long) info->cur_row.lastpos,-subkeys.i,
+ buf);
}
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
printf("%10ld\r",total);
=== modified file 'storage/myisam/ft_boolean_search.c'
--- a/storage/myisam/ft_boolean_search.c 2009-11-29 23:08:56 +0000
+++ b/storage/myisam/ft_boolean_search.c 2009-11-30 13:36:06 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,7 +282,7 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *query, size_t len)
+ const uchar *query, mysql_ft_size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
@@ -616,7 +616,7 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -648,7 +648,8 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *document, size_t len)
+ const uchar *document,
+ mysql_ft_size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -874,8 +875,9 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, mysql_ft_size_t len,
+ MYSQL_FTPARSER_BOOLEAN_INFO
+ *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
@@ -935,7 +937,7 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc, size_t len)
+ const uchar *doc, mysql_ft_size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
=== modified file 'storage/myisam/ft_nlq_search.c'
--- a/storage/myisam/ft_nlq_search.c 2009-11-29 23:08:56 +0000
+++ b/storage/myisam/ft_nlq_search.c 2009-11-30 13:36:06 +0000
@@ -63,7 +63,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int32 subkeys;
+ FT_WEIGTH subkeys;
int r;
uint keylen, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
@@ -91,7 +91,7 @@ static int walk_and_match(FT_WORD *word,
/* Skip rows inserted by current inserted */
for (r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root) ;
!r &&
- (subkeys=ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
+ (subkeys.i= ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
info->lastpos >= info->state->data_file_length ;
r= _mi_search_next(info, keyinfo, info->lastkey,
info->lastkey_length, SEARCH_BIGGER, key_root))
@@ -108,7 +108,7 @@ static int walk_and_match(FT_WORD *word,
info->lastkey_length-extra-1, keybuff+1,keylen-1,0,0))
break;
- if (subkeys<0)
+ if (subkeys.i < 0)
{
if (doc_cnt)
DBUG_RETURN(1); /* index is corrupted */
@@ -125,7 +125,7 @@ static int walk_and_match(FT_WORD *word,
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
/* The weight we read was actually a float */
- tmp_weight=*(float*) (char*) &subkeys;
+ tmp_weight= subkeys.f;
#else
#error
#endif
@@ -162,7 +162,7 @@ static int walk_and_match(FT_WORD *word,
r=_mi_search(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
do_skip:
- while ((subkeys=ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
+ while ((subkeys.i= ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
!r && info->lastpos >= info->state->data_file_length)
r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
=== modified file 'storage/myisam/ft_parser.c'
--- a/storage/myisam/ft_parser.c 2009-11-29 23:08:56 +0000
+++ b/storage/myisam/ft_parser.c 2009-11-30 13:36:06 +0000
@@ -258,7 +258,7 @@ void ft_parse_init(TREE *wtree, CHARSET_
static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
__attribute__((unused)))
{
@@ -288,7 +288,7 @@ static int ft_add_word(MYSQL_FTPARSER_PA
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc_arg, size_t doc_len)
+ const uchar *doc_arg, mysql_ft_size_t doc_len)
{
const uchar *doc= doc_arg;
const uchar *end= doc + doc_len;
@@ -379,8 +379,8 @@ MYSQL_FTPARSER_PARAM *ftparser_call_init
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
- MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *,
+ mysql_ft_size_t, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
}
=== modified file 'storage/myisam/myisam_ftdump.c'
--- a/storage/myisam/myisam_ftdump.c 2009-11-29 23:08:56 +0000
+++ b/storage/myisam/myisam_ftdump.c 2009-11-30 13:36:06 +0000
@@ -53,7 +53,7 @@ static struct my_option my_long_options[
int main(int argc,char *argv[])
{
- int error=0, subkeys;
+ int error=0;
uint keylen, keylen2=0, inx, doc_cnt=0;
float weight= 1.0;
double gws, min_gws=0, avg_gws=0;
@@ -109,11 +109,12 @@ int main(int argc,char *argv[])
while (!(error=mi_rnext(info,NULL,inx)))
{
+ FT_WEIGTH subkeys;
keylen=*(info->lastkey);
- subkeys=ft_sintXkorr(info->lastkey+keylen+1);
- if (subkeys >= 0)
- weight= *(float*) (char*) &subkeys;
+ subkeys.i =ft_sintXkorr(info->lastkey+keylen+1);
+ if (subkeys.i >= 0)
+ weight= subkeys.f;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
@@ -150,14 +151,14 @@ int main(int argc,char *argv[])
keylen2=keylen;
doc_cnt=0;
}
- doc_cnt+= (subkeys >= 0 ? 1 : -subkeys);
+ doc_cnt+= (subkeys.i >= 0 ? 1 : -subkeys.i);
}
if (dump)
{
- if (subkeys>=0)
+ if (subkeys.i >= 0)
printf("%9lx %20.7f %s\n", (long) info->lastpos,weight,buf);
else
- printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys,buf);
+ printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys.i,buf);
}
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
printf("%10ld\r",total);
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2778)
by knielsen@knielsen-hq.org 30 Nov '09
by knielsen@knielsen-hq.org 30 Nov '09
30 Nov '09
#At lp:maria
2778 knielsen(a)knielsen-hq.org 2009-11-30
After-merge fixes for MySQL 5.1.41 merge into MariaDB: Another warning also needed during shutdown.
modified:
mysql-test/mysql-test-run.pl
=== 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-11-30 13:24:30 +0000
@@ -3999,6 +3999,7 @@ 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/,
);
my $match_count= 0;
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2777)
by Michael Widenius 30 Nov '09
by Michael Widenius 30 Nov '09
30 Nov '09
#At lp:maria based on revid:knielsen@knielsen-hq.org-20091127132059-3su1w7xhsbbtpg6f
2777 Michael Widenius 2009-11-30
Added more general support for sorting 2 characters as one (contractions)
Added support for Croatian sorting orders utf8_croatian_ci and ucs2_croatian_ci.
Patch done by Alexander Barkov. See http://www.collation-charts.org/articles/croatian.htm
modified:
include/m_ctype.h
mysql-test/r/ctype_uca.result
mysql-test/t/ctype_uca.test
mysys/charset-def.c
strings/ctype-mb.c
strings/ctype-uca.c
strings/ctype-ucs2.c
per-file messages:
mysql-test/r/ctype_uca.result
Added testing of Croatian sort order
mysql-test/t/ctype_uca.test
Added testing of Croatian sort order
=== modified file 'include/m_ctype.h'
--- a/include/m_ctype.h 2009-09-07 20:50:10 +0000
+++ b/include/m_ctype.h 2009-11-30 12:42:24 +0000
@@ -49,6 +49,24 @@ typedef struct unicase_info_st
extern MY_UNICASE_INFO *my_unicase_default[256];
extern MY_UNICASE_INFO *my_unicase_turkish[256];
+#define MY_UCA_MAX_CONTRACTION 4
+#define MY_UCA_MAX_WEIGHT_SIZE 8
+
+typedef struct my_contraction_t
+{
+ my_wc_t ch[MY_UCA_MAX_CONTRACTION]; /* Character sequence */
+ uint16 weight[MY_UCA_MAX_WEIGHT_SIZE];/* Its weight string, 0-terminated */
+} MY_CONTRACTION;
+
+
+typedef struct my_contraction_list_t
+{
+ size_t nitems; /* Number of items in the list */
+ MY_CONTRACTION *item; /* List of contractions */
+ char *flags; /* Character flags, e.g. "is contraction head") */
+} MY_CONTRACTIONS;
+
+
typedef struct uni_ctype_st
{
uchar pctype;
@@ -262,7 +280,7 @@ typedef struct charset_info_st
uchar *to_lower;
uchar *to_upper;
uchar *sort_order;
- uint16 *contractions;
+ MY_CONTRACTIONS *contractions;
uint16 **sort_order_big;
uint16 *tab_to_uni;
MY_UNI_IDX *tab_from_uni;
@@ -475,6 +493,13 @@ my_bool my_charset_is_ascii_based(CHARSE
my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs);
uint my_charset_repertoire(CHARSET_INFO *cs);
+my_bool my_uca_have_contractions(CHARSET_INFO *cs);
+my_bool my_uca_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc);
+my_bool my_uca_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc);
+uint16 *my_uca_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2);
+
+
+
#define _MY_U 01 /* Upper case */
#define _MY_L 02 /* Lower case */
=== modified file 'mysql-test/r/ctype_uca.result'
--- a/mysql-test/r/ctype_uca.result 2008-03-26 09:51:16 +0000
+++ b/mysql-test/r/ctype_uca.result 2009-11-30 12:42:24 +0000
@@ -159,6 +159,7 @@ insert into t1 values (_ucs2 0x01fc),(_u
insert into t1 values ('AA'),('Aa'),('aa'),('aA');
insert into t1 values ('CH'),('Ch'),('ch'),('cH');
insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
+insert into t1 values ('D��'),('D��'),('d��'),('d��');
insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
insert into t1 values ('LL'),('Ll'),('ll'),('lL');
@@ -181,7 +182,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -286,7 +287,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��,��
��
@@ -400,6 +401,7 @@ CH,Ch,cH,ch
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -513,7 +515,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -622,6 +624,7 @@ CH,Ch,cH,ch
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -729,7 +732,7 @@ CH,Ch,cH,ch
��,��
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -840,6 +843,7 @@ CH,Ch,cH,ch
��,��
D,d,��,��
DZ,Dz,dZ,dz
+D��,D��,d��,d��
��,��,��,��,��,��
��,��
��
@@ -951,7 +955,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1056,7 +1060,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1164,7 +1168,7 @@ CH,Ch,cH,ch
��,��
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1275,6 +1279,7 @@ cH
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -1382,7 +1387,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1491,6 +1496,7 @@ cH
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -1599,6 +1605,7 @@ cH
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -1707,7 +1714,7 @@ cH
CH,Ch,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1813,7 +1820,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1921,7 +1928,7 @@ CH,Ch,cH,ch
��,��
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -2030,7 +2037,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -2121,6 +2128,118 @@ Z,z,��,��,��,��,��,��
��
��
��
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_croatian_ci;
+group_concat(c1 order by c1)
+��
+��
+A,a,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+AA,Aa,aA,aa
+��,��,��,��,��,��
+B,b
+��
+��
+��,��
+C,c,��,��,��,��,��,��
+CH,Ch,cH,ch
+��,��
+��,��
+��,��
+D,d,��,��
+DZ,Dz,dZ,dz,��,��,��
+d��
+D��,D��,d��,��,��,��
+��,��
+��
+��
+��,��
+��,��
+E,e,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+��,��
+��
+��
+F,f
+��,��
+G,g,��,��,��,��,��,��,��,��,��,��,��,��
+��,��
+��
+��
+��,��
+H,h,��,��
+��,��
+��,��
+I,i,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+IJ,Ij,iJ,ij,��,��
+��
+��
+��
+J,j,��,��,��
+K,k,��,��,��,��
+��,��
+L,l,��,��,��,��,��,��
+��,��
+lJ
+LL,Ll,lL,ll
+LJ,Lj,lj,��,��,��
+��,��
+��
+��
+M,m
+N,n,��,��,��,��,��,��,��,��,��,��
+nJ
+NJ,Nj,nj,��,��,��
+��
+��
+��,��
+O,o,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+OE,Oe,oE,oe,��,��
+��,��,��,��
+��
+��
+P,p
+��,��
+Q,q
+��
+R,r,��,��,��,��,��,��
+RR,Rr,rR,rr
+��
+S,s,��,��,��,��,��,��,��
+SS,Ss,sS,ss,��
+��,��
+��
+��
+T,t,��,��,��,��
+��
+��,��
+��
+��,��
+��
+U,u,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+��
+��
+V,v
+��
+W,w,��,��
+X,x
+Y,y,��,��,��,��,��,��
+��,��
+Z,z,��,��,��,��
+��
+��,��
+��,��
+��,��,��
+��,��
+��
+��,��
+��,��
+��
+��,��
+��,��
+��,��
+��
+��
+��
+��
+��
drop table t1;
SET NAMES utf8;
CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_general_ci, INDEX (c));
=== modified file 'mysql-test/t/ctype_uca.test'
--- a/mysql-test/t/ctype_uca.test 2008-02-20 18:49:26 +0000
+++ b/mysql-test/t/ctype_uca.test 2009-11-30 12:42:24 +0000
@@ -186,6 +186,7 @@ insert into t1 values (_ucs2 0x01fc),(_u
insert into t1 values ('AA'),('Aa'),('aa'),('aA');
insert into t1 values ('CH'),('Ch'),('ch'),('cH');
insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
+insert into t1 values ('D��'),('D��'),('d��'),('d��');
insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
insert into t1 values ('LL'),('Ll'),('ll'),('lL');
@@ -213,6 +214,7 @@ select group_concat(c1 order by c1) from
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_esperanto_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_hungarian_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_croatian_ci;
drop table t1;
=== modified file 'mysys/charset-def.c'
--- a/mysys/charset-def.c 2007-06-21 20:10:40 +0000
+++ b/mysys/charset-def.c 2009-11-30 12:42:24 +0000
@@ -42,6 +42,7 @@ extern CHARSET_INFO my_charset_ucs2_roma
extern CHARSET_INFO my_charset_ucs2_persian_uca_ci;
extern CHARSET_INFO my_charset_ucs2_esperanto_uca_ci;
extern CHARSET_INFO my_charset_ucs2_hungarian_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_croatian_uca_ci;
#endif
#ifdef HAVE_CHARSET_utf8
@@ -63,6 +64,7 @@ extern CHARSET_INFO my_charset_utf8_roma
extern CHARSET_INFO my_charset_utf8_persian_uca_ci;
extern CHARSET_INFO my_charset_utf8_esperanto_uca_ci;
extern CHARSET_INFO my_charset_utf8_hungarian_uca_ci;
+extern CHARSET_INFO my_charset_utf8_croatian_uca_ci;
#ifdef HAVE_UTF8_GENERAL_CS
extern CHARSET_INFO my_charset_utf8_general_cs;
#endif
@@ -152,6 +154,7 @@ my_bool init_compiled_charsets(myf flags
add_compiled_collation(&my_charset_ucs2_persian_uca_ci);
add_compiled_collation(&my_charset_ucs2_esperanto_uca_ci);
add_compiled_collation(&my_charset_ucs2_hungarian_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_croatian_uca_ci);
#endif
#endif
@@ -186,6 +189,7 @@ my_bool init_compiled_charsets(myf flags
add_compiled_collation(&my_charset_utf8_persian_uca_ci);
add_compiled_collation(&my_charset_utf8_esperanto_uca_ci);
add_compiled_collation(&my_charset_utf8_hungarian_uca_ci);
+ add_compiled_collation(&my_charset_utf8_croatian_uca_ci);
#endif
#endif
=== modified file 'strings/ctype-mb.c'
--- a/strings/ctype-mb.c 2009-02-13 16:41:47 +0000
+++ b/strings/ctype-mb.c 2009-11-30 12:42:24 +0000
@@ -567,8 +567,7 @@ my_bool my_like_range_mb(CHARSET_INFO *c
char *min_end= min_str + res_length;
char *max_end= max_str + res_length;
size_t maxcharlen= res_length / cs->mbmaxlen;
- const char *contraction_flags= cs->contractions ?
- ((const char*) cs->contractions) + 0x40*0x40 : NULL;
+ my_bool have_contractions= my_uca_have_contractions(cs);
for (; ptr != end && min_str != min_end && maxcharlen ; maxcharlen--)
{
@@ -636,8 +635,8 @@ fill_max_and_min:
'ab\min\min\min\min' and 'ab\max\max\max\max'.
*/
- if (contraction_flags && ptr + 1 < end &&
- contraction_flags[(uchar) *ptr])
+ if (have_contractions && ptr + 1 < end &&
+ my_uca_can_be_contraction_head(cs, (uchar) *ptr))
{
/* Ptr[0] is a contraction head. */
@@ -659,8 +658,8 @@ fill_max_and_min:
is not a contraction, then we put only ptr[0],
and continue with ptr[1] on the next loop.
*/
- if (contraction_flags[(uchar) ptr[1]] &&
- cs->contractions[(*ptr-0x40)*0x40 + ptr[1] - 0x40])
+ if (my_uca_can_be_contraction_tail(cs, (uchar) ptr[1]) &&
+ my_uca_contraction2_weight(cs, (uchar) ptr[0], (uchar) ptr[1]))
{
/* Contraction found */
if (maxcharlen == 1 || min_str + 1 >= min_end)
=== modified file 'strings/ctype-uca.c'
--- a/strings/ctype-uca.c 2009-11-16 20:49:51 +0000
+++ b/strings/ctype-uca.c 2009-11-30 12:42:24 +0000
@@ -6713,6 +6713,16 @@ static const char hungarian[]=
"&U < \\u00FC <<< \\u00DC << \\u0171 <<< \\u0170";
+static const char croatian[]=
+
+"&C < \\u010D <<< \\u010C < \\u0107 <<< \\u0106 "
+"&D < d\\u017E <<< \\u01C6 <<< D\\u017E <<< \\u01C5 <<< D\\u017D <<< \\u01C4 "
+" < \\u0111 <<< \\u0110 "
+"&L < lj <<< \\u01C9 <<< Lj <<< \\u01C8 <<< LJ <<< \\u01C7 "
+"&N < nj <<< \\u01CC <<< Nj <<< \\u01CB <<< NJ <<< \\u01CA "
+"&S < \\u0161 <<< \\u0160 "
+"&Z < \\u017E <<< \\u017D";
+
/*
Unicode Collation Algorithm:
Collation element (weight) scanner,
@@ -6726,7 +6736,7 @@ typedef struct my_uca_scanner_st
const uchar *send; /* End of the input string */
uchar *uca_length;
uint16 **uca_weight;
- uint16 *contractions;
+ MY_CONTRACTIONS *contractions;
uint16 implicit[2];
int page;
int code;
@@ -6747,6 +6757,164 @@ typedef struct my_uca_scanner_handler_st
static uint16 nochar[]= {0,0};
+#define MY_UCA_CNT_FLAG_SIZE 4096
+#define MY_UCA_CNT_FLAG_MASK 4095
+
+#define MY_UCA_CNT_HEAD 1
+#define MY_UCA_CNT_TAIL 2
+
+
+
+
+/********** Helper functions to handle contraction ************/
+
+
+/**
+ Mark a character as a contraction part
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Unicode code point
+ @flag flag: "is contraction head", "is contraction tail"
+*/
+
+static void
+my_uca_add_contraction_flag(CHARSET_INFO *cs, my_wc_t wc, int flag)
+{
+ cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK]|= flag;
+}
+
+
+/**
+ Add a new contraction into contraction list
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Unicode code points of the characters
+ @len Number of characters
+
+ @return New contraction
+ @retval Pointer to a newly added contraction
+*/
+
+static MY_CONTRACTION *
+my_uca_add_contraction(CHARSET_INFO *cs,
+ my_wc_t *wc, int len __attribute__((unused)))
+{
+ MY_CONTRACTIONS *list= cs->contractions;
+ MY_CONTRACTION *next= &list->item[list->nitems];
+ DBUG_ASSERT(len == 2); /* We currently support only contraction2 */
+ next->ch[0]= wc[0];
+ next->ch[1]= wc[1];
+ list->nitems++;
+ return next;
+}
+
+
+/**
+ Allocate and initialize memory for contraction list and flags
+
+ @cs Pointer to CHARSET_INFO data
+ @alloc Memory allocation function (typically points to my_alloc_once)
+ @n Number of contractions
+
+ @return Error code
+ @retval 0 - memory allocated successfully
+ @retval 1 - not enough memory
+*/
+
+static my_bool
+my_uca_alloc_contractions(CHARSET_INFO *cs, void *(*alloc)(size_t), size_t n)
+{
+ uint size= n * sizeof(MY_CONTRACTION);
+ if (!(cs->contractions= (*alloc)(sizeof(MY_CONTRACTIONS))))
+ return 1;
+ bzero(cs->contractions, sizeof(MY_CONTRACTIONS));
+ if (!(cs->contractions->item= (*alloc)(size)) ||
+ !(cs->contractions->flags= (char*) (*alloc)(MY_UCA_CNT_FLAG_SIZE)))
+ return 1;
+ bzero((void*) cs->contractions->item, size);
+ bzero((void*) cs->contractions->flags, MY_UCA_CNT_FLAG_SIZE);
+ return 0;
+}
+
+
+/**
+ Check if UCA data has contractions (public version)
+
+ @cs Pointer to CHARSET_INFO data
+ @retval 0 - no contraction, 1 - have contractions.
+*/
+
+my_bool
+my_uca_have_contractions(CHARSET_INFO *cs)
+{
+ return cs->contractions != NULL;
+}
+
+
+/**
+ Check if a character can be contraction head
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Code point
+
+ @retval 0 - cannot be contraction head
+ @retval 1 - can be contraction head
+*/
+
+my_bool
+my_uca_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_HEAD;
+}
+
+
+/**
+ Check if a character can be contraction tail
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Code point
+
+ @retval 0 - cannot be contraction tail
+ @retval 1 - can be contraction tail
+*/
+
+my_bool
+my_uca_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_TAIL;
+}
+
+
+/**
+ Find a contraction and return its weight array
+
+ @cs Pointer to CHARSET data
+ @wc1 First character
+ @wc2 Second character
+
+ @return Weight array
+ @retval NULL - no contraction found
+ @retval ptr - contraction weight array
+*/
+
+uint16 *
+my_uca_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
+{
+ MY_CONTRACTIONS *list= cs->contractions;
+ MY_CONTRACTION *c, *last;
+ for (c= list->item, last= &list->item[list->nitems]; c < last; c++)
+ {
+ if (c->ch[0] == wc1 && c->ch[1] == wc2)
+ {
+ return c->weight;
+ }
+ }
+ return NULL;
+}
+
+
+
+
#ifdef HAVE_CHARSET_ucs2
/*
Initialize collation weight scanner
@@ -6766,7 +6934,7 @@ static uint16 nochar[]= {0,0};
*/
static void my_uca_scanner_init_ucs2(my_uca_scanner *scanner,
- CHARSET_INFO *cs __attribute__((unused)),
+ CHARSET_INFO *cs,
const uchar *str, size_t length)
{
scanner->wbeg= nochar;
@@ -6777,6 +6945,7 @@ static void my_uca_scanner_init_ucs2(my_
scanner->uca_length= cs->sort_order;
scanner->uca_weight= cs->sort_order_big;
scanner->contractions= cs->contractions;
+ scanner->cs= cs;
return;
}
@@ -6865,18 +7034,23 @@ static int my_uca_scanner_next_ucs2(my_u
if (scanner->contractions && (scanner->sbeg <= scanner->send))
{
- int cweight;
+ my_wc_t wc1= ((scanner->page << 8) | scanner->code);
- if (!scanner->page && !scanner->sbeg[0] &&
- (scanner->sbeg[1] > 0x40) && (scanner->sbeg[1] < 0x80) &&
- (scanner->code > 0x40) && (scanner->code < 0x80) &&
- (cweight= scanner->contractions[(scanner->code-0x40)*0x40+scanner->sbeg[1]-0x40]))
+ if (my_uca_can_be_contraction_head(scanner->cs, wc1))
+ {
+ uint16 *cweight;
+ my_wc_t wc2= (((my_wc_t) scanner->sbeg[0]) << 8) | scanner->sbeg[1];
+ if (my_uca_can_be_contraction_tail(scanner->cs, wc2) &&
+ (cweight= my_uca_contraction2_weight(scanner->cs,
+ scanner->code,
+ scanner->sbeg[1])))
{
scanner->implicit[0]= 0;
scanner->wbeg= scanner->implicit;
scanner->sbeg+=2;
- return cweight;
+ return *cweight;
}
+ }
}
if (!ucaw[scanner->page])
@@ -6959,23 +7133,22 @@ static int my_uca_scanner_next_any(my_uc
scanner->code= wc & 0xFF;
scanner->sbeg+= mb_len;
- if (scanner->contractions && !scanner->page &&
- (scanner->code > 0x40) && (scanner->code < 0x80))
+ if (my_uca_have_contractions(scanner->cs) &&
+ my_uca_can_be_contraction_head(scanner->cs, wc))
{
- uint page1, code1, cweight;
+ my_wc_t wc2;
+ uint16 *cweight;
- if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc,
+ if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc2,
scanner->sbeg,
scanner->send)) >=0) &&
- (!(page1= (wc >> 8))) &&
- ((code1= (wc & 0xFF)) > 0x40) &&
- (code1 < 0x80) &&
- (cweight= scanner->contractions[(scanner->code-0x40)*0x40 + code1-0x40]))
+ my_uca_can_be_contraction_tail(scanner->cs, wc2) &&
+ (cweight= my_uca_contraction2_weight(scanner->cs, wc, wc2)))
{
scanner->implicit[0]= 0;
scanner->wbeg= scanner->implicit;
scanner->sbeg+= mb_len;
- return cweight;
+ return *cweight;
}
}
@@ -7012,6 +7185,33 @@ static my_uca_scanner_handler my_any_uca
my_uca_scanner_next_any
};
+
+
+/**
+ Helper function:
+ Find address of weights of the given character.
+
+ @weights UCA weight array
+ @lengths UCA length array
+ @ch character Unicode code point
+
+ @return Weight array
+ @retval pointer to weight array for the given character,
+ or NULL if this page does not have implicit weights.
+*/
+
+static inline uint16 *
+my_char_weight_addr(CHARSET_INFO *cs, uint wc)
+{
+ uint page= (wc >> 8);
+ uint ofst= wc & 0xFF;
+ return cs->sort_order_big[page] ?
+ cs->sort_order_big[page] + ofst * cs->sort_order[page] :
+ NULL;
+}
+
+
+
/*
Compares two strings according to the collation
@@ -7683,8 +7883,8 @@ ex:
typedef struct my_coll_rule_item_st
{
- uint base; /* Base character */
- uint curr[2]; /* Current character */
+ my_wc_t base; /* Base character */
+ my_wc_t curr[2]; /* Current character */
int diff[3]; /* Primary, Secondary and Tertiary difference */
} MY_COLL_RULE;
@@ -7834,6 +8034,7 @@ static int my_coll_rule_parse(MY_COLL_RU
static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t))
{
MY_COLL_RULE rule[MY_MAX_COLL_RULE];
+ MY_COLL_RULE *r, *rfirst, *rlast;
char errstr[128];
uchar *newlengths;
uint16 **newweights;
@@ -7858,6 +8059,9 @@ static my_bool create_tailoring(CHARSET_
return 1;
}
+ rfirst= rule;
+ rlast= rule + rc;
+
if (!cs->caseinfo)
cs->caseinfo= my_unicase_default;
@@ -7941,44 +8145,21 @@ static my_bool create_tailoring(CHARSET_
/* Now process contractions */
if (ncontractions)
{
- /*
- 8K for weights for basic latin letter pairs,
- plus 256 bytes for "is contraction part" flags.
- */
- uint size= 0x40*0x40*sizeof(uint16) + 256;
- char *contraction_flags;
- if (!(cs->contractions= (uint16*) (*alloc)(size)))
- return 1;
- bzero((void*)cs->contractions, size);
- contraction_flags= ((char*) cs->contractions) + 0x40*0x40;
- for (i=0; i < rc; i++)
+ if (my_uca_alloc_contractions(cs, alloc, ncontractions))
+ return 1;
+ for (r= rfirst; r < rlast; r++)
{
- if (rule[i].curr[1])
+ uint16 *to;
+ if (r->curr[1]) /* Contraction */
{
- uint pageb= (rule[i].base >> 8) & 0xFF;
- uint chb= rule[i].base & 0xFF;
- uint16 *offsb= defweights[pageb] + chb*deflengths[pageb];
- uint offsc;
-
- if (offsb[1] ||
- rule[i].curr[0] < 0x40 || rule[i].curr[0] > 0x7f ||
- rule[i].curr[1] < 0x40 || rule[i].curr[1] > 0x7f)
- {
- /*
- TODO: add error reporting;
- We support only basic latin letters contractions at this point.
- Also, We don't support contractions with weight longer than one.
- Otherwise, we'd need much more memory.
- */
- return 1;
- }
- offsc= (rule[i].curr[0]-0x40)*0x40+(rule[i].curr[1]-0x40);
-
- /* Copy base weight applying primary difference */
- cs->contractions[offsc]= offsb[0] + rule[i].diff[0];
- /* Mark both letters as "is contraction part */
- contraction_flags[rule[i].curr[0]]= 1;
- contraction_flags[rule[i].curr[1]]= 1;
+ /* Mark both letters as "is contraction part" */
+ my_uca_add_contraction_flag(cs, r->curr[0], MY_UCA_CNT_HEAD);
+ my_uca_add_contraction_flag(cs, r->curr[1], MY_UCA_CNT_TAIL);
+ to= my_uca_add_contraction(cs, r->curr, 2)->weight;
+ /* Copy weight from the reset character */
+ to[0]= my_char_weight_addr(cs, r->base)[0];
+ /* Apply primary difference */
+ to[0]+= r->diff[0];
}
}
}
@@ -8701,6 +8882,39 @@ CHARSET_INFO my_charset_ucs2_hungarian_u
};
+CHARSET_INFO my_charset_ucs2_croatian_uca_ci=
+{
+ 149,0,0, /* number */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ "ucs2", /* cs name */
+ "ucs2_croatian_ci", /* name */
+ "", /* comment */
+ croatian, /* tailoring */
+ NULL, /* ctype */
+ NULL, /* to_lower */
+ NULL, /* to_upper */
+ NULL, /* sort_order */
+ NULL, /* contractions */
+ NULL, /* sort_order_big*/
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ my_unicase_default, /* caseinfo */
+ NULL, /* state_map */
+ NULL, /* ident_map */
+ 8, /* strxfrm_multiply */
+ 1, /* caseup_multiply */
+ 1, /* casedn_multiply */
+ 2, /* mbminlen */
+ 2, /* mbmaxlen */
+ 9, /* min_sort_char */
+ 0xFFFF, /* max_sort_char */
+ ' ', /* pad char */
+ 0, /* escape_with_backslash_is_dangerous */
+ &my_charset_ucs2_handler,
+ &my_collation_ucs2_uca_handler
+};
+
+
#endif
@@ -9358,6 +9572,38 @@ CHARSET_INFO my_charset_utf8_hungarian_u
&my_collation_any_uca_handler
};
+CHARSET_INFO my_charset_utf8_croatian_uca_ci=
+{
+ 213,0,0, /* number */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ "utf8", /* cs name */
+ "utf8_croatian_ci", /* name */
+ "", /* comment */
+ croatian, /* tailoring */
+ ctype_utf8, /* ctype */
+ NULL, /* to_lower */
+ NULL, /* to_upper */
+ NULL, /* sort_order */
+ NULL, /* contractions */
+ NULL, /* sort_order_big*/
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ my_unicase_default, /* caseinfo */
+ NULL, /* state_map */
+ NULL, /* ident_map */
+ 8, /* strxfrm_multiply */
+ 1, /* caseup_multiply */
+ 1, /* casedn_multiply */
+ 1, /* mbminlen */
+ 3, /* mbmaxlen */
+ 9, /* min_sort_char */
+ 0xFFFF, /* max_sort_char */
+ ' ', /* pad char */
+ 0, /* escape_with_backslash_is_dangerous */
+ &my_charset_utf8_handler,
+ &my_collation_any_uca_handler
+};
+
#endif /* HAVE_CHARSET_utf8 */
#endif /* HAVE_UCA_COLLATIONS */
=== modified file 'strings/ctype-ucs2.c'
--- a/strings/ctype-ucs2.c 2009-10-15 21:38:29 +0000
+++ b/strings/ctype-ucs2.c 2009-11-30 12:42:24 +0000
@@ -1526,8 +1526,7 @@ my_bool my_like_range_ucs2(CHARSET_INFO
char *min_org=min_str;
char *min_end=min_str+res_length;
size_t charlen= res_length / cs->mbmaxlen;
- const char *contraction_flags= cs->contractions ?
- ((const char*) cs->contractions) + 0x40*0x40 : NULL;
+ my_bool have_contractions= my_uca_have_contractions(cs);
for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0
; ptr+=2, charlen--)
@@ -1567,8 +1566,9 @@ fill_max_and_min:
return 0;
}
- if (contraction_flags && ptr + 3 < end &&
- ptr[0] == '\0' && contraction_flags[(uchar) ptr[1]])
+ if (have_contractions && ptr + 3 < end &&
+ ptr[0] == '\0' &&
+ my_uca_can_be_contraction_head(cs, (uchar) ptr[1]))
{
/* Contraction head found */
if (ptr[2] == '\0' && (ptr[3] == w_one || ptr[3] == w_many))
@@ -1581,8 +1581,9 @@ 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' && contraction_flags[(uchar) ptr[3]] &&
- cs->contractions[(ptr[1]-0x40)*0x40 + ptr[3] - 0x40])
+ 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]))
{
/* Contraction found */
if (charlen == 1 || min_str + 2 >= min_end)
1
0
[Maria-developers] MWL#47: On the question of annotations persisting from one binary log to another
by Sergey Petrunya 30 Nov '09
by Sergey Petrunya 30 Nov '09
30 Nov '09
Hi Alex,
My opinion is as follows:
When log-slave-updates is not set, the slave is not binlogging the updates
it is applying, so the comments do not go to the binary log either.
When log-slave-updates is set, the action should depend on the
binlog-annotate-row-events setting, like it's done on the master. That is,
if binlog-annotate-row-events is on, annotate events should be passed to
slave's binary log, otherwise they should be discarded.
There is one hole left: if one does
mysqlbinlog /path/to/binlog | mysql --host=slave-which-has-log-slave-updates
then the annotations will not make it to slave's binary log. I think that
should be ok, but we better get a confirmation of this to be sure.
One should also take care that the slave do not write annotations for SQL
statements in form of
BINLOG 'xaqw324435324hnjsfp'
as they are not useful (or at least don't copy the entire 'xaqe23....' part).
BR
Sergey
--
Sergey Petrunia, Software Developer
Monty Program AB, http://askmonty.org
Blog: http://s.petrunia.net/blog
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2769)
by Michael Widenius 30 Nov '09
by Michael Widenius 30 Nov '09
30 Nov '09
#At lp:maria based on revid:bo.thorsen@canonical.com-20091126153249-0xfszhcynbym2lvr
2769 Michael Widenius 2009-11-30 [merge]
Automatic merge
modified:
.bzrignore
BUILD/compile-pentium
client/mysql_upgrade.c
cmd-line-utils/readline/config_readline.h
cmd-line-utils/readline/display.c
cmd-line-utils/readline/history.c
cmd-line-utils/readline/rlmbutil.h
cmd-line-utils/readline/text.c
cmd-line-utils/readline/xmalloc.c
configure.in
include/mysql/plugin.h
include/mysql/plugin.h.pp
libmysql/libmysql.c
mysql-test/t/information_schema.test
mysql-test/t/not_partition.test
mysys/lf_hash.c
mysys/my_redel.c
regex/engine.c
regex/engine.ih
sql/log_event.cc
sql/mysqld.cc
sql/scheduler.cc
sql/sp_head.cc
sql/sql_base.cc
sql/sql_builtin.cc.in
sql/sql_class.cc
sql/sql_class.h
sql/sql_insert.cc
sql/sql_parse.cc
sql/sql_select.cc
sql/sql_show.cc
sql/table.cc
storage/maria/ha_maria.cc
storage/maria/lockman.c
storage/maria/ma_check.c
storage/maria/ma_check_standalone.h
storage/maria/ma_ft_boolean_search.c
storage/maria/ma_ft_nlq_search.c
storage/maria/ma_ft_parser.c
storage/maria/ma_ftdefs.h
storage/maria/ma_sort.c
storage/maria/ma_state.c
storage/maria/maria_def.h
storage/maria/maria_ftdump.c
storage/maria/trnman.c
storage/myisam/ft_boolean_search.c
storage/myisam/ft_nlq_search.c
storage/myisam/ft_parser.c
storage/myisam/ft_stopwords.c
storage/myisam/ftdefs.h
storage/myisam/ha_myisam.cc
storage/myisam/mi_check.c
storage/myisam/myisam_ftdump.c
storage/myisam/myisamchk.c
storage/myisam/myisamdef.h
storage/myisam/myisamlog.c
storage/myisam/sort.c
storage/xtradb/fil/fil0fil.c
storage/xtradb/trx/trx0i_s.c
=== modified file '.bzrignore'
--- a/.bzrignore 2009-11-06 17:22:32 +0000
+++ b/.bzrignore 2009-11-29 23:16:14 +0000
@@ -1922,3 +1922,4 @@ libmysqld/examples/mysqltest.cc
extra/libevent/event-config.h
libmysqld/opt_table_elimination.cc
libmysqld/ha_federatedx.cc
+tmp
=== modified file 'BUILD/compile-pentium'
--- a/BUILD/compile-pentium 2007-04-11 12:12:00 +0000
+++ b/BUILD/compile-pentium 2009-11-29 23:08:56 +0000
@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $fast_cflags"
-extra_configs="$pentium_configs $static_link"
+extra_configs="$pentium_configs"
strip=yes
. "$path/FINISH.sh"
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c 2009-11-06 17:22:32 +0000
+++ b/client/mysql_upgrade.c 2009-11-29 23:08:56 +0000
@@ -552,7 +552,6 @@ static int upgrade_already_done(void)
FILE *in;
char upgrade_info_file[FN_REFLEN]= {0};
char buf[sizeof(MYSQL_SERVER_VERSION)+1];
- char *res;
if (get_upgrade_info_file_name(upgrade_info_file))
return 0; /* Could not get filename => not sure */
=== modified file 'cmd-line-utils/readline/config_readline.h'
--- a/cmd-line-utils/readline/config_readline.h 2005-04-20 10:02:07 +0000
+++ b/cmd-line-utils/readline/config_readline.h 2009-11-29 23:08:56 +0000
@@ -7,6 +7,11 @@
# include <config.h>
#endif
+/* to get wcwidth() defined */
+#define _XOPEN_SOURCE 600
+#define _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_
+
/*
Ultrix botches type-ahead when switching from canonical to
non-canonical mode, at least through version 4.3
=== modified file 'cmd-line-utils/readline/display.c'
--- a/cmd-line-utils/readline/display.c 2009-09-07 20:50:10 +0000
+++ b/cmd-line-utils/readline/display.c 2009-11-29 23:08:56 +0000
@@ -461,12 +461,12 @@ rl_redisplay ()
register char *line;
int inv_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, modmark;
- char *prompt_this_line;
+ const char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
- int num, n0;
+ int num, n0= 0;
wchar_t wc;
size_t wc_bytes;
- int wc_width;
+ int wc_width= 0;
mbstate_t ps;
int _rl_wrapped_multicolumn = 0;
#endif
@@ -824,7 +824,7 @@ rl_redisplay ()
cpos_buffer_position = out;
lb_linenum = newlines;
}
- for (i = in; i < in+wc_bytes; i++)
+ for (i = in; (size_t) i < in+wc_bytes; i++)
line[out++] = rl_line_buffer[i];
for (i = 0; i < wc_width; i++)
CHECK_LPOS();
=== modified file 'cmd-line-utils/readline/history.c'
--- a/cmd-line-utils/readline/history.c 2008-04-28 16:24:05 +0000
+++ b/cmd-line-utils/readline/history.c 2009-11-29 23:08:56 +0000
@@ -211,14 +211,14 @@ history_get (offset)
HIST_ENTRY *
alloc_history_entry (string, ts)
- char *string;
+ const char *string;
char *ts;
{
HIST_ENTRY *temp;
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
- temp->line = string ? savestring (string) : string;
+ temp->line = string ? savestring ((char*) string) : (char*) string;
temp->data = (char *)NULL;
temp->timestamp = ts;
=== modified file 'cmd-line-utils/readline/rlmbutil.h'
--- a/cmd-line-utils/readline/rlmbutil.h 2007-11-19 13:38:08 +0000
+++ b/cmd-line-utils/readline/rlmbutil.h 2009-11-29 23:08:56 +0000
@@ -109,8 +109,8 @@ extern int _rl_is_mbchar_matched PARAMS(
extern wchar_t _rl_char_value PARAMS((char *, int));
extern int _rl_walphabetic PARAMS((wchar_t));
-#define _rl_to_wupper(wc) (iswlower (wc) ? towupper (wc) : (wc))
-#define _rl_to_wlower(wc) (iswupper (wc) ? towlower (wc) : (wc))
+#define _rl_to_wupper(wc) (iswlower (wc) ? (wchar_t) towupper (wc) : (wc))
+#define _rl_to_wlower(wc) (iswupper (wc) ? (wchar_t) towlower (wc) : (wc))
#define MB_NEXTCHAR(b,s,c,f) \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) \
=== modified file 'cmd-line-utils/readline/text.c'
--- a/cmd-line-utils/readline/text.c 2009-09-07 20:50:10 +0000
+++ b/cmd-line-utils/readline/text.c 2009-11-29 23:08:56 +0000
@@ -614,7 +614,7 @@ rl_arrow_keys (count, c)
#ifdef HANDLE_MULTIBYTE
static char pending_bytes[MB_LEN_MAX];
static int pending_bytes_length = 0;
-static mbstate_t ps = {0};
+static mbstate_t ps;
#endif
/* Insert the character C at the current location, moving point forward.
=== modified file 'cmd-line-utils/readline/xmalloc.c'
--- a/cmd-line-utils/readline/xmalloc.c 2008-01-23 16:43:46 +0000
+++ b/cmd-line-utils/readline/xmalloc.c 2009-11-29 23:08:56 +0000
@@ -42,7 +42,7 @@
static void
memory_error_and_abort (fname)
- char *fname;
+ const char *fname;
{
fprintf (stderr, "%s: out of virtual memory\n", fname);
exit (2);
=== modified file 'configure.in'
--- a/configure.in 2009-11-07 15:56:51 +0000
+++ b/configure.in 2009-11-29 23:08:56 +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.39-maria-beta)
+AM_INIT_AUTOMAKE(mysql, 5.1.39-MariaDB-beta)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h 2009-09-07 20:50:10 +0000
+++ b/include/mysql/plugin.h 2009-11-29 23:08:56 +0000
@@ -567,9 +567,9 @@ typedef struct st_mysql_ftparser_boolean
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- char *doc, int doc_len);
+ const unsigned char *doc, size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- char *word, int word_len,
+ const unsigned char *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
=== modified file 'include/mysql/plugin.h.pp'
--- a/include/mysql/plugin.h.pp 2008-10-10 15:28:41 +0000
+++ b/include/mysql/plugin.h.pp 2009-11-29 23:08:56 +0000
@@ -73,9 +73,9 @@ typedef struct st_mysql_ftparser_boolean
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- char *doc, int doc_len);
+ const unsigned char *doc, size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- char *word, int word_len,
+ const unsigned char *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c 2009-11-06 17:22:32 +0000
+++ b/libmysql/libmysql.c 2009-11-29 23:08:56 +0000
@@ -2284,7 +2284,7 @@ mysql_stmt_param_metadata(MYSQL_STMT *st
/* Store type of parameter in network buffer. */
-static void store_param_type(char **pos, MYSQL_BIND *param)
+static void store_param_type(uchar **pos, MYSQL_BIND *param)
{
uint typecode= param->buffer_type | (param->is_unsigned ? 32768 : 0);
int2store(*pos, typecode);
@@ -2564,7 +2564,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
that is sent to the server.
*/
for (param= stmt->params; param < param_end ; param++)
- store_param_type((char**) &net->write_pos, param);
+ store_param_type(&net->write_pos, param);
}
for (param= stmt->params; param < param_end; param++)
=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test 2009-09-29 20:19:43 +0000
+++ b/mysql-test/t/information_schema.test 2009-11-29 23:08:56 +0000
@@ -5,6 +5,9 @@
# on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
+# Check that innodb/xtradb is incompiled in as result depends on it
+-- source include/have_innodb.inc
+
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
=== modified file 'mysql-test/t/not_partition.test'
--- a/mysql-test/t/not_partition.test 2009-01-08 14:16:44 +0000
+++ b/mysql-test/t/not_partition.test 2009-11-29 23:08:56 +0000
@@ -15,7 +15,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
# Bug#39893: Crash if select on a partitioned table,
# when partitioning is disabled
FLUSH TABLES;
---copy_file $MYSQLTEST_VARDIR/std_data_ln/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
+--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
SELECT * FROM t1;
TRUNCATE TABLE t1;
ANALYZE TABLE t1;
=== modified file 'mysys/lf_hash.c'
--- a/mysys/lf_hash.c 2009-01-15 21:27:36 +0000
+++ b/mysys/lf_hash.c 2009-11-29 23:08:56 +0000
@@ -124,8 +124,8 @@ retry:
we found a deleted node - be nice, help the other thread
and remove this deleted node
*/
- if (my_atomic_casptr((void **)cursor->prev,
- (void **)&cursor->curr, cursor->next))
+ if (my_atomic_casptr((void **) cursor->prev,
+ (void **)(char*) &cursor->curr, cursor->next))
_lf_alloc_free(pins, cursor->curr);
else
{
@@ -171,7 +171,8 @@ static LF_SLIST *linsert(LF_SLIST * vola
node->link= (intptr)cursor.curr;
DBUG_ASSERT(node->link != (intptr)node); /* no circular references */
DBUG_ASSERT(cursor.prev != &node->link); /* no circular references */
- if (my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+ if (my_atomic_casptr((void **) cursor.prev,
+ (void **)(char*) &cursor.curr, node))
{
res= 1; /* inserted ok */
break;
@@ -218,13 +219,13 @@ static int ldelete(LF_SLIST * volatile *
else
{
/* mark the node deleted */
- if (my_atomic_casptr((void **)&(cursor.curr->link),
- (void **)&cursor.next,
+ if (my_atomic_casptr((void **) (char*) &(cursor.curr->link),
+ (void **) (char*) &cursor.next,
(void *)(((intptr)cursor.next) | 1)))
{
/* and remove it from the list */
if (my_atomic_casptr((void **)cursor.prev,
- (void **)&cursor.curr, cursor.next))
+ (void **)(char*)&cursor.curr, cursor.next))
_lf_alloc_free(pins, cursor.curr);
else
{
@@ -493,7 +494,7 @@ static int initialize_bucket(LF_HASH *ha
my_free((void *)dummy, MYF(0));
dummy= cur;
}
- my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+ my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
/*
note that if the CAS above failed (after linsert() succeeded),
it would mean that some other thread has executed linsert() for
=== modified file 'mysys/my_redel.c'
--- a/mysys/my_redel.c 2009-11-06 17:22:32 +0000
+++ b/mysys/my_redel.c 2009-11-29 23:08:56 +0000
@@ -77,9 +77,6 @@ end:
int my_copystat(const char *from, const char *to, int MyFlags)
{
struct stat statbuf;
-#if !defined(__WIN__) && !defined(__NETWARE__)
- int res;
-#endif
if (stat((char*) from, &statbuf))
{
=== modified file 'regex/engine.c'
--- a/regex/engine.c 2005-09-29 01:20:31 +0000
+++ b/regex/engine.c 2009-11-29 23:08:56 +0000
@@ -33,11 +33,11 @@ struct match {
struct re_guts *g;
int eflags;
my_regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
+ const char *offp; /* offsets work from here */
+ const char *beginp; /* start of string -- virtual NUL precedes */
+ const char *endp; /* end of string -- virtual NUL here */
+ const char *coldp; /* can be no match starting before here */
+ const char **lastpos; /* [nplus+1] */
STATEVARS;
states st; /* current states */
states fresh; /* states for a fresh start */
@@ -66,20 +66,20 @@ static int /* 0 success, REG_NOMATCH f
matcher(charset,g, str, nmatch, pmatch, eflags)
CHARSET_INFO *charset;
register struct re_guts *g;
-char *str;
+const char *str;
size_t nmatch;
my_regmatch_t pmatch[];
int eflags;
{
- register char *endp;
+ register const char *endp;
register uint i;
struct match mv;
register struct match *m = &mv;
- register char *dp;
+ register const char *dp;
register const sopno gf = g->firststate+1; /* +1 for OEND */
register const sopno gl = g->laststate;
- char *start;
- char *stop;
+ const char *start;
+ const char *stop;
/* simplify the situation where possible */
if (g->cflags®_NOSUB)
@@ -163,7 +163,7 @@ int eflags;
dp = dissect(charset, m, m->coldp, endp, gf, gl);
} else {
if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
+ m->lastpos = (const char **)malloc((g->nplus+1) *
sizeof(char *));
if (g->nplus > 0 && m->lastpos == NULL) {
free(m->pmatch);
@@ -235,28 +235,28 @@ int eflags;
== static char *dissect(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* == stop (success) always */
+static const char * /* == stop (success) always */
dissect(charset, m, start, stop, startst, stopst)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
{
register uint i;
register sopno ss; /* start sop of current subRE */
register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
+ register const char *sp; /* start of string matched by it */
+ register const char *stp; /* string matched by it cannot pass here */
+ register const char *rest; /* start of rest of string */
+ register const char *tail; /* string unmatched by rest of RE */
register sopno ssub; /* start sop of subsubRE */
register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp; /* used in debug mode to check asserts */
+ register const char *ssp; /* start of string matched by subsubRE */
+ register const char *sep; /* end of string matched by subsubRE */
+ register const char *oldssp; /* previous ssp */
+ register const char *dp; /* used in debug mode to check asserts */
AT("diss", start, stop, startst, stopst);
sp = start;
@@ -424,23 +424,23 @@ sopno stopst;
== static char *backref(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst, sopno lev);
*/
-static char * /* == stop (success) or NULL (failure) */
+static const char * /* == stop (success) or NULL (failure) */
backref(charset,m, start, stop, startst, stopst, lev)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
sopno lev; /* PLUS nesting level */
{
register uint i;
register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
+ register const char *sp; /* start of string matched by it */
register sopno ssub; /* start sop of subsubRE */
register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
+ register const char *ssp; /* start of string matched by subsubRE */
+ register const char *dp;
register size_t len;
register int hard;
register sop s;
@@ -630,24 +630,24 @@ sopno lev; /* PLUS nesting level */
== static char *fast(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* where tentative match ended, or NULL */
+static const char * /* where tentative match ended, or NULL */
fast(charset, m, start, stop, startst, stopst)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
{
register states st = m->st;
register states fresh = m->fresh;
register states tmp = m->tmp;
- register char *p = start;
+ register const char *p = start;
register int c = (start == m->beginp) ? OUT : *(start-1);
register int lastc; /* previous c */
register int flagch;
register int i;
- register char *coldp; /* last p after which no match was underway */
+ register const char *coldp; /* last p after which no match was underway */
CLEAR(st);
SET1(st, startst);
@@ -722,24 +722,24 @@ sopno stopst;
== static char *slow(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* where it ended */
+static const char * /* where it ended */
slow(charset, m, start, stop, startst, stopst)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
{
register states st = m->st;
register states empty = m->empty;
register states tmp = m->tmp;
- register char *p = start;
+ register const char *p = start;
register int c = (start == m->beginp) ? OUT : *(start-1);
register int lastc; /* previous c */
register int flagch;
register int i;
- register char *matchp; /* last p at which a match ended */
+ register const char *matchp; /* last p at which a match ended */
AT("slow", start, stop, startst, stopst);
CLEAR(st);
=== modified file 'regex/engine.ih'
--- a/regex/engine.ih 2005-09-29 00:08:24 +0000
+++ b/regex/engine.ih 2009-11-29 23:08:56 +0000
@@ -4,11 +4,11 @@ extern "C" {
#endif
/* === engine.c === */
-static int matcher(CHARSET_INFO *charset,register struct re_guts *g, char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
-static char *dissect(CHARSET_INFO *charset,register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
+static int matcher(CHARSET_INFO *charset,register struct re_guts *g, const char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
+static const char *dissect(CHARSET_INFO *charset,register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *backref(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev);
+static const char *fast(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *slow(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
#define BOL (OUT+1)
#define EOL (BOL+1)
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2009-11-26 15:32:49 +0000
+++ b/sql/log_event.cc 2009-11-30 11:13:02 +0000
@@ -2142,7 +2142,7 @@ static void write_str_with_code_and_len(
*/
DBUG_ASSERT(len <= 255);
DBUG_ASSERT(src);
- *((*dst)++)= code;
+ *((*dst)++)= (uchar) code;
*((*dst)++)= (uchar) len;
bmove(*dst, src, len);
(*dst)+= len;
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-10-31 19:22:50 +0000
+++ b/sql/mysqld.cc 2009-11-26 20:19:33 +0000
@@ -957,6 +957,7 @@ static void close_connections(void)
tmp->killed= THD::KILL_CONNECTION;
thread_scheduler.post_kill_notification(tmp);
+ pthread_mutex_lock(&tmp->LOCK_thd_data);
if (tmp->mysys_var)
{
tmp->mysys_var->abort=1;
@@ -979,6 +980,7 @@ static void close_connections(void)
}
pthread_mutex_unlock(&tmp->mysys_var->mutex);
}
+ pthread_mutex_unlock(&tmp->LOCK_thd_data);
}
(void) pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list
=== modified file 'sql/scheduler.cc'
--- a/sql/scheduler.cc 2009-09-07 20:50:10 +0000
+++ b/sql/scheduler.cc 2009-11-26 20:19:33 +0000
@@ -235,9 +235,7 @@ void thd_scheduler::thread_detach()
if (thread_attached)
{
THD* thd = (THD*)list.data;
- pthread_mutex_lock(&thd->LOCK_thd_data);
- thd->mysys_var= NULL;
- pthread_mutex_unlock(&thd->LOCK_thd_data);
+ thd->reset_globals();
thread_attached= FALSE;
#ifndef DBUG_OFF
/*
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2009-09-15 10:46:35 +0000
+++ b/sql/sp_head.cc 2009-11-29 23:08:56 +0000
@@ -1924,9 +1924,10 @@ sp_head::execute_procedure(THD *thd, Lis
if (spvar->mode == sp_param_out)
{
Item_null *null_item= new Item_null();
+ Item *tmp_item= (Item*) null_item;
if (!null_item ||
- nctx->set_variable(thd, i, (Item **)&null_item))
+ nctx->set_variable(thd, i, &tmp_item))
{
err_status= TRUE;
break;
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_base.cc 2009-11-29 23:08:56 +0000
@@ -5823,6 +5823,7 @@ find_field_in_natural_join(THD *thd, TAB
{
/* This is a base table. */
DBUG_ASSERT(nj_col->view_field == NULL);
+ Item *ref= 0;
/*
This fix_fields is not necessary (initially this item is fixed by
the Item_field constructor; after reopen_tables the Item_func_eq
@@ -5830,12 +5831,13 @@ find_field_in_natural_join(THD *thd, TAB
reopening for columns that was dropped by the concurrent connection.
*/
if (!nj_col->table_field->fixed &&
- nj_col->table_field->fix_fields(thd, (Item **)&nj_col->table_field))
+ nj_col->table_field->fix_fields(thd, &ref))
{
DBUG_PRINT("info", ("column '%s' was dropped by the concurrent connection",
nj_col->table_field->name));
DBUG_RETURN(NULL);
}
+ DBUG_ASSERT(ref == 0); // Should not have changed
DBUG_ASSERT(nj_col->table_ref->table == nj_col->table_field->field->table);
found_field= nj_col->table_field->field;
update_field_dependencies(thd, found_field, nj_col->table_ref->table);
=== modified file 'sql/sql_builtin.cc.in'
--- a/sql/sql_builtin.cc.in 2006-12-31 01:29:11 +0000
+++ b/sql/sql_builtin.cc.in 2009-11-29 23:08:56 +0000
@@ -13,6 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include <my_global.h>
#include <mysql/plugin.h>
typedef struct st_mysql_plugin builtin_plugin[];
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2009-09-15 10:46:35 +0000
+++ b/sql/sql_class.cc 2009-11-26 20:19:33 +0000
@@ -1166,6 +1166,19 @@ bool THD::store_globals()
}
+/**
+ Untie THD from current thread
+
+ Used when using --thread-handling=pool-of-threads
+*/
+
+void THD::reset_globals()
+{
+ pthread_mutex_lock(&LOCK_thd_data);
+ mysys_var= 0;
+ pthread_mutex_unlock(&LOCK_thd_data);
+}
+
/*
Cleanup after query.
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2009-09-15 10:46:35 +0000
+++ b/sql/sql_class.h 2009-11-26 20:19:33 +0000
@@ -1906,6 +1906,7 @@ public:
void cleanup(void);
void cleanup_after_query();
bool store_globals();
+ void reset_globals();
#ifdef SIGNAL_WITH_VIO_CLOSE
inline void set_active_vio(Vio* vio)
{
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2009-11-07 10:34:19 +0000
+++ b/sql/sql_insert.cc 2009-11-26 20:19:33 +0000
@@ -2279,6 +2279,7 @@ void kill_delayed_threads(void)
while ((di= it++))
{
di->thd.killed= THD::KILL_CONNECTION;
+ pthread_mutex_lock(&di->thd.LOCK_thd_data);
if (di->thd.mysys_var)
{
pthread_mutex_lock(&di->thd.mysys_var->mutex);
@@ -2297,6 +2298,7 @@ void kill_delayed_threads(void)
}
pthread_mutex_unlock(&di->thd.mysys_var->mutex);
}
+ pthread_mutex_unlock(&di->thd.LOCK_thd_data);
}
VOID(pthread_mutex_unlock(&LOCK_delayed_insert)); // For unlink from list
}
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2009-11-06 17:22:32 +0000
+++ b/sql/sql_parse.cc 2009-11-29 23:08:56 +0000
@@ -464,7 +464,7 @@ pthread_handler_t handle_bootstrap(void
thd->init_for_queries();
while (fgets(buff, thd->net.max_packet, file))
{
- char *query, *res;
+ char *query;
/* strlen() can't be deleted because fgets() doesn't return length */
ulong length= (ulong) strlen(buff);
while (buff[length-1] != '\n' && !feof(file))
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-11-06 17:22:32 +0000
+++ b/sql/sql_select.cc 2009-11-29 23:08:56 +0000
@@ -3586,8 +3586,9 @@ add_key_fields(JOIN *join, KEY_FIELD **k
{
if (!field->eq(item->field))
{
+ Item *tmp_item= (Item*) item;
add_key_field(key_fields, *and_level, cond_func, field,
- TRUE, (Item **) &item, 1, usable_tables,
+ TRUE, &tmp_item, 1, usable_tables,
sargables);
}
}
@@ -15748,7 +15749,11 @@ static bool add_ref_to_table_cond(THD *t
DBUG_RETURN(TRUE);
if (!cond->fixed)
- cond->fix_fields(thd, (Item**)&cond);
+ {
+ Item *tmp_item= (Item*) cond;
+ cond->fix_fields(thd, &tmp_item);
+ DBUG_ASSERT(cond == tmp_item);
+ }
if (join_tab->select)
{
error=(int) cond->add(join_tab->select->cond);
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2009-11-02 09:30:21 +0000
+++ b/sql/sql_show.cc 2009-11-29 23:08:56 +0000
@@ -1747,6 +1747,7 @@ void mysqld_list_processes(THD *thd,cons
if ((thd_info->db=tmp->db)) // Safe test
thd_info->db=thd->strdup(thd_info->db);
thd_info->command=(int) tmp->command;
+ pthread_mutex_lock(&tmp->LOCK_thd_data);
if ((mysys_var= tmp->mysys_var))
pthread_mutex_lock(&mysys_var->mutex);
thd_info->proc_info= (char*) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0);
@@ -1766,6 +1767,7 @@ void mysqld_list_processes(THD *thd,cons
#endif
if (mysys_var)
pthread_mutex_unlock(&mysys_var->mutex);
+ pthread_mutex_unlock(&tmp->LOCK_thd_data);
thd_info->start_time= tmp->start_time;
thd_info->query=0;
@@ -3549,7 +3551,9 @@ static int get_schema_tables_record(THD
TABLE_SHARE *share= show_table->s;
handler *file= show_table->file;
handlerton *tmp_db_type= share->db_type();
+#ifdef WITH_PARTITION_STORAGE_ENGINE
bool is_partitioned= FALSE;
+#endif
if (share->tmp_table == SYSTEM_TMP_TABLE)
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
else if (share->tmp_table)
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2009-10-15 21:38:29 +0000
+++ b/sql/table.cc 2009-11-29 23:08:56 +0000
@@ -2077,8 +2077,9 @@ ulong get_form_pos(File file, uchar *hea
else
{
char *str;
+ const char **tmp = (const char**) (char*) buf;
str=(char *) (buf+a_length);
- fix_type_pointers((const char ***) &buf,save_names,1,&str);
+ fix_type_pointers(&tmp, save_names, 1, &str);
}
DBUG_RETURN(ret_value);
}
=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc 2009-11-07 10:34:19 +0000
+++ b/storage/maria/ha_maria.cc 2009-11-29 23:08:56 +0000
@@ -665,10 +665,9 @@ int maria_check_definition(MARIA_KEYDEF
extern "C" {
-volatile int *_ma_killed_ptr(HA_CHECK *param)
+int _ma_killed_ptr(HA_CHECK *param)
{
- /* In theory Unsafe conversion, but should be ok for now */
- return (int*) &(((THD *) (param->thd))->killed);
+ return thd_killed((THD*)param->thd);
}
=== modified file 'storage/maria/lockman.c'
--- a/storage/maria/lockman.c 2008-02-21 00:51:51 +0000
+++ b/storage/maria/lockman.c 2009-11-29 23:08:56 +0000
@@ -360,7 +360,7 @@ retry:
else
{
if (my_atomic_casptr((void **)cursor->prev,
- (void **)&cursor->curr, cursor->next))
+ (void **)(char*) &cursor->curr, cursor->next))
_lf_alloc_free(pins, cursor->curr);
else
{
@@ -421,7 +421,8 @@ static int lockinsert(LOCK * volatile *h
node->link= (intptr)cursor.curr;
DBUG_ASSERT(node->link != (intptr)node);
DBUG_ASSERT(cursor.prev != &node->link);
- if (!my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+ if (!my_atomic_casptr((void **)cursor.prev,
+ (void **)(char*) &cursor.curr, node))
{
res= REPEAT_ONCE_MORE;
node->flags&= ~ACTIVE;
@@ -498,11 +499,11 @@ static int lockdelete(LOCK * volatile *h
then we can delete. Good news is - this is only required when rolling
back a savepoint.
*/
- if (my_atomic_casptr((void **)&(cursor.curr->link),
- (void **)&cursor.next, 1+(char *)cursor.next))
+ if (my_atomic_casptr((void **)(char*)&(cursor.curr->link),
+ (void **)(char*)&cursor.next, 1+(char *)cursor.next))
{
if (my_atomic_casptr((void **)cursor.prev,
- (void **)&cursor.curr, cursor.next))
+ (void **)(char*)&cursor.curr, cursor.next))
_lf_alloc_free(pins, cursor.curr);
else
lockfind(head, node, &cursor, pins);
@@ -573,7 +574,7 @@ static void initialize_bucket(LOCKMAN *l
my_free((void *)dummy, MYF(0));
dummy= cur;
}
- my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+ my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
}
static inline uint calc_hash(uint64 resource)
=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c 2009-05-06 12:03:24 +0000
+++ b/storage/maria/ma_check.c 2009-11-29 23:08:56 +0000
@@ -215,7 +215,7 @@ int maria_chk_del(HA_CHECK *param, regis
empty=0;
for (i= share->state.state.del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(1);
if (test_flag & T_VERBOSE)
printf(" %9s",llstr(next_link,buff));
@@ -310,7 +310,7 @@ static int check_k_link(HA_CHECK *param,
records= (ha_rows) (share->state.state.key_file_length / block_size);
while (next_link != HA_OFFSET_ERROR && records > 0)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(1);
if (param->testflag & T_VERBOSE)
printf("%16s",llstr(next_link,llbuff));
@@ -876,10 +876,10 @@ static int chk_index(HA_CHECK *param, MA
tmp_key.data= tmp_key_buff;
for ( ;; )
{
- if (*_ma_killed_ptr(param))
- goto err;
if (nod_flag)
{
+ if (_ma_killed_ptr(param))
+ goto err;
next_page= _ma_kpos(nod_flag,keypos);
if (chk_index_down(param,info,keyinfo,next_page,
temp_buff,keys,key_checksum,level+1))
@@ -1180,7 +1180,7 @@ static int check_static_record(HA_CHECK
pos= 0;
while (pos < share->state.state.data_file_length)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
return -1;
if (my_b_read(¶m->read_cache, record,
share->base.pack_reclength))
@@ -1230,7 +1230,7 @@ static int check_dynamic_record(HA_CHECK
{
my_bool got_error= 0;
int flag;
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(-1);
flag= block_info.second_read=0;
@@ -1451,7 +1451,7 @@ static int check_compressed_record(HA_CH
pos= share->pack.header_length; /* Skip header */
while (pos < share->state.state.data_file_length)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(-1);
if (_ma_read_cache(¶m->read_cache, block_info.header, pos,
@@ -1815,7 +1815,7 @@ static int check_block_record(HA_CHECK *
LINT_INIT(row_count);
LINT_INIT(empty_space);
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
{
_ma_scan_end_block_record(info);
return -1;
@@ -4631,7 +4631,7 @@ static int sort_get_next_record(MARIA_SO
char llbuff[22],llbuff2[22];
DBUG_ENTER("sort_get_next_record");
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(1);
switch (sort_info->org_data_file_type) {
=== modified file 'storage/maria/ma_check_standalone.h'
--- a/storage/maria/ma_check_standalone.h 2007-10-03 16:10:32 +0000
+++ b/storage/maria/ma_check_standalone.h 2009-11-29 23:08:56 +0000
@@ -30,11 +30,9 @@
Check if check/repair operation was killed by a signal
*/
-static int not_killed= 0;
-
-volatile int *_ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
+int _ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
{
- return ¬_killed; /* always NULL */
+ return 0;
}
/* print warnings and errors */
=== modified file 'storage/maria/ma_ft_boolean_search.c'
--- a/storage/maria/ma_ft_boolean_search.c 2009-02-19 09:01:25 +0000
+++ b/storage/maria/ma_ft_boolean_search.c 2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- char *query, int len)
+ const uchar *query, size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
- uchar **start= (uchar**) &query;
- uchar *end= (uchar*) query + len;
+ const uchar **start= &query;
+ const uchar *end= query + len;
FT_WORD w;
info.prev= ' ';
info.quot= 0;
while (maria_ft_get_word(cs, start, end, &w, &info))
- param->mysql_add_word(param, (char *) w.pos, w.len, &info);
+ param->mysql_add_word(param, w.pos, w.len, &info);
return(0);
}
@@ -615,7 +615,7 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -647,15 +647,15 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- char *document, int len)
+ const uchar *document, size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
- const uchar *docend= (uchar*) document + len;
- while (maria_ft_simple_get_word(phrase_param->cs, (uchar**) &document,
+ const uchar *docend= document + len;
+ while (maria_ft_simple_get_word(phrase_param->cs, &document,
docend, &word, FALSE))
{
- param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+ param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match)
break;
}
@@ -872,7 +872,7 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int len,
+ const uchar *word, size_t len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -933,15 +933,14 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- char *doc, int len)
+ const uchar *doc, size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
- uchar *end= (uchar*) doc + len;
+ const uchar *end= doc + len;
FT_WORD w;
- while (maria_ft_simple_get_word(ftb->charset, (uchar**) &doc,
- end, &w, TRUE))
- param->mysql_add_word(param, (char *) w.pos, w.len, 0);
+ while (maria_ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+ param->mysql_add_word(param, w.pos, w.len, 0);
return(0);
}
=== modified file 'storage/maria/ma_ft_nlq_search.c'
--- a/storage/maria/ma_ft_nlq_search.c 2009-01-09 04:23:25 +0000
+++ b/storage/maria/ma_ft_nlq_search.c 2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int subkeys, r;
+ int32 subkeys;
+ int r;
uint doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
@@ -127,7 +128,7 @@ static int walk_and_match(FT_WORD *word,
goto do_skip;
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
- tmp_weight=*(float*)&subkeys;
+ tmp_weight=*(float*) (char*) &subkeys;
#else
#error
#endif
=== modified file 'storage/maria/ma_ft_parser.c'
--- a/storage/maria/ma_ft_parser.c 2009-02-19 09:01:25 +0000
+++ b/storage/maria/ma_ft_parser.c 2009-11-29 23:08:56 +0000
@@ -109,10 +109,11 @@ my_bool maria_ft_boolean_check_syntax_st
3 - right bracket
4 - stopword found
*/
-uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar maria_ft_get_word(CHARSET_INFO *cs, const uchar **start,
+ const uchar *end,
FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{
- uchar *doc=*start;
+ const uchar *doc= *start;
int ctype;
uint mwc, length;
int mbl;
@@ -203,11 +204,11 @@ ret:
return param->type;
}
-uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
+uchar maria_ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
const uchar *end, FT_WORD *word,
my_bool skip_stopwords)
{
- uchar *doc= *start;
+ const uchar *doc= *start;
uint mwc, length;
int ctype, mbl;
DBUG_ENTER("maria_ft_simple_get_word");
@@ -259,8 +260,9 @@ void maria_ft_parse_init(TREE *wtree, CH
static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+ __attribute__((unused)))
{
TREE *wtree;
FT_WORD w;
@@ -276,7 +278,7 @@ static int maria_ft_add_word(MYSQL_FTPAR
w.pos= ptr;
}
else
- w.pos= (uchar *) word;
+ w.pos= word;
w.len= word_len;
if (!tree_insert(wtree, &w, 0, wtree->custom_arg))
{
@@ -288,17 +290,17 @@ static int maria_ft_add_word(MYSQL_FTPAR
static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- char *doc_arg, int doc_len)
+ const uchar *doc_arg, size_t doc_len)
{
- uchar *doc= (uchar*) doc_arg;
- uchar *end= doc + doc_len;
+ const uchar *doc= doc_arg;
+ const uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
DBUG_ENTER("maria_ft_parse_internal");
while (maria_ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE))
- if (param->mysql_add_word(param, (char *) w.pos, w.len, 0))
+ if (param->mysql_add_word(param, w.pos, w.len, 0))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
@@ -378,7 +380,7 @@ MYSQL_FTPARSER_PARAM *maria_ftparser_cal
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, char *, int,
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
=== modified file 'storage/maria/ma_ftdefs.h'
--- a/storage/maria/ma_ftdefs.h 2009-02-12 17:51:00 +0000
+++ b/storage/maria/ma_ftdefs.h 2009-11-29 23:08:56 +0000
@@ -96,7 +96,7 @@
#define FTB_RQUOT (ft_boolean_syntax[11])
typedef struct st_maria_ft_word {
- uchar * pos;
+ const uchar * pos;
uint len;
double weight;
} FT_WORD;
@@ -106,9 +106,9 @@ int is_stopword(char *word, uint len);
MARIA_KEY *_ma_ft_make_key(MARIA_HA *, MARIA_KEY *, uint , uchar *, FT_WORD *,
my_off_t);
-uchar maria_ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
- MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar maria_ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar maria_ft_get_word(CHARSET_INFO *, const uchar **, const uchar *,
+ FT_WORD *, MYSQL_FTPARSER_BOOLEAN_INFO *);
+uchar maria_ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
FT_WORD *, my_bool);
typedef struct _st_maria_ft_seg_iterator {
=== modified file 'storage/maria/ma_sort.c'
--- a/storage/maria/ma_sort.c 2009-01-09 04:23:25 +0000
+++ b/storage/maria/ma_sort.c 2009-11-29 23:08:56 +0000
@@ -920,7 +920,6 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
uchar *strpos;
BUFFPEK *buffpek,**refpek;
QUEUE queue;
- volatile int *killed= _ma_killed_ptr(info->sort_info->param);
DBUG_ENTER("merge_buffers");
count=error=0;
@@ -953,10 +952,6 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
{
for (;;)
{
- if (*killed)
- {
- error=1; goto err;
- }
buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file)
{
@@ -976,6 +971,12 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
buffpek->key+=sort_length;
if (! --buffpek->mem_count)
{
+ /* It's enough to check for killedptr before a slow operation */
+ if (_ma_killed_ptr(info->sort_info->param))
+ {
+ error=1;
+ goto err;
+ }
if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
{
uchar *base= buffpek->base;
=== modified file 'storage/maria/ma_state.c'
--- a/storage/maria/ma_state.c 2009-10-06 06:57:22 +0000
+++ b/storage/maria/ma_state.c 2009-11-29 23:08:56 +0000
@@ -528,7 +528,7 @@ void _ma_remove_table_from_trnman(MARIA_
safe_mutex_assert_owner(&share->intern_lock);
- for (prev= (MARIA_USED_TABLES**) &trn->used_tables, tables= *prev;
+ for (prev= (MARIA_USED_TABLES**) (char*) &trn->used_tables, tables= *prev;
tables;
tables= *prev)
{
=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h 2009-10-06 06:57:22 +0000
+++ b/storage/maria/maria_def.h 2009-11-29 23:08:56 +0000
@@ -1160,7 +1160,7 @@ int _ma_flush_table_files(MARIA_HA *info
Functions needed by _ma_check (are overridden in MySQL/ha_maria.cc).
See ma_check_standalone.h .
*/
-volatile int *_ma_killed_ptr(HA_CHECK *param);
+int _ma_killed_ptr(HA_CHECK *param);
void _ma_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...))
ATTRIBUTE_FORMAT(printf, 2, 3);
void _ma_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...))
=== modified file 'storage/maria/maria_ftdump.c'
--- a/storage/maria/maria_ftdump.c 2008-08-25 11:49:47 +0000
+++ b/storage/maria/maria_ftdump.c 2009-11-29 23:08:56 +0000
@@ -116,7 +116,7 @@ int main(int argc,char *argv[])
subkeys=ft_sintXkorr(info->lastkey_buff + keylen + 1);
if (subkeys >= 0)
- weight=*(float*)&subkeys;
+ weight=*(float*) (char*) &subkeys;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);
=== modified file 'storage/maria/trnman.c'
--- a/storage/maria/trnman.c 2009-03-05 13:46:45 +0000
+++ b/storage/maria/trnman.c 2009-11-29 23:08:56 +0000
@@ -300,8 +300,8 @@ TRN *trnman_new_trn(WT_THD *wt)
(ABA isn't possible, we're behind a mutex
*/
my_atomic_rwlock_wrlock(&LOCK_pool);
- while (tmp.trn && !my_atomic_casptr((void **)&pool, &tmp.v,
- (void *)tmp.trn->next))
+ while (tmp.trn && !my_atomic_casptr((void **)(char*) &pool, &tmp.v,
+ (void *)tmp.trn->next))
/* no-op */;
my_atomic_rwlock_wrunlock(&LOCK_pool);
@@ -545,7 +545,7 @@ static void trnman_free_trn(TRN *trn)
down after the loop at -O2
*/
*(TRN * volatile *)&(trn->next)= tmp.trn;
- } while (!my_atomic_casptr((void **)&pool, &tmp.v, trn));
+ } while (!my_atomic_casptr((void **)(char*)&pool, &tmp.v, trn));
my_atomic_rwlock_wrunlock(&LOCK_pool);
}
=== modified file 'storage/myisam/ft_boolean_search.c'
--- a/storage/myisam/ft_boolean_search.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/ft_boolean_search.c 2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- char *query, int len)
+ const uchar *query, size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
- uchar **start= (uchar**) &query;
- uchar *end= (uchar*) query + len;
+ const uchar **start= &query;
+ const uchar *end= query + len;
FT_WORD w;
info.prev= ' ';
info.quot= 0;
while (ft_get_word(cs, start, end, &w, &info))
- param->mysql_add_word(param, (char*) w.pos, w.len, &info);
+ param->mysql_add_word(param, w.pos, w.len, &info);
return(0);
}
@@ -616,7 +616,7 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -648,15 +648,15 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- char *document, int len)
+ const uchar *document, size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
const uchar *docend= (uchar*) document + len;
- while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend,
+ while (ft_simple_get_word(phrase_param->cs, &document, docend,
&word, FALSE))
{
- param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+ param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match)
break;
}
@@ -874,7 +874,7 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int len,
+ const uchar *word, size_t len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -888,8 +888,8 @@ static int ftb_find_relevance_add_word(M
for (a= 0, b= ftb->queue.elements, c= (a+b)/2; b-a>1; c= (a+b)/2)
{
ftbw= ftb->list[c];
- if (ha_compare_text(ftb->charset, (uchar*)word, len,
- (uchar*)ftbw->word+1, ftbw->len-1,
+ if (ha_compare_text(ftb->charset, word, len,
+ ftbw->word+1, ftbw->len-1,
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0)
b= c;
else
@@ -915,8 +915,8 @@ static int ftb_find_relevance_add_word(M
for (; c >= 0; c--)
{
ftbw= ftb->list[c];
- if (ha_compare_text(ftb->charset, (uchar*)word, len,
- (uchar*)ftbw->word + 1,ftbw->len - 1,
+ if (ha_compare_text(ftb->charset, word, len,
+ ftbw->word + 1,ftbw->len - 1,
(my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0))
{
if (ftb->with_scan & FTB_FLAG_TRUNC)
@@ -935,14 +935,14 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- char *doc, int len)
+ const uchar *doc, size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
- uchar *end= (uchar*) doc + len;
+ const uchar *end= doc + len;
FT_WORD w;
- while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
- param->mysql_add_word(param, (char*) w.pos, w.len, 0);
+ while (ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+ param->mysql_add_word(param, w.pos, w.len, 0);
return(0);
}
=== modified file 'storage/myisam/ft_nlq_search.c'
--- a/storage/myisam/ft_nlq_search.c 2008-04-28 16:24:05 +0000
+++ b/storage/myisam/ft_nlq_search.c 2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int subkeys, r;
+ int32 subkeys;
+ int r;
uint keylen, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
@@ -123,7 +124,8 @@ static int walk_and_match(FT_WORD *word,
goto do_skip;
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
- tmp_weight=*(float*)&subkeys;
+ /* The weight we read was actually a float */
+ tmp_weight=*(float*) (char*) &subkeys;
#else
#error
#endif
=== modified file 'storage/myisam/ft_parser.c'
--- a/storage/myisam/ft_parser.c 2009-02-12 14:08:56 +0000
+++ b/storage/myisam/ft_parser.c 2009-11-29 23:08:56 +0000
@@ -106,10 +106,10 @@ my_bool ft_boolean_check_syntax_string(c
3 - right bracket
4 - stopword found
*/
-uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end,
FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{
- uchar *doc=*start;
+ const uchar *doc= *start;
int ctype;
uint mwc, length;
int mbl;
@@ -201,10 +201,11 @@ ret:
return param->type;
}
-uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
- FT_WORD *word, my_bool skip_stopwords)
+uchar ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
+ const uchar *end, FT_WORD *word,
+ my_bool skip_stopwords)
{
- uchar *doc= *start;
+ const uchar *doc= *start;
uint mwc, length;
int mbl;
int ctype;
@@ -216,7 +217,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
{
if (doc >= end)
DBUG_RETURN(0);
- mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+ mbl= cs->cset->ctype(cs, &ctype, doc, end);
if (true_word_char(ctype, *doc))
break;
}
@@ -225,7 +226,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
for (word->pos= doc; doc < end; length++,
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
{
- mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+ mbl= cs->cset->ctype(cs, &ctype, doc, end);
if (true_word_char(ctype, *doc))
mwc= 0;
else if (!misc_word_char(*doc) || mwc)
@@ -238,7 +239,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
if (skip_stopwords == FALSE ||
(length >= ft_min_word_len && length < ft_max_word_len &&
- !is_stopword((char*) word->pos, word->len)))
+ !is_stopword(word->pos, word->len)))
{
*start= doc;
DBUG_RETURN(1);
@@ -257,8 +258,9 @@ void ft_parse_init(TREE *wtree, CHARSET_
static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+ __attribute__((unused)))
{
TREE *wtree;
FT_WORD w;
@@ -286,10 +288,10 @@ static int ft_add_word(MYSQL_FTPARSER_PA
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- char *doc_arg, int doc_len)
+ const uchar *doc_arg, size_t doc_len)
{
- uchar *doc= (uchar*) doc_arg;
- uchar *end= doc + doc_len;
+ const uchar *doc= doc_arg;
+ const uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
@@ -302,7 +304,7 @@ static int ft_parse_internal(MYSQL_FTPAR
}
-int ft_parse(TREE *wtree, uchar *doc, int doclen,
+int ft_parse(TREE *wtree, const uchar *doc, int doclen,
struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
@@ -377,7 +379,7 @@ MYSQL_FTPARSER_PARAM *ftparser_call_init
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, char *, int,
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
=== modified file 'storage/myisam/ft_stopwords.c'
--- a/storage/myisam/ft_stopwords.c 2008-04-28 16:24:05 +0000
+++ b/storage/myisam/ft_stopwords.c 2009-11-29 23:08:56 +0000
@@ -66,7 +66,8 @@ int ft_init_stopwords()
{
File fd;
uint len;
- uchar *buffer, *start, *end;
+ uchar *buffer;
+ const uchar *start, *end;
FT_WORD w;
int error=-1;
@@ -109,7 +110,7 @@ err0:
}
-int is_stopword(char *word, uint len)
+int is_stopword(const uchar *word, size_t len)
{
FT_STOPWORD sw;
sw.pos=word;
=== modified file 'storage/myisam/ftdefs.h'
--- a/storage/myisam/ftdefs.h 2009-01-26 06:35:15 +0000
+++ b/storage/myisam/ftdefs.h 2009-11-29 23:08:56 +0000
@@ -96,18 +96,18 @@
#define FTB_RQUOT (ft_boolean_syntax[11])
typedef struct st_ft_word {
- uchar * pos;
+ const uchar *pos;
uint len;
double weight;
} FT_WORD;
-int is_stopword(char *word, uint len);
+int is_stopword(const uchar *word, size_t len);
uint _ft_make_key(MI_INFO *, uint , uchar *, FT_WORD *, my_off_t);
-uchar ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
+uchar ft_get_word(CHARSET_INFO *, const uchar **, const uchar *, FT_WORD *,
MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
FT_WORD *, my_bool);
typedef struct _st_ft_seg_iterator {
@@ -121,7 +121,7 @@ void _mi_ft_segiterator_dummy_init(const
uint _mi_ft_segiterator(FT_SEG_ITERATOR *);
void ft_parse_init(TREE *, CHARSET_INFO *);
-int ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
+int ft_parse(TREE *, const uchar *, int, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * ft_linearize(TREE *, MEM_ROOT *);
FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const uchar *, MEM_ROOT *);
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2009-10-06 14:53:46 +0000
+++ b/storage/myisam/ha_myisam.cc 2009-11-29 23:08:56 +0000
@@ -497,10 +497,9 @@ int check_definition(MI_KEYDEF *t1_keyin
extern "C" {
-volatile int *killed_ptr(HA_CHECK *param)
+int killed_ptr(HA_CHECK *param)
{
- /* In theory Unsafe conversion, but should be ok for now */
- return (int*) &(((THD *)(param->thd))->killed);
+ return thd_killed((THD*)param->thd);
}
void mi_check_print_error(HA_CHECK *param, const char *fmt,...)
=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/mi_check.c 2009-11-29 23:08:56 +0000
@@ -166,7 +166,7 @@ int chk_del(HA_CHECK *param, register MI
empty=0;
for (i= info->state->del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
DBUG_RETURN(1);
if (test_flag & T_VERBOSE)
printf(" %9s",llstr(next_link,buff));
@@ -261,7 +261,7 @@ static int check_k_link(HA_CHECK *param,
records= (ha_rows) (info->state->key_file_length / block_size);
while (next_link != HA_OFFSET_ERROR && records > 0)
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
DBUG_RETURN(1);
if (param->testflag & T_VERBOSE)
printf("%16s",llstr(next_link,llbuff));
@@ -778,7 +778,7 @@ static int chk_index(HA_CHECK *param, MI
}
for ( ;; )
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
goto err;
memcpy((char*) info->lastkey,(char*) key,key_length);
info->lastkey_length=key_length;
@@ -990,7 +990,7 @@ int chk_data_link(HA_CHECK *param, MI_IN
bzero((char*) key_checksum, info->s->base.keys * sizeof(key_checksum[0]));
while (pos < info->state->data_file_length)
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
goto err2;
switch (info->s->data_file_type) {
case BLOCK_RECORD:
@@ -3247,7 +3247,7 @@ static int sort_get_next_record(MI_SORT_
char llbuff[22],llbuff2[22];
DBUG_ENTER("sort_get_next_record");
- if (*killed_ptr(param))
+ if (killed_ptr(param))
DBUG_RETURN(1);
switch (share->data_file_type) {
=== modified file 'storage/myisam/myisam_ftdump.c'
--- a/storage/myisam/myisam_ftdump.c 2007-05-10 09:59:39 +0000
+++ b/storage/myisam/myisam_ftdump.c 2009-11-29 23:08:56 +0000
@@ -113,7 +113,7 @@ int main(int argc,char *argv[])
subkeys=ft_sintXkorr(info->lastkey+keylen+1);
if (subkeys >= 0)
- weight=*(float*)&subkeys;
+ weight= *(float*) (char*) &subkeys;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c 2009-09-19 21:21:29 +0000
+++ b/storage/myisam/myisamchk.c 2009-11-29 23:08:56 +0000
@@ -1745,11 +1745,9 @@ err:
sorting
*/
-static int not_killed= 0;
-
-volatile int *killed_ptr(HA_CHECK *param __attribute__((unused)))
+int killed_ptr(HA_CHECK *param __attribute__((unused)))
{
- return ¬_killed; /* always NULL */
+ return 0;
}
/* print warnings and errors */
=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h 2009-10-06 06:57:22 +0000
+++ b/storage/myisam/myisamdef.h 2009-11-29 23:08:56 +0000
@@ -725,7 +725,7 @@ my_bool mi_dynmap_file(MI_INFO *info, my
void mi_remap_file(MI_INFO *info, my_off_t size);
/* Functions needed by mi_check */
-volatile int *killed_ptr(HA_CHECK *param);
+int killed_ptr(HA_CHECK *param);
void mi_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...));
void mi_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...));
void mi_check_print_info _VARARGS((HA_CHECK *param, const char *fmt, ...));
=== modified file 'storage/myisam/myisamlog.c'
--- a/storage/myisam/myisamlog.c 2008-02-18 22:35:17 +0000
+++ b/storage/myisam/myisamlog.c 2009-11-29 23:08:56 +0000
@@ -385,7 +385,7 @@ static int examine_log(char * file_name,
file_info.name=0;
file_info.show_name=0;
file_info.record=0;
- if (read_string(&cache,(uchar**) &file_info.name,
+ if (read_string(&cache,(uchar**) (char*) &file_info.name,
(uint) mi_uint2korr(head)))
goto err;
{
=== modified file 'storage/myisam/sort.c'
--- a/storage/myisam/sort.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/sort.c 2009-11-29 23:08:56 +0000
@@ -900,7 +900,6 @@ merge_buffers(MI_SORT_PARAM *info, uint
uchar *strpos;
BUFFPEK *buffpek,**refpek;
QUEUE queue;
- volatile int *killed= killed_ptr(info->sort_info->param);
DBUG_ENTER("merge_buffers");
count=error=0;
@@ -933,10 +932,6 @@ merge_buffers(MI_SORT_PARAM *info, uint
{
for (;;)
{
- if (*killed)
- {
- error=1; goto err;
- }
buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file)
{
@@ -956,6 +951,12 @@ merge_buffers(MI_SORT_PARAM *info, uint
buffpek->key+=sort_length;
if (! --buffpek->mem_count)
{
+ /* It's enough to check for killedptr before a slow operation */
+ if (killed_ptr(info->sort_info->param))
+ {
+ error=1;
+ goto err;
+ }
if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
{
uchar *base= buffpek->base;
=== modified file 'storage/xtradb/fil/fil0fil.c'
--- a/storage/xtradb/fil/fil0fil.c 2009-11-13 21:26:08 +0000
+++ b/storage/xtradb/fil/fil0fil.c 2009-11-29 23:08:56 +0000
@@ -3139,7 +3139,7 @@ skip_info:
if (mach_read_from_4(page + FIL_PAGE_OFFSET) || !offset) {
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
- for (i = 0; i < n_index; i++) {
+ for (i = 0; (ulint) i < n_index; i++) {
if (offset / UNIV_PAGE_SIZE == root_page[i]) {
/* this is index root page */
mach_write_to_4(page + FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
=== modified file 'storage/xtradb/trx/trx0i_s.c'
--- a/storage/xtradb/trx/trx0i_s.c 2009-09-07 10:22:53 +0000
+++ b/storage/xtradb/trx/trx0i_s.c 2009-11-29 23:08:56 +0000
@@ -28,11 +28,11 @@ table cache" for later retrieval.
Created July 17, 2007 Vasil Dimov
*******************************************************/
-#include <mysql/plugin.h>
#include "mysql_addons.h"
#include "univ.i"
+#include <mysql/plugin.h>
#include "buf0buf.h"
#include "dict0dict.h"
#include "ha0storage.h"
1
0
[Maria-developers] Updated (by Knielsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 30 Nov '09
by worklog-noreply@askmonty.org 30 Nov '09
30 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
[ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Knielsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 30 Nov '09
by worklog-noreply@askmonty.org 30 Nov '09
30 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
[ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Knielsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 30 Nov '09
by worklog-noreply@askmonty.org 30 Nov '09
30 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
[ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 30 Nov '09
by worklog-noreply@askmonty.org 30 Nov '09
30 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part. Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
[ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 30 Nov '09
by worklog-noreply@askmonty.org 30 Nov '09
30 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part. Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
[ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 30 Nov '09
by worklog-noreply@askmonty.org 30 Nov '09
30 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part. Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
[ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2771)
by Michael Widenius 30 Nov '09
by Michael Widenius 30 Nov '09
30 Nov '09
#At lp:maria based on revid:monty@askmonty.org-20091129230856-358dn8f5bqx1d67g
2771 Michael Widenius 2009-11-30
Ignore temporary directory
modified:
.bzrignore
=== modified file '.bzrignore'
--- a/.bzrignore 2009-11-06 17:22:32 +0000
+++ b/.bzrignore 2009-11-29 23:16:14 +0000
@@ -1922,3 +1922,4 @@ libmysqld/examples/mysqltest.cc
extra/libevent/event-config.h
libmysqld/opt_table_elimination.cc
libmysqld/ha_federatedx.cc
+tmp
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 29 Nov '09
by worklog-noreply@askmonty.org 29 Nov '09
29 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part. Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 29 Nov '09
by worklog-noreply@askmonty.org 29 Nov '09
29 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part. Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 29 Nov '09
by worklog-noreply@askmonty.org 29 Nov '09
29 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part. Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
LOW-LEVEL DESIGN:
mysql_binlog_send() [sql/sql_repl.cc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 29 Nov '09
by worklog-noreply@askmonty.org 29 Nov '09
29 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part. Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 29 Nov '09
by worklog-noreply@askmonty.org 29 Nov '09
29 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part. Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Alexi): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 29 Nov '09
by worklog-noreply@askmonty.org 29 Nov '09
29 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-row-events
Setting this option makes RBR (row-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_row_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part. Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] bzr commit into Mariadb 5.2, with Maria 2.0:maria/5.2 branch (sanja:2725)
by sanja@askmonty.org 27 Nov '09
by sanja@askmonty.org 27 Nov '09
27 Nov '09
#At lp:maria/5.2
2725 sanja(a)askmonty.org 2009-07-07
Group commit and small optimisation of flush log (in case of page without CRC and sector protection) added. (for review)
modified:
mysql-test/suite/maria/r/maria3.result
storage/maria/ha_maria.cc
storage/maria/ma_init.c
storage/maria/ma_loghandler.c
storage/maria/ma_loghandler.h
per-file messages:
mysql-test/suite/maria/r/maria3.result
New variables added
storage/maria/ha_maria.cc
New variables for group commit and routines to control them added.
storage/maria/ma_init.c
Service thread stop (if it is present)
storage/maria/ma_loghandler.c
2 types of group commit added.
If page is not protetcted by CRC or sector protection (i.e. we do not change header when add data to the page) we do not copy beginning of the page during forcing the buffer where the page is last to close.
storage/maria/ma_loghandler.h
Routines to control group commit added.
=== modified file 'mysql-test/suite/maria/r/maria3.result'
--- a/mysql-test/suite/maria/r/maria3.result 2009-02-19 09:01:25 +0000
+++ b/mysql-test/suite/maria/r/maria3.result 2009-07-07 00:37:23 +0000
@@ -264,6 +264,8 @@ Variable_name Value
maria_block_size 8192
maria_checkpoint_interval 30
maria_force_start_after_recovery_failures 0
+maria_group_commit none
+maria_group_commit_rate 800
maria_log_file_size 4294959104
maria_log_purge_type immediate
maria_max_sort_file_size 9223372036853727232
@@ -285,6 +287,7 @@ Maria_pagecache_read_requests #
Maria_pagecache_reads #
Maria_pagecache_write_requests #
Maria_pagecache_writes #
+Maria_transaction_log_syncs #
create table t1 (b char(0));
insert into t1 values(NULL),("");
select length(b) from t1;
=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc 2009-05-19 09:28:05 +0000
+++ b/storage/maria/ha_maria.cc 2009-07-07 00:37:23 +0000
@@ -101,22 +101,40 @@ TYPELIB maria_translog_purge_type_typeli
array_elements(maria_translog_purge_type_names) - 1, "",
maria_translog_purge_type_names, NULL
};
+
+/* transactional log directory sync */
const char *maria_sync_log_dir_names[]=
{
"NEVER", "NEWFILE", "ALWAYS", NullS
};
-
TYPELIB maria_sync_log_dir_typelib=
{
array_elements(maria_sync_log_dir_names) - 1, "",
maria_sync_log_dir_names, NULL
};
+/* transactional log group commit */
+const char *maria_group_commit_names[]=
+{
+ "none", "hard", "soft", NullS
+};
+TYPELIB maria_group_commit_typelib=
+{
+ array_elements(maria_group_commit_names) - 1, "",
+ maria_group_commit_names, NULL
+};
+
/** Interval between background checkpoints in seconds */
static ulong checkpoint_interval;
static void update_checkpoint_interval(MYSQL_THD thd,
struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
+static void update_maria_group_commit(MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save);
+static void update_maria_group_commit_rate(MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save);
/** After that many consecutive recovery failures, remove logs */
static ulong force_start_after_recovery_failures;
static void update_log_file_size(MYSQL_THD thd,
@@ -163,6 +181,24 @@ static MYSQL_SYSVAR_ULONG(log_file_size,
NULL, update_log_file_size, TRANSLOG_FILE_SIZE,
TRANSLOG_MIN_FILE_SIZE, 0xffffffffL, TRANSLOG_PAGE_SIZE);
+static MYSQL_SYSVAR_ENUM(group_commit, maria_group_commit,
+ PLUGIN_VAR_RQCMDARG,
+ "Specifies maria group commit mode. "
+ "Possible values are \"none\" (no group commit), "
+ "\"hard\" (with waiting to actual commit), "
+ "\"soft\" (no wait for commit (DANGEROUS!!!))",
+ NULL, update_maria_group_commit,
+ TRANSLOG_GCOMMIT_NONE, &maria_group_commit_typelib);
+
+static MYSQL_SYSVAR_ULONG(group_commit_rate, maria_group_commit_rate,
+ PLUGIN_VAR_RQCMDARG,
+ "Number of commits per 100 seconds. (in other words one commit for"
+ "every 100/maria_group_commit_rate second). 0 stands for no waiting"
+ "for other threads to come and do a commit in \"hard\" mode and no"
+ " sync()/commit at all in \"soft\" mode. Option has only an effect"
+ "if maria_group_commit is used",
+ NULL, update_maria_group_commit_rate, 800, 0, UINT_MAX, 1);
+
static MYSQL_SYSVAR_ENUM(log_purge_type, log_purge_type,
PLUGIN_VAR_RQCMDARG,
"Specifies how maria transactional log will be purged. "
@@ -3254,6 +3290,8 @@ static struct st_mysql_sys_var* system_v
MYSQL_SYSVAR(block_size),
MYSQL_SYSVAR(checkpoint_interval),
MYSQL_SYSVAR(force_start_after_recovery_failures),
+ MYSQL_SYSVAR(group_commit),
+ MYSQL_SYSVAR(group_commit_rate),
MYSQL_SYSVAR(page_checksum),
MYSQL_SYSVAR(log_dir_path),
MYSQL_SYSVAR(log_file_size),
@@ -3284,6 +3322,97 @@ static void update_checkpoint_interval(M
}
/**
+ @brief Updates group commit mode
+*/
+
+static void update_maria_group_commit(MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save)
+{
+ ulong value= (ulong)*((long *)var_ptr);
+ DBUG_ENTER("update_maria_group_commit");
+ DBUG_PRINT("enter", ("old value: %lu new value %lu rate %lu",
+ value, (ulong)(*(long *)save),
+ maria_group_commit_rate));
+ /* old value */
+ switch (value) {
+ case TRANSLOG_GCOMMIT_NONE:
+ break;
+ case TRANSLOG_GCOMMIT_HARD:
+ translog_hard_group_commit(FALSE);
+ break;
+ case TRANSLOG_GCOMMIT_SOFT:
+ translog_soft_sync(FALSE);
+ if (maria_group_commit_rate)
+ translog_soft_sync_end();
+ break;
+ default:
+ DBUG_ASSERT(0); /* impossible */
+ }
+ value= *(ulong *)var_ptr= (ulong)(*(long *)save);
+ translog_sync();
+ /* new value */
+ switch (value) {
+ case TRANSLOG_GCOMMIT_NONE:
+ break;
+ case TRANSLOG_GCOMMIT_HARD:
+ translog_hard_group_commit(TRUE);
+ break;
+ case TRANSLOG_GCOMMIT_SOFT:
+ translog_soft_sync(TRUE);
+ /* variable change made under global lock so we can just read it */
+ if (maria_group_commit_rate)
+ translog_soft_sync_start();
+ break;
+ default:
+ DBUG_ASSERT(0); /* impossible */
+ }
+ DBUG_VOID_RETURN;
+}
+
+/**
+ @brief Updates group commit rate
+*/
+
+static void update_maria_group_commit_rate(MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save)
+{
+ ulong new_value= (ulong)*((long *)save);
+ ulong *value_ptr= (ulong*) var_ptr;
+ DBUG_ENTER("update_maria_group_commit_rate");
+ DBUG_PRINT("enter", ("old value: %lu new value %lu group commit %lu",
+ *value_ptr, new_value, maria_group_commit));
+ if (new_value &&
+ ((TRANSLOG_RATE_BASE * 1000000000ULL / new_value +
+ TRANSLOG_RATE_BASE / 2) /
+ TRANSLOG_RATE_BASE) == 0)
+ new_value= 0; /* protection against too small value */
+
+ /* variable change made under global lock so we can just read it */
+ switch (maria_group_commit) {
+ case TRANSLOG_GCOMMIT_NONE:
+ *value_ptr= new_value;
+ translog_set_group_commit_rate(new_value);
+ break;
+ case TRANSLOG_GCOMMIT_HARD:
+ *value_ptr= new_value;
+ translog_set_group_commit_rate(new_value);
+ break;
+ case TRANSLOG_GCOMMIT_SOFT:
+ if (*value_ptr)
+ translog_soft_sync_end();
+ translog_set_group_commit_rate(new_value);
+ if ((*value_ptr= new_value))
+ translog_soft_sync_start();
+ break;
+ default:
+ DBUG_ASSERT(0); /* impossible */
+ }
+ DBUG_VOID_RETURN;
+}
+
+/**
@brief Updates the transaction log file limit.
*/
@@ -3305,6 +3434,7 @@ static SHOW_VAR status_variables[]= {
{"Maria_pagecache_reads", (char*) &maria_pagecache_var.global_cache_read, SHOW_LONGLONG},
{"Maria_pagecache_write_requests", (char*) &maria_pagecache_var.global_cache_w_requests, SHOW_LONGLONG},
{"Maria_pagecache_writes", (char*) &maria_pagecache_var.global_cache_write, SHOW_LONGLONG},
+ {"Maria_transaction_log_syncs", (char*) &translog_syncs, SHOW_LONGLONG},
{NullS, NullS, SHOW_LONG}
};
=== modified file 'storage/maria/ma_init.c'
--- a/storage/maria/ma_init.c 2008-10-09 20:03:54 +0000
+++ b/storage/maria/ma_init.c 2009-07-07 00:37:23 +0000
@@ -82,6 +82,11 @@ void maria_end(void)
maria_inited= maria_multi_threaded= FALSE;
ft_free_stopwords();
ma_checkpoint_end();
+ if (translog_status == TRANSLOG_OK)
+ {
+ translog_soft_sync_end();
+ translog_sync();
+ }
if ((trid= trnman_get_max_trid()) > max_trid_in_control_file)
{
/*
=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c 2009-05-19 09:28:05 +0000
+++ b/storage/maria/ma_loghandler.c 2009-07-07 00:37:23 +0000
@@ -18,6 +18,7 @@
#include "ma_blockrec.h" /* for some constants and in-write hooks */
#include "ma_key_recover.h" /* For some in-write hooks */
#include "ma_checkpoint.h"
+#include "ma_servicethread.h"
/*
On Windows, neither my_open() nor my_sync() work for directories.
@@ -47,6 +48,15 @@
#include <m_ctype.h>
#endif
+/** @brief protects checkpoint_in_progress */
+static pthread_mutex_t LOCK_soft_sync;
+/** @brief for killing the background checkpoint thread */
+static pthread_cond_t COND_soft_sync;
+/** @brief control structure for checkpoint background thread */
+static MA_SERVICE_THREAD_CONTROL soft_sync_control=
+ {THREAD_DEAD, FALSE, &LOCK_soft_sync, &COND_soft_sync};
+
+
/* transaction log file descriptor */
typedef struct st_translog_file
{
@@ -124,10 +134,20 @@ struct st_translog_buffer
/* Previous buffer offset to detect it flush finish */
TRANSLOG_ADDRESS prev_buffer_offset;
/*
+ If the buffer was forced to close it save value of its horizon
+ otherwise LSN_IMPOSSIBLE
+ */
+ TRANSLOG_ADDRESS pre_force_close_horizon;
+ /*
How much is written (or will be written when copy_to_buffer_in_progress
become 0) to this buffer
*/
translog_size_t size;
+ /*
+ How much data was skipped during moving page from previous buffer
+ to this one (it is optimisation of forcing buffer to finish
+ */
+ uint skipped_data;
/* File handler for this buffer */
TRANSLOG_FILE *file;
/* Threads which are waiting for buffer filling/freeing */
@@ -304,6 +324,7 @@ struct st_translog_descriptor
*/
pthread_mutex_t log_flush_lock;
pthread_cond_t log_flush_cond;
+ pthread_cond_t new_goal_cond;
/* Protects changing of headers of finished files (max_lsn) */
pthread_mutex_t file_header_lock;
@@ -344,13 +365,39 @@ static struct st_translog_descriptor log
ulong log_purge_type= TRANSLOG_PURGE_IMMIDIATE;
ulong log_file_size= TRANSLOG_FILE_SIZE;
+/* sync() of log files directory mode */
ulong sync_log_dir= TRANSLOG_SYNC_DIR_NEWFILE;
+ulong maria_group_commit= TRANSLOG_GCOMMIT_NONE;
+ulong maria_group_commit_rate= 0;
/* Marker for end of log */
static uchar end_of_log= 0;
#define END_OF_LOG &end_of_log
+/**
+ Switch for "soft" sync (no real sync() but periodical sync by service
+ thread)
+*/
+static volatile my_bool soft_sync= FALSE;
+/**
+ Switch for "hard" group commit mode
+*/
+static volatile my_bool hard_group_commit= FALSE;
+/**
+ File numbers interval which have to be sync()
+*/
+static uint32 soft_sync_min= 0;
+static uint32 soft_sync_max= 0;
+/**
+ stores interval in nanoseconds/TRANSLOG_RATE_BASE (to
+ fit into uint32)
+*/
+static uint32 group_commit_wait= 0;
enum enum_translog_status translog_status= TRANSLOG_UNINITED;
+ulonglong translog_syncs= 0; /* Number of sync()s */
+
+/* time of last flush */
+static ulonglong flush_start= 0;
/* chunk types */
#define TRANSLOG_CHUNK_LSN 0x00 /* 0 chunk refer as LSN (head or tail */
@@ -980,12 +1027,17 @@ static TRANSLOG_FILE *get_logfile_by_num
static TRANSLOG_FILE *get_current_logfile()
{
TRANSLOG_FILE *file;
+ DBUG_ENTER("get_current_logfile");
rw_rdlock(&log_descriptor.open_files_lock);
+ DBUG_PRINT("info", ("max_file: %lu min_file: %lu open_files: %lu",
+ (ulong) log_descriptor.max_file,
+ (ulong) log_descriptor.min_file,
+ (ulong) log_descriptor.open_files.elements));
DBUG_ASSERT(log_descriptor.max_file - log_descriptor.min_file + 1 ==
log_descriptor.open_files.elements);
file= *dynamic_element(&log_descriptor.open_files, 0, TRANSLOG_FILE **);
rw_unlock(&log_descriptor.open_files_lock);
- return (file);
+ DBUG_RETURN(file);
}
uchar NEAR maria_trans_file_magic[]=
@@ -1069,6 +1121,7 @@ static my_bool translog_write_file_heade
static my_bool translog_max_lsn_to_header(File file, LSN lsn)
{
uchar lsn_buff[LSN_STORE_SIZE];
+ my_bool rc;
DBUG_ENTER("translog_max_lsn_to_header");
DBUG_PRINT("enter", ("File descriptor: %ld "
"lsn: (%lu,0x%lx)",
@@ -1077,11 +1130,13 @@ static my_bool translog_max_lsn_to_heade
lsn_store(lsn_buff, lsn);
- DBUG_RETURN(my_pwrite(file, lsn_buff,
- LSN_STORE_SIZE,
- (LOG_HEADER_DATA_SIZE - LSN_STORE_SIZE),
- log_write_flags) != 0 ||
- my_sync(file, MYF(MY_WME)) != 0);
+ if (!(rc= (my_pwrite(file, lsn_buff,
+ LSN_STORE_SIZE,
+ (LOG_HEADER_DATA_SIZE - LSN_STORE_SIZE),
+ log_write_flags) != 0 ||
+ my_sync(file, MYF(MY_WME)) != 0)))
+ translog_syncs++;
+ DBUG_RETURN(rc);
}
@@ -1423,7 +1478,9 @@ LSN translog_get_file_max_lsn_stored(uin
static my_bool translog_buffer_init(struct st_translog_buffer *buffer, int num)
{
DBUG_ENTER("translog_buffer_init");
- buffer->prev_last_lsn= buffer->last_lsn= LSN_IMPOSSIBLE;
+ buffer->pre_force_close_horizon=
+ buffer->prev_last_lsn= buffer->last_lsn=
+ LSN_IMPOSSIBLE;
DBUG_PRINT("info", ("last_lsn and prev_last_lsn set to 0 buffer: 0x%lx",
(ulong) buffer));
@@ -1435,6 +1492,7 @@ static my_bool translog_buffer_init(stru
memset(buffer->buffer, TRANSLOG_FILLER, TRANSLOG_WRITE_BUFFER);
/* Buffer size */
buffer->size= 0;
+ buffer->skipped_data= 0;
/* cond of thread which is waiting for buffer filling */
if (pthread_cond_init(&buffer->waiting_filling_buffer, 0))
DBUG_RETURN(1);
@@ -1489,7 +1547,10 @@ static my_bool translog_close_log_file(T
TODO: sync only we have changed the log
*/
if (!file->is_sync)
+ {
rc= my_sync(file->handler.file, MYF(MY_WME));
+ translog_syncs++;
+ }
rc|= my_close(file->handler.file, MYF(MY_WME));
my_free(file, MYF(0));
return test(rc);
@@ -2044,7 +2105,8 @@ static void translog_start_buffer(struct
(ulong) LSN_OFFSET(log_descriptor.horizon),
(ulong) LSN_OFFSET(log_descriptor.horizon)));
DBUG_ASSERT(buffer_no == buffer->buffer_no);
- buffer->prev_last_lsn= buffer->last_lsn= LSN_IMPOSSIBLE;
+ buffer->pre_force_close_horizon=
+ buffer->prev_last_lsn= buffer->last_lsn= LSN_IMPOSSIBLE;
DBUG_PRINT("info", ("last_lsn and prev_last_lsn set to 0 buffer: 0x%lx",
(ulong) buffer));
buffer->offset= log_descriptor.horizon;
@@ -2052,6 +2114,7 @@ static void translog_start_buffer(struct
buffer->file= get_current_logfile();
buffer->overlay= 0;
buffer->size= 0;
+ buffer->skipped_data= 0;
translog_cursor_init(cursor, buffer, buffer_no);
DBUG_PRINT("info", ("file: #%ld (%d) init cursor #%u: 0x%lx "
"chaser: %d Size: %lu (%lu)",
@@ -2523,6 +2586,7 @@ static my_bool translog_buffer_flush(str
TRANSLOG_ADDRESS offset= buffer->offset;
TRANSLOG_FILE *file= buffer->file;
uint8 ver= buffer->ver;
+ uint skipped_data;
DBUG_ENTER("translog_buffer_flush");
DBUG_PRINT("enter",
("Buffer: #%u 0x%lx file: %d offset: (%lu,0x%lx) size: %lu",
@@ -2557,6 +2621,8 @@ static my_bool translog_buffer_flush(str
disk
*/
file= buffer->file;
+ skipped_data= buffer->skipped_data;
+ DBUG_ASSERT(skipped_data < TRANSLOG_PAGE_SIZE);
for (i= 0, pg= LSN_OFFSET(buffer->offset) / TRANSLOG_PAGE_SIZE;
i < buffer->size;
i+= TRANSLOG_PAGE_SIZE, pg++)
@@ -2573,13 +2639,16 @@ static my_bool translog_buffer_flush(str
DBUG_ASSERT(i + TRANSLOG_PAGE_SIZE <= buffer->size);
if (translog_status != TRANSLOG_OK && translog_status != TRANSLOG_SHUTDOWN)
DBUG_RETURN(1);
- if (pagecache_inject(log_descriptor.pagecache,
+ if (pagecache_write_part(log_descriptor.pagecache,
&file->handler, pg, 3,
buffer->buffer + i,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_LEFT_UNLOCKED,
- PAGECACHE_PIN_LEFT_UNPINNED, 0,
- LSN_IMPOSSIBLE))
+ PAGECACHE_PIN_LEFT_UNPINNED,
+ PAGECACHE_WRITE_DONE, 0,
+ LSN_IMPOSSIBLE,
+ skipped_data,
+ TRANSLOG_PAGE_SIZE - skipped_data))
{
DBUG_PRINT("error",
("Can't write page (%lu,0x%lx) to pagecache, error: %d",
@@ -2589,10 +2658,12 @@ static my_bool translog_buffer_flush(str
translog_stop_writing();
DBUG_RETURN(1);
}
+ skipped_data= 0;
}
file->is_sync= 0;
- if (my_pwrite(file->handler.file, buffer->buffer,
- buffer->size, LSN_OFFSET(buffer->offset),
+ if (my_pwrite(file->handler.file, buffer->buffer + buffer->skipped_data,
+ buffer->size - buffer->skipped_data,
+ LSN_OFFSET(buffer->offset) + buffer->skipped_data,
log_write_flags))
{
DBUG_PRINT("error", ("Can't write buffer (%lu,0x%lx) size %lu "
@@ -2985,6 +3056,7 @@ restart:
uchar *from, *table= NULL;
int is_last_unfinished_page;
uint last_protected_sector= 0;
+ uint skipped_data= curr_buffer->skipped_data;
TRANSLOG_FILE file_copy;
uint8 ver= curr_buffer->ver;
translog_wait_for_writers(curr_buffer);
@@ -2997,7 +3069,25 @@ restart:
}
DBUG_ASSERT(LSN_FILE_NO(addr) == LSN_FILE_NO(curr_buffer->offset));
from= curr_buffer->buffer + (addr - curr_buffer->offset);
- memcpy(buffer, from, TRANSLOG_PAGE_SIZE);
+ if (skipped_data > (addr - curr_buffer->offset))
+ {
+ /*
+ We read page part of which is not present in buffer,
+ so we should read absent part from file (page cache actually)
+ */
+ file= get_logfile_by_number(file_no);
+ DBUG_ASSERT(file != NULL);
+ buffer= pagecache_read(log_descriptor.pagecache, &file->handler,
+ LSN_OFFSET(addr) / TRANSLOG_PAGE_SIZE,
+ 3, buffer,
+ PAGECACHE_PLAIN_PAGE,
+ PAGECACHE_LOCK_LEFT_UNLOCKED,
+ NULL);
+ }
+ else
+ skipped_data= 0; /* Read after skipped in buffer data */
+ memcpy(buffer + skipped_data, from + skipped_data,
+ TRANSLOG_PAGE_SIZE - skipped_data);
/*
We can use copy then in translog_page_validator() because it
do not put it permanently somewhere.
@@ -3291,6 +3381,7 @@ static my_bool translog_truncate_log(TRA
uint32 next_page_offset, page_rest;
uint32 i;
File fd;
+ int rc;
TRANSLOG_VALIDATOR_DATA data;
char path[FN_REFLEN];
uchar page_buff[TRANSLOG_PAGE_SIZE];
@@ -3316,14 +3407,19 @@ static my_bool translog_truncate_log(TRA
TRANSLOG_PAGE_SIZE);
page_rest= next_page_offset - LSN_OFFSET(addr);
memset(page_buff, TRANSLOG_FILLER, page_rest);
- if ((fd= open_logfile_by_number_no_cache(LSN_FILE_NO(addr))) < 0 ||
- ((my_chsize(fd, next_page_offset, TRANSLOG_FILLER, MYF(MY_WME)) ||
- (page_rest && my_pwrite(fd, page_buff, page_rest, LSN_OFFSET(addr),
- log_write_flags)) ||
- my_sync(fd, MYF(MY_WME))) |
- my_close(fd, MYF(MY_WME))) ||
- (sync_log_dir >= TRANSLOG_SYNC_DIR_ALWAYS &&
- sync_dir(log_descriptor.directory_fd, MYF(MY_WME | MY_IGNORE_BADFD))))
+ rc= ((fd= open_logfile_by_number_no_cache(LSN_FILE_NO(addr))) < 0 ||
+ ((my_chsize(fd, next_page_offset, TRANSLOG_FILLER, MYF(MY_WME)) ||
+ (page_rest && my_pwrite(fd, page_buff, page_rest, LSN_OFFSET(addr),
+ log_write_flags)) ||
+ my_sync(fd, MYF(MY_WME)))));
+ translog_syncs++;
+ rc|= (fd > 0 && my_close(fd, MYF(MY_WME)));
+ if (sync_log_dir >= TRANSLOG_SYNC_DIR_ALWAYS)
+ {
+ rc|= sync_dir(log_descriptor.directory_fd, MYF(MY_WME | MY_IGNORE_BADFD));
+ translog_syncs++;
+ }
+ if (rc)
DBUG_RETURN(1);
/* fix the horizon */
@@ -3511,6 +3607,7 @@ my_bool translog_init_with_table(const c
pthread_mutex_init(&log_descriptor.dirty_buffer_mask_lock,
MY_MUTEX_INIT_FAST) ||
pthread_cond_init(&log_descriptor.log_flush_cond, 0) ||
+ pthread_cond_init(&log_descriptor.new_goal_cond, 0) ||
my_rwlock_init(&log_descriptor.open_files_lock,
NULL) ||
my_init_dynamic_array(&log_descriptor.open_files,
@@ -3912,7 +4009,6 @@ my_bool translog_init_with_table(const c
log_descriptor.flushed= log_descriptor.horizon;
log_descriptor.in_buffers_only= log_descriptor.bc.buffer->offset;
log_descriptor.max_lsn= LSN_IMPOSSIBLE; /* set to 0 */
- log_descriptor.previous_flush_horizon= log_descriptor.horizon;
/*
Now 'flushed' is set to 'horizon' value, but 'horizon' is (potentially)
address of the next LSN and we want indicate that all LSNs that are
@@ -3995,6 +4091,10 @@ my_bool translog_init_with_table(const c
It is beginning of the log => there is no LSNs in the log =>
There is no harm in leaving it "as-is".
*/
+ log_descriptor.previous_flush_horizon= log_descriptor.horizon;
+ DBUG_PRINT("info", ("previous_flush_horizon: (%lu,0x%lx)",
+ LSN_IN_PARTS(log_descriptor.
+ previous_flush_horizon)));
DBUG_RETURN(0);
}
file_no--;
@@ -4070,6 +4170,9 @@ my_bool translog_init_with_table(const c
translog_free_record_header(&rec);
}
}
+ log_descriptor.previous_flush_horizon= log_descriptor.horizon;
+ DBUG_PRINT("info", ("previous_flush_horizon: (%lu,0x%lx)",
+ LSN_IN_PARTS(log_descriptor.previous_flush_horizon)));
DBUG_RETURN(0);
err:
ma_message_no_user(0, "log initialization failed");
@@ -4157,6 +4260,7 @@ void translog_destroy()
pthread_mutex_destroy(&log_descriptor.log_flush_lock);
pthread_mutex_destroy(&log_descriptor.dirty_buffer_mask_lock);
pthread_cond_destroy(&log_descriptor.log_flush_cond);
+ pthread_cond_destroy(&log_descriptor.new_goal_cond);
rwlock_destroy(&log_descriptor.open_files_lock);
delete_dynamic(&log_descriptor.open_files);
delete_dynamic(&log_descriptor.unfinished_files);
@@ -6885,11 +6989,11 @@ int translog_read_record_header_from_buf
{
translog_size_t res;
DBUG_ENTER("translog_read_record_header_from_buffer");
+ DBUG_PRINT("info", ("page byte: 0x%x offset: %u",
+ (uint) page[page_offset], (uint) page_offset));
DBUG_ASSERT(translog_is_LSN_chunk(page[page_offset]));
DBUG_ASSERT(translog_status == TRANSLOG_OK ||
translog_status == TRANSLOG_READONLY);
- DBUG_PRINT("info", ("page byte: 0x%x offset: %u",
- (uint) page[page_offset], (uint) page_offset));
buff->type= (page[page_offset] & TRANSLOG_REC_TYPE);
buff->short_trid= uint2korr(page + page_offset + 1);
DBUG_PRINT("info", ("Type %u, Short TrID %u, LSN (%lu,0x%lx)",
@@ -7356,27 +7460,27 @@ static void translog_force_current_buffe
"Buffer addr: (%lu,0x%lx) "
"Page addr: (%lu,0x%lx) "
"size: %lu (%lu) Pg: %u left: %u in progress %u",
- (uint) log_descriptor.bc.buffer_no,
- (ulong) log_descriptor.bc.buffer,
- LSN_IN_PARTS(log_descriptor.bc.buffer->offset),
+ (uint) old_buffer_no,
+ (ulong) old_buffer,
+ LSN_IN_PARTS(old_buffer->offset),
(ulong) LSN_FILE_NO(log_descriptor.horizon),
(ulong) (LSN_OFFSET(log_descriptor.horizon) -
log_descriptor.bc.current_page_fill),
- (ulong) log_descriptor.bc.buffer->size,
+ (ulong) old_buffer->size,
(ulong) (log_descriptor.bc.ptr -log_descriptor.bc.
buffer->buffer),
(uint) log_descriptor.bc.current_page_fill,
(uint) left,
- (uint) log_descriptor.bc.buffer->
+ (uint) old_buffer->
copy_to_buffer_in_progress));
translog_lock_assert_owner();
LINT_INIT(current_page_fill);
- new_buff_beginning= log_descriptor.bc.buffer->offset;
- new_buff_beginning+= log_descriptor.bc.buffer->size; /* increase offset */
+ new_buff_beginning= old_buffer->offset;
+ new_buff_beginning+= old_buffer->size; /* increase offset */
DBUG_ASSERT(log_descriptor.bc.ptr !=NULL);
DBUG_ASSERT(LSN_FILE_NO(log_descriptor.horizon) ==
- LSN_FILE_NO(log_descriptor.bc.buffer->offset));
+ LSN_FILE_NO(old_buffer->offset));
translog_check_cursor(&log_descriptor.bc);
DBUG_ASSERT(left < TRANSLOG_PAGE_SIZE);
if (left)
@@ -7387,18 +7491,20 @@ static void translog_force_current_buffe
*/
DBUG_PRINT("info", ("left: %u", (uint) left));
+ old_buffer->pre_force_close_horizon=
+ old_buffer->offset + old_buffer->size;
/* decrease offset */
new_buff_beginning-= log_descriptor.bc.current_page_fill;
current_page_fill= log_descriptor.bc.current_page_fill;
memset(log_descriptor.bc.ptr, TRANSLOG_FILLER, left);
- log_descriptor.bc.buffer->size+= left;
+ old_buffer->size+= left;
DBUG_PRINT("info", ("Finish Page buffer #%u: 0x%lx "
"Size: %lu",
- (uint) log_descriptor.bc.buffer->buffer_no,
- (ulong) log_descriptor.bc.buffer,
- (ulong) log_descriptor.bc.buffer->size));
- DBUG_ASSERT(log_descriptor.bc.buffer->buffer_no ==
+ (uint) old_buffer->buffer_no,
+ (ulong) old_buffer,
+ (ulong) old_buffer->size));
+ DBUG_ASSERT(old_buffer->buffer_no ==
log_descriptor.bc.buffer_no);
}
else
@@ -7509,11 +7615,21 @@ static void translog_force_current_buffe
if (left)
{
- /*
- TODO: do not copy beginning of the page if we have no CRC or sector
- checks on
- */
- memcpy(new_buffer->buffer, data, current_page_fill);
+ if (log_descriptor.flags &
+ (TRANSLOG_PAGE_CRC | TRANSLOG_SECTOR_PROTECTION))
+ memcpy(new_buffer->buffer, data, current_page_fill);
+ else
+ {
+ /*
+ This page header does not change if we add more data to the page so
+ we can not copy it and will not overwrite later
+ */
+ new_buffer->skipped_data= current_page_fill;
+#ifndef DBUG_OFF
+ memset(new_buffer->buffer, 0xa5, current_page_fill);
+#endif
+ DBUG_ASSERT(new_buffer->skipped_data < TRANSLOG_PAGE_SIZE);
+ }
}
old_buffer->next_buffer_offset= new_buffer->offset;
translog_buffer_lock(new_buffer);
@@ -7561,6 +7677,7 @@ void translog_flush_set_new_goal_and_wai
{
log_descriptor.next_pass_max_lsn= lsn;
log_descriptor.max_lsn_requester= pthread_self();
+ pthread_cond_broadcast(&log_descriptor.new_goal_cond);
}
while (flush_no == log_descriptor.flush_no)
{
@@ -7572,67 +7689,79 @@ void translog_flush_set_new_goal_and_wai
/**
- @brief Flush the log up to given LSN (included)
+ @brief sync() range of files (inclusive) and directory (by request)
- @param lsn log record serial number up to which (inclusive)
- the log has to be flushed
+ @param min min internal file number to flush
+ @param max max internal file number to flush
+ @param sync_dir need sync directory
- @return Operation status
+ return Operation status
@retval 0 OK
@retval 1 Error
-
*/
-my_bool translog_flush(TRANSLOG_ADDRESS lsn)
+static my_bool translog_sync_files(uint32 min, uint32 max,
+ my_bool sync_dir)
{
- LSN sent_to_disk= LSN_IMPOSSIBLE;
- TRANSLOG_ADDRESS flush_horizon;
- uint fn, i;
- dirty_buffer_mask_t dirty_buffer_mask;
- uint8 last_buffer_no, start_buffer_no;
+ uint fn;
my_bool rc= 0;
- DBUG_ENTER("translog_flush");
- DBUG_PRINT("enter", ("Flush up to LSN: (%lu,0x%lx)", LSN_IN_PARTS(lsn)));
- DBUG_ASSERT(translog_status == TRANSLOG_OK ||
- translog_status == TRANSLOG_READONLY);
- LINT_INIT(sent_to_disk);
-
- pthread_mutex_lock(&log_descriptor.log_flush_lock);
- DBUG_PRINT("info", ("Everything is flushed up to (%lu,0x%lx)",
- LSN_IN_PARTS(log_descriptor.flushed)));
- if (cmp_translog_addr(log_descriptor.flushed, lsn) >= 0)
+ ulonglong flush_interval;
+ DBUG_ENTER("translog_sync_files");
+ DBUG_PRINT("info", ("min: %lu max: %lu sync dir: %d",
+ (ulong) min, (ulong) max, (int) sync_dir));
+ DBUG_ASSERT(min <= max);
+
+ flush_interval= group_commit_wait;
+ if (flush_interval)
+ flush_start= my_micro_time();
+ for (fn= min; fn <= max; fn++)
{
- pthread_mutex_unlock(&log_descriptor.log_flush_lock);
- DBUG_RETURN(0);
- }
- if (log_descriptor.flush_in_progress)
- {
- translog_flush_set_new_goal_and_wait(lsn);
- if (!pthread_equal(log_descriptor.max_lsn_requester, pthread_self()))
+ TRANSLOG_FILE *file= get_logfile_by_number(fn);
+ DBUG_ASSERT(file != NULL);
+ if (!file->is_sync)
{
- /* fix lsn if it was horizon */
- if (cmp_translog_addr(lsn, log_descriptor.bc.buffer->last_lsn) > 0)
- lsn= BUFFER_MAX_LSN(log_descriptor.bc.buffer);
- translog_flush_wait_for_end(lsn);
- pthread_mutex_unlock(&log_descriptor.log_flush_lock);
- DBUG_RETURN(0);
+ if (my_sync(file->handler.file, MYF(MY_WME)))
+ {
+ rc= 1;
+ translog_stop_writing();
+ DBUG_RETURN(rc);
+ }
+ translog_syncs++;
+ file->is_sync= 1;
}
- log_descriptor.next_pass_max_lsn= LSN_IMPOSSIBLE;
}
- log_descriptor.flush_in_progress= 1;
- flush_horizon= log_descriptor.previous_flush_horizon;
- DBUG_PRINT("info", ("flush_in_progress is set"));
- pthread_mutex_unlock(&log_descriptor.log_flush_lock);
- translog_lock();
- if (log_descriptor.is_everything_flushed)
+ if (sync_dir)
{
- DBUG_PRINT("info", ("everything is flushed"));
- rc= (translog_status == TRANSLOG_READONLY);
- translog_unlock();
- goto out;
+ if (!(rc= sync_dir(log_descriptor.directory_fd,
+ MYF(MY_WME | MY_IGNORE_BADFD))))
+ translog_syncs++;
}
+ DBUG_RETURN(rc);
+}
+
+
+/*
+ @brief Flushes buffers with LSNs in them less or equal address <lsn>
+
+ @param lsn address up to which all LSNs should be flushed,
+ can be reset to real last LSN address
+ @parem sent_to_disk returns 'sent to disk' position
+ @param flush_horizon returns horizon of the flush
+
+ @note About terminology see comment to translog_flush().
+*/
+
+void translog_flush_buffers(TRANSLOG_ADDRESS *lsn,
+ TRANSLOG_ADDRESS *sent_to_disk,
+ TRANSLOG_ADDRESS *flush_horizon)
+{
+ dirty_buffer_mask_t dirty_buffer_mask;
+ uint i;
+ uint8 last_buffer_no, start_buffer_no;
+ DBUG_ENTER("translog_flush_buffers");
+
/*
We will recheck information when will lock buffers one by
one so we can use unprotected read here (this is just for
@@ -7656,15 +7785,15 @@ my_bool translog_flush(TRANSLOG_ADDRESS
/*
if LSN up to which we have to flush bigger then maximum LSN of previous
buffer and at least one LSN was saved in the current buffer (last_lsn !=
- LSN_IMPOSSIBLE) then we better finish the current buffer.
+ LSN_IMPOSSIBLE) then we have to close the current buffer.
*/
- if (cmp_translog_addr(lsn, log_descriptor.bc.buffer->prev_last_lsn) > 0 &&
+ if (cmp_translog_addr(*lsn, log_descriptor.bc.buffer->prev_last_lsn) > 0 &&
log_descriptor.bc.buffer->last_lsn != LSN_IMPOSSIBLE)
{
struct st_translog_buffer *buffer= log_descriptor.bc.buffer;
- lsn= log_descriptor.bc.buffer->last_lsn; /* fix lsn if it was horizon */
+ *lsn= log_descriptor.bc.buffer->last_lsn; /* fix lsn if it was horizon */
DBUG_PRINT("info", ("LSN to flush fixed to last lsn: (%lu,0x%lx)",
- LSN_IN_PARTS(log_descriptor.bc.buffer->last_lsn)));
+ LSN_IN_PARTS(log_descriptor.bc.buffer->last_lsn)));
last_buffer_no= log_descriptor.bc.buffer_no;
log_descriptor.is_everything_flushed= 1;
translog_force_current_buffer_to_finish();
@@ -7676,8 +7805,10 @@ my_bool translog_flush(TRANSLOG_ADDRESS
TRANSLOG_BUFFERS_NO);
translog_unlock();
}
- sent_to_disk= translog_get_sent_to_disk();
- if (cmp_translog_addr(lsn, sent_to_disk) > 0)
+
+ /* flush buffers */
+ *sent_to_disk= translog_get_sent_to_disk();
+ if (cmp_translog_addr(*lsn, *sent_to_disk) > 0)
{
DBUG_PRINT("info", ("Start buffer #: %u last buffer #: %u",
@@ -7697,53 +7828,237 @@ my_bool translog_flush(TRANSLOG_ADDRESS
LSN_IN_PARTS(buffer->last_lsn),
(buffer->file ?
"dirty" : "closed")));
- if (buffer->prev_last_lsn <= lsn &&
+ if (buffer->prev_last_lsn <= *lsn &&
buffer->file != NULL)
{
- DBUG_ASSERT(flush_horizon <= buffer->offset + buffer->size);
- flush_horizon= buffer->offset + buffer->size;
+ DBUG_ASSERT(*flush_horizon <= buffer->offset + buffer->size);
+ *flush_horizon= (buffer->pre_force_close_horizon != LSN_IMPOSSIBLE ?
+ buffer->pre_force_close_horizon :
+ buffer->offset + buffer->size);
+ /* pre_force_close_horizon is reset during new buffer start */
+ DBUG_PRINT("info", ("flush_horizon: (%lu,0x%lx)",
+ LSN_IN_PARTS(*flush_horizon)));
+ DBUG_ASSERT(*flush_horizon <= log_descriptor.horizon);
+
translog_buffer_flush(buffer);
}
translog_buffer_unlock(buffer);
i= (i + 1) % TRANSLOG_BUFFERS_NO;
} while (i != last_buffer_no);
- sent_to_disk= translog_get_sent_to_disk();
+ *sent_to_disk= translog_get_sent_to_disk();
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+/**
+ @brief Flush the log up to given LSN (included)
+
+ @param lsn log record serial number up to which (inclusive)
+ the log has to be flushed
+
+ @return Operation status
+ @retval 0 OK
+ @retval 1 Error
+
+ @note
+
+ - Non group commit logic: Commits made in passes. Thread which started
+ flush first is performing actual flush, other threads sets new goal (LSN)
+ of the next pass (if it is maximum) and waits for the pass end or just
+ wait for the pass end.
+
+ - If hard group commit enabled and rate set to zero:
+ The first thread sends all changed buffers to disk. This is repeated
+ as long as there are new LSNs added. The process can not loop
+ forever because we have limited number of threads and they will wait
+ for the data to be synced.
+ Pseudo code:
+
+ do
+ send changed buffers to disk
+ while new_goal
+ sync
+
+ - If hard group commit switched ON and less than rate microseconds has
+ passed from last sync, then after buffers have been sent to disk
+ wait until rate microseconds has passed since last sync, do sync and return.
+ This ensures that if we call sync infrequently we don't do any waits.
+
+ - If soft group commit enabled everything works as with 'non group commit'
+ but the thread doesn't do any real sync(). If rate is not zero the
+ sync() will be performed by a service thread with the given rate
+ when needed (new LSN appears).
+
+ @note Terminology:
+ 'sent to disk' means written to disk but not sync()ed,
+ 'flushed' mean sent to disk and synced().
+*/
+
+my_bool translog_flush(TRANSLOG_ADDRESS lsn)
+{
+ struct timespec abstime;
+ ulonglong flush_interval;
+ ulonglong time_spent;
+ LSN sent_to_disk= LSN_IMPOSSIBLE;
+ TRANSLOG_ADDRESS flush_horizon;
+ my_bool rc= 0;
+ my_bool hgroup_commit_at_start;
+ DBUG_ENTER("translog_flush");
+ DBUG_PRINT("enter", ("Flush up to LSN: (%lu,0x%lx)", LSN_IN_PARTS(lsn)));
+ DBUG_ASSERT(translog_status == TRANSLOG_OK ||
+ translog_status == TRANSLOG_READONLY);
+ LINT_INIT(sent_to_disk);
+
+ pthread_mutex_lock(&log_descriptor.log_flush_lock);
+ DBUG_PRINT("info", ("Everything is flushed up to (%lu,0x%lx)",
+ LSN_IN_PARTS(log_descriptor.flushed)));
+ if (cmp_translog_addr(log_descriptor.flushed, lsn) >= 0)
+
+
+ {
+ pthread_mutex_unlock(&log_descriptor.log_flush_lock);
+ DBUG_RETURN(0);
}
+ if (log_descriptor.flush_in_progress)
+ {
+ translog_lock();
+ /* fix lsn if it was horizon */
+ if (cmp_translog_addr(lsn, log_descriptor.bc.buffer->last_lsn) > 0)
+ lsn= BUFFER_MAX_LSN(log_descriptor.bc.buffer);
+ translog_unlock();
+ translog_flush_set_new_goal_and_wait(lsn);
+ if (!pthread_equal(log_descriptor.max_lsn_requester, pthread_self()))
+ {
+ /*
+ translog_flush_wait_for_end() release log_flush_lock while is
+ waiting then acquire it again
+ */
+ translog_flush_wait_for_end(lsn);
+ pthread_mutex_unlock(&log_descriptor.log_flush_lock);
+ DBUG_RETURN(0);
+ }
+ log_descriptor.next_pass_max_lsn= LSN_IMPOSSIBLE;
+ }
+ log_descriptor.flush_in_progress= 1;
+ flush_horizon= log_descriptor.previous_flush_horizon;
+ DBUG_PRINT("info", ("flush_in_progress is set, flush_horizon: (%lu,0x%lx)",
+ LSN_IN_PARTS(flush_horizon)));
+ pthread_mutex_unlock(&log_descriptor.log_flush_lock);
+
+ hgroup_commit_at_start= hard_group_commit;
+ if (hgroup_commit_at_start)
+ flush_interval= group_commit_wait * TRANSLOG_RATE_BASE;
- /* sync files from previous flush till current one */
- for (fn= LSN_FILE_NO(log_descriptor.flushed); fn <= LSN_FILE_NO(lsn); fn++)
+ translog_lock();
+ if (log_descriptor.is_everything_flushed)
{
- TRANSLOG_FILE *file= get_logfile_by_number(fn);
- DBUG_ASSERT(file != NULL);
- if (!file->is_sync)
+ DBUG_PRINT("info", ("everything is flushed"));
+ translog_unlock();
+ pthread_mutex_lock(&log_descriptor.log_flush_lock);
+ goto out;
+ }
+
+ for (;;)
+ {
+ /* Following function flushes buffers and makes translog_unlock() */
+ translog_flush_buffers(&lsn, &sent_to_disk, &flush_horizon);
+
+ if (!hgroup_commit_at_start)
+ break; /* flush pass is ended */
+
+retest:
+ if (flush_interval != 0 &&
+ (my_micro_time() - flush_start) >= flush_interval)
+ break; /* flush pass is ended */
+
+ pthread_mutex_lock(&log_descriptor.log_flush_lock);
+ if (log_descriptor.next_pass_max_lsn != LSN_IMPOSSIBLE)
+ {
+ /* take next goal */
+ lsn= log_descriptor.next_pass_max_lsn;
+ log_descriptor.next_pass_max_lsn= LSN_IMPOSSIBLE;
+ /* prevent other thread from continue */
+ log_descriptor.max_lsn_requester= pthread_self();
+ DBUG_PRINT("info", ("flush took next goal: (%lu,0x%lx)",
+ LSN_IN_PARTS(lsn)));
+ }
+ else
{
- if (my_sync(file->handler.file, MYF(MY_WME)))
+ if (flush_interval == 0 ||
+ (time_spent= (my_micro_time() - flush_start)) >= flush_interval)
{
- rc= 1;
- translog_stop_writing();
- sent_to_disk= LSN_IMPOSSIBLE;
- goto out;
+ pthread_mutex_unlock(&log_descriptor.log_flush_lock);
+ break;
}
- file->is_sync= 1;
+ DBUG_PRINT("info", ("flush waits: %llu interval: %llu spent: %llu",
+ flush_interval - time_spent,
+ flush_interval, time_spent));
+ /* wait time or next goal */
+ set_timespec_nsec(abstime, flush_interval - time_spent);
+ pthread_cond_timedwait(&log_descriptor.new_goal_cond,
+ &log_descriptor.log_flush_lock,
+ &abstime);
+ pthread_mutex_unlock(&log_descriptor.log_flush_lock);
+ DBUG_PRINT("info", ("retest conditions"));
+ goto retest;
}
+ pthread_mutex_unlock(&log_descriptor.log_flush_lock);
+
+ /* next flush pass */
+ DBUG_PRINT("info", ("next flush pass"));
+ translog_lock();
}
- if (sync_log_dir >= TRANSLOG_SYNC_DIR_ALWAYS &&
- (LSN_FILE_NO(log_descriptor.previous_flush_horizon) !=
- LSN_FILE_NO(flush_horizon) ||
- ((LSN_OFFSET(log_descriptor.previous_flush_horizon) - 1) /
- TRANSLOG_PAGE_SIZE) !=
- ((LSN_OFFSET(flush_horizon) - 1) / TRANSLOG_PAGE_SIZE)))
- rc|= sync_dir(log_descriptor.directory_fd, MYF(MY_WME | MY_IGNORE_BADFD));
+ /*
+ sync() files from previous flush till current one
+ */
+ if (!soft_sync || hgroup_commit_at_start)
+ {
+ if ((rc=
+ translog_sync_files(LSN_FILE_NO(log_descriptor.flushed),
+ LSN_FILE_NO(lsn),
+ sync_log_dir >= TRANSLOG_SYNC_DIR_ALWAYS &&
+ (LSN_FILE_NO(log_descriptor.
+ previous_flush_horizon) !=
+ LSN_FILE_NO(flush_horizon) ||
+ (LSN_OFFSET(log_descriptor.
+ previous_flush_horizon) /
+ TRANSLOG_PAGE_SIZE) !=
+ (LSN_OFFSET(flush_horizon) /
+ TRANSLOG_PAGE_SIZE)))))
+ {
+ sent_to_disk= LSN_IMPOSSIBLE;
+ pthread_mutex_lock(&log_descriptor.log_flush_lock);
+ goto out;
+ }
+ /* keep values for soft sync() and forced sync() actual */
+ {
+ uint32 fileno= LSN_FILE_NO(lsn);
+ my_atomic_rwlock_wrlock(&soft_sync_rwl);
+ my_atomic_store32(&soft_sync_min, fileno);
+ my_atomic_store32(&soft_sync_max, fileno);
+ my_atomic_rwlock_wrunlock(&soft_sync_rwl);
+ }
+ }
+ else
+ {
+ my_atomic_rwlock_wrlock(&soft_sync_rwl);
+ my_atomic_store32(&soft_sync_max, LSN_FILE_NO(lsn));
+ my_atomic_rwlock_wrunlock(&soft_sync_rwl);
+ }
+
+ DBUG_ASSERT(flush_horizon <= log_descriptor.horizon);
+
+ pthread_mutex_lock(&log_descriptor.log_flush_lock);
log_descriptor.previous_flush_horizon= flush_horizon;
out:
- pthread_mutex_lock(&log_descriptor.log_flush_lock);
if (sent_to_disk != LSN_IMPOSSIBLE)
log_descriptor.flushed= sent_to_disk;
log_descriptor.flush_in_progress= 0;
log_descriptor.flush_no++;
DBUG_PRINT("info", ("flush_in_progress is dropped"));
- pthread_mutex_unlock(&log_descriptor.log_flush_lock);\
+ pthread_mutex_unlock(&log_descriptor.log_flush_lock);
pthread_cond_broadcast(&log_descriptor.log_flush_cond);
DBUG_RETURN(rc);
}
@@ -8113,6 +8428,8 @@ LSN translog_first_theoretical_lsn()
my_bool translog_purge(TRANSLOG_ADDRESS low)
{
uint32 last_need_file= LSN_FILE_NO(low);
+ uint32 min_unsync;
+ int soft;
TRANSLOG_ADDRESS horizon= translog_get_horizon();
int rc= 0;
DBUG_ENTER("translog_purge");
@@ -8120,12 +8437,23 @@ my_bool translog_purge(TRANSLOG_ADDRESS
DBUG_ASSERT(translog_status == TRANSLOG_OK ||
translog_status == TRANSLOG_READONLY);
+ soft= soft_sync;
+ DBUG_PRINT("info", ("min_unsync: %lu", (ulong) min_unsync));
+ if (soft && min_unsync < last_need_file)
+ {
+ last_need_file= min_unsync;
+ DBUG_PRINT("info", ("last_need_file set to %lu", (ulong)last_need_file));
+ }
+
pthread_mutex_lock(&log_descriptor.purger_lock);
+ DBUG_PRINT("info", ("last_lsn_checked file: %lu:",
+ (ulong) log_descriptor.last_lsn_checked));
if (LSN_FILE_NO(log_descriptor.last_lsn_checked) < last_need_file)
{
uint32 i;
uint32 min_file= translog_first_file(horizon, 1);
DBUG_ASSERT(min_file != 0); /* log is already started */
+ DBUG_PRINT("info", ("min_file: %lu:",(ulong) min_file));
for(i= min_file; i < last_need_file && rc == 0; i++)
{
LSN lsn= translog_get_file_max_lsn_stored(i);
@@ -8356,6 +8684,153 @@ my_bool translog_log_debug_info(TRN *trn
}
+
+/**
+ Sets soft sync mode
+
+ @param mode TRUE if we need switch soft sync on else off
+*/
+
+void translog_soft_sync(my_bool mode)
+{
+ soft_sync= mode;
+}
+
+
+/**
+ Sets hard group commit
+
+ @param mode TRUE if we need switch hard group commit on else off
+*/
+
+void translog_hard_group_commit(my_bool mode)
+{
+ hard_group_commit= mode;
+}
+
+
+/**
+ @brief forced log sync (used when we are switching modes)
+*/
+
+void translog_sync()
+{
+ uint32 max= get_current_logfile()->number;
+ uint32 min;
+ DBUG_ENTER("ma_translog_sync");
+
+ my_atomic_rwlock_rdlock(&soft_sync_rwl);
+ min= my_atomic_load32(&soft_sync_min);
+ my_atomic_rwlock_rdunlock(&soft_sync_rwl);
+ if (!min)
+ min= max;
+
+ translog_sync_files(min, max, sync_log_dir >= TRANSLOG_SYNC_DIR_ALWAYS);
+
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ @brief set rate for group commit
+
+ @param rate rate to set.
+
+ @note internally it stores interval in nanoseconds/TRANSLOG_RATE_BASE (to
+ fit into uint32)
+*/
+
+void translog_set_group_commit_rate(uint32 rate)
+{
+ DBUG_ENTER("translog_set_group_commit_rate");
+ ulonglong wait_time;
+ if (rate)
+ {
+ wait_time= ((TRANSLOG_RATE_BASE * 1000000000ULL / rate +
+ TRANSLOG_RATE_BASE / 2) /
+ TRANSLOG_RATE_BASE);
+ if (wait_time == 0)
+ wait_time= 1; /* protection from getting special value */
+ }
+ else
+ wait_time= 0;
+ group_commit_wait= wait_time;
+ DBUG_PRINT("info", ("rate: %lu wait: %llu",
+ (ulong)rate, (ulonglong)wait_time));
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ @brief syncing service thread
+*/
+
+static pthread_handler_t
+ma_soft_sync_background( void *arg __attribute__((unused)))
+{
+
+ my_thread_init();
+ {
+ DBUG_ENTER("ma_soft_sync_background");
+ for(;;)
+ {
+ ulonglong prev_loop= my_micro_time();
+ ulonglong time, sleep;
+ uint32 min, max;
+ my_atomic_rwlock_rdlock(&soft_sync_rwl);
+ min= my_atomic_load32(&soft_sync_min);
+ max= my_atomic_load32(&soft_sync_max);
+ my_atomic_store32(&soft_sync_min, max);
+ my_atomic_rwlock_rdunlock(&soft_sync_rwl);
+
+ sleep= group_commit_wait * TRANSLOG_RATE_BASE;
+ translog_sync_files(min, max, FALSE);
+ time= my_micro_time() - prev_loop;
+ if (time > sleep)
+ sleep= 0;
+ else
+ sleep-= time;
+ if (my_service_thread_sleep(&soft_sync_control, sleep))
+ break;
+ }
+ my_service_thread_signal_end(&soft_sync_control);
+ my_thread_end();
+ DBUG_RETURN(0);
+ }
+}
+
+
+/**
+ @brief Starts syncing thread
+*/
+
+int translog_soft_sync_start(void)
+{
+ pthread_t th;
+ int res= 0;
+ DBUG_ENTER("translog_soft_sync_start");
+ if (!(res= ma_service_thread_control_init(&soft_sync_control)))
+ if (!(res= pthread_create(&th, NULL, ma_soft_sync_background, NULL)))
+ soft_sync_control.status= THREAD_RUNNING;
+ DBUG_RETURN(res);
+}
+
+
+/**
+ @brief Stops syncing thread
+*/
+
+void translog_soft_sync_end(void)
+{
+ DBUG_ENTER("translog_soft_sync_end");
+ if (soft_sync_control.inited)
+ {
+ ma_service_thread_control_end(&soft_sync_control);
+ }
+ DBUG_VOID_RETURN;
+}
+
+
#ifdef MARIA_DUMP_LOG
#include <my_getopt.h>
extern void translog_example_table_init();
=== modified file 'storage/maria/ma_loghandler.h'
--- a/storage/maria/ma_loghandler.h 2009-01-15 22:25:53 +0000
+++ b/storage/maria/ma_loghandler.h 2009-07-07 00:37:23 +0000
@@ -342,6 +342,14 @@ enum enum_translog_status
TRANSLOG_SHUTDOWN /* going to shutdown the loghandler */
};
extern enum enum_translog_status translog_status;
+extern ulonglong translog_syncs; /* Number of sync()s */
+
+void translog_soft_sync(my_bool mode);
+void translog_hard_group_commit(my_bool mode);
+int translog_soft_sync_start(void);
+void translog_soft_sync_end(void);
+void translog_sync();
+void translog_set_group_commit_rate(uint32 rate);
/*
all the rest added because of recovery; should we make
@@ -441,6 +449,18 @@ extern LOG_DESC log_record_type_descript
typedef enum
{
+ TRANSLOG_GCOMMIT_NONE,
+ TRANSLOG_GCOMMIT_HARD,
+ TRANSLOG_GCOMMIT_SOFT
+} enum_maria_group_commit;
+extern ulong maria_group_commit;
+extern ulong maria_group_commit_rate;
+/**
+ group commit interval is TRANSLOG_RATE_BASE/<rate> seconds
+*/
+#define TRANSLOG_RATE_BASE 100
+typedef enum
+{
TRANSLOG_PURGE_IMMIDIATE,
TRANSLOG_PURGE_EXTERNAL,
TRANSLOG_PURGE_ONDEMAND
2
1
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2776)
by knielsen@knielsen-hq.org 27 Nov '09
by knielsen@knielsen-hq.org 27 Nov '09
27 Nov '09
#At lp:maria
2776 knielsen(a)knielsen-hq.org 2009-11-27
After-merge fixes for MySQL 5.1.41 merge into MariaDB: more fixes for Buildbot problems.
modified:
mysql-test/mysql-test-run.pl
mysql-test/suite/rpl/r/rpl_temporary_errors.result
mysql-test/suite/rpl/t/rpl_temporary_errors.test
sql/sql_select.cc
per-file messages:
mysql-test/mysql-test-run.pl
Manually apply similar patch to the one in Bug#47983.
mysql-test/suite/rpl/r/rpl_temporary_errors.result
Fix wrong failure with warning in error log due to per-test suppressions
not being active during server shutdown.
mysql-test/suite/rpl/t/rpl_temporary_errors.test
Fix wrong failure with warning in error log due to per-test suppressions
not being active during server shutdown.
sql/sql_select.cc
Manually cherry-pick fix for Bug#45989.
For some reason, that fix was reverted in MySQL 5.1, even though it is
necessary to plug the memory leak.
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-26 08:02:33 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-11-27 13:20:59 +0000
@@ -3994,6 +3994,11 @@ sub extract_warning_lines ($) {
qr/Slave SQL thread retried transaction/,
qr/Slave \(additional info\)/,
qr/Incorrect information in file/,
+ qr/Slave I\/O: Get master SERVER_ID failed with error:.*/,
+ qr/Slave I\/O: Get master clock failed with error:.*/,
+ 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/,
);
my $match_count= 0;
=== modified file 'mysql-test/suite/rpl/r/rpl_temporary_errors.result'
--- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result 2008-10-13 18:33:08 +0000
+++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result 2009-11-27 13:20:59 +0000
@@ -82,3 +82,4 @@ Last_SQL_Error
DROP TABLE t1;
**** On Master ****
DROP TABLE t1;
+STOP SLAVE;
=== modified file 'mysql-test/suite/rpl/t/rpl_temporary_errors.test'
--- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test 2008-10-13 18:33:08 +0000
+++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test 2009-11-27 13:20:59 +0000
@@ -31,3 +31,12 @@ DROP TABLE t1;
--echo **** On Master ****
connection master;
DROP TABLE t1;
+
+# We must wait for the slave to stop.
+# Otherwise the warnings in the error log about deadlock may be written to
+# the error log only during shutdown, and currently the suppression of
+# "Deadlock found" set in this test case is not effective during server
+# shutdown.
+connection slave;
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-11-16 20:54:33 +0000
+++ b/sql/sql_select.cc 2009-11-27 13:20:59 +0000
@@ -2311,7 +2311,7 @@ JOIN::destroy()
tab->cleanup();
}
tmp_join->tmp_join= 0;
- tmp_table_param.copy_field= 0;
+ tmp_table_param.cleanup();
DBUG_RETURN(tmp_join->destroy());
}
cond_equal= 0;
1
0
[Maria-developers] Updated (by Knielsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 27 Nov '09
by worklog-noreply@askmonty.org 27 Nov '09
27 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Knielsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 27 Nov '09
by worklog-noreply@askmonty.org 27 Nov '09
27 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Knielsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 27 Nov '09
by worklog-noreply@askmonty.org 27 Nov '09
27 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
-=-=(Psergey - Sun, 16 Aug 2009, 00:02)=-=-
Dependency created: 39 now depends on 47
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Timour): Subquery optimization: Efficient NOT IN execution with NULLs (68)
by worklog-noreply@askmonty.org 27 Nov '09
by worklog-noreply@askmonty.org 27 Nov '09
27 Nov '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, 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, 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.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Timour): Subquery optimization: Efficient NOT IN execution with NULLs (68)
by worklog-noreply@askmonty.org 27 Nov '09
by worklog-noreply@askmonty.org 27 Nov '09
27 Nov '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, 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, 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.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] New (by Timour): Subquery optimization: Efficient NOT IN execution with NULLs (68)
by worklog-noreply@askmonty.org 27 Nov '09
by worklog-noreply@askmonty.org 27 Nov '09
27 Nov '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:
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.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] New (by Timour): Subquery optimization: Efficient NOT IN execution with NULLs (68)
by worklog-noreply@askmonty.org 27 Nov '09
by worklog-noreply@askmonty.org 27 Nov '09
27 Nov '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:
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.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Monty): Provide key cache statistics (58)
by worklog-noreply@askmonty.org 27 Nov '09
by worklog-noreply@askmonty.org 27 Nov '09
27 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Provide key cache statistics
CREATION DATE..: Thu, 22 Oct 2009, 12:28
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 58 (http://askmonty.org/worklog/?tid=58)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Monty - Fri, 27 Nov 2009, 12:36)=-=-
High Level Description modified.
--- /tmp/wklog.58.old.15108 2009-11-27 10:36:13.000000000 +0000
+++ /tmp/wklog.58.new.15108 2009-11-27 10:36:13.000000000 +0000
@@ -1,8 +1,7 @@
-Provide the key cache
-statistics available for the default cache (key blocks used,
-unflushed, etc.) for all named caches.
+Provide the same key cache statistics for all MyISAM key caches as we provide
+for the default key cache.
-Monty answers in an email:
+Background: Monty answers in an email to customer:
This is a much simpler task and something that is important to get
done. We would have to introduce a 'show keycache statistics' command
@@ -11,3 +10,44 @@
The raw coding is probably 1-2 days, but on top if this we need
testing, a test environment and building of biniaries for you.
Henrik/Bo and Igor will come back to you with a more exact estimate.
+
+-----------------
+Currently we have:
+
+show status like "key%";
++------------------------+-------+
+| Variable_name | Value |
++------------------------+-------+
+| Key_blocks_not_flushed | 0 |
+| Key_blocks_unused | 13389 |
+| Key_blocks_used | 7 |
+| Key_read_requests | 22 |
+| Key_reads | 7 |
+| Key_write_requests | 0 |
+| Key_writes | 0 |
++------------------------+-------+
+
+Sergei suggested we introduce for each new key cache a set of variables prefixed
+with the keycache name:
+
+show status like "keycache1.%";
+Which should show:
+
++----------------------------------+-------+
+| Variable_name | Value |
++----------------------------------+-------+
+| keycache1.Key_blocks_not_flushed | 0 |
+| keycache1.Key_blocks_unused | 13389 |
+| keycache1.Key_blocks_used | 7 |
+| keycache1.Key_read_requests | 22 |
+| keycache1.Key_reads | 7 |
+| keycache1.Key_write_requests | 0 |
+| keycache1.Key_writes | 0 |
++----------------------------------+-------+
+
+The task would thus to be to automatically introduce new variables when we
+create a new key cache and automatically remove these variables when the cache
+is deleted.
+
+The other option would be to add an information schema where we populate the
+information schema with data from all existing key caches.
DESCRIPTION:
Provide the same key cache statistics for all MyISAM key caches as we provide
for the default key cache.
Background: Monty answers in an email to customer:
This is a much simpler task and something that is important to get
done. We would have to introduce a 'show keycache statistics' command
that would iterate over all keycaches and provide the statistics.
The raw coding is probably 1-2 days, but on top if this we need
testing, a test environment and building of biniaries for you.
Henrik/Bo and Igor will come back to you with a more exact estimate.
-----------------
Currently we have:
show status like "key%";
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 13389 |
| Key_blocks_used | 7 |
| Key_read_requests | 22 |
| Key_reads | 7 |
| Key_write_requests | 0 |
| Key_writes | 0 |
+------------------------+-------+
Sergei suggested we introduce for each new key cache a set of variables prefixed
with the keycache name:
show status like "keycache1.%";
Which should show:
+----------------------------------+-------+
| Variable_name | Value |
+----------------------------------+-------+
| keycache1.Key_blocks_not_flushed | 0 |
| keycache1.Key_blocks_unused | 13389 |
| keycache1.Key_blocks_used | 7 |
| keycache1.Key_read_requests | 22 |
| keycache1.Key_reads | 7 |
| keycache1.Key_write_requests | 0 |
| keycache1.Key_writes | 0 |
+----------------------------------+-------+
The task would thus to be to automatically introduce new variables when we
create a new key cache and automatically remove these variables when the cache
is deleted.
The other option would be to add an information schema where we populate the
information schema with data from all existing key caches.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Test failures in PBXT after merging with MySQL-5.1.41
by Kristian Nielsen 27 Nov '09
by Kristian Nielsen 27 Nov '09
27 Nov '09
Hi Paul, Vladimir,
We are working on merging latest MySQL (5.1.41) into MariaDB.
After the merge, I see some test failures in the PBXT test suite. See here:
https://askmonty.org/buildbot/builders/hardy-amd64-fulltest/builds/118/step…
Or if you prefer, see here for a search for these failures in the build
history database:
http://askmonty.org/buildbot/reports/cross_reference#branch=5.1-merge&revis…
>From a quick look, it seems to me most/all of these are just the need to
adjust result files for changes/bugfixes in MySQL. But before spending time on
fixing, I though it was better to coordinate with you, to not duplicate
effort.
So perhaps you already did the similar changes for the PBXT testsuite against
MySQL 5.1.41? Is there maybe a newer version of PBXT that we should merge?
Or alternatively, do you want me to fix the testsuite, and then send you a
patch for merging into PBXT to update to 5.1.41?
- Kristian.
3
11
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2769)
by Michael Widenius 26 Nov '09
by Michael Widenius 26 Nov '09
26 Nov '09
#At lp:maria based on revid:monty@askmonty.org-20091126155705-5g7fmkbcpdu6ad6j
2769 Michael Widenius 2009-11-26
Added protection around usage of thd->mysys_var
(May be changed to 0 by scheduler)
modified:
sql/mysqld.cc
sql/scheduler.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_insert.cc
sql/sql_show.cc
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-10-31 19:22:50 +0000
+++ b/sql/mysqld.cc 2009-11-26 20:19:33 +0000
@@ -957,6 +957,7 @@ static void close_connections(void)
tmp->killed= THD::KILL_CONNECTION;
thread_scheduler.post_kill_notification(tmp);
+ pthread_mutex_lock(&tmp->LOCK_thd_data);
if (tmp->mysys_var)
{
tmp->mysys_var->abort=1;
@@ -979,6 +980,7 @@ static void close_connections(void)
}
pthread_mutex_unlock(&tmp->mysys_var->mutex);
}
+ pthread_mutex_unlock(&tmp->LOCK_thd_data);
}
(void) pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list
=== modified file 'sql/scheduler.cc'
--- a/sql/scheduler.cc 2009-09-07 20:50:10 +0000
+++ b/sql/scheduler.cc 2009-11-26 20:19:33 +0000
@@ -235,9 +235,7 @@ void thd_scheduler::thread_detach()
if (thread_attached)
{
THD* thd = (THD*)list.data;
- pthread_mutex_lock(&thd->LOCK_thd_data);
- thd->mysys_var= NULL;
- pthread_mutex_unlock(&thd->LOCK_thd_data);
+ thd->reset_globals();
thread_attached= FALSE;
#ifndef DBUG_OFF
/*
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2009-09-15 10:46:35 +0000
+++ b/sql/sql_class.cc 2009-11-26 20:19:33 +0000
@@ -1166,6 +1166,19 @@ bool THD::store_globals()
}
+/**
+ Untie THD from current thread
+
+ Used when using --thread-handling=pool-of-threads
+*/
+
+void THD::reset_globals()
+{
+ pthread_mutex_lock(&LOCK_thd_data);
+ mysys_var= 0;
+ pthread_mutex_unlock(&LOCK_thd_data);
+}
+
/*
Cleanup after query.
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2009-09-15 10:46:35 +0000
+++ b/sql/sql_class.h 2009-11-26 20:19:33 +0000
@@ -1906,6 +1906,7 @@ public:
void cleanup(void);
void cleanup_after_query();
bool store_globals();
+ void reset_globals();
#ifdef SIGNAL_WITH_VIO_CLOSE
inline void set_active_vio(Vio* vio)
{
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2009-11-07 10:34:19 +0000
+++ b/sql/sql_insert.cc 2009-11-26 20:19:33 +0000
@@ -2279,6 +2279,7 @@ void kill_delayed_threads(void)
while ((di= it++))
{
di->thd.killed= THD::KILL_CONNECTION;
+ pthread_mutex_lock(&di->thd.LOCK_thd_data);
if (di->thd.mysys_var)
{
pthread_mutex_lock(&di->thd.mysys_var->mutex);
@@ -2297,6 +2298,7 @@ void kill_delayed_threads(void)
}
pthread_mutex_unlock(&di->thd.mysys_var->mutex);
}
+ pthread_mutex_unlock(&di->thd.LOCK_thd_data);
}
VOID(pthread_mutex_unlock(&LOCK_delayed_insert)); // For unlink from list
}
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2009-11-02 09:30:21 +0000
+++ b/sql/sql_show.cc 2009-11-26 20:19:33 +0000
@@ -1747,6 +1747,7 @@ void mysqld_list_processes(THD *thd,cons
if ((thd_info->db=tmp->db)) // Safe test
thd_info->db=thd->strdup(thd_info->db);
thd_info->command=(int) tmp->command;
+ pthread_mutex_lock(&tmp->LOCK_thd_data);
if ((mysys_var= tmp->mysys_var))
pthread_mutex_lock(&mysys_var->mutex);
thd_info->proc_info= (char*) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0);
@@ -1766,6 +1767,7 @@ void mysqld_list_processes(THD *thd,cons
#endif
if (mysys_var)
pthread_mutex_unlock(&mysys_var->mutex);
+ pthread_mutex_unlock(&tmp->LOCK_thd_data);
thd_info->start_time= tmp->start_time;
thd_info->query=0;
1
0
[Maria-developers] Updated (by Psergey): MRR backport (67)
by worklog-noreply@askmonty.org 26 Nov '09
by worklog-noreply@askmonty.org 26 Nov '09
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Psergey - Thu, 26 Nov 2009, 20:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.9329 2009-11-26 20:21:28.000000000 +0200
+++ /tmp/wklog.67.new.9329 2009-11-26 20:21:28.000000000 +0200
@@ -65,17 +65,19 @@
2.5 Make MRR code more of a module
----------------------------------
-Some code in handler.cc can be moved to separate file.
-But changes in opt_range.cc can't.
-TODO: Sort out how much we really can do here. Initial guess is not much as the
-code consists of:
+It is not possible to make MRR to be a totally separate module, as its code
+consists of :
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
- calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ calls. These rely on opt_range.cc's internal stuctures like SEL_ARG trees and
so there is not much point in moving them out.
-- DS-MRR implementations which are spread over storage engines.
-and the only modularization we see is to move #1 into a separate file which
-won't achieve much.
+- DS-MRR impelementations which are spread over storage engines.
+
+We'll try to modularize what we can:
+- Move out default MRR implementation from handler.cc
+- Move possible parts out of opt_range.cc into a separate file.
+
+
2.6 Improve the cost model
--------------------------
-=-=(Psergey - Thu, 26 Nov 2009, 19:06)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.6449 2009-11-26 19:06:04.000000000 +0200
+++ /tmp/wklog.67.new.6449 2009-11-26 19:06:04.000000000 +0200
@@ -1,4 +1,3 @@
-
<contents>
1. Requirements
2. Required actions
@@ -44,6 +43,7 @@
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=icp
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
-=-=(Psergey - Thu, 26 Nov 2009, 18:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.4161 2009-11-26 18:15:36.000000000 +0200
+++ /tmp/wklog.67.new.4161 2009-11-26 18:15:36.000000000 +0200
@@ -1,3 +1,17 @@
+
+<contents>
+1. Requirements
+2. Required actions
+2.1 Fix DS-MRR/InnoDB bugs
+2.2 Backport DS-MRR code to MariaDB 5.2
+2.3 Introduce control variables
+2.4 Other backport issues
+2.5 Make MRR code more of a module
+2.6 Improve the cost model
+2.7 Let DS-MRR support clustered primary keys
+</contents>
+
+
1. Requirements
===============
@@ -63,4 +77,28 @@
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
+2.6 Improve the cost model
+--------------------------
+At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
+records_in_range() calls, followed by index_only_read_time() or read_time()
+calls to produce the estimate for read cost.
+
+ We should change this (TODO sort out how exactly)
+
+Note: this means that the query plans will change from MariaDB 5.2.
+
+2.7 Let DS-MRR support clustered primary keys
+---------------------------------------------
+At the moment DS-MRR is not supported for clustered primary keys. It is not
+needed when MRR is used for range access, because range access is done over
+an ordered list of ranges, but it is useful for BKA.
+
+TODO:
+ it's useful for BKA because BKA makes MRR scans over un-orderered
+ non-disjoint lists of ranges. Then we can sort these and do ordered scans.
+ There is still no use for DS-MRR over clustered primary key for range
+ access, where the ranges are disjoint and ordered.
+ How about postponing this item until BKA is backported?
+
+
-=-=(Guest - Thu, 26 Nov 2009, 16:52)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.694 2009-11-26 14:52:53.000000000 +0000
+++ /tmp/wklog.67.new.694 2009-11-26 14:52:53.000000000 +0000
@@ -1 +1,66 @@
+1. Requirements
+===============
+
+We need the following:
+
+1. Latest MRR interface support, including extensions to support ICP when
+ using BKA.
+2. Let DS-MRR support clustered primary keys (needed when using BKA).
+3. Remove conditions used for key access from the condition pushed to index
+ (ATM this manifests itself as "Using index condition" appearing where there
+ was no "Using where". TODO: example of this?)
+4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
+ is switched on/off by @@engine_condition_pushdown)
+5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
+ for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
+ makes it unobvious for a number of users.
+6. Rename multi_range_read_info_const() to look like it is not a part of MRR
+ interface.
+8. Try to make MRR to be more of a module
+7. Improve MRR's cost model.
+
+2. Required actions
+===================
+
+Roughly in the order in which it will be done:
+
+2.1 Fix DS-MRR/InnoDB bugs
+--------------------------
+We need to fix the bugs listed here:
+
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condition_pushdown
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+
+2.2 Backport DS-MRR code to MariaDB 5.2
+---------------------------------------
+The easiest way seems to be to to manually move the needed code from mysql-6.0
+(or whatever it's called now) to MariaDB.
+
+2.3 Introduce control variables
+-------------------------------
+Act on items #4 and #5 from the requirements. Should be easy as
+@@optimizer_switch is supported in 5.1 codebase.
+
+2.4 Other backport issues
+-------------------------
+* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
+ implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
+ but merging it into 5.1 can be very labor-intensive.
+ Will it be ok to disable NDB/MRR altogether?
+
+
+2.5 Make MRR code more of a module
+----------------------------------
+Some code in handler.cc can be moved to separate file.
+But changes in opt_range.cc can't.
+TODO: Sort out how much we really can do here. Initial guess is not much as the
+code consists of:
+- Default MRR implementation in handler.cc
+- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
+ calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ so there is not much point in moving them out.
+- DS-MRR implementations which are spread over storage engines.
+and the only modularization we see is to move #1 into a separate file which
+won't achieve much.
+
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
HIGH-LEVEL SPECIFICATION:
<contents>
1. Requirements
2. Required actions
2.1 Fix DS-MRR/InnoDB bugs
2.2 Backport DS-MRR code to MariaDB 5.2
2.3 Introduce control variables
2.4 Other backport issues
2.5 Make MRR code more of a module
2.6 Improve the cost model
2.7 Let DS-MRR support clustered primary keys
</contents>
1. Requirements
===============
We need the following:
1. Latest MRR interface support, including extensions to support ICP when
using BKA.
2. Let DS-MRR support clustered primary keys (needed when using BKA).
3. Remove conditions used for key access from the condition pushed to index
(ATM this manifests itself as "Using index condition" appearing where there
was no "Using where". TODO: example of this?)
4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
is switched on/off by @@engine_condition_pushdown)
5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
makes it unobvious for a number of users.
6. Rename multi_range_read_info_const() to look like it is not a part of MRR
interface.
8. Try to make MRR to be more of a module
7. Improve MRR's cost model.
2. Required actions
===================
Roughly in the order in which it will be done:
2.1 Fix DS-MRR/InnoDB bugs
--------------------------
We need to fix the bugs listed here:
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=icp
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
The easiest way seems to be to to manually move the needed code from mysql-6.0
(or whatever it's called now) to MariaDB.
2.3 Introduce control variables
-------------------------------
Act on items #4 and #5 from the requirements. Should be easy as
@@optimizer_switch is supported in 5.1 codebase.
2.4 Other backport issues
-------------------------
* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
but merging it into 5.1 can be very labor-intensive.
Will it be ok to disable NDB/MRR altogether?
2.5 Make MRR code more of a module
----------------------------------
It is not possible to make MRR to be a totally separate module, as its code
consists of :
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
calls. These rely on opt_range.cc's internal stuctures like SEL_ARG trees and
so there is not much point in moving them out.
- DS-MRR impelementations which are spread over storage engines.
We'll try to modularize what we can:
- Move out default MRR implementation from handler.cc
- Move possible parts out of opt_range.cc into a separate file.
2.6 Improve the cost model
--------------------------
At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
records_in_range() calls, followed by index_only_read_time() or read_time()
calls to produce the estimate for read cost.
We should change this (TODO sort out how exactly)
Note: this means that the query plans will change from MariaDB 5.2.
2.7 Let DS-MRR support clustered primary keys
---------------------------------------------
At the moment DS-MRR is not supported for clustered primary keys. It is not
needed when MRR is used for range access, because range access is done over
an ordered list of ranges, but it is useful for BKA.
TODO:
it's useful for BKA because BKA makes MRR scans over un-orderered
non-disjoint lists of ranges. Then we can sort these and do ordered scans.
There is still no use for DS-MRR over clustered primary key for range
access, where the ranges are disjoint and ordered.
How about postponing this item until BKA is backported?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Psergey): MRR backport (67)
by worklog-noreply@askmonty.org 26 Nov '09
by worklog-noreply@askmonty.org 26 Nov '09
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Psergey - Thu, 26 Nov 2009, 20:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.9329 2009-11-26 20:21:28.000000000 +0200
+++ /tmp/wklog.67.new.9329 2009-11-26 20:21:28.000000000 +0200
@@ -65,17 +65,19 @@
2.5 Make MRR code more of a module
----------------------------------
-Some code in handler.cc can be moved to separate file.
-But changes in opt_range.cc can't.
-TODO: Sort out how much we really can do here. Initial guess is not much as the
-code consists of:
+It is not possible to make MRR to be a totally separate module, as its code
+consists of :
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
- calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ calls. These rely on opt_range.cc's internal stuctures like SEL_ARG trees and
so there is not much point in moving them out.
-- DS-MRR implementations which are spread over storage engines.
-and the only modularization we see is to move #1 into a separate file which
-won't achieve much.
+- DS-MRR impelementations which are spread over storage engines.
+
+We'll try to modularize what we can:
+- Move out default MRR implementation from handler.cc
+- Move possible parts out of opt_range.cc into a separate file.
+
+
2.6 Improve the cost model
--------------------------
-=-=(Psergey - Thu, 26 Nov 2009, 19:06)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.6449 2009-11-26 19:06:04.000000000 +0200
+++ /tmp/wklog.67.new.6449 2009-11-26 19:06:04.000000000 +0200
@@ -1,4 +1,3 @@
-
<contents>
1. Requirements
2. Required actions
@@ -44,6 +43,7 @@
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=icp
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
-=-=(Psergey - Thu, 26 Nov 2009, 18:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.4161 2009-11-26 18:15:36.000000000 +0200
+++ /tmp/wklog.67.new.4161 2009-11-26 18:15:36.000000000 +0200
@@ -1,3 +1,17 @@
+
+<contents>
+1. Requirements
+2. Required actions
+2.1 Fix DS-MRR/InnoDB bugs
+2.2 Backport DS-MRR code to MariaDB 5.2
+2.3 Introduce control variables
+2.4 Other backport issues
+2.5 Make MRR code more of a module
+2.6 Improve the cost model
+2.7 Let DS-MRR support clustered primary keys
+</contents>
+
+
1. Requirements
===============
@@ -63,4 +77,28 @@
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
+2.6 Improve the cost model
+--------------------------
+At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
+records_in_range() calls, followed by index_only_read_time() or read_time()
+calls to produce the estimate for read cost.
+
+ We should change this (TODO sort out how exactly)
+
+Note: this means that the query plans will change from MariaDB 5.2.
+
+2.7 Let DS-MRR support clustered primary keys
+---------------------------------------------
+At the moment DS-MRR is not supported for clustered primary keys. It is not
+needed when MRR is used for range access, because range access is done over
+an ordered list of ranges, but it is useful for BKA.
+
+TODO:
+ it's useful for BKA because BKA makes MRR scans over un-orderered
+ non-disjoint lists of ranges. Then we can sort these and do ordered scans.
+ There is still no use for DS-MRR over clustered primary key for range
+ access, where the ranges are disjoint and ordered.
+ How about postponing this item until BKA is backported?
+
+
-=-=(Guest - Thu, 26 Nov 2009, 16:52)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.694 2009-11-26 14:52:53.000000000 +0000
+++ /tmp/wklog.67.new.694 2009-11-26 14:52:53.000000000 +0000
@@ -1 +1,66 @@
+1. Requirements
+===============
+
+We need the following:
+
+1. Latest MRR interface support, including extensions to support ICP when
+ using BKA.
+2. Let DS-MRR support clustered primary keys (needed when using BKA).
+3. Remove conditions used for key access from the condition pushed to index
+ (ATM this manifests itself as "Using index condition" appearing where there
+ was no "Using where". TODO: example of this?)
+4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
+ is switched on/off by @@engine_condition_pushdown)
+5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
+ for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
+ makes it unobvious for a number of users.
+6. Rename multi_range_read_info_const() to look like it is not a part of MRR
+ interface.
+8. Try to make MRR to be more of a module
+7. Improve MRR's cost model.
+
+2. Required actions
+===================
+
+Roughly in the order in which it will be done:
+
+2.1 Fix DS-MRR/InnoDB bugs
+--------------------------
+We need to fix the bugs listed here:
+
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condition_pushdown
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+
+2.2 Backport DS-MRR code to MariaDB 5.2
+---------------------------------------
+The easiest way seems to be to to manually move the needed code from mysql-6.0
+(or whatever it's called now) to MariaDB.
+
+2.3 Introduce control variables
+-------------------------------
+Act on items #4 and #5 from the requirements. Should be easy as
+@@optimizer_switch is supported in 5.1 codebase.
+
+2.4 Other backport issues
+-------------------------
+* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
+ implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
+ but merging it into 5.1 can be very labor-intensive.
+ Will it be ok to disable NDB/MRR altogether?
+
+
+2.5 Make MRR code more of a module
+----------------------------------
+Some code in handler.cc can be moved to separate file.
+But changes in opt_range.cc can't.
+TODO: Sort out how much we really can do here. Initial guess is not much as the
+code consists of:
+- Default MRR implementation in handler.cc
+- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
+ calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ so there is not much point in moving them out.
+- DS-MRR implementations which are spread over storage engines.
+and the only modularization we see is to move #1 into a separate file which
+won't achieve much.
+
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
HIGH-LEVEL SPECIFICATION:
<contents>
1. Requirements
2. Required actions
2.1 Fix DS-MRR/InnoDB bugs
2.2 Backport DS-MRR code to MariaDB 5.2
2.3 Introduce control variables
2.4 Other backport issues
2.5 Make MRR code more of a module
2.6 Improve the cost model
2.7 Let DS-MRR support clustered primary keys
</contents>
1. Requirements
===============
We need the following:
1. Latest MRR interface support, including extensions to support ICP when
using BKA.
2. Let DS-MRR support clustered primary keys (needed when using BKA).
3. Remove conditions used for key access from the condition pushed to index
(ATM this manifests itself as "Using index condition" appearing where there
was no "Using where". TODO: example of this?)
4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
is switched on/off by @@engine_condition_pushdown)
5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
makes it unobvious for a number of users.
6. Rename multi_range_read_info_const() to look like it is not a part of MRR
interface.
8. Try to make MRR to be more of a module
7. Improve MRR's cost model.
2. Required actions
===================
Roughly in the order in which it will be done:
2.1 Fix DS-MRR/InnoDB bugs
--------------------------
We need to fix the bugs listed here:
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=icp
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
The easiest way seems to be to to manually move the needed code from mysql-6.0
(or whatever it's called now) to MariaDB.
2.3 Introduce control variables
-------------------------------
Act on items #4 and #5 from the requirements. Should be easy as
@@optimizer_switch is supported in 5.1 codebase.
2.4 Other backport issues
-------------------------
* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
but merging it into 5.1 can be very labor-intensive.
Will it be ok to disable NDB/MRR altogether?
2.5 Make MRR code more of a module
----------------------------------
It is not possible to make MRR to be a totally separate module, as its code
consists of :
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
calls. These rely on opt_range.cc's internal stuctures like SEL_ARG trees and
so there is not much point in moving them out.
- DS-MRR impelementations which are spread over storage engines.
We'll try to modularize what we can:
- Move out default MRR implementation from handler.cc
- Move possible parts out of opt_range.cc into a separate file.
2.6 Improve the cost model
--------------------------
At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
records_in_range() calls, followed by index_only_read_time() or read_time()
calls to produce the estimate for read cost.
We should change this (TODO sort out how exactly)
Note: this means that the query plans will change from MariaDB 5.2.
2.7 Let DS-MRR support clustered primary keys
---------------------------------------------
At the moment DS-MRR is not supported for clustered primary keys. It is not
needed when MRR is used for range access, because range access is done over
an ordered list of ranges, but it is useful for BKA.
TODO:
it's useful for BKA because BKA makes MRR scans over un-orderered
non-disjoint lists of ranges. Then we can sort these and do ordered scans.
There is still no use for DS-MRR over clustered primary key for range
access, where the ranges are disjoint and ordered.
How about postponing this item until BKA is backported?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Psergey): MRR backport (67)
by worklog-noreply@askmonty.org 26 Nov '09
by worklog-noreply@askmonty.org 26 Nov '09
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Psergey - Thu, 26 Nov 2009, 19:06)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.6449 2009-11-26 19:06:04.000000000 +0200
+++ /tmp/wklog.67.new.6449 2009-11-26 19:06:04.000000000 +0200
@@ -1,4 +1,3 @@
-
<contents>
1. Requirements
2. Required actions
@@ -44,6 +43,7 @@
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=icp
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
-=-=(Psergey - Thu, 26 Nov 2009, 18:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.4161 2009-11-26 18:15:36.000000000 +0200
+++ /tmp/wklog.67.new.4161 2009-11-26 18:15:36.000000000 +0200
@@ -1,3 +1,17 @@
+
+<contents>
+1. Requirements
+2. Required actions
+2.1 Fix DS-MRR/InnoDB bugs
+2.2 Backport DS-MRR code to MariaDB 5.2
+2.3 Introduce control variables
+2.4 Other backport issues
+2.5 Make MRR code more of a module
+2.6 Improve the cost model
+2.7 Let DS-MRR support clustered primary keys
+</contents>
+
+
1. Requirements
===============
@@ -63,4 +77,28 @@
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
+2.6 Improve the cost model
+--------------------------
+At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
+records_in_range() calls, followed by index_only_read_time() or read_time()
+calls to produce the estimate for read cost.
+
+ We should change this (TODO sort out how exactly)
+
+Note: this means that the query plans will change from MariaDB 5.2.
+
+2.7 Let DS-MRR support clustered primary keys
+---------------------------------------------
+At the moment DS-MRR is not supported for clustered primary keys. It is not
+needed when MRR is used for range access, because range access is done over
+an ordered list of ranges, but it is useful for BKA.
+
+TODO:
+ it's useful for BKA because BKA makes MRR scans over un-orderered
+ non-disjoint lists of ranges. Then we can sort these and do ordered scans.
+ There is still no use for DS-MRR over clustered primary key for range
+ access, where the ranges are disjoint and ordered.
+ How about postponing this item until BKA is backported?
+
+
-=-=(Guest - Thu, 26 Nov 2009, 16:52)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.694 2009-11-26 14:52:53.000000000 +0000
+++ /tmp/wklog.67.new.694 2009-11-26 14:52:53.000000000 +0000
@@ -1 +1,66 @@
+1. Requirements
+===============
+
+We need the following:
+
+1. Latest MRR interface support, including extensions to support ICP when
+ using BKA.
+2. Let DS-MRR support clustered primary keys (needed when using BKA).
+3. Remove conditions used for key access from the condition pushed to index
+ (ATM this manifests itself as "Using index condition" appearing where there
+ was no "Using where". TODO: example of this?)
+4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
+ is switched on/off by @@engine_condition_pushdown)
+5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
+ for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
+ makes it unobvious for a number of users.
+6. Rename multi_range_read_info_const() to look like it is not a part of MRR
+ interface.
+8. Try to make MRR to be more of a module
+7. Improve MRR's cost model.
+
+2. Required actions
+===================
+
+Roughly in the order in which it will be done:
+
+2.1 Fix DS-MRR/InnoDB bugs
+--------------------------
+We need to fix the bugs listed here:
+
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condition_pushdown
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+
+2.2 Backport DS-MRR code to MariaDB 5.2
+---------------------------------------
+The easiest way seems to be to to manually move the needed code from mysql-6.0
+(or whatever it's called now) to MariaDB.
+
+2.3 Introduce control variables
+-------------------------------
+Act on items #4 and #5 from the requirements. Should be easy as
+@@optimizer_switch is supported in 5.1 codebase.
+
+2.4 Other backport issues
+-------------------------
+* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
+ implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
+ but merging it into 5.1 can be very labor-intensive.
+ Will it be ok to disable NDB/MRR altogether?
+
+
+2.5 Make MRR code more of a module
+----------------------------------
+Some code in handler.cc can be moved to separate file.
+But changes in opt_range.cc can't.
+TODO: Sort out how much we really can do here. Initial guess is not much as the
+code consists of:
+- Default MRR implementation in handler.cc
+- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
+ calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ so there is not much point in moving them out.
+- DS-MRR implementations which are spread over storage engines.
+and the only modularization we see is to move #1 into a separate file which
+won't achieve much.
+
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
HIGH-LEVEL SPECIFICATION:
<contents>
1. Requirements
2. Required actions
2.1 Fix DS-MRR/InnoDB bugs
2.2 Backport DS-MRR code to MariaDB 5.2
2.3 Introduce control variables
2.4 Other backport issues
2.5 Make MRR code more of a module
2.6 Improve the cost model
2.7 Let DS-MRR support clustered primary keys
</contents>
1. Requirements
===============
We need the following:
1. Latest MRR interface support, including extensions to support ICP when
using BKA.
2. Let DS-MRR support clustered primary keys (needed when using BKA).
3. Remove conditions used for key access from the condition pushed to index
(ATM this manifests itself as "Using index condition" appearing where there
was no "Using where". TODO: example of this?)
4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
is switched on/off by @@engine_condition_pushdown)
5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
makes it unobvious for a number of users.
6. Rename multi_range_read_info_const() to look like it is not a part of MRR
interface.
8. Try to make MRR to be more of a module
7. Improve MRR's cost model.
2. Required actions
===================
Roughly in the order in which it will be done:
2.1 Fix DS-MRR/InnoDB bugs
--------------------------
We need to fix the bugs listed here:
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=icp
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
The easiest way seems to be to to manually move the needed code from mysql-6.0
(or whatever it's called now) to MariaDB.
2.3 Introduce control variables
-------------------------------
Act on items #4 and #5 from the requirements. Should be easy as
@@optimizer_switch is supported in 5.1 codebase.
2.4 Other backport issues
-------------------------
* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
but merging it into 5.1 can be very labor-intensive.
Will it be ok to disable NDB/MRR altogether?
2.5 Make MRR code more of a module
----------------------------------
Some code in handler.cc can be moved to separate file.
But changes in opt_range.cc can't.
TODO: Sort out how much we really can do here. Initial guess is not much as the
code consists of:
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
so there is not much point in moving them out.
- DS-MRR implementations which are spread over storage engines.
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
2.6 Improve the cost model
--------------------------
At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
records_in_range() calls, followed by index_only_read_time() or read_time()
calls to produce the estimate for read cost.
We should change this (TODO sort out how exactly)
Note: this means that the query plans will change from MariaDB 5.2.
2.7 Let DS-MRR support clustered primary keys
---------------------------------------------
At the moment DS-MRR is not supported for clustered primary keys. It is not
needed when MRR is used for range access, because range access is done over
an ordered list of ranges, but it is useful for BKA.
TODO:
it's useful for BKA because BKA makes MRR scans over un-orderered
non-disjoint lists of ranges. Then we can sort these and do ordered scans.
There is still no use for DS-MRR over clustered primary key for range
access, where the ranges are disjoint and ordered.
How about postponing this item until BKA is backported?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Psergey): MRR backport (67)
by worklog-noreply@askmonty.org 26 Nov '09
by worklog-noreply@askmonty.org 26 Nov '09
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Psergey - Thu, 26 Nov 2009, 19:06)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.6449 2009-11-26 19:06:04.000000000 +0200
+++ /tmp/wklog.67.new.6449 2009-11-26 19:06:04.000000000 +0200
@@ -1,4 +1,3 @@
-
<contents>
1. Requirements
2. Required actions
@@ -44,6 +43,7 @@
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=icp
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
-=-=(Psergey - Thu, 26 Nov 2009, 18:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.4161 2009-11-26 18:15:36.000000000 +0200
+++ /tmp/wklog.67.new.4161 2009-11-26 18:15:36.000000000 +0200
@@ -1,3 +1,17 @@
+
+<contents>
+1. Requirements
+2. Required actions
+2.1 Fix DS-MRR/InnoDB bugs
+2.2 Backport DS-MRR code to MariaDB 5.2
+2.3 Introduce control variables
+2.4 Other backport issues
+2.5 Make MRR code more of a module
+2.6 Improve the cost model
+2.7 Let DS-MRR support clustered primary keys
+</contents>
+
+
1. Requirements
===============
@@ -63,4 +77,28 @@
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
+2.6 Improve the cost model
+--------------------------
+At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
+records_in_range() calls, followed by index_only_read_time() or read_time()
+calls to produce the estimate for read cost.
+
+ We should change this (TODO sort out how exactly)
+
+Note: this means that the query plans will change from MariaDB 5.2.
+
+2.7 Let DS-MRR support clustered primary keys
+---------------------------------------------
+At the moment DS-MRR is not supported for clustered primary keys. It is not
+needed when MRR is used for range access, because range access is done over
+an ordered list of ranges, but it is useful for BKA.
+
+TODO:
+ it's useful for BKA because BKA makes MRR scans over un-orderered
+ non-disjoint lists of ranges. Then we can sort these and do ordered scans.
+ There is still no use for DS-MRR over clustered primary key for range
+ access, where the ranges are disjoint and ordered.
+ How about postponing this item until BKA is backported?
+
+
-=-=(Guest - Thu, 26 Nov 2009, 16:52)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.694 2009-11-26 14:52:53.000000000 +0000
+++ /tmp/wklog.67.new.694 2009-11-26 14:52:53.000000000 +0000
@@ -1 +1,66 @@
+1. Requirements
+===============
+
+We need the following:
+
+1. Latest MRR interface support, including extensions to support ICP when
+ using BKA.
+2. Let DS-MRR support clustered primary keys (needed when using BKA).
+3. Remove conditions used for key access from the condition pushed to index
+ (ATM this manifests itself as "Using index condition" appearing where there
+ was no "Using where". TODO: example of this?)
+4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
+ is switched on/off by @@engine_condition_pushdown)
+5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
+ for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
+ makes it unobvious for a number of users.
+6. Rename multi_range_read_info_const() to look like it is not a part of MRR
+ interface.
+8. Try to make MRR to be more of a module
+7. Improve MRR's cost model.
+
+2. Required actions
+===================
+
+Roughly in the order in which it will be done:
+
+2.1 Fix DS-MRR/InnoDB bugs
+--------------------------
+We need to fix the bugs listed here:
+
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condition_pushdown
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+
+2.2 Backport DS-MRR code to MariaDB 5.2
+---------------------------------------
+The easiest way seems to be to to manually move the needed code from mysql-6.0
+(or whatever it's called now) to MariaDB.
+
+2.3 Introduce control variables
+-------------------------------
+Act on items #4 and #5 from the requirements. Should be easy as
+@@optimizer_switch is supported in 5.1 codebase.
+
+2.4 Other backport issues
+-------------------------
+* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
+ implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
+ but merging it into 5.1 can be very labor-intensive.
+ Will it be ok to disable NDB/MRR altogether?
+
+
+2.5 Make MRR code more of a module
+----------------------------------
+Some code in handler.cc can be moved to separate file.
+But changes in opt_range.cc can't.
+TODO: Sort out how much we really can do here. Initial guess is not much as the
+code consists of:
+- Default MRR implementation in handler.cc
+- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
+ calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ so there is not much point in moving them out.
+- DS-MRR implementations which are spread over storage engines.
+and the only modularization we see is to move #1 into a separate file which
+won't achieve much.
+
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
HIGH-LEVEL SPECIFICATION:
<contents>
1. Requirements
2. Required actions
2.1 Fix DS-MRR/InnoDB bugs
2.2 Backport DS-MRR code to MariaDB 5.2
2.3 Introduce control variables
2.4 Other backport issues
2.5 Make MRR code more of a module
2.6 Improve the cost model
2.7 Let DS-MRR support clustered primary keys
</contents>
1. Requirements
===============
We need the following:
1. Latest MRR interface support, including extensions to support ICP when
using BKA.
2. Let DS-MRR support clustered primary keys (needed when using BKA).
3. Remove conditions used for key access from the condition pushed to index
(ATM this manifests itself as "Using index condition" appearing where there
was no "Using where". TODO: example of this?)
4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
is switched on/off by @@engine_condition_pushdown)
5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
makes it unobvious for a number of users.
6. Rename multi_range_read_info_const() to look like it is not a part of MRR
interface.
8. Try to make MRR to be more of a module
7. Improve MRR's cost model.
2. Required actions
===================
Roughly in the order in which it will be done:
2.1 Fix DS-MRR/InnoDB bugs
--------------------------
We need to fix the bugs listed here:
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=icp
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
The easiest way seems to be to to manually move the needed code from mysql-6.0
(or whatever it's called now) to MariaDB.
2.3 Introduce control variables
-------------------------------
Act on items #4 and #5 from the requirements. Should be easy as
@@optimizer_switch is supported in 5.1 codebase.
2.4 Other backport issues
-------------------------
* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
but merging it into 5.1 can be very labor-intensive.
Will it be ok to disable NDB/MRR altogether?
2.5 Make MRR code more of a module
----------------------------------
Some code in handler.cc can be moved to separate file.
But changes in opt_range.cc can't.
TODO: Sort out how much we really can do here. Initial guess is not much as the
code consists of:
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
so there is not much point in moving them out.
- DS-MRR implementations which are spread over storage engines.
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
2.6 Improve the cost model
--------------------------
At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
records_in_range() calls, followed by index_only_read_time() or read_time()
calls to produce the estimate for read cost.
We should change this (TODO sort out how exactly)
Note: this means that the query plans will change from MariaDB 5.2.
2.7 Let DS-MRR support clustered primary keys
---------------------------------------------
At the moment DS-MRR is not supported for clustered primary keys. It is not
needed when MRR is used for range access, because range access is done over
an ordered list of ranges, but it is useful for BKA.
TODO:
it's useful for BKA because BKA makes MRR scans over un-orderered
non-disjoint lists of ranges. Then we can sort these and do ordered scans.
There is still no use for DS-MRR over clustered primary key for range
access, where the ranges are disjoint and ordered.
How about postponing this item until BKA is backported?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Psergey): MRR backport (67)
by worklog-noreply@askmonty.org 26 Nov '09
by worklog-noreply@askmonty.org 26 Nov '09
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Psergey - Thu, 26 Nov 2009, 18:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.4161 2009-11-26 18:15:36.000000000 +0200
+++ /tmp/wklog.67.new.4161 2009-11-26 18:15:36.000000000 +0200
@@ -1,3 +1,17 @@
+
+<contents>
+1. Requirements
+2. Required actions
+2.1 Fix DS-MRR/InnoDB bugs
+2.2 Backport DS-MRR code to MariaDB 5.2
+2.3 Introduce control variables
+2.4 Other backport issues
+2.5 Make MRR code more of a module
+2.6 Improve the cost model
+2.7 Let DS-MRR support clustered primary keys
+</contents>
+
+
1. Requirements
===============
@@ -63,4 +77,28 @@
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
+2.6 Improve the cost model
+--------------------------
+At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
+records_in_range() calls, followed by index_only_read_time() or read_time()
+calls to produce the estimate for read cost.
+
+ We should change this (TODO sort out how exactly)
+
+Note: this means that the query plans will change from MariaDB 5.2.
+
+2.7 Let DS-MRR support clustered primary keys
+---------------------------------------------
+At the moment DS-MRR is not supported for clustered primary keys. It is not
+needed when MRR is used for range access, because range access is done over
+an ordered list of ranges, but it is useful for BKA.
+
+TODO:
+ it's useful for BKA because BKA makes MRR scans over un-orderered
+ non-disjoint lists of ranges. Then we can sort these and do ordered scans.
+ There is still no use for DS-MRR over clustered primary key for range
+ access, where the ranges are disjoint and ordered.
+ How about postponing this item until BKA is backported?
+
+
-=-=(Guest - Thu, 26 Nov 2009, 16:52)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.694 2009-11-26 14:52:53.000000000 +0000
+++ /tmp/wklog.67.new.694 2009-11-26 14:52:53.000000000 +0000
@@ -1 +1,66 @@
+1. Requirements
+===============
+
+We need the following:
+
+1. Latest MRR interface support, including extensions to support ICP when
+ using BKA.
+2. Let DS-MRR support clustered primary keys (needed when using BKA).
+3. Remove conditions used for key access from the condition pushed to index
+ (ATM this manifests itself as "Using index condition" appearing where there
+ was no "Using where". TODO: example of this?)
+4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
+ is switched on/off by @@engine_condition_pushdown)
+5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
+ for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
+ makes it unobvious for a number of users.
+6. Rename multi_range_read_info_const() to look like it is not a part of MRR
+ interface.
+8. Try to make MRR to be more of a module
+7. Improve MRR's cost model.
+
+2. Required actions
+===================
+
+Roughly in the order in which it will be done:
+
+2.1 Fix DS-MRR/InnoDB bugs
+--------------------------
+We need to fix the bugs listed here:
+
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condition_pushdown
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+
+2.2 Backport DS-MRR code to MariaDB 5.2
+---------------------------------------
+The easiest way seems to be to to manually move the needed code from mysql-6.0
+(or whatever it's called now) to MariaDB.
+
+2.3 Introduce control variables
+-------------------------------
+Act on items #4 and #5 from the requirements. Should be easy as
+@@optimizer_switch is supported in 5.1 codebase.
+
+2.4 Other backport issues
+-------------------------
+* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
+ implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
+ but merging it into 5.1 can be very labor-intensive.
+ Will it be ok to disable NDB/MRR altogether?
+
+
+2.5 Make MRR code more of a module
+----------------------------------
+Some code in handler.cc can be moved to separate file.
+But changes in opt_range.cc can't.
+TODO: Sort out how much we really can do here. Initial guess is not much as the
+code consists of:
+- Default MRR implementation in handler.cc
+- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
+ calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ so there is not much point in moving them out.
+- DS-MRR implementations which are spread over storage engines.
+and the only modularization we see is to move #1 into a separate file which
+won't achieve much.
+
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
HIGH-LEVEL SPECIFICATION:
<contents>
1. Requirements
2. Required actions
2.1 Fix DS-MRR/InnoDB bugs
2.2 Backport DS-MRR code to MariaDB 5.2
2.3 Introduce control variables
2.4 Other backport issues
2.5 Make MRR code more of a module
2.6 Improve the cost model
2.7 Let DS-MRR support clustered primary keys
</contents>
1. Requirements
===============
We need the following:
1. Latest MRR interface support, including extensions to support ICP when
using BKA.
2. Let DS-MRR support clustered primary keys (needed when using BKA).
3. Remove conditions used for key access from the condition pushed to index
(ATM this manifests itself as "Using index condition" appearing where there
was no "Using where". TODO: example of this?)
4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
is switched on/off by @@engine_condition_pushdown)
5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
makes it unobvious for a number of users.
6. Rename multi_range_read_info_const() to look like it is not a part of MRR
interface.
8. Try to make MRR to be more of a module
7. Improve MRR's cost model.
2. Required actions
===================
Roughly in the order in which it will be done:
2.1 Fix DS-MRR/InnoDB bugs
--------------------------
We need to fix the bugs listed here:
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
The easiest way seems to be to to manually move the needed code from mysql-6.0
(or whatever it's called now) to MariaDB.
2.3 Introduce control variables
-------------------------------
Act on items #4 and #5 from the requirements. Should be easy as
@@optimizer_switch is supported in 5.1 codebase.
2.4 Other backport issues
-------------------------
* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
but merging it into 5.1 can be very labor-intensive.
Will it be ok to disable NDB/MRR altogether?
2.5 Make MRR code more of a module
----------------------------------
Some code in handler.cc can be moved to separate file.
But changes in opt_range.cc can't.
TODO: Sort out how much we really can do here. Initial guess is not much as the
code consists of:
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
so there is not much point in moving them out.
- DS-MRR implementations which are spread over storage engines.
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
2.6 Improve the cost model
--------------------------
At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
records_in_range() calls, followed by index_only_read_time() or read_time()
calls to produce the estimate for read cost.
We should change this (TODO sort out how exactly)
Note: this means that the query plans will change from MariaDB 5.2.
2.7 Let DS-MRR support clustered primary keys
---------------------------------------------
At the moment DS-MRR is not supported for clustered primary keys. It is not
needed when MRR is used for range access, because range access is done over
an ordered list of ranges, but it is useful for BKA.
TODO:
it's useful for BKA because BKA makes MRR scans over un-orderered
non-disjoint lists of ranges. Then we can sort these and do ordered scans.
There is still no use for DS-MRR over clustered primary key for range
access, where the ranges are disjoint and ordered.
How about postponing this item until BKA is backported?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Psergey): MRR backport (67)
by worklog-noreply@askmonty.org 26 Nov '09
by worklog-noreply@askmonty.org 26 Nov '09
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Psergey - Thu, 26 Nov 2009, 18:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.4161 2009-11-26 18:15:36.000000000 +0200
+++ /tmp/wklog.67.new.4161 2009-11-26 18:15:36.000000000 +0200
@@ -1,3 +1,17 @@
+
+<contents>
+1. Requirements
+2. Required actions
+2.1 Fix DS-MRR/InnoDB bugs
+2.2 Backport DS-MRR code to MariaDB 5.2
+2.3 Introduce control variables
+2.4 Other backport issues
+2.5 Make MRR code more of a module
+2.6 Improve the cost model
+2.7 Let DS-MRR support clustered primary keys
+</contents>
+
+
1. Requirements
===============
@@ -63,4 +77,28 @@
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
+2.6 Improve the cost model
+--------------------------
+At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
+records_in_range() calls, followed by index_only_read_time() or read_time()
+calls to produce the estimate for read cost.
+
+ We should change this (TODO sort out how exactly)
+
+Note: this means that the query plans will change from MariaDB 5.2.
+
+2.7 Let DS-MRR support clustered primary keys
+---------------------------------------------
+At the moment DS-MRR is not supported for clustered primary keys. It is not
+needed when MRR is used for range access, because range access is done over
+an ordered list of ranges, but it is useful for BKA.
+
+TODO:
+ it's useful for BKA because BKA makes MRR scans over un-orderered
+ non-disjoint lists of ranges. Then we can sort these and do ordered scans.
+ There is still no use for DS-MRR over clustered primary key for range
+ access, where the ranges are disjoint and ordered.
+ How about postponing this item until BKA is backported?
+
+
-=-=(Guest - Thu, 26 Nov 2009, 16:52)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.694 2009-11-26 14:52:53.000000000 +0000
+++ /tmp/wklog.67.new.694 2009-11-26 14:52:53.000000000 +0000
@@ -1 +1,66 @@
+1. Requirements
+===============
+
+We need the following:
+
+1. Latest MRR interface support, including extensions to support ICP when
+ using BKA.
+2. Let DS-MRR support clustered primary keys (needed when using BKA).
+3. Remove conditions used for key access from the condition pushed to index
+ (ATM this manifests itself as "Using index condition" appearing where there
+ was no "Using where". TODO: example of this?)
+4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
+ is switched on/off by @@engine_condition_pushdown)
+5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
+ for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
+ makes it unobvious for a number of users.
+6. Rename multi_range_read_info_const() to look like it is not a part of MRR
+ interface.
+8. Try to make MRR to be more of a module
+7. Improve MRR's cost model.
+
+2. Required actions
+===================
+
+Roughly in the order in which it will be done:
+
+2.1 Fix DS-MRR/InnoDB bugs
+--------------------------
+We need to fix the bugs listed here:
+
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condition_pushdown
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+
+2.2 Backport DS-MRR code to MariaDB 5.2
+---------------------------------------
+The easiest way seems to be to to manually move the needed code from mysql-6.0
+(or whatever it's called now) to MariaDB.
+
+2.3 Introduce control variables
+-------------------------------
+Act on items #4 and #5 from the requirements. Should be easy as
+@@optimizer_switch is supported in 5.1 codebase.
+
+2.4 Other backport issues
+-------------------------
+* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
+ implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
+ but merging it into 5.1 can be very labor-intensive.
+ Will it be ok to disable NDB/MRR altogether?
+
+
+2.5 Make MRR code more of a module
+----------------------------------
+Some code in handler.cc can be moved to separate file.
+But changes in opt_range.cc can't.
+TODO: Sort out how much we really can do here. Initial guess is not much as the
+code consists of:
+- Default MRR implementation in handler.cc
+- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
+ calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ so there is not much point in moving them out.
+- DS-MRR implementations which are spread over storage engines.
+and the only modularization we see is to move #1 into a separate file which
+won't achieve much.
+
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
HIGH-LEVEL SPECIFICATION:
<contents>
1. Requirements
2. Required actions
2.1 Fix DS-MRR/InnoDB bugs
2.2 Backport DS-MRR code to MariaDB 5.2
2.3 Introduce control variables
2.4 Other backport issues
2.5 Make MRR code more of a module
2.6 Improve the cost model
2.7 Let DS-MRR support clustered primary keys
</contents>
1. Requirements
===============
We need the following:
1. Latest MRR interface support, including extensions to support ICP when
using BKA.
2. Let DS-MRR support clustered primary keys (needed when using BKA).
3. Remove conditions used for key access from the condition pushed to index
(ATM this manifests itself as "Using index condition" appearing where there
was no "Using where". TODO: example of this?)
4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
is switched on/off by @@engine_condition_pushdown)
5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
makes it unobvious for a number of users.
6. Rename multi_range_read_info_const() to look like it is not a part of MRR
interface.
8. Try to make MRR to be more of a module
7. Improve MRR's cost model.
2. Required actions
===================
Roughly in the order in which it will be done:
2.1 Fix DS-MRR/InnoDB bugs
--------------------------
We need to fix the bugs listed here:
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
The easiest way seems to be to to manually move the needed code from mysql-6.0
(or whatever it's called now) to MariaDB.
2.3 Introduce control variables
-------------------------------
Act on items #4 and #5 from the requirements. Should be easy as
@@optimizer_switch is supported in 5.1 codebase.
2.4 Other backport issues
-------------------------
* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
but merging it into 5.1 can be very labor-intensive.
Will it be ok to disable NDB/MRR altogether?
2.5 Make MRR code more of a module
----------------------------------
Some code in handler.cc can be moved to separate file.
But changes in opt_range.cc can't.
TODO: Sort out how much we really can do here. Initial guess is not much as the
code consists of:
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
so there is not much point in moving them out.
- DS-MRR implementations which are spread over storage engines.
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
2.6 Improve the cost model
--------------------------
At the moment DS-MRR cost formula re-uses non-MRR scan costs, which uses
records_in_range() calls, followed by index_only_read_time() or read_time()
calls to produce the estimate for read cost.
We should change this (TODO sort out how exactly)
Note: this means that the query plans will change from MariaDB 5.2.
2.7 Let DS-MRR support clustered primary keys
---------------------------------------------
At the moment DS-MRR is not supported for clustered primary keys. It is not
needed when MRR is used for range access, because range access is done over
an ordered list of ranges, but it is useful for BKA.
TODO:
it's useful for BKA because BKA makes MRR scans over un-orderered
non-disjoint lists of ranges. Then we can sort these and do ordered scans.
There is still no use for DS-MRR over clustered primary key for range
access, where the ranges are disjoint and ordered.
How about postponing this item until BKA is backported?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2768) Bug#48357
by Michael Widenius 26 Nov '09
by Michael Widenius 26 Nov '09
26 Nov '09
#At lp:maria based on revid:monty@askmonty.org-20091125231823-ausq10s23qyih61x
2768 Michael Widenius 2009-11-26
Fix for Bug #48357 SHOW BINLOG EVENTS: Wrong offset or I/O error
modified:
sql/log_event.cc
per-file messages:
sql/log_event.cc
gcc 4.4.1 assumes that variables that you cast away will not change (strict-aliasing)
The symptom was that mysql-test-run binlog.binglog_database got errors in the log
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2009-10-15 21:38:29 +0000
+++ b/sql/log_event.cc 2009-11-26 15:57:05 +0000
@@ -2133,7 +2133,7 @@ void Query_log_event::pack_info(Protocol
/**
Utility function for the next method (Query_log_event::write()) .
*/
-static void write_str_with_code_and_len(char **dst, const char *src,
+static void write_str_with_code_and_len(uchar **dst, const char *src,
int len, uint code)
{
/*
@@ -2143,7 +2143,7 @@ static void write_str_with_code_and_len(
DBUG_ASSERT(len <= 255);
DBUG_ASSERT(src);
*((*dst)++)= code;
- *((*dst)++)= (uchar) len;
+ *((*dst)++)= len;
bmove(*dst, src, len);
(*dst)+= len;
}
@@ -2229,7 +2229,7 @@ bool Query_log_event::write(IO_CACHE* fi
}
if (catalog_len) // i.e. this var is inited (false for 4.0 events)
{
- write_str_with_code_and_len((char **)(&start),
+ write_str_with_code_and_len(&start,
catalog, catalog_len, Q_CATALOG_NZ_CODE);
/*
In 5.0.x where x<4 masters we used to store the end zero here. This was
@@ -2267,7 +2267,7 @@ bool Query_log_event::write(IO_CACHE* fi
{
/* In the TZ sys table, column Name is of length 64 so this should be ok */
DBUG_ASSERT(time_zone_len <= MAX_TIME_ZONE_NAME_LENGTH);
- write_str_with_code_and_len((char **)(&start),
+ write_str_with_code_and_len(&start,
time_zone_str, time_zone_len, Q_TIME_ZONE_CODE);
}
if (lc_time_names_number)
1
0
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2768: Apply the strict aliasing patch from http://lists.mysql.com/commits/89843
by noreply@launchpad.net 26 Nov '09
by noreply@launchpad.net 26 Nov '09
26 Nov '09
------------------------------------------------------------
revno: 2768
committer: Bo Thorsen <bo.thorsen(a)canonical.com>
branch nick: trunk-local
timestamp: Thu 2009-11-26 16:32:49 +0100
message:
Apply the strict aliasing patch from http://lists.mysql.com/commits/89843
modified:
sql/log_event.cc
--
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
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Guest - Thu, 26 Nov 2009, 16:52)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.694 2009-11-26 14:52:53.000000000 +0000
+++ /tmp/wklog.67.new.694 2009-11-26 14:52:53.000000000 +0000
@@ -1 +1,66 @@
+1. Requirements
+===============
+
+We need the following:
+
+1. Latest MRR interface support, including extensions to support ICP when
+ using BKA.
+2. Let DS-MRR support clustered primary keys (needed when using BKA).
+3. Remove conditions used for key access from the condition pushed to index
+ (ATM this manifests itself as "Using index condition" appearing where there
+ was no "Using where". TODO: example of this?)
+4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
+ is switched on/off by @@engine_condition_pushdown)
+5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
+ for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
+ makes it unobvious for a number of users.
+6. Rename multi_range_read_info_const() to look like it is not a part of MRR
+ interface.
+8. Try to make MRR to be more of a module
+7. Improve MRR's cost model.
+
+2. Required actions
+===================
+
+Roughly in the order in which it will be done:
+
+2.1 Fix DS-MRR/InnoDB bugs
+--------------------------
+We need to fix the bugs listed here:
+
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condition_pushdown
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+
+2.2 Backport DS-MRR code to MariaDB 5.2
+---------------------------------------
+The easiest way seems to be to to manually move the needed code from mysql-6.0
+(or whatever it's called now) to MariaDB.
+
+2.3 Introduce control variables
+-------------------------------
+Act on items #4 and #5 from the requirements. Should be easy as
+@@optimizer_switch is supported in 5.1 codebase.
+
+2.4 Other backport issues
+-------------------------
+* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
+ implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
+ but merging it into 5.1 can be very labor-intensive.
+ Will it be ok to disable NDB/MRR altogether?
+
+
+2.5 Make MRR code more of a module
+----------------------------------
+Some code in handler.cc can be moved to separate file.
+But changes in opt_range.cc can't.
+TODO: Sort out how much we really can do here. Initial guess is not much as the
+code consists of:
+- Default MRR implementation in handler.cc
+- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
+ calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ so there is not much point in moving them out.
+- DS-MRR implementations which are spread over storage engines.
+and the only modularization we see is to move #1 into a separate file which
+won't achieve much.
+
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
HIGH-LEVEL SPECIFICATION:
1. Requirements
===============
We need the following:
1. Latest MRR interface support, including extensions to support ICP when
using BKA.
2. Let DS-MRR support clustered primary keys (needed when using BKA).
3. Remove conditions used for key access from the condition pushed to index
(ATM this manifests itself as "Using index condition" appearing where there
was no "Using where". TODO: example of this?)
4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
is switched on/off by @@engine_condition_pushdown)
5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
makes it unobvious for a number of users.
6. Rename multi_range_read_info_const() to look like it is not a part of MRR
interface.
8. Try to make MRR to be more of a module
7. Improve MRR's cost model.
2. Required actions
===================
Roughly in the order in which it will be done:
2.1 Fix DS-MRR/InnoDB bugs
--------------------------
We need to fix the bugs listed here:
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
The easiest way seems to be to to manually move the needed code from mysql-6.0
(or whatever it's called now) to MariaDB.
2.3 Introduce control variables
-------------------------------
Act on items #4 and #5 from the requirements. Should be easy as
@@optimizer_switch is supported in 5.1 codebase.
2.4 Other backport issues
-------------------------
* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
but merging it into 5.1 can be very labor-intensive.
Will it be ok to disable NDB/MRR altogether?
2.5 Make MRR code more of a module
----------------------------------
Some code in handler.cc can be moved to separate file.
But changes in opt_range.cc can't.
TODO: Sort out how much we really can do here. Initial guess is not much as the
code consists of:
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
so there is not much point in moving them out.
- DS-MRR implementations which are spread over storage engines.
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Guest - Thu, 26 Nov 2009, 16:52)=-=-
High-Level Specification modified.
--- /tmp/wklog.67.old.694 2009-11-26 14:52:53.000000000 +0000
+++ /tmp/wklog.67.new.694 2009-11-26 14:52:53.000000000 +0000
@@ -1 +1,66 @@
+1. Requirements
+===============
+
+We need the following:
+
+1. Latest MRR interface support, including extensions to support ICP when
+ using BKA.
+2. Let DS-MRR support clustered primary keys (needed when using BKA).
+3. Remove conditions used for key access from the condition pushed to index
+ (ATM this manifests itself as "Using index condition" appearing where there
+ was no "Using where". TODO: example of this?)
+4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
+ is switched on/off by @@engine_condition_pushdown)
+5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
+ for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
+ makes it unobvious for a number of users.
+6. Rename multi_range_read_info_const() to look like it is not a part of MRR
+ interface.
+8. Try to make MRR to be more of a module
+7. Improve MRR's cost model.
+
+2. Required actions
+===================
+
+Roughly in the order in which it will be done:
+
+2.1 Fix DS-MRR/InnoDB bugs
+--------------------------
+We need to fix the bugs listed here:
+
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condition_pushdown
+http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
+
+2.2 Backport DS-MRR code to MariaDB 5.2
+---------------------------------------
+The easiest way seems to be to to manually move the needed code from mysql-6.0
+(or whatever it's called now) to MariaDB.
+
+2.3 Introduce control variables
+-------------------------------
+Act on items #4 and #5 from the requirements. Should be easy as
+@@optimizer_switch is supported in 5.1 codebase.
+
+2.4 Other backport issues
+-------------------------
+* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
+ implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
+ but merging it into 5.1 can be very labor-intensive.
+ Will it be ok to disable NDB/MRR altogether?
+
+
+2.5 Make MRR code more of a module
+----------------------------------
+Some code in handler.cc can be moved to separate file.
+But changes in opt_range.cc can't.
+TODO: Sort out how much we really can do here. Initial guess is not much as the
+code consists of:
+- Default MRR implementation in handler.cc
+- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
+ calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
+ so there is not much point in moving them out.
+- DS-MRR implementations which are spread over storage engines.
+and the only modularization we see is to move #1 into a separate file which
+won't achieve much.
+
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
HIGH-LEVEL SPECIFICATION:
1. Requirements
===============
We need the following:
1. Latest MRR interface support, including extensions to support ICP when
using BKA.
2. Let DS-MRR support clustered primary keys (needed when using BKA).
3. Remove conditions used for key access from the condition pushed to index
(ATM this manifests itself as "Using index condition" appearing where there
was no "Using where". TODO: example of this?)
4. Introduce a separate @@optimizer_switch flag for turning on/out ICP (atm it
is switched on/off by @@engine_condition_pushdown)
5. Introduce a separate @@mrr_buffer_size variable to control MRR buffer size
for range+MRR scans. ATM it is controlled by @@read_rnd_size flag and that
makes it unobvious for a number of users.
6. Rename multi_range_read_info_const() to look like it is not a part of MRR
interface.
8. Try to make MRR to be more of a module
7. Improve MRR's cost model.
2. Required actions
===================
Roughly in the order in which it will be done:
2.1 Fix DS-MRR/InnoDB bugs
--------------------------
We need to fix the bugs listed here:
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=index_condi…
http://bugs.mysql.com/search.php?cmd=display&status=Active&tags=mrr
2.2 Backport DS-MRR code to MariaDB 5.2
---------------------------------------
The easiest way seems to be to to manually move the needed code from mysql-6.0
(or whatever it's called now) to MariaDB.
2.3 Introduce control variables
-------------------------------
Act on items #4 and #5 from the requirements. Should be easy as
@@optimizer_switch is supported in 5.1 codebase.
2.4 Other backport issues
-------------------------
* Figure out what to do with NDB/MRR. 5.1 codebase has "old" NDB/MRR
implementation. mysql-6.0 (and NDB's branch) have the updated NDB/MRR
but merging it into 5.1 can be very labor-intensive.
Will it be ok to disable NDB/MRR altogether?
2.5 Make MRR code more of a module
----------------------------------
Some code in handler.cc can be moved to separate file.
But changes in opt_range.cc can't.
TODO: Sort out how much we really can do here. Initial guess is not much as the
code consists of:
- Default MRR implementation in handler.cc
- Changes in opt_range.cc to use MRR instead of multiple records_in_range()
calls. These rely on opt_range.cc's internal structures like SEL_ARG trees and
so there is not much point in moving them out.
- DS-MRR implementations which are spread over storage engines.
and the only modularization we see is to move #1 into a separate file which
won't achieve much.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
26 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: MRR backport
CREATION DATE..: Thu, 26 Nov 2009, 15:19
SUPERVISOR.....: Monty
IMPLEMENTOR....: Psergey
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 67 (http://askmonty.org/worklog/?tid=67)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
DESCRIPTION:
Backport DS-MRR into MariaDB-5.2 codebase, also adding certain extra features to
make it more usable.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
Hi Sergey,
I encountered a memory leak while working on fixing the MySQL 5.1.41 merge.
The memory leak is repeatable with the following test case:
------------------------------ cut here ------------------------------
#
# Bug#45989 memory leak after explain encounters an error in the query
#
CREATE TABLE t1(a LONGTEXT);
INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
--error ER_BAD_FIELD_ERROR
EXPLAIN SELECT DISTINCT 1 FROM t1,
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
WHERE t1.a = d1.a;
DROP TABLE t1;
------------------------------ cut here ------------------------------
perl mysql-test-run.pl --valgrind kn.test
Errors/warnings were found in logfiles during server shutdown after running the
following sequence(s) of tests:
main.kn
==14709== 1,048,584 bytes in 1 blocks are possibly lost in loss record 7 of 7
==14709== at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
==14709== by 0xB1DDD0: my_malloc (my_malloc.c:37)
==14709== by 0x6691C1: String::real_alloc(unsigned) (sql_string.cc:43)
==14709== by 0x5D7BFF: String::alloc(unsigned) (sql_string.h:210)
==14709== by 0x669835: String::copy(String const&) (sql_string.cc:192)
==14709== by 0x7E8BB0: do_save_blob(Copy_field*) (field_conv.cc:296)
==14709== by 0x7E6922: do_copy_null(Copy_field*) (field_conv.cc:207)
==14709== by 0x6EB28B: copy_fields(TMP_TABLE_PARAM*) (sql_select.cc:15374)
==14709== by 0x6F7F1B: end_write_group(JOIN*, st_join_table*, bool) (sql_select.cc:12715)
==14709== by 0x6F4415: evaluate_join_record(JOIN*, st_join_table*, int) (sql_select.cc:11514)
==14709== by 0x6F464E: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:11399)
==14709== by 0x705B1E: do_select(JOIN*, List<Item>*, st_table*, Procedure*) (sql_select.cc:11155)
==14709== by 0x7161C2: JOIN::exec() (sql_select.cc:1809)
==14709== by 0x7127B6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned, List<Item>&, Item*, unsigned, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2425)
==14709== by 0x82EEEB: mysql_derived_filling(THD*, st_lex*, TABLE_LIST*) (sql_derived.cc:294)
==14709== by 0x82EC8B: mysql_handle_derived(st_lex*, bool (*)(THD*, st_lex*, TABLE_LIST*)) (sql_derived.cc:56)
This bug is also in main lp:maria MariaDB trunk, and also in current MySQL
(there is a MySQL bug, http://bugs.mysql.com/bug.php?id=45989)
Could you take a look, and see if it is something you/we could fix, or if you
have any other suggestions for how to deal with this?
- Kristian.
2
1
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2775)
by knielsen@knielsen-hq.org 26 Nov '09
by knielsen@knielsen-hq.org 26 Nov '09
26 Nov '09
#At lp:maria
2775 knielsen(a)knielsen-hq.org 2009-11-26
After-merge fix for MySQL 5.1.41 merge into MariaDB: Fix incorrect merge breaking the build.
modified:
unittest/mysys/Makefile.am
=== modified file 'unittest/mysys/Makefile.am'
--- a/unittest/mysys/Makefile.am 2009-11-16 20:49:51 +0000
+++ b/unittest/mysys/Makefile.am 2009-11-26 08:44:38 +0000
@@ -18,15 +18,13 @@ INCLUDES = @ZLIB_INCLUDES@ -I$(top_buil
noinst_HEADERS = thr_template.c
-noinst_PROGRAMS = bitmap-t base64-t my_atomic-t lf-t waiting_threads-t
-
LDADD = $(top_builddir)/unittest/mytap/libmytap.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/strings/libmystrings.a
EXTRA_DIST = CMakeLists.txt
-noinst_PROGRAMS = bitmap-t base64-t
+noinst_PROGRAMS = bitmap-t base64-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:2774)
by knielsen@knielsen-hq.org 26 Nov '09
by knielsen@knielsen-hq.org 26 Nov '09
26 Nov '09
#At lp:maria
2774 knielsen(a)knielsen-hq.org 2009-11-26
After-merge fixes for merge of MySQL 5.1.41 into MariaDB: more post-shutdown warning fixes.
modified:
mysql-test/mysql-test-run.pl
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-26 07:45:54 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-11-26 08:02:33 +0000
@@ -3992,7 +3992,8 @@ sub extract_warning_lines ($) {
qr/Setting lower_case_table_names=2/,
qr/deprecated/,
qr/Slave SQL thread retried transaction/,
- qw/Slave \(additional info\)/,
+ qr/Slave \(additional info\)/,
+ qr/Incorrect information in file/,
);
my $match_count= 0;
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2773)
by knielsen@knielsen-hq.org 26 Nov '09
by knielsen@knielsen-hq.org 26 Nov '09
26 Nov '09
#At lp:maria
2773 knielsen(a)knielsen-hq.org 2009-11-26
After-merge fix for MySQL 5.1.41 merge into MariaDB: Another warning antipattern also needed during shutdown.
modified:
mysql-test/mysql-test-run.pl
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-25 11:06:01 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-11-26 07:45:54 +0000
@@ -3989,6 +3989,7 @@ sub extract_warning_lines ($) {
qr/unknown option '--loose-/,
qr/unknown variable 'loose-/,
qr/Now setting lower_case_table_names to [02]/,
+ qr/Setting lower_case_table_names=2/,
qr/deprecated/,
qr/Slave SQL thread retried transaction/,
qw/Slave \(additional info\)/,
1
0
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2767: Fixed LPBUG#485443 --with-fast-mutexes and without safe mutexes (debug build) maria do not builds
by noreply@launchpad.net 26 Nov '09
by noreply@launchpad.net 26 Nov '09
26 Nov '09
------------------------------------------------------------
revno: 2767
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Thu 2009-11-26 01:18:23 +0200
message:
Fixed LPBUG#485443 --with-fast-mutexes and without safe mutexes (debug build) maria do not builds
Added 'mariadb_SERVER' as extra config group for MariaDB embedded server
modified:
client/mysql.cc
mysys/thr_mutex.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] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2767)
by Michael Widenius 26 Nov '09
by Michael Widenius 26 Nov '09
26 Nov '09
#At lp:maria based on revid:monty@askmonty.org-20091125073628-7fekfnr2hmkbjos1
2767 Michael Widenius 2009-11-26
Fixed LPBUG#485443 --with-fast-mutexes and without safe mutexes (debug build) maria do not builds
Added 'mariadb_SERVER' as extra config group for MariaDB embedded server
modified:
client/mysql.cc
mysys/thr_mutex.c
per-file messages:
client/mysql.cc
Cleanup
Added 'mariadb_SERVER' as extra config group for MariaDB embedded server
mysys/thr_mutex.c
Fixed LPBUG#485443 --with-fast-mutexes and without safe mutexes (debug build) maria do not builds
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2009-11-06 17:22:32 +0000
+++ b/client/mysql.cc 2009-11-25 23:18:23 +0000
@@ -83,7 +83,7 @@ extern "C" {
#include <term.h>
#endif
#endif
-#endif
+#endif /* defined(HAVE_CURSES_H) && defined(HAVE_TERM_H) */
#undef bcmp // Fix problem with new readline
#if defined(__WIN__)
@@ -92,7 +92,6 @@ extern "C" {
#include <readline/readline.h>
#define HAVE_READLINE
#endif
- //int vidattr(long unsigned int attrs); // Was missing in sun curses
}
#if !defined(HAVE_VIDATTR)
@@ -1024,7 +1023,7 @@ static const char *load_default_groups[]
static int embedded_server_arg_count= 0;
static char *embedded_server_args[MAX_SERVER_ARGS];
static const char *embedded_server_groups[]=
-{ "server", "embedded", "mysql_SERVER", 0 };
+{ "server", "embedded", "mysql_SERVER", "mariadb_SERVER", 0 };
#ifdef HAVE_READLINE
/*
=== modified file 'mysys/thr_mutex.c'
--- a/mysys/thr_mutex.c 2009-06-22 08:06:35 +0000
+++ b/mysys/thr_mutex.c 2009-11-25 23:18:23 +0000
@@ -36,6 +36,7 @@
#undef pthread_mutex_init
#undef pthread_mutex_lock
#undef pthread_mutex_unlock
+#undef pthread_mutex_trylock
#undef pthread_mutex_destroy
#undef pthread_cond_wait
#undef pthread_cond_timedwait
@@ -838,31 +839,9 @@ static void print_deadlock_warning(safe_
DBUG_VOID_RETURN;
}
+#elif defined(MY_PTHREAD_FASTMUTEX)
-#endif /* THREAD && SAFE_MUTEX */
-
-#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
-
-#include "mysys_priv.h"
-#include "my_static.h"
-#include <m_string.h>
-
-#include <m_ctype.h>
-#include <hash.h>
-#include <myisampack.h>
-#include <mysys_err.h>
-#include <my_sys.h>
-
-#undef pthread_mutex_t
-#undef pthread_mutex_init
-#undef pthread_mutex_lock
-#undef pthread_mutex_trylock
-#undef pthread_mutex_unlock
-#undef pthread_mutex_destroy
-#undef pthread_cond_wait
-#undef pthread_cond_timedwait
-
-ulong mutex_delay(ulong delayloops)
+static ulong mutex_delay(ulong delayloops)
{
ulong i;
volatile ulong j;
@@ -943,6 +922,6 @@ void fastmutex_global_init(void)
cpu_count= sysconf(_SC_NPROCESSORS_CONF);
#endif
}
-
-#endif /* SAFE_MUTEX_DEFINED */
+
+#endif /* defined(MY_PTHREAD_FASTMUTEX) */
#endif /* THREAD */
1
0
[Maria-developers] New (by Sanja): Subquery optimization: Avoid recalculating subquery if external fields values found in subquery cache (66)
by worklog-noreply@askmonty.org 25 Nov '09
by worklog-noreply@askmonty.org 25 Nov '09
25 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Avoid recalculating subquery if external fields
values found in subquery cache
CREATION DATE..: Wed, 25 Nov 2009, 22:25
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 66 (http://askmonty.org/worklog/?tid=66)
VERSION........: Server-5.2
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
DESCRIPTION:
Collect all outer items/references (left part of the subquiery and outer
references inside the subquery) in key string. Compare the string (which
represents certain value set of the references) against values in hash table and
return cached result of subquery if the reference values combination has already
been used.
For example in the following subquery:
(L1, L2) IN (SELECT A, B FROM T WHERE T.F1>OTER_FIELD)
set of references to look into the subquery cache is (L1, L2, OTER_FIELD).
The subquery cache should be implemented as simple LRU connected to the subquery.
Size of the subquery cache (in number of results (but maybe in used memory
amount)) is limited by session variable (query parameter?).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] New (by Sanja): Subquery optimization: Avoid recalculating subquery if external fields values found in subquery cache (66)
by worklog-noreply@askmonty.org 25 Nov '09
by worklog-noreply@askmonty.org 25 Nov '09
25 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Subquery optimization: Avoid recalculating subquery if external fields
values found in subquery cache
CREATION DATE..: Wed, 25 Nov 2009, 22:25
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 66 (http://askmonty.org/worklog/?tid=66)
VERSION........: Server-5.2
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
DESCRIPTION:
Collect all outer items/references (left part of the subquiery and outer
references inside the subquery) in key string. Compare the string (which
represents certain value set of the references) against values in hash table and
return cached result of subquery if the reference values combination has already
been used.
For example in the following subquery:
(L1, L2) IN (SELECT A, B FROM T WHERE T.F1>OTER_FIELD)
set of references to look into the subquery cache is (L1, L2, OTER_FIELD).
The subquery cache should be implemented as simple LRU connected to the subquery.
Size of the subquery cache (in number of results (but maybe in used memory
amount)) is limited by session variable (query parameter?).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
Having to start with WL47 which already contains the 'First suggestion',
I'd like to discuss:
Second suggestion
~~~~~~~~~~~~~~~~~
Add query text to the RBR events data part (together with adding query_len
field to their header).
Reason (compared with the First suggestion):
- this makes binary log bit smaller (no need to store headers of new events).
- almost all changes needed in this case are localized in the RBR-event
classes (e.g. replication, being, roughly speaking, based on calling the
apply_event() and other Log_event methods, shouldn't care about whether
there is a query_text in the event or not).
We can recognize whether an RBR-event in a binary log contain query text
or not by looking at it header length in the Format description event
(the post_header member): containing the additional query_len field,
the header of the 'extended' event have a diferent size.
Because we are able to recognize RBR-events format _only_ by the Format
description event (at the beginning of the binary log), we can not allow
to mix in one binary log both 'standard' and 'extended' formats (which is
possible within the First suggestion). If possibility of such a mix is
important then we should prefer the First suggestion.
Any remarks ?
Which way to go ?
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2772)
by knielsen@knielsen-hq.org 25 Nov '09
by knielsen@knielsen-hq.org 25 Nov '09
25 Nov '09
#At lp:maria
2772 knielsen(a)knielsen-hq.org 2009-11-25
After-merge fixes following Merge of Mysql 5.1.41 into MariaDB: Fix path for SSL stuff when running testsuite from installed package.
modified:
mysql-test/lib/My/ConfigFactory.pm
=== modified file 'mysql-test/lib/My/ConfigFactory.pm'
--- a/mysql-test/lib/My/ConfigFactory.pm 2009-11-16 20:49:51 +0000
+++ b/mysql-test/lib/My/ConfigFactory.pm 2009-11-25 13:00:28 +0000
@@ -142,8 +142,7 @@ sub fix_secure_file_priv {
sub fix_std_data {
my ($self, $config, $group_name, $group)= @_;
- my $basedir= $self->get_basedir($group);
- return "$basedir/mysql-test/std_data";
+ return "$::opt_vardir/std_data";
}
sub ssl_supported {
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2771)
by knielsen@knielsen-hq.org 25 Nov '09
by knielsen@knielsen-hq.org 25 Nov '09
25 Nov '09
#At lp:maria
2771 knielsen(a)knielsen-hq.org 2009-11-25
After-merge fix for merge of MySQL 5.1.41 into MariaDB: Valgrind fixes.
modified:
mysql-test/mysql-test-run.pl
sql/log_event.cc
per-file messages:
mysql-test/mysql-test-run.pl
Fix Valgrind warnings: add more post-shutdown warning suppressions, and revert
bad previous change.
sql/log_event.cc
Manually apply fix for Bug#48340 (basically missing initialisation
of thd->lex->local_file in Load_log_event::do_apply_event())
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-24 09:34:42 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-11-25 11:06:01 +0000
@@ -223,7 +223,7 @@ my $opt_strace_client;
our $opt_user = "root";
my $opt_valgrind= 0;
-my $opt_valgrind_mysqld= 0;
+our $opt_valgrind_mysqld= 0;
my $opt_valgrind_mysqltest= 0;
my @default_valgrind_args= ("--show-reachable=yes");
my @valgrind_args;
@@ -3990,6 +3990,8 @@ sub extract_warning_lines ($) {
qr/unknown variable 'loose-/,
qr/Now setting lower_case_table_names to [02]/,
qr/deprecated/,
+ qr/Slave SQL thread retried transaction/,
+ qw/Slave \(additional info\)/,
);
my $match_count= 0;
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2009-11-16 20:49:51 +0000
+++ b/sql/log_event.cc 2009-11-25 11:06:01 +0000
@@ -4509,6 +4509,7 @@ int Load_log_event::do_apply_event(NET*
as the present method does not call mysql_parse().
*/
lex_start(thd);
+ thd->lex->local_file= local_fname;
mysql_reset_thd_for_next_command(thd);
if (!use_rli_only_for_errors)
1
0
[Maria-developers] Updated (by Guest): Add a mysqlbinlog option to filter updates to certain tables (40)
by worklog-noreply@askmonty.org 25 Nov '09
by worklog-noreply@askmonty.org 25 Nov '09
25 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to filter updates to certain tables
CREATION DATE..: Mon, 10 Aug 2009, 13:25
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Psergey
CATEGORY.......: Server-Sprint
TASK ID........: 40 (http://askmonty.org/worklog/?tid=40)
VERSION........: Server-9.x
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 32
ESTIMATE.......: 32 (hours remain)
ORIG. ESTIMATE.: 48
PROGRESS NOTES:
-=-=(Guest - Wed, 25 Nov 2009, 11:41)=-=-
Status updated.
--- /tmp/wklog.40.old.5760 2009-11-25 11:41:09.000000000 +0200
+++ /tmp/wklog.40.new.5760 2009-11-25 11:41:09.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(Guest - Wed, 25 Nov 2009, 11:41)=-=-
Category updated.
--- /tmp/wklog.40.old.5737 2009-11-25 11:41:03.000000000 +0200
+++ /tmp/wklog.40.new.5737 2009-11-25 11:41:03.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Bothorsen - Tue, 17 Nov 2009, 17:20)=-=-
Alex is closer to a working patch now.
Worked 14 hours and estimate 32 hours remain (original estimate unchanged).
-=-=(Bothorsen - Thu, 12 Nov 2009, 13:13)=-=-
Work hours by Alexi and Bo + estimated time for the task.
Worked 16 hours and estimate 46 hours remain (original estimate increased by 14 hours).
-=-=(Alexi - Sun, 08 Nov 2009, 15:18)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.15787 2009-11-08 15:18:11.000000000 +0200
+++ /tmp/wklog.40.new.15787 2009-11-08 15:18:11.000000000 +0200
@@ -62,7 +62,7 @@
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
-3. db_len = 0 means that this is the current db.
+3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
@@ -75,6 +75,77 @@
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+***********************************************************************
+HELP NEEDED
+***********************************************************************
+The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
+
+log_event.h
+~~~~~~~~~~~
+#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
+ LOG_EVENT_HEADER_LEN + /* write_header */ \
+ QUERY_HEADER_LEN + /* write_data */ \
+ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
+ MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
+ NAME_LEN + 1)
+
+which is used only for setting
+
+ thd->variables.max_allowed_packet
+ mysql->net.max_packet_size
+
+Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
+(without making any other changes) be substituted in this definition by
+QUERY_HEADER_LEN_EXT.
+
+Below I list all places where MAX_LOG_EVENT_HEADER is used:
+
+slave.cc
+~~~~~~~~
+static int init_slave_thread(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
+ slave threads, since a replication event can become this much larger
+ than the corresponding packet (query) sent from client to master.
+ */
+ thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
+ ...
+}
+pthread_handler_t handle_slave_io(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
+ thread, since a replication event can become this much larger than
+ the corresponding packet (query) sent from client to master.
+ */
+ mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
+sql_repl.cc
+~~~~~~~~~~~
+void mysql_binlog_send(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
+ this larger than the corresponding packet (query) sent
+ from client to master.
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+bool mysql_show_binlog_events(...)
+{ ...
+ /*
+ to account binlog event header size
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
3. Changes in log events
************************
@@ -84,7 +155,7 @@
This setting is done in Format description event constructor which creates
the event for writing to binary log:
- if (binlog_with_tables_info)
+ if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
@@ -99,12 +170,12 @@
following manner:
switch (binlog_ver) {
- case 4: /* MySQL 5.0 and higher */
+ #ifndef MYSQL_CLIENT
+ case 4: /* MySQL 5.0 and higher */
...
-+ #else
-+ <error>
+ break;
+ #endif
+
case 1:
case 3:
...
@@ -132,7 +203,7 @@
--------------------------------
[Creates the event for binlogging]
-In case of binlog_with_tables_info = TRUE, set additionally query_len,
+In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
@@ -140,7 +211,7 @@
----------------
[Writes the event to binlog]
-In case of binlog_with_tables_info = TRUE, write additional members
+In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
-=-=(Alexi - Sun, 08 Nov 2009, 10:40)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.5055 2009-11-08 08:40:02.000000000 +0000
+++ /tmp/wklog.40.new.5055 2009-11-08 08:40:02.000000000 +0000
@@ -3,6 +3,7 @@
1. Adding --binlog-with-tables-info option
******************************************
+GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
-=-=(Alexi - Thu, 05 Nov 2009, 12:37)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.11441 2009-11-05 12:37:16.000000000 +0200
+++ /tmp/wklog.40.new.11441 2009-11-05 12:37:16.000000000 +0200
@@ -1,9 +1,18 @@
OPTION: 2.5 Extend Query Events With Tables Info
================================================
-1. Query_log_event Binary Format
-********************************
-Changes to be done:
+1. Adding --binlog-with-tables-info option
+******************************************
+
+When set, Query events are to be written in the extended binary
+format which contains tables_info. When not set, Query events
+are to be written in usual format (without any changes).
+
+2. Query event extended binary format
+*************************************
+
+When --binlog-with-tables-info is set, Query events are writen
+to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
@@ -24,12 +33,12 @@
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
-+ tables_info_len 2 (see Note 2)
++ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
-+ db db_len (see Note 3)
++ db db_len (see Note 2)
query query_len
+ tables_info
@@ -37,7 +46,7 @@
---------------------------------
Name Size (bytes)
---------------------------------
- db_len 1 (see Note 4)
+ db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
@@ -48,19 +57,99 @@
table_name table_name_len
NOTES
-1. Currently Query_log_event format doesn't include 'query_len' because
+1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
-2. If tables_info is not included in the event (--binlog-with-tables-info
- option), tables_info_len = 0.
-3. The trailing zero is redundant since the length is already known.
-4. In case of db = current db, db_len = 0 and db = empty, because
- current db is already included in the current event format.
+2. For 'db' (current db) the trailing zero is redundant since the length
+ is already known.
+3. db_len = 0 means that this is the current db.
+
+When reading Query events from binary log, we can recognize its format
+by its post-header length: in extended case the post-header includes 4
+additional bytes.
+
+ #define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
++ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
+ ...
+ #define Q_STATUS_VARS_LEN_OFFSET 11
++ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
++ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+3. Changes in log events
+************************
+
+3.1. Format description event
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Changes needed here concern setting post-header length for Query events.
+This setting is done in Format description event constructor which creates
+the event for writing to binary log:
+
+ if (binlog_with_tables_info)
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
+ else
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
+
+This change is to be done only for case binlog_ver = 4.
+
+NOTE. The refered above constructor is allowed to be invoked in a client
+context for creating "artificial" Format description events in case of
+MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
+(because of 'binlog_with_tables_info') and taking into account the
+"MySQL < 5.0" restriction, we have to #ifdef out the above code in
+following manner:
+
+ switch (binlog_ver) {
+ case 4: /* MySQL 5.0 and higher */
++ #ifndef MYSQL_CLIENT
+ ...
++ #else
++ <error>
++ #endif
+ case 1:
+ case 3:
+ ...
+ }
+
+3.2. Query event
+~~~~~~~~~~~~~~~~
+Changes needed here include adding tables_info and tables_info_len
+members (member for query length already exists) and modifying the
+following function-members:
+
+Query_log_event(buf) constructor
+--------------------------------
+[Parses binary format written to the 'buf']
+
+Getting post-header length from the Format description event (passed
+to the constructor as an argument), define whether buf contains an
+extended or usual Query event and parse the buf contents accordingly.
+
+NOTE. Defining Query event format here should be done with taking into
+account that this constructor can be called within a Query-derived
+event with the event_type argument != QUERY_EVENT.
+
+Query_log_event(thd) constructor
+--------------------------------
+[Creates the event for binlogging]
+
+In case of binlog_with_tables_info = TRUE, set additionally query_len,
+tables_info_len, and tables_info members (the constructor is to have
+an additional 'tables_info' argument).
+
+write() function
+----------------
+[Writes the event to binlog]
+
+In case of binlog_with_tables_info = TRUE, write additional members
+(query_len, tables_info_len, and tables_info) to binary log. Also
+write corresponding whole event length to the common-header.
+
+<To be continued>
-2. Where to get tables info from?
+4. Where to get tables info from?
*********************************
-2.1. Case study: CREATE TABLE
-******************************
+4.1. Case study: CREATE TABLE
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
@@ -129,4 +218,4 @@
}
}
-To be continued
+<To be continued>
-=-=(Alexi - Wed, 04 Nov 2009, 10:21)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.6734 2009-11-04 10:21:20.000000000 +0200
+++ /tmp/wklog.40.new.6734 2009-11-04 10:21:20.000000000 +0200
@@ -21,9 +21,9 @@
slave_proxy_id 4
exec_time 4
db_len 1
-+ query_len 2 (see Note 1)
error_code 2
status_vars_len 2
++ query_len 2 (see Note 1)
+ tables_info_len 2 (see Note 2)
---------------------------------
BODY:
-=-=(Alexi - Tue, 03 Nov 2009, 11:19)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.7187 2009-11-03 11:19:22.000000000 +0200
+++ /tmp/wklog.40.new.7187 2009-11-03 11:19:22.000000000 +0200
@@ -1 +1,132 @@
+OPTION: 2.5 Extend Query Events With Tables Info
+================================================
+1. Query_log_event Binary Format
+********************************
+Changes to be done:
+
+ Query_log_event binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ COMMON HEADER:
+ timestamp 4
+ type 1
+ server_id 4
+ total_size 4
+ master_position 4
+ flags 2
+ ---------------------------------
+ POST HEADER:
+ slave_proxy_id 4
+ exec_time 4
+ db_len 1
++ query_len 2 (see Note 1)
+ error_code 2
+ status_vars_len 2
++ tables_info_len 2 (see Note 2)
+ ---------------------------------
+ BODY:
+ status_vars status_vars_len
+- db db_len + 1
++ db db_len (see Note 3)
+ query query_len
++ tables_info
+
+ tables_info binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ db_len 1 (see Note 4)
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+ ...
+ db_len 1
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+
+NOTES
+1. Currently Query_log_event format doesn't include 'query_len' because
+ it considers the query to extent to the end of the event.
+2. If tables_info is not included in the event (--binlog-with-tables-info
+ option), tables_info_len = 0.
+3. The trailing zero is redundant since the length is already known.
+4. In case of db = current db, db_len = 0 and db = empty, because
+ current db is already included in the current event format.
+
+2. Where to get tables info from?
+*********************************
+
+2.1. Case study: CREATE TABLE
+******************************
+
+*** CREATE TABLE table [SELECT ...]
+
+ bool mysql_create_table_no_lock(
+ THD *thd,
+ const char *db,
+ const char *table_name, ...)
+ {
+ ...
+ // -------------------------------------
+ // WL40: To be included in tables_info:
+ // * db, table_name
+ // * thd->lex->query_tables (tables refered to in
+ // the select-part; empty if no select-part)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+
+*** CREATE TABLE table LIKE src-table
+
+ bool mysql_create_like_table(
+ ...
+ TABLE_LIST *table,
+ TABLE_LIST *src_table,
+ ...)
+ {
+ ...
+ if (thd->current_stmt_binlog_row_based)
+ { // RBR: In this case we don't replicate temp tables
+ if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ if (src_table->table->s->tmp_table)
+ { // CREATE normal-table LIKE temp-table:
+
+ // Generate new query without LIKE-part
+ store_create_info(thd, table, &query, create_info, FALSE);
+
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table (src_table is not included)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, query.ptr(), query.length());
+ }
+ else
+ { // CREATE normal-table LIKE normal-table
+
+ // -------------------------------------
+ // WL40: To include to log_tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+ // CREATE temp-table LIKE ...
+ // This case is not replicated
+ }
+ else
+ { // SBR:
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+
+To be continued
-=-=(Alexi - Mon, 02 Nov 2009, 11:34)=-=-
Worked 2 hours on option 2.5
Worked 2 hours and estimate 48 hours remain (original estimate increased by 50 hours).
------------------------------------------------------------
-=-=(View All Progress Notes, 16 total)=-=-
http://askmonty.org/worklog/index.pl?tid=40&nolimit=1
DESCRIPTION:
Replication slave can be set to filter updates to certain tables with
--replicate-[wild-]{do,ignore}-table options.
This task is about adding similar functionality to mysqlbinlog.
HIGH-LEVEL SPECIFICATION:
1. Context
----------
(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
overview)
At the moment, the server has these replication slave options:
--replicate-do-table=db.tbl
--replicate-ignore-table=db.tbl
--replicate-wild-do-table=pattern.pattern
--replicate-wild-ignore-table=pattern.pattern
They affect both RBR and SBR events. SBR events are checked after the
statement has been parsed, the server iterates over list of used tables and
checks them againist --replicate instructions.
What is interesting is that this scheme still allows to update the ignored
table through a VIEW.
2. Table filtering in mysqlbinlog
---------------------------------
Per-table filtering of RBR events is easy (as it is relatively easy to extract
the name of the table that the event applies to).
Per-table filtering of SBR events is hard, as generally it is not apparent
which tables the statement refers to.
This opens possible options:
2.1 Put the parser into mysqlbinlog
-----------------------------------
Once we have a full parser in mysqlbinlog, we'll be able to check which tables
are used by a statement, and will allow to show behaviour identical to those
that one obtains when using --replicate-* slave options.
(It is not clear how much effort is needed to put the parser into mysqlbinlog.
Any guesses?)
2.2 Use dumb regexp match
-------------------------
Use a really dumb approach. A query is considered to be modifying table X if
it matches an expression
CREATE TABLE $tablename
DROP $tablename
UPDATE ...$tablename ... SET // here '...' can't contain the word 'SET'
DELETE ...$tablename ... WHERE // same as above
ALTER TABLE $tablename
.. etc (go get from the grammar) ..
The advantage over doing the same in awk is that mysqlbinlog will also process
RBR statements, and together with that will provide a working solution for
those who are careful with their table names not mixing with string constants
and such.
(TODO: string constants are of particular concern as they come from
[potentially hostile] users, unlike e.g. table aliases which come from
[not hostile] developers. Remove also all string constants before attempting
to do match?)
2.3 Have the master put annotations
-----------------------------------
We could add a master option so that it injects into query a mark that tells
which tables the query will affect, e.g. for the query
UPDATE t1 LEFT JOIN db3.t2 ON ... WHERE ...
the binlog will have
/* !mysqlbinlog: updates t1,db3.t2 */ UPDATE t1 LEFT JOIN ...
and further processing in mysqlbinlog will be trivial.
2.4 Implement server functionality to ignore certain tables
-----------------------------------------------------------
We could add a general facility in the server to ignore certain tables:
SET SESSION ignored_tables = "db1.t1,db2.t2";
This would work similar to --replicate-ignore-table, but in a general way not
restricted to the slave SQL thread.
It would then be trivial for mysqlbinlog to add such statements at the start
of the output, or probably the user could just do it manually with no need for
additional options for mysqlbinlog.
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
2.5 Extend Query Events With Tables Info
----------------------------------------
We could extend query events structure with a tables info - a list of tables
which the query refers to:
<current query event structure>
tables_info_len
dbase_len dbase
table_len table
...
dbase_len dbase
table_len table
Note. In case of <dbase> = current data base, we can set dbase_len = 0
and dbase = empty because current query event structure already
includes current data base name.
Note. Possibly it is reasonable also to add a --binlog-with-tables-info
option which defines whether tables info must be included to the
query events.
LOW-LEVEL DESIGN:
OPTION: 2.5 Extend Query Events With Tables Info
================================================
1. Adding --binlog-with-tables-info option
******************************************
GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
are to be written in usual format (without any changes).
2. Query event extended binary format
*************************************
When --binlog-with-tables-info is set, Query events are writen
to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
Name Size (bytes)
---------------------------------
COMMON HEADER:
timestamp 4
type 1
server_id 4
total_size 4
master_position 4
flags 2
---------------------------------
POST HEADER:
slave_proxy_id 4
exec_time 4
db_len 1
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
+ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
+ db db_len (see Note 2)
query query_len
+ tables_info
tables_info binary format
---------------------------------
Name Size (bytes)
---------------------------------
db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
...
db_len 1
db db_len
table_name_len 1
table_name table_name_len
NOTES
1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
additional bytes.
#define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
+ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
...
#define Q_STATUS_VARS_LEN_OFFSET 11
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
***********************************************************************
HELP NEEDED
***********************************************************************
The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
log_event.h
~~~~~~~~~~~
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
LOG_EVENT_HEADER_LEN + /* write_header */ \
QUERY_HEADER_LEN + /* write_data */ \
EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
NAME_LEN + 1)
which is used only for setting
thd->variables.max_allowed_packet
mysql->net.max_packet_size
Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
(without making any other changes) be substituted in this definition by
QUERY_HEADER_LEN_EXT.
Below I list all places where MAX_LOG_EVENT_HEADER is used:
slave.cc
~~~~~~~~
static int init_slave_thread(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
slave threads, since a replication event can become this much larger
than the corresponding packet (query) sent from client to master.
*/
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
...
}
pthread_handler_t handle_slave_io(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
thread, since a replication event can become this much larger than
the corresponding packet (query) sent from client to master.
*/
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
...
}
sql_repl.cc
~~~~~~~~~~~
void mysql_binlog_send(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
this larger than the corresponding packet (query) sent
from client to master.
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
bool mysql_show_binlog_events(...)
{ ...
/*
to account binlog event header size
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
3. Changes in log events
************************
3.1. Format description event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Changes needed here concern setting post-header length for Query events.
This setting is done in Format description event constructor which creates
the event for writing to binary log:
if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
This change is to be done only for case binlog_ver = 4.
NOTE. The refered above constructor is allowed to be invoked in a client
context for creating "artificial" Format description events in case of
MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
(because of 'binlog_with_tables_info') and taking into account the
"MySQL < 5.0" restriction, we have to #ifdef out the above code in
following manner:
switch (binlog_ver) {
+ #ifndef MYSQL_CLIENT
case 4: /* MySQL 5.0 and higher */
...
break;
+ #endif
case 1:
case 3:
...
}
3.2. Query event
~~~~~~~~~~~~~~~~
Changes needed here include adding tables_info and tables_info_len
members (member for query length already exists) and modifying the
following function-members:
Query_log_event(buf) constructor
--------------------------------
[Parses binary format written to the 'buf']
Getting post-header length from the Format description event (passed
to the constructor as an argument), define whether buf contains an
extended or usual Query event and parse the buf contents accordingly.
NOTE. Defining Query event format here should be done with taking into
account that this constructor can be called within a Query-derived
event with the event_type argument != QUERY_EVENT.
Query_log_event(thd) constructor
--------------------------------
[Creates the event for binlogging]
In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
write() function
----------------
[Writes the event to binlog]
In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
<To be continued>
4. Where to get tables info from?
*********************************
4.1. Case study: CREATE TABLE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
bool mysql_create_table_no_lock(
THD *thd,
const char *db,
const char *table_name, ...)
{
...
// -------------------------------------
// WL40: To be included in tables_info:
// * db, table_name
// * thd->lex->query_tables (tables refered to in
// the select-part; empty if no select-part)
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
*** CREATE TABLE table LIKE src-table
bool mysql_create_like_table(
...
TABLE_LIST *table,
TABLE_LIST *src_table,
...)
{
...
if (thd->current_stmt_binlog_row_based)
{ // RBR: In this case we don't replicate temp tables
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (src_table->table->s->tmp_table)
{ // CREATE normal-table LIKE temp-table:
// Generate new query without LIKE-part
store_create_info(thd, table, &query, create_info, FALSE);
// -------------------------------------
// WL40: To include to tables_info:
// * table (src_table is not included)
// -------------------------------------
write_bin_log(thd, TRUE, query.ptr(), query.length());
}
else
{ // CREATE normal-table LIKE normal-table
// -------------------------------------
// WL40: To include to log_tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
// CREATE temp-table LIKE ...
// This case is not replicated
}
else
{ // SBR:
// -------------------------------------
// WL40: To include to tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
<To be continued>
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Guest): Add a mysqlbinlog option to filter updates to certain tables (40)
by worklog-noreply@askmonty.org 25 Nov '09
by worklog-noreply@askmonty.org 25 Nov '09
25 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to filter updates to certain tables
CREATION DATE..: Mon, 10 Aug 2009, 13:25
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Psergey
CATEGORY.......: Server-Sprint
TASK ID........: 40 (http://askmonty.org/worklog/?tid=40)
VERSION........: Server-9.x
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 32
ESTIMATE.......: 32 (hours remain)
ORIG. ESTIMATE.: 48
PROGRESS NOTES:
-=-=(Guest - Wed, 25 Nov 2009, 11:41)=-=-
Status updated.
--- /tmp/wklog.40.old.5760 2009-11-25 11:41:09.000000000 +0200
+++ /tmp/wklog.40.new.5760 2009-11-25 11:41:09.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Assigned
-=-=(Guest - Wed, 25 Nov 2009, 11:41)=-=-
Category updated.
--- /tmp/wklog.40.old.5737 2009-11-25 11:41:03.000000000 +0200
+++ /tmp/wklog.40.new.5737 2009-11-25 11:41:03.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Bothorsen - Tue, 17 Nov 2009, 17:20)=-=-
Alex is closer to a working patch now.
Worked 14 hours and estimate 32 hours remain (original estimate unchanged).
-=-=(Bothorsen - Thu, 12 Nov 2009, 13:13)=-=-
Work hours by Alexi and Bo + estimated time for the task.
Worked 16 hours and estimate 46 hours remain (original estimate increased by 14 hours).
-=-=(Alexi - Sun, 08 Nov 2009, 15:18)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.15787 2009-11-08 15:18:11.000000000 +0200
+++ /tmp/wklog.40.new.15787 2009-11-08 15:18:11.000000000 +0200
@@ -62,7 +62,7 @@
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
-3. db_len = 0 means that this is the current db.
+3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
@@ -75,6 +75,77 @@
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+***********************************************************************
+HELP NEEDED
+***********************************************************************
+The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
+
+log_event.h
+~~~~~~~~~~~
+#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
+ LOG_EVENT_HEADER_LEN + /* write_header */ \
+ QUERY_HEADER_LEN + /* write_data */ \
+ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
+ MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
+ NAME_LEN + 1)
+
+which is used only for setting
+
+ thd->variables.max_allowed_packet
+ mysql->net.max_packet_size
+
+Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
+(without making any other changes) be substituted in this definition by
+QUERY_HEADER_LEN_EXT.
+
+Below I list all places where MAX_LOG_EVENT_HEADER is used:
+
+slave.cc
+~~~~~~~~
+static int init_slave_thread(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
+ slave threads, since a replication event can become this much larger
+ than the corresponding packet (query) sent from client to master.
+ */
+ thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
+ ...
+}
+pthread_handler_t handle_slave_io(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
+ thread, since a replication event can become this much larger than
+ the corresponding packet (query) sent from client to master.
+ */
+ mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
+sql_repl.cc
+~~~~~~~~~~~
+void mysql_binlog_send(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
+ this larger than the corresponding packet (query) sent
+ from client to master.
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+bool mysql_show_binlog_events(...)
+{ ...
+ /*
+ to account binlog event header size
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
3. Changes in log events
************************
@@ -84,7 +155,7 @@
This setting is done in Format description event constructor which creates
the event for writing to binary log:
- if (binlog_with_tables_info)
+ if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
@@ -99,12 +170,12 @@
following manner:
switch (binlog_ver) {
- case 4: /* MySQL 5.0 and higher */
+ #ifndef MYSQL_CLIENT
+ case 4: /* MySQL 5.0 and higher */
...
-+ #else
-+ <error>
+ break;
+ #endif
+
case 1:
case 3:
...
@@ -132,7 +203,7 @@
--------------------------------
[Creates the event for binlogging]
-In case of binlog_with_tables_info = TRUE, set additionally query_len,
+In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
@@ -140,7 +211,7 @@
----------------
[Writes the event to binlog]
-In case of binlog_with_tables_info = TRUE, write additional members
+In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
-=-=(Alexi - Sun, 08 Nov 2009, 10:40)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.5055 2009-11-08 08:40:02.000000000 +0000
+++ /tmp/wklog.40.new.5055 2009-11-08 08:40:02.000000000 +0000
@@ -3,6 +3,7 @@
1. Adding --binlog-with-tables-info option
******************************************
+GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
-=-=(Alexi - Thu, 05 Nov 2009, 12:37)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.11441 2009-11-05 12:37:16.000000000 +0200
+++ /tmp/wklog.40.new.11441 2009-11-05 12:37:16.000000000 +0200
@@ -1,9 +1,18 @@
OPTION: 2.5 Extend Query Events With Tables Info
================================================
-1. Query_log_event Binary Format
-********************************
-Changes to be done:
+1. Adding --binlog-with-tables-info option
+******************************************
+
+When set, Query events are to be written in the extended binary
+format which contains tables_info. When not set, Query events
+are to be written in usual format (without any changes).
+
+2. Query event extended binary format
+*************************************
+
+When --binlog-with-tables-info is set, Query events are writen
+to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
@@ -24,12 +33,12 @@
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
-+ tables_info_len 2 (see Note 2)
++ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
-+ db db_len (see Note 3)
++ db db_len (see Note 2)
query query_len
+ tables_info
@@ -37,7 +46,7 @@
---------------------------------
Name Size (bytes)
---------------------------------
- db_len 1 (see Note 4)
+ db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
@@ -48,19 +57,99 @@
table_name table_name_len
NOTES
-1. Currently Query_log_event format doesn't include 'query_len' because
+1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
-2. If tables_info is not included in the event (--binlog-with-tables-info
- option), tables_info_len = 0.
-3. The trailing zero is redundant since the length is already known.
-4. In case of db = current db, db_len = 0 and db = empty, because
- current db is already included in the current event format.
+2. For 'db' (current db) the trailing zero is redundant since the length
+ is already known.
+3. db_len = 0 means that this is the current db.
+
+When reading Query events from binary log, we can recognize its format
+by its post-header length: in extended case the post-header includes 4
+additional bytes.
+
+ #define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
++ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
+ ...
+ #define Q_STATUS_VARS_LEN_OFFSET 11
++ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
++ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+3. Changes in log events
+************************
+
+3.1. Format description event
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Changes needed here concern setting post-header length for Query events.
+This setting is done in Format description event constructor which creates
+the event for writing to binary log:
+
+ if (binlog_with_tables_info)
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
+ else
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
+
+This change is to be done only for case binlog_ver = 4.
+
+NOTE. The refered above constructor is allowed to be invoked in a client
+context for creating "artificial" Format description events in case of
+MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
+(because of 'binlog_with_tables_info') and taking into account the
+"MySQL < 5.0" restriction, we have to #ifdef out the above code in
+following manner:
+
+ switch (binlog_ver) {
+ case 4: /* MySQL 5.0 and higher */
++ #ifndef MYSQL_CLIENT
+ ...
++ #else
++ <error>
++ #endif
+ case 1:
+ case 3:
+ ...
+ }
+
+3.2. Query event
+~~~~~~~~~~~~~~~~
+Changes needed here include adding tables_info and tables_info_len
+members (member for query length already exists) and modifying the
+following function-members:
+
+Query_log_event(buf) constructor
+--------------------------------
+[Parses binary format written to the 'buf']
+
+Getting post-header length from the Format description event (passed
+to the constructor as an argument), define whether buf contains an
+extended or usual Query event and parse the buf contents accordingly.
+
+NOTE. Defining Query event format here should be done with taking into
+account that this constructor can be called within a Query-derived
+event with the event_type argument != QUERY_EVENT.
+
+Query_log_event(thd) constructor
+--------------------------------
+[Creates the event for binlogging]
+
+In case of binlog_with_tables_info = TRUE, set additionally query_len,
+tables_info_len, and tables_info members (the constructor is to have
+an additional 'tables_info' argument).
+
+write() function
+----------------
+[Writes the event to binlog]
+
+In case of binlog_with_tables_info = TRUE, write additional members
+(query_len, tables_info_len, and tables_info) to binary log. Also
+write corresponding whole event length to the common-header.
+
+<To be continued>
-2. Where to get tables info from?
+4. Where to get tables info from?
*********************************
-2.1. Case study: CREATE TABLE
-******************************
+4.1. Case study: CREATE TABLE
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
@@ -129,4 +218,4 @@
}
}
-To be continued
+<To be continued>
-=-=(Alexi - Wed, 04 Nov 2009, 10:21)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.6734 2009-11-04 10:21:20.000000000 +0200
+++ /tmp/wklog.40.new.6734 2009-11-04 10:21:20.000000000 +0200
@@ -21,9 +21,9 @@
slave_proxy_id 4
exec_time 4
db_len 1
-+ query_len 2 (see Note 1)
error_code 2
status_vars_len 2
++ query_len 2 (see Note 1)
+ tables_info_len 2 (see Note 2)
---------------------------------
BODY:
-=-=(Alexi - Tue, 03 Nov 2009, 11:19)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.7187 2009-11-03 11:19:22.000000000 +0200
+++ /tmp/wklog.40.new.7187 2009-11-03 11:19:22.000000000 +0200
@@ -1 +1,132 @@
+OPTION: 2.5 Extend Query Events With Tables Info
+================================================
+1. Query_log_event Binary Format
+********************************
+Changes to be done:
+
+ Query_log_event binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ COMMON HEADER:
+ timestamp 4
+ type 1
+ server_id 4
+ total_size 4
+ master_position 4
+ flags 2
+ ---------------------------------
+ POST HEADER:
+ slave_proxy_id 4
+ exec_time 4
+ db_len 1
++ query_len 2 (see Note 1)
+ error_code 2
+ status_vars_len 2
++ tables_info_len 2 (see Note 2)
+ ---------------------------------
+ BODY:
+ status_vars status_vars_len
+- db db_len + 1
++ db db_len (see Note 3)
+ query query_len
++ tables_info
+
+ tables_info binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ db_len 1 (see Note 4)
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+ ...
+ db_len 1
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+
+NOTES
+1. Currently Query_log_event format doesn't include 'query_len' because
+ it considers the query to extent to the end of the event.
+2. If tables_info is not included in the event (--binlog-with-tables-info
+ option), tables_info_len = 0.
+3. The trailing zero is redundant since the length is already known.
+4. In case of db = current db, db_len = 0 and db = empty, because
+ current db is already included in the current event format.
+
+2. Where to get tables info from?
+*********************************
+
+2.1. Case study: CREATE TABLE
+******************************
+
+*** CREATE TABLE table [SELECT ...]
+
+ bool mysql_create_table_no_lock(
+ THD *thd,
+ const char *db,
+ const char *table_name, ...)
+ {
+ ...
+ // -------------------------------------
+ // WL40: To be included in tables_info:
+ // * db, table_name
+ // * thd->lex->query_tables (tables refered to in
+ // the select-part; empty if no select-part)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+
+*** CREATE TABLE table LIKE src-table
+
+ bool mysql_create_like_table(
+ ...
+ TABLE_LIST *table,
+ TABLE_LIST *src_table,
+ ...)
+ {
+ ...
+ if (thd->current_stmt_binlog_row_based)
+ { // RBR: In this case we don't replicate temp tables
+ if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ if (src_table->table->s->tmp_table)
+ { // CREATE normal-table LIKE temp-table:
+
+ // Generate new query without LIKE-part
+ store_create_info(thd, table, &query, create_info, FALSE);
+
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table (src_table is not included)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, query.ptr(), query.length());
+ }
+ else
+ { // CREATE normal-table LIKE normal-table
+
+ // -------------------------------------
+ // WL40: To include to log_tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+ // CREATE temp-table LIKE ...
+ // This case is not replicated
+ }
+ else
+ { // SBR:
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+
+To be continued
-=-=(Alexi - Mon, 02 Nov 2009, 11:34)=-=-
Worked 2 hours on option 2.5
Worked 2 hours and estimate 48 hours remain (original estimate increased by 50 hours).
------------------------------------------------------------
-=-=(View All Progress Notes, 16 total)=-=-
http://askmonty.org/worklog/index.pl?tid=40&nolimit=1
DESCRIPTION:
Replication slave can be set to filter updates to certain tables with
--replicate-[wild-]{do,ignore}-table options.
This task is about adding similar functionality to mysqlbinlog.
HIGH-LEVEL SPECIFICATION:
1. Context
----------
(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
overview)
At the moment, the server has these replication slave options:
--replicate-do-table=db.tbl
--replicate-ignore-table=db.tbl
--replicate-wild-do-table=pattern.pattern
--replicate-wild-ignore-table=pattern.pattern
They affect both RBR and SBR events. SBR events are checked after the
statement has been parsed, the server iterates over list of used tables and
checks them againist --replicate instructions.
What is interesting is that this scheme still allows to update the ignored
table through a VIEW.
2. Table filtering in mysqlbinlog
---------------------------------
Per-table filtering of RBR events is easy (as it is relatively easy to extract
the name of the table that the event applies to).
Per-table filtering of SBR events is hard, as generally it is not apparent
which tables the statement refers to.
This opens possible options:
2.1 Put the parser into mysqlbinlog
-----------------------------------
Once we have a full parser in mysqlbinlog, we'll be able to check which tables
are used by a statement, and will allow to show behaviour identical to those
that one obtains when using --replicate-* slave options.
(It is not clear how much effort is needed to put the parser into mysqlbinlog.
Any guesses?)
2.2 Use dumb regexp match
-------------------------
Use a really dumb approach. A query is considered to be modifying table X if
it matches an expression
CREATE TABLE $tablename
DROP $tablename
UPDATE ...$tablename ... SET // here '...' can't contain the word 'SET'
DELETE ...$tablename ... WHERE // same as above
ALTER TABLE $tablename
.. etc (go get from the grammar) ..
The advantage over doing the same in awk is that mysqlbinlog will also process
RBR statements, and together with that will provide a working solution for
those who are careful with their table names not mixing with string constants
and such.
(TODO: string constants are of particular concern as they come from
[potentially hostile] users, unlike e.g. table aliases which come from
[not hostile] developers. Remove also all string constants before attempting
to do match?)
2.3 Have the master put annotations
-----------------------------------
We could add a master option so that it injects into query a mark that tells
which tables the query will affect, e.g. for the query
UPDATE t1 LEFT JOIN db3.t2 ON ... WHERE ...
the binlog will have
/* !mysqlbinlog: updates t1,db3.t2 */ UPDATE t1 LEFT JOIN ...
and further processing in mysqlbinlog will be trivial.
2.4 Implement server functionality to ignore certain tables
-----------------------------------------------------------
We could add a general facility in the server to ignore certain tables:
SET SESSION ignored_tables = "db1.t1,db2.t2";
This would work similar to --replicate-ignore-table, but in a general way not
restricted to the slave SQL thread.
It would then be trivial for mysqlbinlog to add such statements at the start
of the output, or probably the user could just do it manually with no need for
additional options for mysqlbinlog.
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
2.5 Extend Query Events With Tables Info
----------------------------------------
We could extend query events structure with a tables info - a list of tables
which the query refers to:
<current query event structure>
tables_info_len
dbase_len dbase
table_len table
...
dbase_len dbase
table_len table
Note. In case of <dbase> = current data base, we can set dbase_len = 0
and dbase = empty because current query event structure already
includes current data base name.
Note. Possibly it is reasonable also to add a --binlog-with-tables-info
option which defines whether tables info must be included to the
query events.
LOW-LEVEL DESIGN:
OPTION: 2.5 Extend Query Events With Tables Info
================================================
1. Adding --binlog-with-tables-info option
******************************************
GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
are to be written in usual format (without any changes).
2. Query event extended binary format
*************************************
When --binlog-with-tables-info is set, Query events are writen
to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
Name Size (bytes)
---------------------------------
COMMON HEADER:
timestamp 4
type 1
server_id 4
total_size 4
master_position 4
flags 2
---------------------------------
POST HEADER:
slave_proxy_id 4
exec_time 4
db_len 1
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
+ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
+ db db_len (see Note 2)
query query_len
+ tables_info
tables_info binary format
---------------------------------
Name Size (bytes)
---------------------------------
db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
...
db_len 1
db db_len
table_name_len 1
table_name table_name_len
NOTES
1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
additional bytes.
#define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
+ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
...
#define Q_STATUS_VARS_LEN_OFFSET 11
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
***********************************************************************
HELP NEEDED
***********************************************************************
The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
log_event.h
~~~~~~~~~~~
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
LOG_EVENT_HEADER_LEN + /* write_header */ \
QUERY_HEADER_LEN + /* write_data */ \
EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
NAME_LEN + 1)
which is used only for setting
thd->variables.max_allowed_packet
mysql->net.max_packet_size
Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
(without making any other changes) be substituted in this definition by
QUERY_HEADER_LEN_EXT.
Below I list all places where MAX_LOG_EVENT_HEADER is used:
slave.cc
~~~~~~~~
static int init_slave_thread(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
slave threads, since a replication event can become this much larger
than the corresponding packet (query) sent from client to master.
*/
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
...
}
pthread_handler_t handle_slave_io(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
thread, since a replication event can become this much larger than
the corresponding packet (query) sent from client to master.
*/
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
...
}
sql_repl.cc
~~~~~~~~~~~
void mysql_binlog_send(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
this larger than the corresponding packet (query) sent
from client to master.
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
bool mysql_show_binlog_events(...)
{ ...
/*
to account binlog event header size
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
3. Changes in log events
************************
3.1. Format description event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Changes needed here concern setting post-header length for Query events.
This setting is done in Format description event constructor which creates
the event for writing to binary log:
if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
This change is to be done only for case binlog_ver = 4.
NOTE. The refered above constructor is allowed to be invoked in a client
context for creating "artificial" Format description events in case of
MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
(because of 'binlog_with_tables_info') and taking into account the
"MySQL < 5.0" restriction, we have to #ifdef out the above code in
following manner:
switch (binlog_ver) {
+ #ifndef MYSQL_CLIENT
case 4: /* MySQL 5.0 and higher */
...
break;
+ #endif
case 1:
case 3:
...
}
3.2. Query event
~~~~~~~~~~~~~~~~
Changes needed here include adding tables_info and tables_info_len
members (member for query length already exists) and modifying the
following function-members:
Query_log_event(buf) constructor
--------------------------------
[Parses binary format written to the 'buf']
Getting post-header length from the Format description event (passed
to the constructor as an argument), define whether buf contains an
extended or usual Query event and parse the buf contents accordingly.
NOTE. Defining Query event format here should be done with taking into
account that this constructor can be called within a Query-derived
event with the event_type argument != QUERY_EVENT.
Query_log_event(thd) constructor
--------------------------------
[Creates the event for binlogging]
In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
write() function
----------------
[Writes the event to binlog]
In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
<To be continued>
4. Where to get tables info from?
*********************************
4.1. Case study: CREATE TABLE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
bool mysql_create_table_no_lock(
THD *thd,
const char *db,
const char *table_name, ...)
{
...
// -------------------------------------
// WL40: To be included in tables_info:
// * db, table_name
// * thd->lex->query_tables (tables refered to in
// the select-part; empty if no select-part)
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
*** CREATE TABLE table LIKE src-table
bool mysql_create_like_table(
...
TABLE_LIST *table,
TABLE_LIST *src_table,
...)
{
...
if (thd->current_stmt_binlog_row_based)
{ // RBR: In this case we don't replicate temp tables
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (src_table->table->s->tmp_table)
{ // CREATE normal-table LIKE temp-table:
// Generate new query without LIKE-part
store_create_info(thd, table, &query, create_info, FALSE);
// -------------------------------------
// WL40: To include to tables_info:
// * table (src_table is not included)
// -------------------------------------
write_bin_log(thd, TRUE, query.ptr(), query.length());
}
else
{ // CREATE normal-table LIKE normal-table
// -------------------------------------
// WL40: To include to log_tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
// CREATE temp-table LIKE ...
// This case is not replicated
}
else
{ // SBR:
// -------------------------------------
// WL40: To include to tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
<To be continued>
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Guest): Add a mysqlbinlog option to filter updates to certain tables (40)
by worklog-noreply@askmonty.org 25 Nov '09
by worklog-noreply@askmonty.org 25 Nov '09
25 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to filter updates to certain tables
CREATION DATE..: Mon, 10 Aug 2009, 13:25
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Psergey
CATEGORY.......: Server-Sprint
TASK ID........: 40 (http://askmonty.org/worklog/?tid=40)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 32
ESTIMATE.......: 32 (hours remain)
ORIG. ESTIMATE.: 48
PROGRESS NOTES:
-=-=(Guest - Wed, 25 Nov 2009, 11:41)=-=-
Category updated.
--- /tmp/wklog.40.old.5737 2009-11-25 11:41:03.000000000 +0200
+++ /tmp/wklog.40.new.5737 2009-11-25 11:41:03.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Bothorsen - Tue, 17 Nov 2009, 17:20)=-=-
Alex is closer to a working patch now.
Worked 14 hours and estimate 32 hours remain (original estimate unchanged).
-=-=(Bothorsen - Thu, 12 Nov 2009, 13:13)=-=-
Work hours by Alexi and Bo + estimated time for the task.
Worked 16 hours and estimate 46 hours remain (original estimate increased by 14 hours).
-=-=(Alexi - Sun, 08 Nov 2009, 15:18)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.15787 2009-11-08 15:18:11.000000000 +0200
+++ /tmp/wklog.40.new.15787 2009-11-08 15:18:11.000000000 +0200
@@ -62,7 +62,7 @@
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
-3. db_len = 0 means that this is the current db.
+3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
@@ -75,6 +75,77 @@
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+***********************************************************************
+HELP NEEDED
+***********************************************************************
+The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
+
+log_event.h
+~~~~~~~~~~~
+#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
+ LOG_EVENT_HEADER_LEN + /* write_header */ \
+ QUERY_HEADER_LEN + /* write_data */ \
+ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
+ MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
+ NAME_LEN + 1)
+
+which is used only for setting
+
+ thd->variables.max_allowed_packet
+ mysql->net.max_packet_size
+
+Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
+(without making any other changes) be substituted in this definition by
+QUERY_HEADER_LEN_EXT.
+
+Below I list all places where MAX_LOG_EVENT_HEADER is used:
+
+slave.cc
+~~~~~~~~
+static int init_slave_thread(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
+ slave threads, since a replication event can become this much larger
+ than the corresponding packet (query) sent from client to master.
+ */
+ thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
+ ...
+}
+pthread_handler_t handle_slave_io(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
+ thread, since a replication event can become this much larger than
+ the corresponding packet (query) sent from client to master.
+ */
+ mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
+sql_repl.cc
+~~~~~~~~~~~
+void mysql_binlog_send(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
+ this larger than the corresponding packet (query) sent
+ from client to master.
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+bool mysql_show_binlog_events(...)
+{ ...
+ /*
+ to account binlog event header size
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
3. Changes in log events
************************
@@ -84,7 +155,7 @@
This setting is done in Format description event constructor which creates
the event for writing to binary log:
- if (binlog_with_tables_info)
+ if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
@@ -99,12 +170,12 @@
following manner:
switch (binlog_ver) {
- case 4: /* MySQL 5.0 and higher */
+ #ifndef MYSQL_CLIENT
+ case 4: /* MySQL 5.0 and higher */
...
-+ #else
-+ <error>
+ break;
+ #endif
+
case 1:
case 3:
...
@@ -132,7 +203,7 @@
--------------------------------
[Creates the event for binlogging]
-In case of binlog_with_tables_info = TRUE, set additionally query_len,
+In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
@@ -140,7 +211,7 @@
----------------
[Writes the event to binlog]
-In case of binlog_with_tables_info = TRUE, write additional members
+In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
-=-=(Alexi - Sun, 08 Nov 2009, 10:40)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.5055 2009-11-08 08:40:02.000000000 +0000
+++ /tmp/wklog.40.new.5055 2009-11-08 08:40:02.000000000 +0000
@@ -3,6 +3,7 @@
1. Adding --binlog-with-tables-info option
******************************************
+GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
-=-=(Alexi - Thu, 05 Nov 2009, 12:37)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.11441 2009-11-05 12:37:16.000000000 +0200
+++ /tmp/wklog.40.new.11441 2009-11-05 12:37:16.000000000 +0200
@@ -1,9 +1,18 @@
OPTION: 2.5 Extend Query Events With Tables Info
================================================
-1. Query_log_event Binary Format
-********************************
-Changes to be done:
+1. Adding --binlog-with-tables-info option
+******************************************
+
+When set, Query events are to be written in the extended binary
+format which contains tables_info. When not set, Query events
+are to be written in usual format (without any changes).
+
+2. Query event extended binary format
+*************************************
+
+When --binlog-with-tables-info is set, Query events are writen
+to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
@@ -24,12 +33,12 @@
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
-+ tables_info_len 2 (see Note 2)
++ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
-+ db db_len (see Note 3)
++ db db_len (see Note 2)
query query_len
+ tables_info
@@ -37,7 +46,7 @@
---------------------------------
Name Size (bytes)
---------------------------------
- db_len 1 (see Note 4)
+ db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
@@ -48,19 +57,99 @@
table_name table_name_len
NOTES
-1. Currently Query_log_event format doesn't include 'query_len' because
+1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
-2. If tables_info is not included in the event (--binlog-with-tables-info
- option), tables_info_len = 0.
-3. The trailing zero is redundant since the length is already known.
-4. In case of db = current db, db_len = 0 and db = empty, because
- current db is already included in the current event format.
+2. For 'db' (current db) the trailing zero is redundant since the length
+ is already known.
+3. db_len = 0 means that this is the current db.
+
+When reading Query events from binary log, we can recognize its format
+by its post-header length: in extended case the post-header includes 4
+additional bytes.
+
+ #define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
++ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
+ ...
+ #define Q_STATUS_VARS_LEN_OFFSET 11
++ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
++ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+3. Changes in log events
+************************
+
+3.1. Format description event
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Changes needed here concern setting post-header length for Query events.
+This setting is done in Format description event constructor which creates
+the event for writing to binary log:
+
+ if (binlog_with_tables_info)
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
+ else
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
+
+This change is to be done only for case binlog_ver = 4.
+
+NOTE. The refered above constructor is allowed to be invoked in a client
+context for creating "artificial" Format description events in case of
+MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
+(because of 'binlog_with_tables_info') and taking into account the
+"MySQL < 5.0" restriction, we have to #ifdef out the above code in
+following manner:
+
+ switch (binlog_ver) {
+ case 4: /* MySQL 5.0 and higher */
++ #ifndef MYSQL_CLIENT
+ ...
++ #else
++ <error>
++ #endif
+ case 1:
+ case 3:
+ ...
+ }
+
+3.2. Query event
+~~~~~~~~~~~~~~~~
+Changes needed here include adding tables_info and tables_info_len
+members (member for query length already exists) and modifying the
+following function-members:
+
+Query_log_event(buf) constructor
+--------------------------------
+[Parses binary format written to the 'buf']
+
+Getting post-header length from the Format description event (passed
+to the constructor as an argument), define whether buf contains an
+extended or usual Query event and parse the buf contents accordingly.
+
+NOTE. Defining Query event format here should be done with taking into
+account that this constructor can be called within a Query-derived
+event with the event_type argument != QUERY_EVENT.
+
+Query_log_event(thd) constructor
+--------------------------------
+[Creates the event for binlogging]
+
+In case of binlog_with_tables_info = TRUE, set additionally query_len,
+tables_info_len, and tables_info members (the constructor is to have
+an additional 'tables_info' argument).
+
+write() function
+----------------
+[Writes the event to binlog]
+
+In case of binlog_with_tables_info = TRUE, write additional members
+(query_len, tables_info_len, and tables_info) to binary log. Also
+write corresponding whole event length to the common-header.
+
+<To be continued>
-2. Where to get tables info from?
+4. Where to get tables info from?
*********************************
-2.1. Case study: CREATE TABLE
-******************************
+4.1. Case study: CREATE TABLE
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
@@ -129,4 +218,4 @@
}
}
-To be continued
+<To be continued>
-=-=(Alexi - Wed, 04 Nov 2009, 10:21)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.6734 2009-11-04 10:21:20.000000000 +0200
+++ /tmp/wklog.40.new.6734 2009-11-04 10:21:20.000000000 +0200
@@ -21,9 +21,9 @@
slave_proxy_id 4
exec_time 4
db_len 1
-+ query_len 2 (see Note 1)
error_code 2
status_vars_len 2
++ query_len 2 (see Note 1)
+ tables_info_len 2 (see Note 2)
---------------------------------
BODY:
-=-=(Alexi - Tue, 03 Nov 2009, 11:19)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.7187 2009-11-03 11:19:22.000000000 +0200
+++ /tmp/wklog.40.new.7187 2009-11-03 11:19:22.000000000 +0200
@@ -1 +1,132 @@
+OPTION: 2.5 Extend Query Events With Tables Info
+================================================
+1. Query_log_event Binary Format
+********************************
+Changes to be done:
+
+ Query_log_event binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ COMMON HEADER:
+ timestamp 4
+ type 1
+ server_id 4
+ total_size 4
+ master_position 4
+ flags 2
+ ---------------------------------
+ POST HEADER:
+ slave_proxy_id 4
+ exec_time 4
+ db_len 1
++ query_len 2 (see Note 1)
+ error_code 2
+ status_vars_len 2
++ tables_info_len 2 (see Note 2)
+ ---------------------------------
+ BODY:
+ status_vars status_vars_len
+- db db_len + 1
++ db db_len (see Note 3)
+ query query_len
++ tables_info
+
+ tables_info binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ db_len 1 (see Note 4)
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+ ...
+ db_len 1
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+
+NOTES
+1. Currently Query_log_event format doesn't include 'query_len' because
+ it considers the query to extent to the end of the event.
+2. If tables_info is not included in the event (--binlog-with-tables-info
+ option), tables_info_len = 0.
+3. The trailing zero is redundant since the length is already known.
+4. In case of db = current db, db_len = 0 and db = empty, because
+ current db is already included in the current event format.
+
+2. Where to get tables info from?
+*********************************
+
+2.1. Case study: CREATE TABLE
+******************************
+
+*** CREATE TABLE table [SELECT ...]
+
+ bool mysql_create_table_no_lock(
+ THD *thd,
+ const char *db,
+ const char *table_name, ...)
+ {
+ ...
+ // -------------------------------------
+ // WL40: To be included in tables_info:
+ // * db, table_name
+ // * thd->lex->query_tables (tables refered to in
+ // the select-part; empty if no select-part)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+
+*** CREATE TABLE table LIKE src-table
+
+ bool mysql_create_like_table(
+ ...
+ TABLE_LIST *table,
+ TABLE_LIST *src_table,
+ ...)
+ {
+ ...
+ if (thd->current_stmt_binlog_row_based)
+ { // RBR: In this case we don't replicate temp tables
+ if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ if (src_table->table->s->tmp_table)
+ { // CREATE normal-table LIKE temp-table:
+
+ // Generate new query without LIKE-part
+ store_create_info(thd, table, &query, create_info, FALSE);
+
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table (src_table is not included)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, query.ptr(), query.length());
+ }
+ else
+ { // CREATE normal-table LIKE normal-table
+
+ // -------------------------------------
+ // WL40: To include to log_tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+ // CREATE temp-table LIKE ...
+ // This case is not replicated
+ }
+ else
+ { // SBR:
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+
+To be continued
-=-=(Alexi - Mon, 02 Nov 2009, 11:34)=-=-
Worked 2 hours on option 2.5
Worked 2 hours and estimate 48 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Mon, 02 Nov 2009, 11:20)=-=-
High-Level Specification modified.
--- /tmp/wklog.40.old.4848 2009-11-02 11:20:24.000000000 +0200
+++ /tmp/wklog.40.new.4848 2009-11-02 11:20:24.000000000 +0200
@@ -90,3 +90,25 @@
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
+2.5 Extend Query Events With Tables Info
+----------------------------------------
+
+We could extend query events structure with a tables info - a list of tables
+which the query refers to:
+
+ <current query event structure>
+ tables_info_len
+ dbase_len dbase
+ table_len table
+ ...
+ dbase_len dbase
+ table_len table
+
+Note. In case of <dbase> = current data base, we can set dbase_len = 0
+ and dbase = empty because current query event structure already
+ includes current data base name.
+
+Note. Possibly it is reasonable also to add a --binlog-with-tables-info
+ option which defines whether tables info must be included to the
+ query events.
+
------------------------------------------------------------
-=-=(View All Progress Notes, 15 total)=-=-
http://askmonty.org/worklog/index.pl?tid=40&nolimit=1
DESCRIPTION:
Replication slave can be set to filter updates to certain tables with
--replicate-[wild-]{do,ignore}-table options.
This task is about adding similar functionality to mysqlbinlog.
HIGH-LEVEL SPECIFICATION:
1. Context
----------
(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
overview)
At the moment, the server has these replication slave options:
--replicate-do-table=db.tbl
--replicate-ignore-table=db.tbl
--replicate-wild-do-table=pattern.pattern
--replicate-wild-ignore-table=pattern.pattern
They affect both RBR and SBR events. SBR events are checked after the
statement has been parsed, the server iterates over list of used tables and
checks them againist --replicate instructions.
What is interesting is that this scheme still allows to update the ignored
table through a VIEW.
2. Table filtering in mysqlbinlog
---------------------------------
Per-table filtering of RBR events is easy (as it is relatively easy to extract
the name of the table that the event applies to).
Per-table filtering of SBR events is hard, as generally it is not apparent
which tables the statement refers to.
This opens possible options:
2.1 Put the parser into mysqlbinlog
-----------------------------------
Once we have a full parser in mysqlbinlog, we'll be able to check which tables
are used by a statement, and will allow to show behaviour identical to those
that one obtains when using --replicate-* slave options.
(It is not clear how much effort is needed to put the parser into mysqlbinlog.
Any guesses?)
2.2 Use dumb regexp match
-------------------------
Use a really dumb approach. A query is considered to be modifying table X if
it matches an expression
CREATE TABLE $tablename
DROP $tablename
UPDATE ...$tablename ... SET // here '...' can't contain the word 'SET'
DELETE ...$tablename ... WHERE // same as above
ALTER TABLE $tablename
.. etc (go get from the grammar) ..
The advantage over doing the same in awk is that mysqlbinlog will also process
RBR statements, and together with that will provide a working solution for
those who are careful with their table names not mixing with string constants
and such.
(TODO: string constants are of particular concern as they come from
[potentially hostile] users, unlike e.g. table aliases which come from
[not hostile] developers. Remove also all string constants before attempting
to do match?)
2.3 Have the master put annotations
-----------------------------------
We could add a master option so that it injects into query a mark that tells
which tables the query will affect, e.g. for the query
UPDATE t1 LEFT JOIN db3.t2 ON ... WHERE ...
the binlog will have
/* !mysqlbinlog: updates t1,db3.t2 */ UPDATE t1 LEFT JOIN ...
and further processing in mysqlbinlog will be trivial.
2.4 Implement server functionality to ignore certain tables
-----------------------------------------------------------
We could add a general facility in the server to ignore certain tables:
SET SESSION ignored_tables = "db1.t1,db2.t2";
This would work similar to --replicate-ignore-table, but in a general way not
restricted to the slave SQL thread.
It would then be trivial for mysqlbinlog to add such statements at the start
of the output, or probably the user could just do it manually with no need for
additional options for mysqlbinlog.
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
2.5 Extend Query Events With Tables Info
----------------------------------------
We could extend query events structure with a tables info - a list of tables
which the query refers to:
<current query event structure>
tables_info_len
dbase_len dbase
table_len table
...
dbase_len dbase
table_len table
Note. In case of <dbase> = current data base, we can set dbase_len = 0
and dbase = empty because current query event structure already
includes current data base name.
Note. Possibly it is reasonable also to add a --binlog-with-tables-info
option which defines whether tables info must be included to the
query events.
LOW-LEVEL DESIGN:
OPTION: 2.5 Extend Query Events With Tables Info
================================================
1. Adding --binlog-with-tables-info option
******************************************
GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
are to be written in usual format (without any changes).
2. Query event extended binary format
*************************************
When --binlog-with-tables-info is set, Query events are writen
to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
Name Size (bytes)
---------------------------------
COMMON HEADER:
timestamp 4
type 1
server_id 4
total_size 4
master_position 4
flags 2
---------------------------------
POST HEADER:
slave_proxy_id 4
exec_time 4
db_len 1
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
+ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
+ db db_len (see Note 2)
query query_len
+ tables_info
tables_info binary format
---------------------------------
Name Size (bytes)
---------------------------------
db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
...
db_len 1
db db_len
table_name_len 1
table_name table_name_len
NOTES
1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
additional bytes.
#define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
+ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
...
#define Q_STATUS_VARS_LEN_OFFSET 11
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
***********************************************************************
HELP NEEDED
***********************************************************************
The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
log_event.h
~~~~~~~~~~~
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
LOG_EVENT_HEADER_LEN + /* write_header */ \
QUERY_HEADER_LEN + /* write_data */ \
EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
NAME_LEN + 1)
which is used only for setting
thd->variables.max_allowed_packet
mysql->net.max_packet_size
Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
(without making any other changes) be substituted in this definition by
QUERY_HEADER_LEN_EXT.
Below I list all places where MAX_LOG_EVENT_HEADER is used:
slave.cc
~~~~~~~~
static int init_slave_thread(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
slave threads, since a replication event can become this much larger
than the corresponding packet (query) sent from client to master.
*/
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
...
}
pthread_handler_t handle_slave_io(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
thread, since a replication event can become this much larger than
the corresponding packet (query) sent from client to master.
*/
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
...
}
sql_repl.cc
~~~~~~~~~~~
void mysql_binlog_send(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
this larger than the corresponding packet (query) sent
from client to master.
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
bool mysql_show_binlog_events(...)
{ ...
/*
to account binlog event header size
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
3. Changes in log events
************************
3.1. Format description event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Changes needed here concern setting post-header length for Query events.
This setting is done in Format description event constructor which creates
the event for writing to binary log:
if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
This change is to be done only for case binlog_ver = 4.
NOTE. The refered above constructor is allowed to be invoked in a client
context for creating "artificial" Format description events in case of
MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
(because of 'binlog_with_tables_info') and taking into account the
"MySQL < 5.0" restriction, we have to #ifdef out the above code in
following manner:
switch (binlog_ver) {
+ #ifndef MYSQL_CLIENT
case 4: /* MySQL 5.0 and higher */
...
break;
+ #endif
case 1:
case 3:
...
}
3.2. Query event
~~~~~~~~~~~~~~~~
Changes needed here include adding tables_info and tables_info_len
members (member for query length already exists) and modifying the
following function-members:
Query_log_event(buf) constructor
--------------------------------
[Parses binary format written to the 'buf']
Getting post-header length from the Format description event (passed
to the constructor as an argument), define whether buf contains an
extended or usual Query event and parse the buf contents accordingly.
NOTE. Defining Query event format here should be done with taking into
account that this constructor can be called within a Query-derived
event with the event_type argument != QUERY_EVENT.
Query_log_event(thd) constructor
--------------------------------
[Creates the event for binlogging]
In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
write() function
----------------
[Writes the event to binlog]
In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
<To be continued>
4. Where to get tables info from?
*********************************
4.1. Case study: CREATE TABLE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
bool mysql_create_table_no_lock(
THD *thd,
const char *db,
const char *table_name, ...)
{
...
// -------------------------------------
// WL40: To be included in tables_info:
// * db, table_name
// * thd->lex->query_tables (tables refered to in
// the select-part; empty if no select-part)
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
*** CREATE TABLE table LIKE src-table
bool mysql_create_like_table(
...
TABLE_LIST *table,
TABLE_LIST *src_table,
...)
{
...
if (thd->current_stmt_binlog_row_based)
{ // RBR: In this case we don't replicate temp tables
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (src_table->table->s->tmp_table)
{ // CREATE normal-table LIKE temp-table:
// Generate new query without LIKE-part
store_create_info(thd, table, &query, create_info, FALSE);
// -------------------------------------
// WL40: To include to tables_info:
// * table (src_table is not included)
// -------------------------------------
write_bin_log(thd, TRUE, query.ptr(), query.length());
}
else
{ // CREATE normal-table LIKE normal-table
// -------------------------------------
// WL40: To include to log_tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
// CREATE temp-table LIKE ...
// This case is not replicated
}
else
{ // SBR:
// -------------------------------------
// WL40: To include to tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
<To be continued>
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Guest): Add a mysqlbinlog option to filter updates to certain tables (40)
by worklog-noreply@askmonty.org 25 Nov '09
by worklog-noreply@askmonty.org 25 Nov '09
25 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to filter updates to certain tables
CREATION DATE..: Mon, 10 Aug 2009, 13:25
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Psergey
CATEGORY.......: Server-Sprint
TASK ID........: 40 (http://askmonty.org/worklog/?tid=40)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 32
ESTIMATE.......: 32 (hours remain)
ORIG. ESTIMATE.: 48
PROGRESS NOTES:
-=-=(Guest - Wed, 25 Nov 2009, 11:41)=-=-
Category updated.
--- /tmp/wklog.40.old.5737 2009-11-25 11:41:03.000000000 +0200
+++ /tmp/wklog.40.new.5737 2009-11-25 11:41:03.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint
-=-=(Bothorsen - Tue, 17 Nov 2009, 17:20)=-=-
Alex is closer to a working patch now.
Worked 14 hours and estimate 32 hours remain (original estimate unchanged).
-=-=(Bothorsen - Thu, 12 Nov 2009, 13:13)=-=-
Work hours by Alexi and Bo + estimated time for the task.
Worked 16 hours and estimate 46 hours remain (original estimate increased by 14 hours).
-=-=(Alexi - Sun, 08 Nov 2009, 15:18)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.15787 2009-11-08 15:18:11.000000000 +0200
+++ /tmp/wklog.40.new.15787 2009-11-08 15:18:11.000000000 +0200
@@ -62,7 +62,7 @@
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
-3. db_len = 0 means that this is the current db.
+3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
@@ -75,6 +75,77 @@
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+***********************************************************************
+HELP NEEDED
+***********************************************************************
+The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
+
+log_event.h
+~~~~~~~~~~~
+#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
+ LOG_EVENT_HEADER_LEN + /* write_header */ \
+ QUERY_HEADER_LEN + /* write_data */ \
+ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
+ MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
+ NAME_LEN + 1)
+
+which is used only for setting
+
+ thd->variables.max_allowed_packet
+ mysql->net.max_packet_size
+
+Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
+(without making any other changes) be substituted in this definition by
+QUERY_HEADER_LEN_EXT.
+
+Below I list all places where MAX_LOG_EVENT_HEADER is used:
+
+slave.cc
+~~~~~~~~
+static int init_slave_thread(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
+ slave threads, since a replication event can become this much larger
+ than the corresponding packet (query) sent from client to master.
+ */
+ thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
+ ...
+}
+pthread_handler_t handle_slave_io(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
+ thread, since a replication event can become this much larger than
+ the corresponding packet (query) sent from client to master.
+ */
+ mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
+sql_repl.cc
+~~~~~~~~~~~
+void mysql_binlog_send(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
+ this larger than the corresponding packet (query) sent
+ from client to master.
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+bool mysql_show_binlog_events(...)
+{ ...
+ /*
+ to account binlog event header size
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
3. Changes in log events
************************
@@ -84,7 +155,7 @@
This setting is done in Format description event constructor which creates
the event for writing to binary log:
- if (binlog_with_tables_info)
+ if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
@@ -99,12 +170,12 @@
following manner:
switch (binlog_ver) {
- case 4: /* MySQL 5.0 and higher */
+ #ifndef MYSQL_CLIENT
+ case 4: /* MySQL 5.0 and higher */
...
-+ #else
-+ <error>
+ break;
+ #endif
+
case 1:
case 3:
...
@@ -132,7 +203,7 @@
--------------------------------
[Creates the event for binlogging]
-In case of binlog_with_tables_info = TRUE, set additionally query_len,
+In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
@@ -140,7 +211,7 @@
----------------
[Writes the event to binlog]
-In case of binlog_with_tables_info = TRUE, write additional members
+In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
-=-=(Alexi - Sun, 08 Nov 2009, 10:40)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.5055 2009-11-08 08:40:02.000000000 +0000
+++ /tmp/wklog.40.new.5055 2009-11-08 08:40:02.000000000 +0000
@@ -3,6 +3,7 @@
1. Adding --binlog-with-tables-info option
******************************************
+GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
-=-=(Alexi - Thu, 05 Nov 2009, 12:37)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.11441 2009-11-05 12:37:16.000000000 +0200
+++ /tmp/wklog.40.new.11441 2009-11-05 12:37:16.000000000 +0200
@@ -1,9 +1,18 @@
OPTION: 2.5 Extend Query Events With Tables Info
================================================
-1. Query_log_event Binary Format
-********************************
-Changes to be done:
+1. Adding --binlog-with-tables-info option
+******************************************
+
+When set, Query events are to be written in the extended binary
+format which contains tables_info. When not set, Query events
+are to be written in usual format (without any changes).
+
+2. Query event extended binary format
+*************************************
+
+When --binlog-with-tables-info is set, Query events are writen
+to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
@@ -24,12 +33,12 @@
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
-+ tables_info_len 2 (see Note 2)
++ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
-+ db db_len (see Note 3)
++ db db_len (see Note 2)
query query_len
+ tables_info
@@ -37,7 +46,7 @@
---------------------------------
Name Size (bytes)
---------------------------------
- db_len 1 (see Note 4)
+ db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
@@ -48,19 +57,99 @@
table_name table_name_len
NOTES
-1. Currently Query_log_event format doesn't include 'query_len' because
+1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
-2. If tables_info is not included in the event (--binlog-with-tables-info
- option), tables_info_len = 0.
-3. The trailing zero is redundant since the length is already known.
-4. In case of db = current db, db_len = 0 and db = empty, because
- current db is already included in the current event format.
+2. For 'db' (current db) the trailing zero is redundant since the length
+ is already known.
+3. db_len = 0 means that this is the current db.
+
+When reading Query events from binary log, we can recognize its format
+by its post-header length: in extended case the post-header includes 4
+additional bytes.
+
+ #define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
++ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
+ ...
+ #define Q_STATUS_VARS_LEN_OFFSET 11
++ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
++ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+3. Changes in log events
+************************
+
+3.1. Format description event
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Changes needed here concern setting post-header length for Query events.
+This setting is done in Format description event constructor which creates
+the event for writing to binary log:
+
+ if (binlog_with_tables_info)
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
+ else
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
+
+This change is to be done only for case binlog_ver = 4.
+
+NOTE. The refered above constructor is allowed to be invoked in a client
+context for creating "artificial" Format description events in case of
+MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
+(because of 'binlog_with_tables_info') and taking into account the
+"MySQL < 5.0" restriction, we have to #ifdef out the above code in
+following manner:
+
+ switch (binlog_ver) {
+ case 4: /* MySQL 5.0 and higher */
++ #ifndef MYSQL_CLIENT
+ ...
++ #else
++ <error>
++ #endif
+ case 1:
+ case 3:
+ ...
+ }
+
+3.2. Query event
+~~~~~~~~~~~~~~~~
+Changes needed here include adding tables_info and tables_info_len
+members (member for query length already exists) and modifying the
+following function-members:
+
+Query_log_event(buf) constructor
+--------------------------------
+[Parses binary format written to the 'buf']
+
+Getting post-header length from the Format description event (passed
+to the constructor as an argument), define whether buf contains an
+extended or usual Query event and parse the buf contents accordingly.
+
+NOTE. Defining Query event format here should be done with taking into
+account that this constructor can be called within a Query-derived
+event with the event_type argument != QUERY_EVENT.
+
+Query_log_event(thd) constructor
+--------------------------------
+[Creates the event for binlogging]
+
+In case of binlog_with_tables_info = TRUE, set additionally query_len,
+tables_info_len, and tables_info members (the constructor is to have
+an additional 'tables_info' argument).
+
+write() function
+----------------
+[Writes the event to binlog]
+
+In case of binlog_with_tables_info = TRUE, write additional members
+(query_len, tables_info_len, and tables_info) to binary log. Also
+write corresponding whole event length to the common-header.
+
+<To be continued>
-2. Where to get tables info from?
+4. Where to get tables info from?
*********************************
-2.1. Case study: CREATE TABLE
-******************************
+4.1. Case study: CREATE TABLE
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
@@ -129,4 +218,4 @@
}
}
-To be continued
+<To be continued>
-=-=(Alexi - Wed, 04 Nov 2009, 10:21)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.6734 2009-11-04 10:21:20.000000000 +0200
+++ /tmp/wklog.40.new.6734 2009-11-04 10:21:20.000000000 +0200
@@ -21,9 +21,9 @@
slave_proxy_id 4
exec_time 4
db_len 1
-+ query_len 2 (see Note 1)
error_code 2
status_vars_len 2
++ query_len 2 (see Note 1)
+ tables_info_len 2 (see Note 2)
---------------------------------
BODY:
-=-=(Alexi - Tue, 03 Nov 2009, 11:19)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.7187 2009-11-03 11:19:22.000000000 +0200
+++ /tmp/wklog.40.new.7187 2009-11-03 11:19:22.000000000 +0200
@@ -1 +1,132 @@
+OPTION: 2.5 Extend Query Events With Tables Info
+================================================
+1. Query_log_event Binary Format
+********************************
+Changes to be done:
+
+ Query_log_event binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ COMMON HEADER:
+ timestamp 4
+ type 1
+ server_id 4
+ total_size 4
+ master_position 4
+ flags 2
+ ---------------------------------
+ POST HEADER:
+ slave_proxy_id 4
+ exec_time 4
+ db_len 1
++ query_len 2 (see Note 1)
+ error_code 2
+ status_vars_len 2
++ tables_info_len 2 (see Note 2)
+ ---------------------------------
+ BODY:
+ status_vars status_vars_len
+- db db_len + 1
++ db db_len (see Note 3)
+ query query_len
++ tables_info
+
+ tables_info binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ db_len 1 (see Note 4)
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+ ...
+ db_len 1
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+
+NOTES
+1. Currently Query_log_event format doesn't include 'query_len' because
+ it considers the query to extent to the end of the event.
+2. If tables_info is not included in the event (--binlog-with-tables-info
+ option), tables_info_len = 0.
+3. The trailing zero is redundant since the length is already known.
+4. In case of db = current db, db_len = 0 and db = empty, because
+ current db is already included in the current event format.
+
+2. Where to get tables info from?
+*********************************
+
+2.1. Case study: CREATE TABLE
+******************************
+
+*** CREATE TABLE table [SELECT ...]
+
+ bool mysql_create_table_no_lock(
+ THD *thd,
+ const char *db,
+ const char *table_name, ...)
+ {
+ ...
+ // -------------------------------------
+ // WL40: To be included in tables_info:
+ // * db, table_name
+ // * thd->lex->query_tables (tables refered to in
+ // the select-part; empty if no select-part)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+
+*** CREATE TABLE table LIKE src-table
+
+ bool mysql_create_like_table(
+ ...
+ TABLE_LIST *table,
+ TABLE_LIST *src_table,
+ ...)
+ {
+ ...
+ if (thd->current_stmt_binlog_row_based)
+ { // RBR: In this case we don't replicate temp tables
+ if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ if (src_table->table->s->tmp_table)
+ { // CREATE normal-table LIKE temp-table:
+
+ // Generate new query without LIKE-part
+ store_create_info(thd, table, &query, create_info, FALSE);
+
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table (src_table is not included)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, query.ptr(), query.length());
+ }
+ else
+ { // CREATE normal-table LIKE normal-table
+
+ // -------------------------------------
+ // WL40: To include to log_tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+ // CREATE temp-table LIKE ...
+ // This case is not replicated
+ }
+ else
+ { // SBR:
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+
+To be continued
-=-=(Alexi - Mon, 02 Nov 2009, 11:34)=-=-
Worked 2 hours on option 2.5
Worked 2 hours and estimate 48 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Mon, 02 Nov 2009, 11:20)=-=-
High-Level Specification modified.
--- /tmp/wklog.40.old.4848 2009-11-02 11:20:24.000000000 +0200
+++ /tmp/wklog.40.new.4848 2009-11-02 11:20:24.000000000 +0200
@@ -90,3 +90,25 @@
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
+2.5 Extend Query Events With Tables Info
+----------------------------------------
+
+We could extend query events structure with a tables info - a list of tables
+which the query refers to:
+
+ <current query event structure>
+ tables_info_len
+ dbase_len dbase
+ table_len table
+ ...
+ dbase_len dbase
+ table_len table
+
+Note. In case of <dbase> = current data base, we can set dbase_len = 0
+ and dbase = empty because current query event structure already
+ includes current data base name.
+
+Note. Possibly it is reasonable also to add a --binlog-with-tables-info
+ option which defines whether tables info must be included to the
+ query events.
+
------------------------------------------------------------
-=-=(View All Progress Notes, 15 total)=-=-
http://askmonty.org/worklog/index.pl?tid=40&nolimit=1
DESCRIPTION:
Replication slave can be set to filter updates to certain tables with
--replicate-[wild-]{do,ignore}-table options.
This task is about adding similar functionality to mysqlbinlog.
HIGH-LEVEL SPECIFICATION:
1. Context
----------
(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
overview)
At the moment, the server has these replication slave options:
--replicate-do-table=db.tbl
--replicate-ignore-table=db.tbl
--replicate-wild-do-table=pattern.pattern
--replicate-wild-ignore-table=pattern.pattern
They affect both RBR and SBR events. SBR events are checked after the
statement has been parsed, the server iterates over list of used tables and
checks them againist --replicate instructions.
What is interesting is that this scheme still allows to update the ignored
table through a VIEW.
2. Table filtering in mysqlbinlog
---------------------------------
Per-table filtering of RBR events is easy (as it is relatively easy to extract
the name of the table that the event applies to).
Per-table filtering of SBR events is hard, as generally it is not apparent
which tables the statement refers to.
This opens possible options:
2.1 Put the parser into mysqlbinlog
-----------------------------------
Once we have a full parser in mysqlbinlog, we'll be able to check which tables
are used by a statement, and will allow to show behaviour identical to those
that one obtains when using --replicate-* slave options.
(It is not clear how much effort is needed to put the parser into mysqlbinlog.
Any guesses?)
2.2 Use dumb regexp match
-------------------------
Use a really dumb approach. A query is considered to be modifying table X if
it matches an expression
CREATE TABLE $tablename
DROP $tablename
UPDATE ...$tablename ... SET // here '...' can't contain the word 'SET'
DELETE ...$tablename ... WHERE // same as above
ALTER TABLE $tablename
.. etc (go get from the grammar) ..
The advantage over doing the same in awk is that mysqlbinlog will also process
RBR statements, and together with that will provide a working solution for
those who are careful with their table names not mixing with string constants
and such.
(TODO: string constants are of particular concern as they come from
[potentially hostile] users, unlike e.g. table aliases which come from
[not hostile] developers. Remove also all string constants before attempting
to do match?)
2.3 Have the master put annotations
-----------------------------------
We could add a master option so that it injects into query a mark that tells
which tables the query will affect, e.g. for the query
UPDATE t1 LEFT JOIN db3.t2 ON ... WHERE ...
the binlog will have
/* !mysqlbinlog: updates t1,db3.t2 */ UPDATE t1 LEFT JOIN ...
and further processing in mysqlbinlog will be trivial.
2.4 Implement server functionality to ignore certain tables
-----------------------------------------------------------
We could add a general facility in the server to ignore certain tables:
SET SESSION ignored_tables = "db1.t1,db2.t2";
This would work similar to --replicate-ignore-table, but in a general way not
restricted to the slave SQL thread.
It would then be trivial for mysqlbinlog to add such statements at the start
of the output, or probably the user could just do it manually with no need for
additional options for mysqlbinlog.
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
2.5 Extend Query Events With Tables Info
----------------------------------------
We could extend query events structure with a tables info - a list of tables
which the query refers to:
<current query event structure>
tables_info_len
dbase_len dbase
table_len table
...
dbase_len dbase
table_len table
Note. In case of <dbase> = current data base, we can set dbase_len = 0
and dbase = empty because current query event structure already
includes current data base name.
Note. Possibly it is reasonable also to add a --binlog-with-tables-info
option which defines whether tables info must be included to the
query events.
LOW-LEVEL DESIGN:
OPTION: 2.5 Extend Query Events With Tables Info
================================================
1. Adding --binlog-with-tables-info option
******************************************
GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
are to be written in usual format (without any changes).
2. Query event extended binary format
*************************************
When --binlog-with-tables-info is set, Query events are writen
to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
Name Size (bytes)
---------------------------------
COMMON HEADER:
timestamp 4
type 1
server_id 4
total_size 4
master_position 4
flags 2
---------------------------------
POST HEADER:
slave_proxy_id 4
exec_time 4
db_len 1
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
+ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
+ db db_len (see Note 2)
query query_len
+ tables_info
tables_info binary format
---------------------------------
Name Size (bytes)
---------------------------------
db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
...
db_len 1
db db_len
table_name_len 1
table_name table_name_len
NOTES
1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
additional bytes.
#define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
+ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
...
#define Q_STATUS_VARS_LEN_OFFSET 11
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
***********************************************************************
HELP NEEDED
***********************************************************************
The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
log_event.h
~~~~~~~~~~~
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
LOG_EVENT_HEADER_LEN + /* write_header */ \
QUERY_HEADER_LEN + /* write_data */ \
EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
NAME_LEN + 1)
which is used only for setting
thd->variables.max_allowed_packet
mysql->net.max_packet_size
Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
(without making any other changes) be substituted in this definition by
QUERY_HEADER_LEN_EXT.
Below I list all places where MAX_LOG_EVENT_HEADER is used:
slave.cc
~~~~~~~~
static int init_slave_thread(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
slave threads, since a replication event can become this much larger
than the corresponding packet (query) sent from client to master.
*/
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
...
}
pthread_handler_t handle_slave_io(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
thread, since a replication event can become this much larger than
the corresponding packet (query) sent from client to master.
*/
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
...
}
sql_repl.cc
~~~~~~~~~~~
void mysql_binlog_send(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
this larger than the corresponding packet (query) sent
from client to master.
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
bool mysql_show_binlog_events(...)
{ ...
/*
to account binlog event header size
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
3. Changes in log events
************************
3.1. Format description event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Changes needed here concern setting post-header length for Query events.
This setting is done in Format description event constructor which creates
the event for writing to binary log:
if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
This change is to be done only for case binlog_ver = 4.
NOTE. The refered above constructor is allowed to be invoked in a client
context for creating "artificial" Format description events in case of
MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
(because of 'binlog_with_tables_info') and taking into account the
"MySQL < 5.0" restriction, we have to #ifdef out the above code in
following manner:
switch (binlog_ver) {
+ #ifndef MYSQL_CLIENT
case 4: /* MySQL 5.0 and higher */
...
break;
+ #endif
case 1:
case 3:
...
}
3.2. Query event
~~~~~~~~~~~~~~~~
Changes needed here include adding tables_info and tables_info_len
members (member for query length already exists) and modifying the
following function-members:
Query_log_event(buf) constructor
--------------------------------
[Parses binary format written to the 'buf']
Getting post-header length from the Format description event (passed
to the constructor as an argument), define whether buf contains an
extended or usual Query event and parse the buf contents accordingly.
NOTE. Defining Query event format here should be done with taking into
account that this constructor can be called within a Query-derived
event with the event_type argument != QUERY_EVENT.
Query_log_event(thd) constructor
--------------------------------
[Creates the event for binlogging]
In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
write() function
----------------
[Writes the event to binlog]
In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
<To be continued>
4. Where to get tables info from?
*********************************
4.1. Case study: CREATE TABLE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
bool mysql_create_table_no_lock(
THD *thd,
const char *db,
const char *table_name, ...)
{
...
// -------------------------------------
// WL40: To be included in tables_info:
// * db, table_name
// * thd->lex->query_tables (tables refered to in
// the select-part; empty if no select-part)
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
*** CREATE TABLE table LIKE src-table
bool mysql_create_like_table(
...
TABLE_LIST *table,
TABLE_LIST *src_table,
...)
{
...
if (thd->current_stmt_binlog_row_based)
{ // RBR: In this case we don't replicate temp tables
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (src_table->table->s->tmp_table)
{ // CREATE normal-table LIKE temp-table:
// Generate new query without LIKE-part
store_create_info(thd, table, &query, create_info, FALSE);
// -------------------------------------
// WL40: To include to tables_info:
// * table (src_table is not included)
// -------------------------------------
write_bin_log(thd, TRUE, query.ptr(), query.length());
}
else
{ // CREATE normal-table LIKE normal-table
// -------------------------------------
// WL40: To include to log_tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
// CREATE temp-table LIKE ...
// This case is not replicated
}
else
{ // SBR:
// -------------------------------------
// WL40: To include to tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
<To be continued>
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2771)
by knielsen@knielsen-hq.org 25 Nov '09
by knielsen@knielsen-hq.org 25 Nov '09
25 Nov '09
#At lp:maria
2771 knielsen(a)knielsen-hq.org 2009-11-25
After-merge fix for merge of MySQL 5.1.41 into MariaDB.
Manually apply fix for Bug#48340 (basically missing initialisation
of thd->lex->local_file in Load_log_event::do_apply_event())
modified:
sql/log_event.cc
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2009-11-16 20:49:51 +0000
+++ b/sql/log_event.cc 2009-11-25 09:15:05 +0000
@@ -4509,6 +4509,7 @@ int Load_log_event::do_apply_event(NET*
as the present method does not call mysql_parse().
*/
lex_start(thd);
+ thd->lex->local_file= local_fname;
mysql_reset_thd_for_next_command(thd);
if (!use_rli_only_for_errors)
1
0
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2766: Automatic merge
by noreply@launchpad.net 25 Nov '09
by noreply@launchpad.net 25 Nov '09
25 Nov '09
Merge authors:
Michael Widenius (monty)
------------------------------------------------------------
revno: 2766 [merge]
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Wed 2009-11-25 09:36:28 +0200
message:
Automatic merge
modified:
include/mysys_err.h
mysys/errors.c
mysys/my_seek.c
sql/sql_insert.cc
storage/maria/ha_maria.cc
--
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:2766)
by Michael Widenius 25 Nov '09
by Michael Widenius 25 Nov '09
25 Nov '09
#At lp:maria based on revid:monty@mysql.com-20091116153408-azpb6hq1zfp1kpvv
2766 Michael Widenius 2009-11-25 [merge]
Automatic merge
modified:
include/mysys_err.h
mysys/errors.c
mysys/my_seek.c
sql/sql_insert.cc
storage/maria/ha_maria.cc
=== modified file 'include/mysys_err.h'
--- a/include/mysys_err.h 2009-10-26 11:35:42 +0000
+++ b/include/mysys_err.h 2009-11-07 10:34:19 +0000
@@ -63,8 +63,9 @@ extern const char * NEAR globerrs[]; /*
#define EE_FILENOTFOUND 29
#define EE_FILE_NOT_CLOSED 30
#define EE_CANT_CHMOD 31
-#define EE_CANT_COPY_OWNERSHIP 32
-#define EE_ERROR_LAST 32 /* Copy last error nr */
+#define EE_CANT_SEEK 32
+#define EE_CANT_COPY_OWNERSHIP 33
+#define EE_ERROR_LAST 33 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */
=== modified file 'mysys/errors.c'
--- a/mysys/errors.c 2009-10-26 11:35:42 +0000
+++ b/mysys/errors.c 2009-11-07 10:34:19 +0000
@@ -51,6 +51,7 @@ const char * NEAR globerrs[GLOBERRS]=
"File '%s' not found (Errcode: %d)",
"File '%s' (fileno: %d) was not closed",
"Can't change mode for file '%s' to 0x%lx (Error: %d)",
+ "Can't do seek on file '%s' (Errcode: %d)",
"Warning: Can't copy ownership for file '%s' (Error: %d)"
};
@@ -93,6 +94,7 @@ void init_glob_errs()
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
EE(EE_CANT_CHMOD) = "Can't change mode for file '%s' to 0x%lx (Error: %d)";
+ EE(EE_CANT_SEEK) = "Can't do seek on file '%s' (Errcode: %d)";
EE(EE_CANT_COPY_OWNERSHIP)= "Warning: Can't copy ownership for file '%s' (Error: %d)";
}
#endif
=== modified file 'mysys/my_seek.c'
--- a/mysys/my_seek.c 2007-12-18 01:21:32 +0000
+++ b/mysys/my_seek.c 2009-11-07 10:34:19 +0000
@@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysys_priv.h"
+#include "mysys_err.h"
/*
Seek to a position in a file.
@@ -42,8 +43,7 @@
actual error.
*/
-my_off_t my_seek(File fd, my_off_t pos, int whence,
- myf MyFlags __attribute__((unused)))
+my_off_t my_seek(File fd, my_off_t pos, int whence, myf MyFlags)
{
reg1 os_off_t newpos= -1;
DBUG_ENTER("my_seek");
@@ -68,7 +68,9 @@ my_off_t my_seek(File fd, my_off_t pos,
newpos= lseek(fd, pos, whence);
if (newpos == (os_off_t) -1)
{
- my_errno=errno;
+ my_errno= errno;
+ if (MyFlags & MY_WME)
+ my_error(EE_CANT_SEEK, MYF(0), my_filename(fd), my_errno);
DBUG_PRINT("error",("lseek: %lu errno: %d", (ulong) newpos,errno));
DBUG_RETURN(MY_FILEPOS_ERROR);
}
@@ -83,7 +85,7 @@ my_off_t my_seek(File fd, my_off_t pos,
/* Tell current position of file */
/* ARGSUSED */
-my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
+my_off_t my_tell(File fd, myf MyFlags)
{
os_off_t pos;
DBUG_ENTER("my_tell");
@@ -95,7 +97,11 @@ my_off_t my_tell(File fd, myf MyFlags __
pos=lseek(fd, 0L, MY_SEEK_CUR);
#endif
if (pos == (os_off_t) -1)
- my_errno=errno;
+ {
+ my_errno= errno;
+ if (MyFlags & MY_WME)
+ my_error(EE_CANT_SEEK, MYF(0), my_filename(fd), my_errno);
+ }
DBUG_PRINT("exit",("pos: %lu", (ulong) pos));
DBUG_RETURN((my_off_t) pos);
} /* my_tell */
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_insert.cc 2009-11-07 10:34:19 +0000
@@ -3437,10 +3437,12 @@ static TABLE *create_table_from_items(TH
Create_field *cr_field;
Field *field, *def_field;
if (item->type() == Item::FUNC_ITEM)
+ {
if (item->result_type() != STRING_RESULT)
field= item->tmp_table_field(&tmp_table);
else
field= item->tmp_table_field_from_field_type(&tmp_table, 0);
+ }
else
field= create_tmp_field(thd, &tmp_table, item, item->type(),
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc 2009-10-26 11:35:42 +0000
+++ b/storage/maria/ha_maria.cc 2009-11-07 10:34:19 +0000
@@ -3341,7 +3341,7 @@ mysql_declare_plugin(maria)
MYSQL_STORAGE_ENGINE_PLUGIN,
&maria_storage_engine,
"MARIA",
- "MySQL AB",
+ "Monty Program Ab",
"Crash-safe tables with MyISAM heritage",
PLUGIN_LICENSE_GPL,
ha_maria_init, /* Plugin Init */
1
0
Hi!
19 нояб. 2009, в 02:39, Michael Widenius написал(а):
[skip]
> +#ifdef MARIADB
> + /* the plugin maturity (PLUGIN_MATURITY_XXX) */
> + /* int */
> + STRUCT_FLD(maturity, PLUGIN_MATURITY_RELEASE),
> +#endif
> +
>
> A little strange that you have to repeat the same thing many times.
> Something for the xtradb team to fix...
It is OK. PBXT contains 2 plugins, XtraDB has even more.
>
> <cut>
>
> So whats left to do:
> - See if Serg has a solution for keeping things compatible with old
> plugin
> interface.
Here is solution we discussed (in general, I hope Serg will check it
in details).
> - If mysqld is started with --old, don't show the two new columns in
> SHOW
> ENGINES. (if (!thd->variables.old_mode) ...)
SHOW ENGINE was not changed, only information schema:
+select PLUGIN_NAME, PLUGIN_MATURITY, PLUGIN_AUTH_VERSION from plugins;
+PLUGIN_NAME PLUGIN_MATURITY PLUGIN_AUTH_VERSION
+binlog Release 1.0
+MyISAM Release 1.0
+partition Release 1.0
+ARCHIVE Release 1.0
+BLACKHOLE Release 1.0
+CSV Release 1.0
+FEDERATED Unknown 1.0
+MEMORY Release 1.0
+MARIA Gamma 1.5
+MRG_MYISAM Release 1.0
+PBXT Unknown 1.0
+PBXT_STATISTICS Unknown 1.0
+InnoDB Release 1.0.4-8
+INNODB_RSEG Release 1.0
+INNODB_BUFFER_POOL_PAGES Release 1.0
+INNODB_BUFFER_POOL_PAGES_INDEX Release 1.0
+INNODB_BUFFER_POOL_PAGES_BLOB Release 1.0
+INNODB_TRX Release 1.0.4-8
+INNODB_LOCKS Release 1.0.4-8
+INNODB_LOCK_WAITS Release 1.0.4-8
+INNODB_CMP Release 1.0.4-8
+INNODB_CMP_RESET Release 1.0.4-8
+INNODB_CMPMEM Release 1.0.4-8
+INNODB_CMPMEM_RESET Release 1.0.4-8
+INNODB_TABLE_STATS Release 1.0
+INNODB_INDEX_STATS Release 1.0
+XTRADB_ENHANCEMENTS Release 1.0.4-8
I think some maturity tags should be fixed (I did my best but do not
know what authors thinks), versions could be fixed too (now just taken
from plugins numeric fields)
Also I think I should add ability of detecting of MariaDB from the old
patch, maybe some engines will want to put maria extensions in ifdef
in case it will be built against MySQLl as static.
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2770)
by knielsen@knielsen-hq.org 24 Nov '09
by knielsen@knielsen-hq.org 24 Nov '09
24 Nov '09
#At lp:maria
2770 knielsen(a)knielsen-hq.org 2009-11-24
After-merge fixes for MySQL 5.1.41 merge: PBXT result file updates.
modified:
mysql-test/suite/pbxt/r/func_group.result
mysql-test/suite/pbxt/r/grant.result
mysql-test/suite/pbxt/r/group_min_max.result
mysql-test/suite/pbxt/r/join_nested.result
mysql-test/suite/pbxt/r/negation_elimination.result
mysql-test/suite/pbxt/r/ps_grant.result
mysql-test/suite/pbxt/r/skip_grants.result
mysql-test/suite/pbxt/r/subselect.result
mysql-test/suite/pbxt/r/view_grant.result
mysql-test/suite/pbxt/t/grant.test
mysql-test/suite/pbxt/t/ps_grant.test
mysql-test/suite/pbxt/t/subselect.test
per-file messages:
mysql-test/suite/pbxt/r/func_group.result
Result file update.
mysql-test/suite/pbxt/r/grant.result
Use --sorted_result
mysql-test/suite/pbxt/r/group_min_max.result
Result file update.
mysql-test/suite/pbxt/r/join_nested.result
Result file update.
mysql-test/suite/pbxt/r/negation_elimination.result
Result file update.
mysql-test/suite/pbxt/r/ps_grant.result
Use --sorted_result
mysql-test/suite/pbxt/r/skip_grants.result
Result file update.
mysql-test/suite/pbxt/r/subselect.result
Adjust test case following error message change due to fix of Bug#48293
mysql-test/suite/pbxt/r/view_grant.result
Result file update.
mysql-test/suite/pbxt/t/grant.test
Use --sorted_result
mysql-test/suite/pbxt/t/ps_grant.test
Use --sorted_result
mysql-test/suite/pbxt/t/subselect.test
Adjust test case following error message change due to fix of Bug#48293
=== modified file 'mysql-test/suite/pbxt/r/func_group.result'
--- a/mysql-test/suite/pbxt/r/func_group.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/func_group.result 2009-11-24 10:19:08 +0000
@@ -601,7 +601,7 @@ AME AME
explain
select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY PRIMARY 0 NULL 1 Using where; Using index
+1 SIMPLE t1 index PRIMARY PRIMARY 3 NULL 15 Using where; Using index
explain
select min(a1) from t1 where a1 != 'KKK';
id select_type table type possible_keys key key_len ref rows Extra
=== modified file 'mysql-test/suite/pbxt/r/grant.result'
--- a/mysql-test/suite/pbxt/r/grant.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/grant.result 2009-11-24 10:19:08 +0000
@@ -993,9 +993,9 @@ GRANT INSERT, SELECT, CREATE, ALTER, DRO
DROP TABLE mysqltest1.t2;
SHOW GRANTS;
Grants for mysqltest_1@localhost
-GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
-GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
RENAME TABLE t1 TO t2;
RENAME TABLE t2 TO t1;
ALTER TABLE t1 RENAME TO t2;
@@ -1004,9 +1004,9 @@ REVOKE DROP, INSERT ON mysqltest1.t1 FRO
REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost;
SHOW GRANTS;
Grants for mysqltest_1@localhost
-GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
-GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
+GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
RENAME TABLE t1 TO t2;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
ALTER TABLE t1 RENAME TO t2;
=== modified file 'mysql-test/suite/pbxt/r/group_min_max.result'
--- a/mysql-test/suite/pbxt/r/group_min_max.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/group_min_max.result 2009-11-24 10:19:08 +0000
@@ -876,10 +876,10 @@ id select_type table type possible_keys
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
@@ -924,7 +924,7 @@ id select_type table type possible_keys
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
+1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
=== modified file 'mysql-test/suite/pbxt/r/join_nested.result'
--- a/mysql-test/suite/pbxt/r/join_nested.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/join_nested.result 2009-11-24 10:19:08 +0000
@@ -958,15 +958,15 @@ id select_type table type possible_keys
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 Using where
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
CREATE INDEX idx_b ON t8(b);
EXPLAIN EXTENDED
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
@@ -1008,13 +1008,13 @@ id select_type table type possible_keys
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 Using where
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
Warnings:
CREATE INDEX idx_b ON t1(b);
CREATE INDEX idx_a ON t0(a);
@@ -1058,13 +1058,13 @@ id select_type table type possible_keys
1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 Using where
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
Warnings:
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
=== modified file 'mysql-test/suite/pbxt/r/negation_elimination.result'
--- a/mysql-test/suite/pbxt/r/negation_elimination.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/negation_elimination.result 2009-11-24 10:19:08 +0000
@@ -327,7 +327,7 @@ a
0
explain select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index
+1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index
select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
a
10
@@ -342,7 +342,7 @@ a
19
explain select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index
+1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
a
5
=== modified file 'mysql-test/suite/pbxt/r/ps_grant.result'
--- a/mysql-test/suite/pbxt/r/ps_grant.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/ps_grant.result 2009-11-24 10:19:08 +0000
@@ -31,20 +31,20 @@ grant select on mysqltest.t1 to second_u
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
-GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
drop table mysqltest.t9 ;
show grants for second_user@localhost ;
Grants for second_user@localhost
-GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
show grants for second_user@localhost ;
Grants for second_user@localhost
-GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ;
my_col
=== modified file 'mysql-test/suite/pbxt/r/skip_grants.result'
--- a/mysql-test/suite/pbxt/r/skip_grants.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/skip_grants.result 2009-11-24 10:19:08 +0000
@@ -54,7 +54,7 @@ SHOW CREATE VIEW v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`` SQL SECURITY DEFINER VIEW `v3` AS select `test`.`t1`.`c` AS `c` from `t1` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('a'@'') does not exist
SHOW CREATE PROCEDURE p3;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
p3 CREATE DEFINER=`a`@`` PROCEDURE `p3`()
=== modified file 'mysql-test/suite/pbxt/r/subselect.result'
--- a/mysql-test/suite/pbxt/r/subselect.result 2009-10-16 12:45:42 +0000
+++ b/mysql-test/suite/pbxt/r/subselect.result 2009-11-24 10:19:08 +0000
@@ -75,7 +75,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
=== modified file 'mysql-test/suite/pbxt/r/view_grant.result'
--- a/mysql-test/suite/pbxt/r/view_grant.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/view_grant.result 2009-11-24 10:19:08 +0000
@@ -605,7 +605,7 @@ SHOW CREATE VIEW v;
View Create View character_set_client collation_connection
v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist
SELECT * FROM v;
ERROR HY000: The user specified as a definer ('no-such-user'@'localhost') does not exist
DROP VIEW v;
@@ -936,7 +936,7 @@ SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
@@ -944,7 +944,7 @@ SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist
@@ -952,7 +952,7 @@ SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist
DROP VIEW v1;
DROP TABLE t1;
End of 5.1 tests.
=== modified file 'mysql-test/suite/pbxt/t/grant.test'
--- a/mysql-test/suite/pbxt/t/grant.test 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/t/grant.test 2009-11-24 10:19:08 +0000
@@ -876,6 +876,7 @@ GRANT INSERT, SELECT, CREATE, ALTER, DRO
DROP TABLE mysqltest1.t2;
connect (conn42,localhost,mysqltest_1,,mysqltest1);
+--sorted_result
SHOW GRANTS;
RENAME TABLE t1 TO t2;
RENAME TABLE t2 TO t1;
@@ -887,6 +888,7 @@ REVOKE DROP, INSERT ON mysqltest1.t1 FRO
REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost;
connect (conn42,localhost,mysqltest_1,,mysqltest1);
+--sorted_result
SHOW GRANTS;
--error ER_TABLEACCESS_DENIED_ERROR
RENAME TABLE t1 TO t2;
=== modified file 'mysql-test/suite/pbxt/t/ps_grant.test'
--- a/mysql-test/suite/pbxt/t/ps_grant.test 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/t/ps_grant.test 2009-11-24 10:19:08 +0000
@@ -64,8 +64,10 @@ select a as my_col from t1;
connection default;
grant select on mysqltest.t1 to second_user@localhost
identified by 'looser' ;
+--sorted_result
show grants for second_user@localhost ;
drop table mysqltest.t9 ;
+--sorted_result
show grants for second_user@localhost ;
@@ -73,6 +75,7 @@ show grants for second_user@localhost ;
## switch to the second session
connection con3;
######## Question 1: The table t1 should be now accessible. ########
+--sorted_result
show grants for second_user@localhost ;
prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ;
=== modified file 'mysql-test/suite/pbxt/t/subselect.test'
--- a/mysql-test/suite/pbxt/t/subselect.test 2009-11-06 17:22:32 +0000
+++ b/mysql-test/suite/pbxt/t/subselect.test 2009-11-24 10:19:08 +0000
@@ -28,9 +28,9 @@ SELECT * FROM (SELECT 1 as id) b WHERE i
SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
SELECT 1 IN (SELECT 1);
SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
--- error 1221
-select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-- error ER_WRONG_USAGE
+select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
+-- error ER_WRONG_PARAMETERS_TO_PROCEDURE
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-- error ER_BAD_FIELD_ERROR
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2769)
by knielsen@knielsen-hq.org 24 Nov '09
by knielsen@knielsen-hq.org 24 Nov '09
24 Nov '09
#At lp:maria
2769 knielsen(a)knielsen-hq.org 2009-11-24
After-merge fix for MySQL 5.1.41 merge: suppress some warnings during shutdown.
The MySQL 5.1.41 merge adds back some more warning lines in error log to be
checked. So some suppressions for these new ones need to be added to the code
in MariaDB that checks for warnings during server shutdown (MySQL only checks
for warnings that occur while executing the test cases themselves).
modified:
mysql-test/mysql-test-run.pl
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-23 14:04:17 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-11-24 09:34:42 +0000
@@ -3983,6 +3983,13 @@ sub extract_warning_lines ($) {
qr/error .*connecting to master/,
qr/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/,
qr/InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal/,
+ qr/Slave: Unknown table 't1' Error_code: 1051/,
+ qr/Slave SQL:.*(Error_code: [[:digit:]]+|Query:.*)/,
+ qr/slave SQL thread aborted/,
+ qr/unknown option '--loose-/,
+ qr/unknown variable 'loose-/,
+ qr/Now setting lower_case_table_names to [02]/,
+ qr/deprecated/,
);
my $match_count= 0;
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2768)
by knielsen@knielsen-hq.org 23 Nov '09
by knielsen@knielsen-hq.org 23 Nov '09
23 Nov '09
#At lp:maria
2768 knielsen(a)knielsen-hq.org 2009-11-23
After-merge fixes for MySQL 5.1.41 merge into MariaDB.
modified:
Makefile.am
mysql-test/mysql-test-run.pl
per-file messages:
Makefile.am
Fix incorrect automerges.
mysql-test/mysql-test-run.pl
Fix bad merge.
We revert some of the MySQL-side changes, as the problem is that they may accidentally ignore some warnings in mysqld.err that should be reported.
Also remove some differences between MySQL and MariaDB where there is no semantic difference (to make future merges easier).
=== modified file 'Makefile.am'
--- a/Makefile.am 2009-11-16 20:49:51 +0000
+++ b/Makefile.am 2009-11-23 14:04:17 +0000
@@ -210,7 +210,7 @@ test-bt-fast:
test-bt-fast2:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol --report-features
+ @PERL@ ./mysql-test-run.pl $(MTR_EXTRA_OPTIONS) --force --comment=ps --ps-protocol --report-features
test-bt-debug:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@@ -219,8 +219,6 @@ test-bt-debug:
test-bt-debug-fast:
-test-bt-debug-fast:
-
# Keep these for a while
test-pl: test
test-full-pl: test-full
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-16 20:49:51 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-11-23 14:04:17 +0000
@@ -126,13 +126,9 @@ my $path_config_file; # The ge
# executables will be used by the test suite.
our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
-my $DEFAULT_SUITES= "binlog,federated,main,maria,rpl,innodb,parts";
+my $DEFAULT_SUITES= "main,binlog,federated,rpl,innodb,maria,parts";
+my $opt_suites;
-our $opt_usage;
-our $opt_list_options;
-our $opt_suites;
-our $opt_suites_default= "main,backup,backup_engines,binlog,rpl,parts"; # Default suites to run
-our $opt_script_debug= 0; # Script debugging, enable with --script-debug
our $opt_verbose= 0; # Verbose output, enable with --verbose
our $exe_mysql;
our $exe_mysqladmin;
@@ -205,10 +201,10 @@ my $opt_mark_progress;
my $opt_sleep;
-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
+my $opt_testcase_timeout= 15; # minutes
+my $opt_suite_timeout = 300; # minutes
+my $opt_shutdown_timeout= 10; # seconds
+my $opt_start_timeout = 180; # seconds
sub testcase_timeout { return $opt_testcase_timeout * 60; };
sub suite_timeout { return $opt_suite_timeout * 60; };
@@ -227,7 +223,7 @@ my $opt_strace_client;
our $opt_user = "root";
my $opt_valgrind= 0;
-our $opt_valgrind_mysqld= 0;
+my $opt_valgrind_mysqld= 0;
my $opt_valgrind_mysqltest= 0;
my @default_valgrind_args= ("--show-reachable=yes");
my @valgrind_args;
@@ -293,11 +289,6 @@ sub main {
"mysql-5.1-telco-6.2-merge" => "ndb_team",
"mysql-5.1-telco-6.3" => "ndb_team",
"mysql-6.0-ndb" => "ndb_team",
- "mysql-6.0-falcon" => "falcon_team",
- "mysql-6.0-falcon-team" => "falcon_team",
- "mysql-6.0-falcon-wlad" => "falcon_team",
- "mysql-6.0-falcon-chris" => "falcon_team",
- "mysql-6.0-falcon-kevin" => "falcon_team",
);
foreach my $dir ( reverse splitdir($basedir) ) {
@@ -1327,8 +1318,6 @@ 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;
@@ -2161,6 +2150,7 @@ 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;
+
}
@@ -2917,8 +2907,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/mariadb",
- "share/mysql", "share", "scripts"],
+ ["mysql", "sql/share", "share/mysql",
+ "share/mariadb", "share", "scripts"],
"mysql_system_tables.sql",
NOT_REQUIRED);
@@ -3870,37 +3860,35 @@ sub extract_server_log ($$) {
my ($error_log, $tname) = @_;
# Open the servers .err log file and read all lines
- # belonging to current test into @lines
+ # belonging to current tets into @lines
my $Ferr = IO::File->new($error_log)
- or return [];
- my $last_pos= $last_warning_position->{$error_log}{seek_pos};
- $Ferr->seek($last_pos, 0) if defined($last_pos);
- # If the seek fails, we will parse the whole error log, at least we will not
- # miss any warnings.
+ or mtr_error("Could not open file '$error_log' for reading: $!");
- my @lines= <$Ferr>;
- $last_warning_position->{$error_log}{seek_pos}= $Ferr->tell();
- $Ferr = undef; # Close error log file
-
- # mysql_client_test.test sends a COM_DEBUG packet to the server
- # to provoke a SAFEMALLOC leak report, ignore any warnings
- # between "Begin/end safemalloc memory dump"
- if ( grep(/Begin safemalloc memory dump:/, @lines) > 0)
+ my @lines;
+ my $found_test= 0; # Set once we've found the log of this test
+ while ( my $line = <$Ferr> )
{
- my $discard_lines= 1;
- foreach my $line ( @lines )
+ if ($found_test)
{
- if ($line =~ /Begin safemalloc memory dump:/){
- $discard_lines = 1;
- } elsif ($line =~ /End safemalloc memory dump./){
- $discard_lines = 0;
+ # If test wasn't last after all, discard what we found, test again.
+ if ( $line =~ /^CURRENT_TEST:/)
+ {
+ @lines= ();
+ $found_test= $line =~ /^CURRENT_TEST: $tname/;
}
-
- if ($discard_lines){
- $line = "ignored";
+ else
+ {
+ push(@lines, $line);
}
}
+ else
+ {
+ # Search for beginning of test, until found
+ $found_test= 1 if ($line =~ /^CURRENT_TEST: $tname/);
+ }
}
+ $Ferr = undef; # Close error log file
+
return @lines;
}
@@ -3922,16 +3910,48 @@ sub get_log_from_proc ($$) {
return $srv_log;
}
+#
# Perform a rough examination of the servers
# error log and write all lines that look
# suspicious into $error_log.warnings
#
-sub extract_warning_lines ($$) {
- my ($error_log, $tname) = @_;
+sub extract_warning_lines ($) {
+ my ($error_log) = @_;
- my @lines= extract_server_log($error_log, $tname);
+ # Open the servers .err log file and read all lines
+ # belonging to current tets into @lines
+ my $Ferr = IO::File->new($error_log)
+ or return [];
+ my $last_pos= $last_warning_position->{$error_log}{seek_pos};
+ $Ferr->seek($last_pos, 0) if defined($last_pos);
+ # If the seek fails, we will parse the whole error log, at least we will not
+ # miss any warnings.
+
+ my @lines= <$Ferr>;
+ $last_warning_position->{$error_log}{seek_pos}= $Ferr->tell();
+ $Ferr = undef; # Close error log file
+
+ # mysql_client_test.test sends a COM_DEBUG packet to the server
+ # to provoke a SAFEMALLOC leak report, ignore any warnings
+ # between "Begin/end safemalloc memory dump"
+ if ( grep(/Begin safemalloc memory dump:/, @lines) > 0)
+ {
+ my $discard_lines= 1;
+ foreach my $line ( @lines )
+ {
+ if ($line =~ /Begin safemalloc memory dump:/){
+ $discard_lines = 1;
+ } elsif ($line =~ /End safemalloc memory dump./){
+ $discard_lines = 0;
+ }
+
+ if ($discard_lines){
+ $line = "ignored";
+ }
+ }
+ }
-# Write all suspicious lines to $error_log.warnings file
+ # Write all suspicious lines to $error_log.warnings file
my $warning_log = "$error_log.warnings";
my $Fwarn = IO::File->new($warning_log, "w")
or die("Could not open file '$warning_log' for writing: $!");
@@ -4008,7 +4028,7 @@ sub start_check_warnings ($$) {
my $log_error= $mysqld->value('#log-error');
# To be communicated to the test
$ENV{MTR_LOG_ERROR}= $log_error;
- extract_warning_lines($log_error, $tinfo->{name});
+ extract_warning_lines($log_error);
my $args;
mtr_init_args(\$args);
@@ -4167,7 +4187,7 @@ sub check_warnings_post_shutdown {
my $testname_hash= { };
foreach my $mysqld ( mysqlds())
{
- my $testlist= extract_warning_lines($mysqld->value('#log-error'), "");
+ my $testlist= extract_warning_lines($mysqld->value('#log-error'));
$testname_hash->{$_}= 1 for @$testlist;
}
my @warning_tests= keys(%$testname_hash);
1
0
[Maria-developers] Rev 3195: MWL#36: Add a mysqlbinlog option to change the used database in file:///home/psergey/dev/mysql-5.1-mwl36/
by Sergey Petrunya 21 Nov '09
by Sergey Petrunya 21 Nov '09
21 Nov '09
At file:///home/psergey/dev/mysql-5.1-mwl36/
------------------------------------------------------------
revno: 3195
revision-id: psergey(a)askmonty.org-20091121155306-33ze26zq4i0o3l71
parent: build(a)mysql.com-20091105202217-biphfh9cz8m1y82k
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: mysql-5.1-mwl36
timestamp: Sat 2009-11-21 17:53:06 +0200
message:
MWL#36: Add a mysqlbinlog option to change the used database
- Port the patch to MySQL
=== modified file 'client/Makefile.am'
--- a/client/Makefile.am 2009-09-03 12:29:25 +0000
+++ b/client/Makefile.am 2009-11-21 15:53:06 +0000
@@ -107,7 +107,8 @@
rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \
log_event.cc my_decimal.h my_decimal.cc \
log_event_old.h log_event_old.cc \
- rpl_record_old.h rpl_record_old.cc
+ rpl_record_old.h rpl_record_old.cc \
+ sql_list.h rpl_filter.h sql_list.cc rpl_filter.cc
strings_src=decimal.c
link_sources:
=== modified file 'client/client_priv.h'
--- a/client/client_priv.h 2008-01-31 16:46:50 +0000
+++ b/client/client_priv.h 2009-11-21 15:53:06 +0000
@@ -80,5 +80,6 @@
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
OPT_WRITE_BINLOG, OPT_DUMP_DATE,
+ OPT_REWRITE_DB,
OPT_MAX_CLIENT_OPTION
};
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc 2009-11-03 00:52:57 +0000
+++ b/client/mysqlbinlog.cc 2009-11-21 15:53:06 +0000
@@ -35,6 +35,15 @@
#include "log_event.h"
#include "sql_common.h"
+/* Needed for Rpl_filter */
+CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci;
+
+#include "sql_string.h" // needed for Rpl_filter
+#include "sql_list.h" // needed for Rpl_filter
+#include "rpl_filter.h"
+
+Rpl_filter *binlog_filter;
+
#define BIN_LOG_HEADER_SIZE 4
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
@@ -619,6 +628,42 @@
/**
+ Print "use <db>" statement when current db is to be changed.
+
+ We have to control emiting USE statements according to rewrite-db options.
+ We have to do it here (see process_event() below) and to suppress
+ producing USE statements by corresponding log event print-functions.
+*/
+
+void print_use_stmt(PRINT_EVENT_INFO* pinfo, const char* db, size_t db_len)
+{
+ // pinfo->db is the current db.
+ // If current db is the same as required db, do nothing.
+ if (!db || !memcmp(pinfo->db, db, db_len + 1))
+ return;
+
+ // Current db and required db are different.
+ // Check for rewrite rule for required db. (Note that in a rewrite rule
+ // neither db_from nor db_to part can be empty).
+ size_t len_to= 0;
+ const char *db_to= binlog_filter->get_rewrite_db(db, &len_to);
+
+ // If there is no rewrite rule for db (in this case len_to is left = 0),
+ // printing of the corresponding USE statement is left for log event
+ // print-function.
+ if (!len_to)
+ return;
+
+ // In case of rewrite rule print USE statement for db_to
+ fprintf(result_file, "use %s%s\n", db_to, pinfo->delimiter);
+
+ // Copy the *original* db to pinfo to suppress emiting
+ // of USE stmts by log_event print-functions.
+ memcpy(pinfo->db, db, db_len + 1);
+}
+
+
+/**
Prints the given event in base64 format.
The header is printed to the head cache and the body is printed to
@@ -729,11 +774,14 @@
switch (ev_type) {
case QUERY_EVENT:
+ {
+ Query_log_event *qe= (Query_log_event*)ev;
if (strncmp(((Query_log_event*)ev)->query, "BEGIN", 5) &&
strncmp(((Query_log_event*)ev)->query, "COMMIT", 6) &&
strncmp(((Query_log_event*)ev)->query, "ROLLBACK", 8) &&
- shall_skip_database(((Query_log_event*)ev)->db))
+ shall_skip_database(qe->db))
goto end;
+ print_use_stmt(print_event_info, qe->db, qe->db_len);
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
{
if ((retval= write_event_header_and_base64(ev, result_file,
@@ -744,6 +792,7 @@
else
ev->print(result_file, print_event_info);
break;
+ }
case CREATE_FILE_EVENT:
{
@@ -861,6 +910,7 @@
if (!shall_skip_database(exlq->db))
{
+ print_use_stmt(print_event_info, exlq->db, exlq->db_len);
if (fname)
{
convert_path_to_forward_slashes(fname);
@@ -884,6 +934,13 @@
destroy_evt= FALSE;
goto end;
}
+ size_t len_to= 0;
+ const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(), &len_to);
+ if (len_to && map->rewrite_db(db_to, len_to, glob_description_event))
+ {
+ error("Could not rewrite database name");
+ goto err;
+ }
}
case WRITE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
@@ -968,14 +1025,16 @@
retval= ERROR_STOP;
end:
rec_count++;
+
/*
- Destroy the log_event object. If reading from a remote host,
- set the temp_buf to NULL so that memory isn't freed twice.
+ Destroy the log_event object.
+ MariaDB MWL#36: mainline does this:
+ If reading from a remote host,
+ set the temp_buf to NULL so that memory isn't freed twice.
+ We no longer do that, we use Rpl_filter::event_owns_temp_buf instead.
*/
if (ev)
{
- if (remote_opt)
- ev->temp_buf= 0;
if (destroy_evt) /* destroy it later if not set (ignored table map) */
delete ev;
}
@@ -1142,6 +1201,10 @@
"Used to reserve file descriptors for usage by this program",
(uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
+ {"rewrite-db", OPT_REWRITE_DB,
+ "Updates to a database with a different name than the original. \
+Example: rewrite-db='from->to'.",
+ 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -1333,6 +1396,53 @@
(find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);
}
break;
+ case OPT_REWRITE_DB: // db_from->db_to
+ {
+ /* See also handling of OPT_REPLICATE_REWRITE_DB in sql/mysqld.cc */
+ char* ptr;
+ char* key= argument; // db-from
+ char* val; // db-to
+
+ // Where key begins
+ while (*key && my_isspace(&my_charset_latin1, *key))
+ key++;
+
+ // Where val begins
+ if (!(ptr= strstr(argument, "->")))
+ {
+ sql_print_error("Bad syntax in rewrite-db: missing '->'!\n");
+ return 1;
+ }
+ val= ptr + 2;
+ while (*val && my_isspace(&my_charset_latin1, *val))
+ val++;
+
+ // Write \0 and skip blanks at the end of key
+ *ptr-- = 0;
+ while (my_isspace(&my_charset_latin1, *ptr) && ptr > argument)
+ *ptr-- = 0;
+
+ if (!*key)
+ {
+ sql_print_error("Bad syntax in rewrite-db: empty db-from!\n");
+ return 1;
+ }
+
+ // Skip blanks at the end of val
+ ptr= val;
+ while (*ptr && !my_isspace(&my_charset_latin1, *ptr))
+ ptr++;
+ *ptr= 0;
+
+ if (!*val)
+ {
+ sql_print_error("Bad syntax in rewrite-db: empty db-to!\n");
+ return 1;
+ }
+
+ binlog_filter->add_db_rewrite(key, val);
+ break;
+ }
case 'v':
if (argument == disabled_my_option)
verbose= 0;
@@ -1603,7 +1713,7 @@
If reading from a remote host, ensure the temp_buf for the
Log_event class is pointing to the incoming stream.
*/
- ev->register_temp_buf((char *) net->read_pos + 1);
+ ev->register_temp_buf((char *) net->read_pos + 1, FALSE);
Log_event_type type= ev->get_type_code();
if (glob_description_event->binlog_version >= 3 ||
@@ -2003,6 +2113,8 @@
return retval;
}
+/* Used in sql_alloc(). Inited and freed in main() */
+MEM_ROOT s_mem_root;
int main(int argc, char** argv)
{
@@ -2015,6 +2127,13 @@
my_init_time(); // for time functions
+ init_alloc_root(&s_mem_root, 16384, 0);
+ if (!(binlog_filter= new Rpl_filter))
+ {
+ error("Failed to create Rpl_filter");
+ exit(1);
+ }
+
parse_args(&argc, (char***)&argv);
defaults_argv=argv;
@@ -2101,6 +2220,8 @@
if (result_file != stdout)
my_fclose(result_file, MYF(0));
cleanup();
+ delete binlog_filter;
+ free_root(&s_mem_root, MYF(0));
free_defaults(defaults_argv);
my_free_open_file_info();
load_processor.destroy();
@@ -2112,6 +2233,12 @@
DBUG_RETURN(retval == ERROR_STOP ? 1 : 0);
}
+
+void *sql_alloc(size_t size)
+{
+ return alloc_root(&s_mem_root, size);
+}
+
/*
We must include this here as it's compiled with different options for
the server
@@ -2122,4 +2249,7 @@
#include "my_decimal.cc"
#include "log_event.cc"
#include "log_event_old.cc"
+#include "sql_string.cc"
+#include "sql_list.cc"
+#include "rpl_filter.cc"
=== modified file 'client/sql_string.cc'
--- a/client/sql_string.cc 2009-03-24 13:58:52 +0000
+++ b/client/sql_string.cc 2009-11-21 15:53:06 +0000
@@ -26,15 +26,6 @@
#ifdef HAVE_FCONVERT
#include <floatingpoint.h>
#endif
-
-/*
- The following extern declarations are ok as these are interface functions
- required by the string function
-*/
-
-extern void sql_alloc(size_t size);
-extern void sql_element_free(void *ptr);
-
#include "sql_string.h"
/*****************************************************************************
=== modified file 'client/sql_string.h'
--- a/client/sql_string.h 2007-03-08 03:27:41 +0000
+++ b/client/sql_string.h 2009-11-21 15:53:06 +0000
@@ -15,6 +15,9 @@
/* This file is originally from the mysql distribution. Coded by monty */
+#ifndef CLIENT_SQL_STRING_H
+#define CLIENT_SQL_STRING_H
+
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
@@ -353,3 +356,5 @@
return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length);
}
};
+
+#endif
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2009-10-23 03:13:42 +0000
+++ b/sql/log_event.cc 2009-11-21 15:53:06 +0000
@@ -1122,7 +1122,7 @@
goto err;
}
if ((res= read_log_event(buf, data_len, &error, description_event)))
- res->register_temp_buf(buf);
+ res->register_temp_buf(buf, TRUE);
err:
UNLOCK_MUTEX;
@@ -8041,6 +8041,111 @@
my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR));
}
+
+#ifdef MYSQL_CLIENT
+
+/*
+ Rewrite database name for the event to name specified by new_db
+ SYNOPSIS
+ new_db Database name to change to
+ new_len Length
+ desc Event describing binlog that we're writing to.
+
+ DESCRIPTION
+ Reset db name. This function assumes that temp_buf member contains event
+ representation taken from a binary log. It resets m_dbnam and m_dblen and
+ rewrites temp_buf with new db name.
+
+ RETURN
+ 0 - Success
+ other - Error
+*/
+
+int Table_map_log_event::rewrite_db(const char* new_db, size_t new_len,
+ const Format_description_log_event* desc)
+{
+ DBUG_ENTER("Table_map_log_event::rewrite_db");
+ DBUG_ASSERT(temp_buf);
+
+ uint header_len= min(desc->common_header_len,
+ LOG_EVENT_MINIMAL_HEADER_LEN) + TABLE_MAP_HEADER_LEN;
+ int len_diff;
+
+ if (!(len_diff= new_len - m_dblen))
+ {
+ memcpy((void*) (temp_buf + header_len + 1), new_db, m_dblen + 1);
+ memcpy((void*) m_dbnam, new_db, m_dblen + 1);
+ DBUG_RETURN(0);
+ }
+
+ // Create new temp_buf
+ ulong event_cur_len= uint4korr(temp_buf + EVENT_LEN_OFFSET);
+ ulong event_new_len= event_cur_len + len_diff;
+ char* new_temp_buf= (char*) my_malloc(event_new_len, MYF(MY_WME));
+
+ if (!new_temp_buf)
+ {
+ sql_print_error("Table_map_log_event::rewrite_db: "
+ "failed to allocate new temp_buf (%d bytes required)",
+ event_new_len);
+ DBUG_RETURN(-1);
+ }
+
+ // Rewrite temp_buf
+ char* ptr= new_temp_buf;
+ ulong cnt= 0;
+
+ // Copy header and change event length
+ memcpy(ptr, temp_buf, header_len);
+ int4store(ptr + EVENT_LEN_OFFSET, event_new_len);
+ ptr += header_len;
+ cnt += header_len;
+
+ // Write new db name length and new name
+ *ptr++ = new_len;
+ memcpy(ptr, new_db, new_len + 1);
+ ptr += new_len + 1;
+ cnt += m_dblen + 2;
+
+ // Copy rest part
+ memcpy(ptr, temp_buf + cnt, event_cur_len - cnt);
+
+ // Reregister temp buf
+ free_temp_buf();
+ register_temp_buf(new_temp_buf, TRUE);
+
+ // Reset m_dbnam and m_dblen members
+ m_dblen= new_len;
+
+ // m_dbnam resides in m_memory together with m_tblnam and m_coltype
+ uchar* memory= m_memory;
+ char const* tblnam= m_tblnam;
+ uchar* coltype= m_coltype;
+
+ m_memory= (uchar*) my_multi_malloc(MYF(MY_WME),
+ &m_dbnam, (uint) m_dblen + 1,
+ &m_tblnam, (uint) m_tbllen + 1,
+ &m_coltype, (uint) m_colcnt,
+ NullS);
+
+ if (!m_memory)
+ {
+ sql_print_error("Table_map_log_event::rewrite_db: "
+ "failed to allocate new m_memory (%d + %d + %d bytes required)",
+ m_dblen + 1, m_tbllen + 1, m_colcnt);
+ DBUG_RETURN(-1);
+ }
+
+ memcpy((void*)m_dbnam, new_db, m_dblen + 1);
+ memcpy((void*)m_tblnam, tblnam, m_tbllen + 1);
+ memcpy(m_coltype, coltype, m_colcnt);
+
+ my_free(memory, MYF(MY_WME));
+ DBUG_RETURN(0);
+}
+#endif /* MYSQL_CLIENT */
+
+
/*
Return value is an error code, one of:
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2009-09-28 12:41:10 +0000
+++ b/sql/log_event.h 2009-11-21 15:53:06 +0000
@@ -873,6 +873,13 @@
event's type, and its content is distributed in the event-specific fields.
*/
char *temp_buf;
+
+ /*
+ TRUE <=> this event 'owns' temp_buf and should call my_free() when done
+ with it
+ */
+ bool event_owns_temp_buf;
+
/*
Timestamp on the master(for debugging and replication of
NOW()/TIMESTAMP). It is important for queries and LOAD DATA
@@ -1014,12 +1021,17 @@
Log_event(const char* buf, const Format_description_log_event
*description_event);
virtual ~Log_event() { free_temp_buf();}
- void register_temp_buf(char* buf) { temp_buf = buf; }
+ void register_temp_buf(char* buf, bool must_free)
+ {
+ temp_buf= buf;
+ event_owns_temp_buf= must_free;
+ }
void free_temp_buf()
{
if (temp_buf)
{
- my_free(temp_buf, MYF(0));
+ if (event_owns_temp_buf)
+ my_free(temp_buf, MYF(0));
temp_buf = 0;
}
}
@@ -3310,6 +3322,8 @@
ulong get_table_id() const { return m_table_id; }
const char *get_table_name() const { return m_tblnam; }
const char *get_db_name() const { return m_dbnam; }
+ int rewrite_db(const char* new_name, size_t new_name_len,
+ const Format_description_log_event*);
#endif
virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; }
=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h 2009-10-27 13:20:34 +0000
+++ b/sql/mysql_priv.h 2009-11-21 15:53:06 +0000
@@ -91,12 +91,16 @@
#include "unireg.h"
void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size);
+#endif // MYSQL_CLIENT
+
void *sql_alloc(size_t);
void *sql_calloc(size_t);
char *sql_strdup(const char *str);
char *sql_strmake(const char *str, size_t len);
void *sql_memdup(const void * ptr, size_t size);
void sql_element_free(void *ptr);
+
+#ifndef MYSQL_CLIENT
char *sql_strmake_with_convert(const char *str, size_t arg_length,
CHARSET_INFO *from_cs,
size_t max_res_length,
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-11-03 00:52:57 +0000
+++ b/sql/mysqld.cc 2009-11-21 15:53:06 +0000
@@ -7970,6 +7970,7 @@
}
case (int)OPT_REPLICATE_REWRITE_DB:
{
+ /* See also OPT_REWRITE_DB handling in client/mysqlbinlog.cc */
char* key = argument,*p, *val;
if (!(p= strstr(argument, "->")))
=== modified file 'sql/rpl_filter.cc'
--- a/sql/rpl_filter.cc 2009-09-10 07:40:57 +0000
+++ b/sql/rpl_filter.cc 2009-11-21 15:53:06 +0000
@@ -45,6 +45,7 @@
}
+#ifndef MYSQL_CLIENT
/*
Returns true if table should be logged/replicated
@@ -129,6 +130,7 @@
!do_table_inited && !wild_do_table_inited);
}
+#endif
/*
Checks whether a db matches some do_db and ignore_db rules
@@ -514,6 +516,13 @@
}
+bool
+Rpl_filter::rewrite_db_is_empty()
+{
+ return rewrite_db.is_empty();
+}
+
+
const char*
Rpl_filter::get_rewrite_db(const char* db, size_t *new_len)
{
=== modified file 'sql/rpl_filter.h'
--- a/sql/rpl_filter.h 2007-05-10 09:59:39 +0000
+++ b/sql/rpl_filter.h 2009-11-21 15:53:06 +0000
@@ -42,7 +42,9 @@
/* Checks - returns true if ok to replicate/log */
- bool tables_ok(const char* db, TABLE_LIST* tables);
+#ifndef MYSQL_CLIENT
+ bool tables_ok(const char* db, TABLE_LIST *tables);
+#endif
bool db_ok(const char* db);
bool db_ok_with_wild_table(const char *db);
@@ -69,6 +71,7 @@
void get_wild_do_table(String* str);
void get_wild_ignore_table(String* str);
+ bool rewrite_db_is_empty();
const char* get_rewrite_db(const char* db, size_t *new_len);
I_List<i_string>* get_do_db();
=== modified file 'sql/sql_string.cc'
--- a/sql/sql_string.cc 2009-07-31 17:14:52 +0000
+++ b/sql/sql_string.cc 2009-11-21 15:53:06 +0000
@@ -37,6 +37,9 @@
#include "sql_string.h"
+#ifdef MYSQL_CLIENT
+#error Attempt to use server-side sql_string on client. Use client/sql_string.cc
+#endif
/*****************************************************************************
** String functions
*****************************************************************************/
=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h 2009-07-31 17:14:52 +0000
+++ b/sql/sql_string.h 2009-11-21 15:53:06 +0000
@@ -1,3 +1,5 @@
+#ifndef MYSQL_SQL_STRING_H_INCLUDED
+#define MYSQL_SQL_STRING_H_INCLUDED
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -23,6 +25,10 @@
#define NOT_FIXED_DEC 31
#endif
+#ifdef MYSQL_CLIENT
+#error Attempt to use server-side sql_string on client. Use client/sql_string.h
+#endif
+
class String;
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
@@ -389,3 +395,5 @@
{
return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;
}
+
+#endif // MYSQL_SQL_STRING_H_INCLUDED
=== modified file 'sql/thr_malloc.cc'
--- a/sql/thr_malloc.cc 2009-06-29 14:00:47 +0000
+++ b/sql/thr_malloc.cc 2009-11-21 15:53:06 +0000
@@ -59,11 +59,13 @@
}
+#ifndef MYSQL_CLIENT
void *sql_alloc(size_t Size)
{
MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC);
return alloc_root(root,Size);
}
+#endif
void *sql_calloc(size_t size)
1
0
[Maria-developers] Updated (by Sanja): Add info to engine description (61)
by worklog-noreply@askmonty.org 19 Nov '09
by worklog-noreply@askmonty.org 19 Nov '09
19 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add info to engine description
CREATION DATE..: Mon, 02 Nov 2009, 22:58
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 61 (http://askmonty.org/worklog/?tid=61)
VERSION........: Server-5.1
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 5 (hours remain)
ORIG. ESTIMATE.: 5
PROGRESS NOTES:
-=-=(Sanja - Fri, 20 Nov 2009, 00:18)=-=-
High-Level Specification modified.
--- /tmp/wklog.61.old.19932 2009-11-20 00:18:57.000000000 +0200
+++ /tmp/wklog.61.new.19932 2009-11-20 00:18:57.000000000 +0200
@@ -1 +1,9 @@
+There is two time of engines/plugins build in and loadable. For both we add
+structure with additional information
+1) for build in we will modify MYSQL_PLUGIN_STATIC to collect that strucures in
+array also with builtin_*_plugin structures.
+
+2) for dinamic plugins we check in plugin_dl_add() if the pligin defins maria
+simbols we read info in if no then fill maturety with UNKNOWN and version with
+empty string.
-=-=(Sanja - Thu, 19 Nov 2009, 23:56)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.19057 2009-11-19 23:56:48.000000000 +0200
+++ /tmp/wklog.61.new.19057 2009-11-19 23:56:48.000000000 +0200
@@ -1,8 +1,6 @@
-Add additional information about engine and show it in SHOW ENGINES:
+Add additional information about engine and show it in information schema:
-License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
-
-Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
+Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
-=-=(Hakan - Thu, 05 Nov 2009, 21:09)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.22402 2009-11-05 21:09:08.000000000 +0200
+++ /tmp/wklog.61.new.22402 2009-11-05 21:09:08.000000000 +0200
@@ -1,8 +1,8 @@
Add additional information about engine and show it in SHOW ENGINES:
-License (PROPRIETARY, GPL, BSD) (it is present just have to be shown)
+License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
-Version (just string from engine developer like "0.99 betta", better if it will
+Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
DESCRIPTION:
Add additional information about engine and show it in information schema:
Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
HIGH-LEVEL SPECIFICATION:
There is two time of engines/plugins build in and loadable. For both we add
structure with additional information
1) for build in we will modify MYSQL_PLUGIN_STATIC to collect that strucures in
array also with builtin_*_plugin structures.
2) for dinamic plugins we check in plugin_dl_add() if the pligin defins maria
simbols we read info in if no then fill maturety with UNKNOWN and version with
empty string.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Sanja): Add info to engine description (61)
by worklog-noreply@askmonty.org 19 Nov '09
by worklog-noreply@askmonty.org 19 Nov '09
19 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add info to engine description
CREATION DATE..: Mon, 02 Nov 2009, 22:58
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 61 (http://askmonty.org/worklog/?tid=61)
VERSION........: Server-5.1
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 5 (hours remain)
ORIG. ESTIMATE.: 5
PROGRESS NOTES:
-=-=(Sanja - Fri, 20 Nov 2009, 00:18)=-=-
High-Level Specification modified.
--- /tmp/wklog.61.old.19932 2009-11-20 00:18:57.000000000 +0200
+++ /tmp/wklog.61.new.19932 2009-11-20 00:18:57.000000000 +0200
@@ -1 +1,9 @@
+There is two time of engines/plugins build in and loadable. For both we add
+structure with additional information
+1) for build in we will modify MYSQL_PLUGIN_STATIC to collect that strucures in
+array also with builtin_*_plugin structures.
+
+2) for dinamic plugins we check in plugin_dl_add() if the pligin defins maria
+simbols we read info in if no then fill maturety with UNKNOWN and version with
+empty string.
-=-=(Sanja - Thu, 19 Nov 2009, 23:56)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.19057 2009-11-19 23:56:48.000000000 +0200
+++ /tmp/wklog.61.new.19057 2009-11-19 23:56:48.000000000 +0200
@@ -1,8 +1,6 @@
-Add additional information about engine and show it in SHOW ENGINES:
+Add additional information about engine and show it in information schema:
-License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
-
-Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
+Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
-=-=(Hakan - Thu, 05 Nov 2009, 21:09)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.22402 2009-11-05 21:09:08.000000000 +0200
+++ /tmp/wklog.61.new.22402 2009-11-05 21:09:08.000000000 +0200
@@ -1,8 +1,8 @@
Add additional information about engine and show it in SHOW ENGINES:
-License (PROPRIETARY, GPL, BSD) (it is present just have to be shown)
+License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
-Version (just string from engine developer like "0.99 betta", better if it will
+Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
DESCRIPTION:
Add additional information about engine and show it in information schema:
Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
HIGH-LEVEL SPECIFICATION:
There is two time of engines/plugins build in and loadable. For both we add
structure with additional information
1) for build in we will modify MYSQL_PLUGIN_STATIC to collect that strucures in
array also with builtin_*_plugin structures.
2) for dinamic plugins we check in plugin_dl_add() if the pligin defins maria
simbols we read info in if no then fill maturety with UNKNOWN and version with
empty string.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Sanja): Add info to engine description (61)
by worklog-noreply@askmonty.org 19 Nov '09
by worklog-noreply@askmonty.org 19 Nov '09
19 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add info to engine description
CREATION DATE..: Mon, 02 Nov 2009, 22:58
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 61 (http://askmonty.org/worklog/?tid=61)
VERSION........: Server-5.1
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 5 (hours remain)
ORIG. ESTIMATE.: 5
PROGRESS NOTES:
-=-=(Sanja - Thu, 19 Nov 2009, 23:56)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.19057 2009-11-19 23:56:48.000000000 +0200
+++ /tmp/wklog.61.new.19057 2009-11-19 23:56:48.000000000 +0200
@@ -1,8 +1,6 @@
-Add additional information about engine and show it in SHOW ENGINES:
+Add additional information about engine and show it in information schema:
-License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
-
-Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
+Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
-=-=(Hakan - Thu, 05 Nov 2009, 21:09)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.22402 2009-11-05 21:09:08.000000000 +0200
+++ /tmp/wklog.61.new.22402 2009-11-05 21:09:08.000000000 +0200
@@ -1,8 +1,8 @@
Add additional information about engine and show it in SHOW ENGINES:
-License (PROPRIETARY, GPL, BSD) (it is present just have to be shown)
+License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
-Version (just string from engine developer like "0.99 betta", better if it will
+Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
DESCRIPTION:
Add additional information about engine and show it in information schema:
Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Sanja): Add info to engine description (61)
by worklog-noreply@askmonty.org 19 Nov '09
by worklog-noreply@askmonty.org 19 Nov '09
19 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add info to engine description
CREATION DATE..: Mon, 02 Nov 2009, 22:58
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-BackLog
TASK ID........: 61 (http://askmonty.org/worklog/?tid=61)
VERSION........: Server-5.1
STATUS.........: Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 5 (hours remain)
ORIG. ESTIMATE.: 5
PROGRESS NOTES:
-=-=(Sanja - Thu, 19 Nov 2009, 23:56)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.19057 2009-11-19 23:56:48.000000000 +0200
+++ /tmp/wklog.61.new.19057 2009-11-19 23:56:48.000000000 +0200
@@ -1,8 +1,6 @@
-Add additional information about engine and show it in SHOW ENGINES:
+Add additional information about engine and show it in information schema:
-License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
-
-Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
+Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
-=-=(Hakan - Thu, 05 Nov 2009, 21:09)=-=-
High Level Description modified.
--- /tmp/wklog.61.old.22402 2009-11-05 21:09:08.000000000 +0200
+++ /tmp/wklog.61.new.22402 2009-11-05 21:09:08.000000000 +0200
@@ -1,8 +1,8 @@
Add additional information about engine and show it in SHOW ENGINES:
-License (PROPRIETARY, GPL, BSD) (it is present just have to be shown)
+License (PROPRIETARY, GPL, BSD) (it is already present, just have to be shown)
Maturity (TEST, ALPHA, BETA, GAMMA, RELEASE)
-Version (just string from engine developer like "0.99 betta", better if it will
+Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
DESCRIPTION:
Add additional information about engine and show it in information schema:
Maturity (UNKNOWN, TEST, ALPHA, BETA, GAMMA, RELEASE)
Version (just string from engine developer like "0.99 beta", better if it will
be monotonically increasing in terms of alphabetical sort).
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
Hi!
19 нояб. 2009, в 14:44, Michael Widenius написал(а):
>
> Hi!
>
>>>>>> "Oleksandr" == Oleksandr Byelkin <sanja(a)askmonty.org> writes:
>
> Oleksandr> Hi!
> Oleksandr> Here is try to implement CRETE TABLE options. Here is
> only for TABLE,
> Oleksandr> and no real support from the engine side, but the result
> looks like:
>
> Oleksandr> create table t1 (a int) ttt = xxx;
> Oleksandr> Warnings:
> Oleksandr> Warning 1639 Unused option 'ttt' (value 'xxx') of table
> 'test'.'t1'
>
> Oleksandr> I publish it to let other to catch problems on early stage.
>
>
> After some thinking, I have a comment that will affect the usage of
> this:
>
> To make the extra options easy to use, they should linked list should
> be added to the appropriate objects when the table is opened:
>
> - Table options should be added to the TABLE objects
> - Field options to the related Field object
> - Key options to the related KEY object.
>
> This will cause same code changes, but will make the usage of these
> much easier, both in the handler but also in information schemas.
>
> Lets talk about this on IRC on Friday when I am back.
OK. Just I have one note - TABLE is internal server object and as well
as referencing THD & Co it makes engine release dependent
(incompatible with other releases where the classes maybe changed).
1
0
Hi Daniel,
Here is the best I have for the release notes for 5.1.39:
1. My manually extracted "relevant" information from the bzr history.
2. Raw bzr dump of changes (short).
3. Raw bzr dump of changes (long).
Hope this helps.
- Kristian.
-----------------------------------------------------------------------
Changes:
- Includes MySQL 5.1.39 (check MySQL release notes for details of changes
since MySQL 5.1.38)
- Includes XtraDB 8 (check XtraDB release notes for details of changes since
XtraDB 6)
- RPMs for Centos 5 now available.
- Includes FederatedX as replacement for old Federated storage engine.
- Test suite speedups.
- Binary tarballs now build on Ubuntu Hardy, so now depends on glibc 2.7
rather than 2.9 and so should work on more systems.
- Some (still not all) compiler warnings eliminated.
Bug fixes:
- MBug#443014: Too many 'skipped' messages in mysql-test-run
-----------------------------------------------------------------------
You have 144 extra revision(s):
2768: knielsen@knielsen... 2009-11-14 XtraDB 8 after-merge fix: Fix windows ...
2767: knielsen@knielsen... 2009-11-14 XtraDB 8 after-merge fixes: fix forgot...
2766: knielsen@knielsen... 2009-11-13 XtraDB 8 after-merge fix: Add missing ...
2765: knielsen@knielsen... 2009-11-13 [merge] Merge XtraDB 8.
2763.1.2: knielsen@knielsen... 2009-11-10 Fix double declaration of Makefi...
2763.1.1: knielsen@knielsen... 2009-11-10 Apply Monty's fix for warning ab...
2764: knielsen@knielsen... 2009-11-13 [merge] Merge XtraDB 8 into MariaDB.
0.6.5: Aleksandr Kuzminsky 2009-09-30 Sync with rev. 107
0.6.4: Aleksandr Kuzminsky 2009-09-23 Sync with rev.105
0.6.3: Aleksandr Kuzminsky 2009-09-07 sync with rev.96
2763: knielsen@knielsen... 2009-11-07 Bump revision number for MariaDB 5.1.3...
2762: knielsen@knielsen... 2009-11-07 Result file update for new FederatedX
2761: knielsen@knielsen... 2009-11-06 [merge] Merge 5.1-release branch into ...
2737.1.59: knielsen@knielsen... 2009-11-05 Fix running test suite from ins...
2737.1.58: Arjen Lentz 2009-10-31 libevent fixup required for Debian 4 (Etch)
2760: knielsen@knielsen... 2009-11-06 [merge] Merge Mysql 5.1.39 merge into ...
2743.1.5: Michael Widenius 2009-11-02 Fixed problem with schema tables and...
2743.1.4: knielsen@knielsen... 2009-10-16 When running with --skip-safemal...
2743.1.3: knielsen@knielsen... 2009-10-16 After-merge fixes for MySQL 5.1....
2743.1.2: knielsen@knielsen... 2009-10-15 [merge] Merge with latest MariaD...
2743.1.1: knielsen@knielsen... 2009-10-15 [merge] Merge MySQL 5.1.39 into ...
2502.733.86: Jonathan Perkin 2009-09-04 Install mysqld.lib
2502.733.85: Jonathan Perkin 2009-09-03 [merge] Merge from mysql-5.1.38-...
2502.733.84: Georgi Kodinov 2009-09-02 [merge] null merge of 5.0 fixes b...
1810.3943.19: Georgi Kodinov 2009-09-02 Backported the --parallel=str ...
1810.3943.18: Georgi Kodinov 2009-09-02 [merge] merge
1810.3948.2: Georgi Kodinov 2009-09-02 [merge] merge
1810.3948.1: Georgi Kodinov 2009-09-02 moved version to 5.0-main
2502.733.83: Georgi Kodinov 2009-09-02 fixed a valgrind warning in parti...
2502.733.82: Georgi Kodinov 2009-09-02 [merge] automerge
2502.774.2: Davi Arnaut 2009-09-02 [merge] Manual merge.
1810.3943.17: Davi Arnaut 2009-09-02 Post-merge fix. Observe C decla...
1810.3943.16: Tatiana A. Nurnberg 2009-08-31 [merge] auto-merge
2502.774.1: Davi Arnaut 2009-09-02 Increase thread stack size on HP-UX...
2502.733.81: Georgi Kodinov 2009-09-02 fixed a valgrind warning in parti...
2502.733.80: Georgi Kodinov 2009-09-02 Fixed win32 compilation warnings
2502.733.79: Georgi Kodinov 2009-09-02 fixed compilation warnings
2502.733.78: Mattias Jonsson 2009-09-01 [merge] merge to update with lat...
2502.773.2: Georgi Kodinov 2009-09-01 Fixed a problem in how BUILD/che...
2502.773.1: Davi Arnaut 2009-09-01 Bug#45611: Minor code cleanup
2502.733.77: Mattias Jonsson 2009-09-01 post push fix for bug#20577 and ...
2502.733.76: Mattias Jonsson 2009-09-01 Post fix patch for bug#20577 and...
2502.733.75: Tatiana A. Nurnberg 2009-08-31 [merge] auto-merge
2502.772.4: Georgi Kodinov 2009-08-31 [merge] automerge
1810.3947.4: Georgi Kodinov 2009-08-31 [merge] merge 5.0-main -> 5.0...
2502.772.3: Georgi Kodinov 2009-08-31 [merge] automerge 5.1-main -> 5....
2502.772.2: Georgi Kodinov 2009-08-31 [merge] automerge
1810.3947.3: Georgi Kodinov 2009-08-27 Bug #46749: Segfault in add_k...
2502.772.1: Anurag Shekhar 2009-08-31 [merge] merging bugfix from 5.0
1810.3947.2: Anurag Shekhar 2009-08-31 [merge] merging with changes ...
1810.3947.1: Anurag Shekhar 2009-08-24 Bug #44723 Larger read_buffer...
2502.733.74: Tatiana A. Nurnberg 2009-08-31 [merge] manual merge
1810.3943.15: Tatiana A. Nurnberg 2009-08-31 Bug#35132: MySQLadmin --w...
2502.733.73: Dao-Gang.Qu(a)sun.com 2009-08-31 Bug #44331 Restore of datab...
2502.733.72: Staale Smedseng 2009-08-30 [merge] Merge from 5.1-bugteam
2502.770.3: Alexey Kopytov 2009-08-30 [merge] Automerge.
2502.771.1: Alexey Kopytov 2009-08-30 Bug #46607: Assertion failed: ...
2502.770.2: Dao-Gang.Qu(a)sun.com 2009-08-29 Bug #44331 Restore of data...
2502.770.1: Davi Arnaut 2009-08-28 Reduce test case runtime.
2502.733.71: Staale Smedseng 2009-08-28 [merge] Merge from 5.0 for 43414
1810.3943.14: Staale Smedseng 2009-08-28 Bug #43414 Parenthesis (and o...
2502.733.70: Davi Arnaut 2009-08-28 Fix for a few assorted compiler warn...
2502.733.69: Mattias Jonsson 2009-08-28 [merge] merge
2502.767.3: Mattias Jonsson 2009-08-28 [merge] Manual merge between bu...
2502.769.1: Mattias Jonsson 2009-08-26 Bug#46362: Endpoint should be...
2502.767.2: Mattias Jonsson 2009-08-26 [merge] merge
2502.768.1: Mattias Jonsson 2009-08-07 Bug#32430: 'show innodb statu...
2502.767.1: Mattias Jonsson 2009-08-26 [merge] merge
2502.766.1: Mattias Jonsson 2009-08-26 Bug#20577: Partitions: use of...
2502.733.68: Alfranio Correia 2009-08-28 [merge] merge mysql-5.0-bugteam...
1810.3943.13: Alfranio Correia 2009-08-28 [merge] auto-merge mysql-5.0...
1810.3789.10: Alfranio Correia 2009-08-27 BUG#46861 Auto-closing of ...
2502.733.67: Alfranio Correia 2009-08-27 BUG#46864 Incorrect update of I...
2502.733.66: Sergey Glukhov 2009-08-27 [merge] 5.0-bugteam->5.1-bugteam ...
1810.3943.12: Sergey Glukhov 2009-08-27 Bug#46184 Crash, SELECT ... FR...
2502.733.65: Alfranio Correia 2009-08-27 Post-fix for BUG#28976.
2502.733.64: Georgi Kodinov 2009-08-27 [merge] merged 5.0-bugteam -> 5.1...
1810.3943.11: Georgi Kodinov 2009-08-24 Bug #37044: Read overflow in o...
1810.3943.10: Georgi Kodinov 2009-08-19 Bug #46807: subselect test fai...
2502.733.63: Alfranio Correia 2009-08-27 BUG#28976 Mixing trans and non-...
2502.733.62: Davi Arnaut 2009-08-24 Bug#45261: Crash, stored procedure +...
2502.733.61: Alfranio Correia 2009-08-24 [merge] auto-merge mysql-5.1-bu...
2502.765.1: Alfranio Correia 2009-08-19 BUG#45694 Deadlock in replicat...
2502.733.60: Alfranio Correia 2009-08-24 [merge] auto-merge mysql-5.1-bu...
2502.764.1: Alfranio Correia 2009-08-13 BUG#46130 Slave does not corre...
2502.733.59: Mattias Jonsson 2009-08-21 [merge] merge
2502.763.1: Mattias Jonsson 2009-08-21 Bug#46639: 1030 (HY000): Got er...
2502.733.58: Georgi Kodinov 2009-08-21 [merge] reverted the fix for bug ...
1810.3943.9: Georgi Kodinov 2009-08-21 [merge] automerge
1810.3946.1: Martin Hansson 2009-08-21 [merge] Merge.
1810.3943.8: Georgi Kodinov 2009-08-21 Revert of the fix for bug #46019.
2502.733.57: Martin Hansson 2009-08-21 [merge] Merge.
2502.762.1: Martin Hansson 2009-08-20 [merge] Bug#46616: Merge
1810.3945.1: Martin Hansson 2009-08-20 Bug#46616: Assertion `!table-...
2502.733.56: Ramil Kalimullin 2009-08-21 Fix for bug #46456 [Ver->Prg]: ...
2502.733.55: Georgi Kodinov 2009-08-20 [merge] merge of bug #46019 to 5....
1810.3943.7: Georgi Kodinov 2009-08-19 Bug #46019: ERROR 1356 When sel...
2502.733.54: Georgi Kodinov 2009-07-09 Bug #45962: memory leak after 'so...
2502.733.53: Georgi Kodinov 2009-08-19 [merge] null merge of the backpor...
1810.3943.6: Georgi Kodinov 2009-08-19 backport of Chad's fix for bug ...
2502.733.52: Georgi Kodinov 2009-08-17 [merge] automere
1810.3943.5: Georgi Kodinov 2009-08-17 [merge] automerge
2502.733.51: Georgi Kodinov 2009-08-17 [merge] automerge
2502.733.50: Ramil Kalimullin 2009-08-14 [merge] Automerge
2502.761.1: Davi Arnaut 2009-08-13 [merge] Merge from mysql-5.0-bugteam.
1810.3943.4: Davi Arnaut 2009-08-13 Bug#46013: rpl_extraColmaster_my...
2502.733.49: Ramil Kalimullin 2009-08-14 Fix for bug #46614: Assertion i...
2502.733.48: Li-Bing.Song(a)sun.com 2009-08-13 BUG#45574 CREATE IF NOT EXI...
2502.733.47: Mattias Jonsson 2009-08-12 [merge] merge
2502.760.2: Konstantin Osipov 2009-08-12 A follow up patch for the fol...
2502.760.1: Konstantin Osipov 2009-08-12 A follow up patch for Bug#458...
2502.733.46: Mattias Jonsson 2009-08-12 [merge] manual merge
2502.759.1: Mattias Jonsson 2009-08-06 Bug#46478: timestamp field inco...
2502.733.45: Mattias Jonsson 2009-08-12 [merge] merge
2502.758.1: Mattias Jonsson 2009-01-08 Bug#39893: Crash if select on a...
2502.733.44: Li-Bing.Song(a)sun.com 2009-08-12 [merge] Manual Merge
1810.3943.3: Li-Bing.Song(a)sun.com 2009-08-12 BUG#45516 SQL thread does...
2502.733.43: Davi Arnaut 2009-08-11 [merge] Merge from mysql-5.0-bugteam.
2759: sanja(a)askmonty.org 2009-11-03 Add federatedx files for build
2758: sanja(a)askmonty.org 2009-11-03 Make federated compiling under windows
2757: sanja(a)askmonty.org 2009-11-02 Fixed federatedx building under windows
2756: Hakan Kuecuekyilmaz 2009-11-01 [merge] Merge.
2754.1.2: Hakan Kuecuekyilmaz 2009-11-01 [merge] Merge.
2754.1.1: Hakan Kuecuekyilmaz 2009-11-01 BUILD/compile-dist && make dist w...
2755: sanja(a)askmonty.org 2009-10-31 Compilation under windows x64 made possi...
2754: Michael Widenius 2009-10-30 [merge] Merge with 5.1-release
2737.1.57: Sergey Petrunya 2009-10-30 Dummy change to push the release tag.
2753: Michael Widenius 2009-10-30 [merge] Merge of FederatedX code
2751.1.2: Michael Widenius 2009-10-30 Added ignore for symlinked build file
2751.1.1: Michael Widenius 2009-10-30 Added federatedx storage engine
2752: Sergey Petrunya 2009-10-29 MWL#17: Table elimination
2751: Michael Widenius 2009-10-29 Compile by default MySQL clients with libm...
2750: Michael Widenius 2009-10-28 Added missing 'source' command.
2749: Michael Widenius 2009-10-28 Speed up of test suite:
2748: Michael Widenius 2009-10-26 [merge] Automatic merge with maria-merge
2747: Michael Widenius 2009-10-26 Fixed compiler warning message
2746: Michael Widenius 2009-10-14 [merge] Automatic merge with 5.1-merge
2745: Michael Widenius 2009-10-13 Removed not used declarations
2744: Michael Widenius 2009-10-13 Force restart before maria_showlog_error t...
2743: knielsen@knielsen... 2009-10-06 [merge] Merge a bunch of small fixes f...
2742: Michael Widenius 2009-10-06 [merge] Merge with bug fix
2740.1.2: Michael Widenius 2009-10-06 [merge] Merge with trunk
2740.1.1: Michael Widenius 2009-10-06 Don't call _ma_decrement_open_count(...
2741: knielsen@knielsen... 2009-10-05 MBug#443014: Too many 'skipped' messag...
-----------------------------------------------------------------------
You have 144 extra revision(s):
------------------------------------------------------------
revno: 2768
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Sat 2009-11-14 10:53:18 +0100
message:
XtraDB 8 after-merge fix: Fix windows build.
------------------------------------------------------------
revno: 2767
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Sat 2009-11-14 02:15:03 +0100
message:
XtraDB 8 after-merge fixes: fix forgotten manual merge of patch file.
------------------------------------------------------------
revno: 2766
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Fri 2009-11-13 23:53:04 +0100
message:
XtraDB 8 after-merge fix: Add missing header to `make dist`.
------------------------------------------------------------
revno: 2765 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Fri 2009-11-13 22:27:39 +0100
message:
Merge XtraDB 8.
------------------------------------------------------------
revno: 2763.1.2
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1-release
timestamp: Tue 2009-11-10 14:55:48 +0100
message:
Fix double declaration of Makefile variable for FederatedX.
This eliminates a warning from Automake about the double declaration.
------------------------------------------------------------
revno: 2763.1.1
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1-release
timestamp: Tue 2009-11-10 09:35:39 +0100
message:
Apply Monty's fix for warning about wrong FEDERATED typecode.
------------------------------------------------------------
revno: 2764 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Fri 2009-11-13 22:26:08 +0100
message:
Merge XtraDB 8 into MariaDB.
------------------------------------------------------------
revno: 0.6.5
committer: Aleksandr Kuzminsky <aleksandr.kuzminsky(a)percona.com>
branch nick: release-8
timestamp: Wed 2009-09-30 18:33:51 +0000
message:
Sync with rev. 107
------------------------------------------------------------
revno: 0.6.4
committer: Aleksandr Kuzminsky <aleksandr.kuzminsky(a)percona.com>
branch nick: release-8
timestamp: Wed 2009-09-23 00:06:02 +0000
message:
Sync with rev.105
------------------------------------------------------------
revno: 0.6.3
committer: Aleksandr Kuzminsky <aleksandr.kuzminsky(a)percona.com>
branch nick: percona-xtradb
timestamp: Mon 2009-09-07 10:22:53 +0000
message:
sync with rev.96
------------------------------------------------------------
revno: 2763
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1-release
timestamp: Sat 2009-11-07 16:56:51 +0100
message:
Bump revision number for MariaDB 5.1.39 release.
------------------------------------------------------------
revno: 2762
committer: knielsen(a)knielsen-hq.org
branch nick: tmp
timestamp: Sat 2009-11-07 07:29:10 +0100
message:
Result file update for new FederatedX
------------------------------------------------------------
revno: 2761 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: tmp
timestamp: Fri 2009-11-06 18:24:38 +0100
message:
Merge 5.1-release branch into MariaDB trunk.
------------------------------------------------------------
revno: 2737.1.59
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1-release
timestamp: Thu 2009-11-05 14:40:01 +0100
message:
Fix running test suite from installed package.
Some files are in different locations in this case.
------------------------------------------------------------
revno: 2737.1.58
committer: Arjen Lentz <arjen(a)openquery.com>
branch nick: mariadb-openquery-fixes
timestamp: Sat 2009-10-31 15:29:16 +1000
message:
libevent fixup required for Debian 4 (Etch)
Also missing copyright for copied macros.
Fix by Antony Curtis.
------------------------------------------------------------
revno: 2760 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: tmp
timestamp: Fri 2009-11-06 18:22:32 +0100
message:
Merge Mysql 5.1.39 merge into MariaDB trunk
------------------------------------------------------------
revno: 2743.1.5
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mariadb-bug
timestamp: Mon 2009-11-02 11:30:21 +0200
message:
Fixed problem with schema tables and DECIMAL
------------------------------------------------------------
revno: 2743.1.4
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Fri 2009-10-16 17:01:36 +0200
message:
When running with --skip-safemalloc, still do some basic, but cheap, overrun checks.
This greatly helps with eg. slow hosts in Buildbot.
------------------------------------------------------------
revno: 2743.1.3
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Fri 2009-10-16 14:45:42 +0200
message:
After-merge fixes for MySQL 5.1.39 merge.
Some pbxt test suite files needed updating due to similar changes after
bugfixes in MySQL 5.1.39.
------------------------------------------------------------
revno: 2743.1.2 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Thu 2009-10-15 23:52:31 +0200
message:
Merge with latest MariaDB 5.1 trunk.
------------------------------------------------------------
revno: 2743.1.1 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Thu 2009-10-15 23:38:29 +0200
message:
Merge MySQL 5.1.39 into MariaDB 5.1.
------------------------------------------------------------
revno: 2502.733.86
committer: Jonathan Perkin <jperkin(a)sun.com>
branch nick: mysql-5.1.39-release
timestamp: Fri 2009-09-04 17:45:07 +0200
message:
Install mysqld.lib
------------------------------------------------------------
revno: 2502.733.85 [merge]
committer: Jonathan Perkin <jperkin(a)sun.com>
branch nick: mysql-5.1
timestamp: Thu 2009-09-03 01:48:06 +0200
message:
Merge from mysql-5.1.38-release
------------------------------------------------------------
revno: 2502.733.84 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-vg-5.1-bugteam
timestamp: Wed 2009-09-02 18:45:33 +0300
message:
null merge of 5.0 fixes backported from 5.1
------------------------------------------------------------
revno: 1810.3943.19
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.0-bugteam
timestamp: Wed 2009-09-02 16:36:52 +0300
message:
Backported the --parallel=str option from mtr2 for backward compatibility
with the newer pb2 testing environments
------------------------------------------------------------
revno: 1810.3943.18 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.0-bugteam
timestamp: Wed 2009-09-02 16:07:52 +0300
message:
merge
------------------------------------------------------------
revno: 1810.3948.2 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.0-bugteam
timestamp: Wed 2009-09-02 15:33:18 +0300
message:
merge
------------------------------------------------------------
revno: 1810.3948.1
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.0-bugteam
timestamp: Wed 2009-09-02 13:23:37 +0300
message:
moved version to 5.0-main
------------------------------------------------------------
revno: 2502.733.83
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-vg-5.1-bugteam
timestamp: Wed 2009-09-02 18:42:08 +0300
message:
fixed a valgrind warning in partition_pruning
------------------------------------------------------------
revno: 2502.733.82 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-vg-5.1-bugteam
timestamp: Wed 2009-09-02 15:22:32 +0300
message:
automerge
------------------------------------------------------------
revno: 2502.774.2 [merge]
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: mysql-5.1-bugteam
timestamp: Wed 2009-09-02 09:12:18 -0300
message:
Manual merge.
------------------------------------------------------------
revno: 1810.3943.17
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: mysql-5.0-bugteam
timestamp: Wed 2009-09-02 09:02:22 -0300
message:
Post-merge fix. Observe C declaration placement rules.
------------------------------------------------------------
revno: 1810.3943.16 [merge]
committer: Tatiana A. Nurnberg <azundris(a)mysql.com>
branch nick: 50-35132m
timestamp: Mon 2009-08-31 12:56:01 -0700
message:
auto-merge
------------------------------------------------------------
revno: 2502.774.1
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: mysql-5.1-bugteam
timestamp: Wed 2009-09-02 08:45:48 -0300
message:
Increase thread stack size on HP-UX when built with debug.
------------------------------------------------------------
revno: 2502.733.81
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-vg-5.1-bugteam
timestamp: Wed 2009-09-02 15:20:47 +0300
message:
fixed a valgrind warning in partitioning code
------------------------------------------------------------
revno: 2502.733.80
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.1-bugteam
timestamp: Wed 2009-09-02 13:22:47 +0300
message:
Fixed win32 compilation warnings
------------------------------------------------------------
revno: 2502.733.79
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.1-bugteam
timestamp: Wed 2009-09-02 13:09:01 +0300
message:
fixed compilation warnings
------------------------------------------------------------
revno: 2502.733.78 [merge]
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Tue 2009-09-01 15:54:59 +0200
message:
merge to update with latest mysql-5.1-bugteam
------------------------------------------------------------
revno: 2502.773.2
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: test64-5.1-bugteam
timestamp: Tue 2009-09-01 16:39:13 +0300
message:
Fixed a problem in how BUILD/check_cpu handles Core 2 Duo processors.
This fixes the regression introduced in 5.1 that prevents 64 bit builds on Intel while still keeping the core2 hack operational so the cluster can build.
------------------------------------------------------------
revno: 2502.773.1
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: mysql-5.1-bugteam
timestamp: Tue 2009-09-01 09:32:26 -0300
message:
Bug#45611: Minor code cleanup
Remove a self assignment.
Rework a few constructs to avoid a potential overflow.
Based upon patch contributed by Michal Hrusecky
------------------------------------------------------------
revno: 2502.733.77
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Tue 2009-09-01 14:53:27 +0200
message:
post push fix for bug#20577 and bug#46362, disabling warnings
------------------------------------------------------------
revno: 2502.733.76
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Tue 2009-09-01 13:04:56 +0200
message:
Post fix patch for bug#20577 and bug#46362.
On 64-bits machines the calculation gets the wrong types and results
in very large numbers. Fixed by explicitly cast month to (int)
------------------------------------------------------------
revno: 2502.733.75 [merge]
committer: Tatiana A. Nurnberg <azundris(a)mysql.com>
branch nick: 51-35132m
timestamp: Mon 2009-08-31 12:54:22 -0700
message:
auto-merge
------------------------------------------------------------
revno: 2502.772.4 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.1-bugteam
timestamp: Mon 2009-08-31 17:11:54 +0300
message:
automerge
------------------------------------------------------------
revno: 1810.3947.4 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.0-bugteam
timestamp: Mon 2009-08-31 17:08:10 +0300
message:
merge 5.0-main -> 5.0-bugteam
------------------------------------------------------------
revno: 2502.772.3 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.1-bugteam
timestamp: Mon 2009-08-31 17:09:09 +0300
message:
automerge 5.1-main -> 5.1-bugteam
------------------------------------------------------------
revno: 2502.772.2 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B46749-5.1-bugteam
timestamp: Mon 2009-08-31 16:40:35 +0300
message:
automerge
------------------------------------------------------------
revno: 1810.3947.3
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B46749-5.0-bugteam
timestamp: Thu 2009-08-27 14:40:42 +0300
message:
Bug #46749: Segfault in add_key_fields() with outer subquery level
field references
This error requires a combination of factors :
1. An "impossible where" in the outermost SELECT
2. An aggregate in the outermost SELECT
3. A correlated subquery with a WHERE clause that includes an outer
field reference as a top level WHERE sargable predicate
When JOIN::optimize detects an "impossible WHERE" it will bail out
without doing the rest of the work and initializations. It will not
call make_join_statistics() as well. And make_join_statistics fills
in various structures for each table referenced.
When processing the result of the "impossible WHERE" the query must
send a single row of data if there are aggregate functions in it.
In this case the server marks all the aggregates as having received
no rows and calls the relevant Item::val_xxx() method on the SELECT
list. However if this SELECT list happens to contain a correlated
subquery this subquery is evaluated in a normal evaluation mode.
And if this correlated subquery has a reference to a field from the
outermost "impossible where" SELECT the add_key_fields will mistakenly
consider the outer field reference as a "local" field reference when
looking for sargable predicates.
But since the SELECT where the outer field reference refers to is not
completely initialized due to the "impossible WHERE" in this level
we'll get a NULL pointer reference.
Fixed by making a better condition for discovering if a field is "local"
to the SELECT level being processed.
It's not enough to look for OUTER_REF_TABLE_BIT in this case since
for outer references to constant tables the Item_field::used_tables()
will return 0 regardless of whether the field reference is from the
local SELECT or not.
------------------------------------------------------------
revno: 2502.772.1 [merge]
committer: Anurag Shekhar <anurag.shekhar(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Mon 2009-08-31 13:26:09 +0530
message:
merging bugfix from 5.0
------------------------------------------------------------
revno: 1810.3947.2 [merge]
committer: Anurag Shekhar <anurag.shekhar(a)sun.com>
branch nick: mysql-5.0-bugteam-44723
timestamp: Mon 2009-08-31 13:02:31 +0530
message:
merging with changes in bugteam branch.
------------------------------------------------------------
revno: 1810.3947.1
committer: Anurag Shekhar <anurag.shekhar(a)sun.com>
branch nick: mysql-5.0-bugteam-44723
timestamp: Mon 2009-08-24 13:15:51 +0530
message:
Bug #44723 Larger read_buffer_size values can cause performance
decrease for INSERTs
Bulk inserts (multiple row, CREATE ... SELECT, INSERT ... SELECT) into
MyISAM tables were performed inefficiently. This was mainly affecting
use cases where read_buffer_size was considerably large (>256K) and low
number of rows was inserted (e.g. 30-100).
The problem was that during I/O cache initialization (this happens
before each bulk insert) allocated I/O buffer was unnecessarily
initialized to '\0'.
This was happening because of mess in flag values. MyISAM informs I/O
cache to wait for free space (if out of disk space) by passing
MY_WAIT_IF_FULL flag. Since MY_WAIT_IF_FULL and MY_ZEROFILL have the
same values, memory allocator was initializing memory to '\0'.
The performance gain provided with this patch may only be visible with
non-debug binaries, since safemalloc always initializes allocated memory
to 0xA5A5...
------------------------------------------------------------
revno: 2502.733.74 [merge]
committer: Tatiana A. Nurnberg <azundris(a)mysql.com>
branch nick: 51-35132m
timestamp: Mon 2009-08-31 12:40:33 -0700
message:
manual merge
------------------------------------------------------------
revno: 1810.3943.15
committer: Tatiana A. Nurnberg <azundris(a)mysql.com>
branch nick: 50-35132m
timestamp: Mon 2009-08-31 10:01:13 -0700
message:
Bug#35132: MySQLadmin --wait ping always crashes on Windows systems
Failing to connect would release parts of the MYSQL struct.
We would then proceed to try again to connect without re-
initializing the struct.
We prevent the unwanted freeing of data we'll still need now.
------------------------------------------------------------
revno: 2502.733.73
committer: <Dao-Gang.Qu(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Mon 2009-08-31 10:26:01 +0800
message:
Bug #44331 Restore of database with events produces warning in replication
Update the test case for BUG#44331 to fix the push build failure.
------------------------------------------------------------
revno: 2502.733.72 [merge]
committer: Staale Smedseng <staale.smedseng(a)sun.com>
branch nick: 43414-51
timestamp: Sun 2009-08-30 19:01:48 +0200
message:
Merge from 5.1-bugteam
------------------------------------------------------------
revno: 2502.770.3 [merge]
committer: Alexey Kopytov <Alexey.Kopytov(a)Sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Sun 2009-08-30 11:38:49 +0400
message:
Automerge.
------------------------------------------------------------
revno: 2502.771.1
committer: Alexey Kopytov <Alexey.Kopytov(a)Sun.com>
branch nick: my51-bug46607
timestamp: Sun 2009-08-30 11:03:37 +0400
message:
Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM)
results in server crash
check_group_min_max_predicates() assumed the input condition
item to be one of COND_ITEM, SUBSELECT_ITEM, or FUNC_ITEM.
Since a condition of the form "field" is also a valid condition
equivalent to "field <> 0", using such a condition in a query
where the loose index scan was chosen resulted in a debug
assertion failure.
Fixed by handling conditions of the FIELD_ITEM type in
check_group_min_max_predicates().
------------------------------------------------------------
revno: 2502.770.2
committer: <Dao-Gang.Qu(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Sat 2009-08-29 16:52:22 +0800
message:
Bug #44331 Restore of database with events produces warning in replication
If an EVENT is created without the DEFINER clause set explicitly or with it set
to CURRENT_USER, the master and slaves become inconsistent. This issue stems from
the fact that in both cases, the DEFINER is set to the CURRENT_USER of the current
thread. On the master, the CURRENT_USER is the mysqld's user, while on the slave,
the CURRENT_USER is empty for the SQL Thread which is responsible for executing
the statement.
To fix the problem, we do what follows. If the definer is not set explicitly,
a DEFINER clause is added when writing the query into binlog; if 'CURRENT_USER' is
used as the DEFINER, it is replaced with the value of the current user before
writing to binlog.
------------------------------------------------------------
revno: 2502.770.1
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: mysql-5.1-bugteam
timestamp: Fri 2009-08-28 18:49:16 -0300
message:
Reduce test case runtime.
------------------------------------------------------------
revno: 2502.733.71 [merge]
committer: Staale Smedseng <staale.smedseng(a)sun.com>
branch nick: 43414-51
timestamp: Fri 2009-08-28 18:21:54 +0200
message:
Merge from 5.0 for 43414
------------------------------------------------------------
revno: 1810.3943.14
committer: Staale Smedseng <staale.smedseng(a)sun.com>
branch nick: 43414-50
timestamp: Fri 2009-08-28 17:51:31 +0200
message:
Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
This patch fixes a number of GCC warnings about variables used
before initialized. A new macro UNINIT_VAR() is introduced for
use in the variable declaration, and LINT_INIT() usage will be
gradually deprecated. (A workaround is used for g++, pending a
patch for a g++ bug.)
GCC warnings for unused results (attribute warn_unused_result)
for a number of system calls (present at least in later
Ubuntus, where the usual void cast trick doesn't work) are
also fixed.
------------------------------------------------------------
revno: 2502.733.70
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: mysql-5.1-bugteam
timestamp: Fri 2009-08-28 12:06:59 -0300
message:
Fix for a few assorted compiler warnings.
------------------------------------------------------------
revno: 2502.733.69 [merge]
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam_2
timestamp: Fri 2009-08-28 13:54:17 +0200
message:
merge
------------------------------------------------------------
revno: 2502.767.3 [merge]
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Fri 2009-08-28 12:55:59 +0200
message:
Manual merge between bug#46362 and bug#20577.
------------------------------------------------------------
revno: 2502.769.1
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: b46362-51-bugteam
timestamp: Wed 2009-08-26 12:51:23 +0200
message:
Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
There were a problem since pruning uses the field
for comparison (while evaluate_join_record uses longlong),
resulting in pruning failures when comparing DATE to DATETIME.
Fix was to always comparing DATE vs DATETIME as DATETIME,
by adding ' 00:00:00' to the DATE string.
And adding optimization for comparing with 23:59:59, so that
DATETIME_col > '2001-02-03 23:59:59' ->
TO_DAYS(DATETIME_col) > TO_DAYS('2001-02-03 23:59:59') instead
of '>='.
------------------------------------------------------------
revno: 2502.767.2 [merge]
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Wed 2009-08-26 14:45:50 +0200
message:
merge
------------------------------------------------------------
revno: 2502.768.1
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: test-51-bugteam_innodb_plugin
timestamp: Fri 2009-08-07 15:08:32 +0200
message:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
Post push patch.
Bug was that a non partitioned table file was not
converted to system_charset, (due to table_name_len was not set).
Also missing DBUG_RETURN.
And Innodb adds quotes after calling the function,
so I added one more mode where explain_filename does not
add quotes. But it still appends the [sub]partition name
as a comment.
Also caught a minor quoting bug, the character '`' was
not quoted in the identifier. (so 'a`b' was quoted as `a`b`
and not `a``b`, this is mulitbyte characters aware.)
------------------------------------------------------------
revno: 2502.767.1 [merge]
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Wed 2009-08-26 14:40:18 +0200
message:
merge
------------------------------------------------------------
revno: 2502.766.1
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: b20577-51-bugteam
timestamp: Wed 2009-08-26 12:59:49 +0200
message:
Bug#20577: Partitions: use of to_days() function leads to selection failures
Problem was that the partition containing NULL values
was pruned away, since '2001-01-01' < '2001-02-00' but
TO_DAYS('2001-02-00') is NULL.
Added the NULL partition for RANGE/LIST partitioning on TO_DAYS()
function to be scanned too.
Also fixed a bug that added ALLOW_INVALID_DATES to sql_mode
(SELECT * FROM t WHERE date_col < '1999-99-99' on a RANGE/LIST
partitioned table would add it).
------------------------------------------------------------
revno: 2502.733.68 [merge]
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Fri 2009-08-28 10:45:57 +0100
message:
merge mysql-5.0-bugteam --> mysql-5.1-bugteam
------------------------------------------------------------
revno: 1810.3943.13 [merge]
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: mysql-5.0-bugteam
timestamp: Fri 2009-08-28 10:29:04 +0100
message:
auto-merge mysql-5.0-bugteam (local) --> mysql-5.0-bugteam
------------------------------------------------------------
revno: 1810.3789.10
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: b46861-5.0.72sp
timestamp: Thu 2009-08-27 17:28:09 +0100
message:
BUG#46861 Auto-closing of temporary tables broken by replicate-rewrite-db
When a connection is dropped any remaining temporary table is also automatically
dropped and the SQL statement of this operation is written to the binary log in
order to drop such tables on the slave and keep the slave in sync. Specifically,
the current code base creates the following type of statement:
DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `db`.`table`;
Unfortunately, appending the database to the table name in this manner circumvents
the replicate-rewrite-db option (and any options that check the current database).
To solve the issue, we started writing the statement to the binary as follows:
use `db`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `table`;
------------------------------------------------------------
revno: 2502.733.67
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Thu 2009-08-27 13:46:29 +0100
message:
BUG#46864 Incorrect update of InnoDB table on slave when using trigger with myisam table
Slave does not correctly handle "expected errors" leading to inconsistencies
between the mater and slave. Specifically, when a statement changes both
transactional and non-transactional tables, the transactional changes are
automatically rolled back on the master but the slave ignores the error and
does not roll them back thus leading to inconsistencies.
To fix the problem, we automatically roll back a statement that fails on
the slave but note that the transaction is not rolled back unless a "rollback"
command is in the relay log file.
------------------------------------------------------------
revno: 2502.733.66 [merge]
committer: Sergey Glukhov <Sergey.Glukhov(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Thu 2009-08-27 15:59:25 +0500
message:
5.0-bugteam->5.1-bugteam merge
------------------------------------------------------------
revno: 1810.3943.12
committer: Sergey Glukhov <Sergey.Glukhov(a)sun.com>
branch nick: mysql-5.0-bugteam
timestamp: Thu 2009-08-27 15:22:19 +0500
message:
Bug#46184 Crash, SELECT ... FROM derived table procedure analyze
The crash happens because select_union object is used as result set
for queries which have derived tables.
select_union use temporary table as data storage and if
fields count exceeds 10(count of values for procedure ANALYSE())
then we get a crash on fill_record() function.
------------------------------------------------------------
revno: 2502.733.65
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Thu 2009-08-27 10:32:27 +0100
message:
Post-fix for BUG#28976.
Updated main.mysqlbinlog_row_trans's result file as
TRUNCATE statements are wrapped in BEGIN...COMMIT.
------------------------------------------------------------
revno: 2502.733.64 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B37044-5.1-bugteam
timestamp: Thu 2009-08-27 10:46:35 +0300
message:
merged 5.0-bugteam -> 5.1-bugteam
------------------------------------------------------------
revno: 1810.3943.11
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B37044-5.0-bugteam
timestamp: Mon 2009-08-24 15:28:03 +0300
message:
Bug #37044: Read overflow in opt_range.cc found during "make test"
The code was using a special global buffer for the value of IS NULL ranges.
This was not always long enough to be copied by a regular memcpy. As a
result read buffer overflows may occur.
Fixed by setting the null byte to 1 and setting the rest of the field disk image
to NULL with a bzero (instead of relying on the buffer and memcpy()).
------------------------------------------------------------
revno: 1810.3943.10
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B46807-5.0-bugteam
timestamp: Wed 2009-08-19 17:53:43 +0300
message:
Bug #46807: subselect test fails on PB-2 with a crash
The check for stack overflow was independent of the size of the
structure stored in the heap.
Fixed by adding sizeof(PARAM) to the requested free heap size.
------------------------------------------------------------
revno: 2502.733.63
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Thu 2009-08-27 00:13:03 +0100
message:
BUG#28976 Mixing trans and non-trans tables in one transaction results in incorrect
binlog
Mixing transactional (T) and non-transactional (N) tables on behalf of a
transaction may lead to inconsistencies among masters and slaves in STATEMENT
mode. The problem stems from the fact that although modifications done to
non-transactional tables on behalf of a transaction become immediately visible
to other connections they do not immediately get to the binary log and therefore
consistency is broken. Although there may be issues in mixing T and M tables in
STATEMENT mode, there are safe combinations that clients find useful.
In this bug, we fix the following issue. Mixing N and T tables in multi-level
(e.g. a statement that fires a trigger) or multi-table table statements (e.g.
update t1, t2...) were not handled correctly. In such cases, it was not possible
to distinguish when a T table was updated if the sequence of changes was N and T.
In a nutshell, just the flag "modified_non_trans_table" was not enough to reflect
that both a N and T tables were changed. To circumvent this issue, we check if an
engine is registered in the handler's list and changed something which means that
a T table was modified.
Check WL 2687 for a full-fledged patch that will make the use of either the MIXED or
ROW modes completely safe.
------------------------------------------------------------
revno: 2502.733.62
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: 45261-5.1
timestamp: Mon 2009-08-24 16:47:08 -0300
message:
Bug#45261: Crash, stored procedure + decimal
The problem was that creating a DECIMAL column from a decimal
value could lead to a failed assertion as decimal values can
have a higher precision than those attached to a table. The
assert could be triggered by creating a table from a decimal
with a large (> 30) scale. Also, there was a problem in
calculating the number of digits in the integral and fractional
parts if both exceeded the maximum number of digits permitted
by the new decimal type.
The solution is to ensure that truncation procedure is executed
when deducing a DECIMAL column from a decimal value of higher
precision. If the integer part is equal to or bigger than the
maximum precision for the DECIMAL type (65), the integer part
is truncated to fit and the fractional becomes zero. Otherwise,
the fractional part is truncated to fit into the space left
after the integer part is copied.
This patch borrows code and ideas from Martin Hansson's patch.
------------------------------------------------------------
revno: 2502.733.61 [merge]
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: mysql-5.1-bugteam-push
timestamp: Mon 2009-08-24 11:37:44 +0100
message:
auto-merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam
------------------------------------------------------------
revno: 2502.765.1
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Wed 2009-08-19 16:38:18 +0100
message:
BUG#45694 Deadlock in replicated statement is not retried
If the SQL Thread fails to execute an event due to a temporary error (e.g.
ER_LOCK_DEADLOCK) and the option "--slave_transaction_retries" is set the SQL
Thread should not be aborted and the transaction should be restarted from the
beginning and re-executed.
Unfortunately, a wrong interpretation of the THD::is_fatal_error was preventing
this behavior. In a nutshell, "this variable is set to TRUE if an execution of a
compound statement cannot continue. In particular, it is used to disable access
to the CONTINUE or EXIT handlers of stored routines. So even temporary errors
may have this variable set.
To fix the bug, we have done what follows:
DBUG_ENTER("has_temporary_error");
- if (thd->is_fatal_error)
- DBUG_RETURN(0);
-
DBUG_EXECUTE_IF("all_errors_are_temporary_errors",
if (thd->main_da.is_error())
{
------------------------------------------------------------
revno: 2502.733.60 [merge]
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: mysql-5.1-bugteam-push
timestamp: Mon 2009-08-24 10:24:52 +0100
message:
auto-merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam
------------------------------------------------------------
revno: 2502.764.1
committer: Alfranio Correia <alfranio.correia(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Thu 2009-08-13 17:21:01 +0100
message:
BUG#46130 Slave does not correctly handle "expected errors"
In STATEMENT based replication, a statement that failed on the master but that
updated non-transactional tables is written to binary log with the error code
appended to it. On the slave, the statement is executed and the same error is
expected. However, when an "expected error" did not happen on the slave and was
either ignored or was related to a concurrency issue on the master, the slave
did not rollback the effects of the statement and as such inconsistencies might
happen.
To fix the problem, we automatically rollback a statement that should have
failed on a slave but succeded and whose expected failure is either ignored or
stems from a concurrency issue on the master.
------------------------------------------------------------
revno: 2502.733.59 [merge]
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Fri 2009-08-21 18:00:38 +0200
message:
merge
------------------------------------------------------------
revno: 2502.763.1
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: b46639-51-bugteam
timestamp: Fri 2009-08-21 17:38:29 +0200
message:
Bug#46639: 1030 (HY000): Got error 124 from storage engine on
INSERT ... SELECT ...
Problem was that when bulk insert is used on an empty
table/partition, it disables the indexes for better
performance, but in this specific case it also tries
to read from that partition using an index, which is
not possible since it has been disabled.
Solution was to allow index reads on disabled indexes
if there are no records.
Also reverted the patch for bug#38005, since that was a workaround
in the partitioning engine instead of a fix in myisam.
------------------------------------------------------------
revno: 2502.733.58 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B46019-5.1-bugteam
timestamp: Fri 2009-08-21 17:41:48 +0300
message:
reverted the fix for bug #46019 from 5.1-bugteam
------------------------------------------------------------
revno: 1810.3943.9 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B46019-5.0-bugteam
timestamp: Fri 2009-08-21 17:12:03 +0300
message:
automerge
------------------------------------------------------------
revno: 1810.3946.1 [merge]
committer: Martin Hansson <martin.hansson(a)sun.com>
branch nick: 5.0bt
timestamp: Fri 2009-08-21 14:31:40 +0200
message:
Merge.
------------------------------------------------------------
revno: 1810.3943.8
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B46019-5.0-bugteam
timestamp: Fri 2009-08-21 17:10:55 +0300
message:
Revert of the fix for bug #46019.
------------------------------------------------------------
revno: 2502.733.57 [merge]
committer: Martin Hansson <martin.hansson(a)sun.com>
branch nick: 5.1bt
timestamp: Fri 2009-08-21 12:13:03 +0200
message:
Merge.
------------------------------------------------------------
revno: 2502.762.1 [merge]
committer: Martin Hansson <martin.hansson(a)sun.com>
branch nick: 5.1bt-gca
timestamp: Thu 2009-08-20 14:30:59 +0200
message:
Bug#46616: Merge
------------------------------------------------------------
revno: 1810.3945.1
committer: Martin Hansson <martin.hansson(a)sun.com>
branch nick: 5.0bt-gca
timestamp: Thu 2009-08-20 13:56:29 +0200
message:
Bug#46616: Assertion `!table->auto_increment_field_not_null' on
view manipulations
The bespoke flag was not properly reset after last call to
fill_record. Fixed by resetting in caller mysql_update.
------------------------------------------------------------
revno: 2502.733.56
committer: Ramil Kalimullin <ramil(a)mysql.com>
branch nick: mysql-5.1-bugteam
timestamp: Fri 2009-08-21 10:55:35 +0500
message:
Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP
(temporary) TABLE, crash
Problem: if one has an open "HANDLER t1", further "TRUNCATE t1"
doesn't close the handler and leaves handler table hash in an
inconsistent state, that may lead to a server crash.
Fix: TRUNCATE should implicitly close all open handlers.
Doc. request: the fact should be described in the manual accordingly.
------------------------------------------------------------
revno: 2502.733.55 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B46019-5.1-bugteam
timestamp: Thu 2009-08-20 17:11:22 +0300
message:
merge of bug #46019 to 5.1-bugteam
------------------------------------------------------------
revno: 1810.3943.7
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B46019-5.0-bugteam
timestamp: Wed 2009-08-19 15:14:57 +0300
message:
Bug #46019: ERROR 1356 When selecting from within another
view that has Group By
Table access rights checking function check_grant() assumed
that no view is opened when it's called.
This is not true with nested views where the inner view
needs materialization. In this case the view is already
materialized when check_grant() is called for it.
This caused check_grant() to not look for table level
grants on the materialized view table.
Fixed by checking if a view is already materialized and if
it is check table level grants using the original table name
(not the ones of the materialized temp table).
------------------------------------------------------------
revno: 2502.733.54
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B45962-5.1-bugteam
timestamp: Thu 2009-07-09 15:05:30 +0300
message:
Bug #45962: memory leak after 'sort aborted' errors
When the function exits with an error it was not
freeing the local Unique class instance.
Fixed my making sure all the places where the function
returns from are freeing the Unique instance
------------------------------------------------------------
revno: 2502.733.53 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B39326-5.1-bugteam
timestamp: Wed 2009-08-19 18:16:30 +0300
message:
null merge of the backport of Chad's fix for bug #39326 to 5.1-bugteam
------------------------------------------------------------
revno: 1810.3943.6
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: B39326-5.0-bugteam
timestamp: Wed 2009-08-19 10:59:17 +0300
message:
backport of Chad's fix for bug #39326 to 5.0-bugteam
------------------------------------------------------------
revno: 2502.733.52 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.1-bugteam
timestamp: Mon 2009-08-17 17:21:08 +0300
message:
automere
------------------------------------------------------------
revno: 1810.3943.5 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.0-bugteam
timestamp: Mon 2009-08-17 17:13:08 +0300
message:
automerge
------------------------------------------------------------
revno: 2502.733.51 [merge]
committer: Georgi Kodinov <joro(a)sun.com>
branch nick: merge-5.1-bugteam
timestamp: Mon 2009-08-17 17:14:51 +0300
message:
automerge
------------------------------------------------------------
revno: 2502.733.50 [merge]
committer: Ramil Kalimullin <ramil(a)mysql.com>
branch nick: mysql-5.1-bugteam
timestamp: Fri 2009-08-14 14:13:16 +0500
message:
Automerge
------------------------------------------------------------
revno: 2502.761.1 [merge]
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: mysql-5.1-bugteam
timestamp: Thu 2009-08-13 17:45:01 -0300
message:
Merge from mysql-5.0-bugteam.
------------------------------------------------------------
revno: 1810.3943.4
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: 45238-5.0
timestamp: Thu 2009-08-13 17:07:20 -0300
message:
Bug#46013: rpl_extraColmaster_myisam fails on pb2
Bug#45243: crash on win in sql thread clear_tables_to_lock() -> free()
Bug#45242: crash on win in mysql_close() -> free()
Bug#45238: rpl_slave_skip, rpl_change_master failed (lost connection) for STOP SLAVE
Bug#46030: rpl_truncate_3innodb causes server crash on windows
Bug#46014: rpl_stm_reset_slave crashes the server sporadically in pb2
When killing a user session on the server, it's necessary to
interrupt (notify) the thread associated with the session that
the connection is being killed so that the thread is woken up
if waiting for I/O. On a few platforms (Mac, Windows and HP-UX)
where the SIGNAL_WITH_VIO_CLOSE flag is defined, this interruption
procedure is to asynchronously close the underlying socket of
the connection.
In order to enable this schema, each connection serving thread
registers its VIO (I/O interface) so that other threads can
access it and close the connection. But only the owner thread of
the VIO might delete it as to guarantee that other threads won't
see freed memory (the thread unregisters the VIO before deleting
it). A side note: closing the socket introduces a harmless race
that might cause a thread attempt to read from a closed socket,
but this is deemed acceptable.
The problem is that this infrastructure was meant to only be used
by server threads, but the slave I/O thread was registering the
VIO of a mysql handle (a client API structure that represents a
connection to another server instance) as a active connection of
the thread. But under some circumstances such as network failures,
the client API might destroy the VIO associated with a handle at
will, yet the VIO wouldn't be properly unregistered. This could
lead to accesses to freed data if a thread attempted to kill a
slave I/O thread whose connection was already broken.
There was a attempt to work around this by checking whether
the socket was being interrupted, but this hack didn't work as
intended due to the aforementioned race -- attempting to read
from the socket would yield a "bad file descriptor" error.
The solution is to add a hook to the client API that is called
from the client code before the VIO of a handle is deleted.
This hook allows the slave I/O thread to detach the active vio
so it does not point to freed memory.
------------------------------------------------------------
revno: 2502.733.49
committer: Ramil Kalimullin <ramil(a)mysql.com>
branch nick: mysql-5.1-bugteam
timestamp: Fri 2009-08-14 00:49:28 +0500
message:
Fix for bug #46614: Assertion in show_create_trigger()
on SHOW CREATE TRIGGER + MERGE table
Problem: SHOW CREATE TRIGGER erroneously relies on fact
that we have the only underlying table for a trigger
(wrong for merge tables).
Fix: remove erroneous assert().
------------------------------------------------------------
revno: 2502.733.48
committer: <Li-Bing.Song(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Thu 2009-08-13 10:48:57 +0800
message:
BUG#45574 CREATE IF NOT EXISTS is not binlogged if the object exists
There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
binlogged even if either the DB, TABLE or EVENT does not exist. In
contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
exists.
This patch fixes the following cases for all the replication formats:
CREATE DATABASE IF NOT EXISTS.
CREATE TABLE IF NOT EXISTS,
CREATE TABLE IF NOT EXISTS ... LIKE,
CREAET TABLE IF NOT EXISTS ... SELECT.
------------------------------------------------------------
revno: 2502.733.47 [merge]
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Wed 2009-08-12 18:53:33 +0200
message:
merge
------------------------------------------------------------
revno: 2502.760.2
committer: Konstantin Osipov <kostja(a)sun.com>
branch nick: 5.1-bugteam
timestamp: Wed 2009-08-12 17:11:06 +0400
message:
A follow up patch for the follow up patch for Bug#45829
"CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted,
does nothing".
Put back stubs for members of structures that are shared between
sql/ and pluggable storage engines. to not break ABI unnecessarily.
To be NULL-merged into 5.4, where we do break the ABI already.
------------------------------------------------------------
revno: 2502.760.1
committer: Konstantin Osipov <kostja(a)sun.com>
branch nick: 5.1-bugteam
timestamp: Wed 2009-08-12 14:57:41 +0400
message:
A follow up patch for Bug#45829 "CREATE TABLE TRANSACTIONAL
PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing"
Remove unused code that would lead to warnings when compiling
sql_yacc.yy.
------------------------------------------------------------
revno: 2502.733.46 [merge]
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Wed 2009-08-12 12:03:05 +0200
message:
manual merge
------------------------------------------------------------
revno: 2502.759.1
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: b46478-51-bugteam
timestamp: Thu 2009-08-06 14:28:39 +0200
message:
Bug#46478: timestamp field incorrectly defaulted
when partition is reoganized.
Problem was that table->timestamp_field_type was not changed
before copying rows between partitions.
fixed by setting it to TIMESTAMP_NO_AUTO_SET as the first thing
in fast_alter_partition_table, so that all if-branches is covered.
------------------------------------------------------------
revno: 2502.733.45 [merge]
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: topush-51-bugteam
timestamp: Wed 2009-08-12 11:46:08 +0200
message:
merge
------------------------------------------------------------
revno: 2502.758.1
committer: Mattias Jonsson <mattias.jonsson(a)sun.com>
branch nick: b39893-51-bugteam
timestamp: Thu 2009-01-08 15:16:44 +0100
message:
Bug#39893: Crash if select on a partitioned table, when partitioning is disabled
Problem was that it tried to run partitioning function calls when
opening a partitioned table, when it was explicitly disabled.
Solution is to check if the partitioning plugin is ready to use before
using any partitioning specific calls.
------------------------------------------------------------
revno: 2502.733.44 [merge]
committer: <Li-Bing.Song(a)sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Wed 2009-08-12 13:31:56 +0800
message:
Manual Merge
------------------------------------------------------------
revno: 1810.3943.3
committer: <Li-Bing.Song(a)sun.com>
branch nick: mysql-5.0-bugteam
timestamp: Wed 2009-08-12 11:54:05 +0800
message:
BUG#45516 SQL thread does not use database charset properly
Replication SQL thread does not set database default charset to
thd->variables.collation_database properly, when executing LOAD DATA binlog.
This bug can be repeated by using "LOAD DATA" command in STATEMENT mode.
This patch adds code to find the default character set of the current database
then assign it to thd->db_charset when slave server begins to execute a relay log.
The test of this bug is added into rpl_loaddata_charset.test
------------------------------------------------------------
revno: 2502.733.43 [merge]
committer: Davi Arnaut <Davi.Arnaut(a)Sun.COM>
branch nick: mysql-5.1-bugteam
timestamp: Tue 2009-08-11 13:29:45 -0300
message:
Merge from mysql-5.0-bugteam.
------------------------------------------------------------
revno: 2759
committer: sanja(a)askmonty.org
branch nick: work-maria-5.1-federatedx
timestamp: Tue 2009-11-03 16:39:54 +0200
message:
Add federatedx files for build
------------------------------------------------------------
revno: 2758
committer: sanja(a)askmonty.org
branch nick: work-maria-5.1-federatedx
timestamp: Tue 2009-11-03 13:08:09 +0200
message:
Make federated compiling under windows
------------------------------------------------------------
revno: 2757
committer: sanja(a)askmonty.org
branch nick: work-maria-5.1-win64
timestamp: Mon 2009-11-02 21:17:58 +0200
message:
Fixed federatedx building under windows
------------------------------------------------------------
revno: 2756 [merge]
committer: Hakan Kuecuekyilmaz <hakan(a)askmonty.org>
branch nick: maria-local-master
timestamp: Sun 2009-11-01 18:41:16 +0100
message:
Merge.
------------------------------------------------------------
revno: 2754.1.2 [merge]
committer: Hakan Kuecuekyilmaz <hakan(a)askmonty.org>
branch nick: maria
timestamp: Sun 2009-11-01 18:37:37 +0100
message:
Merge.
------------------------------------------------------------
revno: 2754.1.1
committer: Hakan Kuecuekyilmaz <hakan(a)askmonty.org>
branch nick: maria
timestamp: Sun 2009-11-01 16:09:55 +0100
message:
BUILD/compile-dist && make dist was not working due to typos.
Fixed by renaming a file and editing the typo in Makefile.am
------------------------------------------------------------
revno: 2755
committer: sanja(a)askmonty.org
branch nick: work-maria-5.1-win64
timestamp: Sat 2009-10-31 21:22:50 +0200
message:
Compilation under windows x64 made possible.
------------------------------------------------------------
revno: 2754 [merge]
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Fri 2009-10-30 22:28:11 +0200
message:
Merge with 5.1-release
------------------------------------------------------------
revno: 2737.1.57
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.1-build1
timestamp: Fri 2009-10-30 13:50:48 +0300
message:
Dummy change to push the release tag.
------------------------------------------------------------
revno: 2753 [merge]
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-5.1
timestamp: Fri 2009-10-30 22:16:08 +0200
message:
Merge of FederatedX code
------------------------------------------------------------
revno: 2751.1.2
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Fri 2009-10-30 20:51:46 +0200
message:
Added ignore for symlinked build file
------------------------------------------------------------
revno: 2751.1.1
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Fri 2009-10-30 20:50:56 +0200
message:
Added federatedx storage engine
Fixed compiler warnings
------------------------------------------------------------
revno: 2752
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.1
timestamp: Thu 2009-10-29 20:50:33 +0300
message:
MWL#17: Table elimination
- add debug tests (were accidentally not pushed with the bulk of WL)
------------------------------------------------------------
revno: 2751
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Thu 2009-10-29 02:04:56 +0200
message:
Compile by default MySQL clients with libmysqldclient.a (not .so)
This makes them suitable for tar archices right away and also are easier to copy
Don't disable federated storage engine by default.
Don't allow one to disable the Maria storage engine if it's used for temp tables
------------------------------------------------------------
revno: 2750
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Wed 2009-10-28 10:08:54 +0200
message:
Added missing 'source' command.
------------------------------------------------------------
revno: 2749
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Wed 2009-10-28 09:52:34 +0200
message:
Speed up of test suite:
- Added --disable_query_log ; begin ; .... commit; --enable_query_log around all while loops that does insert
------------------------------------------------------------
revno: 2748 [merge]
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Mon 2009-10-26 13:38:17 +0200
message:
Automatic merge with maria-merge
------------------------------------------------------------
revno: 2747
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Mon 2009-10-26 13:35:42 +0200
message:
Fixed compiler warning message
- Added checking of return value for system(), freopen(), fgets() and chown()
- Ensure that calls that require a format strings gets a format string
- Other trivial things
Updated test suite results (especially for pbxt and embedded server)
Removed warning for "Invalid (old?) table or database name 'mysqld.1'" from pbxt tests
Speed up some pbxt tests by inserting begin ; commit; around "while loops with inserts"
Added mysqld startup option '--debug-flush'
Create maria_recovery.trace in data directory instead of current directory
------------------------------------------------------------
revno: 2746 [merge]
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Wed 2009-10-14 11:09:56 +0300
message:
Automatic merge with 5.1-merge
------------------------------------------------------------
revno: 2745
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Tue 2009-10-13 19:57:36 +0300
message:
Removed not used declarations
------------------------------------------------------------
revno: 2744
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Tue 2009-10-13 15:47:17 +0300
message:
Force restart before maria_showlog_error to get rid of status from previous connections
This fixes a race condition in the test system
------------------------------------------------------------
revno: 2743 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: mariadb-5.1
timestamp: Tue 2009-10-06 20:37:55 +0200
message:
Merge a bunch of small fixes from release tree into main lp:maria.
------------------------------------------------------------
revno: 2742 [merge]
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: maria-skr
timestamp: Tue 2009-10-06 09:20:31 +0300
message:
Merge with bug fix
------------------------------------------------------------
revno: 2740.1.2 [merge]
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Tue 2009-10-06 09:15:12 +0300
message:
Merge with trunk
------------------------------------------------------------
revno: 2740.1.1
committer: Michael Widenius <monty(a)askmonty.org>
branch nick: mysql-maria
timestamp: Tue 2009-10-06 09:13:56 +0300
message:
Don't call _ma_decrement_open_count() for ma_extra(HA_EXTRA_PREPARE_FOR_DROP).
Don't call _mi_decrement_open_count() for mi_extra(HA_EXTRA_PREPARE_FOR_DROP).
This ensures that if we empty the key cache and a drop table fails later, the index will be automaticly rebuilt
------------------------------------------------------------
revno: 2741
committer: knielsen(a)knielsen-hq.org
branch nick: work-5.1
timestamp: Mon 2009-10-05 14:26:57 +0200
message:
MBug#443014: Too many 'skipped' messages in mysql-test-run
Remove mysql-test-run.pl unnecessary and confusing 'skipped' messages.
- In mysql-test-run.pl, we auto-generate combinations of replication
tests. But this sometimes generates combinations that are meaningless,
like running a test that requires row-based replication with
statement-based. These superfluous combinationes should not be
reported as skipped, they should just be deleted.
- Remove ndb suites from default suites, as we do not support NDB
in MariaDB.
Keep skip messages resulting from running mysql-test-run.pl in special
ways, eg. --mysqld=--binlog-format=statement.
-----------------------------------------------------------------------
2
1
Hi
I took a look at
https://bugs.launchpad.net/maria/+bugs?
...all bugs in MariaDB.
For instance the third one
https://bugs.launchpad.net/maria/+bug/417751
has been fixed and closed a long time ago. The status has in fact been
updated properly, but this is only effective as the bug appears in the
xtradb project, not maria project.
Hakan, with your new bug triaging hat on, could you also make sure old
bugs like this are properly closed so we don't need to see them.
henrik
--
email: henrik.ingo(a)avoinelama.fi
tel: +358-40-5697354
www: www.avoinelama.fi/~hingo
book: www.openlife.cc
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2767)
by knielsen@knielsen-hq.org 18 Nov '09
by knielsen@knielsen-hq.org 18 Nov '09
18 Nov '09
#At lp:maria
2767 knielsen(a)knielsen-hq.org 2009-11-18 [merge]
Merge the last bit of MySQL 5.1.41 into MariaDB.
modified:
mysys/typelib.c
=== modified file 'mysys/typelib.c'
--- a/mysys/typelib.c 2009-11-16 20:49:51 +0000
+++ b/mysys/typelib.c 2009-11-18 11:47:59 +0000
@@ -192,7 +192,7 @@ my_ulonglong find_typeset(char *x, TYPEL
i= x;
while (*x && *x != field_separator)
x++;
- if (x[0] && x[1]) // skip separator if found
+ if (x[0] && x[1]) /* skip separator if found */
x++;
if ((find= find_type(i, lib, 2 | 8) - 1) < 0)
DBUG_RETURN(0);
1
0
Hi,
With the lots of builders now included in our Buildbot, the status pages are
getting difficult to get an overview of.
I therefore enabled the Buildbot category feature. I grouped the builders into
the following four categories:
main These are the main builders, which are well-working and should
always be green
package These are the builders for package testing. There are a lot of
these, so I put them in their own category.
experimental These are the builders that are not stable, ie. they
crash/disconnect a lot or have other problems that makes them
unreliable for checking for problems in new commits. THESE
NEED TO BE FIXED so they can move into category main!
new New builders that are not fully operation yet (eg. missing bzr
installation or similar).
I also added some simple forms to be able to select among these on the main
page (reload to clear browser cache):
http://askmonty.org/buildbot/
Please someone help with getting the many builders in experimental fixes!
http://askmonty.org/buildbot/waterfall?category=experimental&branch=5.1
Eg. all of the Windows builders are currectly experimental because of multiple
problems with crashes, hangs, stuck processes, etc. etc.
- Kristian.
1
0
[Maria-developers] New (by Monty): Give warnings in case of overflow in integer arithmetic (65)
by worklog-noreply@askmonty.org 18 Nov '09
by worklog-noreply@askmonty.org 18 Nov '09
18 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Give warnings in case of overflow in integer arithmetic
CREATION DATE..: Wed, 18 Nov 2009, 01:20
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 65 (http://askmonty.org/worklog/?tid=65)
VERSION........: Benchmarks-3.0
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 40 (hours remain)
ORIG. ESTIMATE.: 40
PROGRESS NOTES:
DESCRIPTION:
Give warnings in case of overflow in integer arithmetic
The issue is described here:
http://bugs.launchpad.net/maria/+bug/482846
MySQL reason is descried here:
http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html
We can't fix the arithmetic as it would make us incompatible in how MySQL works.
We should however see if we can generate warnings when overflows
happens.
mysql> SELECT 4294967296 * 4294967296;
+-------------------------+
| 4294967296 * 4294967296 |
+-------------------------+
| 0 |
+-------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
mysql> SELECT 3037000500 * 3037000500;
+-------------------------+
| 3037000500 * 3037000500 |
+-------------------------+
| -9223372036709301616 |
+-------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
mysql> SELECT 4294967296 * 4294967297;
+-------------------------+
| 4294967296 * 4294967297 |
+-------------------------+
| 4294967296 |
+-------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
mysql> SELECT 4294967296 * 4294967298;
+-------------------------+
| 4294967296 * 4294967298 |
+-------------------------+
| 8589934592 |
+-------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] New (by Monty): Give warnings in case of overflow in integer arithmetic (65)
by worklog-noreply@askmonty.org 18 Nov '09
by worklog-noreply@askmonty.org 18 Nov '09
18 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Give warnings in case of overflow in integer arithmetic
CREATION DATE..: Wed, 18 Nov 2009, 01:20
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 65 (http://askmonty.org/worklog/?tid=65)
VERSION........: Benchmarks-3.0
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 40 (hours remain)
ORIG. ESTIMATE.: 40
PROGRESS NOTES:
DESCRIPTION:
Give warnings in case of overflow in integer arithmetic
The issue is described here:
http://bugs.launchpad.net/maria/+bug/482846
MySQL reason is descried here:
http://dev.mysql.com/doc/refman/5.1/en/arithmetic-functions.html
We can't fix the arithmetic as it would make us incompatible in how MySQL works.
We should however see if we can generate warnings when overflows
happens.
mysql> SELECT 4294967296 * 4294967296;
+-------------------------+
| 4294967296 * 4294967296 |
+-------------------------+
| 0 |
+-------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
mysql> SELECT 3037000500 * 3037000500;
+-------------------------+
| 3037000500 * 3037000500 |
+-------------------------+
| -9223372036709301616 |
+-------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
mysql> SELECT 4294967296 * 4294967297;
+-------------------------+
| 4294967296 * 4294967297 |
+-------------------------+
| 4294967296 |
+-------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
mysql> SELECT 4294967296 * 4294967298;
+-------------------------+
| 4294967296 * 4294967298 |
+-------------------------+
| 8589934592 |
+-------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Add a mysqlbinlog option to filter updates to certain tables (40)
by worklog-noreply@askmonty.org 17 Nov '09
by worklog-noreply@askmonty.org 17 Nov '09
17 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to filter updates to certain tables
CREATION DATE..: Mon, 10 Aug 2009, 13:25
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Psergey
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 40 (http://askmonty.org/worklog/?tid=40)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 32
ESTIMATE.......: 32 (hours remain)
ORIG. ESTIMATE.: 48
PROGRESS NOTES:
-=-=(Bothorsen - Tue, 17 Nov 2009, 17:20)=-=-
Alex is closer to a working patch now.
Worked 14 hours and estimate 32 hours remain (original estimate unchanged).
-=-=(Bothorsen - Thu, 12 Nov 2009, 13:13)=-=-
Work hours by Alexi and Bo + estimated time for the task.
Worked 16 hours and estimate 46 hours remain (original estimate increased by 14 hours).
-=-=(Alexi - Sun, 08 Nov 2009, 15:18)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.15787 2009-11-08 15:18:11.000000000 +0200
+++ /tmp/wklog.40.new.15787 2009-11-08 15:18:11.000000000 +0200
@@ -62,7 +62,7 @@
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
-3. db_len = 0 means that this is the current db.
+3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
@@ -75,6 +75,77 @@
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+***********************************************************************
+HELP NEEDED
+***********************************************************************
+The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
+
+log_event.h
+~~~~~~~~~~~
+#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
+ LOG_EVENT_HEADER_LEN + /* write_header */ \
+ QUERY_HEADER_LEN + /* write_data */ \
+ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
+ MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
+ NAME_LEN + 1)
+
+which is used only for setting
+
+ thd->variables.max_allowed_packet
+ mysql->net.max_packet_size
+
+Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
+(without making any other changes) be substituted in this definition by
+QUERY_HEADER_LEN_EXT.
+
+Below I list all places where MAX_LOG_EVENT_HEADER is used:
+
+slave.cc
+~~~~~~~~
+static int init_slave_thread(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
+ slave threads, since a replication event can become this much larger
+ than the corresponding packet (query) sent from client to master.
+ */
+ thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
+ ...
+}
+pthread_handler_t handle_slave_io(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
+ thread, since a replication event can become this much larger than
+ the corresponding packet (query) sent from client to master.
+ */
+ mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
+sql_repl.cc
+~~~~~~~~~~~
+void mysql_binlog_send(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
+ this larger than the corresponding packet (query) sent
+ from client to master.
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+bool mysql_show_binlog_events(...)
+{ ...
+ /*
+ to account binlog event header size
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
3. Changes in log events
************************
@@ -84,7 +155,7 @@
This setting is done in Format description event constructor which creates
the event for writing to binary log:
- if (binlog_with_tables_info)
+ if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
@@ -99,12 +170,12 @@
following manner:
switch (binlog_ver) {
- case 4: /* MySQL 5.0 and higher */
+ #ifndef MYSQL_CLIENT
+ case 4: /* MySQL 5.0 and higher */
...
-+ #else
-+ <error>
+ break;
+ #endif
+
case 1:
case 3:
...
@@ -132,7 +203,7 @@
--------------------------------
[Creates the event for binlogging]
-In case of binlog_with_tables_info = TRUE, set additionally query_len,
+In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
@@ -140,7 +211,7 @@
----------------
[Writes the event to binlog]
-In case of binlog_with_tables_info = TRUE, write additional members
+In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
-=-=(Alexi - Sun, 08 Nov 2009, 10:40)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.5055 2009-11-08 08:40:02.000000000 +0000
+++ /tmp/wklog.40.new.5055 2009-11-08 08:40:02.000000000 +0000
@@ -3,6 +3,7 @@
1. Adding --binlog-with-tables-info option
******************************************
+GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
-=-=(Alexi - Thu, 05 Nov 2009, 12:37)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.11441 2009-11-05 12:37:16.000000000 +0200
+++ /tmp/wklog.40.new.11441 2009-11-05 12:37:16.000000000 +0200
@@ -1,9 +1,18 @@
OPTION: 2.5 Extend Query Events With Tables Info
================================================
-1. Query_log_event Binary Format
-********************************
-Changes to be done:
+1. Adding --binlog-with-tables-info option
+******************************************
+
+When set, Query events are to be written in the extended binary
+format which contains tables_info. When not set, Query events
+are to be written in usual format (without any changes).
+
+2. Query event extended binary format
+*************************************
+
+When --binlog-with-tables-info is set, Query events are writen
+to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
@@ -24,12 +33,12 @@
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
-+ tables_info_len 2 (see Note 2)
++ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
-+ db db_len (see Note 3)
++ db db_len (see Note 2)
query query_len
+ tables_info
@@ -37,7 +46,7 @@
---------------------------------
Name Size (bytes)
---------------------------------
- db_len 1 (see Note 4)
+ db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
@@ -48,19 +57,99 @@
table_name table_name_len
NOTES
-1. Currently Query_log_event format doesn't include 'query_len' because
+1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
-2. If tables_info is not included in the event (--binlog-with-tables-info
- option), tables_info_len = 0.
-3. The trailing zero is redundant since the length is already known.
-4. In case of db = current db, db_len = 0 and db = empty, because
- current db is already included in the current event format.
+2. For 'db' (current db) the trailing zero is redundant since the length
+ is already known.
+3. db_len = 0 means that this is the current db.
+
+When reading Query events from binary log, we can recognize its format
+by its post-header length: in extended case the post-header includes 4
+additional bytes.
+
+ #define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
++ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
+ ...
+ #define Q_STATUS_VARS_LEN_OFFSET 11
++ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
++ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+3. Changes in log events
+************************
+
+3.1. Format description event
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Changes needed here concern setting post-header length for Query events.
+This setting is done in Format description event constructor which creates
+the event for writing to binary log:
+
+ if (binlog_with_tables_info)
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
+ else
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
+
+This change is to be done only for case binlog_ver = 4.
+
+NOTE. The refered above constructor is allowed to be invoked in a client
+context for creating "artificial" Format description events in case of
+MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
+(because of 'binlog_with_tables_info') and taking into account the
+"MySQL < 5.0" restriction, we have to #ifdef out the above code in
+following manner:
+
+ switch (binlog_ver) {
+ case 4: /* MySQL 5.0 and higher */
++ #ifndef MYSQL_CLIENT
+ ...
++ #else
++ <error>
++ #endif
+ case 1:
+ case 3:
+ ...
+ }
+
+3.2. Query event
+~~~~~~~~~~~~~~~~
+Changes needed here include adding tables_info and tables_info_len
+members (member for query length already exists) and modifying the
+following function-members:
+
+Query_log_event(buf) constructor
+--------------------------------
+[Parses binary format written to the 'buf']
+
+Getting post-header length from the Format description event (passed
+to the constructor as an argument), define whether buf contains an
+extended or usual Query event and parse the buf contents accordingly.
+
+NOTE. Defining Query event format here should be done with taking into
+account that this constructor can be called within a Query-derived
+event with the event_type argument != QUERY_EVENT.
+
+Query_log_event(thd) constructor
+--------------------------------
+[Creates the event for binlogging]
+
+In case of binlog_with_tables_info = TRUE, set additionally query_len,
+tables_info_len, and tables_info members (the constructor is to have
+an additional 'tables_info' argument).
+
+write() function
+----------------
+[Writes the event to binlog]
+
+In case of binlog_with_tables_info = TRUE, write additional members
+(query_len, tables_info_len, and tables_info) to binary log. Also
+write corresponding whole event length to the common-header.
+
+<To be continued>
-2. Where to get tables info from?
+4. Where to get tables info from?
*********************************
-2.1. Case study: CREATE TABLE
-******************************
+4.1. Case study: CREATE TABLE
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
@@ -129,4 +218,4 @@
}
}
-To be continued
+<To be continued>
-=-=(Alexi - Wed, 04 Nov 2009, 10:21)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.6734 2009-11-04 10:21:20.000000000 +0200
+++ /tmp/wklog.40.new.6734 2009-11-04 10:21:20.000000000 +0200
@@ -21,9 +21,9 @@
slave_proxy_id 4
exec_time 4
db_len 1
-+ query_len 2 (see Note 1)
error_code 2
status_vars_len 2
++ query_len 2 (see Note 1)
+ tables_info_len 2 (see Note 2)
---------------------------------
BODY:
-=-=(Alexi - Tue, 03 Nov 2009, 11:19)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.7187 2009-11-03 11:19:22.000000000 +0200
+++ /tmp/wklog.40.new.7187 2009-11-03 11:19:22.000000000 +0200
@@ -1 +1,132 @@
+OPTION: 2.5 Extend Query Events With Tables Info
+================================================
+1. Query_log_event Binary Format
+********************************
+Changes to be done:
+
+ Query_log_event binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ COMMON HEADER:
+ timestamp 4
+ type 1
+ server_id 4
+ total_size 4
+ master_position 4
+ flags 2
+ ---------------------------------
+ POST HEADER:
+ slave_proxy_id 4
+ exec_time 4
+ db_len 1
++ query_len 2 (see Note 1)
+ error_code 2
+ status_vars_len 2
++ tables_info_len 2 (see Note 2)
+ ---------------------------------
+ BODY:
+ status_vars status_vars_len
+- db db_len + 1
++ db db_len (see Note 3)
+ query query_len
++ tables_info
+
+ tables_info binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ db_len 1 (see Note 4)
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+ ...
+ db_len 1
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+
+NOTES
+1. Currently Query_log_event format doesn't include 'query_len' because
+ it considers the query to extent to the end of the event.
+2. If tables_info is not included in the event (--binlog-with-tables-info
+ option), tables_info_len = 0.
+3. The trailing zero is redundant since the length is already known.
+4. In case of db = current db, db_len = 0 and db = empty, because
+ current db is already included in the current event format.
+
+2. Where to get tables info from?
+*********************************
+
+2.1. Case study: CREATE TABLE
+******************************
+
+*** CREATE TABLE table [SELECT ...]
+
+ bool mysql_create_table_no_lock(
+ THD *thd,
+ const char *db,
+ const char *table_name, ...)
+ {
+ ...
+ // -------------------------------------
+ // WL40: To be included in tables_info:
+ // * db, table_name
+ // * thd->lex->query_tables (tables refered to in
+ // the select-part; empty if no select-part)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+
+*** CREATE TABLE table LIKE src-table
+
+ bool mysql_create_like_table(
+ ...
+ TABLE_LIST *table,
+ TABLE_LIST *src_table,
+ ...)
+ {
+ ...
+ if (thd->current_stmt_binlog_row_based)
+ { // RBR: In this case we don't replicate temp tables
+ if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ if (src_table->table->s->tmp_table)
+ { // CREATE normal-table LIKE temp-table:
+
+ // Generate new query without LIKE-part
+ store_create_info(thd, table, &query, create_info, FALSE);
+
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table (src_table is not included)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, query.ptr(), query.length());
+ }
+ else
+ { // CREATE normal-table LIKE normal-table
+
+ // -------------------------------------
+ // WL40: To include to log_tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+ // CREATE temp-table LIKE ...
+ // This case is not replicated
+ }
+ else
+ { // SBR:
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+
+To be continued
-=-=(Alexi - Mon, 02 Nov 2009, 11:34)=-=-
Worked 2 hours on option 2.5
Worked 2 hours and estimate 48 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Mon, 02 Nov 2009, 11:20)=-=-
High-Level Specification modified.
--- /tmp/wklog.40.old.4848 2009-11-02 11:20:24.000000000 +0200
+++ /tmp/wklog.40.new.4848 2009-11-02 11:20:24.000000000 +0200
@@ -90,3 +90,25 @@
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
+2.5 Extend Query Events With Tables Info
+----------------------------------------
+
+We could extend query events structure with a tables info - a list of tables
+which the query refers to:
+
+ <current query event structure>
+ tables_info_len
+ dbase_len dbase
+ table_len table
+ ...
+ dbase_len dbase
+ table_len table
+
+Note. In case of <dbase> = current data base, we can set dbase_len = 0
+ and dbase = empty because current query event structure already
+ includes current data base name.
+
+Note. Possibly it is reasonable also to add a --binlog-with-tables-info
+ option which defines whether tables info must be included to the
+ query events.
+
-=-=(Knielsen - Fri, 14 Aug 2009, 15:47)=-=-
High-Level Specification modified.
--- /tmp/wklog.40.old.10896 2009-08-14 15:47:39.000000000 +0300
+++ /tmp/wklog.40.new.10896 2009-08-14 15:47:39.000000000 +0300
@@ -72,3 +72,21 @@
/* !mysqlbinlog: updates t1,db3.t2 */ UPDATE t1 LEFT JOIN ...
and further processing in mysqlbinlog will be trivial.
+
+2.4 Implement server functionality to ignore certain tables
+-----------------------------------------------------------
+
+We could add a general facility in the server to ignore certain tables:
+
+ SET SESSION ignored_tables = "db1.t1,db2.t2";
+
+This would work similar to --replicate-ignore-table, but in a general way not
+restricted to the slave SQL thread.
+
+It would then be trivial for mysqlbinlog to add such statements at the start
+of the output, or probably the user could just do it manually with no need for
+additional options for mysqlbinlog.
+
+It might be useful to integrate this with the code that already handles
+--replicate-ignore-db and similar slave options.
+
------------------------------------------------------------
-=-=(View All Progress Notes, 14 total)=-=-
http://askmonty.org/worklog/index.pl?tid=40&nolimit=1
DESCRIPTION:
Replication slave can be set to filter updates to certain tables with
--replicate-[wild-]{do,ignore}-table options.
This task is about adding similar functionality to mysqlbinlog.
HIGH-LEVEL SPECIFICATION:
1. Context
----------
(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
overview)
At the moment, the server has these replication slave options:
--replicate-do-table=db.tbl
--replicate-ignore-table=db.tbl
--replicate-wild-do-table=pattern.pattern
--replicate-wild-ignore-table=pattern.pattern
They affect both RBR and SBR events. SBR events are checked after the
statement has been parsed, the server iterates over list of used tables and
checks them againist --replicate instructions.
What is interesting is that this scheme still allows to update the ignored
table through a VIEW.
2. Table filtering in mysqlbinlog
---------------------------------
Per-table filtering of RBR events is easy (as it is relatively easy to extract
the name of the table that the event applies to).
Per-table filtering of SBR events is hard, as generally it is not apparent
which tables the statement refers to.
This opens possible options:
2.1 Put the parser into mysqlbinlog
-----------------------------------
Once we have a full parser in mysqlbinlog, we'll be able to check which tables
are used by a statement, and will allow to show behaviour identical to those
that one obtains when using --replicate-* slave options.
(It is not clear how much effort is needed to put the parser into mysqlbinlog.
Any guesses?)
2.2 Use dumb regexp match
-------------------------
Use a really dumb approach. A query is considered to be modifying table X if
it matches an expression
CREATE TABLE $tablename
DROP $tablename
UPDATE ...$tablename ... SET // here '...' can't contain the word 'SET'
DELETE ...$tablename ... WHERE // same as above
ALTER TABLE $tablename
.. etc (go get from the grammar) ..
The advantage over doing the same in awk is that mysqlbinlog will also process
RBR statements, and together with that will provide a working solution for
those who are careful with their table names not mixing with string constants
and such.
(TODO: string constants are of particular concern as they come from
[potentially hostile] users, unlike e.g. table aliases which come from
[not hostile] developers. Remove also all string constants before attempting
to do match?)
2.3 Have the master put annotations
-----------------------------------
We could add a master option so that it injects into query a mark that tells
which tables the query will affect, e.g. for the query
UPDATE t1 LEFT JOIN db3.t2 ON ... WHERE ...
the binlog will have
/* !mysqlbinlog: updates t1,db3.t2 */ UPDATE t1 LEFT JOIN ...
and further processing in mysqlbinlog will be trivial.
2.4 Implement server functionality to ignore certain tables
-----------------------------------------------------------
We could add a general facility in the server to ignore certain tables:
SET SESSION ignored_tables = "db1.t1,db2.t2";
This would work similar to --replicate-ignore-table, but in a general way not
restricted to the slave SQL thread.
It would then be trivial for mysqlbinlog to add such statements at the start
of the output, or probably the user could just do it manually with no need for
additional options for mysqlbinlog.
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
2.5 Extend Query Events With Tables Info
----------------------------------------
We could extend query events structure with a tables info - a list of tables
which the query refers to:
<current query event structure>
tables_info_len
dbase_len dbase
table_len table
...
dbase_len dbase
table_len table
Note. In case of <dbase> = current data base, we can set dbase_len = 0
and dbase = empty because current query event structure already
includes current data base name.
Note. Possibly it is reasonable also to add a --binlog-with-tables-info
option which defines whether tables info must be included to the
query events.
LOW-LEVEL DESIGN:
OPTION: 2.5 Extend Query Events With Tables Info
================================================
1. Adding --binlog-with-tables-info option
******************************************
GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
are to be written in usual format (without any changes).
2. Query event extended binary format
*************************************
When --binlog-with-tables-info is set, Query events are writen
to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
Name Size (bytes)
---------------------------------
COMMON HEADER:
timestamp 4
type 1
server_id 4
total_size 4
master_position 4
flags 2
---------------------------------
POST HEADER:
slave_proxy_id 4
exec_time 4
db_len 1
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
+ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
+ db db_len (see Note 2)
query query_len
+ tables_info
tables_info binary format
---------------------------------
Name Size (bytes)
---------------------------------
db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
...
db_len 1
db db_len
table_name_len 1
table_name table_name_len
NOTES
1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
additional bytes.
#define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
+ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
...
#define Q_STATUS_VARS_LEN_OFFSET 11
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
***********************************************************************
HELP NEEDED
***********************************************************************
The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
log_event.h
~~~~~~~~~~~
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
LOG_EVENT_HEADER_LEN + /* write_header */ \
QUERY_HEADER_LEN + /* write_data */ \
EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
NAME_LEN + 1)
which is used only for setting
thd->variables.max_allowed_packet
mysql->net.max_packet_size
Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
(without making any other changes) be substituted in this definition by
QUERY_HEADER_LEN_EXT.
Below I list all places where MAX_LOG_EVENT_HEADER is used:
slave.cc
~~~~~~~~
static int init_slave_thread(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
slave threads, since a replication event can become this much larger
than the corresponding packet (query) sent from client to master.
*/
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
...
}
pthread_handler_t handle_slave_io(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
thread, since a replication event can become this much larger than
the corresponding packet (query) sent from client to master.
*/
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
...
}
sql_repl.cc
~~~~~~~~~~~
void mysql_binlog_send(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
this larger than the corresponding packet (query) sent
from client to master.
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
bool mysql_show_binlog_events(...)
{ ...
/*
to account binlog event header size
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
3. Changes in log events
************************
3.1. Format description event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Changes needed here concern setting post-header length for Query events.
This setting is done in Format description event constructor which creates
the event for writing to binary log:
if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
This change is to be done only for case binlog_ver = 4.
NOTE. The refered above constructor is allowed to be invoked in a client
context for creating "artificial" Format description events in case of
MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
(because of 'binlog_with_tables_info') and taking into account the
"MySQL < 5.0" restriction, we have to #ifdef out the above code in
following manner:
switch (binlog_ver) {
+ #ifndef MYSQL_CLIENT
case 4: /* MySQL 5.0 and higher */
...
break;
+ #endif
case 1:
case 3:
...
}
3.2. Query event
~~~~~~~~~~~~~~~~
Changes needed here include adding tables_info and tables_info_len
members (member for query length already exists) and modifying the
following function-members:
Query_log_event(buf) constructor
--------------------------------
[Parses binary format written to the 'buf']
Getting post-header length from the Format description event (passed
to the constructor as an argument), define whether buf contains an
extended or usual Query event and parse the buf contents accordingly.
NOTE. Defining Query event format here should be done with taking into
account that this constructor can be called within a Query-derived
event with the event_type argument != QUERY_EVENT.
Query_log_event(thd) constructor
--------------------------------
[Creates the event for binlogging]
In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
write() function
----------------
[Writes the event to binlog]
In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
<To be continued>
4. Where to get tables info from?
*********************************
4.1. Case study: CREATE TABLE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
bool mysql_create_table_no_lock(
THD *thd,
const char *db,
const char *table_name, ...)
{
...
// -------------------------------------
// WL40: To be included in tables_info:
// * db, table_name
// * thd->lex->query_tables (tables refered to in
// the select-part; empty if no select-part)
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
*** CREATE TABLE table LIKE src-table
bool mysql_create_like_table(
...
TABLE_LIST *table,
TABLE_LIST *src_table,
...)
{
...
if (thd->current_stmt_binlog_row_based)
{ // RBR: In this case we don't replicate temp tables
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (src_table->table->s->tmp_table)
{ // CREATE normal-table LIKE temp-table:
// Generate new query without LIKE-part
store_create_info(thd, table, &query, create_info, FALSE);
// -------------------------------------
// WL40: To include to tables_info:
// * table (src_table is not included)
// -------------------------------------
write_bin_log(thd, TRUE, query.ptr(), query.length());
}
else
{ // CREATE normal-table LIKE normal-table
// -------------------------------------
// WL40: To include to log_tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
// CREATE temp-table LIKE ...
// This case is not replicated
}
else
{ // SBR:
// -------------------------------------
// WL40: To include to tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
<To be continued>
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Bothorsen): Add a mysqlbinlog option to filter updates to certain tables (40)
by worklog-noreply@askmonty.org 17 Nov '09
by worklog-noreply@askmonty.org 17 Nov '09
17 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to filter updates to certain tables
CREATION DATE..: Mon, 10 Aug 2009, 13:25
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Psergey
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 40 (http://askmonty.org/worklog/?tid=40)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 32
ESTIMATE.......: 32 (hours remain)
ORIG. ESTIMATE.: 48
PROGRESS NOTES:
-=-=(Bothorsen - Tue, 17 Nov 2009, 17:20)=-=-
Alex is closer to a working patch now.
Worked 14 hours and estimate 32 hours remain (original estimate unchanged).
-=-=(Bothorsen - Thu, 12 Nov 2009, 13:13)=-=-
Work hours by Alexi and Bo + estimated time for the task.
Worked 16 hours and estimate 46 hours remain (original estimate increased by 14 hours).
-=-=(Alexi - Sun, 08 Nov 2009, 15:18)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.15787 2009-11-08 15:18:11.000000000 +0200
+++ /tmp/wklog.40.new.15787 2009-11-08 15:18:11.000000000 +0200
@@ -62,7 +62,7 @@
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
-3. db_len = 0 means that this is the current db.
+3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
@@ -75,6 +75,77 @@
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+***********************************************************************
+HELP NEEDED
+***********************************************************************
+The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
+
+log_event.h
+~~~~~~~~~~~
+#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
+ LOG_EVENT_HEADER_LEN + /* write_header */ \
+ QUERY_HEADER_LEN + /* write_data */ \
+ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
+ MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
+ NAME_LEN + 1)
+
+which is used only for setting
+
+ thd->variables.max_allowed_packet
+ mysql->net.max_packet_size
+
+Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
+(without making any other changes) be substituted in this definition by
+QUERY_HEADER_LEN_EXT.
+
+Below I list all places where MAX_LOG_EVENT_HEADER is used:
+
+slave.cc
+~~~~~~~~
+static int init_slave_thread(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
+ slave threads, since a replication event can become this much larger
+ than the corresponding packet (query) sent from client to master.
+ */
+ thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
+ ...
+}
+pthread_handler_t handle_slave_io(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
+ thread, since a replication event can become this much larger than
+ the corresponding packet (query) sent from client to master.
+ */
+ mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
+sql_repl.cc
+~~~~~~~~~~~
+void mysql_binlog_send(...)
+{ ...
+ /*
+ Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
+ this larger than the corresponding packet (query) sent
+ from client to master.
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+bool mysql_show_binlog_events(...)
+{ ...
+ /*
+ to account binlog event header size
+ */
+ thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
+ ...
+}
+
3. Changes in log events
************************
@@ -84,7 +155,7 @@
This setting is done in Format description event constructor which creates
the event for writing to binary log:
- if (binlog_with_tables_info)
+ if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
@@ -99,12 +170,12 @@
following manner:
switch (binlog_ver) {
- case 4: /* MySQL 5.0 and higher */
+ #ifndef MYSQL_CLIENT
+ case 4: /* MySQL 5.0 and higher */
...
-+ #else
-+ <error>
+ break;
+ #endif
+
case 1:
case 3:
...
@@ -132,7 +203,7 @@
--------------------------------
[Creates the event for binlogging]
-In case of binlog_with_tables_info = TRUE, set additionally query_len,
+In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
@@ -140,7 +211,7 @@
----------------
[Writes the event to binlog]
-In case of binlog_with_tables_info = TRUE, write additional members
+In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
-=-=(Alexi - Sun, 08 Nov 2009, 10:40)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.5055 2009-11-08 08:40:02.000000000 +0000
+++ /tmp/wklog.40.new.5055 2009-11-08 08:40:02.000000000 +0000
@@ -3,6 +3,7 @@
1. Adding --binlog-with-tables-info option
******************************************
+GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
-=-=(Alexi - Thu, 05 Nov 2009, 12:37)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.11441 2009-11-05 12:37:16.000000000 +0200
+++ /tmp/wklog.40.new.11441 2009-11-05 12:37:16.000000000 +0200
@@ -1,9 +1,18 @@
OPTION: 2.5 Extend Query Events With Tables Info
================================================
-1. Query_log_event Binary Format
-********************************
-Changes to be done:
+1. Adding --binlog-with-tables-info option
+******************************************
+
+When set, Query events are to be written in the extended binary
+format which contains tables_info. When not set, Query events
+are to be written in usual format (without any changes).
+
+2. Query event extended binary format
+*************************************
+
+When --binlog-with-tables-info is set, Query events are writen
+to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
@@ -24,12 +33,12 @@
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
-+ tables_info_len 2 (see Note 2)
++ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
-+ db db_len (see Note 3)
++ db db_len (see Note 2)
query query_len
+ tables_info
@@ -37,7 +46,7 @@
---------------------------------
Name Size (bytes)
---------------------------------
- db_len 1 (see Note 4)
+ db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
@@ -48,19 +57,99 @@
table_name table_name_len
NOTES
-1. Currently Query_log_event format doesn't include 'query_len' because
+1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
-2. If tables_info is not included in the event (--binlog-with-tables-info
- option), tables_info_len = 0.
-3. The trailing zero is redundant since the length is already known.
-4. In case of db = current db, db_len = 0 and db = empty, because
- current db is already included in the current event format.
+2. For 'db' (current db) the trailing zero is redundant since the length
+ is already known.
+3. db_len = 0 means that this is the current db.
+
+When reading Query events from binary log, we can recognize its format
+by its post-header length: in extended case the post-header includes 4
+additional bytes.
+
+ #define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
++ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
+ ...
+ #define Q_STATUS_VARS_LEN_OFFSET 11
++ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
++ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
+
+3. Changes in log events
+************************
+
+3.1. Format description event
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Changes needed here concern setting post-header length for Query events.
+This setting is done in Format description event constructor which creates
+the event for writing to binary log:
+
+ if (binlog_with_tables_info)
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
+ else
+ post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
+
+This change is to be done only for case binlog_ver = 4.
+
+NOTE. The refered above constructor is allowed to be invoked in a client
+context for creating "artificial" Format description events in case of
+MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
+(because of 'binlog_with_tables_info') and taking into account the
+"MySQL < 5.0" restriction, we have to #ifdef out the above code in
+following manner:
+
+ switch (binlog_ver) {
+ case 4: /* MySQL 5.0 and higher */
++ #ifndef MYSQL_CLIENT
+ ...
++ #else
++ <error>
++ #endif
+ case 1:
+ case 3:
+ ...
+ }
+
+3.2. Query event
+~~~~~~~~~~~~~~~~
+Changes needed here include adding tables_info and tables_info_len
+members (member for query length already exists) and modifying the
+following function-members:
+
+Query_log_event(buf) constructor
+--------------------------------
+[Parses binary format written to the 'buf']
+
+Getting post-header length from the Format description event (passed
+to the constructor as an argument), define whether buf contains an
+extended or usual Query event and parse the buf contents accordingly.
+
+NOTE. Defining Query event format here should be done with taking into
+account that this constructor can be called within a Query-derived
+event with the event_type argument != QUERY_EVENT.
+
+Query_log_event(thd) constructor
+--------------------------------
+[Creates the event for binlogging]
+
+In case of binlog_with_tables_info = TRUE, set additionally query_len,
+tables_info_len, and tables_info members (the constructor is to have
+an additional 'tables_info' argument).
+
+write() function
+----------------
+[Writes the event to binlog]
+
+In case of binlog_with_tables_info = TRUE, write additional members
+(query_len, tables_info_len, and tables_info) to binary log. Also
+write corresponding whole event length to the common-header.
+
+<To be continued>
-2. Where to get tables info from?
+4. Where to get tables info from?
*********************************
-2.1. Case study: CREATE TABLE
-******************************
+4.1. Case study: CREATE TABLE
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
@@ -129,4 +218,4 @@
}
}
-To be continued
+<To be continued>
-=-=(Alexi - Wed, 04 Nov 2009, 10:21)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.6734 2009-11-04 10:21:20.000000000 +0200
+++ /tmp/wklog.40.new.6734 2009-11-04 10:21:20.000000000 +0200
@@ -21,9 +21,9 @@
slave_proxy_id 4
exec_time 4
db_len 1
-+ query_len 2 (see Note 1)
error_code 2
status_vars_len 2
++ query_len 2 (see Note 1)
+ tables_info_len 2 (see Note 2)
---------------------------------
BODY:
-=-=(Alexi - Tue, 03 Nov 2009, 11:19)=-=-
Low Level Design modified.
--- /tmp/wklog.40.old.7187 2009-11-03 11:19:22.000000000 +0200
+++ /tmp/wklog.40.new.7187 2009-11-03 11:19:22.000000000 +0200
@@ -1 +1,132 @@
+OPTION: 2.5 Extend Query Events With Tables Info
+================================================
+1. Query_log_event Binary Format
+********************************
+Changes to be done:
+
+ Query_log_event binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ COMMON HEADER:
+ timestamp 4
+ type 1
+ server_id 4
+ total_size 4
+ master_position 4
+ flags 2
+ ---------------------------------
+ POST HEADER:
+ slave_proxy_id 4
+ exec_time 4
+ db_len 1
++ query_len 2 (see Note 1)
+ error_code 2
+ status_vars_len 2
++ tables_info_len 2 (see Note 2)
+ ---------------------------------
+ BODY:
+ status_vars status_vars_len
+- db db_len + 1
++ db db_len (see Note 3)
+ query query_len
++ tables_info
+
+ tables_info binary format
+ ---------------------------------
+ Name Size (bytes)
+ ---------------------------------
+ db_len 1 (see Note 4)
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+ ...
+ db_len 1
+ db db_len
+ table_name_len 1
+ table_name table_name_len
+
+NOTES
+1. Currently Query_log_event format doesn't include 'query_len' because
+ it considers the query to extent to the end of the event.
+2. If tables_info is not included in the event (--binlog-with-tables-info
+ option), tables_info_len = 0.
+3. The trailing zero is redundant since the length is already known.
+4. In case of db = current db, db_len = 0 and db = empty, because
+ current db is already included in the current event format.
+
+2. Where to get tables info from?
+*********************************
+
+2.1. Case study: CREATE TABLE
+******************************
+
+*** CREATE TABLE table [SELECT ...]
+
+ bool mysql_create_table_no_lock(
+ THD *thd,
+ const char *db,
+ const char *table_name, ...)
+ {
+ ...
+ // -------------------------------------
+ // WL40: To be included in tables_info:
+ // * db, table_name
+ // * thd->lex->query_tables (tables refered to in
+ // the select-part; empty if no select-part)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+
+*** CREATE TABLE table LIKE src-table
+
+ bool mysql_create_like_table(
+ ...
+ TABLE_LIST *table,
+ TABLE_LIST *src_table,
+ ...)
+ {
+ ...
+ if (thd->current_stmt_binlog_row_based)
+ { // RBR: In this case we don't replicate temp tables
+ if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ if (src_table->table->s->tmp_table)
+ { // CREATE normal-table LIKE temp-table:
+
+ // Generate new query without LIKE-part
+ store_create_info(thd, table, &query, create_info, FALSE);
+
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table (src_table is not included)
+ // -------------------------------------
+ write_bin_log(thd, TRUE, query.ptr(), query.length());
+ }
+ else
+ { // CREATE normal-table LIKE normal-table
+
+ // -------------------------------------
+ // WL40: To include to log_tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+ // CREATE temp-table LIKE ...
+ // This case is not replicated
+ }
+ else
+ { // SBR:
+ // -------------------------------------
+ // WL40: To include to tables_info:
+ // * table
+ // * src_table
+ // -------------------------------------
+ write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ }
+ }
+
+To be continued
-=-=(Alexi - Mon, 02 Nov 2009, 11:34)=-=-
Worked 2 hours on option 2.5
Worked 2 hours and estimate 48 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Mon, 02 Nov 2009, 11:20)=-=-
High-Level Specification modified.
--- /tmp/wklog.40.old.4848 2009-11-02 11:20:24.000000000 +0200
+++ /tmp/wklog.40.new.4848 2009-11-02 11:20:24.000000000 +0200
@@ -90,3 +90,25 @@
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
+2.5 Extend Query Events With Tables Info
+----------------------------------------
+
+We could extend query events structure with a tables info - a list of tables
+which the query refers to:
+
+ <current query event structure>
+ tables_info_len
+ dbase_len dbase
+ table_len table
+ ...
+ dbase_len dbase
+ table_len table
+
+Note. In case of <dbase> = current data base, we can set dbase_len = 0
+ and dbase = empty because current query event structure already
+ includes current data base name.
+
+Note. Possibly it is reasonable also to add a --binlog-with-tables-info
+ option which defines whether tables info must be included to the
+ query events.
+
-=-=(Knielsen - Fri, 14 Aug 2009, 15:47)=-=-
High-Level Specification modified.
--- /tmp/wklog.40.old.10896 2009-08-14 15:47:39.000000000 +0300
+++ /tmp/wklog.40.new.10896 2009-08-14 15:47:39.000000000 +0300
@@ -72,3 +72,21 @@
/* !mysqlbinlog: updates t1,db3.t2 */ UPDATE t1 LEFT JOIN ...
and further processing in mysqlbinlog will be trivial.
+
+2.4 Implement server functionality to ignore certain tables
+-----------------------------------------------------------
+
+We could add a general facility in the server to ignore certain tables:
+
+ SET SESSION ignored_tables = "db1.t1,db2.t2";
+
+This would work similar to --replicate-ignore-table, but in a general way not
+restricted to the slave SQL thread.
+
+It would then be trivial for mysqlbinlog to add such statements at the start
+of the output, or probably the user could just do it manually with no need for
+additional options for mysqlbinlog.
+
+It might be useful to integrate this with the code that already handles
+--replicate-ignore-db and similar slave options.
+
------------------------------------------------------------
-=-=(View All Progress Notes, 14 total)=-=-
http://askmonty.org/worklog/index.pl?tid=40&nolimit=1
DESCRIPTION:
Replication slave can be set to filter updates to certain tables with
--replicate-[wild-]{do,ignore}-table options.
This task is about adding similar functionality to mysqlbinlog.
HIGH-LEVEL SPECIFICATION:
1. Context
----------
(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
overview)
At the moment, the server has these replication slave options:
--replicate-do-table=db.tbl
--replicate-ignore-table=db.tbl
--replicate-wild-do-table=pattern.pattern
--replicate-wild-ignore-table=pattern.pattern
They affect both RBR and SBR events. SBR events are checked after the
statement has been parsed, the server iterates over list of used tables and
checks them againist --replicate instructions.
What is interesting is that this scheme still allows to update the ignored
table through a VIEW.
2. Table filtering in mysqlbinlog
---------------------------------
Per-table filtering of RBR events is easy (as it is relatively easy to extract
the name of the table that the event applies to).
Per-table filtering of SBR events is hard, as generally it is not apparent
which tables the statement refers to.
This opens possible options:
2.1 Put the parser into mysqlbinlog
-----------------------------------
Once we have a full parser in mysqlbinlog, we'll be able to check which tables
are used by a statement, and will allow to show behaviour identical to those
that one obtains when using --replicate-* slave options.
(It is not clear how much effort is needed to put the parser into mysqlbinlog.
Any guesses?)
2.2 Use dumb regexp match
-------------------------
Use a really dumb approach. A query is considered to be modifying table X if
it matches an expression
CREATE TABLE $tablename
DROP $tablename
UPDATE ...$tablename ... SET // here '...' can't contain the word 'SET'
DELETE ...$tablename ... WHERE // same as above
ALTER TABLE $tablename
.. etc (go get from the grammar) ..
The advantage over doing the same in awk is that mysqlbinlog will also process
RBR statements, and together with that will provide a working solution for
those who are careful with their table names not mixing with string constants
and such.
(TODO: string constants are of particular concern as they come from
[potentially hostile] users, unlike e.g. table aliases which come from
[not hostile] developers. Remove also all string constants before attempting
to do match?)
2.3 Have the master put annotations
-----------------------------------
We could add a master option so that it injects into query a mark that tells
which tables the query will affect, e.g. for the query
UPDATE t1 LEFT JOIN db3.t2 ON ... WHERE ...
the binlog will have
/* !mysqlbinlog: updates t1,db3.t2 */ UPDATE t1 LEFT JOIN ...
and further processing in mysqlbinlog will be trivial.
2.4 Implement server functionality to ignore certain tables
-----------------------------------------------------------
We could add a general facility in the server to ignore certain tables:
SET SESSION ignored_tables = "db1.t1,db2.t2";
This would work similar to --replicate-ignore-table, but in a general way not
restricted to the slave SQL thread.
It would then be trivial for mysqlbinlog to add such statements at the start
of the output, or probably the user could just do it manually with no need for
additional options for mysqlbinlog.
It might be useful to integrate this with the code that already handles
--replicate-ignore-db and similar slave options.
2.5 Extend Query Events With Tables Info
----------------------------------------
We could extend query events structure with a tables info - a list of tables
which the query refers to:
<current query event structure>
tables_info_len
dbase_len dbase
table_len table
...
dbase_len dbase
table_len table
Note. In case of <dbase> = current data base, we can set dbase_len = 0
and dbase = empty because current query event structure already
includes current data base name.
Note. Possibly it is reasonable also to add a --binlog-with-tables-info
option which defines whether tables info must be included to the
query events.
LOW-LEVEL DESIGN:
OPTION: 2.5 Extend Query Events With Tables Info
================================================
1. Adding --binlog-with-tables-info option
******************************************
GLOBAL, read-only option.
When set, Query events are to be written in the extended binary
format which contains tables_info. When not set, Query events
are to be written in usual format (without any changes).
2. Query event extended binary format
*************************************
When --binlog-with-tables-info is set, Query events are writen
to binary log in the following (extended) format.
Query_log_event binary format
---------------------------------
Name Size (bytes)
---------------------------------
COMMON HEADER:
timestamp 4
type 1
server_id 4
total_size 4
master_position 4
flags 2
---------------------------------
POST HEADER:
slave_proxy_id 4
exec_time 4
db_len 1
error_code 2
status_vars_len 2
+ query_len 2 (see Note 1)
+ tables_info_len 2
---------------------------------
BODY:
status_vars status_vars_len
- db db_len + 1
+ db db_len (see Note 2)
query query_len
+ tables_info
tables_info binary format
---------------------------------
Name Size (bytes)
---------------------------------
db_len 1 (see Note 3)
db db_len
table_name_len 1
table_name table_name_len
...
db_len 1
db db_len
table_name_len 1
table_name table_name_len
NOTES
1. In usual format, Query_log_event doesn't include 'query_len' because
it considers the query to extent to the end of the event.
2. For 'db' (current db) the trailing zero is redundant since the length
is already known.
3. In tables_info, db_len = 0 means that this is the current db.
When reading Query events from binary log, we can recognize its format
by its post-header length: in extended case the post-header includes 4
additional bytes.
#define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 4)
+ #define QUERY_HEADER_LEN_EXT (QUERY_HEADER_LEN + 4)
...
#define Q_STATUS_VARS_LEN_OFFSET 11
+ #define Q_QUERY_LEN_OFFSET Q_STATUS_VARS_LEN_OFFSET + 2
+ #define Q_QUERY_TABLES_INFO_LEN_OFFSET Q_QUERY_LEN_OFFSET + 2
***********************************************************************
HELP NEEDED
***********************************************************************
The QUERY_HEADER_LEN is used in the definition of MAX_LOG_EVENT_HEADER:
log_event.h
~~~~~~~~~~~
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
LOG_EVENT_HEADER_LEN + /* write_header */ \
QUERY_HEADER_LEN + /* write_data */ \
EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
NAME_LEN + 1)
which is used only for setting
thd->variables.max_allowed_packet
mysql->net.max_packet_size
Looks like (but I am not quite sure) that QUERY_HEADER_LEN can simply
(without making any other changes) be substituted in this definition by
QUERY_HEADER_LEN_EXT.
Below I list all places where MAX_LOG_EVENT_HEADER is used:
slave.cc
~~~~~~~~
static int init_slave_thread(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
slave threads, since a replication event can become this much larger
than the corresponding packet (query) sent from client to master.
*/
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
...
}
pthread_handler_t handle_slave_io(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
thread, since a replication event can become this much larger than
the corresponding packet (query) sent from client to master.
*/
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
...
}
sql_repl.cc
~~~~~~~~~~~
void mysql_binlog_send(...)
{ ...
/*
Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
this larger than the corresponding packet (query) sent
from client to master.
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
bool mysql_show_binlog_events(...)
{ ...
/*
to account binlog event header size
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
...
}
3. Changes in log events
************************
3.1. Format description event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Changes needed here concern setting post-header length for Query events.
This setting is done in Format description event constructor which creates
the event for writing to binary log:
if (opt_binlog_with_tables_info)
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN_EXT;
else
post_header_len[QUERY_EVENT - 1] = QUERY_HEADER_LEN;
This change is to be done only for case binlog_ver = 4.
NOTE. The refered above constructor is allowed to be invoked in a client
context for creating "artificial" Format description events in case of
MySQL < 5.0 (e.g. see mysqlbinlog code). To avoid compilation problems
(because of 'binlog_with_tables_info') and taking into account the
"MySQL < 5.0" restriction, we have to #ifdef out the above code in
following manner:
switch (binlog_ver) {
+ #ifndef MYSQL_CLIENT
case 4: /* MySQL 5.0 and higher */
...
break;
+ #endif
case 1:
case 3:
...
}
3.2. Query event
~~~~~~~~~~~~~~~~
Changes needed here include adding tables_info and tables_info_len
members (member for query length already exists) and modifying the
following function-members:
Query_log_event(buf) constructor
--------------------------------
[Parses binary format written to the 'buf']
Getting post-header length from the Format description event (passed
to the constructor as an argument), define whether buf contains an
extended or usual Query event and parse the buf contents accordingly.
NOTE. Defining Query event format here should be done with taking into
account that this constructor can be called within a Query-derived
event with the event_type argument != QUERY_EVENT.
Query_log_event(thd) constructor
--------------------------------
[Creates the event for binlogging]
In case of opt_binlog_with_tables_info = TRUE, set additionally query_len,
tables_info_len, and tables_info members (the constructor is to have
an additional 'tables_info' argument).
write() function
----------------
[Writes the event to binlog]
In case of opt_binlog_with_tables_info = TRUE, write additional members
(query_len, tables_info_len, and tables_info) to binary log. Also
write corresponding whole event length to the common-header.
<To be continued>
4. Where to get tables info from?
*********************************
4.1. Case study: CREATE TABLE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** CREATE TABLE table [SELECT ...]
bool mysql_create_table_no_lock(
THD *thd,
const char *db,
const char *table_name, ...)
{
...
// -------------------------------------
// WL40: To be included in tables_info:
// * db, table_name
// * thd->lex->query_tables (tables refered to in
// the select-part; empty if no select-part)
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
*** CREATE TABLE table LIKE src-table
bool mysql_create_like_table(
...
TABLE_LIST *table,
TABLE_LIST *src_table,
...)
{
...
if (thd->current_stmt_binlog_row_based)
{ // RBR: In this case we don't replicate temp tables
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (src_table->table->s->tmp_table)
{ // CREATE normal-table LIKE temp-table:
// Generate new query without LIKE-part
store_create_info(thd, table, &query, create_info, FALSE);
// -------------------------------------
// WL40: To include to tables_info:
// * table (src_table is not included)
// -------------------------------------
write_bin_log(thd, TRUE, query.ptr(), query.length());
}
else
{ // CREATE normal-table LIKE normal-table
// -------------------------------------
// WL40: To include to log_tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
// CREATE temp-table LIKE ...
// This case is not replicated
}
else
{ // SBR:
// -------------------------------------
// WL40: To include to tables_info:
// * table
// * src_table
// -------------------------------------
write_bin_log(thd, TRUE, thd->query, thd->query_length);
}
}
<To be continued>
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
Hi!
Here is try to implement CRETE TABLE options. Here is only for TABLE,
and no real support from the engine side, but the result looks like:
create table t1 (a int) ttt = xxx;
Warnings:
Warning 1639 Unused option 'ttt' (value 'xxx') of table 'test'.'t1'
I publish it to let other to catch problems on early stage.
1
0
Hi all
I've started using the tag "5.1" for launchpad bugs that should be
fixed before 5.1 final release. This is so that one can easily get an
overview of release activity with this list:
https://bugs.launchpad.net/maria/+bugs?field.tag=5.1
I'm aware that there is also a "Nominate for release" feature, and
would be happy to use that if someone else sets it up. For now it
seems that using tags is the simplest solution.
I don't seem to have rights to set importance of bugs. Of the four
"cosmetics" bugs I've filed last week:
These 2 are MUST have for 5.1 RC:
481311 Anything needed to build MariaDB binaries and packages must be
in the maria launchpad repository Undecided New
481320 Remove "brand/tag" in the official MariaDB 5.1 rpm/deb/tar
binaries (ourdelta, or otherwise) Undecided New
While these 2 can be discussed (ie nice to have):
481298 MariaDB deb/rpm/tar binaries should be called mariadb-*, not
mysql-* Undecided New
481326 Remove "-maria" string from MariaDB tar packages Undecided New
As a general comment, while lp bugtracker may be a bit simplistic, I
think we are not fully using all of its capabilities either. We can
talk about this today on the MP call at least, how to become better
users of it.
Thanks.
henrik
--
email: henrik.ingo(a)avoinelama.fi
tel: +358-40-5697354
www: www.avoinelama.fi/~hingo
book: www.openlife.cc
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2766)
by knielsen@knielsen-hq.org 16 Nov '09
by knielsen@knielsen-hq.org 16 Nov '09
16 Nov '09
#At lp:maria
2766 knielsen(a)knielsen-hq.org 2009-11-16
MySQL 5.1.41 after-merge fix: Fix non-debug build breakage.
modified:
include/my_dbug.h
=== modified file 'include/my_dbug.h'
--- a/include/my_dbug.h 2009-11-16 20:49:51 +0000
+++ b/include/my_dbug.h 2009-11-16 21:35:55 +0000
@@ -132,6 +132,7 @@ extern void _db_flush_();
#else /* No debugger */
#define DBUG_ENTER(a1)
+#define DBUG_VIOLATION_HELPER_LEAVE do { } while(0)
#define DBUG_LEAVE
#define DBUG_RETURN(a1) do { return(a1); } while(0)
#define DBUG_VOID_RETURN do { return; } while(0)
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2765) Bug#42116 WL#17
by knielsen@knielsen-hq.org 16 Nov '09
by knielsen@knielsen-hq.org 16 Nov '09
16 Nov '09
#At lp:maria
2765 knielsen(a)knielsen-hq.org 2009-11-16
Corrected a line from the patch for table elimination (WL#17)
to fix a problem with the test case for bug#42116.
Re-commit of Igor's fix due to re-commit of MySQL 5.1.41 merge.
modified:
sql/sql_select.cc
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-11-16 20:49:51 +0000
+++ b/sql/sql_select.cc 2009-11-16 20:54:33 +0000
@@ -8937,7 +8937,7 @@ static uint reset_nj_counters(JOIN *join
// ~join->eliminated_tables);
nested_join->n_tables= reset_nj_counters(join, &nested_join->join_list);
}
- if (table->table && (table->table->map & ~join->eliminated_tables))
+ if (!table->table || (table->table->map & ~join->eliminated_tables))
n++;
}
DBUG_RETURN(n);
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2764)
by knielsen@knielsen-hq.org 16 Nov '09
by knielsen@knielsen-hq.org 16 Nov '09
16 Nov '09
#At lp:maria
2764 knielsen(a)knielsen-hq.org 2009-11-16 [merge]
Merge with MySQL 5.1, with following additions:
- Moved some code from innodb_plugin to xtradb, to ensure that all tests runs
- Did changes in pbxt and maria storage engines becasue of changes in thd->query
- Reverted wrong code in sql_table.cc for how ROW_FORMAT is used.
This is a re-commit of Monty's merge to eliminate an extra commit from
MySQL-5.1.42 that was accidentally included in the merge.
This is a merge of the MySQL 5.1.41 clone-off (clone-5.1.41-build). In
case there are any extra changes done before final MySQL 5.1.41
release, these will need to be merged later before MariaDB 5.1.41
release.
removed:
mysql-test/include/have_dynamic_loading.inc
mysys/mf_strip.c
storage/innodb_plugin/README
storage/innodb_plugin/handler/handler0vars.h
storage/innodb_plugin/handler/win_delay_loader.cc
storage/innodb_plugin/win-plugin/
storage/innodb_plugin/win-plugin/README
storage/innodb_plugin/win-plugin/win-plugin.diff
added:
mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test
mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test
mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test
mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test
mysql-test/include/have_case_insensitive_fs.inc
mysql-test/include/have_debug_sync.inc
mysql-test/include/have_dynamic_loading.inc
mysql-test/include/have_mysql_upgrade.inc
mysql-test/include/have_not_innodb_plugin.inc
mysql-test/include/not_windows_embedded.inc
mysql-test/lib/v1/incompatible.tests
mysql-test/r/bug46760.result
mysql-test/r/case_insensitive_fs.require
mysql-test/r/debug_sync.result
mysql-test/r/grant_lowercase_fs.result
mysql-test/r/have_debug_sync.require
mysql-test/r/innodb_bug44369.result
mysql-test/r/innodb_bug46000.result
mysql-test/r/innodb_bug47777.result
mysql-test/r/locale.result
mysql-test/r/lowercase_mixed_tmpdir_innodb.result
mysql-test/r/not_true.require
mysql-test/r/partition_innodb_builtin.result
mysql-test/r/partition_innodb_plugin.result
mysql-test/r/partition_open_files_limit.result
mysql-test/r/sp-bugs.result
mysql-test/r/subselect4.result
mysql-test/std_data/binlog_transaction.000001
mysql-test/std_data/latin1.xml
mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result
mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result
mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result
mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result
mysql-test/suite/binlog/r/binlog_stm_do_db.result
mysql-test/suite/binlog/std_data/update-full-row.binlog
mysql-test/suite/binlog/std_data/update-partial-row.binlog
mysql-test/suite/binlog/std_data/write-full-row.binlog
mysql-test/suite/binlog/std_data/write-partial-row.binlog
mysql-test/suite/binlog/t/binlog_delete_and_flush_index.test
mysql-test/suite/binlog/t/binlog_mixed_failure_mixing_engines.test
mysql-test/suite/binlog/t/binlog_row_failure_mixing_engines.test
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test
mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
mysql-test/suite/binlog/t/binlog_stm_do_db.test
mysql-test/suite/federated/federated_debug-master.opt
mysql-test/suite/federated/federated_debug.result
mysql-test/suite/federated/federated_debug.test
mysql-test/suite/innodb/r/innodb-consistent.result
mysql-test/suite/innodb/r/innodb_bug44571.result
mysql-test/suite/innodb/t/innodb-consistent-master.opt
mysql-test/suite/innodb/t/innodb-consistent.test
mysql-test/suite/innodb/t/innodb_bug44571.test
mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result
mysql-test/suite/rpl/r/rpl_mysql_upgrade.result
mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result
mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock-slave.opt
mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test
mysql-test/t/bug46760-master.opt
mysql-test/t/bug46760.test
mysql-test/t/debug_sync.test
mysql-test/t/grant_lowercase_fs.test
mysql-test/t/innodb_bug44369.test
mysql-test/t/innodb_bug46000.test
mysql-test/t/innodb_bug47777.test
mysql-test/t/locale.test
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh
mysql-test/t/lowercase_mixed_tmpdir_innodb.test
mysql-test/t/partition_innodb_builtin.test
mysql-test/t/partition_innodb_plugin.test
mysql-test/t/partition_open_files_limit-master.opt
mysql-test/t/partition_open_files_limit.test
mysql-test/t/sp-bugs.test
mysql-test/t/status-master.opt
mysql-test/t/subselect4.test
sql/debug_sync.cc
sql/debug_sync.h
storage/innodb_plugin/mysql-test/innodb-consistent-master.opt
storage/innodb_plugin/mysql-test/innodb-consistent.result
storage/innodb_plugin/mysql-test/innodb-consistent.test
storage/innodb_plugin/mysql-test/innodb_bug44369.result
storage/innodb_plugin/mysql-test/innodb_bug44369.test
storage/innodb_plugin/mysql-test/innodb_bug44571.result
storage/innodb_plugin/mysql-test/innodb_bug44571.test
storage/innodb_plugin/mysql-test/innodb_bug46000.result
storage/innodb_plugin/mysql-test/innodb_bug46000.test
storage/innodb_plugin/revert_gen.sh
storage/innodb_plugin/scripts/export.sh
storage/innodb_plugin/ut/ut0auxconf_have_gcc_atomics.c
renamed:
mysql-test/r/bug40113.result => mysql-test/r/innodb_lock_wait_timeout_1.result
mysql-test/t/bug40113-master.opt => mysql-test/t/innodb_lock_wait_timeout_1-master.opt
mysql-test/t/bug40113.test => mysql-test/t/innodb_lock_wait_timeout_1.test
modified:
.bzrignore
CMakeLists.txt
Makefile.am
client/mysql.cc
client/mysql_upgrade.c
client/mysqlbinlog.cc
client/mysqlcheck.c
client/mysqlimport.c
client/mysqlslap.c
client/mysqltest.cc
cmd-line-utils/readline/display.c
configure.in
extra/yassl/include/yassl_int.hpp
extra/yassl/taocrypt/src/random.cpp
include/my_dbug.h
include/my_sys.h
include/myisamchk.h
include/mysql.h
include/mysql.h.pp
include/violite.h
libmysql/libmysql.c
libmysql/libmysql.def
libmysqld/CMakeLists.txt
libmysqld/Makefile.am
libmysqld/lib_sql.cc
libmysqld/libmysqld.c
libmysqld/libmysqld.def
mysql-test/collections/README.experimental
mysql-test/collections/default.experimental
mysql-test/extra/binlog_tests/binlog.test
mysql-test/extra/binlog_tests/drop_temp_table.test
mysql-test/extra/rpl_tests/rpl_auto_increment.test
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
mysql-test/extra/rpl_tests/rpl_failed_optimize.test
mysql-test/extra/rpl_tests/rpl_loaddata.test
mysql-test/extra/rpl_tests/rpl_row_sp006.test
mysql-test/extra/rpl_tests/rpl_stm_000001.test
mysql-test/include/check-warnings.test
mysql-test/include/concurrent.inc
mysql-test/include/have_example_plugin.inc
mysql-test/include/have_simple_parser.inc
mysql-test/include/have_udf.inc
mysql-test/include/mix1.inc
mysql-test/include/mtr_warnings.sql
mysql-test/lib/My/ConfigFactory.pm
mysql-test/lib/My/Platform.pm
mysql-test/lib/My/SafeProcess/safe_kill_win.cc
mysql-test/lib/My/SafeProcess/safe_process_win.cc
mysql-test/lib/mtr_cases.pm
mysql-test/lib/mtr_report.pm
mysql-test/lib/v1/mtr_cases.pl
mysql-test/mysql-stress-test.pl
mysql-test/mysql-test-run.pl
mysql-test/r/almost_full.result
mysql-test/r/alter_table.result
mysql-test/r/analyse.result
mysql-test/r/archive.result
mysql-test/r/bug46080.result
mysql-test/r/create.result
mysql-test/r/ctype_ldml.result
mysql-test/r/delete.result
mysql-test/r/distinct.result
mysql-test/r/explain.result
mysql-test/r/func_group.result
mysql-test/r/func_in.result
mysql-test/r/func_str.result
mysql-test/r/gis-rtree.result
mysql-test/r/gis.result
mysql-test/r/grant.result
mysql-test/r/grant3.result
mysql-test/r/group_min_max.result
mysql-test/r/information_schema_db.result
mysql-test/r/innodb-autoinc.result
mysql-test/r/innodb_mysql.result
mysql-test/r/insert_select.result
mysql-test/r/join.result
mysql-test/r/lowercase_fs_off.result
mysql-test/r/lowercase_table3.result
mysql-test/r/myisam.result
mysql-test/r/myisam_crash_before_flush_keys.result
mysql-test/r/mysqlbinlog.result
mysql-test/r/mysqltest.result
mysql-test/r/olap.result
mysql-test/r/order_by.result
mysql-test/r/partition.result
mysql-test/r/partition_csv.result
mysql-test/r/partition_innodb.result
mysql-test/r/partition_pruning.result
mysql-test/r/ps_grant.result
mysql-test/r/query_cache.result
mysql-test/r/range.result
mysql-test/r/select.result
mysql-test/r/sp-error.result
mysql-test/r/sp.result
mysql-test/r/subselect.result
mysql-test/r/subselect3.result
mysql-test/r/system_mysql_db.result
mysql-test/r/trigger_notembedded.result
mysql-test/r/type_bit.result
mysql-test/r/type_newdecimal.result
mysql-test/r/udf.result
mysql-test/r/update.result
mysql-test/r/upgrade.result
mysql-test/r/view_grant.result
mysql-test/r/warnings.result
mysql-test/r/windows.result
mysql-test/r/xa.result
mysql-test/std_data/Index.xml
mysql-test/suite/binlog/r/binlog_killed_simulate.result
mysql-test/suite/binlog/r/binlog_row_binlog.result
mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
mysql-test/suite/binlog/r/binlog_stm_binlog.result
mysql-test/suite/binlog/r/binlog_stm_blackhole.result
mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test
mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
mysql-test/suite/federated/my.cnf
mysql-test/suite/funcs_1/r/is_columns_mysql.result
mysql-test/suite/funcs_1/r/is_statistics.result
mysql-test/suite/innodb/r/innodb-zip.result
mysql-test/suite/innodb/r/innodb_file_format.result
mysql-test/suite/innodb/t/innodb-zip.test
mysql-test/suite/innodb/t/innodb_file_format.test
mysql-test/suite/innodb/t/innodb_information_schema.test
mysql-test/suite/parts/inc/partition_auto_increment.inc
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
mysql-test/suite/parts/r/partition_auto_increment_maria.result
mysql-test/suite/parts/r/partition_auto_increment_memory.result
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
mysql-test/suite/parts/r/partition_recover_myisam.result
mysql-test/suite/parts/t/partition_auto_increment_archive.test
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test
mysql-test/suite/parts/t/partition_recover_myisam.test
mysql-test/suite/rpl/r/rpl_auto_increment.result
mysql-test/suite/rpl/r/rpl_bug33931.result
mysql-test/suite/rpl/r/rpl_do_grant.result
mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
mysql-test/suite/rpl/r/rpl_idempotency.result
mysql-test/suite/rpl/r/rpl_init_slave_errors.result
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
mysql-test/suite/rpl/r/rpl_loaddata.result
mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
mysql-test/suite/rpl/r/rpl_loaddata_map.result
mysql-test/suite/rpl/r/rpl_loaddatalocal.result
mysql-test/suite/rpl/r/rpl_log_pos.result
mysql-test/suite/rpl/r/rpl_packet.result
mysql-test/suite/rpl/r/rpl_row_create_table.result
mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
mysql-test/suite/rpl/r/rpl_stm_log.result
mysql-test/suite/rpl/t/disabled.def
mysql-test/suite/rpl/t/rpl_bug33931.test
mysql-test/suite/rpl/t/rpl_do_grant.test
mysql-test/suite/rpl/t/rpl_drop_temp.test
mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
mysql-test/suite/rpl/t/rpl_idempotency.test
mysql-test/suite/rpl/t/rpl_init_slave_errors.test
mysql-test/suite/rpl/t/rpl_loaddatalocal.test
mysql-test/suite/rpl/t/rpl_log_pos.test
mysql-test/suite/rpl/t/rpl_packet.test
mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
mysql-test/t/almost_full.test
mysql-test/t/alter_table.test
mysql-test/t/analyse.test
mysql-test/t/archive.test
mysql-test/t/bug46080.test
mysql-test/t/create.test
mysql-test/t/ctype_ldml.test
mysql-test/t/delete.test
mysql-test/t/disabled.def
mysql-test/t/distinct.test
mysql-test/t/explain.test
mysql-test/t/flush_read_lock_kill.test
mysql-test/t/func_group.test
mysql-test/t/func_in.test
mysql-test/t/func_str.test
mysql-test/t/gis-rtree.test
mysql-test/t/gis.test
mysql-test/t/grant3.test
mysql-test/t/information_schema_db.test
mysql-test/t/innodb-autoinc.test
mysql-test/t/innodb_bug39438.test
mysql-test/t/innodb_mysql.test
mysql-test/t/insert_select.test
mysql-test/t/join.test
mysql-test/t/kill.test
mysql-test/t/lowercase_fs_off.test
mysql-test/t/lowercase_table3.test
mysql-test/t/myisam-system.test
mysql-test/t/myisam.test
mysql-test/t/myisam_crash_before_flush_keys.test
mysql-test/t/mysqlbinlog.test
mysql-test/t/mysqltest.test
mysql-test/t/named_pipe.test
mysql-test/t/not_partition.test
mysql-test/t/olap.test
mysql-test/t/order_by.test
mysql-test/t/partition.test
mysql-test/t/partition_csv.test
mysql-test/t/partition_innodb.test
mysql-test/t/plugin.test
mysql-test/t/plugin_load.test
mysql-test/t/ps_not_windows.test
mysql-test/t/query_cache.test
mysql-test/t/range.test
mysql-test/t/select.test
mysql-test/t/sp-error.test
mysql-test/t/sp.test
mysql-test/t/subselect.test
mysql-test/t/subselect3.test
mysql-test/t/type_bit.test
mysql-test/t/type_newdecimal.test
mysql-test/t/udf.test
mysql-test/t/update.test
mysql-test/t/upgrade.test
mysql-test/t/view_grant.test
mysql-test/t/warnings.test
mysql-test/t/windows.test
mysql-test/t/xa.test
mysql-test/valgrind.supp
mysys/CMakeLists.txt
mysys/Makefile.am
mysys/hash.c
mysys/mf_keycache.c
mysys/my_copy.c
mysys/my_getopt.c
mysys/my_largepage.c
mysys/my_static.c
mysys/my_thr_init.c
mysys/my_wincond.c
mysys/thr_lock.c
mysys/typelib.c
regex/CMakeLists.txt
scripts/make_win_bin_dist
scripts/mysql_system_tables.sql
scripts/mysql_system_tables_fix.sql
sql-common/client.c
sql-common/my_time.c
sql/CMakeLists.txt
sql/Makefile.am
sql/event_data_objects.cc
sql/events.cc
sql/field.cc
sql/field.h
sql/ha_ndbcluster.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_partition.cc
sql/ha_partition.h
sql/handler.cc
sql/handler.h
sql/item.cc
sql/item.h
sql/item_cmpfunc.cc
sql/item_cmpfunc.h
sql/item_func.cc
sql/item_func.h
sql/item_geofunc.cc
sql/item_strfunc.cc
sql/item_subselect.cc
sql/item_sum.cc
sql/item_timefunc.cc
sql/item_xmlfunc.cc
sql/log.cc
sql/log_event.cc
sql/log_event.h
sql/log_event_old.cc
sql/my_decimal.h
sql/mysql_priv.h
sql/mysqld.cc
sql/opt_range.cc
sql/opt_sum.cc
sql/partition_info.cc
sql/records.cc
sql/repl_failsafe.cc
sql/rpl_filter.cc
sql/set_var.cc
sql/set_var.h
sql/share/errmsg.txt
sql/slave.cc
sql/slave.h
sql/sp.cc
sql/sp_head.cc
sql/sql_acl.cc
sql/sql_base.cc
sql/sql_binlog.cc
sql/sql_cache.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_db.cc
sql/sql_delete.cc
sql/sql_handler.cc
sql/sql_insert.cc
sql/sql_lex.h
sql/sql_load.cc
sql/sql_locale.cc
sql/sql_parse.cc
sql/sql_partition.cc
sql/sql_plugin.cc
sql/sql_prepare.cc
sql/sql_rename.cc
sql/sql_repl.cc
sql/sql_select.cc
sql/sql_select.h
sql/sql_show.cc
sql/sql_table.cc
sql/sql_tablespace.cc
sql/sql_trigger.cc
sql/sql_udf.cc
sql/sql_update.cc
sql/sql_view.cc
sql/sql_yacc.yy
sql/structs.h
sql/table.cc
sql/table.h
sql/time.cc
sql/udf_example.c
sql/unireg.cc
storage/archive/ha_archive.cc
storage/blackhole/ha_blackhole.cc
storage/csv/ha_tina.cc
storage/federatedx/Makefile.am
storage/federatedx/ha_federatedx.cc
storage/heap/hp_write.c
storage/innobase/dict/dict0dict.c
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.h
storage/innobase/os/os0proc.c
storage/innobase/row/row0mysql.c
storage/innodb_plugin/CMakeLists.txt
storage/innodb_plugin/ChangeLog
storage/innodb_plugin/Makefile.am
storage/innodb_plugin/btr/btr0btr.c
storage/innodb_plugin/btr/btr0sea.c
storage/innodb_plugin/buf/buf0buf.c
storage/innodb_plugin/buf/buf0flu.c
storage/innodb_plugin/buf/buf0lru.c
storage/innodb_plugin/buf/buf0rea.c
storage/innodb_plugin/dict/dict0crea.c
storage/innodb_plugin/dict/dict0dict.c
storage/innodb_plugin/fil/fil0fil.c
storage/innodb_plugin/fsp/fsp0fsp.c
storage/innodb_plugin/handler/ha_innodb.cc
storage/innodb_plugin/handler/ha_innodb.h
storage/innodb_plugin/handler/handler0alter.cc
storage/innodb_plugin/include/buf0buf.h
storage/innodb_plugin/include/buf0buf.ic
storage/innodb_plugin/include/buf0lru.h
storage/innodb_plugin/include/buf0rea.h
storage/innodb_plugin/include/buf0types.h
storage/innodb_plugin/include/dict0crea.h
storage/innodb_plugin/include/dict0dict.h
storage/innodb_plugin/include/dict0mem.h
storage/innodb_plugin/include/fsp0fsp.h
storage/innodb_plugin/include/lock0lock.h
storage/innodb_plugin/include/log0log.h
storage/innodb_plugin/include/log0log.ic
storage/innodb_plugin/include/log0recv.h
storage/innodb_plugin/include/mtr0mtr.h
storage/innodb_plugin/include/os0file.h
storage/innodb_plugin/include/os0sync.h
storage/innodb_plugin/include/page0page.h
storage/innodb_plugin/include/page0page.ic
storage/innodb_plugin/include/page0zip.h
storage/innodb_plugin/include/rem0cmp.h
storage/innodb_plugin/include/rem0rec.ic
storage/innodb_plugin/include/row0ins.h
storage/innodb_plugin/include/row0mysql.h
storage/innodb_plugin/include/srv0srv.h
storage/innodb_plugin/include/trx0rec.h
storage/innodb_plugin/include/trx0rec.ic
storage/innodb_plugin/include/trx0roll.h
storage/innodb_plugin/include/trx0sys.ic
storage/innodb_plugin/include/trx0trx.h
storage/innodb_plugin/include/univ.i
storage/innodb_plugin/include/ut0auxconf.h
storage/innodb_plugin/include/ut0byte.h
storage/innodb_plugin/include/ut0byte.ic
storage/innodb_plugin/include/ut0ut.h
storage/innodb_plugin/lock/lock0lock.c
storage/innodb_plugin/log/log0log.c
storage/innodb_plugin/log/log0recv.c
storage/innodb_plugin/mem/mem0mem.c
storage/innodb_plugin/mtr/mtr0mtr.c
storage/innodb_plugin/mysql-test/innodb-analyze.test
storage/innodb_plugin/mysql-test/innodb-zip.result
storage/innodb_plugin/mysql-test/innodb-zip.test
storage/innodb_plugin/mysql-test/innodb_bug34300.test
storage/innodb_plugin/mysql-test/innodb_bug36169.test
storage/innodb_plugin/mysql-test/innodb_bug36172.test
storage/innodb_plugin/mysql-test/innodb_file_format.result
storage/innodb_plugin/mysql-test/innodb_file_format.test
storage/innodb_plugin/os/os0file.c
storage/innodb_plugin/os/os0proc.c
storage/innodb_plugin/page/page0cur.c
storage/innodb_plugin/page/page0page.c
storage/innodb_plugin/page/page0zip.c
storage/innodb_plugin/plug.in.disabled
storage/innodb_plugin/rem/rem0cmp.c
storage/innodb_plugin/row/row0ins.c
storage/innodb_plugin/row/row0merge.c
storage/innodb_plugin/row/row0mysql.c
storage/innodb_plugin/srv/srv0srv.c
storage/innodb_plugin/srv/srv0start.c
storage/innodb_plugin/sync/sync0rw.c
storage/innodb_plugin/sync/sync0sync.c
storage/innodb_plugin/thr/thr0loc.c
storage/innodb_plugin/trx/trx0rec.c
storage/innodb_plugin/trx/trx0roll.c
storage/innodb_plugin/trx/trx0trx.c
storage/innodb_plugin/ut/ut0auxconf_atomic_pthread_t_solaris.c
storage/innodb_plugin/ut/ut0ut.c
storage/maria/ha_maria.cc
storage/myisam/ha_myisam.cc
storage/myisam/mi_check.c
storage/myisam/mi_search.c
storage/myisam/mi_write.c
storage/myisam/myisamchk.c
storage/myisam/sort.c
storage/myisammrg/myrg_open.c
storage/mysql_storage_engine.cmake
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
storage/ndb/src/kernel/blocks/suma/Suma.cpp
storage/pbxt/src/discover_xt.cc
storage/xtradb/dict/dict0dict.c
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.h
storage/xtradb/handler/handler0alter.cc
strings/ctype-simple.c
strings/ctype-uca.c
support-files/binary-configure.sh
tests/mysql_client_test.c
unittest/mysys/Makefile.am
vio/vio.c
vio/vio_priv.h
vio/viosocket.c
vio/viosslfactories.c
mysql-test/r/innodb_lock_wait_timeout_1.result
mysql-test/t/innodb_lock_wait_timeout_1.test
=== modified file '.bzrignore'
--- a/.bzrignore 2009-11-06 17:22:32 +0000
+++ b/.bzrignore 2009-11-16 20:49:51 +0000
@@ -1922,3 +1922,4 @@ libmysqld/examples/mysqltest.cc
extra/libevent/event-config.h
libmysqld/opt_table_elimination.cc
libmysqld/ha_federatedx.cc
+libmysqld/debug_sync.cc
=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt 2009-10-03 19:24:13 +0000
+++ b/CMakeLists.txt 2009-11-16 20:49:51 +0000
@@ -66,6 +66,12 @@ IF(EXTRA_DEBUG)
ADD_DEFINITIONS(-D EXTRA_DEBUG)
ENDIF(EXTRA_DEBUG)
+IF(ENABLED_DEBUG_SYNC)
+ ADD_DEFINITIONS(-D ENABLED_DEBUG_SYNC)
+ENDIF(ENABLED_DEBUG_SYNC)
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
+
# in some places we use DBUG_OFF
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
@@ -211,12 +217,16 @@ ENDIF(WITHOUT_DYNAMIC_PLUGINS)
FILE(GLOB STORAGE_SUBDIRS storage/*)
FOREACH(SUBDIR ${STORAGE_SUBDIRS})
FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/storage ${SUBDIR})
- STRING(TOUPPER ${DIRNAME} ENGINE)
- STRING(TOLOWER ${DIRNAME} ENGINE_LOWER)
IF (EXISTS ${SUBDIR}/CMakeLists.txt)
# Check MYSQL_STORAGE_ENGINE macro is present
FILE(STRINGS ${SUBDIR}/CMakeLists.txt HAVE_STORAGE_ENGINE REGEX MYSQL_STORAGE_ENGINE)
IF(HAVE_STORAGE_ENGINE)
+ # Extract name of engine from HAVE_STORAGE_ENGINE
+ STRING(REGEX REPLACE ".*MYSQL_STORAGE_ENGINE\\((.*\)\\).*"
+ "\\1" ENGINE_NAME ${HAVE_STORAGE_ENGINE})
+ STRING(TOUPPER ${ENGINE_NAME} ENGINE)
+ STRING(TOLOWER ${ENGINE_NAME} ENGINE_LOWER)
+
SET(ENGINE_BUILD_TYPE "DYNAMIC")
# Read plug.in to find out if a plugin is mandatory and whether it supports
# build as shared library (dynamic).
@@ -254,6 +264,7 @@ FOREACH(SUBDIR ${STORAGE_SUBDIRS})
SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${PLUGIN_NAME})
SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_${ENGINE}_STORAGE_ENGINE")
SET (WITH_${ENGINE}_STORAGE_ENGINE TRUE)
+ SET (${ENGINE}_DIR ${DIRNAME})
ENDIF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
ENDIF(EXISTS ${SUBDIR}/plug.in)
=== modified file 'Makefile.am'
--- a/Makefile.am 2009-10-11 15:38:37 +0000
+++ b/Makefile.am 2009-11-16 20:49:51 +0000
@@ -1,4 +1,4 @@
-# Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+# Copyright 2000-2008 MySQL AB, 2009 Sun Microsystems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common scripts \
@pstack_dir@ \
- @sql_union_dirs@ unittest storage plugin \
+ @sql_union_dirs@ storage \
@sql_server@ @man_dirs@ tests \
netware @libmysqld_dirs@ \
mysql-test support-files sql-bench @tools_dirs@ \
@@ -208,6 +208,10 @@ test-bt-fast:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl $(MTR_EXTRA_OPTIONS) --force --comment=stress --suite=stress
+test-bt-fast2:
+ -cd mysql-test ; MTR_BUILD_THREAD=auto \
+ @PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol --report-features
+
test-bt-debug:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl $(MTR_EXTRA_OPTIONS) --comment=debug --force --timer \
@@ -215,6 +219,8 @@ test-bt-debug:
test-bt-debug-fast:
+test-bt-debug-fast:
+
# Keep these for a while
test-pl: test
test-full-pl: test-full
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2009-11-06 17:22:32 +0000
+++ b/client/mysql.cc 2009-11-16 20:49:51 +0000
@@ -1281,21 +1281,35 @@ sig_handler handle_sigint(int sig)
MYSQL *kill_mysql= NULL;
/* terminate if no query being executed, or we already tried interrupting */
- if (!executing_query || interrupted_query)
+ /* terminate if no query being executed, or we already tried interrupting */
+ if (!executing_query || (interrupted_query == 2))
+ {
+ tee_fprintf(stdout, "Ctrl-C -- exit!\n");
goto err;
+ }
kill_mysql= mysql_init(kill_mysql);
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
"", opt_mysql_port, opt_mysql_unix_port,0))
+ {
+ tee_fprintf(stdout, "Ctrl-C -- sorry, cannot connect to server to kill query, giving up ...\n");
goto err;
+ }
+
+ interrupted_query++;
+
+ /* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
+ if ((interrupted_query == 1) && (mysql_get_server_version(&mysql) < 50000))
+ interrupted_query= 2;
/* kill_buffer is always big enough because max length of %lu is 15 */
- sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
- mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
+ 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);
+ mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql);
- tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
-
- interrupted_query= 1;
+ tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
return;
@@ -2873,7 +2887,7 @@ com_help(String *buffer __attribute__((u
"For developer information, including the MySQL Reference Manual, "
"visit:\n"
" http://dev.mysql.com/\n"
- "To buy MySQL Network Support, training, or other products, visit:\n"
+ "To buy MySQL Enterprise support, training, or other products, visit:\n"
" https://shop.mysql.com/\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c 2009-11-06 17:22:32 +0000
+++ b/client/mysql_upgrade.c 2009-11-16 20:49:51 +0000
@@ -54,6 +54,8 @@ static char **defaults_argv;
static my_bool not_used; /* Can't use GET_BOOL without a value pointer */
+static my_bool opt_write_binlog;
+
#include <help_start.h>
static struct my_option my_long_options[]=
@@ -124,6 +126,11 @@ static struct my_option my_long_options[
{"verbose", 'v', "Display more output about the process",
(uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ {"write-binlog", OPT_WRITE_BINLOG,
+ "All commands including mysqlcheck are binlogged. Enabled by default;"
+ "use --skip-write-binlog when commands should not be sent to replication slaves.",
+ (uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
+ 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -448,6 +455,8 @@ static int run_query(const char *query,
int ret;
File fd;
char query_file_path[FN_REFLEN];
+ const uchar sql_log_bin[]= "SET SQL_LOG_BIN=0;";
+
DBUG_ENTER("run_query");
DBUG_PRINT("enter", ("query: %s", query));
if ((fd= create_temp_file(query_file_path, opt_tmpdir,
@@ -455,6 +464,22 @@ static int run_query(const char *query,
MYF(MY_WME))) < 0)
die("Failed to create temporary file for defaults");
+ /*
+ Master and slave should be upgraded separately. All statements executed
+ by mysql_upgrade will not be binlogged.
+ 'SET SQL_LOG_BIN=0' is executed before any other statements.
+ */
+ if (!opt_write_binlog)
+ {
+ if (my_write(fd, sql_log_bin, sizeof(sql_log_bin)-1,
+ MYF(MY_FNABP | MY_WME)))
+ {
+ my_close(fd, MYF(0));
+ my_delete(query_file_path, MYF(0));
+ die("Failed to write to '%s'", query_file_path);
+ }
+ }
+
if (my_write(fd, (uchar*) query, strlen(query),
MYF(MY_FNABP | MY_WME)))
{
@@ -647,6 +672,7 @@ static int run_mysqlcheck_upgrade(void)
"--check-upgrade",
"--all-databases",
"--auto-repair",
+ opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
NULL);
}
@@ -661,6 +687,7 @@ static int run_mysqlcheck_fixnames(void)
"--all-databases",
"--fix-db-names",
"--fix-table-names",
+ opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
NULL);
}
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc 2009-09-15 10:46:35 +0000
+++ b/client/mysqlbinlog.cc 2009-11-16 20:49:51 +0000
@@ -78,6 +78,9 @@ static const char* host = 0;
static int port= 0;
static uint my_end_arg;
static const char* sock= 0;
+#ifdef HAVE_SMEM
+static char *shared_memory_base_name= 0;
+#endif
static const char* user = 0;
static char* pass = 0;
static char *charset= 0;
@@ -726,7 +729,10 @@ Exit_status process_event(PRINT_EVENT_IN
switch (ev_type) {
case QUERY_EVENT:
- if (shall_skip_database(((Query_log_event*)ev)->db))
+ if (strncmp(((Query_log_event*)ev)->query, "BEGIN", 5) &&
+ strncmp(((Query_log_event*)ev)->query, "COMMIT", 6) &&
+ strncmp(((Query_log_event*)ev)->query, "ROLLBACK", 8) &&
+ shall_skip_database(((Query_log_event*)ev)->db))
goto end;
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
{
@@ -989,13 +995,13 @@ static struct my_option my_long_options[
/* 'unspec' is not mentioned because it is just a placeholder. */
"Determine when the output statements should be base64-encoded BINLOG "
"statements: 'never' disables it and works only for binlogs without "
- "row-based events; 'auto' is the default and prints base64 only when "
- "necessary (i.e., for row-based events and format description events); "
- "'decode-rows' suppresses BINLOG statements for row events, but does "
- "not exit as an error if a row event is found, unlike 'never'; "
- "'always' prints base64 whenever possible. 'always' is for debugging "
- "only and should not be used in a production system. The default is "
- "'auto'. --base64-output is a short form for --base64-output=always."
+ "row-based events; 'decode-rows' decodes row events into commented SQL "
+ "statements if the --verbose option is also given; 'auto' prints base64 "
+ "only when necessary (i.e., for row-based events and format description "
+ "events); 'always' prints base64 whenever possible. 'always' is for "
+ "debugging only and should not be used in a production system. If this "
+ "argument is not given, the default is 'auto'; if it is given with no "
+ "argument, 'always' is used."
,(uchar**) &opt_base64_output_mode_str,
(uchar**) &opt_base64_output_mode_str,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -1074,6 +1080,12 @@ static struct my_option my_long_options[
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES character_set' to the output.", (uchar**) &charset,
(uchar**) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#ifdef HAVE_SMEM
+ {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name,
+ (uchar**) &shared_memory_base_name,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{"short-form", 's', "Just show regular queries: no extra info and no "
"row-based events. This is for testing only, and should not be used in "
"production systems. If you want to suppress base64-output, consider "
@@ -1376,6 +1388,11 @@ static Exit_status safe_connect()
if (opt_protocol)
mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
+#ifdef HAVE_SMEM
+ if (shared_memory_base_name)
+ mysql_options(mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
+ shared_memory_base_name);
+#endif
if (!mysql_real_connect(mysql, host, user, pass, 0, port, sock, 0))
{
error("Failed on connect: %s", mysql_error(mysql));
=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c 2009-07-14 17:08:38 +0000
+++ b/client/mysqlcheck.c 2009-09-28 06:24:19 +0000
@@ -652,6 +652,17 @@ static int use_db(char *database)
return 0;
} /* use_db */
+static int disable_binlog()
+{
+ const char *stmt= "SET SQL_LOG_BIN=0";
+ if (mysql_query(sock, stmt))
+ {
+ fprintf(stderr, "Failed to %s\n", stmt);
+ fprintf(stderr, "Error: %s\n", mysql_error(sock));
+ return 1;
+ }
+ return 0;
+}
static int handle_request_for_tables(char *tables, uint length)
{
@@ -844,6 +855,14 @@ int main(int argc, char **argv)
if (dbConnect(current_host, current_user, opt_password))
exit(EX_MYSQLERR);
+ if (!opt_write_binlog)
+ {
+ if (disable_binlog()) {
+ first_error= 1;
+ goto end;
+ }
+ }
+
if (opt_auto_repair &&
my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64))
{
=== modified file 'client/mysqlimport.c'
--- a/client/mysqlimport.c 2009-07-14 17:08:38 +0000
+++ b/client/mysqlimport.c 2009-09-17 16:34:24 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2006 MySQL AB
+/* Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -583,7 +583,7 @@ error:
counter--;
pthread_cond_signal(&count_threshhold);
pthread_mutex_unlock(&counter_mutex);
- my_thread_end();
+ mysql_thread_end();
return 0;
}
=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c 2009-10-26 11:35:42 +0000
+++ b/client/mysqlslap.c 2009-11-16 20:49:51 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 MySQL AB
+/* Copyright (C) 2005 MySQL AB, 2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -423,6 +423,7 @@ void concurrency_loop(MYSQL *mysql, uint
stats *sptr;
conclusions conclusion;
unsigned long long client_limit;
+ int sysret;
head_sptr= (stats *)my_malloc(sizeof(stats) * iterations,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
@@ -472,7 +473,10 @@ void concurrency_loop(MYSQL *mysql, uint
run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
if (pre_system)
- if (system(pre_system)) { /* Ignore for now */ }
+ if ((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
@@ -487,8 +491,10 @@ void concurrency_loop(MYSQL *mysql, uint
run_statements(mysql, post_statements);
if (post_system)
- if (system(post_system)) { /* Ignore for now */ }
-
+ if ((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();
@@ -1942,7 +1948,7 @@ end:
if (!opt_only_print)
mysql_close(mysql);
- my_thread_end();
+ mysql_thread_end();
pthread_mutex_lock(&counter_mutex);
thread_counter--;
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2009-10-15 21:52:31 +0000
+++ b/client/mysqltest.cc 2009-11-16 20:49:51 +0000
@@ -82,6 +82,9 @@ enum {
static int record= 0, opt_sleep= -1;
static char *opt_db= 0, *opt_pass= 0;
const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
+#ifdef HAVE_SMEM
+static char *shared_memory_base_name=0;
+#endif
const char *opt_logdir= "";
const char *opt_include= 0, *opt_charsets_dir;
static int opt_port= 0;
@@ -429,6 +432,7 @@ static struct st_expected_errors saved_e
struct st_command
{
char *query, *query_buf,*first_argument,*last_argument,*end;
+ DYNAMIC_STRING content;
int first_word_len, query_len;
my_bool abort_on_error;
struct st_expected_errors expected_errors;
@@ -1152,6 +1156,8 @@ void free_used_memory()
{
struct st_command **q= dynamic_element(&q_lines, i, struct st_command**);
my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
+ if ((*q)->content.str)
+ dynstr_free(&(*q)->content);
my_free((*q),MYF(0));
}
for (i= 0; i < 10; i++)
@@ -1177,6 +1183,7 @@ void free_used_memory()
mysql_server_end();
/* Don't use DBUG after mysql_server_end() */
+ DBUG_VIOLATION_HELPER_LEAVE;
return;
}
@@ -1543,7 +1550,7 @@ void show_diff(DYNAMIC_STRING* ds,
else
diff_name = 0;
#else
- diff_name = "diff"; // Otherwise always assume it's called diff
+ diff_name = "diff"; /* Otherwise always assume it's called diff */
#endif
if (diff_name)
@@ -3321,21 +3328,30 @@ void do_write_file_command(struct st_com
sizeof(write_file_args)/sizeof(struct command_arg),
' ');
- /* If no delimiter was provided, use EOF */
- if (ds_delimiter.length == 0)
- dynstr_set(&ds_delimiter, "EOF");
-
if (!append && access(ds_filename.str, F_OK) == 0)
{
/* The file should not be overwritten */
die("File already exist: '%s'", ds_filename.str);
}
- init_dynamic_string(&ds_content, "", 1024, 1024);
- read_until_delimiter(&ds_content, &ds_delimiter);
- DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
- str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
- dynstr_free(&ds_content);
+ ds_content= command->content;
+ /* If it hasn't been done already by a loop iteration, fill it in */
+ if (! ds_content.str)
+ {
+ /* If no delimiter was provided, use EOF */
+ if (ds_delimiter.length == 0)
+ dynstr_set(&ds_delimiter, "EOF");
+
+ init_dynamic_string(&ds_content, "", 1024, 1024);
+ read_until_delimiter(&ds_content, &ds_delimiter);
+ command->content= ds_content;
+ }
+ /* This function could be called even if "false", so check before printing */
+ if (cur_block->ok)
+ {
+ DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
+ str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
+ }
dynstr_free(&ds_filename);
dynstr_free(&ds_delimiter);
DBUG_VOID_RETURN;
@@ -3478,12 +3494,17 @@ void do_diff_files(struct st_command *co
die("command \"diff_files\" failed, file '%s' does not exist",
ds_filename2.str);
- if ((error= compare_files(ds_filename.str, ds_filename2.str)))
+ 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
+ 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);
+ log_file.flush();
+ dynstr_set(&ds_res, 0);
}
dynstr_free(&ds_filename);
@@ -4910,6 +4931,8 @@ do_handle_error:
<opts> - options to use for the connection
* SSL - use SSL if available
* COMPRESS - use compression if available
+ * SHM - use shared memory if available
+ * PIPE - use named pipe if available
*/
@@ -4918,6 +4941,7 @@ void do_connect(struct st_command *comma
int con_port= opt_port;
char *con_options;
my_bool con_ssl= 0, con_compress= 0;
+ my_bool con_pipe= 0, con_shm= 0;
struct st_connection* con_slot;
static DYNAMIC_STRING ds_connection_name;
@@ -4928,6 +4952,9 @@ void do_connect(struct st_command *comma
static DYNAMIC_STRING ds_port;
static DYNAMIC_STRING ds_sock;
static DYNAMIC_STRING ds_options;
+#ifdef HAVE_SMEM
+ static DYNAMIC_STRING ds_shm;
+#endif
const struct command_arg connect_args[] = {
{ "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" },
{ "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" },
@@ -4955,6 +4982,11 @@ void do_connect(struct st_command *comma
die("Illegal argument for port: '%s'", ds_port.str);
}
+#ifdef HAVE_SMEM
+ /* Shared memory */
+ init_dynamic_string(&ds_shm, ds_sock.str, 0, 0);
+#endif
+
/* Sock */
if (ds_sock.length)
{
@@ -4993,6 +5025,10 @@ void do_connect(struct st_command *comma
con_ssl= 1;
else if (!strncmp(con_options, "COMPRESS", 8))
con_compress= 1;
+ else if (!strncmp(con_options, "PIPE", 4))
+ con_pipe= 1;
+ else if (!strncmp(con_options, "SHM", 3))
+ con_shm= 1;
else
die("Illegal option to connect: %.*s",
(int) (end - con_options), con_options);
@@ -5043,6 +5079,31 @@ void do_connect(struct st_command *comma
}
#endif
+#ifdef __WIN__
+ if (con_pipe)
+ {
+ uint protocol= MYSQL_PROTOCOL_PIPE;
+ mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
+ }
+#endif
+
+#ifdef HAVE_SMEM
+ if (con_shm)
+ {
+ uint protocol= MYSQL_PROTOCOL_MEMORY;
+ if (!ds_shm.length)
+ die("Missing shared memory base name");
+ 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)
+ {
+ mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
+ shared_memory_base_name);
+ }
+#endif
+
+
/* Use default db name */
if (ds_database.length == 0)
dynstr_set(&ds_database, opt_db);
@@ -5075,6 +5136,9 @@ void do_connect(struct st_command *comma
dynstr_free(&ds_port);
dynstr_free(&ds_sock);
dynstr_free(&ds_options);
+#ifdef HAVE_SMEM
+ dynstr_free(&ds_shm);
+#endif
DBUG_VOID_RETURN;
}
@@ -5746,6 +5810,12 @@ static struct my_option my_long_options[
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-file", 'F', "Read embedded server arguments from file.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#ifdef HAVE_SMEM
+ {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
+ "Base name of shared memory.", (uchar**) &shared_memory_base_name,
+ (uchar**) &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ 0, 0, 0},
+#endif
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
(uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
@@ -6809,8 +6879,10 @@ 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
@@ -6950,32 +7022,43 @@ void run_query_stmt(MYSQL *mysql, struct
*/
}
- if (!disable_warnings)
+ /*
+ Need to grab affected rows information before getting
+ warnings here
+ */
{
- /* Get the warnings from execute */
+ ulonglong affected_rows;
+ LINT_INIT(affected_rows);
- /* 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);
- }
- }
+ if (!disable_info)
+ affected_rows= mysql_affected_rows(mysql);
- if (!disable_info)
- append_info(ds, mysql_affected_rows(mysql), mysql_info(mysql));
+ if (!disable_warnings)
+ {
+ /* 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);
+ }
+ }
+
+ if (!disable_info)
+ append_info(ds, affected_rows, mysql_info(mysql));
+ }
}
end:
@@ -7224,6 +7307,10 @@ void run_query(struct st_connection *cn,
run_query_normal(cn, command, flags, query, query_len,
ds, &ds_warnings);
+ dynstr_free(&ds_warnings);
+ if (command->type == Q_EVAL)
+ dynstr_free(&eval_query);
+
if (display_result_sorted)
{
/* Sort the result set and append it to result */
@@ -7254,11 +7341,8 @@ void run_query(struct st_connection *cn,
check_require(ds, command->require_file);
}
- dynstr_free(&ds_warnings);
if (ds == &ds_result)
dynstr_free(&ds_result);
- if (command->type == Q_EVAL)
- dynstr_free(&eval_query);
DBUG_VOID_RETURN;
}
@@ -7704,6 +7788,11 @@ int main(int argc, char **argv)
}
#endif
+#ifdef HAVE_SMEM
+ if (shared_memory_base_name)
+ mysql_options(&con->mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
+#endif
+
if (!(con->name = my_strdup("default", MYF(MY_WME))))
die("Out of memory");
@@ -7742,7 +7831,32 @@ int main(int argc, char **argv)
command->type= Q_COMMENT;
}
- if (cur_block->ok)
+ my_bool 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
+ a while loop at some level above the current block.
+ */
+ if (!ok_to_do)
+ {
+ if (command->type == Q_SOURCE ||
+ command->type == Q_ERROR ||
+ command->type == Q_WRITE_FILE ||
+ command->type == Q_APPEND_FILE ||
+ command->type == Q_PERL)
+ {
+ for (struct st_block *stb= cur_block-1; stb >= block_stack; stb--)
+ {
+ if (stb->cmd == cmd_while)
+ {
+ ok_to_do= 1;
+ break;
+ }
+ }
+ }
+ }
+
+ if (ok_to_do)
{
command->last_argument= command->first_argument;
processed = 1;
@@ -8053,6 +8167,8 @@ 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.
@@ -8093,11 +8209,20 @@ int main(int argc, char **argv)
}
else
{
- die("The test didn't produce any output");
+ /* Empty output is an error *unless* we also have an empty result file */
+ if (! result_file_name || record ||
+ compare_files (log_file.file_name(), result_file_name))
+ {
+ die("The test didn't produce any output");
+ }
+ else
+ {
+ empty_result= TRUE; /* Meaning empty was expected */
+ }
}
- if (!command_executed && result_file_name)
- die("No queries executed but result file found!");
+ if (!command_executed && result_file_name && !empty_result)
+ die("No queries executed but non-empty result file found!");
verbose_msg("Test has succeeded!");
timer_output();
@@ -8184,6 +8309,8 @@ void do_get_replace_column(struct st_com
}
my_free(start, MYF(0));
command->last_argument= command->end;
+
+ DBUG_VOID_RETURN;
}
=== modified file 'cmd-line-utils/readline/display.c'
--- a/cmd-line-utils/readline/display.c 2009-09-07 20:50:10 +0000
+++ b/cmd-line-utils/readline/display.c 2009-11-16 20:49:51 +0000
@@ -463,10 +463,10 @@ rl_redisplay ()
int newlines, lpos, temp, modmark;
char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
- int num, n0;
+ int num, n0= 0;
wchar_t wc;
size_t wc_bytes;
- int wc_width;
+ int wc_width= 0;
mbstate_t ps;
int _rl_wrapped_multicolumn = 0;
#endif
@@ -824,7 +824,7 @@ rl_redisplay ()
cpos_buffer_position = out;
lb_linenum = newlines;
}
- for (i = in; i < in+wc_bytes; i++)
+ for (i = in; i < in+(int)wc_bytes; i++)
line[out++] = rl_line_buffer[i];
for (i = 0; i < wc_width; i++)
CHECK_LPOS();
=== modified file 'configure.in'
--- a/configure.in 2009-11-06 17:22:32 +0000
+++ b/configure.in 2009-11-16 20:49:51 +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.38-maria-beta)
+AM_INIT_AUTOMAKE(mysql, 5.1.41-mariadb-beta)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
@@ -1652,13 +1652,14 @@ then
DEBUG_OPTIMIZE_CXX="-O"
OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE"
else
- DEBUG_CXXFLAGS="-g"
DEBUG_OPTIMIZE_CXX=""
case $SYSTEM_TYPE in
*solaris*)
+ DEBUG_CXXFLAGS="-g0"
OPTIMIZE_CXXFLAGS="-O1"
;;
*)
+ DEBUG_CXXFLAGS="-g"
OPTIMIZE_CXXFLAGS="-O"
;;
esac
@@ -1715,6 +1716,23 @@ else
CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
fi
+# Debug Sync Facility. NOTE: depends on 'with_debug'. Must be behind it.
+AC_MSG_CHECKING(if Debug Sync Facility should be enabled.)
+AC_ARG_ENABLE(debug_sync,
+ AS_HELP_STRING([--enable-debug-sync],
+ [Build a version with Debug Sync Facility]),
+ [ enable_debug_sync=$enableval ],
+ [ enable_debug_sync=$with_debug ])
+
+if test "$enable_debug_sync" != "no"
+then
+ AC_DEFINE([ENABLED_DEBUG_SYNC], [1],
+ [If Debug Sync Facility should be enabled])
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+
# If we should allow error injection tests
AC_ARG_WITH(error-inject,
AC_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]),
@@ -2775,7 +2793,7 @@ server_scripts=
dnl This probably should be cleaned up more - for now the threaded
dnl client is just using plain-old libs.
-sql_client_dirs="strings regex mysys libmysql"
+sql_client_dirs="strings mysys dbug extra regex libmysql unittest"
AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
@@ -2803,12 +2821,20 @@ fi
AC_SUBST(netware_dir)
AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware")
-if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
+if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"
then
AC_DEFINE([THREAD], [1],
[Define if you want to have threaded code. This may be undef on client code])
+ # Avoid _PROGRAMS names
+ THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o mf_keycaches.o waiting_threads.o"
+ AC_SUBST(THREAD_LOBJECTS)
+fi
+AM_CONDITIONAL(NEED_THREAD, test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no")
+
+if test "$with_server" != "no"
+then
server_scripts="mysqld_safe mysql_install_db"
- sql_server_dirs="strings mysys dbug extra regex"
+ sql_server_dirs="strings mysys dbug extra regex storage plugin"
sql_server="vio sql"
fi
@@ -2834,9 +2860,10 @@ AC_SUBST(mysql_plugin_defs)
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
-# Start with the (longer) server list, add each client item not yet present.
-sql_union_dirs=" $sql_server_dirs "
-for DIR in $sql_client_dirs
+# We support client-only builds by "--without-server", but not vice versa,
+# so we start with the client list, then add each server item not yet present.
+sql_union_dirs=" $sql_client_dirs "
+for DIR in $sql_server_dirs
do
if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
then
=== modified file 'extra/yassl/include/yassl_int.hpp'
--- a/extra/yassl/include/yassl_int.hpp 2009-09-03 13:20:22 +0000
+++ b/extra/yassl/include/yassl_int.hpp 2009-11-16 20:49:51 +0000
@@ -441,7 +441,7 @@ public:
const Ciphers& GetCiphers() const;
const DH_Parms& GetDH_Parms() const;
const Stats& GetStats() const;
- VerifyCallback getVerifyCallback() const;
+ VerifyCallback getVerifyCallback() const;
pem_password_cb GetPasswordCb() const;
void* GetUserData() const;
bool GetSessionCacheOff() const;
=== modified file 'extra/yassl/taocrypt/src/random.cpp'
--- a/extra/yassl/taocrypt/src/random.cpp 2007-01-29 15:54:40 +0000
+++ b/extra/yassl/taocrypt/src/random.cpp 2009-10-06 16:10:34 +0000
@@ -27,7 +27,6 @@
#include <time.h>
#if defined(_WIN32)
- #define _WIN32_WINNT 0x0400
#include <windows.h>
#include <wincrypt.h>
#else
=== modified file 'include/my_dbug.h'
--- a/include/my_dbug.h 2009-09-07 20:50:10 +0000
+++ b/include/my_dbug.h 2009-11-16 20:49:51 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2000 MySQL AB & 2009 Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,7 +16,30 @@
#ifndef _dbug_h
#define _dbug_h
-#ifdef __cplusplus
+#if defined(__cplusplus) && !defined(DBUG_OFF)
+class Dbug_violation_helper
+{
+public:
+ inline Dbug_violation_helper() :
+ _entered(TRUE)
+ { }
+
+ inline ~Dbug_violation_helper()
+ {
+ assert(!_entered);
+ }
+
+ inline void leave()
+ {
+ _entered= FALSE;
+ }
+
+private:
+ bool _entered;
+};
+#endif /* C++ */
+
+#ifdef __cplusplus
extern "C" {
#endif
#if !defined(DBUG_OFF) && !defined(_lint)
@@ -30,34 +53,51 @@ struct _db_stack_frame_ {
struct _db_code_state_;
extern my_bool _dbug_on_;
-extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int);
+extern my_bool _db_keyword_(struct _db_code_state_ *cs, const char *keyword,
+ int strict_flag);
+extern int _db_strict_keyword_(const char *keyword);
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
extern int _db_explain_init_(char *buf, size_t len);
extern int _db_is_pushed_(void);
extern void _db_setjmp_(void);
extern void _db_longjmp_(void);
extern void _db_process_(const char *name);
-extern void _db_push_(const char *control);
-extern void _db_pop_(void);
+extern void _db_push_(const char *control);
+extern void _db_pop_(void);
extern void _db_set_(const char *control);
extern void _db_set_init_(const char *control);
-extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
- struct _db_stack_frame_ *_stack_frame_);
+extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
+ struct _db_stack_frame_ *_stack_frame_);
extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_);
extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...))
ATTRIBUTE_FORMAT(printf, 1, 2);
-extern void _db_dump_(uint _line_,const char *keyword,
+extern void _db_dump_(uint _line_,const char *keyword,
const unsigned char *memory, size_t length);
-extern void _db_end_(void);
-extern void _db_lock_file_(void);
-extern void _db_unlock_file_(void);
-extern FILE *_db_fp_(void);
+extern void _db_end_(void);
+extern void _db_lock_file_(void);
+extern void _db_unlock_file_(void);
+extern FILE *_db_fp_(void);
extern void _db_flush_();
+#ifdef __cplusplus
+
#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \
+ Dbug_violation_helper dbug_violation_helper; \
_db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_)
-#define DBUG_LEAVE _db_return_ (__LINE__, &_db_stack_frame_)
+#define DBUG_VIOLATION_HELPER_LEAVE dbug_violation_helper.leave()
+
+#else /* C */
+
+#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \
+ _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_)
+#define DBUG_VIOLATION_HELPER_LEAVE do { } while(0)
+
+#endif /* C++ */
+
+#define DBUG_LEAVE \
+ DBUG_VIOLATION_HELPER_LEAVE; \
+ _db_return_ (__LINE__, &_db_stack_frame_)
#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0)
#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
#define DBUG_EXECUTE(keyword,a1) \
@@ -88,28 +128,15 @@ extern void _db_flush_();
#define DEBUGGER_OFF do { _dbug_on_= 0; } while(0)
#define DEBUGGER_ON do { _dbug_on_= 1; } while(0)
#define IF_DBUG(A) A
-#ifndef __WIN__
#define DBUG_ABORT() (_db_flush_(), abort())
-#else
-/*
- Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can
- call abort() instead of _exit(3) (now it would cause a "test signal" popup).
-*/
-#include <crtdbg.h>
-#define DBUG_ABORT() (_db_flush_(),\
- (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\
- (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\
- _exit(3))
-#endif
-
#else /* No debugger */
#define DBUG_ENTER(a1)
#define DBUG_LEAVE
-#define DBUG_RETURN(a1) do { return(a1); } while(0)
-#define DBUG_VOID_RETURN do { return; } while(0)
-#define DBUG_EXECUTE(keyword,a1) do { } while(0)
-#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0)
+#define DBUG_RETURN(a1) do { return(a1); } while(0)
+#define DBUG_VOID_RETURN do { return; } while(0)
+#define DBUG_EXECUTE(keyword,a1) do { } while(0)
+#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0)
#define DBUG_EVALUATE(keyword,a1,a2) (a2)
#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
#define DBUG_PRINT(keyword,arglist) do { } while(0)
=== modified file 'include/my_sys.h'
--- a/include/my_sys.h 2009-09-07 20:50:10 +0000
+++ b/include/my_sys.h 2009-11-16 20:49:51 +0000
@@ -69,6 +69,7 @@ extern int NEAR my_errno; /* Last error
#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
#define MY_DONT_OVERWRITE_FILE 2048 /* my_copy: Don't overwrite file */
#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
+#define MY_SYNC 4096 /* my_copy(): sync dst file */
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/
@@ -175,6 +176,16 @@ extern char *my_strndup(const char *from
#define TRASH(A,B) /* nothing */
#endif
+#if defined(ENABLED_DEBUG_SYNC)
+extern void (*debug_sync_C_callback_ptr)(const char *, size_t);
+#define DEBUG_SYNC_C(_sync_point_name_) do { \
+ if (debug_sync_C_callback_ptr != NULL) \
+ (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \
+ while(0)
+#else
+#define DEBUG_SYNC_C(_sync_point_name_)
+#endif /* defined(ENABLED_DEBUG_SYNC) */
+
#ifdef HAVE_LARGE_PAGES
extern uint my_get_large_page_size(void);
extern uchar * my_large_malloc(size_t size, myf my_flags);
@@ -727,7 +738,6 @@ extern int wild_compare(const char *str,
extern WF_PACK *wf_comp(char * str);
extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
extern void wf_end(struct wild_file_pack *buffer);
-extern size_t strip_sp(char * str);
extern my_bool array_append_string_unique(const char *str,
const char **array, size_t size);
extern void get_date(char * to,int timeflag,time_t use_time);
=== modified file 'include/myisamchk.h'
--- a/include/myisamchk.h 2009-09-07 20:50:10 +0000
+++ b/include/myisamchk.h 2009-11-16 20:49:51 +0000
@@ -154,6 +154,10 @@ typedef struct st_handler_check_param
char temp_filename[FN_REFLEN];
IO_CACHE read_cache;
enum_handler_stats_method stats_method;
+#ifdef THREAD
+ pthread_mutex_t print_msg_mutex;
+ my_bool need_print_msg_lock;
+#endif
} HA_CHECK;
=== modified file 'include/mysql.h'
--- a/include/mysql.h 2009-10-02 10:36:28 +0000
+++ b/include/mysql.h 2009-11-16 20:49:51 +0000
@@ -558,6 +558,16 @@ unsigned long STDCALL mysql_real_escape_
char *to,const char *from,
unsigned long length);
void STDCALL mysql_debug(const char *debug);
+char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
+ char *to,
+ unsigned long to_length,
+ const char *from,
+ unsigned long from_length,
+ void *param,
+ char *
+ (*extend_buffer)
+ (void *, char *to,
+ unsigned long *length));
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int STDCALL mysql_thread_safe(void);
my_bool STDCALL mysql_embedded(void);
=== modified file 'include/mysql.h.pp'
--- a/include/mysql.h.pp 2009-10-02 10:36:28 +0000
+++ b/include/mysql.h.pp 2009-11-16 20:49:51 +0000
@@ -518,6 +518,16 @@ unsigned long mysql_real_escape_string(M
char *to,const char *from,
unsigned long length);
void mysql_debug(const char *debug);
+char * mysql_odbc_escape_string(MYSQL *mysql,
+ char *to,
+ unsigned long to_length,
+ const char *from,
+ unsigned long from_length,
+ void *param,
+ char *
+ (*extend_buffer)
+ (void *, char *to,
+ unsigned long *length));
void myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int mysql_thread_safe(void);
my_bool mysql_embedded(void);
=== modified file 'include/violite.h'
--- a/include/violite.h 2009-09-07 20:50:10 +0000
+++ b/include/violite.h 2009-11-16 20:49:51 +0000
@@ -44,7 +44,7 @@ enum enum_vio_type
Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags);
#ifdef __WIN__
Vio* vio_new_win32pipe(HANDLE hPipe);
-Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
+Vio* vio_new_win32shared_memory(HANDLE handle_file_map,
HANDLE handle_map,
HANDLE event_server_wrote,
HANDLE event_server_read,
@@ -222,7 +222,11 @@ struct st_vio
HANDLE event_conn_closed;
size_t shared_memory_remain;
char *shared_memory_pos;
- NET *net;
#endif /* HAVE_SMEM */
+#ifdef _WIN32
+ OVERLAPPED pipe_overlapped;
+ DWORD read_timeout_millis;
+ DWORD write_timeout_millis;
+#endif
};
#endif /* vio_violite_h_ */
=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c 2009-11-06 17:22:32 +0000
+++ b/libmysql/libmysql.c 2009-11-16 20:49:51 +0000
@@ -1642,6 +1642,20 @@ mysql_real_escape_string(MYSQL *mysql, c
return (uint) escape_string_for_mysql(mysql->charset, to, 0, from, length);
}
+
+char * STDCALL
+mysql_odbc_escape_string(MYSQL *mysql __attribute__((unused)),
+ char *to __attribute__((unused)),
+ ulong to_length __attribute__((unused)),
+ const char *from __attribute__((unused)),
+ ulong from_length __attribute__((unused)),
+ void *param __attribute__((unused)),
+ char * (*extend_buffer)(void *, char *, ulong *)
+ __attribute__((unused)))
+{
+ return NULL;
+}
+
void STDCALL
myodbc_remove_escape(MYSQL *mysql,char *name)
{
=== modified file 'libmysql/libmysql.def'
--- a/libmysql/libmysql.def 2009-10-04 22:22:57 +0000
+++ b/libmysql/libmysql.def 2009-11-16 20:49:51 +0000
@@ -78,6 +78,7 @@ EXPORTS
mysql_next_result
mysql_num_fields
mysql_num_rows
+ mysql_odbc_escape_string
mysql_options
mysql_stmt_param_count
mysql_stmt_param_metadata
=== modified file 'libmysqld/CMakeLists.txt'
--- a/libmysqld/CMakeLists.txt 2009-10-03 19:24:13 +0000
+++ b/libmysqld/CMakeLists.txt 2009-11-16 20:49:51 +0000
@@ -90,8 +90,10 @@ ENDFOREACH(rpath)
FOREACH (ENGINE_LIB ${MYSQLD_STATIC_ENGINE_LIBS})
INCLUDE(${CMAKE_SOURCE_DIR}/storage/${plugin_dir_${ENGINE_LIB}}/CMakeLists.txt)
STRING(TOUPPER ${ENGINE_LIB} ENGINE_LIB_UPPER)
+ SET(ENGINE_DIR ${${ENGINE_LIB_UPPER}_DIR})
+ INCLUDE(${CMAKE_SOURCE_DIR}/storage/${ENGINE_DIR}/CMakeLists.txt)
FOREACH(rpath ${${ENGINE_LIB_UPPER}_SOURCES})
- SET(LIB_SOURCES ${LIB_SOURCES} ${CMAKE_SOURCE_DIR}/storage/${plugin_dir_${ENGINE_LIB}}/${rpath})
+ SET(LIB_SOURCES ${LIB_SOURCES} ${CMAKE_SOURCE_DIR}/storage/${ENGINE_DIR}/${rpath})
ENDFOREACH(rpath)
ENDFOREACH(ENGINE_LIB)
@@ -127,6 +129,7 @@ SET(LIBMYSQLD_SOURCES emb_qcache.cc libm
../sql/sql_list.cc ../sql/sql_load.cc ../sql/sql_locale.cc
../sql/sql_binlog.cc ../sql/sql_manager.cc ../sql/sql_map.cc
../sql/sql_parse.cc ../sql/sql_partition.cc ../sql/sql_plugin.cc
+ ../sql/debug_sync.cc
../sql/sql_prepare.cc ../sql/sql_rename.cc ../sql/sql_repl.cc
../sql/sql_select.cc ../sql/sql_servers.cc
../sql/sql_show.cc ../sql/sql_state.c ../sql/sql_string.cc
@@ -152,6 +155,14 @@ ADD_LIBRARY(mysqlserver STATIC ${LIBMYSQ
ADD_DEPENDENCIES(mysqlserver GenServerSource GenError)
TARGET_LINK_LIBRARIES(mysqlserver)
+# Add any additional libraries requested by engine(s)
+FOREACH (ENGINE_LIB ${MYSQLD_STATIC_ENGINE_LIBS})
+ STRING(TOUPPER ${ENGINE_LIB} ENGINE_LIB_UPPER)
+ IF(${ENGINE_LIB_UPPER}_LIBS)
+ TARGET_LINK_LIBRARIES(mysqlserver ${${ENGINE_LIB_UPPER}_LIBS})
+ ENDIF(${ENGINE_LIB_UPPER}_LIBS)
+ENDFOREACH(ENGINE_LIB)
+
ADD_LIBRARY(libmysqld SHARED cmake_dummy.c libmysqld.def)
ADD_DEPENDENCIES(libmysqld mysqlserver)
TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32)
=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am 2009-10-30 18:50:56 +0000
+++ b/libmysqld/Makefile.am 2009-11-16 20:49:51 +0000
@@ -74,6 +74,7 @@ sqlsources = derror.cc field.cc field_co
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
+ debug_sync.cc \
sql_tablespace.cc \
rpl_injector.cc my_user.c partition_info.cc \
sql_servers.cc event_parse_data.cc opt_table_elimination.cc
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc 2009-09-07 20:50:10 +0000
+++ b/libmysqld/lib_sql.cc 2009-11-16 20:49:51 +0000
@@ -142,6 +142,8 @@ emb_advanced_command(MYSQL *mysql, enum
if (!skip_check)
result= thd->is_error() ? -1 : 0;
+ thd->mysys_var= 0;
+
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.finish_current_query();
#endif
@@ -634,6 +636,7 @@ void *create_embedded_thd(int client_fla
thread_count++;
threads.append(thd);
+ thd->mysys_var= 0;
return thd;
err:
delete(thd);
=== modified file 'libmysqld/libmysqld.c'
--- a/libmysqld/libmysqld.c 2008-02-28 17:55:46 +0000
+++ b/libmysqld/libmysqld.c 2009-09-25 11:39:05 +0000
@@ -164,6 +164,7 @@ mysql_real_connect(MYSQL *mysql,const ch
port=0;
unix_socket=0;
+ client_flag|=mysql->options.client_flag;
/* Send client information for access check */
client_flag|=CLIENT_CAPABILITIES;
if (client_flag & CLIENT_MULTI_STATEMENTS)
=== modified file 'libmysqld/libmysqld.def'
--- a/libmysqld/libmysqld.def 2009-10-04 22:22:57 +0000
+++ b/libmysqld/libmysqld.def 2009-11-16 20:49:51 +0000
@@ -50,6 +50,7 @@ EXPORTS
mysql_next_result
mysql_num_fields
mysql_num_rows
+ mysql_odbc_escape_string
mysql_options
mysql_ping
mysql_query
=== modified file 'mysql-test/collections/README.experimental'
--- a/mysql-test/collections/README.experimental 2009-02-25 14:00:17 +0000
+++ b/mysql-test/collections/README.experimental 2009-08-13 13:29:19 +0000
@@ -23,3 +23,10 @@ The syntax is as follows:
start with the same characters up to the last letter before the asterisk
are considered experimental:
main.a* # get rid of main.alias, main.alibaba and main.agliolio
+
+6) Optionally, the test case may be followed by one or more platform
+ qualifiers beginning with @ or @!. The test will then be considered
+ experimental only/except on that platform. Basic OS names as
+ reported by $^O in Perl, or 'windows' are supported, this includes
+ solaris, linux, windows, aix, darwin, ... Example:
+ main.alias @aix @windows # Fails on those
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental 2009-08-13 20:45:01 +0000
+++ b/mysql-test/collections/default.experimental 2009-10-26 12:33:03 +0000
@@ -1,6 +1,45 @@
+# For easier human reading (MTR doesn't care), please keep entries
+# in alphabetical order. This also helps with merge conflict resolution.
+
+binlog.binlog_multi_engine # joro : NDB tests marked as experimental as agreed with bochklin
+
funcs_1.charset_collation_1 # depends on compile-time decisions
-binlog.binlog_tmp_table # Bug#45578: Test binlog_tmp_table fails ramdonly on PB2: Unknown table 't2'
-main.ctype_gbk_binlog # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
-rpl.rpl_row_create_table # Bug#45576: rpl_row_create_table fails on PB2
+funcs_1.is_cml_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+funcs_1.is_columns_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+funcs_1.is_engines_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+funcs_1.is_tables_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+funcs_1.ndb* # joro : NDB tests marked as experimental as agreed with bochklin
+
+funcs_2.ndb_charset # joro : NDB tests marked as experimental as agreed with bochklin
+
+main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
+main.innodb-autoinc* # Bug#47809 2009-10-04 joro innodb-autoinc.test fails with valgrind errors with the innodb plugin
+main.plugin_load @solaris # Bug#42144
+
+ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
+
+rpl.rpl_cross_version* # Bug #43913 2009-10-26 joro rpl_cross_version can't pass on conflicts complainig clash with --slave-load-tm
+rpl.rpl_get_master_version_and_clock* # Bug#46931 2009-08-26 alik rpl.rpl_get_master_version_and_clock fails on hpux11.31
+rpl.rpl_innodb_bug28430* @solaris # Bug#46029
+rpl.rpl_row_create_table* # Bug#45576: rpl_row_create_table fails on PB2
+rpl.rpl_trigger* # Bug#47810 2009-10-04 joro rpl.rpl_trigger.test fails with valgrind errors with the innodb plugin
+
+rpl_ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
rpl_ndb.rpl_ndb_log # Bug#38998
-rpl.rpl_innodb_bug28430 # Bug#46029
+
+stress.ddl_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+
+parts.ndb_dd_backuprestore # joro : NDB tests marked as experimental as agreed with bochklin
+parts.part_supported_sql_func_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_alter1_1_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_alter1_1_2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_alter1_2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_auto_increment_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_basic_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_engine_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_int_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_mgm_lc0_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin
=== modified file 'mysql-test/extra/binlog_tests/binlog.test'
--- a/mysql-test/extra/binlog_tests/binlog.test 2009-07-14 15:07:29 +0000
+++ b/mysql-test/extra/binlog_tests/binlog.test 2009-10-14 15:46:45 +0000
@@ -270,3 +270,42 @@ INSERT INTO test.t1 VALUES (1), (2);
CREATE TABLE test.t2 SELECT * FROM test.t1;
USE test;
DROP TABLES t1, t2;
+
+#
+# Bug#46640
+# This test verifies if the server_id stored in the "format
+# description BINLOG statement" will override the server_id
+# of the server executing the statements.
+#
+
+connect (fresh,localhost,root,,test);
+connection fresh;
+
+RESET MASTER;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+
+# Format description event, with server_id = 10;
+BINLOG '
+3u9kSA8KAAAAZgAAAGoAAAABAAQANS4xLjM1LW1hcmlhLWJldGExLWRlYnVnLWxvZwAAAAAAAAAA
+AAAAAAAAAAAAAAAAAADe72RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
+';
+
+# What server_id is logged for a statement? Should be our own, not the
+# one from the format description event.
+INSERT INTO t1 VALUES (1);
+
+# INSERT INTO t1 VALUES (2), with server_id=20. Check that this is logged
+# with our own server id, not the 20 from the BINLOG statement.
+BINLOG '
+3u9kSBMUAAAAKQAAAJEBAAAAABoAAAAAAAAABHRlc3QAAnQxAAEDAAA=
+3u9kSBcUAAAAIgAAALMBAAAQABoAAAAAAAEAAf/+AgAAAA==
+';
+
+# Show binlog events to check that server ids are correct.
+--replace_column 1 # 2 # 5 #
+--replace_regex /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+
+DROP TABLE t1;
+disconnect fresh;
+
=== added file 'mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test'
--- a/mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test 2009-10-06 00:54:00 +0000
@@ -0,0 +1,300 @@
+################################################################################
+# Let
+# - B be begin, C commit and R rollback.
+# - T a statement that accesses and changes only transactional tables, i.e.
+# T-tables
+# - N a statement that accesses and changes only non-transactional tables,
+# i.e, N-tables.
+# - M be a mixed statement, i.e. a statement that updates both T- and
+# N-tables.
+# - M* be a mixed statement that fails while updating either a T
+# or N-table.
+# - N* be a statement that fails while updating a N-table.
+#
+# In this test case, when changes are logged as rows either in the RBR or MIXED
+# modes, we check if a M* statement that happens early in a transaction is
+# written to the binary log outside the boundaries of the transaction and
+# wrapped up in a BEGIN/ROLLBACK. This is done to keep the slave consistent with
+# the master as the rollback will keep the changes on N-tables and undo them on
+# T-tables. In particular, we expect the following behavior:
+#
+# 1. B M* T C would generate in the binlog B M* R B T C.
+# 2. B M M* C would generate in the binlog B M M* C.
+# 3. B M* M* T C would generate in the binlog B M* R B M* R B T C.
+#
+# SBR is not considered in this test because a failing statement is written to
+# the binary along with the error code such that a slave executes and rolls it
+# back, thus undoing the effects on T-tables.
+#
+# Note that, in the first case, we are not preserving history from the master as
+# we are introducing a rollback that never happened. However, this seems to be
+# more acceptable than making the slave diverge. In the second case, the slave
+# will diverge as the changes on T-tables that originated from the M statement
+# are rolled back on the master but not on the slave. Unfortunately, we cannot
+# simply roll the transaction back as this would undo any uncommitted changes
+# on T-tables.
+#
+# We check two more cases. First, INSERT...SELECT* which produces the following
+# results:
+#
+# 1. B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
+# the binlog the following entries: "Nothing".
+# 2. B INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
+# the binlog the following entries: B INSERT M...SELECT* R.
+#
+# Finally, we also check if any N statement that happens early in a transaction
+# (i.e. before any T or M statement) is written to the binary log outside the
+# boundaries of the transaction. In particular, we expect the following
+# behavior:
+#
+# 1. B N N T C would generate in the binlog B N C B N C B T C.
+# 2. B N N T R would generate in the binlog B N C B N C B T R.
+# 3. B N* N* T C would generate in the binlog B N R B N R B T C.
+# 4. B N* N* T R would generate in the binlog B N R B N R B T R.
+# 5. B N N T N T C would generate in the binlog B N C B N C B T N T C.
+# 6. B N N T N T R would generate in the binlog the B N C B N C B T N T R.
+#
+# Such issues do not happen in SBR. In RBR and MBR, a full-fledged fix will be
+# pushed after the WL#2687.
+#
+# Please, remove this test case after pushing WL#2687.
+################################################################################
+
+
+--echo ###################################################################################
+--echo # CONFIGURATION
+--echo ###################################################################################
+CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
+CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
+CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
+CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
+
+DELIMITER |;
+
+CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
+BEGIN
+ INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
+END|
+
+CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
+BEGIN
+ INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
+END|
+
+DELIMITER ;|
+
+--echo ###################################################################################
+--echo # CHECK HISTORY IN BINLOG
+--echo ###################################################################################
+--echo
+--echo
+--echo
+--echo *** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+INSERT INTO nt_1 VALUES ("new text 1", 1);
+BEGIN;
+--error ER_DUP_ENTRY
+INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
+INSERT INTO tt_2 VALUES ("new text 3", 3);
+COMMIT;
+--source include/show_binlog_events.inc
+
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+INSERT INTO tt_2 VALUES ("new text 4", 4);
+BEGIN;
+--error ER_DUP_ENTRY
+INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
+INSERT INTO tt_2 VALUES ("new text 6", 6);
+COMMIT;
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo *** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+INSERT INTO nt_1 VALUES ("new text 10", 10);
+BEGIN;
+INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
+--error ER_DUP_ENTRY
+INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
+INSERT INTO tt_2 VALUES ("new text 11", 11);
+COMMIT;
+--source include/show_binlog_events.inc
+
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+INSERT INTO tt_2 VALUES ("new text 15", 15);
+BEGIN;
+INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
+--error ER_DUP_ENTRY
+INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
+INSERT INTO tt_2 VALUES ("new text 16", 16);
+COMMIT;
+--source include/show_binlog_events.inc
+
+
+--echo
+--echo
+--echo
+--echo *** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+INSERT INTO nt_1 VALUES ("new text 18", 18);
+INSERT INTO nt_1 VALUES ("new text 20", 20);
+BEGIN;
+--error ER_DUP_ENTRY
+INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
+--error ER_DUP_ENTRY
+INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
+INSERT INTO tt_2 VALUES ("new text 21", 21);
+COMMIT;
+--source include/show_binlog_events.inc
+
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+INSERT INTO tt_2 VALUES ("new text 23", 23);
+INSERT INTO tt_2 VALUES ("new text 25", 25);
+BEGIN;
+--error ER_DUP_ENTRY
+INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
+--error ER_DUP_ENTRY
+INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
+INSERT INTO tt_2 VALUES ("new text 26", 26);
+COMMIT;
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo *** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
+--echo *** in the binlog the following entries: "Nothing".
+--echo *** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+TRUNCATE TABLE nt_2;
+TRUNCATE TABLE tt_2;
+INSERT INTO tt_2 VALUES ("new text 7", 7);
+BEGIN;
+INSERT INTO tt_2 VALUES ("new text 27", 27);
+--error ER_DUP_ENTRY
+INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
+INSERT INTO tt_2 VALUES ("new text 28", 28);
+ROLLBACK;
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo *** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
+--echo *** in the binlog the following entries: "B INSERT M..SELECT* R".
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+TRUNCATE TABLE nt_2;
+TRUNCATE TABLE tt_2;
+INSERT INTO tt_2 VALUES ("new text 7", 7);
+BEGIN;
+--error ER_DUP_ENTRY
+INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
+COMMIT;
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo *** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+TRUNCATE TABLE nt_1;
+TRUNCATE TABLE tt_2;
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 1);
+INSERT INTO nt_1 VALUES (USER(), 2);
+INSERT INTO tt_2 VALUES (USER(), 3);
+COMMIT;
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo *** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 4);
+INSERT INTO nt_1 VALUES (USER(), 5);
+INSERT INTO tt_2 VALUES (USER(), 6);
+ROLLBACK;
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo *** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+BEGIN;
+--error ER_DUP_ENTRY
+INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
+--error ER_DUP_ENTRY
+INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
+INSERT INTO tt_2 VALUES (USER(), 9);
+COMMIT;
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo *** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+BEGIN;
+--error ER_DUP_ENTRY
+INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
+--error ER_DUP_ENTRY
+INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
+INSERT INTO tt_2 VALUES (USER(), 12);
+ROLLBACK;
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo *** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 13);
+INSERT INTO nt_1 VALUES (USER(), 14);
+INSERT INTO tt_2 VALUES (USER(), 15);
+INSERT INTO nt_1 VALUES (USER(), 16);
+INSERT INTO tt_2 VALUES (USER(), 17);
+COMMIT;
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo *** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 18);
+INSERT INTO nt_1 VALUES (USER(), 19);
+INSERT INTO tt_2 VALUES (USER(), 20);
+INSERT INTO nt_1 VALUES (USER(), 21);
+INSERT INTO tt_2 VALUES (USER(), 22);
+ROLLBACK;
+--source include/show_binlog_events.inc
+
+--echo ###################################################################################
+--echo # CLEAN
+--echo ###################################################################################
+
+DROP TABLE tt_1;
+DROP TABLE tt_2;
+DROP TABLE nt_1;
+DROP TABLE nt_2;
=== modified file 'mysql-test/extra/binlog_tests/drop_temp_table.test'
--- a/mysql-test/extra/binlog_tests/drop_temp_table.test 2007-06-15 16:56:11 +0000
+++ b/mysql-test/extra/binlog_tests/drop_temp_table.test 2009-11-03 10:20:08 +0000
@@ -1,27 +1,72 @@
--disable_warnings
-drop database if exists `drop-temp+table-test`;
+DROP DATABASE IF EXISTS `drop-temp+table-test`;
--enable_warnings
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
-reset master;
-create database `drop-temp+table-test`;
-use `drop-temp+table-test`;
-create temporary table shortn1 (a int);
-create temporary table `table:name` (a int);
-create temporary table shortn2 (a int);
-select get_lock("a",10);
+RESET MASTER;
+CREATE DATABASE `drop-temp+table-test`;
+USE `drop-temp+table-test`;
+CREATE TEMPORARY TABLE shortn1 (a INT);
+CREATE TEMPORARY TABLE `table:name` (a INT);
+CREATE TEMPORARY TABLE shortn2 (a INT);
+
+##############################################################################
+# BUG#46572 DROP TEMPORARY table IF EXISTS does not have a consistent behavior
+# in ROW mode
+#
+# In RBR, 'DROP TEMPORARY TABLE ...' statement should never be binlogged no
+# matter if the tables exist or not. In contrast, both in SBR and MBR, the
+# statement should be always binlogged no matter if the tables exist or not.
+##############################################################################
+CREATE TEMPORARY TABLE tmp(c1 int);
+CREATE TEMPORARY TABLE tmp1(c1 int);
+CREATE TEMPORARY TABLE tmp2(c1 int);
+CREATE TEMPORARY TABLE tmp3(c1 int);
+CREATE TABLE t(c1 int);
+
+DROP TEMPORARY TABLE IF EXISTS tmp;
+
+--disable_warnings
+# Before fixing BUG#46572, 'DROP TEMPORARY TABLE IF EXISTS...' statement was
+# binlogged when the table did not exist in RBR.
+DROP TEMPORARY TABLE IF EXISTS tmp;
+
+# In RBR, 'DROP TEMPORARY TABLE ...' statement is never binlogged no matter if
+# the tables exist or not.
+DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
+DROP TEMPORARY TABLE tmp3;
+
+#In RBR, tmp2 will NOT be binlogged, because it is a temporary table.
+DROP TABLE IF EXISTS tmp2, t;
+
+#In RBR, tmp2 will be binlogged, because it does not exist and master do not know
+# whether it is a temporary table or not.
+DROP TABLE IF EXISTS tmp2, t;
+--enable_warnings
+
+SELECT GET_LOCK("a",10);
+
+#
+# BUG48216 Replication fails on all slaves after upgrade to 5.0.86 on master
+#
+# When the session is closed, any temporary tables of the session are dropped
+# and are binlogged. But it will be binlogged with a wrong database name when
+# the length of the database name('drop-temp-table-test') is greater than the
+# current database name('test').
+#
+USE test;
disconnect con1;
connection con2;
# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
# guarantee that logging of the terminated con1 has been done yet.
# To be sure that logging has been done, we use a user lock.
-select get_lock("a",10);
-let $VERSION=`select version()`;
+SELECT GET_LOCK("a",10);
+let $VERSION=`SELECT VERSION()`;
source include/show_binlog_events.inc;
-drop database `drop-temp+table-test`;
+DROP DATABASE `drop-temp+table-test`;
# End of 4.1 tests
=== modified file 'mysql-test/extra/rpl_tests/rpl_auto_increment.test'
--- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test 2009-04-08 16:55:26 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test 2009-11-16 20:49:51 +0000
@@ -163,5 +163,81 @@ show create table t1;
connection master;
drop table t1;
+#
+# BUG#45999 Row based replication fails when auto_increment field = 0.
+# Store engine of Slaves auto-generates new sequence numbers for
+# auto_increment fields if the values of them are 0. There is an inconsistency
+# between slave and master. When MODE_NO_AUTO_VALUE_ON_ZERO are masters treat
+#
+source include/master-slave-reset.inc;
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+eval CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type;
+eval CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type2;
+SET SQL_MODE='';
+# Value of the id will be 1;
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t2 VALUES(NULL);
+SELECT * FROM t1;
+SELECT * FROM t2;
+# Value of the id will be 2;
+INSERT INTO t1 VALUES();
+INSERT INTO t2 VALUES();
+SELECT * FROM t1;
+SELECT * FROM t2;
+# Value of the id will be 3. The master treats 0 as NULL or empty because
+# NO_AUTO_VALUE_ON_ZERO is not assign to SQL_MODE.
+INSERT INTO t1 VALUES(0);
+INSERT INTO t2 VALUES(0);
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+# Value of the id will be 0. The master does not treat 0 as NULL or empty
+# because NO_AUTO_VALUE_ON_ZERO has assigned to SQL_MODE.
+INSERT INTO t1 VALUES(0);
+INSERT INTO t2 VALUES(0);
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+INSERT INTO t1 VALUES(4);
+INSERT INTO t2 VALUES(4);
+FLUSH LOGS;
+sync_slave_with_master;
+
+let $diff_table_1= master:test.t1;
+let $diff_table_2= slave:test.t1;
+source include/diff_tables.inc;
+
+let $diff_table_1= master:test.t2;
+let $diff_table_2= slave:test.t2;
+source include/diff_tables.inc;
+
+connection master;
+DROP TABLE t1;
+DROP TABLE t2;
+sync_slave_with_master;
+
+connection master;
+let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL test
+sync_slave_with_master;
+
+let $diff_table_1= master:test.t1;
+let $diff_table_2= slave:test.t1;
+source include/diff_tables.inc;
+
+let $diff_table_1= master:test.t2;
+let $diff_table_2= slave:test.t2;
+source include/diff_tables.inc;
+
# End cleanup
+DROP TABLE t1;
+DROP TABLE t2;
+SET SQL_MODE='';
sync_slave_with_master;
=== added file 'mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test'
--- a/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test 2009-09-30 23:19:36 +0000
@@ -0,0 +1,44 @@
+#
+# This test verifies if inserting data into view that invokes a
+# trigger will make the autoinc values become inconsistent on
+# master and slave.
+#
+connection master;
+CREATE TABLE t1(i1 int not null auto_increment, c1 INT, primary key(i1)) engine=innodb;
+CREATE TABLE t2(i1 int not null auto_increment, c2 INT, primary key(i1)) engine=innodb;
+CREATE TABLE t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+eval create trigger tr16 $insert_action on t1 for each row insert into t3(a) values(new.c1);
+eval create trigger tr17 $insert_action on t2 for each row insert into t3(a) values(new.c2);
+begin;
+INSERT INTO t1(c1) VALUES (11), (12);
+INSERT INTO t2(c2) VALUES (13), (14);
+
+CREATE VIEW v16 AS SELECT c1, c2 FROM t1, t2;
+
+INSERT INTO v16(c1) VALUES (15),(16);
+INSERT INTO v16(c2) VALUES (17),(18);
+
+connection master1;
+INSERT INTO v16(c1) VALUES (19),(20);
+INSERT INTO v16(c2) VALUES (21),(22);
+
+connection master;
+INSERT INTO v16(c1) VALUES (23), (24);
+INSERT INTO v16(c1) VALUES (25), (26);
+commit;
+sync_slave_with_master;
+--echo #Test if the results are consistent on master and slave
+--echo #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS'
+let $diff_table_1=master:test.t3;
+let $diff_table_2=slave:test.t3;
+source include/diff_tables.inc;
+
+connection master;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP VIEW v16;
+sync_slave_with_master;
+
+
+
=== added file 'mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test'
--- a/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test 2009-09-30 23:19:36 +0000
@@ -0,0 +1,82 @@
+#
+# This test verifies if concurrent transactions that invoke a
+# trigger that inserts more than one values into one or more
+# tables with an auto_increment column will make the autoinc
+# values become inconsistent on master and slave.
+#
+
+connection master;
+create table t1(a int, b int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+eval create trigger tr1 $trigger_action on t1 for each row insert into t2(a) values(6);
+
+create table t3(a int, b int) engine=innodb;
+create table t4(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t5(a int) engine=innodb;
+delimiter |;
+eval create trigger tr2 $trigger_action on t3 for each row begin
+ insert into t4(a) values(f1_insert_triggered());
+ insert into t4(a) values(f1_insert_triggered());
+ insert into t5(a) values(8);
+end |
+delimiter ;|
+
+create table t6(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+delimiter //;
+CREATE FUNCTION f1_insert_triggered() RETURNS INTEGER
+BEGIN
+ INSERT INTO t6(a) values(2),(3);
+ RETURN 1;
+END//
+delimiter ;//
+
+begin;
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+insert into t1(a,b) values(1,1),(2,1);
+insert into t3(a,b) values(1,1),(2,1);
+update t1 set a = a + 5 where b = 1;
+update t3 set a = a + 5 where b = 1;
+delete from t1 where b = 1;
+delete from t3 where b = 1;
+
+connection master1;
+#The default autocommit is set to 1, so the statement is auto committed
+insert into t2(a) values(3);
+insert into t4(a) values(3);
+
+connection master;
+commit;
+insert into t1(a,b) values(4,2);
+insert into t3(a,b) values(4,2);
+update t1 set a = a + 5 where b = 2;
+update t3 set a = a + 5 where b = 2;
+delete from t1 where b = 2;
+delete from t3 where b = 2;
+--echo # To verify if insert/update in an autoinc column causes statement to be logged in row format
+source include/show_binlog_events.inc;
+commit;
+
+connection master;
+sync_slave_with_master;
+--echo #Test if the results are consistent on master and slave
+--echo #for 'INVOKES A TRIGGER with $trigger_action action'
+let $diff_table_1=master:test.t2;
+let $diff_table_2=slave:test.t2;
+source include/diff_tables.inc;
+let $diff_table_1=master:test.t4;
+let $diff_table_2=slave:test.t4;
+source include/diff_tables.inc;
+let $diff_table_1=master:test.t6;
+let $diff_table_2=slave:test.t6;
+source include/diff_tables.inc;
+
+connection master;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP FUNCTION f1_insert_triggered;
+sync_slave_with_master;
+
=== added file 'mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test'
--- a/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test 2009-09-30 23:19:36 +0000
@@ -0,0 +1,57 @@
+#
+# This test verifies if concurrent transactions that call a
+# function which invokes a 'after/before insert action' trigger
+# that inserts more than one values into a table with autoinc
+# column will make the autoinc values become inconsistent on
+# master and slave.
+#
+
+connection master;
+create table t1(a int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+delimiter |;
+CREATE FUNCTION f1_two_inserts_trigger() RETURNS INTEGER
+BEGIN
+ INSERT INTO t2(a) values(2),(3);
+ INSERT INTO t2(a) values(2),(3);
+ RETURN 1;
+END |
+eval create trigger tr11 $insert_action on t2 for each row begin
+ insert into t3(a) values(new.a);
+ insert into t3(a) values(new.a);
+end |
+delimiter ;|
+begin;
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+insert into t1(a) values(f1_two_inserts_trigger());
+
+connection master1;
+#The default autocommit is set to 1, so the statement is auto committed
+insert into t2(a) values(4),(5);
+
+connection master;
+commit;
+insert into t1(a) values(f1_two_inserts_trigger());
+--echo # To verify if insert/update in an autoinc column causes statement to be logged in row format
+source include/show_binlog_events.inc;
+commit;
+
+connection master;
+sync_slave_with_master;
+--echo #Test if the results are consistent on master and slave
+--echo #for 'CALLS A FUNCTION which INVOKES A TRIGGER with $insert_action action'
+let $diff_table_1=master:test.t2;
+let $diff_table_2=slave:test.t2;
+source include/diff_tables.inc;
+let $diff_table_1=master:test.t3;
+let $diff_table_2=slave:test.t3;
+source include/diff_tables.inc;
+
+connection master;
+drop table t1;
+drop table t2;
+drop table t3;
+drop function f1_two_inserts_trigger;
+sync_slave_with_master;
+
=== modified file 'mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test'
--- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2008-07-10 16:09:39 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2009-08-28 14:13:27 +0000
@@ -22,6 +22,8 @@ DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,
# should stop the slave. #
#################################################
+call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
+
--echo **** Diff Table Def Start ****
##############################################
=== modified file 'mysql-test/extra/rpl_tests/rpl_failed_optimize.test'
--- a/mysql-test/extra/rpl_tests/rpl_failed_optimize.test 2006-05-05 17:08:40 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_failed_optimize.test 2009-09-27 22:03:05 +0000
@@ -22,3 +22,4 @@ connection master;
select * from t1;
commit;
drop table t1;
+-- sync_slave_with_master
=== modified file 'mysql-test/extra/rpl_tests/rpl_loaddata.test'
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test 2008-11-13 19:19:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test 2009-10-27 15:15:53 +0000
@@ -158,4 +158,65 @@ LOAD DATA INFILE "../../std_data/words.d
DROP TABLE IF EXISTS t1;
+# BUG#48297: Schema name is ignored when LOAD DATA is written into binlog,
+# replication aborts
+-- source include/master-slave-reset.inc
+
+-- let $db1= b48297_db1
+-- let $db2= b42897_db2
+
+-- connection master
+
+-- disable_warnings
+-- eval drop database if exists $db1
+-- eval drop database if exists $db2
+-- enable_warnings
+
+-- eval create database $db1
+-- eval create database $db2
+
+-- eval use $db1
+-- eval CREATE TABLE t1 (c1 VARCHAR(256)) engine=$engine_type;
+
+-- eval use $db2
+
+-- echo ### assertion: works with cross-referenced database
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
+
+-- eval use $db1
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- echo ### assertion: works with fully qualified name on current database
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
+
+-- echo ### assertion: works without fully qualified name on current database
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
+
+-- echo ### create connection without default database
+-- echo ### connect (conn2,localhost,root,,*NO-ONE*);
+connect (conn2,localhost,root,,*NO-ONE*);
+-- connection conn2
+-- echo ### assertion: works without stating the default database
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
+-- echo ### disconnect and switch back to master connection
+-- disconnect conn2
+-- connection master
+
+-- sync_slave_with_master
+-- eval use $db1
+
+let $diff_table_1=master:$db1.t1;
+let $diff_table_2=slave:$db1.t1;
+source include/diff_tables.inc;
+
+-- connection master
+
+-- eval DROP DATABASE $db1
+-- eval DROP DATABASE $db2
+
+-- sync_slave_with_master
+
# End of 4.1 tests
=== modified file 'mysql-test/extra/rpl_tests/rpl_row_sp006.test'
--- a/mysql-test/extra/rpl_tests/rpl_row_sp006.test 2007-06-18 13:36:10 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp006.test 2009-09-04 01:33:45 +0000
@@ -9,29 +9,27 @@
#############################################################################
# Begin clean up test section
-connection master;
--disable_warnings
-create database if not exists mysqltest1;
-DROP PROCEDURE IF EXISTS mysqltest1.p1;
-DROP PROCEDURE IF EXISTS mysqltest1.p2;
-DROP TABLE IF EXISTS mysqltest1.t2;
-DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
--enable_warnings
# End of cleanup
# Begin test section 1
-eval CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
-eval CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
+eval CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
+eval CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
delimiter |;
-CREATE PROCEDURE mysqltest1.p1()
+CREATE PROCEDURE p1()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb INT;
DECLARE cur1 CURSOR FOR SELECT name,
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
- FROM mysqltest1.t1;
+ FROM t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
@@ -41,7 +39,7 @@ BEGIN
FETCH cur1 INTO spa, spb;
IF NOT done THEN
START TRANSACTION;
- INSERT INTO mysqltest1.t2 VALUES (spa,spb);
+ INSERT INTO t2 VALUES (spa,spb);
COMMIT;
END IF;
UNTIL done END REPEAT;
@@ -49,30 +47,29 @@ BEGIN
SET AUTOCOMMIT=1;
CLOSE cur1;
END|
-CREATE PROCEDURE mysqltest1.p2()
+CREATE PROCEDURE p2()
BEGIN
- INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
+ INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
END|
delimiter ;|
-CALL mysqltest1.p2();
+CALL p2();
sync_slave_with_master;
connection master;
-CALL mysqltest1.p1();
+CALL p1();
sync_slave_with_master;
connection master;
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
-DROP PROCEDURE IF EXISTS mysqltest1.p1;
-DROP PROCEDURE IF EXISTS mysqltest1.p2;
-DROP TABLE IF EXISTS mysqltest1.t1;
-DROP TABLE IF EXISTS mysqltest1.t2;
-DROP DATABASE mysqltest1;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
# Lets compare. Note: If they match test will pass, if they do not match
# the test will show that the diff statement failed and not reject file
=== modified file 'mysql-test/extra/rpl_tests/rpl_stm_000001.test'
--- a/mysql-test/extra/rpl_tests/rpl_stm_000001.test 2007-12-12 17:19:24 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_stm_000001.test 2009-10-20 18:00:07 +0000
@@ -93,7 +93,7 @@ kill @id;
# We don't drop t3 as this is a temporary table
drop table t2;
connection master;
---error 1053,2013
+--error 1317,2013
reap;
connection slave;
# The SQL slave thread should now have stopped because the query was killed on
=== modified file 'mysql-test/include/check-warnings.test'
--- a/mysql-test/include/check-warnings.test 2009-04-25 09:04:38 +0000
+++ b/mysql-test/include/check-warnings.test 2009-11-16 20:49:51 +0000
@@ -58,5 +58,5 @@ if (`select @result = 0`){
skip OK;
}
--enable_query_log
-echo ^ Found warnings!!;
+echo ^ Found warnings in $log_error;
exit;
=== modified file 'mysql-test/include/concurrent.inc'
--- a/mysql-test/include/concurrent.inc 2009-09-15 06:08:54 +0000
+++ b/mysql-test/include/concurrent.inc 2009-11-16 20:49:51 +0000
@@ -25,8 +25,6 @@
# new wrapper t/concurrent_innodb_safelog.test
#
---source include/not_embedded.inc
-
connection default;
#
# Show prerequisites for this test.
=== added file 'mysql-test/include/have_case_insensitive_fs.inc'
--- a/mysql-test/include/have_case_insensitive_fs.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_case_insensitive_fs.inc 2009-10-27 08:09:19 +0000
@@ -0,0 +1,4 @@
+--require r/case_insensitive_fs.require
+--disable_query_log
+show variables like 'lower_case_file_system';
+--enable_query_log
=== added file 'mysql-test/include/have_debug_sync.inc'
--- a/mysql-test/include/have_debug_sync.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_debug_sync.inc 2009-09-29 15:38:40 +0000
@@ -0,0 +1,5 @@
+--require r/have_debug_sync.require
+disable_query_log;
+let $value= query_get_value(SHOW VARIABLES LIKE 'debug_sync', Value, 1);
+eval SELECT ('$value' LIKE 'ON %') AS debug_sync;
+enable_query_log;
=== added file 'mysql-test/include/have_dynamic_loading.inc'
--- a/mysql-test/include/have_dynamic_loading.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_dynamic_loading.inc 2009-09-04 20:02:17 +0000
@@ -0,0 +1,7 @@
+#
+# Whether server supports dynamic loading.
+#
+--require r/have_dynamic_loading.require
+disable_query_log;
+show variables like 'have_dynamic_loading';
+enable_query_log;
=== removed file 'mysql-test/include/have_dynamic_loading.inc'
--- a/mysql-test/include/have_dynamic_loading.inc 2009-05-22 17:53:25 +0000
+++ b/mysql-test/include/have_dynamic_loading.inc 1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
--- require r/have_dynamic_loading.require
-disable_query_log;
-show variables like 'have_dynamic_loading';
-enable_query_log;
=== modified file 'mysql-test/include/have_example_plugin.inc'
--- a/mysql-test/include/have_example_plugin.inc 2008-07-04 18:48:25 +0000
+++ b/mysql-test/include/have_example_plugin.inc 2009-09-04 20:02:17 +0000
@@ -2,10 +2,7 @@
# Check if server has support for loading udf's
# i.e it will support dlopen
#
---require r/have_dynamic_loading.require
-disable_query_log;
-show variables like 'have_dynamic_loading';
-enable_query_log;
+--source include/have_dynamic_loading.inc
#
# Check if the variable EXAMPLE_PLUGIN is set
=== added file 'mysql-test/include/have_mysql_upgrade.inc'
--- a/mysql-test/include/have_mysql_upgrade.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_mysql_upgrade.inc 2009-09-28 06:24:19 +0000
@@ -0,0 +1,4 @@
+--require r/have_mysql_upgrade.result
+--disable_query_log
+select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
+--enable_query_log
=== added file 'mysql-test/include/have_not_innodb_plugin.inc'
--- a/mysql-test/include/have_not_innodb_plugin.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_not_innodb_plugin.inc 2009-09-25 09:26:49 +0000
@@ -0,0 +1,4 @@
+disable_query_log;
+--require r/not_true.require
+select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB';
+enable_query_log;
=== modified file 'mysql-test/include/have_simple_parser.inc'
--- a/mysql-test/include/have_simple_parser.inc 2008-12-17 13:24:34 +0000
+++ b/mysql-test/include/have_simple_parser.inc 2009-09-04 20:02:17 +0000
@@ -2,10 +2,7 @@
# Check if server has support for loading udf's
# i.e it will support dlopen
#
---require r/have_dynamic_loading.require
-disable_query_log;
-show variables like 'have_dynamic_loading';
-enable_query_log;
+--source include/have_dynamic_loading.inc
#
# Check if the variable SIMPLE_PARSER is set
=== modified file 'mysql-test/include/have_udf.inc'
--- a/mysql-test/include/have_udf.inc 2008-07-04 18:48:25 +0000
+++ b/mysql-test/include/have_udf.inc 2009-09-04 20:02:17 +0000
@@ -2,10 +2,7 @@
# Check if server has support for loading udf's
# i.e it will support dlopen
#
---require r/have_dynamic_loading.require
-disable_query_log;
-show variables like 'have_dynamic_loading';
-enable_query_log;
+--source include/have_dynamic_loading.inc
#
# Check if the variable UDF_EXAMPLE_LIB is set
=== modified file 'mysql-test/include/mix1.inc'
--- a/mysql-test/include/mix1.inc 2009-09-15 06:08:54 +0000
+++ b/mysql-test/include/mix1.inc 2009-11-16 20:49:51 +0000
@@ -442,6 +442,8 @@ INSERT INTO t1(id, dept, age, name) VALU
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
DELETE FROM t1;
+--echo # Masking (#) number in "rows" column of the following EXPLAIN output, as it may vary (bug#47746).
+--replace_column 9 #
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
=== modified file 'mysql-test/include/mtr_warnings.sql'
--- a/mysql-test/include/mtr_warnings.sql 2009-09-07 20:50:10 +0000
+++ b/mysql-test/include/mtr_warnings.sql 2009-11-16 20:49:51 +0000
@@ -132,7 +132,7 @@ INSERT INTO global_suppressions VALUES
("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"),
- ("Statement is not safe to log in statement format"),
+ ("Statement may not be safe to log in statement format"),
/* test case for Bug#bug29807 copies a stray frm into database */
("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"),
@@ -162,6 +162,8 @@ INSERT INTO global_suppressions VALUES
("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
("Slave: Can't DROP 'c7'.* 1091"),
("Slave: Key column 'c6'.* 1072"),
+ ("The slave I.O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
+ (".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"),
/* Test case for Bug#31590 in order_by.test produces the following error */
("Out of sort memory; increase server sort buffer size"),
@@ -171,6 +173,7 @@ INSERT INTO global_suppressions VALUES
this error message.
*/
("Can't find file: '.\\\\test\\\\\\?{8}.frm'"),
+ ("Slave: Unknown table 't1' Error_code: 1051"),
/* maria-recovery.test has warning about missing log file */
("File '.*maria_log.000.*' not found \\(Errcode: 2\\)"),
@@ -217,7 +220,7 @@ BEGIN
WHERE suspicious=1;
IF @num_warnings > 0 THEN
- SELECT file_name, line
+ SELECT line
FROM error_log WHERE suspicious=1;
--SELECT * FROM test_suppressions;
-- Return 2 -> check failed
=== added file 'mysql-test/include/not_windows_embedded.inc'
--- a/mysql-test/include/not_windows_embedded.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/not_windows_embedded.inc 2009-10-08 08:39:15 +0000
@@ -0,0 +1,11 @@
+let $is_win = `select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`;
+let $is_embedded = `select version() like '%embedded%'`;
+#echo is_win: $is_win;
+#echo is_embedded: $is_embedded;
+if ($is_win)
+{
+ if ($is_embedded)
+ {
+ skip Not supported with embedded on windows;
+ }
+}
=== modified file 'mysql-test/lib/My/ConfigFactory.pm'
--- a/mysql-test/lib/My/ConfigFactory.pm 2009-10-07 22:57:43 +0000
+++ b/mysql-test/lib/My/ConfigFactory.pm 2009-11-16 20:49:51 +0000
@@ -7,6 +7,7 @@ use Carp;
use My::Config;
use My::Find;
+use My::Platform;
use File::Basename;
@@ -207,8 +208,8 @@ my @mysqld_rules=
{ '#log-error' => \&fix_log_error },
{ 'general-log' => sub { return 1; } },
{ 'general-log-file' => \&fix_log },
- { 'slow-query-log-file' => \&fix_log_slow_queries },
{ 'slow-query-log' => sub { return 1; } },
+ { 'slow-query-log-file' => \&fix_log_slow_queries },
{ '#user' => sub { return shift->{ARGS}->{user} || ""; } },
{ '#password' => sub { return shift->{ARGS}->{password} || ""; } },
{ 'server-id' => \&fix_server_id, },
@@ -219,7 +220,13 @@ my @mysqld_rules=
{ 'ssl-key' => \&fix_ssl_server_key },
);
-
+if (IS_WINDOWS)
+{
+ # For simplicity, we use the same names for shared memory and
+ # named pipes.
+ push(@mysqld_rules, {'shared-memory-base-name' => \&fix_socket});
+}
+
sub fix_ndb_mgmd_port {
my ($self, $config, $group_name, $group)= @_;
my $hostname= $group->value('HostName');
@@ -348,6 +355,16 @@ sub post_check_client_group {
}
$config->insert($client_group_name, $name_to, $option->value())
}
+
+ if (IS_WINDOWS)
+ {
+ # Shared memory base may or may not be defined (e.g not defined in embedded)
+ my $shm = $group_to_copy_from->option("shared-memory-base-name");
+ if (defined $shm)
+ {
+ $config->insert($client_group_name,"shared-memory-base-name", $shm->value());
+ }
+ }
}
@@ -394,6 +411,7 @@ sub post_check_embedded_group {
(
'#log-error', # Embedded server writes stderr to mysqltest's log file
'slave-net-timeout', # Embedded server are not build with replication
+ 'shared-memory-base-name', # No shared memory for embedded
);
foreach my $option ( $mysqld->options(), $first_mysqld->options() ) {
=== modified file 'mysql-test/lib/My/Platform.pm'
--- a/mysql-test/lib/My/Platform.pm 2009-02-25 09:32:13 +0000
+++ b/mysql-test/lib/My/Platform.pm 2009-08-06 07:30:53 +0000
@@ -106,10 +106,13 @@ sub check_socket_path_length {
my ($path)= @_;
return 0 if IS_WINDOWS;
+ # This may not be true, but we can't test for it on AIX due to Perl bug
+ # See Bug #45771
+ return 0 if ($^O eq 'aix');
require IO::Socket::UNIX;
- my $truncated= 1; # Be negative
+ my $truncated= undef;
# Create a tempfile name with same length as "path"
my $tmpdir = tempdir( CLEANUP => 0);
@@ -122,6 +125,7 @@ sub check_socket_path_length {
Local => $testfile,
Listen => 1,
);
+ $truncated= 1; # Be negatvie
die "Could not create UNIX domain socket: $!"
unless defined $sock;
@@ -133,6 +137,9 @@ sub check_socket_path_length {
};
+ die "Unexpected failure when checking socket path length: $@"
+ if $@ and not defined $truncated;
+
$sock= undef; # Close socket
rmtree($tmpdir); # Remove the tempdir and any socket file created
return $truncated;
=== modified file 'mysql-test/lib/My/SafeProcess/safe_kill_win.cc'
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc 2008-10-08 20:02:32 +0000
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc 2009-09-29 22:19:00 +0000
@@ -30,7 +30,7 @@ int main(int argc, const char** argv )
DWORD pid= -1;
HANDLE shutdown_event;
char safe_process_name[32]= {0};
- int retry_open_event= 100;
+ int retry_open_event= 2;
/* Ignore any signals */
signal(SIGINT, SIG_IGN);
signal(SIGBREAK, SIG_IGN);
@@ -51,15 +51,31 @@ int main(int argc, const char** argv )
{
/*
Check if the process is alive, otherwise there is really
- no idea to retry the open of the event
+ no sense to retry the open of the event
*/
HANDLE process;
- if ((process= OpenProcess(SYNCHRONIZE, FALSE, pid)) == NULL)
+ DWORD exit_code;
+ process= OpenProcess(SYNCHRONIZE| PROCESS_QUERY_INFORMATION, FALSE, pid);
+ if (!process)
{
- fprintf(stderr, "Could not open event or process %d, error: %d\n",
- pid, GetLastError());
- exit(3);
+ /* Already died */
+ exit(1);
+ }
+
+ if (!GetExitCodeProcess(process,&exit_code))
+ {
+ fprintf(stderr, "GetExitCodeProcess failed, pid= %d, err= %d\n",
+ pid, GetLastError());
+ exit(1);
}
+
+ if (exit_code != STILL_ACTIVE)
+ {
+ /* Already died */
+ CloseHandle(process);
+ exit(2);
+ }
+
CloseHandle(process);
if (retry_open_event--)
=== modified file 'mysql-test/lib/My/SafeProcess/safe_process_win.cc'
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc 2009-09-17 22:46:10 +0000
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc 2009-11-16 20:49:51 +0000
@@ -50,9 +50,6 @@
is killed.
*/
-/* Requires Windows 2000 or higher */
-#define _WIN32_WINNT 0x0500
-
#include <windows.h>
#include <stdio.h>
#include <tlhelp32.h>
@@ -189,7 +186,14 @@ int main(int argc, const char** argv )
die("No real args -> nothing to do");
/* Copy the remaining args to child_arg */
for (int j= i+1; j < argc; j++) {
- to+= _snprintf(to, child_args + sizeof(child_args) - to, "%s ", argv[j]);
+ if (strchr (argv[j], ' ')) {
+ /* Protect with "" if this arg contains a space */
+ to+= _snprintf(to, child_args + sizeof(child_args) - to,
+ "\"%s\" ", argv[j]);
+ } else {
+ to+= _snprintf(to, child_args + sizeof(child_args) - to,
+ "%s ", argv[j]);
+ }
}
break;
} else {
=== modified file 'mysql-test/lib/mtr_cases.pm'
--- a/mysql-test/lib/mtr_cases.pm 2009-11-06 17:24:38 +0000
+++ b/mysql-test/lib/mtr_cases.pm 2009-11-16 20:49:51 +0000
@@ -41,6 +41,7 @@ our $opt_with_ndbcluster_only;
our $defaults_file;
our $defaults_extra_file;
our $reorder= 1;
+our $quick_collect;
sub collect_option {
my ($opt, $value)= @_;
@@ -68,6 +69,13 @@ require "mtr_misc.pl";
my $do_test_reg;
my $skip_test_reg;
+# Related to adding InnoDB plugin combinations
+my $lib_innodb_plugin;
+my $do_innodb_plugin;
+
+# If "Quick collect", set to 1 once a test to run has been found.
+my $some_test_found;
+
sub init_pattern {
my ($from, $what)= @_;
return undef unless defined $from;
@@ -100,10 +108,23 @@ sub collect_test_cases ($$) {
$do_test_reg= init_pattern($do_test, "--do-test");
$skip_test_reg= init_pattern($skip_test, "--skip-test");
+ $lib_innodb_plugin=
+ my_find_file($::basedir,
+ ["storage/innodb_plugin", "storage/innodb_plugin/.libs",
+ "lib/mysql/plugin", "lib/mariadb/plugin", "lib/plugin"],
+ ["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
+ "ha_innodb_plugin.sl"],
+ NOT_REQUIRED);
+
+ $do_innodb_plugin= ($::mysql_version_id >= 50100 &&
+ !(IS_WINDOWS && $::opt_embedded_server) &&
+ $lib_innodb_plugin);
+
foreach my $suite (split(",", $suites))
{
push(@$cases, collect_one_suite($suite, $opt_cases));
$found_suites{$suite}= 1;
+ last if $some_test_found;
}
if ( @$opt_cases )
@@ -147,7 +168,7 @@ sub collect_test_cases ($$) {
}
}
- if ( $reorder )
+ if ( $reorder && !$quick_collect)
{
# Reorder the test cases in an order that will make them faster to run
my %sort_criteria;
@@ -398,7 +419,7 @@ sub collect_one_suite($)
# Read combinations for this suite and build testcases x combinations
# if any combinations exists
# ----------------------------------------------------------------------
- if ( ! $skip_combinations )
+ if ( ! $skip_combinations && ! $quick_collect )
{
my @combinations;
my $combination_file= "$suitedir/combinations";
@@ -491,21 +512,16 @@ sub collect_one_suite($)
# ----------------------------------------------------------------------
# Testing InnoDB plugin.
# ----------------------------------------------------------------------
- my $lib_innodb_plugin=
- mtr_file_exists(::vs_config_dirs('storage/innodb_plugin', 'ha_innodb_plugin.dll'),
- "$::basedir/storage/innodb_plugin/.libs/ha_innodb_plugin.so",
- "$::basedir/lib/mariadb/plugin/ha_innodb_plugin.so",
- "$::basedir/lib/mariadb/plugin/ha_innodb_plugin.dll",
- "$::basedir/lib/mysql/plugin/ha_innodb_plugin.so",
- "$::basedir/lib/mysql/plugin/ha_innodb_plugin.dll");
- if ($::mysql_version_id >= 50100 && !(IS_WINDOWS && $::opt_embedded_server) &&
- $lib_innodb_plugin)
+ if ($do_innodb_plugin)
{
my @new_cases;
+ my $sep= (IS_WINDOWS) ? ';' : ':';
foreach my $test (@cases)
{
- next if ($test->{'skip'} || !$test->{'innodb_test'});
+ next if (!$test->{'innodb_test'});
+ # If skipped due to no builtin innodb, we can still run it with plugin
+ next if ($test->{'skip'} && $test->{comment} ne "No innodb support");
# Exceptions
next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk)
next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff
@@ -515,6 +531,8 @@ sub collect_one_suite($)
next if ($test->{'name'} eq 'sys_vars.innodb_lock_wait_timeout_basic');
# Diff around innodb_thread_concurrency variable
next if ($test->{'name'} eq 'sys_vars.innodb_thread_concurrency_basic');
+ # Can't work with InnoPlug. Test framework needs to be re-designed.
+ next if ($test->{'name'} eq 'main.innodb_bug46000');
# Copy test options
my $new_test= My::Test->new();
while (my ($key, $value) = each(%$test))
@@ -525,23 +543,24 @@ sub collect_one_suite($)
}
else
{
- $new_test->{$key}= $value;
+ $new_test->{$key}= $value unless ($key eq 'skip');
}
}
my $plugin_filename= basename($lib_innodb_plugin);
+ my $plugin_list= "innodb=$plugin_filename" . $sep . "innodb_locks=$plugin_filename";
push(@{$new_test->{master_opt}}, '--ignore-builtin-innodb');
push(@{$new_test->{master_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
- push(@{$new_test->{master_opt}}, "--plugin_load=innodb=$plugin_filename;innodb_locks=$plugin_filename");
+ push(@{$new_test->{master_opt}}, "--plugin_load=$plugin_list");
push(@{$new_test->{slave_opt}}, '--ignore-builtin-innodb');
push(@{$new_test->{slave_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
- push(@{$new_test->{slave_opt}}, "--plugin_load=innodb=$plugin_filename;innodb_locks=$plugin_filename");
+ push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list");
if ($new_test->{combination})
{
- $new_test->{combination}.= ' + InnoDB plugin';
+ $new_test->{combination}.= '+innodb_plugin';
}
else
{
- $new_test->{combination}= 'InnoDB plugin';
+ $new_test->{combination}= 'innodb_plugin';
}
push(@new_cases, $new_test);
}
@@ -670,34 +689,10 @@ sub optimize_cases {
}
}
- # =======================================================
- # Check that engine selected by
- # --default-storage-engine=<engine> is supported
- # =======================================================
- my %builtin_engines = ('myisam' => 1, 'memory' => 1);
-
- foreach my $opt ( @{$tinfo->{master_opt}} ) {
- my $default_engine=
- mtr_match_prefix($opt, "--default-storage-engine=");
-
- if (defined $default_engine){
-
-
- my $engine_value= $::mysqld_variables{$default_engine};
-
- if ( ! exists $::mysqld_variables{$default_engine} and
- ! exists $builtin_engines{$default_engine} )
- {
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}=
- "'$default_engine' not supported";
- }
-
- $tinfo->{'ndb_test'}= 1
- if ( $default_engine =~ /^ndb/i );
- $tinfo->{'innodb_test'}= 1
- if ( $default_engine =~ /^innodb/i );
- }
+ if ($quick_collect && ! $tinfo->{'skip'})
+ {
+ $some_test_found= 1;
+ return;
}
}
@$cases= @new_cases;
@@ -1001,21 +996,24 @@ sub collect_one_test_case {
if ($tinfo->{'federated_test'})
{
- # This is a test that need federated, enable it
+ # This is a test that needs federated, enable it
push(@{$tinfo->{'master_opt'}}, "--loose-federated");
push(@{$tinfo->{'slave_opt'}}, "--loose-federated");
}
if ( $tinfo->{'innodb_test'} )
{
- # This is a test that need innodb
+ # This is a test that needs innodb
if ( $::mysqld_variables{'innodb'} eq "OFF" ||
! exists $::mysqld_variables{'innodb'} )
{
# innodb is not supported, skip it
$tinfo->{'skip'}= 1;
+ # This comment is checked for running with innodb plugin (see above),
+ # please keep that in mind if changing the text.
$tinfo->{'comment'}= "No innodb support";
- return $tinfo;
+ # But continue processing if we may run it with innodb plugin
+ return $tinfo unless $do_innodb_plugin;
}
}
else
@@ -1071,6 +1069,17 @@ sub collect_one_test_case {
}
}
+ if ( $tinfo->{'need_ssl'} )
+ {
+ # This is a test that needs ssl
+ if ( ! $::opt_ssl_supported ) {
+ # SSL is not supported, skip it
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "No SSL support";
+ return $tinfo;
+ }
+ }
+
# ----------------------------------------------------------------------
# Find config file to use if not already selected in <testname>.opt file
# ----------------------------------------------------------------------
@@ -1163,7 +1172,8 @@ my @tags=
["federated.inc", "federated_test", 1],
["include/not_embedded.inc", "not_embedded", 1],
["include/not_valgrind.inc", "not_valgrind", 1],
- ["include/have_example_plugin.inc", "example_plugin_test", 1]
+ ["include/have_example_plugin.inc", "example_plugin_test", 1],
+ ["include/have_ssl.inc", "need_ssl", 1],
);
=== modified file 'mysql-test/lib/mtr_report.pm'
--- a/mysql-test/lib/mtr_report.pm 2009-09-07 20:50:10 +0000
+++ b/mysql-test/lib/mtr_report.pm 2009-11-16 20:49:51 +0000
@@ -134,8 +134,8 @@ sub mtr_report_test ($) {
# an asterisk at the end, determine if the characters up to
# but excluding the asterisk are the same
if ( $exp ne "" && substr($exp, -1, 1) eq "*" ) {
- $exp = substr($exp, 0, length($exp) - 1);
- if ( substr($test_name, 0, length($exp)) ne $exp ) {
+ my $nexp = substr($exp, 0, length($exp) - 1);
+ if ( substr($test_name, 0, length($nexp)) ne $nexp ) {
# no match, try next entry
next;
}
@@ -146,6 +146,7 @@ sub mtr_report_test ($) {
}
}
$fail = "exp-fail";
+ $tinfo->{exp_fail}= 1;
last;
}
}
=== added file 'mysql-test/lib/v1/incompatible.tests'
--- a/mysql-test/lib/v1/incompatible.tests 1970-01-01 00:00:00 +0000
+++ b/mysql-test/lib/v1/incompatible.tests 2009-07-16 12:05:46 +0000
@@ -0,0 +1,6 @@
+# This file lists tests that cannot run in MTR v1 for some reason.
+# They will be skipped.
+# Any text following white space after full test name is ignored
+# Only exact test names can be used, no regexp.
+
+main.fulltext_plugin # Refers to $SIMPLE_PARSER_OPT which is not set
=== modified file 'mysql-test/lib/v1/mtr_cases.pl'
--- a/mysql-test/lib/v1/mtr_cases.pl 2008-11-14 14:39:12 +0000
+++ b/mysql-test/lib/v1/mtr_cases.pl 2009-07-31 09:22:57 +0000
@@ -32,6 +32,7 @@ sub mtr_options_from_test_file($$);
my $do_test;
my $skip_test;
+my %incompatible;
sub init_pattern {
my ($from, $what)= @_;
@@ -47,6 +48,15 @@ sub init_pattern {
}
+sub collect_incomp_tests {
+ open (INCOMP, "lib/v1/incompatible.tests");
+ while (<INCOMP>)
+ {
+ next unless /^\w/;
+ s/\s.*\n//; # Ignore anything from first white space
+ $incompatible{$_}= 1;
+ }
+}
##############################################################################
#
@@ -58,6 +68,8 @@ sub collect_test_cases ($) {
$do_test= init_pattern($::opt_do_test, "--do-test");
$skip_test= init_pattern($::opt_skip_test, "--skip-test");
+ collect_incomp_tests();
+
my $suites= shift; # Semicolon separated list of test suites
my $cases = []; # Array of hash
@@ -528,6 +540,17 @@ sub collect_one_test_case($$$$$$$$$) {
$tinfo->{'component_id'} = $component_id;
push(@$cases, $tinfo);
+ # Remove "combinations" part of test name
+ my $test_base_name= $tinfo->{'name'};
+ $test_base_name=~ s/\s.*\n//;
+
+ if (exists ($incompatible{$test_base_name}))
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Test cannot run in mtr v1";
+ return;
+ }
+
# ----------------------------------------------------------------------
# Skip some tests but include in list, just mark them to skip
# ----------------------------------------------------------------------
@@ -841,7 +864,7 @@ sub collect_one_test_case($$$$$$$$$) {
if ( $tinfo->{'innodb_test'} )
{
# This is a test that need innodb
- if ( $::mysqld_variables{'innodb'} ne "TRUE" )
+ if ( $::mysqld_variables{'innodb'} eq "OFF" )
{
# innodb is not supported, skip it
$tinfo->{'skip'}= 1;
=== modified file 'mysql-test/mysql-stress-test.pl'
--- a/mysql-test/mysql-stress-test.pl 2009-09-30 23:40:51 +0000
+++ b/mysql-test/mysql-stress-test.pl 2009-11-16 20:49:51 +0000
@@ -14,17 +14,16 @@
#
# Design of stress script should allow one:
#
-# - To stress test the mysqltest binary test engine.
-# - To stress test the regular test suite and any additional test suites
-# (such as mysql-test-extra-5.0).
-# - To specify files with lists of tests both for initialization of
-# stress db and for further testing itself.
-# - To define the number of threads to be concurrently used in testing.
-# - To define limitations for the test run. such as the number of tests or
-# loops for execution or duration of testing, delay between test
-# executions, and so forth.
-# - To get a readable log file that can be used for identification of
-# errors that occur during testing.
+# - to use for stress testing mysqltest binary as test engine
+# - to use for stress testing both regular test suite and any
+# additional test suites (e.g. mysql-test-extra-5.0)
+# - to specify files with lists of tests both for initialization of
+# stress db and for further testing itself
+# - to define number of threads that will be concurrently used in testing
+# - to define limitations for test run. e.g. number of tests or loops
+# for execution or duration of testing, delay between test executions, etc.
+# - to get readable log file which can be used for identification of
+# errors arose during testing
#
# Basic scenarios:
#
@@ -58,6 +57,8 @@
# to reproduce and debug errors that was found in continued stress
# testing
#
+# 2009-01-28 OBN Additions and modifications per WL#4685
+#
########################################################################
use Config;
@@ -114,13 +115,15 @@ $opt_stress_mode="random";
$opt_loop_count=0;
$opt_test_count=0;
$opt_test_duration=0;
-$opt_abort_on_error=0;
+# OBN: Changing abort-on-error default to -1 (for WL-4626/4685): -1 means no abort
+$opt_abort_on_error=-1;
$opt_sleep_time = 0;
$opt_threads=1;
$pid_file="mysql_stress_test.pid";
$opt_mysqltest= ($^O =~ /mswin32/i) ? "mysqltest.exe" : "mysqltest";
$opt_check_tests_file="";
-@mysqltest_args=("--silent", "-v", "--skip-safemalloc");
+# OBM adding a setting for 'max-connect-retries=7' the default of 500 is to high
+@mysqltest_args=("--silent", "-v", "--skip-safemalloc", "--max-connect-retries=7");
# Client ip address
$client_ip=inet_ntoa((gethostbyname(hostname()))[4]);
@@ -133,24 +136,31 @@ $client_ip=~ s/\.//g;
#
# S1 - Critical errors - cause immediately abort of testing. These errors
# could be caused by server crash or impossibility
-# of test execution
+# of test execution.
#
# S2 - Serious errors - these errors are bugs for sure as it knowns that
# they shouldn't appear during stress testing
#
-# S3 - Non-seriuos errros - these errors could be caused by fact that
+# S3 - Unknown errors - Errors were returned but we don't know what they are
+# so script can't determine if they are OK or not
+#
+# S4 - Non-seriuos errros - these errors could be caused by fact that
# we execute simultaneously statements that
# affect tests executed by other threads
%error_strings = ( 'Failed in mysql_real_connect()' => S1,
+ 'Can\'t connect' => S1,
'not found (Errcode: 2)' => S1 );
%error_codes = ( 1012 => S2, 1015 => S2, 1021 => S2,
1027 => S2, 1037 => S2, 1038 => S2,
1039 => S2, 1040 => S2, 1046 => S2,
- 1180 => S2, 1181 => S2, 1203 => S2,
- 1205 => S2, 1206 => S2, 1207 => S2,
- 1223 => S2, 2013 => S1);
+ 1053 => S2, 1180 => S2, 1181 => S2,
+ 1203 => S2, 1205 => S4, 1206 => S2,
+ 1207 => S2, 1213 => S4, 1223 => S2,
+ 2002 => S1, 2003 => S1, 2006 => S1,
+ 2013 => S1
+ );
share(%test_counters);
%test_counters=( loop_count => 0, test_count=>0);
@@ -158,6 +168,35 @@ share(%test_counters);
share($exiting);
$exiting=0;
+# OBN Code and 'set_exit_code' function added by ES to set an exit code based on the error category returned
+# in combination with the --abort-on-error value see WL#4685)
+use constant ABORT_MAKEWEIGHT => 20;
+share($gExitCode);
+$gExitCode = 0; # global exit code
+sub set_exit_code {
+ my $severity = shift;
+ my $code = 0;
+ if ( $severity =~ /^S(\d+)/ ) {
+ $severity = $1;
+ $code = 11 - $severity; # S1=10, S2=9, ... -- as per WL
+ }
+ else {
+ # we know how we call the sub: severity should be S<num>; so, we should never be here...
+ print STDERR "Unknown severity format: $severity; setting to S1\n";
+ $severity = 1;
+ }
+ $abort = 0;
+ if ( $severity <= $opt_abort_on_error ) {
+ # the test finished with a failure severe enough to abort. We are adding the 'abort flag' to the exit code
+ $code += ABORT_MAKEWEIGHT;
+ # but are not exiting just yet -- we need to update global exit code first
+ $abort = 1;
+ }
+ lock $gExitCode; # we can use lock here because the script uses threads anyway
+ $gExitCode = $code if $code > $gExitCode;
+ kill INT, $$ if $abort; # this is just a way to call sig_INT_handler: it will set exiting flag, which should do the rest
+}
+
share($test_counters_lock);
$test_counters_lock=0;
share($log_file_lock);
@@ -176,7 +215,8 @@ GetOptions("server-host=s", "server-logs
"threads=s", "sleep-time=s", "loop-count=i", "test-count=i",
"test-duration=i", "test-suffix=s", "check-tests-file",
"verbose", "log-error-details", "cleanup", "mysqltest=s",
- "abort-on-error", "help") || usage();
+ # OBN: (changing 'abort-on-error' to numberic for WL-4626/4685)
+ "abort-on-error=i" => \$opt_abort_on_error, "help") || usage();
usage() if ($opt_help);
@@ -563,7 +603,15 @@ EOF
if ($opt_test_duration)
{
- sleep($opt_test_duration);
+ # OBN - At this point we need to wait for the duration of the test, hoever
+ # we need to be able to quit if an 'abort-on-error' condition has happend
+ # with one of the children (WL#4685). Using solution by ES and replacing
+ # the 'sleep' command with a loop checking the abort condition every second
+
+ foreach ( 1..$opt_test_duration ) {
+ last if $exiting;
+ sleep 1;
+ }
kill INT, $$; #Interrupt child threads
}
@@ -580,6 +628,8 @@ EOF
print "EXIT\n";
}
+exit $gExitCode; # ES WL#4685: script should return a meaningful exit code
+
sub test_init
{
my ($env)=@_;
@@ -681,7 +731,9 @@ sub test_execute
{
if (!exists($error_codes{$err_code}))
{
- $severity="S3";
+ # OBN Changing severity level to S4 from S3 as S3 now reserved
+ # for the case where the error is unknown (for WL#4626/4685
+ $severity="S4";
$err_code=0;
}
else
@@ -734,6 +786,7 @@ sub test_execute
{
push @{$env->{test_status}}, "Severity $severity: $total";
$env->{errors}->{total}=+$total;
+ set_exit_code($severity);
}
}
@@ -748,18 +801,20 @@ sub test_execute
log_session_errors($env, $test_file);
- if (!$exiting && ($signal_num == 2 || $signal_num == 15 ||
- ($opt_abort_on_error && $env->{errors}->{S1} > 0)))
+ #OBN Removing the case of S1 and abort-on-error as that is now set
+ # inside the set_exit_code function (for WL#4626/4685)
+ #if (!$exiting && ($signal_num == 2 || $signal_num == 15 ||
+ # ($opt_abort_on_error && $env->{errors}->{S1} > 0)))
+ if (!$exiting && ($signal_num == 2 || $signal_num == 15))
{
- #mysqltest was interrupted with INT or TERM signals or test was
- #ran with --abort-on-error option and we got errors with severity S1
+ #mysqltest was interrupted with INT or TERM signals
#so we assume that we should cancel testing and exit
$exiting=1;
+ # OBN - Adjusted text to exclude case of S1 and abort-on-error that
+ # was mentioned (for WL#4626/4685)
print STDERR<<EOF;
WARNING:
- mysqltest was interrupted with INT or TERM signals or test was
- ran with --abort-on-error option and we got errors with severity S1
- (test cann't connect to the server or server crashed) so we assume that
+ mysqltest was interrupted with INT or TERM signals so we assume that
we should cancel testing and exit. Please check log file for this thread
in $stress_log_file or
inspect below output of the last test case executed with mysqltest to
@@ -840,12 +895,23 @@ LOOP:
$client_env{test_count}."]:".
" TID ".$client_env{thread_id}.
" test: '$test_name' ".
- " Errors: ".join(" ",@{$client_env{test_status}}),"\n";
- print "\n";
+ " Errors: ".join(" ",@{$client_env{test_status}}).
+ ( $exiting ? " (thread aborting)" : "" )."\n";
}
- sleep($opt_sleep_time) if($opt_sleep_time);
-
+ # OBN - At this point we need to wait until the 'wait' time between test
+ # executions passes (in case it is specifed) passes, hoever we need
+ # to be able to quit and break out of the test if an 'abort-on-error'
+ # condition has happend with one of the other children (WL#4685).
+ # Using solution by ES and replacing the 'sleep' command with a loop
+ # checking the abort condition every second
+
+ if ( $opt_sleep_time ) {
+ foreach ( 1..$opt_sleep_time ) {
+ last if $exiting;
+ sleep 1;
+ }
+ }
}
}
@@ -1119,6 +1185,9 @@ mysql-stress-test.pl --stress-basedir=<d
--cleanup
Force to clean up working directory (specified with --stress-basedir)
+--abort-on-error=<number>
+ Causes the script to abort if an error with severity <= number was encounterd
+
--log-error-details
Enable errors details in the global error log file. (Default: off)
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-06 17:24:38 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-11-16 20:49:51 +0000
@@ -150,7 +150,7 @@ our @opt_extra_mysqltest_opt;
my $opt_compress;
my $opt_ssl;
my $opt_skip_ssl;
-my $opt_ssl_supported;
+our $opt_ssl_supported;
my $opt_ps_protocol;
my $opt_sp_protocol;
my $opt_cursor_protocol;
@@ -216,6 +216,7 @@ sub check_timeout { return $opt_testcase
my $opt_start;
my $opt_start_dirty;
+my $start_only;
my $opt_wait_all;
my $opt_repeat= 1;
my $opt_retry= 3;
@@ -339,7 +340,8 @@ sub main {
for my $limit (2000, 1500, 1000, 500){
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
}
- $opt_parallel= 8 if ($opt_parallel > 8);
+ my $max_par= $ENV{MTR_MAX_PARALLEL} || 8;
+ $opt_parallel= $max_par if ($opt_parallel > $max_par);
$opt_parallel= $num_tests if ($opt_parallel > $num_tests);
$opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm());
$opt_parallel= 1 if ($opt_parallel < 1);
@@ -547,7 +549,8 @@ sub run_test_server ($$$) {
}
}
$num_saved_datadir++;
- $num_failed_test++ unless $result->{retries};
+ $num_failed_test++ unless ($result->{retries} ||
+ $result->{exp_fail});
$test_failure= 1;
if ( !$opt_force ) {
@@ -1052,6 +1055,9 @@ sub command_line_setup {
if ( $opt_experimental )
{
+ # $^O on Windows considered not generic enough
+ my $plat= (IS_WINDOWS) ? 'windows' : $^O;
+
# read the list of experimental test cases from the file specified on
# the command line
open(FILE, "<", $opt_experimental) or mtr_error("Can't read experimental file: $opt_experimental");
@@ -1062,6 +1068,15 @@ sub command_line_setup {
# remove comments (# foo) at the beginning of the line, or after a
# blank at the end of the line
s/( +|^)#.*$//;
+ # If @ platform specifier given, use this entry only if it contains
+ # @<platform> or @!<xxx> where xxx != platform
+ if (/\@.*/)
+ {
+ next if (/\@!$plat/);
+ next unless (/\@$plat/ or /\@!/);
+ # Then remove @ and everything after it
+ s/\@.*$//;
+ }
# remove whitespace
s/^ +//;
s/ +$//;
@@ -1321,6 +1336,21 @@ sub command_line_setup {
{
mtr_error("Can't use --extern when using debugger");
}
+ # Set one week timeout (check-testcase timeout will be 1/10th)
+ $opt_testcase_timeout= 7 * 24 * 60;
+ $opt_suite_timeout= 7 * 24 * 60;
+ # One day to shutdown
+ $opt_shutdown_timeout= 24 * 60;
+ # One day for PID file creation (this is given in seconds not minutes)
+ $opt_start_timeout= 24 * 60 * 60;
+ }
+
+ # --------------------------------------------------------------------------
+ # Modified behavior with --start options
+ # --------------------------------------------------------------------------
+ if ($opt_start or $opt_start_dirty) {
+ collect_option ('quick-collect', 1);
+ $start_only= 1;
}
if ($opt_debug)
{
@@ -1334,7 +1364,7 @@ sub command_line_setup {
# Check use of wait-all
# --------------------------------------------------------------------------
- if ($opt_wait_all && ! ($opt_start_dirty || $opt_start))
+ if ($opt_wait_all && ! $start_only)
{
mtr_error("--wait-all can only be used with --start or --start-dirty");
}
@@ -1394,6 +1424,9 @@ sub command_line_setup {
push(@valgrind_args, @default_valgrind_args)
unless @valgrind_args;
+ # Make valgrind run in quiet mode so it only print errors
+ push(@valgrind_args, "--quiet" );
+
mtr_report("Running valgrind with options \"",
join(" ", @valgrind_args), "\"");
}
@@ -1609,6 +1642,10 @@ sub collect_mysqld_features_from_running
}
}
+ # "Convert" innodb flag
+ $mysqld_variables{'innodb'}= "ON"
+ if ($mysqld_variables{'have_innodb'} eq "YES");
+
# Parse version
my $version_str= $mysqld_variables{'version'};
if ( $version_str =~ /^([0-9]*)\.([0-9]*)\.([0-9]*)/ )
@@ -1909,11 +1946,11 @@ sub environment_setup {
# --------------------------------------------------------------------------
# Add the path where mysqld will find ha_example.so
# --------------------------------------------------------------------------
- if ($mysql_version_id >= 50100 && !(IS_WINDOWS && $opt_embedded_server)) {
+ if ($mysql_version_id >= 50100) {
my $plugin_filename;
if (IS_WINDOWS)
{
- $plugin_filename = "ha_example.dll";
+ $plugin_filename = "ha_example.dll";
}
else
{
@@ -1930,7 +1967,7 @@ sub environment_setup {
($lib_example_plugin ? dirname($lib_example_plugin) : "");
$ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'";
- $ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=;EXAMPLE=".$plugin_filename.";";
+ $ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=EXAMPLE=".$plugin_filename;
}
# ----------------------------------------------------
@@ -3004,7 +3041,7 @@ sub run_testcase_check_skip_test($)
if ( $tinfo->{'skip'} )
{
- mtr_report_test_skipped($tinfo);
+ mtr_report_test_skipped($tinfo) unless $start_only;
return 1;
}
@@ -3174,7 +3211,8 @@ test case was executed:\n";
# Unknown process returned, most likley a crash, abort everything
$tinfo->{comment}=
"The server $proc crashed while running ".
- "'check testcase $mode test'";
+ "'check testcase $mode test'".
+ get_log_from_proc($proc, $tinfo->{name});
$result= 3;
}
@@ -3292,7 +3330,8 @@ sub run_on_all($$)
else {
# Unknown process returned, most likley a crash, abort everything
$tinfo->{comment}.=
- "The server $proc crashed while running '$run'";
+ "The server $proc crashed while running '$run'".
+ get_log_from_proc($proc, $tinfo->{name});
}
# Kill any check processes still running
@@ -3407,6 +3446,12 @@ sub run_testcase ($$) {
mtr_verbose("Running test:", $tinfo->{name});
+ # Allow only alpanumerics pluss _ - + . in combination names
+ my $combination= $tinfo->{combination};
+ if ($combination && $combination !~ /^\w[-\w\.\+]+$/)
+ {
+ mtr_error("Combination '$combination' contains illegal characters");
+ }
# -------------------------------------------------------
# Init variables that can change between each test case
# -------------------------------------------------------
@@ -3501,9 +3546,16 @@ sub run_testcase ($$) {
# server exits
# ----------------------------------------------------------------------
- if ( $opt_start or $opt_start_dirty )
+ if ( $start_only )
{
mtr_print("\nStarted", started(all_servers()));
+ mtr_print("Using config for test", $tinfo->{name});
+ mtr_print("Port and socket path for server(s):");
+ foreach my $mysqld ( mysqlds() )
+ {
+ mtr_print ($mysqld->name() . " " . $mysqld->value('port') .
+ " " . $mysqld->value('socket'));
+ }
mtr_print("Waiting for server(s) to exit...");
if ( $opt_wait_all ) {
My::SafeProcess->wait_all();
@@ -3597,7 +3649,7 @@ sub run_testcase ($$) {
my $check_res;
if ( restart_forced_by_test() )
{
- stop_all_servers();
+ stop_all_servers($opt_shutdown_timeout);
}
elsif ( $opt_check_testcases and
$check_res= check_testcase($tinfo, "after"))
@@ -3614,7 +3666,7 @@ sub run_testcase ($$) {
# test.
} else {
# Not checking warnings, so can do a hard shutdown.
- stop_all_servers();
+ stop_all_servers($opt_shutdown_timeout);
}
mtr_report("Resuming tests...\n");
}
@@ -3696,7 +3748,8 @@ sub run_testcase ($$) {
{
# Server failed, probably crashed
$tinfo->{comment}=
- "Server $proc failed during test run";
+ "Server $proc failed during test run" .
+ get_log_from_proc($proc, $tinfo->{name});
# ----------------------------------------------------
# It's not mysqltest that has exited, kill it
@@ -3809,16 +3862,15 @@ sub pre_write_errorlog {
}
}
+# Extract server log from after the last occurrence of named test
+# Return as an array of lines
#
-# Perform a rough examination of the servers
-# error log and write all lines that look
-# suspicious into $error_log.warnings
-#
-sub extract_warning_lines ($) {
- my ($error_log) = @_;
+
+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 return [];
my $last_pos= $last_warning_position->{$error_log}{seek_pos};
@@ -3849,8 +3901,37 @@ sub extract_warning_lines ($) {
}
}
}
+ return @lines;
+}
+
+# Get log from server identified from its $proc object, from named test
+# Return as a single string
+#
+
+sub get_log_from_proc ($$) {
+ my ($proc, $name)= @_;
+ my $srv_log= "";
+
+ foreach my $mysqld (mysqlds()) {
+ if ($mysqld->{proc} eq $proc) {
+ my @srv_lines= extract_server_log($mysqld->value('#log-error'), $name);
+ $srv_log= "\nServer log from this test:\n" . join ("", @srv_lines);
+ last;
+ }
+ }
+ return $srv_log;
+}
- # Write all suspicious lines to $error_log.warnings file
+# Perform a rough examination of the servers
+# error log and write all lines that look
+# suspicious into $error_log.warnings
+#
+sub extract_warning_lines ($$) {
+ my ($error_log, $tname) = @_;
+
+ my @lines= extract_server_log($error_log, $tname);
+
+# Write all suspicious lines to $error_log.warnings file
my $warning_log = "$error_log.warnings";
my $Fwarn = IO::File->new($warning_log, "w")
or die("Could not open file '$warning_log' for writing: $!");
@@ -3858,16 +3939,9 @@ sub extract_warning_lines ($) {
my @patterns =
(
- # The patterns for detection of [Warning] and [ERROR]
- # in the server log files have been faulty for a longer period
- # and correcting them shows a few additional harmless warnings.
- # Thus those patterns are temporarily removed from the list
- # of patterns. For more info see BUG#42408
- # qr/^Warning:|mysqld: Warning|\[Warning\]/,
- # qr/^Error:|\[ERROR\]/,
- qr/^Warning:|mysqld: Warning/,
- qr/^Error:/,
- qr/^==.* at 0x/,
+ qr/^Warning:|mysqld: Warning|\[Warning\]/,
+ qr/^Error:|\[ERROR\]/,
+ qr/^==\d*==/, # valgrind errors
qr/InnoDB: Warning|InnoDB: Error/,
qr/^safe_mutex:|allocated at line/,
qr/missing DBUG_RETURN/,
@@ -3886,6 +3960,7 @@ sub extract_warning_lines ($) {
# Perl code.
my @antipatterns =
(
+ qr/error .*connecting to master/,
qr/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/,
qr/InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal/,
);
@@ -3933,7 +4008,7 @@ sub start_check_warnings ($$) {
my $log_error= $mysqld->value('#log-error');
# To be communicated to the test
$ENV{MTR_LOG_ERROR}= $log_error;
- extract_warning_lines($log_error);
+ extract_warning_lines($log_error, $tinfo->{name});
my $args;
mtr_init_args(\$args);
@@ -3980,7 +4055,7 @@ sub start_check_warnings ($$) {
#
# Loop through our list of processes and check the error log
-# for unexepcted errors and warnings
+# for unexpected errors and warnings
#
sub check_warnings ($) {
my ($tinfo)= @_;
@@ -4067,7 +4142,8 @@ sub check_warnings ($) {
else {
# Unknown process returned, most likley a crash, abort everything
$tinfo->{comment}=
- "The server $proc crashed while running 'check warnings'";
+ "The server $proc crashed while running 'check warnings'".
+ get_log_from_proc($proc, $tinfo->{name});
$result= 3;
}
@@ -4083,13 +4159,15 @@ sub check_warnings ($) {
}
# Check for warnings generated during shutdown of a mysqld server.
-# If any, report them to master server, and return true; else just return false.
+# If any, report them to master server, and return true; else just return
+# false.
+
sub check_warnings_post_shutdown {
my ($server_socket)= @_;
my $testname_hash= { };
foreach my $mysqld ( mysqlds())
{
- my $testlist= extract_warning_lines($mysqld->value('#log-error'));
+ my $testlist= extract_warning_lines($mysqld->value('#log-error'), "");
$testname_hash->{$_}= 1 for @$testlist;
}
my @warning_tests= keys(%$testname_hash);
@@ -4343,6 +4421,7 @@ sub mysqld_stop {
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--character-sets-dir=%s", $mysqld->value('character-sets-dir'));
mtr_add_arg($args, "--user=%s", $opt_user);
mtr_add_arg($args, "--password=");
mtr_add_arg($args, "--port=%d", $mysqld->value('port'));
@@ -4392,7 +4471,7 @@ sub mysqld_arguments ($$$) {
if (!using_extern() and $mysql_version_id >= 50106 )
{
- # Turn on logging to bothe tables and file
+ # Turn on logging to file and tables
mtr_add_arg($args, "%s--log-output=table,file");
}
@@ -4555,7 +4634,8 @@ sub mysqld_start ($$) {
$opt_start_timeout,
$mysqld->{'proc'}))
{
- mtr_error("Failed to start mysqld $mysqld->name()");
+ my $mname= $mysqld->name();
+ mtr_error("Failed to start mysqld $mname with command $exe");
}
# Remember options used when starting
@@ -4566,11 +4646,12 @@ sub mysqld_start ($$) {
sub stop_all_servers () {
+ my $shutdown_timeout = $_[0] or 0;
mtr_verbose("Stopping all servers...");
# Kill all started servers
- My::SafeProcess::shutdown(0, # shutdown timeout 0 => kill
+ My::SafeProcess::shutdown($shutdown_timeout,
started(all_servers()));
# Remove pidfiles
@@ -4940,7 +5021,8 @@ sub start_servers($) {
my $logfile= $mysqld->value('#log-error');
if ( defined $logfile and -f $logfile )
{
- $tinfo->{logfile}= mtr_fromfile($logfile);
+ my @srv_lines= extract_server_log($logfile, $tinfo->{name});
+ $tinfo->{logfile}= "Server log is:\n" . join ("", @srv_lines);
}
else
{
@@ -5369,7 +5451,6 @@ sub valgrind_arguments {
else
{
mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
- mtr_add_arg($args, "--alignment=8");
mtr_add_arg($args, "--leak-check=yes");
mtr_add_arg($args, "--num-callers=16");
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
@@ -5468,7 +5549,7 @@ Options to control what test suites or c
staging-run Run a limited number of tests (no slow tests). Used
for running staging trees with valgrind.
enable-disabled Run also tests marked as disabled
- print_testcases Don't run the tests but print details about all the
+ print-testcases Don't run the tests but print details about all the
selected tests, in the order they would be run.
Options that specify ports
=== modified file 'mysql-test/r/almost_full.result'
--- a/mysql-test/r/almost_full.result 2007-11-12 09:00:22 +0000
+++ b/mysql-test/r/almost_full.result 2009-08-25 13:56:50 +0000
@@ -1,3 +1,4 @@
+call mtr.add_suppression("The table 't1' is full");
drop table if exists t1;
set global myisam_data_pointer_size=2;
CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM;
=== modified file 'mysql-test/r/alter_table.result'
--- a/mysql-test/r/alter_table.result 2009-10-28 07:52:34 +0000
+++ b/mysql-test/r/alter_table.result 2009-11-16 20:49:51 +0000
@@ -1175,4 +1175,74 @@ a
42
DROP TABLE t1;
SET @@sql_mode=@save_sql_mode;
+#
+# Bug#45567: Fast ALTER TABLE broken for enum and set
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a ENUM('a1','a2'));
+INSERT INTO t1 VALUES ('a1'),('a2');
+# No copy: No modification
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2');
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+# No copy: Add new enumeration to the end
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a3');
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+# Copy: Modify and add new to the end
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx','a5');
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+# Copy: Remove from the end
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx');
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+# Copy: Add new enumeration
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx');
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+# No copy: Add new enumerations to the end
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx','a5','a6');
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+DROP TABLE t1;
+CREATE TABLE t1 (a SET('a1','a2'));
+INSERT INTO t1 VALUES ('a1'),('a2');
+# No copy: No modification
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2');
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+# No copy: Add new to the end
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a3');
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+# Copy: Modify and add new to the end
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx','a5');
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+# Copy: Remove from the end
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx');
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+# Copy: Add new member
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx');
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+# No copy: Add new to the end
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6');
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+# Copy: Numerical incrase (pack lenght)
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9','a10');
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+DROP TABLE t1;
+CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL,
+f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2);
+this should affect no rows as there is no real change
+ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+DROP TABLE t1;
End of 5.1 tests
=== modified file 'mysql-test/r/analyse.result'
--- a/mysql-test/r/analyse.result 2009-08-27 10:59:25 +0000
+++ b/mysql-test/r/analyse.result 2009-10-30 09:56:32 +0000
@@ -19,81 +19,10 @@ test.t1.empty_string 0 0 4 0 0.0000 NU
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
create table t2 select * from t1 procedure analyse();
-select * from t2;
-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-test.t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
-test.t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
-test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
-test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
-test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
-drop table t1,t2;
+ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
+drop table t1;
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and subquery
-create table t1 (a int not null);
-create table t2 select * from t1 where 0=1 procedure analyse();
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `Field_name` varbinary(255) NOT NULL DEFAULT '',
- `Min_value` varbinary(255) DEFAULT NULL,
- `Max_value` varbinary(255) DEFAULT NULL,
- `Min_length` bigint(11) NOT NULL DEFAULT '0',
- `Max_length` bigint(11) NOT NULL DEFAULT '0',
- `Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
- `Nulls` bigint(11) NOT NULL DEFAULT '0',
- `Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
- `Std` varbinary(255) DEFAULT NULL,
- `Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-select * from t1 where 0=1 procedure analyse();
-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-insert into t1 values(1);
-drop table t2;
-create table t2 select * from t1 where 0=1 procedure analyse();
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `Field_name` varbinary(255) NOT NULL DEFAULT '',
- `Min_value` varbinary(255) DEFAULT NULL,
- `Max_value` varbinary(255) DEFAULT NULL,
- `Min_length` bigint(11) NOT NULL DEFAULT '0',
- `Max_length` bigint(11) NOT NULL DEFAULT '0',
- `Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
- `Nulls` bigint(11) NOT NULL DEFAULT '0',
- `Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
- `Std` varbinary(255) DEFAULT NULL,
- `Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-select * from t2;
-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-insert into t2 select * from t1 procedure analyse();
-select * from t2;
-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-test.t1.a 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
-insert into t1 values(2);
-drop table t2;
-create table t2 select * from t1 where 0=1 procedure analyse();
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `Field_name` varbinary(255) NOT NULL DEFAULT '',
- `Min_value` varbinary(255) DEFAULT NULL,
- `Max_value` varbinary(255) DEFAULT NULL,
- `Min_length` bigint(11) NOT NULL DEFAULT '0',
- `Max_length` bigint(11) NOT NULL DEFAULT '0',
- `Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
- `Nulls` bigint(11) NOT NULL DEFAULT '0',
- `Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
- `Std` varbinary(255) DEFAULT NULL,
- `Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-select * from t2;
-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-insert into t2 select * from t1 procedure analyse();
-select * from t2;
-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-test.t1.a 1 2 1 1 0 0 1.5000 0.5000 ENUM('1','2') NOT NULL
-drop table t1,t2;
create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse();
@@ -157,3 +86,40 @@ SELECT * FROM (SELECT * FROM t1) d PROCE
ERROR HY000: Incorrect usage of PROCEDURE and subquery
DROP TABLE t1;
End of 4.1 tests
+#
+# Bug #48293: crash with procedure analyse, view with > 10 columns,
+# having clause...
+#
+CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
+f INT, g INT, h INT, i INT, j INT,k INT);
+INSERT INTO t1 VALUES (),();
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+#should have a derived table
+EXPLAIN SELECT * FROM v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 2
+#should not crash
+SELECT * FROM v1 PROCEDURE analyse();
+ERROR HY000: Incorrect usage of PROCEDURE and view
+#should not crash
+SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
+ERROR HY000: Incorrect usage of PROCEDURE and view
+#should not crash
+SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
+ERROR HY000: Incorrect usage of PROCEDURE and subquery
+#should not crash
+SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
+ERROR HY000: Incorrect usage of PROCEDURE and subquery
+#should not crash
+SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
+ERROR HY000: Can't use ORDER clause with this procedure
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1),(2);
+# should not crash
+CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
+ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
+DROP TABLE t1;
+End of 5.0 tests
=== modified file 'mysql-test/r/archive.result'
--- a/mysql-test/r/archive.result 2009-03-26 14:27:34 +0000
+++ b/mysql-test/r/archive.result 2009-09-10 06:58:13 +0000
@@ -12695,3 +12695,25 @@ a b
1 NULL
2 NULL
DROP TABLE t1;
+CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
+SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
+INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+DATA_LENGTH AVG_ROW_LENGTH
+8666 15
+INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
+SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
+INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+DATA_LENGTH AVG_ROW_LENGTH
+8700 4350
+DROP TABLE t1;
+SET @save_join_buffer_size= @@join_buffer_size;
+SET @@join_buffer_size= 8228;
+CREATE TABLE t1(a CHAR(255)) ENGINE=archive;
+INSERT INTO t1 VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
+('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
+('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+SELECT COUNT(t1.a) FROM t1, t1 a, t1 b, t1 c, t1 d, t1 e;
+COUNT(t1.a)
+729
+DROP TABLE t1;
+SET @@join_buffer_size= @save_join_buffer_size;
=== modified file 'mysql-test/r/bug46080.result'
--- a/mysql-test/r/bug46080.result 2009-07-13 11:17:14 +0000
+++ b/mysql-test/r/bug46080.result 2009-09-03 06:38:06 +0000
@@ -2,6 +2,8 @@
# Bug #46080: group_concat(... order by) crashes server when
# sort_buffer_size cannot allocate
#
+call mtr.add_suppression("Out of memory at line .*, 'my_alloc.c'");
+call mtr.add_suppression("needed .* byte .*k., memory in use: .* bytes .*k");
CREATE TABLE t1(a CHAR(255));
INSERT INTO t1 VALUES ('a');
SET @@SESSION.sort_buffer_size=5*16*1000000;
=== added file 'mysql-test/r/bug46760.result'
--- a/mysql-test/r/bug46760.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug46760.result 2009-09-18 13:01:18 +0000
@@ -0,0 +1,43 @@
+#
+# Bug#46760: Fast ALTER TABLE no longer works for InnoDB
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+# By using --enable_info and verifying that number of affected
+# rows is 0 we check that this ALTER TABLE is really carried
+# out as "fast/online" operation, i.e. without full-blown data
+# copying.
+#
+# I.e. info for the below statement should normally look like:
+#
+# affected rows: 0
+# info: Records: 0 Duplicates: 0 Warnings: 0
+ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 10;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT '10'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# MySQL Bug#39200: optimize table does not recognize
+# ROW_FORMAT=COMPRESSED
+#
+CREATE TABLE t1 (a INT) ROW_FORMAT=compressed;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+DROP TABLE t1;
+End of 5.1 tests
=== added file 'mysql-test/r/case_insensitive_fs.require'
--- a/mysql-test/r/case_insensitive_fs.require 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/case_insensitive_fs.require 2009-10-27 08:09:19 +0000
@@ -0,0 +1,2 @@
+Variable_name Value
+lower_case_file_system ON
=== modified file 'mysql-test/r/create.result'
--- a/mysql-test/r/create.result 2009-09-23 11:03:47 +0000
+++ b/mysql-test/r/create.result 2009-11-16 20:49:51 +0000
@@ -1588,6 +1588,19 @@ CREATE TABLE IF NOT EXISTS t2 (a INTEGER
SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
DROP TABLE t1, t2;
+#
+# BUG#46384 - mysqld segfault when trying to create table with same
+# name as existing view
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (1),(2),(3);
+CREATE VIEW v1 AS SELECT t1.a FROM t1, t2;
+CREATE TABLE v1 AS SELECT * FROM t1;
+ERROR 42S01: Table 'v1' already exists
+DROP VIEW v1;
+DROP TABLE t1,t2;
End of 5.0 tests
CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2);
=== modified file 'mysql-test/r/ctype_ldml.result'
--- a/mysql-test/r/ctype_ldml.result 2009-06-04 09:35:29 +0000
+++ b/mysql-test/r/ctype_ldml.result 2009-10-19 13:23:53 +0000
@@ -41,6 +41,14 @@ efgh efgh
ijkl ijkl
DROP TABLE t1;
#
+# Bug#45645 Mysql server close all connection and restart using lower function
+#
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
+INSERT INTO t1 (a) VALUES ('hello!');
+SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
+a
+DROP TABLE t1;
+#
# Bug#43827 Server closes connections and restarts
#
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
@@ -321,3 +329,11 @@ Vv
Xx
YyÝýỲỳỴỵỶỷỸỹ
drop table t1;
+Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
+set names latin1;
+show collation like 'latin1_test';
+Collation Charset Id Default Compiled Sortlen
+latin1_test latin1 99 Yes 1
+select "foo" = "foo " collate latin1_test;
+"foo" = "foo " collate latin1_test
+1
=== added file 'mysql-test/r/debug_sync.result'
--- a/mysql-test/r/debug_sync.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/debug_sync.result 2009-09-29 15:38:40 +0000
@@ -0,0 +1,277 @@
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE IF EXISTS t1;
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: ''
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
+SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2';
+SET DEBUG_SYNC='p0 SIGNAL s1 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 WAIT_FOR s2';
+SET DEBUG_SYNC='p0 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 CLEAR';
+SET DEBUG_SYNC='p0 TEST';
+SET DEBUG_SYNC='RESET';
+set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2 hit_limit 3';
+set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2';
+set debug_sync='p0 signal s1 wait_for s2 timeout 6 hit_limit 3';
+set debug_sync='p0 signal s1 wait_for s2 timeout 6';
+set debug_sync='p0 signal s1 wait_for s2 execute 2 hit_limit 3';
+set debug_sync='p0 signal s1 wait_for s2 execute 2';
+set debug_sync='p0 signal s1 wait_for s2 hit_limit 3';
+set debug_sync='p0 signal s1 wait_for s2';
+set debug_sync='p0 signal s1 execute 2 hit_limit 3';
+set debug_sync='p0 signal s1 execute 2';
+set debug_sync='p0 signal s1 hit_limit 3';
+set debug_sync='p0 signal s1';
+set debug_sync='p0 wait_for s2 timeout 6 execute 2 hit_limit 3';
+set debug_sync='p0 wait_for s2 timeout 6 execute 2';
+set debug_sync='p0 wait_for s2 timeout 6 hit_limit 3';
+set debug_sync='p0 wait_for s2 timeout 6';
+set debug_sync='p0 wait_for s2 execute 2 hit_limit 3';
+set debug_sync='p0 wait_for s2 execute 2';
+set debug_sync='p0 wait_for s2 hit_limit 3';
+set debug_sync='p0 wait_for s2';
+set debug_sync='p0 hit_limit 3';
+set debug_sync='p0 clear';
+set debug_sync='p0 test';
+set debug_sync='reset';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6
+ EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 ';
+SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
+SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
+SET DEBUG_SYNC='';
+ERROR 42000: Missing synchronization point name
+SET DEBUG_SYNC=' ';
+ERROR 42000: Missing synchronization point name
+SET DEBUG_SYNC='p0';
+ERROR 42000: Missing action after synchronization point name 'p0'
+SET DEBUG_SYNC='p0 EXECUTE 2';
+ERROR 42000: Missing action before EXECUTE
+SET DEBUG_SYNC='p0 TIMEOUT 6 EXECUTE 2';
+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
+SET DEBUG_SYNC='p0 TIMEOUT 6';
+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1';
+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 EXECUTE 2';
+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6';
+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1 EXECUTE 2';
+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1';
+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
+SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2 EXECUTE 2';
+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
+SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2';
+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
+SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
+SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6';
+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
+SET DEBUG_SYNC='p0 EXECUTE 2 SIGNAL s1 TIMEOUT 6';
+ERROR 42000: Missing action before EXECUTE
+SET DEBUG_SYNC='p0 TIMEOUT 6 SIGNAL s1';
+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
+SET DEBUG_SYNC='p0 EXECUTE 2 TIMEOUT 6 SIGNAL s1';
+ERROR 42000: Missing action before EXECUTE
+SET DEBUG_SYNC='p0 CLEAR HIT_LIMIT 3';
+ERROR 42000: Nothing must follow action CLEAR
+SET DEBUG_SYNC='CLEAR';
+ERROR 42000: Missing action after synchronization point name 'CLEAR'
+SET DEBUG_SYNC='p0 CLEAR p0';
+ERROR 42000: Nothing must follow action CLEAR
+SET DEBUG_SYNC='TEST';
+ERROR 42000: Missing action after synchronization point name 'TEST'
+SET DEBUG_SYNC='p0 TEST p0';
+ERROR 42000: Nothing must follow action TEST
+SET DEBUG_SYNC='p0 RESET';
+ERROR 42000: Illegal or out of order stuff: 'RESET'
+SET DEBUG_SYNC='RESET p0';
+ERROR 42000: Illegal or out of order stuff: 'p0'
+SET DEBUG_SYNC='p0 RESET p0';
+ERROR 42000: Illegal or out of order stuff: 'RESET'
+SET DEBUG_SYNC='p0 SIGNAL ';
+ERROR 42000: Missing signal name after action SIGNAL
+SET DEBUG_SYNC='p0 WAIT_FOR ';
+ERROR 42000: Missing signal name after action WAIT_FOR
+SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE ';
+ERROR 42000: Missing valid number after EXECUTE
+SET DEBUG_SYNCx='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+ERROR HY000: Unknown system variable 'DEBUG_SYNCx'
+SET DEBUG_SYNC='p0 SIGNAx s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+ERROR 42000: Illegal or out of order stuff: 'SIGNAx'
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOx s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+ERROR 42000: Illegal or out of order stuff: 'WAIT_FOx'
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUx 0 EXECUTE 2 HIT_LIMIT 3';
+ERROR 42000: Illegal or out of order stuff: 'TIMEOUx'
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTx 2 HIT_LIMIT 3';
+ERROR 42000: Illegal or out of order stuff: 'EXECUTx'
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIx 3';
+ERROR 42000: Illegal or out of order stuff: 'HIT_LIMIx'
+SET DEBUG_SYNC='p0 CLEARx';
+ERROR 42000: Illegal or out of order stuff: 'CLEARx'
+SET DEBUG_SYNC='p0 TESTx';
+ERROR 42000: Illegal or out of order stuff: 'TESTx'
+SET DEBUG_SYNC='RESETx';
+ERROR 42000: Missing action after synchronization point name 'RESETx'
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 0x6 EXECUTE 2 HIT_LIMIT 3';
+ERROR 42000: Missing valid number after TIMEOUT
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 0x2 HIT_LIMIT 3';
+ERROR 42000: Missing valid number after EXECUTE
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 7 EXECUTE 2 HIT_LIMIT 0x3';
+ERROR 42000: Missing valid number after HIT_LIMIT
+SET DEBUG_SYNC= 7;
+ERROR 42000: Incorrect argument type to variable 'debug_sync'
+SET GLOBAL DEBUG_SYNC= 'p0 CLEAR';
+ERROR HY000: Variable 'debug_sync' is a SESSION variable and can't be used with SET GLOBAL
+SET @myvar= 'now SIGNAL from_myvar';
+SET DEBUG_SYNC= @myvar;
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 'from_myvar'
+SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24);
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 'from_function'
+SET DEBUG_SYNC= 'now SIGNAL something';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 'something'
+SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
+Warnings:
+Warning #### debug sync point wait timed out
+SET DEBUG_SYNC= 'now SIGNAL nothing';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 'nothing'
+SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
+SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 'nothing'
+SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0';
+SET DEBUG_SYNC= 'now HIT_LIMIT 1';
+ERROR HY000: debug sync point hit limit reached
+SET DEBUG_SYNC= 'RESET';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: ''
+SET DEBUG_SYNC= 'p1abcd SIGNAL s1 EXECUTE 2';
+SET DEBUG_SYNC= 'p2abc SIGNAL s2 EXECUTE 2';
+SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2';
+SET DEBUG_SYNC= 'p4a SIGNAL s4 EXECUTE 2';
+SET DEBUG_SYNC= 'p5abcde SIGNAL s5 EXECUTE 2';
+SET DEBUG_SYNC= 'p6ab SIGNAL s6 EXECUTE 2';
+SET DEBUG_SYNC= 'p7 SIGNAL s7 EXECUTE 2';
+SET DEBUG_SYNC= 'p8abcdef SIGNAL s8 EXECUTE 2';
+SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2';
+SET DEBUG_SYNC= 'p4a TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 's4'
+SET DEBUG_SYNC= 'p1abcd TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 's1'
+SET DEBUG_SYNC= 'p7 TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 's7'
+SET DEBUG_SYNC= 'p9abcdef TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 's9'
+SET DEBUG_SYNC= 'p3abcdef TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 's3'
+SET DEBUG_SYNC= 'p1abcd CLEAR';
+SET DEBUG_SYNC= 'p2abc CLEAR';
+SET DEBUG_SYNC= 'p5abcde CLEAR';
+SET DEBUG_SYNC= 'p6ab CLEAR';
+SET DEBUG_SYNC= 'p8abcdef CLEAR';
+SET DEBUG_SYNC= 'p9abcdef CLEAR';
+SET DEBUG_SYNC= 'p3abcdef CLEAR';
+SET DEBUG_SYNC= 'p4a CLEAR';
+SET DEBUG_SYNC= 'p7 CLEAR';
+SET DEBUG_SYNC= 'p1abcd TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 's3'
+SET DEBUG_SYNC= 'p7 TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 's3'
+SET DEBUG_SYNC= 'p9abcdef TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: 's3'
+SET DEBUG_SYNC= 'RESET';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signal: ''
+CREATE USER mysqltest_1@localhost;
+GRANT SUPER ON *.* TO mysqltest_1@localhost;
+connection con1, mysqltest_1
+SET DEBUG_SYNC= 'RESET';
+connection default
+DROP USER mysqltest_1@localhost;
+CREATE USER mysqltest_2@localhost;
+GRANT ALL ON *.* TO mysqltest_2@localhost;
+REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
+connection con1, mysqltest_2
+SET DEBUG_SYNC= 'RESET';
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+connection default
+DROP USER mysqltest_2@localhost;
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT);
+connection con1
+SET DEBUG_SYNC= 'before_lock_tables_takes_lock
+ SIGNAL opened WAIT_FOR flushed';
+INSERT INTO t1 VALUES(1);
+connection default
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
+FLUSH TABLE t1;
+connection con1
+connection default
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT);
+LOCK TABLE t1 WRITE;
+connection con1
+SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
+INSERT INTO t1 VALUES (1);
+connection default
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+UNLOCK TABLES;
+connection con1
+retrieve INSERT result.
+connection default
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
=== modified file 'mysql-test/r/delete.result'
--- a/mysql-test/r/delete.result 2007-12-07 14:15:58 +0000
+++ b/mysql-test/r/delete.result 2009-09-28 10:48:52 +0000
@@ -279,3 +279,48 @@ ERROR 42000: Incorrect number of argumen
DROP TABLE t1;
DROP FUNCTION f1;
End of 5.0 tests
+#
+# Bug#46958: Assertion in Diagnostics_area::set_ok_status, trigger,
+# merge table
+#
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+CREATE TABLE t3 ( a INT );
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+INSERT INTO t3 VALUES (1), (2);
+CREATE TRIGGER tr1 BEFORE DELETE ON t2
+FOR EACH ROW INSERT INTO no_such_table VALUES (1);
+DELETE t1, t2, t3 FROM t1, t2, t3;
+ERROR 42S02: Table 'test.no_such_table' doesn't exist
+SELECT * FROM t1;
+a
+SELECT * FROM t2;
+a
+1
+2
+SELECT * FROM t3;
+a
+1
+2
+DROP TABLE t1, t2, t3;
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+CREATE TABLE t3 ( a INT );
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+INSERT INTO t3 VALUES (1), (2);
+CREATE TRIGGER tr1 AFTER DELETE ON t2
+FOR EACH ROW INSERT INTO no_such_table VALUES (1);
+DELETE t1, t2, t3 FROM t1, t2, t3;
+ERROR 42S02: Table 'test.no_such_table' doesn't exist
+SELECT * FROM t1;
+a
+SELECT * FROM t2;
+a
+2
+SELECT * FROM t3;
+a
+1
+2
+DROP TABLE t1, t2, t3;
=== modified file 'mysql-test/r/distinct.result'
--- a/mysql-test/r/distinct.result 2009-05-10 16:20:35 +0000
+++ b/mysql-test/r/distinct.result 2009-09-05 20:42:17 +0000
@@ -763,4 +763,34 @@ a b d c
1 2 0 2
1 2 0 3
DROP TABLE t1;
+#
+# Bug #46159: simple query that never returns
+#
+SET @old_max_heap_table_size = @@max_heap_table_size;
+SET @@max_heap_table_size = 16384;
+SET @old_sort_buffer_size = @@sort_buffer_size;
+SET @@sort_buffer_size = 32804;
+CREATE TABLE t1(c1 int, c2 VARCHAR(20));
+INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4');
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4;
+c1 c2 COUNT(*)
+1 1 2
+2 2 1
+3 1 2
+4 4 1
+SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1;
+c2
+1
+5
+DROP TABLE t1;
+SET @@sort_buffer_size = @old_sort_buffer_size;
+SET @@max_heap_table_size = @old_max_heap_table_size;
End of 5.1 tests
=== modified file 'mysql-test/r/explain.result'
--- a/mysql-test/r/explain.result 2009-06-11 16:21:32 +0000
+++ b/mysql-test/r/explain.result 2009-10-29 23:01:54 +0000
@@ -159,6 +159,14 @@ CREATE TABLE t1 (a INT PRIMARY KEY);
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
ERROR 42000: Key 'a' doesn't exist in table 't1'
DROP TABLE t1;
+CREATE TABLE t1(a LONGTEXT);
+INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
+INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
+EXPLAIN SELECT DISTINCT 1 FROM t1,
+(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
+WHERE t1.a = d1.a;
+ERROR 42S22: Unknown column 'd1.a' in 'where clause'
+DROP TABLE t1;
#
# Bug#37870: Usage of uninitialized value caused failed assertion.
#
@@ -186,4 +194,20 @@ dt
2001-01-01 01:01:01
2001-01-01 01:01:01
drop tables t1, t2;
+#
+# Bug#48295:
+# explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
+#
+CREATE TABLE t1 (f1 INT);
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+EXPLAIN EXTENDED SELECT 1 FROM t1
+WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
+ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
+SHOW WARNINGS;
+Level Code Message
+Error 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
+Note 1003 select 1 AS `1` from `test`.`t1` where <not>(<exists>(...))
+SET SESSION sql_mode=@old_sql_mode;
+DROP TABLE t1;
End of 5.1 tests.
=== modified file 'mysql-test/r/func_group.result'
--- a/mysql-test/r/func_group.result 2009-04-01 11:10:03 +0000
+++ b/mysql-test/r/func_group.result 2009-10-14 08:46:50 +0000
@@ -1477,3 +1477,47 @@ COUNT(*)
SET SQL_MODE=default;
DROP TABLE t1;
End of 5.0 tests
+#
+# BUG#47280 - strange results from count(*) with order by multiple
+# columns without where/group
+#
+#
+# Initialize test
+#
+CREATE TABLE t1 (
+pk INT NOT NULL,
+i INT,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1,11),(2,12),(3,13);
+#
+# Start test
+# All the following queries shall return 1 record
+#
+
+# Masking all correct values {11...13} for column i in this result.
+SELECT MAX(pk) as max, i
+FROM t1
+ORDER BY max;
+max i
+3 #
+
+EXPLAIN
+SELECT MAX(pk) as max, i
+FROM t1
+ORDER BY max;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary
+
+# Only 11 is correct for collumn i in this result
+SELECT MAX(pk) as max, i
+FROM t1
+WHERE pk<2
+ORDER BY max;
+max i
+1 11
+#
+# Cleanup
+#
+DROP TABLE t1;
+End of 5.1 tests
=== modified file 'mysql-test/r/func_in.result'
--- a/mysql-test/r/func_in.result 2009-05-25 08:00:40 +0000
+++ b/mysql-test/r/func_in.result 2009-10-05 05:27:36 +0000
@@ -608,4 +608,146 @@ SELECT SUM( DISTINCT e ) FROM t1 GROUP B
((AVG( 1 ), 1 + c, 1 + d), (AVG( 1 ), 2 + c, 2 + d));
SUM( DISTINCT e )
DROP TABLE t1;
+#
+# Bug #44139: Table scan when NULL appears in IN clause
+#
+CREATE TABLE t1 (
+c_int INT NOT NULL,
+c_decimal DECIMAL(5,2) NOT NULL,
+c_float FLOAT(5, 2) NOT NULL,
+c_bit BIT(10) NOT NULL,
+c_date DATE NOT NULL,
+c_datetime DATETIME NOT NULL,
+c_timestamp TIMESTAMP NOT NULL,
+c_time TIME NOT NULL,
+c_year YEAR NOT NULL,
+c_char CHAR(10) NOT NULL,
+INDEX(c_int), INDEX(c_decimal), INDEX(c_float), INDEX(c_bit), INDEX(c_date),
+INDEX(c_datetime), INDEX(c_timestamp), INDEX(c_time), INDEX(c_year),
+INDEX(c_char));
+INSERT INTO t1 (c_int) VALUES (1), (2), (3), (4), (5);
+INSERT INTO t1 (c_int) SELECT 0 FROM t1;
+INSERT INTO t1 (c_int) SELECT 0 FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, 1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, NULL, 2, NULL, 3, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, 1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_float IN (1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_float c_float 4 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, 1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_float c_float 4 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, 1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_date
+IN ('2009-09-01', '2009-09-02', '2009-09-03');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_date c_date 3 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_date
+IN (NULL, '2009-09-01', '2009-09-02', '2009-09-03');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_date c_date 3 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_datetime
+IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_datetime
+IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_timestamp
+IN ('2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_timestamp
+IN (NULL, '2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_year IN (1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_year c_year 1 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, 1, 2, 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_year c_year 1 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_char IN ('1', '2', '3');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_char c_char 10 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, '1', '2', '3');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c_char c_char 10 NULL 3 Using where
+EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+DROP TABLE t1;
+#
End of 5.1 tests
=== modified file 'mysql-test/r/func_str.result'
--- a/mysql-test/r/func_str.result 2009-05-13 18:39:35 +0000
+++ b/mysql-test/r/func_str.result 2009-09-10 10:30:03 +0000
@@ -2534,6 +2534,15 @@ SELECT LOAD_FILE(a) FROM t1;
LOAD_FILE(a)
NULL
DROP TABLE t1;
+CREATE TABLE t1 (f2 VARCHAR(20));
+CREATE TABLE t2 (f2 VARCHAR(20));
+INSERT INTO t1 VALUES ('MIN'),('MAX');
+INSERT INTO t2 VALUES ('LOAD');
+SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1;
+concat_name
+LOAD_MIN
+LOAD_MAX
+DROP TABLE t1, t2;
End of 5.0 tests
drop table if exists t1;
create table t1(f1 tinyint default null)engine=myisam;
=== modified file 'mysql-test/r/gis-rtree.result'
--- a/mysql-test/r/gis-rtree.result 2009-10-28 07:52:34 +0000
+++ b/mysql-test/r/gis-rtree.result 2009-11-16 20:49:51 +0000
@@ -1037,4 +1037,43 @@ MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRIN
COUNT(*)
2
DROP TABLE t1;
+#
+# Bug #48258: Assertion failed when using a spatial index
+#
+CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
+INSERT INTO t1 VALUES
+(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
+(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
+EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
+SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+1
+1
+1
+EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
+SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+1
+EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
+SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+1
+1
+1
+EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
+SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+1
+EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
+SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+1
+1
+1
+DROP TABLE t1;
End of 5.0 tests.
=== modified file 'mysql-test/r/gis.result'
--- a/mysql-test/r/gis.result 2009-07-10 23:12:13 +0000
+++ b/mysql-test/r/gis.result 2009-10-24 06:57:31 +0000
@@ -972,6 +972,18 @@ select min(`col002`) from t1 union selec
min(`col002`)
NULL
drop table t1;
+#
+# Bug #47780: crash when comparing GIS items from subquery
+#
+CREATE TABLE t1(a INT, b MULTIPOLYGON);
+INSERT INTO t1 VALUES
+(0,
+GEOMFROMTEXT(
+'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
+# must not crash
+SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
+1
+DROP TABLE t1;
End of 5.0 tests
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
=== modified file 'mysql-test/r/grant.result'
--- a/mysql-test/r/grant.result 2009-06-15 15:53:45 +0000
+++ b/mysql-test/r/grant.result 2009-10-27 10:09:36 +0000
@@ -1007,8 +1007,8 @@ DROP TABLE mysqltest1.t2;
SHOW GRANTS;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
-GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
RENAME TABLE t1 TO t2;
RENAME TABLE t2 TO t1;
ALTER TABLE t1 RENAME TO t2;
@@ -1018,8 +1018,8 @@ REVOKE DROP, INSERT ON mysqltest1.t2 FRO
SHOW GRANTS;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
-GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
+GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
RENAME TABLE t1 TO t2;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
ALTER TABLE t1 RENAME TO t2;
=== modified file 'mysql-test/r/grant3.result'
--- a/mysql-test/r/grant3.result 2008-02-13 15:34:12 +0000
+++ b/mysql-test/r/grant3.result 2009-10-20 06:17:57 +0000
@@ -154,4 +154,42 @@ SELECT * FROM mysqltest_1.t1;
a
DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1;
+#
+# Bug#41597 - After rename of user, there are additional grants
+# when grants are reapplied.
+#
+CREATE DATABASE temp;
+CREATE TABLE temp.t1(a INT, b VARCHAR(10));
+INSERT INTO temp.t1 VALUES(1, 'name1');
+INSERT INTO temp.t1 VALUES(2, 'name2');
+INSERT INTO temp.t1 VALUES(3, 'name3');
+CREATE USER 'user1'@'%';
+RENAME USER 'user1'@'%' TO 'user2'@'%';
+# Show privileges after rename and BEFORE grant
+SHOW GRANTS FOR 'user2'@'%';
+Grants for user2@%
+GRANT USAGE ON *.* TO 'user2'@'%'
+GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
+# Show privileges after rename and grant
+SHOW GRANTS FOR 'user2'@'%';
+Grants for user2@%
+GRANT USAGE ON *.* TO 'user2'@'%'
+GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
+# Connect as the renamed user
+SHOW GRANTS;
+Grants for user2@%
+GRANT USAGE ON *.* TO 'user2'@'%'
+GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
+SELECT a FROM temp.t1;
+a
+1
+2
+3
+# Check for additional privileges by accessing a
+# non privileged column. We shouldn't be able to
+# access this column.
+SELECT b FROM temp.t1;
+ERROR 42000: SELECT command denied to user 'user2'@'localhost' for column 'b' in table 't1'
+DROP USER 'user2'@'%';
+DROP DATABASE temp;
End of 5.0 tests
=== added file 'mysql-test/r/grant_lowercase_fs.result'
--- a/mysql-test/r/grant_lowercase_fs.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/grant_lowercase_fs.result 2009-10-27 08:09:19 +0000
@@ -0,0 +1,16 @@
+create database db1;
+GRANT CREATE ON db1.* to user_1@localhost;
+GRANT SELECT ON db1.* to USER_1@localhost;
+CREATE TABLE t1(f1 int);
+SELECT * FROM t1;
+ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
+SELECT * FROM t1;
+f1
+CREATE TABLE t2(f1 int);
+ERROR 42000: CREATE command denied to user 'USER_1'@'localhost' for table 't2'
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
+DROP USER user_1@localhost;
+DROP USER USER_1@localhost;
+DROP DATABASE db1;
+use test;
=== modified file 'mysql-test/r/group_min_max.result'
--- a/mysql-test/r/group_min_max.result 2009-08-30 07:03:37 +0000
+++ b/mysql-test/r/group_min_max.result 2009-10-09 09:30:40 +0000
@@ -876,10 +876,10 @@ id select_type table type possible_keys
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
@@ -924,7 +924,7 @@ id select_type table type possible_keys
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
+1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
=== added file 'mysql-test/r/have_debug_sync.require'
--- a/mysql-test/r/have_debug_sync.require 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/have_debug_sync.require 2009-09-29 15:38:40 +0000
@@ -0,0 +1,2 @@
+debug_sync
+1
=== modified file 'mysql-test/r/information_schema_db.result'
--- a/mysql-test/r/information_schema_db.result 2009-09-07 20:50:10 +0000
+++ b/mysql-test/r/information_schema_db.result 2009-11-16 20:49:51 +0000
@@ -108,7 +108,7 @@ show create view testdb_1.v7;
View Create View character_set_client collation_connection
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
show fields from testdb_1.v7;
Field Type Null Key Default Extra
f1 char(4) YES NULL
@@ -138,7 +138,7 @@ show create view testdb_1.v7;
View Create View character_set_client collation_connection
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
revoke insert(f1) on v3 from testdb_2@localhost;
revoke show view on v5 from testdb_2@localhost;
use testdb_1;
@@ -156,7 +156,8 @@ ERROR 42000: SELECT command denied to us
show create view testdb_1.v7;
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
show create view v4;
-ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `v3`.`f1` AS `f1`,`v3`.`f2` AS `f2` from `testdb_1`.`v3` latin1 latin1_swedish_ci
show fields from v4;
Field Type Null Key Default Extra
f1 char(4) YES NULL
=== modified file 'mysql-test/r/innodb-autoinc.result'
--- a/mysql-test/r/innodb-autoinc.result 2009-06-09 15:08:46 +0000
+++ b/mysql-test/r/innodb-autoinc.result 2009-11-16 20:49:51 +0000
@@ -197,7 +197,7 @@ c1 c2
5 9
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
@@ -230,7 +230,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -269,7 +269,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -282,7 +282,7 @@ SELECT * FROM t1;
c1
-1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
@@ -315,7 +315,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -330,7 +330,7 @@ SELECT * FROM t1;
c1
1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
@@ -370,7 +370,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -385,7 +385,7 @@ SELECT * FROM t1;
c1
1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
@@ -419,7 +419,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -434,7 +434,7 @@ c1
1
9223372036854775794
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 2
auto_increment_offset 10
@@ -452,7 +452,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -467,7 +467,7 @@ c1
1
18446744073709551603
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 2
auto_increment_offset 10
@@ -485,7 +485,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -500,7 +500,7 @@ c1
1
18446744073709551603
SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 5
auto_increment_offset 7
@@ -514,7 +514,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -533,7 +533,7 @@ c1
-9223372036854775806
1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 3
auto_increment_offset 3
@@ -550,7 +550,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -568,7 +568,7 @@ SET @@SESSION.AUTO_INCREMENT_INCREMENT=1
Warnings:
Warning 1292 Truncated incorrect auto_increment_increment value: '1152921504606846976'
Warning 1292 Truncated incorrect auto_increment_offset value: '1152921504606846976'
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 65535
auto_increment_offset 65535
@@ -581,7 +581,7 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
@@ -867,3 +867,262 @@ INSERT INTO t2 SELECT NULL FROM t1;
Got one of the listed errors
DROP TABLE t1;
DROP TABLE t2;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (null);
+INSERT INTO t1 VALUES (null);
+ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
+SELECT * FROM t1;
+d1
+1
+3
+SELECT * FROM t1;
+d1
+1
+3
+INSERT INTO t1 VALUES(null);
+Got one of the listed errors
+ALTER TABLE t1 AUTO_INCREMENT = 3;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `d1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`d1`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+d1
+1
+3
+4
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyint(4) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-127 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-127, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32767, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` smallint(6) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-32767 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-32757, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-8388607 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-2147483647 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-9223372036854775807 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
+CREATE INDEX i1 on T1(c2);
+SHOW CREATE TABLE T1;
+Table Create Table
+T1 CREATE TABLE `T1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ `c2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `i1` (`c2`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
+INSERT INTO T1 (c2) values (0);
+SELECT * FROM T1;
+c1 c2
+10 0
+DROP TABLE T1;
=== added file 'mysql-test/r/innodb_bug44369.result'
--- a/mysql-test/r/innodb_bug44369.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb_bug44369.result 2009-11-02 14:59:44 +0000
@@ -0,0 +1,14 @@
+create table bug44369 (DB_ROW_ID int) engine=innodb;
+ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
+create table bug44369 (db_row_id int) engine=innodb;
+ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
+show warnings;
+Level Code Message
+Warning 1005 Error creating table 'test/bug44369' with column name 'db_row_id'. 'db_row_id' is a reserved name. Please try to re-create the table with a different column name.
+Error 1005 Can't create table 'test.bug44369' (errno: -1)
+create table bug44369 (db_TRX_Id int) engine=innodb;
+ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
+show warnings;
+Level Code Message
+Warning 1005 Error creating table 'test/bug44369' with column name 'db_TRX_Id'. 'db_TRX_Id' is a reserved name. Please try to re-create the table with a different column name.
+Error 1005 Can't create table 'test.bug44369' (errno: -1)
=== added file 'mysql-test/r/innodb_bug46000.result'
--- a/mysql-test/r/innodb_bug46000.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb_bug46000.result 2009-11-16 20:49:51 +0000
@@ -0,0 +1,18 @@
+create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
+ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
+create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
+ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
+show warnings;
+Level Code Message
+Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
+Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
+Error 1005 Can't create table 'test.bug46000' (errno: -1)
+create table bug46000(id int) engine=innodb;
+create index GEN_CLUST_INDEX on bug46000(id);
+ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
+show warnings;
+Level Code Message
+Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
+Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
+create index idx on bug46000(id);
+drop table bug46000;
=== added file 'mysql-test/r/innodb_bug47777.result'
--- a/mysql-test/r/innodb_bug47777.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb_bug47777.result 2009-11-02 14:41:40 +0000
@@ -0,0 +1,13 @@
+create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
+insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+count(*)
+1
+update bug47777 set c2=GeomFromText('POINT(1 1)');
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+count(*)
+0
+select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
+count(*)
+1
+drop table bug47777;
=== renamed file 'mysql-test/r/bug40113.result' => 'mysql-test/r/innodb_lock_wait_timeout_1.result'
--- a/mysql-test/r/bug40113.result 2009-07-13 15:11:16 +0000
+++ b/mysql-test/r/innodb_lock_wait_timeout_1.result 2009-11-03 17:45:52 +0000
@@ -26,4 +26,332 @@ SELECT * FROM t1;
a b
1070109 99
DROP TABLE t2, t1;
-End of 5.0 tests
+# End of 5.0 tests
+#
+# Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
+# FOR UPDATE
+#
+drop table if exists t1;
+create table t1 (a int primary key auto_increment,
+b int, index(b)) engine=innodb;
+insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+set autocommit=0;
+begin;
+select * from t1 where b=5 for update;
+a b
+5 5
+insert ignore into t1 (b) select a as b from t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Cleanup
+#
+commit;
+set autocommit=default;
+drop table t1;
+#
+# Bug#41756 Strange error messages about locks from InnoDB
+#
+drop table if exists t1;
+# In the default transaction isolation mode, and/or with
+# innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row()
+# in InnoDB does nothing.
+# Thus in order to reproduce the condition that led to the
+# warning, one needs to relax isolation by either
+# setting a weaker tx_isolation value, or by turning on
+# the unsafe replication switch.
+# For testing purposes, choose to tweak the isolation level,
+# since it's settable at runtime, unlike
+# innodb_locks_unsafe_for_binlog, which is
+# only a command-line switch.
+#
+set @@session.tx_isolation="read-committed";
+# Prepare data. We need a table with a unique index,
+# for join_read_key to be used. The other column
+# allows to control what passes WHERE clause filter.
+create table t1 (a int primary key, b int) engine=innodb;
+# Let's make sure t1 has sufficient amount of rows
+# to exclude JT_ALL access method when reading it,
+# i.e. make sure that JT_EQ_REF(a) is always preferred.
+insert into t1 values (1,1), (2,null), (3,1), (4,1),
+(5,1), (6,1), (7,1), (8,1), (9,1), (10,1),
+(11,1), (12,1), (13,1), (14,1), (15,1),
+(16,1), (17,1), (18,1), (19,1), (20,1);
+#
+# Demonstrate that for the SELECT statement
+# used later in the test JT_EQ_REF access method is used.
+#
+explain
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+select 2 as a, 2 as b) as t2 for update;
+id 1
+select_type PRIMARY
+table <derived2>
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows 2
+Extra
+id 1
+select_type PRIMARY
+table t1
+type eq_ref
+possible_keys PRIMARY
+key PRIMARY
+key_len 4
+ref t2.a
+rows 1
+Extra Using where
+id 2
+select_type DERIVED
+table NULL
+type NULL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra No tables used
+id 3
+select_type UNION
+table NULL
+type NULL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra No tables used
+id NULL
+select_type UNION RESULT
+table <union2,3>
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra
+#
+# Demonstrate that the reported SELECT statement
+# no longer produces warnings.
+#
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+select 2 as a, 2 as b) as t2 for update;
+1
+commit;
+#
+# Demonstrate that due to lack of inter-sweep "reset" function,
+# we keep some non-matching records locked, even though we know
+# we could unlock them.
+# To do that, show that if there is only one distinct value
+# for a in t2 (a=2), we will keep record (2,null) in t1 locked.
+# But if we add another value for "a" to t2, say 6,
+# join_read_key cache will be pruned at least once,
+# and thus record (2, null) in t1 will get unlocked.
+#
+begin;
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+select 2 as a, 2 as b) as t2 for update;
+1
+#
+# Switching to connection con1
+# We should be able to delete all records from t1 except (2, null),
+# since they were not locked.
+begin;
+# Delete in series of 3 records so that full scan
+# is not used and we're not blocked on record (2,null)
+delete from t1 where a in (1,3,4);
+delete from t1 where a in (5,6,7);
+delete from t1 where a in (8,9,10);
+delete from t1 where a in (11,12,13);
+delete from t1 where a in (14,15,16);
+delete from t1 where a in (17,18);
+delete from t1 where a in (19,20);
+#
+# Record (2, null) is locked. This is actually unnecessary,
+# because the previous select returned no rows.
+# Just demonstrate the effect.
+#
+delete from t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+#
+# Switching to connection default
+#
+# Show that the original contents of t1 is intact:
+select * from t1;
+a b
+1 1
+2 NULL
+3 1
+4 1
+5 1
+6 1
+7 1
+8 1
+9 1
+10 1
+11 1
+12 1
+13 1
+14 1
+15 1
+16 1
+17 1
+18 1
+19 1
+20 1
+commit;
+#
+# Have a one more record in t2 to show that
+# if join_read_key cache is purned, the current
+# row under the cursor is unlocked (provided, this row didn't
+# match the partial WHERE clause, of course).
+# Sic: the result of this test dependent on the order of retrieval
+# of records --echo # from the derived table, if !
+# We use DELETE to disable the JOIN CACHE. This DELETE modifies no
+# records. It also should leave no InnoDB row locks.
+#
+begin;
+delete t1.* from t1 natural join (select 2 as a, 2 as b union all
+select 0 as a, 0 as b) as t2;
+# Demonstrate that nothing was deleted form t1
+select * from t1;
+a b
+1 1
+2 NULL
+3 1
+4 1
+5 1
+6 1
+7 1
+8 1
+9 1
+10 1
+11 1
+12 1
+13 1
+14 1
+15 1
+16 1
+17 1
+18 1
+19 1
+20 1
+#
+# Switching to connection con1
+begin;
+# Since there is another distinct record in the derived table
+# the previous matching record in t1 -- (2,null) -- was unlocked.
+delete from t1;
+# We will need the contents of the table again.
+rollback;
+select * from t1;
+a b
+1 1
+2 NULL
+3 1
+4 1
+5 1
+6 1
+7 1
+8 1
+9 1
+10 1
+11 1
+12 1
+13 1
+14 1
+15 1
+16 1
+17 1
+18 1
+19 1
+20 1
+commit;
+#
+# Switching to connection default
+rollback;
+begin;
+#
+# Before this patch, we could wrongly unlock a record
+# that was cached and later used in a join. Demonstrate that
+# this is no longer the case.
+# Sic: this test is also order-dependent (i.e. the
+# the bug would show up only if the first record in the union
+# is retreived and processed first.
+#
+# Verify that JT_EQ_REF is used.
+explain
+select 1 from t1 natural join (select 3 as a, 2 as b union all
+select 3 as a, 1 as b) as t2 for update;
+id 1
+select_type PRIMARY
+table <derived2>
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows 2
+Extra
+id 1
+select_type PRIMARY
+table t1
+type eq_ref
+possible_keys PRIMARY
+key PRIMARY
+key_len 4
+ref t2.a
+rows 1
+Extra Using where
+id 2
+select_type DERIVED
+table NULL
+type NULL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra No tables used
+id 3
+select_type UNION
+table NULL
+type NULL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra No tables used
+id NULL
+select_type UNION RESULT
+table <union2,3>
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra
+# Lock the record.
+select 1 from t1 natural join (select 3 as a, 2 as b union all
+select 3 as a, 1 as b) as t2 for update;
+1
+1
+# Switching to connection con1
+#
+# We should not be able to delete record (3,1) from t1,
+# (previously it was possible).
+#
+delete from t1 where a=3;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Switching to connection default
+commit;
+set @@session.tx_isolation=default;
+drop table t1;
+#
+# End of 5.1 tests
+#
=== modified file 'mysql-test/r/innodb_mysql.result'
--- a/mysql-test/r/innodb_mysql.result 2009-09-15 06:08:54 +0000
+++ b/mysql-test/r/innodb_mysql.result 2009-11-16 20:49:51 +0000
@@ -385,9 +385,10 @@ name dept
rs5 cs10
rs5 cs9
DELETE FROM t1;
+# Masking (#) number in "rows" column of the following EXPLAIN output, as it may vary (bug#47746).
EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range name name 44 NULL 2 Using where; Using index for group-by
+1 SIMPLE t1 range name name 44 NULL # Using where; Using index for group-by
SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
name dept
DROP TABLE t1;
@@ -2208,4 +2209,46 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRI
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where
DROP TABLE t1;
+#
+# Bug #47963: Wrong results when index is used
+#
+CREATE TABLE t1(
+a VARCHAR(5) NOT NULL,
+b VARCHAR(5) NOT NULL,
+c DATETIME NOT NULL,
+KEY (c)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00');
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
+a b c
+EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+DROP TABLE t1;
End of 5.1 tests
=== modified file 'mysql-test/r/insert_select.result'
--- a/mysql-test/r/insert_select.result 2009-09-07 20:50:10 +0000
+++ b/mysql-test/r/insert_select.result 2009-11-16 20:49:51 +0000
@@ -833,3 +833,17 @@ Table Op Msg_type Msg_text
test.t2 check status OK
drop table t1,t2;
End of 5.0 tests
+##################################################################
+#
+# Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
+#
+CREATE TABLE t1(a INT);
+SET max_heap_table_size = 16384;
+SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
+SET GLOBAL myisam_data_pointer_size = 2;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+call mtr.add_suppression("mysqld: The table '.*#sql.*' is full");
+INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
+SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
+DROP TABLE t1;
+End of 5.1 tests
=== modified file 'mysql-test/r/join.result'
--- a/mysql-test/r/join.result 2008-10-06 12:37:52 +0000
+++ b/mysql-test/r/join.result 2009-10-30 08:03:18 +0000
@@ -1063,4 +1063,68 @@ a b c d
127 NULL 127 NULL
128 NULL 128 NULL
DROP TABLE IF EXISTS t1,t2;
+#
+# Bug #42116: Mysql crash on specific query
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+CREATE TABLE t3 (a INT, INDEX (a));
+CREATE TABLE t4 (a INT);
+CREATE TABLE t5 (a INT);
+CREATE TABLE t6 (a INT);
+INSERT INTO t1 VALUES (1), (1), (1);
+INSERT INTO t2 VALUES
+(2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
+INSERT INTO t3 VALUES
+(3), (3), (3), (3), (3), (3), (3), (3), (3), (3);
+EXPLAIN
+SELECT *
+FROM
+t1 JOIN t2 ON t1.a = t2.a
+LEFT JOIN
+(
+(
+t3 LEFT JOIN t4 ON t3.a = t4.a
+)
+LEFT JOIN
+(
+t5 LEFT JOIN t6 ON t5.a = t6.a
+)
+ON t4.a = t5.a
+)
+ON t1.a = t3.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t3 ref a a 5 test.t1.a 2 Using index
+1 SIMPLE t4 ALL NULL NULL NULL NULL 0
+1 SIMPLE t5 ALL NULL NULL NULL NULL 0
+1 SIMPLE t6 ALL NULL NULL NULL NULL 0
+1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where; Using join buffer
+SELECT *
+FROM
+t1 JOIN t2 ON t1.a = t2.a
+LEFT JOIN
+(
+(
+t3 LEFT JOIN t4 ON t3.a = t4.a
+)
+LEFT JOIN
+(
+t5 LEFT JOIN t6 ON t5.a = t6.a
+)
+ON t4.a = t5.a
+)
+ON t1.a = t3.a;
+a a a a a a
+DROP TABLE t1,t2,t3,t4,t5,t6;
End of 5.0 tests.
+CREATE TABLE t1 (f1 int);
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2 VALUES (1);
+CREATE VIEW v1 AS SELECT * FROM t2;
+PREPARE stmt FROM 'UPDATE t2 AS A NATURAL JOIN v1 B SET B.f1 = 1';
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP VIEW v1;
+DROP TABLE t1, t2;
=== added file 'mysql-test/r/locale.result'
--- a/mysql-test/r/locale.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/locale.result 2009-10-19 08:44:44 +0000
@@ -0,0 +1,29 @@
+DROP TABLE IF EXISTS t1;
+Start of 5.4 tests
+#
+# Bug#43207 wrong LC_TIME names for romanian locale
+#
+SET NAMES utf8;
+SET lc_time_names=ro_RO;
+SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
+DATE_FORMAT('2001-01-01', '%w %a %W')
+1 Lu Luni
+SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
+DATE_FORMAT('2001-01-02', '%w %a %W')
+2 Ma Marţi
+SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
+DATE_FORMAT('2001-01-03', '%w %a %W')
+3 Mi Miercuri
+SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
+DATE_FORMAT('2001-01-04', '%w %a %W')
+4 Jo Joi
+SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
+DATE_FORMAT('2001-01-05', '%w %a %W')
+5 Vi Vineri
+SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
+DATE_FORMAT('2001-01-06', '%w %a %W')
+6 Sâ Sâmbătă
+SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
+DATE_FORMAT('2001-01-07', '%w %a %W')
+0 Du Duminică
+End of 5.4 tests
=== modified file 'mysql-test/r/lowercase_fs_off.result'
--- a/mysql-test/r/lowercase_fs_off.result 2006-11-14 18:45:52 +0000
+++ b/mysql-test/r/lowercase_fs_off.result 2009-10-27 08:09:19 +0000
@@ -10,3 +10,48 @@ create database D1;
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
drop user 'sample'@'localhost';
drop database if exists d1;
+CREATE DATABASE d1;
+USE d1;
+CREATE TABLE T1(f1 INT);
+CREATE TABLE t1(f1 INT);
+GRANT SELECT ON T1 to user_1@localhost;
+select * from t1;
+ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
+select * from T1;
+f1
+GRANT SELECT ON t1 to user_1@localhost;
+select * from information_schema.table_privileges;
+GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
+'user_1'@'localhost' NULL d1 T1 SELECT NO
+'user_1'@'localhost' NULL d1 t1 SELECT NO
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
+DROP USER user_1@localhost;
+DROP DATABASE d1;
+USE test;
+CREATE DATABASE db1;
+USE db1;
+CREATE PROCEDURE p1() BEGIN END;
+CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
+GRANT USAGE ON db1.* to user_1@localhost;
+GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
+GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
+GRANT UPDATE ON db1.* to USER_1@localhost;
+call p1();
+call P1();
+select f1(1);
+f1(1)
+2
+call p1();
+ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
+call P1();
+ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
+select f1(1);
+ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.f1'
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
+DROP FUNCTION f1;
+DROP PROCEDURE p1;
+DROP USER user_1@localhost;
+DROP USER USER_1@localhost;
+DROP DATABASE db1;
+use test;
=== added file 'mysql-test/r/lowercase_mixed_tmpdir_innodb.result'
--- a/mysql-test/r/lowercase_mixed_tmpdir_innodb.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/lowercase_mixed_tmpdir_innodb.result 2009-09-09 09:38:50 +0000
@@ -0,0 +1,6 @@
+drop table if exists t1;
+create table t1 (id int) engine=InnoDB;
+insert into t1 values (1);
+create temporary table t2 engine=InnoDB select * from t1;
+drop temporary table t2;
+drop table t1;
=== modified file 'mysql-test/r/lowercase_table3.result'
--- a/mysql-test/r/lowercase_table3.result 2009-02-13 21:12:59 +0000
+++ b/mysql-test/r/lowercase_table3.result 2009-08-28 14:13:27 +0000
@@ -1,4 +1,4 @@
-call mtr.add_suppression("Cannot find or open table test/BUG29839 from .*");
+call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
DROP TABLE IF EXISTS t1,T1;
CREATE TABLE t1 (a INT);
SELECT * FROM T1;
=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result 2009-09-18 01:04:43 +0000
+++ b/mysql-test/r/myisam.result 2009-11-16 20:49:51 +0000
@@ -2283,4 +2283,50 @@ h+0 d + 0 e g + 0
1 1 3 0
1 1 4 0
DROP TABLE t1;
+#
+# Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field
+# (same content / differen checksum)
+#
+CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
+INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
+checksum table t1;
+Table Checksum
+test.t1 326284887
+CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
+INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
+checksum table t2;
+Table Checksum
+test.t2 326284887
+CREATE TABLE t3 select * from t1;
+checksum table t3;
+Table Checksum
+test.t3 326284887
+drop table t1,t2,t3;
+CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
+INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
+(6,'0'),(7,'0');
+INSERT INTO t1 SELECT a+10,b FROM t1;
+INSERT INTO t1 SELECT a+20,b FROM t1;
+INSERT INTO t1 SELECT a+40,b FROM t1;
+INSERT INTO t1 SELECT a+80,b FROM t1;
+INSERT INTO t1 SELECT a+160,b FROM t1;
+INSERT INTO t1 SELECT a+320,b FROM t1;
+INSERT INTO t1 SELECT a+640,b FROM t1;
+INSERT INTO t1 SELECT a+1280,b FROM t1;
+INSERT INTO t1 SELECT a+2560,b FROM t1;
+INSERT INTO t1 SELECT a+5120,b FROM t1;
+SET myisam_sort_buffer_size=4;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair error myisam_sort_buffer_size is too small
+test.t1 repair warning Number of rows changed from 0 to 7168
+test.t1 repair status OK
+SET myisam_repair_threads=2;
+REPAIR TABLE t1;
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
End of 5.1 tests
=== modified file 'mysql-test/r/myisam_crash_before_flush_keys.result'
--- a/mysql-test/r/myisam_crash_before_flush_keys.result 2009-04-06 07:01:17 +0000
+++ b/mysql-test/r/myisam_crash_before_flush_keys.result 2009-10-14 11:26:16 +0000
@@ -15,31 +15,13 @@ SET SESSION debug="d,crash_before_flush_
# Run the crashing query
FLUSH TABLE t1;
ERROR HY000: Lost connection to MySQL server during query
-# Run MYISAMCHK tool to check the table t1 and repair
-myisamchk: MyISAM file MYSQLD_DATADIR/test/t1
-myisamchk: warning: 1 client is using or hasn't closed the table properly
-myisamchk: error: Size of indexfile is: 1024 Should be: 3072
-MYISAMCHK: Unknown error 126
-myisamchk: error: Can't read indexpage from filepos: 1024
-MyISAM-table 'MYSQLD_DATADIR/test/t1' is corrupted
-Fix it using switch "-r" or "-o"
# Write file to make mysql-test-run.pl start the server
# Turn on reconnect
# Call script that will poll the server waiting for
# it to be back online again
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`a`,`b`),
- KEY `b` (`b`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
-SELECT * FROM t1 FORCE INDEX (PRIMARY);
-a b
-1 2
-2 3
-3 4
-4 5
-5 6
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check warning 1 client is using or hasn't closed the table properly
+test.t1 check error Size of indexfile is: 1024 Should be: 3072
+test.t1 check error Corrupt
DROP TABLE t1;
=== modified file 'mysql-test/r/mysqlbinlog.result'
--- a/mysql-test/r/mysqlbinlog.result 2009-05-08 17:24:15 +0000
+++ b/mysql-test/r/mysqlbinlog.result 2009-09-30 02:31:25 +0000
@@ -44,16 +44,16 @@ SET TIMESTAMP=1000000000/*!*/;
insert into t2 values ()
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
DELIMITER ;
# End of log file
@@ -144,16 +144,16 @@ SET TIMESTAMP=1000000000/*!*/;
insert into t2 values ()
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
DELIMITER ;
# End of log file
@@ -359,29 +359,29 @@ SET @@session.collation_database=DEFAULT
create table t1 (a varchar(64) character set utf8)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO TABLE `t1` CHARACTER SET koi8r FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
drop table t1
@@ -473,5 +473,94 @@ IS NOT NULL
SET @@global.server_id= 1;
RESET MASTER;
FLUSH LOGS;
+RESET MASTER;
+FLUSH LOGS;
+#
+# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is exist
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+create table t1(a int) engine= innodb
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+insert into t1 (a) values (1)
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+create table t3(a int) engine= innodb
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+insert into t3 (a) values (2)
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+ROLLBACK
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+create table t5(a int) engine= NDB
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+insert into t5 (a) values (3)
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+COMMIT
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+#
+# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is not exist
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+BEGIN
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+ROLLBACK
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1253783037/*!*/;
+COMMIT
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
End of 5.0 tests
End of 5.1 tests
=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result 2009-05-27 20:54:40 +0000
+++ b/mysql-test/r/mysqltest.result 2009-10-08 09:30:03 +0000
@@ -314,20 +314,10 @@ here is the sourced script
1 = outer loop variable before dec
0 = outer loop variable after dec
-
-2 = outer loop variable after while
-here is the sourced script
-
-2 = outer loop variable before dec
-
-1 = outer loop variable after dec
-
-1 = outer loop variable after while
+outer=2 ifval=0
+outer=1 ifval=1
here is the sourced script
-
-1 = outer loop variable before dec
-
-0 = outer loop variable after dec
+ERROR 42S02: Table 'test.nowhere' doesn't exist
In loop
here is the sourced script
@@ -538,6 +528,10 @@ mysqltest: At line 1: Missing required a
mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found
Content for test_file1
mysqltest: At line 1: File already exist: 'MYSQLTEST_VARDIR/tmp/test_file1.tmp'
+These lines should be repeated,
+if things work as expected
+These lines should be repeated,
+if things work as expected
Some data
for cat_file command
of mysqltest
=== added file 'mysql-test/r/not_true.require'
--- a/mysql-test/r/not_true.require 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/not_true.require 2009-09-25 09:26:49 +0000
@@ -0,0 +1,2 @@
+TRUE
+NULL
=== modified file 'mysql-test/r/olap.result'
--- a/mysql-test/r/olap.result 2007-11-23 08:35:02 +0000
+++ b/mysql-test/r/olap.result 2009-10-30 15:59:06 +0000
@@ -733,4 +733,24 @@ SELECT 1 FROM t1 GROUP BY (DATE(NULL)) W
1
1
DROP TABLE t1;
+#
+# Bug #48131: crash group by with rollup, distinct,
+# filesort, with temporary tables
+#
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (100);
+SELECT a, b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
+a b
+1 100
+1 NULL
+2 100
+2 NULL
+NULL NULL
+SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
+b
+100
+NULL
+DROP TABLE t1, t2;
End of 5.0 tests
=== modified file 'mysql-test/r/order_by.result'
--- a/mysql-test/r/order_by.result 2009-08-07 11:51:40 +0000
+++ b/mysql-test/r/order_by.result 2009-10-14 14:30:39 +0000
@@ -1557,3 +1557,34 @@ a
2001
1991
DROP TABLE t1;
+#
+# Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join buffering
+# is used
+#
+CREATE TABLE t1 (a INT, b INT, KEY (a));
+INSERT INTO t1 VALUES (0, NULL), (1, NULL), (2, NULL), (3, NULL);
+INSERT INTO t1 SELECT a+4, b FROM t1;
+INSERT INTO t1 SELECT a+8, b FROM t1;
+CREATE TABLE t2 (a INT, b INT);
+INSERT INTO t2 VALUES (0,NULL), (1,NULL), (2,NULL), (3,NULL), (4,NULL);
+INSERT INTO t2 SELECT a+4, b FROM t2;
+# shouldn't have "using filesort"
+EXPLAIN
+SELECT * FROM t1 FORCE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 2 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 10
+# should have "using filesort"
+EXPLAIN
+SELECT * FROM t1 USE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 2 Using where; Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer
+# should have "using filesort"
+EXPLAIN
+SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 2 Using where; Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer
+DROP TABLE t1, t2;
+End of 5.1 tests
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result 2009-10-15 21:38:29 +0000
+++ b/mysql-test/r/partition.result 2009-11-16 20:49:51 +0000
@@ -50,6 +50,21 @@ t1 CREATE TABLE `t1` (
PARTITION p3 VALUES LESS THAN (733969) ENGINE = MyISAM,
PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
DROP TABLE t1;
+create table t1 (a int, b int, key(a))
+partition by list (a)
+( partition p0 values in (1),
+partition p1 values in (2));
+insert into t1 values (1,1),(2,1),(2,2),(2,3);
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show indexes from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 1 NULL NULL YES BTREE
+drop table t1;
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
ENGINE=MyISAM
PARTITION BY HASH (a);
=== modified file 'mysql-test/r/partition_csv.result'
--- a/mysql-test/r/partition_csv.result 2009-07-31 23:39:26 +0000
+++ b/mysql-test/r/partition_csv.result 2009-09-03 06:38:06 +0000
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Failed to write to mysql.general_log");
drop table if exists t1;
create table t1 (a int)
engine = csv
=== modified file 'mysql-test/r/partition_innodb.result'
--- a/mysql-test/r/partition_innodb.result 2008-11-10 20:13:24 +0000
+++ b/mysql-test/r/partition_innodb.result 2009-09-10 06:54:26 +0000
@@ -1,4 +1,18 @@
drop table if exists t1;
+create table t1 (a int not null,
+b datetime not null,
+primary key (a,b))
+engine=innodb
+partition by range (to_days(b))
+subpartition by hash (a)
+subpartitions 2
+( partition p0 values less than (to_days('2009-01-01')),
+partition p1 values less than (to_days('2009-02-01')),
+partition p2 values less than (to_days('2009-03-01')),
+partition p3 values less than maxvalue);
+alter table t1 reorganize partition p1,p2 into
+( partition p2 values less than (to_days('2009-03-01')));
+drop table t1;
CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
PARTITION BY RANGE(id) (
PARTITION p0 VALUES LESS THAN (5),
@@ -256,3 +270,7 @@ SUBPARTITION BY KEY (char_column)
SUBPARTITIONS 2
(PARTITION p1 VALUES LESS THAN (5) ENGINE = MyISAM) */
drop table t1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB
+PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
+CREATE INDEX i1 ON t1 (a);
+DROP TABLE t1;
=== added file 'mysql-test/r/partition_innodb_builtin.result'
--- a/mysql-test/r/partition_innodb_builtin.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/partition_innodb_builtin.result 2009-09-25 09:26:49 +0000
@@ -0,0 +1,39 @@
+SET NAMES utf8;
+CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
+ENGINE=InnoDB
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION `p0``\""e` VALUES LESS THAN (100)
+(SUBPARTITION `sp0``\""e`,
+SUBPARTITION `sp1``\""e`),
+PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
+(SUBPARTITION `sp2``\""e`,
+SUBPARTITION `sp3``\""e`));
+INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
+START TRANSACTION;
+# con1
+SET NAMES utf8;
+START TRANSACTION;
+# default connection
+UPDATE `t``\""e` SET a = 16 WHERE a = 0;
+# con1
+UPDATE `t``\""e` SET a = 8 WHERE a = 22;
+UPDATE `t``\""e` SET a = 12 WHERE a = 0;
+# default connection
+UPDATE `t``\""e` SET a = 4 WHERE a = 22;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+# First table reported in 'SHOW ENGINE InnoDB STATUS'
+SHOW ENGINE InnoDB STATUS;
+Type Name Status
+InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+SHOW ENGINE InnoDB STATUS;
+Type Name Status
+InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+set @@sql_mode = @old_sql_mode;
+# con1
+ROLLBACK;
+# default connection
+DROP TABLE `t``\""e`;
+SET NAMES DEFAULT;
=== added file 'mysql-test/r/partition_innodb_plugin.result'
--- a/mysql-test/r/partition_innodb_plugin.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/partition_innodb_plugin.result 2009-09-25 09:26:49 +0000
@@ -0,0 +1,50 @@
+SET NAMES utf8;
+CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
+ENGINE=InnoDB
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION `p0``\""e` VALUES LESS THAN (100)
+(SUBPARTITION `sp0``\""e`,
+SUBPARTITION `sp1``\""e`),
+PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
+(SUBPARTITION `sp2``\""e`,
+SUBPARTITION `sp3``\""e`));
+INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
+START TRANSACTION;
+# con1
+SET NAMES utf8;
+START TRANSACTION;
+# default connection
+UPDATE `t``\""e` SET a = 16 WHERE a = 0;
+# con1
+UPDATE `t``\""e` SET a = 8 WHERE a = 22;
+UPDATE `t``\""e` SET a = 12 WHERE a = 0;
+# default connection
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+lock_table COUNT(*)
+`test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */ 2
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+lock_table COUNT(*)
+"test"."t`\""""e" /* Partition "p0`\""""e", Subpartition "sp0`\""""e" */ 2
+set @@sql_mode = @old_sql_mode;
+UPDATE `t``\""e` SET a = 4 WHERE a = 22;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+# First table reported in 'SHOW ENGINE InnoDB STATUS'
+SHOW ENGINE InnoDB STATUS;
+Type Name Status
+InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+SHOW ENGINE InnoDB STATUS;
+Type Name Status
+InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+set @@sql_mode = @old_sql_mode;
+# con1
+ROLLBACK;
+# default connection
+DROP TABLE `t``\""e`;
+SET NAMES DEFAULT;
=== added file 'mysql-test/r/partition_open_files_limit.result'
--- a/mysql-test/r/partition_open_files_limit.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/partition_open_files_limit.result 2009-10-08 13:36:43 +0000
@@ -0,0 +1,22 @@
+DROP TABLE IF EXISTS `t1`;
+# Bug#46922: crash when adding partitions and open_files_limit is reached
+CREATE TABLE t1 (a INT PRIMARY KEY)
+ENGINE=MyISAM PARTITION BY KEY () PARTITIONS 1;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
+# if the bug exists, then crash will happen here
+ALTER TABLE t1 ADD PARTITION PARTITIONS 511;
+ERROR HY000: Out of resources when opening file '<partition file>' (Errcode: 24)
+SELECT * FROM t1;
+a
+1
+10
+11
+2
+3
+4
+5
+6
+7
+8
+9
+DROP TABLE t1;
=== modified file 'mysql-test/r/partition_pruning.result'
--- a/mysql-test/r/partition_pruning.result 2009-09-01 12:53:27 +0000
+++ b/mysql-test/r/partition_pruning.result 2009-10-16 20:19:51 +0000
@@ -1272,10 +1272,9 @@ INSERT INTO t1 VALUES (1, '2009-01-01'),
# test with an invalid date, which lead to item->null_value is set.
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 p20090401 ALL NULL NULL NULL NULL 2 Using where
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1292 Incorrect datetime value: '2009-04-99'
-Warning 1292 Incorrect datetime value: '2009-04-99'
DROP TABLE t1;
CREATE TABLE t1
(a INT NOT NULL AUTO_INCREMENT,
=== modified file 'mysql-test/r/ps_grant.result'
--- a/mysql-test/r/ps_grant.result 2006-08-23 13:50:06 +0000
+++ b/mysql-test/r/ps_grant.result 2009-10-27 10:09:36 +0000
@@ -32,19 +32,19 @@ identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
drop table mysqltest.t9 ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ;
my_col
=== modified file 'mysql-test/r/query_cache.result'
--- a/mysql-test/r/query_cache.result 2009-02-19 09:01:25 +0000
+++ b/mysql-test/r/query_cache.result 2009-11-16 20:49:51 +0000
@@ -1708,6 +1708,7 @@ Qcache_hits 2
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
End of 5.0 tests
+SET GLOBAL query_cache_size=1024*1024*512;
CREATE TABLE t1 (a ENUM('rainbow'));
INSERT INTO t1 VALUES (),(),(),(),();
SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
@@ -1722,4 +1723,5 @@ SELECT 1 FROM t1 GROUP BY
1
1
DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
End of 5.1 tests
=== modified file 'mysql-test/r/range.result'
--- a/mysql-test/r/range.result 2008-03-27 02:18:46 +0000
+++ b/mysql-test/r/range.result 2009-11-02 12:24:07 +0000
@@ -1219,3 +1219,388 @@ explain select * from t2 where a=1000 an
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref a a 5 const 502 Using where
drop table t1, t2;
+CREATE TABLE t1( a INT, b INT, KEY( a, b ) );
+CREATE TABLE t2( a INT, b INT, KEY( a, b ) );
+CREATE TABLE t3( a INT, b INT, KEY( a, b ) );
+INSERT INTO t1( a, b )
+VALUES (0, 1), (1, 2), (1, 4), (2, 3), (5, 0), (9, 7);
+INSERT INTO t2( a, b )
+VALUES ( 1, 1), ( 2, 1), ( 3, 1), ( 4, 1), ( 5, 1),
+( 6, 1), ( 7, 1), ( 8, 1), ( 9, 1), (10, 1),
+(11, 1), (12, 1), (13, 1), (14, 1), (15, 1),
+(16, 1), (17, 1), (18, 1), (19, 1), (20, 1);
+INSERT INTO t2 SELECT a, 2 FROM t2 WHERE b = 1;
+INSERT INTO t2 SELECT a, 3 FROM t2 WHERE b = 1;
+INSERT INTO t2 SELECT -1, -1 FROM t2;
+INSERT INTO t2 SELECT -1, -1 FROM t2;
+INSERT INTO t2 SELECT -1, -1 FROM t2;
+INSERT INTO t3
+VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0),
+(6, 0), (7, 0), (8, 0), (9, 0), (10, 0);
+INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
+INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
+SELECT * FROM t1 WHERE
+3 <= a AND a < 5 OR
+5 < a AND b = 3 OR
+3 <= a;
+a b
+5 0
+9 7
+EXPLAIN
+SELECT * FROM t1 WHERE
+3 <= a AND a < 5 OR
+5 < a AND b = 3 OR
+3 <= a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index
+SELECT * FROM t1 WHERE
+3 <= a AND a < 5 OR
+5 <= a AND b = 3 OR
+3 <= a;
+a b
+5 0
+9 7
+EXPLAIN
+SELECT * FROM t1 WHERE
+3 <= a AND a < 5 OR
+5 <= a AND b = 3 OR
+3 <= a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
+SELECT * FROM t1 WHERE
+3 <= a AND a <= 5 OR
+5 <= a AND b = 3 OR
+3 <= a;
+a b
+5 0
+9 7
+EXPLAIN
+SELECT * FROM t1 WHERE
+3 <= a AND a <= 5 OR
+5 <= a AND b = 3 OR
+3 <= a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index
+SELECT * FROM t1 WHERE
+3 <= a AND a <= 5 OR
+3 <= a;
+a b
+5 0
+9 7
+EXPLAIN
+SELECT * FROM t1 WHERE
+3 <= a AND a <= 5 OR
+3 <= a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index
+SELECT * FROM t2 WHERE
+5 <= a AND a < 10 AND b = 1 OR
+15 <= a AND a < 20 AND b = 3
+OR
+1 <= a AND b = 1;
+a b
+1 1
+2 1
+3 1
+4 1
+5 1
+6 1
+7 1
+8 1
+9 1
+10 1
+11 1
+12 1
+13 1
+14 1
+15 1
+15 3
+16 1
+16 3
+17 1
+17 3
+18 1
+18 3
+19 1
+19 3
+20 1
+EXPLAIN
+SELECT * FROM t2 WHERE
+5 <= a AND a < 10 AND b = 1 OR
+15 <= a AND a < 20 AND b = 3
+OR
+1 <= a AND b = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range a a 10 NULL 50 Using where; Using index
+SELECT * FROM t2 WHERE
+5 <= a AND a < 10 AND b = 2 OR
+15 <= a AND a < 20 AND b = 3
+OR
+1 <= a AND b = 1;
+a b
+1 1
+2 1
+3 1
+4 1
+5 1
+5 2
+6 1
+6 2
+7 1
+7 2
+8 1
+8 2
+9 1
+9 2
+10 1
+11 1
+12 1
+13 1
+14 1
+15 1
+15 3
+16 1
+16 3
+17 1
+17 3
+18 1
+18 3
+19 1
+19 3
+20 1
+EXPLAIN
+SELECT * FROM t2 WHERE
+5 <= a AND a < 10 AND b = 2 OR
+15 <= a AND a < 20 AND b = 3
+OR
+1 <= a AND b = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range a a 10 NULL 50 Using where; Using index
+SELECT * FROM t3 WHERE
+5 <= a AND a < 10 AND b = 3 OR
+a < 5 OR
+a < 10;
+a b
+1 0
+2 0
+3 0
+4 0
+5 0
+6 0
+7 0
+8 0
+9 0
+EXPLAIN
+SELECT * FROM t3 WHERE
+5 <= a AND a < 10 AND b = 3 OR
+a < 5 OR
+a < 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 range a a 5 NULL 8 Using where; Using index
+DROP TABLE t1, t2, t3;
+#
+# Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
+#
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES (1), (NULL);
+SELECT * FROM t1 WHERE a <> NULL and (a <> NULL or a <= NULL);
+a
+DROP TABLE t1;
+#
+# Bug#47925: regression of range optimizer and date comparison in 5.1.39!
+#
+CREATE TABLE t1 ( a DATE, KEY ( a ) );
+CREATE TABLE t2 ( a DATETIME, KEY ( a ) );
+# Make optimizer choose range scan
+INSERT INTO t1 VALUES ('2009-09-22'), ('2009-09-22'), ('2009-09-22');
+INSERT INTO t1 VALUES ('2009-09-23'), ('2009-09-23'), ('2009-09-23');
+INSERT INTO t2 VALUES ('2009-09-22 12:00:00'), ('2009-09-22 12:00:00'),
+('2009-09-22 12:00:00');
+INSERT INTO t2 VALUES ('2009-09-23 12:00:00'), ('2009-09-23 12:00:00'),
+('2009-09-23 12:00:00');
+# DATE vs DATE
+EXPLAIN
+SELECT * FROM t1 WHERE a >= '2009/09/23';
+id select_type table type possible_keys key key_len ref rows Extra
+X X X range a a X X X X
+SELECT * FROM t1 WHERE a >= '2009/09/23';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= '20090923';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= 20090923;
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= '2009-9-23';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= '2009.09.23';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= '2009:09:23';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+# DATE vs DATETIME
+EXPLAIN
+SELECT * FROM t2 WHERE a >= '2009/09/23';
+id select_type table type possible_keys key key_len ref rows Extra
+X X X range a a X X X X
+SELECT * FROM t2 WHERE a >= '2009/09/23';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= '2009/09/23';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= '20090923';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= 20090923;
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= '2009-9-23';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= '2009.09.23';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= '2009:09:23';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+# DATETIME vs DATETIME
+EXPLAIN
+SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00';
+id select_type table type possible_keys key key_len ref rows Extra
+X X X range a a X X X X
+SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= '20090923120000';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= 20090923120000;
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= '2009-9-23 12:00:00';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= '2009.09.23 12:00:00';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+SELECT * FROM t2 WHERE a >= '2009:09:23 12:00:00';
+a
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+2009-09-23 12:00:00
+# DATETIME vs DATE
+EXPLAIN
+SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
+id select_type table type possible_keys key key_len ref rows Extra
+X X X range a a X X X X
+SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= '20090923000000';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= 20090923000000;
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= '2009-9-23 00:00:00';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= '2009.09.23 00:00:00';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+SELECT * FROM t1 WHERE a >= '2009:09:23 00:00:00';
+a
+2009-09-23
+2009-09-23
+2009-09-23
+# Test of the new get_date_from_str implementation
+# Behavior differs slightly between the trunk and mysql-pe.
+# The former may give errors for the truncated values, while the latter
+# gives warnings. The purpose of this test is not to interfere, and only
+# preserve existing behavior.
+SELECT str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND
+str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20';
+str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND
+str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20'
+1
+Warnings:
+Warning 1292 Truncated incorrect date value: ''
+SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
+str_to_date('2007-20-00', '%Y-%m-%d') <= '';
+str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
+str_to_date('2007-20-00', '%Y-%m-%d') <= ''
+NULL
+Warnings:
+Warning 1292 Truncated incorrect date value: ''
+Error 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
+Error 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
+SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20';
+str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'
+1
+Warnings:
+Warning 1292 Truncated incorrect datetime value: ''
+SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '';
+str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''
+NULL
+Warnings:
+Error 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
+SELECT str_to_date('', '%Y-%m-%d');
+str_to_date('', '%Y-%m-%d')
+0000-00-00
+DROP TABLE t1, t2;
+End of 5.1 tests
=== modified file 'mysql-test/r/select.result'
--- a/mysql-test/r/select.result 2009-09-15 10:46:35 +0000
+++ b/mysql-test/r/select.result 2009-11-16 20:49:51 +0000
@@ -4385,6 +4385,47 @@ id select_type table type possible_keys
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` > 1)) limit 2
DROP TABLE t1;
+#
+# Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when
+# forcing a spatial index
+#
+CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
+INSERT INTO t1 VALUES
+(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
+(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
+EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL a NULL NULL NULL 2
+SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
+1
+1
+1
+1
+1
+EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL a NULL NULL NULL 2
+SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
+1
+1
+1
+1
+1
+DROP TABLE t1;
+#
+# Bug #48291 : crash with row() operator,select into @var, and
+# subquery returning multiple rows
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (2),(3);
+# Should not crash
+SELECT 1 FROM t1 WHERE a <> 1 AND NOT
+ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1))
+INTO @var0;
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1;
End of 5.0 tests
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
=== added file 'mysql-test/r/sp-bugs.result'
--- a/mysql-test/r/sp-bugs.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/sp-bugs.result 2009-10-26 09:55:57 +0000
@@ -0,0 +1,47 @@
+#
+# Bug #47412: Valgrind warnings / user can read uninitalized memory
+# using SP variables
+#
+CREATE SCHEMA testdb;
+USE testdb;
+CREATE FUNCTION f2 () RETURNS INTEGER
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
+RETURN f_not_exists () ;
+END|
+CREATE PROCEDURE p3 ( arg1 VARCHAR(32) )
+BEGIN
+CALL p_not_exists ( );
+END|
+# should not return valgrind warnings
+CALL p3 ( f2 () );
+ERROR 42000: PROCEDURE testdb.p_not_exists does not exist
+DROP SCHEMA testdb;
+CREATE SCHEMA testdb;
+USE testdb;
+CREATE FUNCTION f2 () RETURNS INTEGER
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
+RETURN f_not_exists () ;
+END|
+CREATE PROCEDURE p3 ( arg2 INTEGER )
+BEGIN
+CALL p_not_exists ( );
+END|
+# should not return valgrind warnings
+CALL p3 ( f2 () );
+ERROR 42000: PROCEDURE testdb.p_not_exists does not exist
+DROP SCHEMA testdb;
+CREATE SCHEMA testdb;
+USE testdb;
+CREATE FUNCTION f2 () RETURNS INTEGER
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
+RETURN f_not_exists () ;
+END|
+# should not return valgrind warnings
+SELECT f2 ();
+f2 ()
+NULL
+DROP SCHEMA testdb;
+End of 5.1 tests
=== modified file 'mysql-test/r/sp-error.result'
--- a/mysql-test/r/sp-error.result 2009-05-27 15:19:44 +0000
+++ b/mysql-test/r/sp-error.result 2009-10-19 13:55:04 +0000
@@ -1670,3 +1670,19 @@ NULL
SELECT non_existent (a) FROM t1 WHERE b = 999999;
ERROR 42000: FUNCTION test.non_existent does not exist
DROP TABLE t1;
+#
+# Bug #47788: Crash in TABLE_LIST::hide_view_error on UPDATE + VIEW +
+# SP + MERGE + ALTER
+#
+CREATE TABLE t1 (pk INT, b INT, KEY (b));
+CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+CREATE PROCEDURE p1 (a int) UPDATE IGNORE v1 SET b = a;
+CALL p1(5);
+ERROR HY000: The target table v1 of the UPDATE is not updatable
+ALTER TABLE t1 CHANGE COLUMN b b2 INT;
+CALL p1(7);
+ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1;
+End of 5.1 tests
=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result 2009-06-04 11:53:15 +0000
+++ b/mysql-test/r/sp.result 2009-10-23 13:54:58 +0000
@@ -6963,6 +6963,22 @@ CALL p1();
CALL p1();
DROP PROCEDURE p1;
DROP TABLE t1;
+#
+# Bug #46629: Item_in_subselect::val_int(): Assertion `0'
+# on subquery inside a SP
+#
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT, b INT PRIMARY KEY);
+CREATE PROCEDURE p1 ()
+BEGIN
+SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B);
+END|
+CALL p1;
+ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY subquery'
+CALL p1;
+ERROR 42S22: Unknown column 'A.b' in 'IN/ALL/ANY subquery'
+DROP PROCEDURE p1;
+DROP TABLE t1, t2;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
=== modified file 'mysql-test/r/subselect.result'
--- a/mysql-test/r/subselect.result 2009-10-15 21:38:29 +0000
+++ b/mysql-test/r/subselect.result 2009-11-16 20:49:51 +0000
@@ -75,7 +75,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -4403,8 +4403,7 @@ FROM t1
WHERE a = 230;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DEPENDENT SUBQUERY st1 index NULL a 5 NULL 2 Using index
-2 DEPENDENT SUBQUERY st2 index b b 5 NULL 2 Using where; Using index; Using join buffer
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
@@ -4561,4 +4560,18 @@ id g v s
51 50 NULL l
61 60 NULL l
drop table t1, t2;
+CREATE TABLE t1 (a ENUM('rainbow'));
+INSERT INTO t1 VALUES (),(),(),(),();
+SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
+1
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a LONGBLOB);
+INSERT INTO t1 SET a = 'aaaa';
+INSERT INTO t1 SET a = 'aaaa';
+SELECT 1 FROM t1 GROUP BY
+(SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
+1
+1
+DROP TABLE t1;
End of 5.1 tests.
=== modified file 'mysql-test/r/subselect3.result'
--- a/mysql-test/r/subselect3.result 2009-10-15 21:38:29 +0000
+++ b/mysql-test/r/subselect3.result 2009-11-16 20:49:51 +0000
@@ -895,3 +895,72 @@ t1.a < (select t4.a+10
from t4, t5 limit 2));
ERROR 21000: Subquery returns more than 1 row
drop table t0, t1, t2, t3, t4, t5;
+#
+# BUG#48177 - SELECTs with NOT IN subqueries containing NULL
+# values return too many records
+#
+CREATE TABLE t1 (
+i1 int DEFAULT NULL,
+i2 int DEFAULT NULL
+) ;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (2, 3);
+INSERT INTO t1 VALUES (4, NULL);
+INSERT INTO t1 VALUES (4, 0);
+INSERT INTO t1 VALUES (NULL, NULL);
+CREATE TABLE t2 (
+i1 int DEFAULT NULL,
+i2 int DEFAULT NULL
+) ;
+INSERT INTO t2 VALUES (4, NULL);
+INSERT INTO t2 VALUES (5, 0);
+
+Data in t1
+SELECT i1, i2 FROM t1;
+i1 i2
+1 NULL
+2 3
+4 NULL
+4 0
+NULL NULL
+
+Data in subquery (should be filtered out)
+SELECT i1, i2 FROM t2 ORDER BY i1;
+i1 i2
+4 NULL
+5 0
+FLUSH STATUS;
+
+SELECT i1, i2
+FROM t1
+WHERE (i1, i2)
+NOT IN (SELECT i1, i2 FROM t2);
+i1 i2
+1 NULL
+2 3
+
+# Check that the subquery only has to be evaluated once
+# for all-NULL values even though there are two (NULL,NULL) records
+# Baseline:
+SHOW STATUS LIKE '%Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 17
+
+INSERT INTO t1 VALUES (NULL, NULL);
+FLUSH STATUS;
+
+SELECT i1, i2
+FROM t1
+WHERE (i1, i2)
+NOT IN (SELECT i1, i2 FROM t2);
+i1 i2
+1 NULL
+2 3
+
+# Handler_read_rnd_next should be one more than baseline
+# (read record from t1, but do not read from t2)
+SHOW STATUS LIKE '%Handler_read_rnd_next';
+Variable_name Value
+Handler_read_rnd_next 18
+DROP TABLE t1,t2;
+End of 5.1 tests
=== added file 'mysql-test/r/subselect4.result'
--- a/mysql-test/r/subselect4.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/subselect4.result 2009-09-28 13:48:40 +0000
@@ -0,0 +1,61 @@
+#
+# Bug #46791: Assertion failed:(table->key_read==0),function unknown
+# function,file sql_base.cc
+#
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 VALUES (1,1),(2,2);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES (1,1),(2,2);
+CREATE TABLE t3 LIKE t1;
+# should have 1 impossible where and 2 dependent subqueries
+EXPLAIN
+SELECT 1 FROM t1
+WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
+ORDER BY count(*);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL a 5 NULL 2 Using index; Using temporary
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+# should not crash the next statement
+SELECT 1 FROM t1
+WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
+ORDER BY count(*);
+1
+1
+# should not crash: the crash is caused by the previous statement
+SELECT 1;
+1
+1
+DROP TABLE t1,t2,t3;
+#
+# Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing
+# query
+#
+CREATE TABLE t1 (
+a INT,
+b INT,
+PRIMARY KEY (a),
+KEY b (b)
+);
+INSERT INTO t1 VALUES (1, 1), (2, 1);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 SELECT * FROM t1;
+CREATE TABLE t3 LIKE t1;
+INSERT INTO t3 SELECT * FROM t1;
+# Should not crash.
+# Should have 1 impossible where and 2 dependent subqs.
+EXPLAIN
+SELECT
+(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+FROM t3 WHERE 1 = 0 GROUP BY 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 DEPENDENT SUBQUERY t1 index NULL PRIMARY 4 NULL 2 Using index
+2 DEPENDENT SUBQUERY t2 index b b 5 NULL 2 Using where; Using index; Using join buffer
+# should return 0 rows
+SELECT
+(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+FROM t3 WHERE 1 = 0 GROUP BY 1;
+(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+DROP TABLE t1,t2,t3;
+End of 5.0 tests.
=== modified file 'mysql-test/r/system_mysql_db.result'
--- a/mysql-test/r/system_mysql_db.result 2009-03-11 20:30:56 +0000
+++ b/mysql-test/r/system_mysql_db.result 2009-10-27 10:09:36 +0000
@@ -161,7 +161,7 @@ procs_priv CREATE TABLE `procs_priv` (
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
`Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Routine_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Routine_name` char(64) CHARACTER SET utf8 NOT NULL DEFAULT '',
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
=== modified file 'mysql-test/r/trigger_notembedded.result'
--- a/mysql-test/r/trigger_notembedded.result 2009-06-25 10:52:50 +0000
+++ b/mysql-test/r/trigger_notembedded.result 2009-09-17 11:33:23 +0000
@@ -180,8 +180,6 @@ NULL mysqltest_db1 trg5 DELETE NULL mysq
DROP USER mysqltest_dfn@localhost;
DROP USER mysqltest_inv@localhost;
DROP DATABASE mysqltest_db1;
-Warnings:
-Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
=== modified file 'mysql-test/r/type_bit.result'
--- a/mysql-test/r/type_bit.result 2008-12-09 13:31:22 +0000
+++ b/mysql-test/r/type_bit.result 2009-10-08 15:36:36 +0000
@@ -749,6 +749,16 @@ bin(a1)
110000111111111
110001011111111
drop table t1bit7, t2bit7;
+#
+# Bug42803: Field_bit does not have unsigned_flag field,
+# can lead to bad memory access
+#
+CREATE TABLE t1 (a BIT(7), b BIT(9), KEY(a, b));
+INSERT INTO t1 VALUES(0, 0), (5, 3), (5, 6), (6, 4), (7, 0);
+EXPLAIN SELECT a+0, b+0 FROM t1 WHERE a > 4 and b < 7 ORDER BY 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 2 NULL 4 Using where; Using index; Using filesort
+DROP TABLE t1;
End of 5.0 tests
create table t1(a bit(7));
insert into t1 values(0x40);
=== modified file 'mysql-test/r/type_newdecimal.result'
--- a/mysql-test/r/type_newdecimal.result 2009-08-24 19:47:08 +0000
+++ b/mysql-test/r/type_newdecimal.result 2009-11-02 11:21:39 +0000
@@ -1495,9 +1495,9 @@ CREATE TABLE t1 (a int DEFAULT NULL, b i
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa;
aa SUM(b)
-2.00000000000000000000000000000 10
-3.00000000000000000000000000000 10
-4.00000000000000000000000000000 30
+2.000000000000000000000000000000 10
+3.000000000000000000000000000000 10
+4.000000000000000000000000000000 30
SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa;
ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30.
DROP TABLE t1;
@@ -1521,13 +1521,13 @@ f1
DROP TABLE t1;
CREATE TABLE t1 SELECT 123451234512345123451234512345123451234512345.678906789067890678906789067890678906789067890 AS f1;
Warnings:
-Note 1265 Data truncated for column 'f1' at row 1
+Warning 1264 Out of range value for column 'f1' at row 1
DESC t1;
Field Type Null Key Default Extra
-f1 decimal(65,20) NO 0.00000000000000000000
+f1 decimal(65,30) NO 0.000000000000000000000000000000
SELECT f1 FROM t1;
f1
-123451234512345123451234512345123451234512345.67890678906789067891
+99999999999999999999999999999999999.999999999999999999999999999999
DROP TABLE t1;
select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000);
@@ -1595,7 +1595,7 @@ Warnings:
Note 1265 Data truncated for column 'my_col' at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
-my_col decimal(32,30) NO 0.000000000000000000000000000000
+my_col decimal(65,30) NO 0.000000000000000000000000000000
SELECT my_col FROM t1;
my_col
1.123456789123456789123456789123
@@ -1625,212 +1625,8 @@ Warnings:
Note 1265 Data truncated for column 'my_col' at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
-my_col decimal(30,30) YES NULL
+my_col decimal(65,30) YES NULL
SELECT my_col FROM t1;
my_col
0.012345687012345687012345687012
DROP TABLE t1;
-#
-# Bug#45261: Crash, stored procedure + decimal
-#
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 SELECT
-/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001
-AS c1;
-Warnings:
-Warning 1264 Out of range value for column 'c1' at row 1
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
-SELECT * FROM t1;
-c1
-99999999999999999999999999999999999999999999999999999999999999999
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.
-AS c1;
-Warnings:
-Warning 1264 Out of range value for column 'c1' at row 1
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
-SELECT * FROM t1;
-c1
-99999999999999999999999999999999999999999999999999999999999999999
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.1 /* 1 */
-AS c1;
-Warnings:
-Warning 1264 Out of range value for column 'c1' at row 1
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
-SELECT * FROM t1;
-c1
-99999999999999999999999999999999999999999999999999999999999999999
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-/* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
-AS c1;
-Warnings:
-Error 1292 Truncated incorrect DECIMAL value: ''
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
-SELECT * FROM t1;
-c1
-99999999999999999999999999999999999999999999999999999999999999999
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-/* 40 */ 1000000000000000000000000000000000000001.1000000000000000000000000000000000000001 /* 40 */
-AS c1;
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,25) NO 0.0000000000000000000000000
-SELECT * FROM t1;
-c1
-1000000000000000000000000000000000000001.1000000000000000000000000
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-/* 1 */ 1.10000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 80 */
-AS c1;
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(31,30) NO 0.000000000000000000000000000000
-SELECT * FROM t1;
-c1
-1.100000000000000000000000000000
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-/* 1 */ 1.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
-AS c1;
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(31,30) NO 0.000000000000000000000000000000
-SELECT * FROM t1;
-c1
-1.100000000000000000000000000000
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
-AS c1;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 1
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(30,30) NO 0.000000000000000000000000000000
-SELECT * FROM t1;
-c1
-0.100000000000000000000000000000
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-/* 45 */ 123456789012345678901234567890123456789012345.123456789012345678901234567890123456789012345 /* 45 */
-AS c1;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 1
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,20) NO 0.00000000000000000000
-SELECT * FROM t1;
-c1
-123456789012345678901234567890123456789012345.12345678901234567890
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-/* 65 */ 12345678901234567890123456789012345678901234567890123456789012345.1 /* 1 */
-AS c1;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 1
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
-SELECT * FROM t1;
-c1
-12345678901234567890123456789012345678901234567890123456789012345
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-/* 66 */ 123456789012345678901234567890123456789012345678901234567890123456.1 /* 1 */
-AS c1;
-Warnings:
-Warning 1264 Out of range value for column 'c1' at row 1
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,0) NO 0
-SELECT * FROM t1;
-c1
-99999999999999999999999999999999999999999999999999999999999999999
-DROP TABLE t1;
-CREATE TABLE t1 SELECT
-.123456789012345678901234567890123456789012345678901234567890123456 /* 66 */
-AS c1;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 1
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(30,30) NO 0.000000000000000000000000000000
-SELECT * FROM t1;
-c1
-0.123456789012345678901234567890
-DROP TABLE t1;
-CREATE TABLE t1 AS SELECT 123.1234567890123456789012345678901 /* 31 */ AS c1;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 1
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(33,30) NO 0.000000000000000000000000000000
-SELECT * FROM t1;
-c1
-123.123456789012345678901234567890
-DROP TABLE t1;
-CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,29) NO 0.00000000000000000000000000000
-SELECT * FROM t1;
-c1
-2.10000000000000000000000000000
-DROP TABLE t1;
-#
-# Test that the integer and decimal parts are properly calculated.
-#
-CREATE TABLE t1 (a DECIMAL(30,30));
-INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
-CREATE TABLE t2 SELECT MIN(a + 0.0000000000000000000000000000001) AS c1 FROM t1;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 3
-DESC t2;
-Field Type Null Key Default Extra
-c1 decimal(32,30) YES NULL
-DROP TABLE t1,t2;
-CREATE TABLE t1 (a DECIMAL(30,30));
-INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
-CREATE TABLE t2 SELECT IFNULL(a + 0.0000000000000000000000000000001, NULL) AS c1 FROM t1;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 1
-Note 1265 Data truncated for column 'c1' at row 2
-Note 1265 Data truncated for column 'c1' at row 3
-DESC t2;
-Field Type Null Key Default Extra
-c1 decimal(32,30) YES NULL
-DROP TABLE t1,t2;
-CREATE TABLE t1 (a DECIMAL(30,30));
-INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
-CREATE TABLE t2 SELECT CASE a WHEN 0.1 THEN 0.0000000000000000000000000000000000000000000000000000000000000000001 END AS c1 FROM t1;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 1
-DESC t2;
-Field Type Null Key Default Extra
-c1 decimal(31,30) YES NULL
-DROP TABLE t1,t2;
-#
-# Test that variables get maximum precision.
-#
-SET @decimal= 1.1;
-CREATE TABLE t1 SELECT @decimal AS c1;
-DESC t1;
-Field Type Null Key Default Extra
-c1 decimal(65,30) YES NULL
-SELECT * FROM t1;
-c1
-1.100000000000000000000000000000
-DROP TABLE t1;
=== modified file 'mysql-test/r/udf.result'
--- a/mysql-test/r/udf.result 2009-05-15 12:57:51 +0000
+++ b/mysql-test/r/udf.result 2009-09-07 09:57:22 +0000
@@ -392,4 +392,20 @@ a
4
DROP FUNCTION sequence;
DROP TABLE t1,t2;
+#
+# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1), (2), (3);
+SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b` + 1, 1 );
+b
+1
+2
+3
+SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b`, 1 );
+b
+2
+3
+1
+DROP TABLE t1;
End of 5.0 tests.
=== modified file 'mysql-test/r/update.result'
--- a/mysql-test/r/update.result 2008-11-28 16:36:07 +0000
+++ b/mysql-test/r/update.result 2009-10-23 13:09:14 +0000
@@ -503,3 +503,14 @@ ERROR HY000: Recursive stored functions
DROP TABLE t1;
DROP FUNCTION f1;
End of 5.0 tests
+#
+# Bug #47919 assert in open_table during ALTER temporary table
+#
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
+CREATE TEMPORARY TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ALTER TABLE t2 COMMENT = 'ABC';
+UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
+ALTER TABLE t2 COMMENT = 'DEF';
+DROP TABLE t1, t2;
=== modified file 'mysql-test/r/upgrade.result'
--- a/mysql-test/r/upgrade.result 2009-04-30 12:46:49 +0000
+++ b/mysql-test/r/upgrade.result 2009-08-25 13:56:50 +0000
@@ -108,11 +108,7 @@ a-b-c
show create view `a-b-c`.v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `a`.`f1` AS `f1` from (`a-b-c`.`t1` `a` join `information_schema`.`tables` `b`) where (convert(`a`.`f1` using utf8) = `b`.`TABLE_NAME`) utf8 utf8_general_ci
-Warnings:
-Note 1600 Creation context of view `a-b-c`.`v1' is invalid
select * from `a-b-c`.v1;
f1
-Warnings:
-Note 1600 Creation context of view `a-b-c`.`v1' is invalid
drop database `a-b-c`;
use test;
=== modified file 'mysql-test/r/view_grant.result'
--- a/mysql-test/r/view_grant.result 2009-08-21 14:41:48 +0000
+++ b/mysql-test/r/view_grant.result 2009-10-16 11:12:21 +0000
@@ -606,7 +606,7 @@ SHOW CREATE VIEW v;
View Create View character_set_client collation_connection
v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist
SELECT * FROM v;
ERROR HY000: The user specified as a definer ('no-such-user'@'localhost') does not exist
DROP VIEW v;
@@ -963,7 +963,7 @@ SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
@@ -971,7 +971,7 @@ SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist
@@ -979,7 +979,7 @@ SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
-Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist
DROP VIEW v1;
DROP TABLE t1;
CREATE USER mysqluser1@localhost;
@@ -1044,3 +1044,196 @@ DROP DATABASE mysqltest1;
DROP VIEW test.v3;
DROP USER mysqluser1@localhost;
USE test;
+#
+# Bug#35996: SELECT + SHOW VIEW should be enough to display view
+# definition
+#
+CREATE USER mysqluser1@localhost;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+GRANT USAGE, SELECT, CREATE VIEW, SHOW VIEW
+ON mysqltest2.* TO mysqluser1@localhost;
+USE mysqltest1;
+CREATE TABLE t1( a INT );
+CREATE TABLE t2( a INT, b INT );
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+CREATE VIEW v1 AS SELECT 1 AS a;
+CREATE VIEW v2 AS SELECT 1 AS a, 2 AS b;
+GRANT SELECT ON TABLE t1 TO mysqluser1@localhost;
+GRANT SELECT (a, b) ON TABLE t2 TO mysqluser1@localhost;
+GRANT EXECUTE ON FUNCTION f1 TO mysqluser1@localhost;
+GRANT SELECT ON TABLE v1 TO mysqluser1@localhost;
+GRANT SELECT (a, b) ON TABLE v2 TO mysqluser1@localhost;
+CREATE VIEW v_t1 AS SELECT * FROM t1;
+CREATE VIEW v_t2 AS SELECT * FROM t2;
+CREATE VIEW v_f1 AS SELECT f1() AS a;
+CREATE VIEW v_v1 AS SELECT * FROM v1;
+CREATE VIEW v_v2 AS SELECT * FROM v2;
+GRANT SELECT, SHOW VIEW ON v_t1 TO mysqluser1@localhost;
+GRANT SELECT, SHOW VIEW ON v_t2 TO mysqluser1@localhost;
+GRANT SELECT, SHOW VIEW ON v_f1 TO mysqluser1@localhost;
+GRANT SELECT, SHOW VIEW ON v_v1 TO mysqluser1@localhost;
+GRANT SELECT, SHOW VIEW ON v_v2 TO mysqluser1@localhost;
+CREATE VIEW v_mysqluser1_t1 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW v_mysqluser1_t2 AS SELECT * FROM mysqltest1.t2;
+CREATE VIEW v_mysqluser1_f1 AS SELECT mysqltest1.f1() AS a;
+CREATE VIEW v_mysqluser1_v1 AS SELECT * FROM mysqltest1.v1;
+CREATE VIEW v_mysqluser1_v2 AS SELECT * FROM mysqltest1.v2;
+SHOW CREATE VIEW mysqltest1.v_t1;
+View Create View character_set_client collation_connection
+v_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW mysqltest1.v_t2;
+View Create View character_set_client collation_connection
+v_t2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t2` AS select `mysqltest1`.`t2`.`a` AS `a`,`mysqltest1`.`t2`.`b` AS `b` from `mysqltest1`.`t2` latin1 latin1_swedish_ci
+SHOW CREATE VIEW mysqltest1.v_f1;
+View Create View character_set_client collation_connection
+v_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_f1` AS select `f1`() AS `a` latin1 latin1_swedish_ci
+SHOW CREATE VIEW mysqltest1.v_v1;
+View Create View character_set_client collation_connection
+v_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW mysqltest1.v_v2;
+View Create View character_set_client collation_connection
+v_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_t1;
+View Create View character_set_client collation_connection
+v_mysqluser1_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_t2;
+View Create View character_set_client collation_connection
+v_mysqluser1_t2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t2` AS select `mysqltest1`.`t2`.`a` AS `a`,`mysqltest1`.`t2`.`b` AS `b` from `mysqltest1`.`t2` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_f1;
+View Create View character_set_client collation_connection
+v_mysqluser1_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_f1` AS select `mysqltest1`.`f1`() AS `a` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_v1;
+View Create View character_set_client collation_connection
+v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_v2;
+View Create View character_set_client collation_connection
+v_mysqluser1_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci
+REVOKE SELECT ON TABLE t1 FROM mysqluser1@localhost;
+REVOKE SELECT (a) ON TABLE t2 FROM mysqluser1@localhost;
+REVOKE EXECUTE ON FUNCTION f1 FROM mysqluser1@localhost;
+REVOKE SELECT ON TABLE v1 FROM mysqluser1@localhost;
+SHOW CREATE VIEW mysqltest1.v_t1;
+View Create View character_set_client collation_connection
+v_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW mysqltest1.v_t2;
+View Create View character_set_client collation_connection
+v_t2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t2` AS select `mysqltest1`.`t2`.`a` AS `a`,`mysqltest1`.`t2`.`b` AS `b` from `mysqltest1`.`t2` latin1 latin1_swedish_ci
+SHOW CREATE VIEW mysqltest1.v_f1;
+View Create View character_set_client collation_connection
+v_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_f1` AS select `f1`() AS `a` latin1 latin1_swedish_ci
+SHOW CREATE VIEW mysqltest1.v_v1;
+View Create View character_set_client collation_connection
+v_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW mysqltest1.v_v2;
+View Create View character_set_client collation_connection
+v_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_t1;
+View Create View character_set_client collation_connection
+v_mysqluser1_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_t2;
+View Create View character_set_client collation_connection
+v_mysqluser1_t2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t2` AS select `mysqltest1`.`t2`.`a` AS `a`,`mysqltest1`.`t2`.`b` AS `b` from `mysqltest1`.`t2` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_f1;
+View Create View character_set_client collation_connection
+v_mysqluser1_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_f1` AS select `mysqltest1`.`f1`() AS `a` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_v1;
+View Create View character_set_client collation_connection
+v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v_mysqluser1_v2;
+View Create View character_set_client collation_connection
+v_mysqluser1_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci
+# Testing the case when the views reference missing objects.
+# Obviously, there are no privileges to check for, so we
+# need only each object type once.
+DROP TABLE t1;
+DROP FUNCTION f1;
+DROP VIEW v1;
+SHOW CREATE VIEW mysqltest1.v_t1;
+View Create View character_set_client collation_connection
+v_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SHOW CREATE VIEW mysqltest1.v_f1;
+View Create View character_set_client collation_connection
+v_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_f1` AS select `f1`() AS `a` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'mysqltest1.v_f1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SHOW CREATE VIEW mysqltest1.v_v1;
+View Create View character_set_client collation_connection
+v_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'mysqltest1.v_v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SHOW CREATE VIEW v_mysqluser1_t1;
+View Create View character_set_client collation_connection
+v_mysqluser1_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'mysqltest2.v_mysqluser1_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SHOW CREATE VIEW v_mysqluser1_f1;
+View Create View character_set_client collation_connection
+v_mysqluser1_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_f1` AS select `mysqltest1`.`f1`() AS `a` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'mysqltest2.v_mysqluser1_f1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SHOW CREATE VIEW v_mysqluser1_v1;
+View Create View character_set_client collation_connection
+v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'mysqltest2.v_mysqluser1_v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+REVOKE SHOW VIEW ON v_t1 FROM mysqluser1@localhost;
+REVOKE SHOW VIEW ON v_f1 FROM mysqluser1@localhost;
+REVOKE SHOW VIEW ON v_v1 FROM mysqluser1@localhost;
+SHOW CREATE VIEW mysqltest1.v_t1;
+ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_t1'
+SHOW CREATE VIEW mysqltest1.v_f1;
+ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_f1'
+SHOW CREATE VIEW mysqltest1.v_v1;
+ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_v1'
+SHOW CREATE VIEW v_mysqluser1_t1;
+View Create View character_set_client collation_connection
+v_mysqluser1_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'mysqltest2.v_mysqluser1_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SHOW CREATE VIEW v_mysqluser1_f1;
+View Create View character_set_client collation_connection
+v_mysqluser1_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_f1` AS select `mysqltest1`.`f1`() AS `a` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'mysqltest2.v_mysqluser1_f1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SHOW CREATE VIEW v_mysqluser1_v1;
+View Create View character_set_client collation_connection
+v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'mysqltest2.v_mysqluser1_v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+DROP USER mysqluser1@localhost;
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+USE test;
+CREATE TABLE t1( a INT );
+CREATE DEFINER = no_such_user@no_such_host VIEW v1 AS SELECT * FROM t1;
+Warnings:
+Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
+Warnings:
+Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
+DROP TABLE t1;
+DROP VIEW v1;
+#
+# Bug #46019: ERROR 1356 When selecting from within another
+# view that has Group By
+#
+CREATE DATABASE mysqltest1;
+USE mysqltest1;
+CREATE TABLE t1 (a INT);
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT a FROM t1 GROUP BY a;
+CREATE SQL SECURITY INVOKER VIEW v2 AS SELECT a FROM v1;
+CREATE USER mysqluser1;
+GRANT SELECT ON TABLE t1 TO mysqluser1;
+GRANT SELECT, SHOW VIEW ON TABLE v1 TO mysqluser1;
+GRANT SELECT, SHOW VIEW ON TABLE v2 TO mysqluser1;
+SELECT a FROM v1;
+a
+SELECT a FROM v2;
+a
+DROP USER mysqluser1;
+DROP DATABASE mysqltest1;
=== modified file 'mysql-test/r/warnings.result'
--- a/mysql-test/r/warnings.result 2009-07-06 06:55:53 +0000
+++ b/mysql-test/r/warnings.result 2009-09-10 08:49:49 +0000
@@ -313,4 +313,9 @@ ERROR 22001: Data too long for column 'c
insert into t2 values(@q);
ERROR 22001: Data too long for column 'c_tinyblob' at row 1
drop table t1, t2;
+DROP TABLE t1;
+ERROR 42S02: Unknown table 't1'
+SHOW ERRORS;
+Level Code Message
+Error 1051 Unknown table 't1'
End of 5.0 tests
=== modified file 'mysql-test/r/windows.result'
--- a/mysql-test/r/windows.result 2009-02-12 09:52:01 +0000
+++ b/mysql-test/r/windows.result 2009-09-22 11:22:07 +0000
@@ -53,3 +53,10 @@ ERROR HY000: No paths allowed for shared
execute abc;
ERROR HY000: No paths allowed for shared library
deallocate prepare abc;
+#
+# Bug#45498: Socket variable not available on Windows
+#
+SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME = 'socket';
+VARIABLE_NAME
+SOCKET
=== modified file 'mysql-test/r/xa.result'
--- a/mysql-test/r/xa.result 2009-06-25 15:25:23 +0000
+++ b/mysql-test/r/xa.result 2009-10-28 15:39:08 +0000
@@ -89,3 +89,28 @@ xa start 'a';
xa end 'a';
xa prepare 'a';
xa commit 'a';
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1),(2);
+BEGIN;
+UPDATE t1 SET a=3 WHERE a=1;
+BEGIN;
+UPDATE t1 SET a=4 WHERE a=2;
+UPDATE t1 SET a=5 WHERE a=2;
+UPDATE t1 SET a=5 WHERE a=1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+ROLLBACK;
+BEGIN;
+UPDATE t1 SET a=3 WHERE a=1;
+XA START 'xid1';
+UPDATE t1 SET a=4 WHERE a=2;
+UPDATE t1 SET a=5 WHERE a=2;
+UPDATE t1 SET a=5 WHERE a=1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+XA END 'xid1';
+ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
+XA ROLLBACK 'xid1';
+XA START 'xid1';
+XA END 'xid1';
+XA ROLLBACK 'xid1';
+DROP TABLE t1;
=== modified file 'mysql-test/std_data/Index.xml'
--- a/mysql-test/std_data/Index.xml 2007-06-07 12:55:55 +0000
+++ b/mysql-test/std_data/Index.xml 2009-10-12 07:43:15 +0000
@@ -68,4 +68,17 @@
</charset>
+ <charset name="latin1">
+ <family>Western</family>
+ <description>cp1252 West European</description>
+ <alias>csisolatin1</alias>
+ <alias>iso-8859-1</alias>
+ <alias>iso-ir-100</alias>
+ <alias>iso_8859-1</alias>
+ <alias>iso_8859-1:1987</alias>
+ <alias>l1</alias>
+ <alias>latin1</alias>
+ <collation name="latin1_test" id="99" order="test"/>
+ </charset>
+
</charsets>
=== added file 'mysql-test/std_data/binlog_transaction.000001'
Binary files a/mysql-test/std_data/binlog_transaction.000001 1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/binlog_transaction.000001 2009-09-30 02:01:52 +0000 differ
=== added file 'mysql-test/std_data/latin1.xml'
--- a/mysql-test/std_data/latin1.xml 1970-01-01 00:00:00 +0000
+++ b/mysql-test/std_data/latin1.xml 2009-10-12 09:55:59 +0000
@@ -0,0 +1,135 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<copyright>
+ Copyright (C) 2009 Sun Microsystems, Inc
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+</copyright>
+
+<charset name="latin1">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
+ 10 00 10 02 10 10 10 10 10 10 01 10 01 00 01 00
+ 00 10 10 10 10 10 10 10 10 10 02 10 02 00 02 01
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+ 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+ 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+ 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+ 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+ 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+ 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+ 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+ 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+ 20AC 0081 201A 0192 201E 2026 2020 2021 02C6 2030 0160 2039 0152 008D 017D 008F
+ 0090 2018 2019 201C 201D 2022 2013 2014 02DC 2122 0161 203A 0153 009D 017E 0178
+ 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
+ 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
+ 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
+ 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF
+ 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
+ 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF
+</map>
+</unicode>
+
+<collation name="latin1_test">
+<map>
+ 00 01 02 03 37 2D 2E 2F 16 05 25 0B 0C 0D 0E 0F
+ 10 11 12 13 3C 3D 32 26 18 19 3F 27 1C 1D 1E 1F
+ 40 4F 7F 7B 5B 6C 50 7D 4D 5D 5C 4E 6B 60 4B 61
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 7A 5E 4C 7E 6E 6F
+ 7C C1 C2 C3 C4 C5 C6 C7 C8 C9 D1 D2 D3 D4 D5 D6
+ D7 D8 D9 E2 E3 E4 E5 E6 E7 E8 E9 4A E0 5A 5F 6D
+ 79 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96
+ 97 98 99 A2 A3 A4 A5 A6 A7 A8 A9 C0 6A D0 A1 07
+ 20 21 22 23 24 15 06 17 28 29 2A 2B 2C 09 0A 1B
+ 30 31 1A 33 34 35 36 08 38 39 3A 3B 04 14 3E E1
+ 41 42 43 44 45 46 47 48 49 51 52 53 54 55 56 57
+ 58 59 62 63 64 65 66 67 68 69 70 71 72 73 74 75
+ 76 77 78 80 8A 8B 8C 8D 8E 8F 90 9A 9B 9C 9D 9E
+ 9F A0 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7
+ B8 B9 BA BB BC BD BE BF CA CB CC CD CE CF DA DB
+ DC DD DE DF EA EB EC ED EE EF FA FB FC FD FE FF
+</map>
+</collation>
+
+</charset>
+
+</charsets>
=== added file 'mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result'
--- a/mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result 2009-10-20 08:39:40 +0000
@@ -0,0 +1,50 @@
+RESET MASTER;
+CREATE TABLE t1 (a int);
+### assertion: index file contains regular entries
+SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
+SELECT @index;
+@index
+master-bin.000001
+
+### assertion: show original binlogs
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+### assertion: binlog contents from regular entries
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
+FLUSH LOGS;
+### assertion: index file contains renamed binlog and the new one
+SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
+SELECT @index;
+@index
+master-bin-b34582.000001
+master-bin.000002
+
+### assertion: original binlog content still exists, despite we
+### renamed and changed the index file
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin-b34582.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
+### assertion: user changed binlog index shows correct entries
+show binary logs;
+Log_name File_size
+master-bin-b34582.000001 #
+master-bin.000002 #
+DROP TABLE t1;
+### assertion: purging binlogs up to binlog created after instrumenting index file should work
+PURGE BINARY LOGS TO 'master-bin.000002';
+### assertion: show binary logs should only contain latest binlog
+show binary logs;
+Log_name File_size
+master-bin.000002 #
+### assertion: assert that binlog files were indeed purged (using file_exists calls)
+### assertion: assert that not purged binlog file exists
+### assertion: show index file contents and these should match show binary logs issued above
+SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
+SELECT @index;
+@index
+master-bin.000002
+
+RESET MASTER;
=== modified file 'mysql-test/suite/binlog/r/binlog_killed_simulate.result'
--- a/mysql-test/suite/binlog/r/binlog_killed_simulate.result 2008-08-15 02:31:04 +0000
+++ b/mysql-test/suite/binlog/r/binlog_killed_simulate.result 2009-09-28 12:41:10 +0000
@@ -19,7 +19,7 @@ ERROR 70100: Query execution was interru
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, b) ;file_id=#
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null;
=== added file 'mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result'
--- a/mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result 2009-10-06 00:54:00 +0000
@@ -0,0 +1,406 @@
+###################################################################################
+# CONFIGURATION
+###################################################################################
+CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
+CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
+CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
+CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
+CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
+BEGIN
+INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
+END|
+CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
+BEGIN
+INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
+END|
+###################################################################################
+# CHECK HISTORY IN BINLOG
+###################################################################################
+
+
+
+*** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
+
+INSERT INTO nt_1 VALUES ("new text 1", 1);
+BEGIN;
+INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 3", 3);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 1", 1)
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 3", 3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+INSERT INTO tt_2 VALUES ("new text 4", 4);
+BEGIN;
+INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 6", 6);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 4", 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 6", 6)
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
+
+INSERT INTO nt_1 VALUES ("new text 10", 10);
+BEGIN;
+INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
+INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
+ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 11", 11);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 10", 10)
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8)
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 11", 11)
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+INSERT INTO tt_2 VALUES ("new text 15", 15);
+BEGIN;
+INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
+INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
+ERROR 23000: Duplicate entry '15' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 16", 16);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 15", 15)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13)
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 16", 16)
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
+
+INSERT INTO nt_1 VALUES ("new text 18", 18);
+INSERT INTO nt_1 VALUES ("new text 20", 20);
+BEGIN;
+INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
+ERROR 23000: Duplicate entry '18' for key 'PRIMARY'
+INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
+ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 21", 21);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 18", 18)
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 20", 20)
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 21", 21)
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+INSERT INTO tt_2 VALUES ("new text 23", 23);
+INSERT INTO tt_2 VALUES ("new text 25", 25);
+BEGIN;
+INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
+ERROR 23000: Duplicate entry '23' for key 'PRIMARY'
+INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
+ERROR 23000: Duplicate entry '25' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 26", 26);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 23", 23)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 25", 25)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 26", 26)
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
+*** in the binlog the following entries: "Nothing".
+*** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
+
+TRUNCATE TABLE nt_2;
+TRUNCATE TABLE tt_2;
+INSERT INTO tt_2 VALUES ("new text 7", 7);
+BEGIN;
+INSERT INTO tt_2 VALUES ("new text 27", 27);
+INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
+ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 28", 28);
+ROLLBACK;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 7", 7)
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
+*** in the binlog the following entries: "B INSERT M..SELECT* R".
+
+TRUNCATE TABLE nt_2;
+TRUNCATE TABLE tt_2;
+INSERT INTO tt_2 VALUES ("new text 7", 7);
+BEGIN;
+INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
+ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 7", 7)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+
+
+
+*** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
+
+TRUNCATE TABLE nt_1;
+TRUNCATE TABLE tt_2;
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 1);
+INSERT INTO nt_1 VALUES (USER(), 2);
+INSERT INTO tt_2 VALUES (USER(), 3);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_1
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 4);
+INSERT INTO nt_1 VALUES (USER(), 5);
+INSERT INTO tt_2 VALUES (USER(), 6);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+
+
+
+*** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES (USER(), 9);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES (USER(), 12);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+
+
+
+*** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 13);
+INSERT INTO nt_1 VALUES (USER(), 14);
+INSERT INTO tt_2 VALUES (USER(), 15);
+INSERT INTO nt_1 VALUES (USER(), 16);
+INSERT INTO tt_2 VALUES (USER(), 17);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 18);
+INSERT INTO nt_1 VALUES (USER(), 19);
+INSERT INTO tt_2 VALUES (USER(), 20);
+INSERT INTO nt_1 VALUES (USER(), 21);
+INSERT INTO tt_2 VALUES (USER(), 22);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+###################################################################################
+# CLEAN
+###################################################################################
+DROP TABLE tt_1;
+DROP TABLE tt_2;
+DROP TABLE nt_1;
+DROP TABLE nt_2;
=== modified file 'mysql-test/suite/binlog/r/binlog_row_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result 2009-07-14 15:07:29 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result 2009-10-14 15:46:45 +0000
@@ -1309,3 +1309,27 @@ INSERT INTO test.t1 VALUES (1), (2);
CREATE TABLE test.t2 SELECT * FROM test.t1;
USE test;
DROP TABLES t1, t2;
+RESET MASTER;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+BINLOG '
+3u9kSA8KAAAAZgAAAGoAAAABAAQANS4xLjM1LW1hcmlhLWJldGExLWRlYnVnLWxvZwAAAAAAAAAA
+AAAAAAAAAAAAAAAAAADe72RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
+';
+INSERT INTO t1 VALUES (1);
+BINLOG '
+3u9kSBMUAAAAKQAAAJEBAAAAABoAAAAAAAAABHRlc3QAAnQxAAEDAAA=
+3u9kSBcUAAAAIgAAALMBAAAQABoAAAAAAAEAAf/+AgAAAA==
+';
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+# # Format_desc 1 # Server ver: #, Binlog ver: #
+# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
+# # Query 1 # BEGIN
+# # Table_map 1 # table_id: # (test.t1)
+# # Write_rows 1 # table_id: # flags: STMT_END_F
+# # Query 1 # COMMIT
+# # Query 1 # BEGIN
+# # Table_map 1 # table_id: # (test.t1)
+# # Write_rows 1 # table_id: # flags: STMT_END_F
+# # Query 1 # COMMIT
+DROP TABLE t1;
=== modified file 'mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result'
--- a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result 2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result 2009-11-03 10:20:08 +0000
@@ -1,17 +1,32 @@
-drop database if exists `drop-temp+table-test`;
-reset master;
-create database `drop-temp+table-test`;
-use `drop-temp+table-test`;
-create temporary table shortn1 (a int);
-create temporary table `table:name` (a int);
-create temporary table shortn2 (a int);
-select get_lock("a",10);
-get_lock("a",10)
+DROP DATABASE IF EXISTS `drop-temp+table-test`;
+RESET MASTER;
+CREATE DATABASE `drop-temp+table-test`;
+USE `drop-temp+table-test`;
+CREATE TEMPORARY TABLE shortn1 (a INT);
+CREATE TEMPORARY TABLE `table:name` (a INT);
+CREATE TEMPORARY TABLE shortn2 (a INT);
+CREATE TEMPORARY TABLE tmp(c1 int);
+CREATE TEMPORARY TABLE tmp1(c1 int);
+CREATE TEMPORARY TABLE tmp2(c1 int);
+CREATE TEMPORARY TABLE tmp3(c1 int);
+CREATE TABLE t(c1 int);
+DROP TEMPORARY TABLE IF EXISTS tmp;
+DROP TEMPORARY TABLE IF EXISTS tmp;
+DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
+DROP TEMPORARY TABLE tmp3;
+DROP TABLE IF EXISTS tmp2, t;
+DROP TABLE IF EXISTS tmp2, t;
+SELECT GET_LOCK("a",10);
+GET_LOCK("a",10)
1
-select get_lock("a",10);
-get_lock("a",10)
+USE test;
+SELECT GET_LOCK("a",10);
+GET_LOCK("a",10)
1
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # create database `drop-temp+table-test`
-drop database `drop-temp+table-test`;
+master-bin.000001 # Query # # CREATE DATABASE `drop-temp+table-test`
+master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TABLE t(c1 int)
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
+DROP DATABASE `drop-temp+table-test`;
=== added file 'mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result'
--- a/mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result 2009-10-06 00:54:00 +0000
@@ -0,0 +1,440 @@
+###################################################################################
+# CONFIGURATION
+###################################################################################
+CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
+CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
+CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
+CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
+CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
+BEGIN
+INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
+END|
+CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
+BEGIN
+INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
+END|
+###################################################################################
+# CHECK HISTORY IN BINLOG
+###################################################################################
+
+
+
+*** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
+
+INSERT INTO nt_1 VALUES ("new text 1", 1);
+BEGIN;
+INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 3", 3);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+INSERT INTO tt_2 VALUES ("new text 4", 4);
+BEGIN;
+INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 6", 6);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
+
+INSERT INTO nt_1 VALUES ("new text 10", 10);
+BEGIN;
+INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
+INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
+ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 11", 11);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+INSERT INTO tt_2 VALUES ("new text 15", 15);
+BEGIN;
+INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
+INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
+ERROR 23000: Duplicate entry '15' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 16", 16);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
+
+INSERT INTO nt_1 VALUES ("new text 18", 18);
+INSERT INTO nt_1 VALUES ("new text 20", 20);
+BEGIN;
+INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
+ERROR 23000: Duplicate entry '18' for key 'PRIMARY'
+INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
+ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 21", 21);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+INSERT INTO tt_2 VALUES ("new text 23", 23);
+INSERT INTO tt_2 VALUES ("new text 25", 25);
+BEGIN;
+INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
+ERROR 23000: Duplicate entry '23' for key 'PRIMARY'
+INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
+ERROR 23000: Duplicate entry '25' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 26", 26);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
+*** in the binlog the following entries: "Nothing".
+*** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
+
+TRUNCATE TABLE nt_2;
+TRUNCATE TABLE tt_2;
+INSERT INTO tt_2 VALUES ("new text 7", 7);
+BEGIN;
+INSERT INTO tt_2 VALUES ("new text 27", 27);
+INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
+ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES ("new text 28", 28);
+ROLLBACK;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
+*** in the binlog the following entries: "B INSERT M..SELECT* R".
+
+TRUNCATE TABLE nt_2;
+TRUNCATE TABLE tt_2;
+INSERT INTO tt_2 VALUES ("new text 7", 7);
+BEGIN;
+INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
+ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_2)
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+
+
+
+*** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
+
+TRUNCATE TABLE nt_1;
+TRUNCATE TABLE tt_2;
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 1);
+INSERT INTO nt_1 VALUES (USER(), 2);
+INSERT INTO tt_2 VALUES (USER(), 3);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_1
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 4);
+INSERT INTO nt_1 VALUES (USER(), 5);
+INSERT INTO tt_2 VALUES (USER(), 6);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+
+
+
+*** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES (USER(), 9);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO tt_2 VALUES (USER(), 12);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+
+
+
+*** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 13);
+INSERT INTO nt_1 VALUES (USER(), 14);
+INSERT INTO tt_2 VALUES (USER(), 15);
+INSERT INTO nt_1 VALUES (USER(), 16);
+INSERT INTO tt_2 VALUES (USER(), 17);
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+
+
+
+*** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
+
+BEGIN;
+INSERT INTO nt_1 VALUES (USER(), 18);
+INSERT INTO nt_1 VALUES (USER(), 19);
+INSERT INTO tt_2 VALUES (USER(), 20);
+INSERT INTO nt_1 VALUES (USER(), 21);
+INSERT INTO tt_2 VALUES (USER(), 22);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
+###################################################################################
+# CLEAN
+###################################################################################
+DROP TABLE tt_1;
+DROP TABLE tt_2;
+DROP TABLE nt_1;
+DROP TABLE nt_2;
=== modified file 'mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result'
--- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result 2009-08-26 23:13:03 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result 2009-10-06 10:25:36 +0000
@@ -133,6 +133,10 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
insert into t1 values(11);
commit;
show binlog events from <binlog_start>;
@@ -144,6 +148,8 @@ master-bin.000001 # Xid # # COMMIT /* XI
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
@@ -272,6 +278,10 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; drop table t1,t2
master-bin.000001 # Query # # use `test`; create table t0 (n int)
master-bin.000001 # Query # # BEGIN
@@ -372,7 +382,7 @@ master-bin.000001 # Query # # use `test`
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
master-bin.000001 # Query # # BEGIN
@@ -390,9 +400,11 @@ master-bin.000001 # Query # # use `test`
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
@@ -400,7 +412,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # ROLLBACK
+master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
@@ -917,7 +929,7 @@ master-bin.000001 # User var # # @`b`=_l
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
master-bin.000001 # Query # # ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
=== added file 'mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result'
--- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result 2009-10-14 13:25:11 +0000
@@ -0,0 +1,161 @@
+Verbose statements from : write-partial-row.binlog
+select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
+stmt
+### INSERT INTO mysql.ndb_apply_status
+### SET
+### @1=1
+### @2=25769803786
+### @3=''
+### @4=0
+### @5=0
+### INSERT INTO test.ba
+### SET
+### @1=3
+### @2=3
+### @3=3
+### INSERT INTO test.ba
+### SET
+### @1=1
+### @2=1
+### @3=1
+### INSERT INTO test.ba
+### SET
+### @1=2
+### @2=2
+### @3=2
+### INSERT INTO test.ba
+### SET
+### @1=4
+### @2=4
+### @3=4
+### INSERT INTO test.ba
+### SET
+### @1=4
+### @3=40
+### DELETE FROM test.ba
+### WHERE
+### @1=2
+drop table raw_binlog_rows;
+Verbose statements from : write-full-row.binlog
+select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
+stmt
+### INSERT INTO mysql.ndb_apply_status
+### SET
+### @1=2
+### @2=25769803786
+### @3=''
+### @4=0
+### @5=0
+### INSERT INTO test.ba
+### SET
+### @1=3
+### @2=3
+### @3=3
+### INSERT INTO test.ba
+### SET
+### @1=1
+### @2=1
+### @3=1
+### INSERT INTO test.ba
+### SET
+### @1=2
+### @2=2
+### @3=2
+### INSERT INTO test.ba
+### SET
+### @1=4
+### @2=4
+### @3=4
+### INSERT INTO test.ba
+### SET
+### @1=4
+### @2=4
+### @3=40
+### DELETE FROM test.ba
+### WHERE
+### @1=2
+drop table raw_binlog_rows;
+Verbose statements from : update-partial-row.binlog
+select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
+stmt
+### INSERT INTO mysql.ndb_apply_status
+### SET
+### @1=3
+### @2=25769803786
+### @3=''
+### @4=0
+### @5=0
+### INSERT INTO test.ba
+### SET
+### @1=3
+### @2=3
+### @3=3
+### INSERT INTO test.ba
+### SET
+### @1=1
+### @2=1
+### @3=1
+### INSERT INTO test.ba
+### SET
+### @1=2
+### @2=2
+### @3=2
+### INSERT INTO test.ba
+### SET
+### @1=4
+### @2=4
+### @3=4
+### UPDATE test.ba
+### WHERE
+### @1=4
+### @3=4
+### SET
+### @1=4
+### @3=40
+### DELETE FROM test.ba
+### WHERE
+### @1=2
+drop table raw_binlog_rows;
+Verbose statements from : update-full-row.binlog
+select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
+stmt
+### INSERT INTO mysql.ndb_apply_status
+### SET
+### @1=4
+### @2=25769803786
+### @3=''
+### @4=0
+### @5=0
+### INSERT INTO test.ba
+### SET
+### @1=3
+### @2=3
+### @3=3
+### INSERT INTO test.ba
+### SET
+### @1=1
+### @2=1
+### @3=1
+### INSERT INTO test.ba
+### SET
+### @1=2
+### @2=2
+### @3=2
+### INSERT INTO test.ba
+### SET
+### @1=4
+### @2=4
+### @3=4
+### UPDATE test.ba
+### WHERE
+### @1=4
+### @2=4
+### @3=4
+### SET
+### @1=4
+### @2=4
+### @3=40
+### DELETE FROM test.ba
+### WHERE
+### @1=2
+drop table raw_binlog_rows;
=== modified file 'mysql-test/suite/binlog/r/binlog_stm_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result 2009-07-15 10:25:44 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result 2009-10-14 15:46:45 +0000
@@ -784,3 +784,24 @@ INSERT INTO test.t1 VALUES (1), (2);
CREATE TABLE test.t2 SELECT * FROM test.t1;
USE test;
DROP TABLES t1, t2;
+RESET MASTER;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+BINLOG '
+3u9kSA8KAAAAZgAAAGoAAAABAAQANS4xLjM1LW1hcmlhLWJldGExLWRlYnVnLWxvZwAAAAAAAAAA
+AAAAAAAAAAAAAAAAAADe72RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
+';
+INSERT INTO t1 VALUES (1);
+BINLOG '
+3u9kSBMUAAAAKQAAAJEBAAAAABoAAAAAAAAABHRlc3QAAnQxAAEDAAA=
+3u9kSBcUAAAAIgAAALMBAAAQABoAAAAAAAEAAf/+AgAAAA==
+';
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+# # Format_desc 1 # Server ver: #, Binlog ver: #
+# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
+# # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
+# # Query 1 # BEGIN
+# # Table_map 1 # table_id: # (test.t1)
+# # Write_rows 1 # table_id: # flags: STMT_END_F
+# # Query 1 # COMMIT
+DROP TABLE t1;
=== modified file 'mysql-test/suite/binlog/r/binlog_stm_blackhole.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result 2009-05-31 05:44:41 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result 2009-09-28 12:41:10 +0000
@@ -127,7 +127,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=581
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a) ;file_id=#
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; alter table t1 add b int
master-bin.000001 # Query # # use `test`; alter table t1 drop b
=== added file 'mysql-test/suite/binlog/r/binlog_stm_do_db.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_do_db.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_do_db.result 2009-09-24 14:52:52 +0000
@@ -0,0 +1,42 @@
+SET @old_isolation_level= @@session.tx_isolation;
+SET @@session.tx_isolation= 'READ-COMMITTED';
+CREATE DATABASE b42829;
+use b42829;
+CREATE TABLE t1 (x int, y int) engine=InnoDB;
+CREATE TABLE t2 (x int, y int) engine=InnoDB;
+CREATE DATABASE b42829_filtered;
+use b42829_filtered;
+CREATE TABLE t1 (x int, y int) engine=InnoDB;
+CREATE TABLE t2 (x int, y int) engine=InnoDB;
+SET @@session.sql_log_bin= 0;
+INSERT INTO b42829_filtered.t1 VALUES (100,100);
+INSERT INTO b42829.t1 VALUES (100,100);
+SET @@session.sql_log_bin= 1;
+### assertion: the inserts will not raise log error because
+### binlog-do-db is filtering used database
+INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
+INSERT INTO t1 SELECT * FROM t2;
+### assertion: assert that despite updating a not filtered
+### database this wont trigger an error as the
+### used database is the filtered one.
+UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2;
+use b42829;
+### assertion: the statements *will* raise log error because
+### binlog-do-db is not filtering used database
+BEGIN;
+INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
+ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
+UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2;
+ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
+INSERT INTO t1 SELECT * FROM t2;
+ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
+COMMIT;
+### assertion: filtered events did not make into the binlog
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # CREATE DATABASE b42829
+master-bin.000001 # Query # # use `b42829`; CREATE TABLE t1 (x int, y int) engine=InnoDB
+master-bin.000001 # Query # # use `b42829`; CREATE TABLE t2 (x int, y int) engine=InnoDB
+DROP DATABASE b42829;
+DROP DATABASE b42829_filtered;
+SET @@session.tx_isolation= @old_isolation_level;
=== modified file 'mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result 2009-08-28 09:45:57 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result 2009-11-03 10:20:08 +0000
@@ -1,21 +1,44 @@
-drop database if exists `drop-temp+table-test`;
-reset master;
-create database `drop-temp+table-test`;
-use `drop-temp+table-test`;
-create temporary table shortn1 (a int);
-create temporary table `table:name` (a int);
-create temporary table shortn2 (a int);
-select get_lock("a",10);
-get_lock("a",10)
+DROP DATABASE IF EXISTS `drop-temp+table-test`;
+RESET MASTER;
+CREATE DATABASE `drop-temp+table-test`;
+USE `drop-temp+table-test`;
+CREATE TEMPORARY TABLE shortn1 (a INT);
+CREATE TEMPORARY TABLE `table:name` (a INT);
+CREATE TEMPORARY TABLE shortn2 (a INT);
+CREATE TEMPORARY TABLE tmp(c1 int);
+CREATE TEMPORARY TABLE tmp1(c1 int);
+CREATE TEMPORARY TABLE tmp2(c1 int);
+CREATE TEMPORARY TABLE tmp3(c1 int);
+CREATE TABLE t(c1 int);
+DROP TEMPORARY TABLE IF EXISTS tmp;
+DROP TEMPORARY TABLE IF EXISTS tmp;
+DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
+DROP TEMPORARY TABLE tmp3;
+DROP TABLE IF EXISTS tmp2, t;
+DROP TABLE IF EXISTS tmp2, t;
+SELECT GET_LOCK("a",10);
+GET_LOCK("a",10)
1
-select get_lock("a",10);
-get_lock("a",10)
+USE test;
+SELECT GET_LOCK("a",10);
+GET_LOCK("a",10)
1
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # create database `drop-temp+table-test`
-master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table shortn1 (a int)
-master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table `table:name` (a int)
-master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table shortn2 (a int)
+master-bin.000001 # Query # # CREATE DATABASE `drop-temp+table-test`
+master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE shortn1 (a INT)
+master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE `table:name` (a INT)
+master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE shortn2 (a INT)
+master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp(c1 int)
+master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp1(c1 int)
+master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp2(c1 int)
+master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp3(c1 int)
+master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TABLE t(c1 int)
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS tmp
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS tmp
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS tmp, tmp1
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE tmp3
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
+master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
-drop database `drop-temp+table-test`;
+DROP DATABASE `drop-temp+table-test`;
=== modified file 'mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result 2009-08-28 09:45:57 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result 2009-09-28 12:41:10 +0000
@@ -625,7 +625,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
master-bin.000001 # Query # # ROLLBACK
/* the output must denote there is the query */;
drop trigger trg_del_t2;
@@ -863,7 +863,7 @@ master-bin.000001 # User var # # @`b`=_l
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
master-bin.000001 # Query # # ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
=== added file 'mysql-test/suite/binlog/std_data/update-full-row.binlog'
Binary files a/mysql-test/suite/binlog/std_data/update-full-row.binlog 1970-01-01 00:00:00 +0000 and b/mysql-test/suite/binlog/std_data/update-full-row.binlog 2009-10-09 08:54:48 +0000 differ
=== added file 'mysql-test/suite/binlog/std_data/update-partial-row.binlog'
Binary files a/mysql-test/suite/binlog/std_data/update-partial-row.binlog 1970-01-01 00:00:00 +0000 and b/mysql-test/suite/binlog/std_data/update-partial-row.binlog 2009-10-09 08:54:48 +0000 differ
=== added file 'mysql-test/suite/binlog/std_data/write-full-row.binlog'
Binary files a/mysql-test/suite/binlog/std_data/write-full-row.binlog 1970-01-01 00:00:00 +0000 and b/mysql-test/suite/binlog/std_data/write-full-row.binlog 2009-10-09 08:54:48 +0000 differ
=== added file 'mysql-test/suite/binlog/std_data/write-partial-row.binlog'
Binary files a/mysql-test/suite/binlog/std_data/write-partial-row.binlog 1970-01-01 00:00:00 +0000 and b/mysql-test/suite/binlog/std_data/write-partial-row.binlog 2009-10-09 08:54:48 +0000 differ
=== added file 'mysql-test/suite/binlog/t/binlog_delete_and_flush_index.test'
--- a/mysql-test/suite/binlog/t/binlog_delete_and_flush_index.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_delete_and_flush_index.test 2009-10-20 08:39:40 +0000
@@ -0,0 +1,114 @@
+# BUG#34582: FLUSH LOGS does not close and reopen the binlog index
+# file
+#
+# WHAT
+# ====
+#
+# We want to test that FLUSH LOGS closes and reopens binlog index
+# file.
+#
+# HOW
+# ===
+#
+# PREPARE:
+# 1. create some binlog events
+# 2. show index content, binlog events and binlog contents
+# for mysql-bin.000001
+# 3. copy the mysql-bin.000001 to mysql-bin-b34582.000001
+# 4. change the index file so that mysql-bin.000001 is replaced
+# with mysql-bin-b34582.000001
+# 5. FLUSH the logs so that new index is closed and reopened
+#
+# ASSERTIONS:
+# 1. index file contents shows mysql-bin-b34582.000001 and
+# mysql-bin.000002
+# 1. show binary logs shows current index entries
+# 2. binlog contents for mysql-bin-b34582.000001 are displayed
+# 3. Purge binlogs up to the latest one succeeds
+# 4. SHOW BINARY LOGS presents the latest one only after purging
+# 5. Purged binlogs files don't exist in the filesystem
+# 6. Not purged binlog file exists in the filesystem
+#
+# CLEAN UP:
+# 1. RESET MASTER
+#
+
+-- source include/have_log_bin.inc
+
+RESET MASTER;
+
+-- let $datadir= `SELECT @@datadir`
+-- let $index=$datadir/master-bin.index
+-- chmod 0644 $index
+
+# action: issue one command so that binlog gets some event
+CREATE TABLE t1 (a int);
+
+-- echo ### assertion: index file contains regular entries
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval SET @index=LOAD_FILE('$index')
+-- replace_regex /\.[\\\/]master/master/
+SELECT @index;
+
+--echo ### assertion: show original binlogs
+-- source include/show_binary_logs.inc
+
+--echo ### assertion: binlog contents from regular entries
+-- source include/show_binlog_events.inc
+
+# action: copy binlogs to other names and change entries in index file
+-- copy_file $datadir/master-bin.000001 $datadir/master-bin-b34582.000001
+let INDEX_FILE=$index;
+perl;
+$file= $ENV{'INDEX_FILE'};
+open(FILE, ">$file") || die "Unable to open $file.";
+truncate(FILE,0);
+close ($file);
+EOF
+
+-- append_file $index
+master-bin-b34582.000001
+EOF
+
+# action: should cause rotation, and creation of new binlogs
+FLUSH LOGS;
+
+# file is not used anymore - remove it (mysql closed on flush logs).
+-- remove_file $datadir/master-bin.000001
+
+-- echo ### assertion: index file contains renamed binlog and the new one
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval SET @index=LOAD_FILE('$index')
+-- replace_regex /\.[\\\/]master/master/
+SELECT @index;
+
+-- echo ### assertion: original binlog content still exists, despite we
+-- echo ### renamed and changed the index file
+-- source include/show_binlog_events.inc
+
+-- echo ### assertion: user changed binlog index shows correct entries
+-- source include/show_binary_logs.inc
+
+DROP TABLE t1;
+
+-- echo ### assertion: purging binlogs up to binlog created after instrumenting index file should work
+-- let $current_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
+-- eval PURGE BINARY LOGS TO '$current_binlog'
+
+-- echo ### assertion: show binary logs should only contain latest binlog
+-- source include/show_binary_logs.inc
+
+-- echo ### assertion: assert that binlog files were indeed purged (using file_exists calls)
+-- error 1
+-- file_exists $datadir/master-bin-b34852.000001
+
+-- echo ### assertion: assert that not purged binlog file exists
+-- file_exists $datadir/$current_binlog
+
+-- echo ### assertion: show index file contents and these should match show binary logs issued above
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval SET @index=LOAD_FILE('$index')
+-- replace_regex /\.[\\\/]master/master/
+SELECT @index;
+
+RESET MASTER;
=== added file 'mysql-test/suite/binlog/t/binlog_mixed_failure_mixing_engines.test'
--- a/mysql-test/suite/binlog/t/binlog_mixed_failure_mixing_engines.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_mixed_failure_mixing_engines.test 2009-10-06 00:38:58 +0000
@@ -0,0 +1,4 @@
+--source include/have_binlog_format_mixed.inc
+--source include/have_innodb.inc
+
+--source extra/binlog_tests/binlog_failure_mixing_engines.test
=== added file 'mysql-test/suite/binlog/t/binlog_row_failure_mixing_engines.test'
--- a/mysql-test/suite/binlog/t/binlog_row_failure_mixing_engines.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_row_failure_mixing_engines.test 2009-10-06 00:38:58 +0000
@@ -0,0 +1,4 @@
+--source include/have_binlog_format_row.inc
+--source include/have_innodb.inc
+
+--source extra/binlog_tests/binlog_failure_mixing_engines.test
=== modified file 'mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test'
--- a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test 2009-06-07 22:28:08 +0000
+++ b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test 2009-09-30 02:31:25 +0000
@@ -112,17 +112,22 @@ while($i)
# remove unecessary files
-- remove_file $outfile.1
-- remove_file $outfile.2
-
+
+ #
+ # The two tests are canceled since we introduced the patch of bug#46998,
+ # which will make mydsqlbinlog output the 'BEGIN', 'COMMIT' and 'ROLLBACK'
+ # in regardless of database filtering
+ #
# assertion: events for database test are filtered
- if (`SELECT INSTR((a)b42941_output.1, 'test')`)
- {
- -- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.1).
- }
-
- if (`SELECT INSTR((a)b42941_output.2, 'test')`)
- {
- -- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.2).
- }
+ #if (`SELECT INSTR((a)b42941_output.1, 'test')`)
+ #{
+ #-- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.1).
+ #}
+
+ #if (`SELECT INSTR((a)b42941_output.2, 'test')`)
+ #{
+ #-- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.2).
+ #}
# assertion: events for database b42941 are not filtered
if (!`SELECT INSTR((a)b42941_output.1, 'b42941')`)
=== added file 'mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test'
--- a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test 2009-10-14 13:25:11 +0000
@@ -0,0 +1,86 @@
+########################################################
+# Test mysqlbinlog command with Ndb produced Binlog
+# variants
+#
+# WHAT
+# ====
+# This test aims to check that the mysqlbinlog --verbose
+# command can output binlogs in 4 format variants, currently
+# used by Ndb
+#
+# 1) Updates logged as write_row events
+# Only primary key and updated columns included in the
+# event
+# 2) Updates logged as write_row_events
+# All columns included in the event
+# 3) Updates logged as update_row events
+# Only primary key and updated columns included in the
+# event
+# 4) Updates logged as update_row events
+# All columns included in the event
+#
+# Format variant (1) is the Ndb default.
+# Bug#47323 resulted in binlogs generated in format (1)
+# being incorrectly parsed by the mysqlbinlog --verbose
+# option
+#
+# HOW
+# ===
+# Row-based binlog files in each format have been
+# captured from an Ndb cluster
+# These are output using the mysqlbinlog --verbose
+# tool and the output is checked.
+#
+########################################################
+
+# We require binlog_format_row as we're independent of binlog format
+# and there's no point running the same test 3 times
+-- source include/have_binlog_format_row.inc
+
+--disable_query_log
+--let $binlog_file=write-partial-row.binlog
+--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+create table raw_binlog_rows (txt varchar(1000));
+--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+--enable_query_log
+--echo Verbose statements from : $binlog_file
+# Output --verbose lines, with extra Windows CR's trimmed
+select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
+drop table raw_binlog_rows;
+
+--disable_query_log
+--let $binlog_file=write-full-row.binlog
+--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+create table raw_binlog_rows (txt varchar(1000));
+--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+--enable_query_log
+--echo Verbose statements from : $binlog_file
+# Output --verbose lines, with extra Windows CR's trimmed
+select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
+drop table raw_binlog_rows;
+
+--disable_query_log
+--let $binlog_file=update-partial-row.binlog
+--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+create table raw_binlog_rows (txt varchar(1000));
+--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+--enable_query_log
+--echo Verbose statements from : $binlog_file
+# Output --verbose lines, with extra Windows CR's trimmed
+select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
+drop table raw_binlog_rows;
+
+--disable_query_log
+--let $binlog_file=update-full-row.binlog
+--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+create table raw_binlog_rows (txt varchar(1000));
+--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+--enable_query_log
+--echo Verbose statements from : $binlog_file
+# Output --verbose lines, with extra Windows CR's trimmed
+select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
+drop table raw_binlog_rows;
=== added file 'mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt'
--- a/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt 2009-09-24 14:52:52 +0000
@@ -0,0 +1 @@
+--binlog-do-db=b42829
=== added file 'mysql-test/suite/binlog/t/binlog_stm_do_db.test'
--- a/mysql-test/suite/binlog/t/binlog_stm_do_db.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_stm_do_db.test 2009-09-24 14:52:52 +0000
@@ -0,0 +1,90 @@
+# BUG#42829: binlogging enabled for all schemas regardless of
+# binlog-db-db / binlog-ignore-db
+#
+# WHAT
+# ====
+#
+# We want to test whether filtered events from binlog will cause
+# raising an error mentioning that statement is unable to be logged or
+# not, when:
+#
+# 1. isolation level READ-COMMITTED; AND
+#
+# 2. using InnoDB engine; AND
+#
+# 3. using SBL (in which case InnoDB will only allow RBL).
+#
+# HOW
+# ===
+#
+# The test is implemented as follows:
+#
+# i) set tx_isolation to read-committed.
+#
+# ii) create two databases (one filtered other not - using
+# binlog-do-db)
+#
+# iii) Create statements that are to be filtered on filtered db
+#
+# - At this point, before fix, an error would be raised
+#
+# iv) do the same thing for not the filtered database and check
+# that events throw an error:
+#
+# - Error: ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
+#
+
+-- source include/have_log_bin.inc
+-- source include/have_innodb.inc
+-- source include/have_binlog_format_statement.inc
+
+SET @old_isolation_level= @@session.tx_isolation;
+SET @@session.tx_isolation= 'READ-COMMITTED';
+
+-- let $engine= InnoDB
+-- let $filtered= b42829_filtered
+-- let $not_filtered= b42829
+
+-- eval CREATE DATABASE $not_filtered
+-- eval use $not_filtered
+-- eval CREATE TABLE t1 (x int, y int) engine=$engine
+-- eval CREATE TABLE t2 (x int, y int) engine=$engine
+
+-- eval CREATE DATABASE $filtered
+-- eval use $filtered
+-- eval CREATE TABLE t1 (x int, y int) engine=$engine
+-- eval CREATE TABLE t2 (x int, y int) engine=$engine
+
+SET @@session.sql_log_bin= 0;
+-- eval INSERT INTO $filtered.t1 VALUES (100,100)
+-- eval INSERT INTO $not_filtered.t1 VALUES (100,100)
+SET @@session.sql_log_bin= 1;
+
+-- echo ### assertion: the inserts will not raise log error because
+-- echo ### binlog-do-db is filtering used database
+INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
+INSERT INTO t1 SELECT * FROM t2;
+
+-- echo ### assertion: assert that despite updating a not filtered
+-- echo ### database this wont trigger an error as the
+-- echo ### used database is the filtered one.
+-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
+
+-- eval use $not_filtered
+-- echo ### assertion: the statements *will* raise log error because
+-- echo ### binlog-do-db is not filtering used database
+BEGIN;
+-- error ER_BINLOG_LOGGING_IMPOSSIBLE
+INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
+-- error ER_BINLOG_LOGGING_IMPOSSIBLE
+-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
+-- error ER_BINLOG_LOGGING_IMPOSSIBLE
+INSERT INTO t1 SELECT * FROM t2;
+COMMIT;
+
+-- echo ### assertion: filtered events did not make into the binlog
+source include/show_binlog_events.inc;
+
+-- eval DROP DATABASE $not_filtered
+-- eval DROP DATABASE $filtered
+SET @@session.tx_isolation= @old_isolation_level;
=== modified file 'mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test'
--- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test 2009-07-31 13:00:35 +0000
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test 2009-10-08 12:00:43 +0000
@@ -94,15 +94,24 @@ DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
-let LOG_ERROR= `SELECT @@GLOBAL.log_error`;
+let $log_error_= `SELECT @@GLOBAL.log_error`;
+if(!`select LENGTH('$log_error_')`)
+{
+ # MySQL Server on windows is started with --console and thus
+ # does not know the location of its .err log, use default location
+ let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+}
+# Assign env variable LOG_ERROR
+let LOG_ERROR=$log_error_;
--echo # Count the number of times the "Unsafe" message was printed
--echo # to the error log.
perl;
- $log_error= $ENV{'LOG_ERROR'};
+ use strict;
+ my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
- $count = () = grep(/Bug#46265/g,<FILE>);
+ my $count = () = grep(/Bug#46265/g,<FILE>);
print "Occurrences: $count\n";
close(FILE);
EOF
=== added file 'mysql-test/suite/federated/federated_debug-master.opt'
--- a/mysql-test/suite/federated/federated_debug-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/federated/federated_debug-master.opt 2009-09-30 22:25:06 +0000
@@ -0,0 +1 @@
+--loose-debug=d,simulate_detached_thread_refresh
=== added file 'mysql-test/suite/federated/federated_debug.result'
--- a/mysql-test/suite/federated/federated_debug.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/federated/federated_debug.result 2009-11-16 20:49:51 +0000
@@ -0,0 +1,33 @@
+CREATE DATABASE federated;
+CREATE DATABASE federated;
+#
+# Bug#47525: MySQL crashed (Federated)
+#
+# Switch to slave
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1);
+# Switch to master
+CREATE TABLE t1(a INT) ENGINE=FEDERATED
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
+SELECT * FROM t1;
+a
+1
+# Start a asynchronous reload
+# Wait for tables to be closed
+# Timeout in include/wait_show_condition.inc for
+# show_statement : SHOW STATUS LIKE 'Open_tables'
+# field : Value
+# condition : = '0'
+# max_run_time : 31
+# Ensure that the server didn't crash
+SELECT * FROM t1;
+a
+1
+# Drop tables on master and slave
+DROP TABLE t1;
+DROP TABLE t1;
+# Federated cleanup
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
=== added file 'mysql-test/suite/federated/federated_debug.test'
--- a/mysql-test/suite/federated/federated_debug.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/federated/federated_debug.test 2009-09-30 22:25:06 +0000
@@ -0,0 +1,39 @@
+--source include/have_debug.inc
+--source federated.inc
+
+--echo #
+--echo # Bug#47525: MySQL crashed (Federated)
+--echo #
+
+connection slave;
+--echo # Switch to slave
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1);
+
+connection master;
+--echo # Switch to master
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1(a INT) ENGINE=FEDERATED
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+
+SELECT * FROM t1;
+
+--echo # Start a asynchronous reload
+--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= refresh 2>&1
+
+--echo # Wait for tables to be closed
+let $show_statement= SHOW STATUS LIKE 'Open_tables';
+let $field= Value;
+let $condition= = '0';
+--source include/wait_show_condition.inc
+
+--echo # Ensure that the server didn't crash
+SELECT * FROM t1;
+--echo # Drop tables on master and slave
+DROP TABLE t1;
+connection slave;
+DROP TABLE t1;
+
+connection default;
+--echo # Federated cleanup
+source federated_cleanup.inc;
=== modified file 'mysql-test/suite/federated/my.cnf'
--- a/mysql-test/suite/federated/my.cnf 2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/federated/my.cnf 2009-09-30 22:25:06 +0000
@@ -9,4 +9,7 @@ log-bin= master-bin
[ENV]
MASTER_MYPORT= @mysqld.1.port
+MASTER_MYSOCK= @mysqld.1.socket
+
SLAVE_MYPORT= @mysqld.2.port
+SLAVE_MYSOCK= @mysqld.2.socket
=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result 2009-03-13 09:16:32 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result 2009-10-28 09:23:02 +0000
@@ -130,7 +130,7 @@ NULL mysql procs_priv Db 2 NO char 64 1
NULL mysql procs_priv Grantor 6 NO char 77 231 NULL NULL utf8 utf8_bin char(77) MUL select,insert,update,references
NULL mysql procs_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
NULL mysql procs_priv Proc_priv 7 NO set 27 81 NULL NULL utf8 utf8_general_ci set('Execute','Alter Routine','Grant') select,insert,update,references
-NULL mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references
+NULL mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references
NULL mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI select,insert,update,references
NULL mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
NULL mysql procs_priv User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
@@ -411,7 +411,7 @@ NULL mysql proc modified timestamp NULL
3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60)
3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64)
3.0000 mysql procs_priv User char 16 48 utf8 utf8_bin char(16)
-3.0000 mysql procs_priv Routine_name char 64 192 utf8 utf8_bin char(64)
+3.0000 mysql procs_priv Routine_name char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql procs_priv Routine_type enum 9 27 utf8 utf8_bin enum('FUNCTION','PROCEDURE')
3.0000 mysql procs_priv Grantor char 77 231 utf8 utf8_bin char(77)
3.0000 mysql procs_priv Proc_priv set 27 81 utf8 utf8_general_ci set('Execute','Alter Routine','Grant')
=== modified file 'mysql-test/suite/funcs_1/r/is_statistics.result'
--- a/mysql-test/suite/funcs_1/r/is_statistics.result 2008-03-07 19:18:14 +0000
+++ b/mysql-test/suite/funcs_1/r/is_statistics.result 2009-10-28 09:23:02 +0000
@@ -166,8 +166,8 @@ NULL db_datadict_2 t4 0 db_datadict_2 PR
SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
-GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
GRANT SELECT ON `db_datadict`.`t1` TO 'testuser1'@'localhost' WITH GRANT OPTION
+GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
SHOW GRANTS FOR 'testuser2'@'localhost';
Grants for testuser2@localhost
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
@@ -185,8 +185,8 @@ NULL db_datadict_2 t3 0 db_datadict_2 PR
SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
-GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
GRANT SELECT ON `db_datadict`.`t1` TO 'testuser1'@'localhost' WITH GRANT OPTION
+GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
SHOW GRANTS FOR 'testuser2'@'localhost';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
# Switch to connection testuser2
=== added file 'mysql-test/suite/innodb/r/innodb-consistent.result'
--- a/mysql-test/suite/innodb/r/innodb-consistent.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb-consistent.result 2009-10-09 13:37:47 +0000
@@ -0,0 +1,35 @@
+drop table if exists t1;
+set session transaction isolation level read committed;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+create table t2 like t1;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7);
+set autocommit=0;
+begin;
+replace into t1 select * from t2;
+set session transaction isolation level read committed;
+set autocommit=0;
+delete from t2 where a=5;
+commit;
+delete from t2;
+commit;
+commit;
+begin;
+insert into t1 select * from t2;
+set session transaction isolation level read committed;
+set autocommit=0;
+delete from t2 where a=5;
+commit;
+delete from t2;
+commit;
+commit;
+select * from t1;
+a
+1
+2
+3
+4
+5
+6
+7
+drop table t1;
+drop table t2;
=== modified file 'mysql-test/suite/innodb/r/innodb-zip.result'
--- a/mysql-test/suite/innodb/r/innodb-zip.result 2009-06-10 13:51:20 +0000
+++ b/mysql-test/suite/innodb/r/innodb-zip.result 2009-11-03 10:21:39 +0000
@@ -141,7 +141,7 @@ drop table t1;
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
+CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
@@ -196,15 +196,15 @@ drop table t1;
set innodb_strict_mode = on;
create table t1 (id int primary key) engine = innodb key_block_size = 0;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16]
+Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16]
Error 1005 Can't create table 'test.t1' (errno: 1478)
create table t2 (id int primary key) engine = innodb key_block_size = 9;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
+Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t3 (id int primary key) engine = innodb key_block_size = 1;
create table t4 (id int primary key) engine = innodb key_block_size = 2;
@@ -233,30 +233,30 @@ key_block_size = 8 row_format = compress
create table t2 (id int primary key) engine = innodb
key_block_size = 8 row_format = redundant;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t3 (id int primary key) engine = innodb
key_block_size = 8 row_format = compact;
ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t3' (errno: 1478)
create table t4 (id int primary key) engine = innodb
key_block_size = 8 row_format = dynamic;
ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t4' (errno: 1478)
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t5' (errno: 1478)
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
@@ -266,26 +266,26 @@ drop table t1;
create table t1 (id int primary key) engine = innodb
key_block_size = 9 row_format = redundant;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
+Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t1' (errno: 1478)
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = compact;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
+Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = dynamic;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
+Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t2' (errno: 1478)
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
@@ -293,45 +293,45 @@ table_schema table_name row_format
set global innodb_file_per_table = off;
create table t1 (id int primary key) engine = innodb key_block_size = 1;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t1' (errno: 1478)
create table t2 (id int primary key) engine = innodb key_block_size = 2;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t3 (id int primary key) engine = innodb key_block_size = 4;
ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t3' (errno: 1478)
create table t4 (id int primary key) engine = innodb key_block_size = 8;
ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t4' (errno: 1478)
create table t5 (id int primary key) engine = innodb key_block_size = 16;
ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table 'test.t5' (errno: 1478)
create table t6 (id int primary key) engine = innodb row_format = compressed;
ERROR HY000: Can't create table 'test.t6' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
Error 1005 Can't create table 'test.t6' (errno: 1478)
create table t7 (id int primary key) engine = innodb row_format = dynamic;
ERROR HY000: Can't create table 'test.t7' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
@@ -345,45 +345,45 @@ set global innodb_file_per_table = on;
set global innodb_file_format = `0`;
create table t1 (id int primary key) engine = innodb key_block_size = 1;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t1' (errno: 1478)
create table t2 (id int primary key) engine = innodb key_block_size = 2;
ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t2' (errno: 1478)
create table t3 (id int primary key) engine = innodb key_block_size = 4;
ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t3' (errno: 1478)
create table t4 (id int primary key) engine = innodb key_block_size = 8;
ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t4' (errno: 1478)
create table t5 (id int primary key) engine = innodb key_block_size = 16;
ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t5' (errno: 1478)
create table t6 (id int primary key) engine = innodb row_format = compressed;
ERROR HY000: Can't create table 'test.t6' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t6' (errno: 1478)
create table t7 (id int primary key) engine = innodb row_format = dynamic;
ERROR HY000: Can't create table 'test.t7' (errno: 1478)
-show errors;
+show warnings;
Level Code Message
-Error 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
=== added file 'mysql-test/suite/innodb/r/innodb_bug44571.result'
--- a/mysql-test/suite/innodb/r/innodb_bug44571.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug44571.result 2009-10-08 11:28:37 +0000
@@ -0,0 +1,9 @@
+CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
+ALTER TABLE bug44571 CHANGE foo bar INT;
+ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
+ERROR 42000: Key column 'foo' doesn't exist in table
+ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
+ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
+CREATE INDEX bug44571b ON bug44571 (bar);
+ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
+DROP TABLE bug44571;
=== modified file 'mysql-test/suite/innodb/r/innodb_file_format.result'
--- a/mysql-test/suite/innodb/r/innodb_file_format.result 2009-07-30 12:42:56 +0000
+++ b/mysql-test/suite/innodb/r/innodb_file_format.result 2009-09-02 16:58:17 +0000
@@ -1,3 +1,4 @@
+call mtr.add_suppression("InnoDB: invalid innodb_file_format_check value");
select @@innodb_file_format;
@@innodb_file_format
Antelope
=== added file 'mysql-test/suite/innodb/t/innodb-consistent-master.opt'
--- a/mysql-test/suite/innodb/t/innodb-consistent-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb-consistent-master.opt 2009-10-09 13:37:47 +0000
@@ -0,0 +1 @@
+--innodb_lock_wait_timeout=2
=== added file 'mysql-test/suite/innodb/t/innodb-consistent.test'
--- a/mysql-test/suite/innodb/t/innodb-consistent.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb-consistent.test 2009-10-09 13:37:47 +0000
@@ -0,0 +1,59 @@
+-- source include/not_embedded.inc
+-- source include/have_innodb.inc
+-- source suite/innodb/include/have_innodb_plugin.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
+# a consistent read of the source table.
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+set session transaction isolation level read committed;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+create table t2 like t1;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7);
+set autocommit=0;
+
+# REPLACE INTO ... SELECT case
+begin;
+# this should not result in any locks on t2.
+replace into t1 select * from t2;
+
+connection b;
+set session transaction isolation level read committed;
+set autocommit=0;
+# should not cuase a lock wait.
+delete from t2 where a=5;
+commit;
+delete from t2;
+commit;
+connection a;
+commit;
+
+# INSERT INTO ... SELECT case
+begin;
+# this should not result in any locks on t2.
+insert into t1 select * from t2;
+
+connection b;
+set session transaction isolation level read committed;
+set autocommit=0;
+# should not cuase a lock wait.
+delete from t2 where a=5;
+commit;
+delete from t2;
+commit;
+connection a;
+commit;
+
+select * from t1;
+drop table t1;
+drop table t2;
+
+connection default;
+disconnect a;
+disconnect b;
=== modified file 'mysql-test/suite/innodb/t/innodb-zip.test'
--- a/mysql-test/suite/innodb/t/innodb-zip.test 2009-06-24 17:18:58 +0000
+++ b/mysql-test/suite/innodb/t/innodb-zip.test 2009-11-03 10:20:18 +0000
@@ -106,7 +106,7 @@ drop table t1;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
+CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
@@ -175,11 +175,11 @@ set innodb_strict_mode = on;
--error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb key_block_size = 0;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb key_block_size = 9;
-show errors;
+show warnings;
create table t3 (id int primary key) engine = innodb key_block_size = 1;
@@ -205,22 +205,22 @@ key_block_size = 8 row_format = compress
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb
key_block_size = 8 row_format = redundant;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t3 (id int primary key) engine = innodb
key_block_size = 8 row_format = compact;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t4 (id int primary key) engine = innodb
key_block_size = 8 row_format = dynamic;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
-show errors;
+show warnings;
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
@@ -230,17 +230,17 @@ drop table t1;
--error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb
key_block_size = 9 row_format = redundant;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = compact;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = dynamic;
-show errors;
+show warnings;
SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
@@ -250,25 +250,25 @@ set global innodb_file_per_table = off;
--error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb key_block_size = 1;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb key_block_size = 2;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t3 (id int primary key) engine = innodb key_block_size = 4;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t4 (id int primary key) engine = innodb key_block_size = 8;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t5 (id int primary key) engine = innodb key_block_size = 16;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t6 (id int primary key) engine = innodb row_format = compressed;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t7 (id int primary key) engine = innodb row_format = dynamic;
-show errors;
+show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
@@ -282,25 +282,25 @@ set global innodb_file_format = `0`;
--error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb key_block_size = 1;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb key_block_size = 2;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t3 (id int primary key) engine = innodb key_block_size = 4;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t4 (id int primary key) engine = innodb key_block_size = 8;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t5 (id int primary key) engine = innodb key_block_size = 16;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t6 (id int primary key) engine = innodb row_format = compressed;
-show errors;
+show warnings;
--error ER_CANT_CREATE_TABLE
create table t7 (id int primary key) engine = innodb row_format = dynamic;
-show errors;
+show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
=== added file 'mysql-test/suite/innodb/t/innodb_bug44571.test'
--- a/mysql-test/suite/innodb/t/innodb_bug44571.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug44571.test 2009-10-08 11:28:37 +0000
@@ -0,0 +1,18 @@
+#
+# Bug#44571 InnoDB Plugin crashes on ADD INDEX
+# http://bugs.mysql.com/44571
+#
+-- source include/have_innodb.inc
+-- source suite/innodb/include/have_innodb_plugin.inc
+
+CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
+ALTER TABLE bug44571 CHANGE foo bar INT;
+-- error ER_KEY_COLUMN_DOES_NOT_EXITS
+ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
+# The following will fail, because the CHANGE foo bar was
+# not communicated to InnoDB.
+--error ER_NOT_KEYFILE
+ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
+--error ER_NOT_KEYFILE
+CREATE INDEX bug44571b ON bug44571 (bar);
+DROP TABLE bug44571;
=== modified file 'mysql-test/suite/innodb/t/innodb_file_format.test'
--- a/mysql-test/suite/innodb/t/innodb_file_format.test 2009-07-30 12:42:56 +0000
+++ b/mysql-test/suite/innodb/t/innodb_file_format.test 2009-09-02 16:58:17 +0000
@@ -1,6 +1,8 @@
-- source include/have_innodb.inc
-- source suite/innodb/include/have_innodb_plugin.inc
+call mtr.add_suppression("InnoDB: invalid innodb_file_format_check value");
+
let $format=`select @@innodb_file_format`;
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
=== modified file 'mysql-test/suite/innodb/t/innodb_information_schema.test'
--- a/mysql-test/suite/innodb/t/innodb_information_schema.test 2009-06-24 17:18:58 +0000
+++ b/mysql-test/suite/innodb/t/innodb_information_schema.test 2009-11-03 10:04:18 +0000
@@ -110,14 +110,18 @@ SELECT * FROM ```t'\"_str` WHERE c1 = '3
-- send
SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE;
-# Give time to the above 2 queries to execute before continuing.
-# Without this sleep it sometimes happens that the SELECT from innodb_locks
-# executes before some of them, resulting in less than expected number
-# of rows being selected from innodb_locks.
--- sleep 0.1
-
-- enable_result_log
-- connection con_verify_innodb_locks
+# Wait for the above queries to execute before continuing.
+# Without this, it sometimes happens that the SELECT from innodb_locks
+# executes before some of them, resulting in less than expected number
+# of rows being selected from innodb_locks. If there is a bug and there
+# are no 14 rows in innodb_locks then this test will fail with timeout.
+let $count = 14;
+let $table = INFORMATION_SCHEMA.INNODB_LOCKS;
+-- source include/wait_until_rows_count.inc
+# the above enables the query log, re-disable it
+-- disable_query_log
SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data
FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data;
=== modified file 'mysql-test/suite/parts/inc/partition_auto_increment.inc'
--- a/mysql-test/suite/parts/inc/partition_auto_increment.inc 2009-02-18 21:35:28 +0000
+++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc 2009-09-04 03:57:11 +0000
@@ -623,3 +623,195 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;
+if (!$skip_negative_auto_inc)
+{
+--echo #############################################################################
+--echo # Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
+--echo # Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
+--echo ##############################################################################
+
+--echo # Inserting negative autoincrement values into a partition table (partitions >= 4)
+
+eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+ c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
+
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+DROP TABLE t;
+
+--echo # Reading from a partition table (partitions >= 2 ) after inserting a negative
+--echo # value into the auto increment column
+
+
+eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+ c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 2;
+
+INSERT INTO t VALUES (-2,-20);
+INSERT INTO t(c2) VALUES (30);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+DROP TABLE t;
+
+--echo # Inserting negative auto increment value into a partition table (partitions >= 2)
+--echo # auto increment value > 2.
+
+eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+ c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 2;
+
+INSERT INTO t VALUES (-4,-20);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+DROP TABLE t;
+
+--echo # Inserting -1 into autoincrement column of a partition table (partition >= 4)
+
+eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+ c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
+
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+INSERT INTO t(c2) VALUES (30);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+DROP TABLE t;
+
+--echo # Deleting from an auto increment table after inserting negative values
+
+eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+ c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
+
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t VALUES (-3,-20);
+INSERT INTO t(c2) VALUES (40);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+if (!$skip_delete)
+{
+DELETE FROM t WHERE c1 > 1;
+}
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+DROP TABLE t;
+
+--echo # Inserting a positive value that exceeds maximum allowed value for an
+--echo # Auto Increment column (positive maximum)
+
+eval CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+ c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
+
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+
+--error ER_DUP_ENTRY
+INSERT INTO t VALUES (128,50);
+--error ER_DUP_ENTRY
+INSERT INTO t VALUES (129,60);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+DROP TABLE t;
+
+--echo # Inserting a negative value that goes below minimum allowed value for an
+--echo # Auto Increment column (negative minimum)
+
+eval CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+ c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
+
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-127,30);
+INSERT INTO t VALUES (-128,40);
+
+--error ER_DUP_ENTRY
+INSERT INTO t VALUES (-129,50);
+--error ER_DUP_ENTRY
+INSERT INTO t VALUES (-130,60);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+DROP TABLE t;
+
+--echo # Updating the partition table with a negative Auto Increment value
+
+eval CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+ c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
+
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+if (!$skip_update)
+{
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+}
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+INSERT INTO t(c2) VALUES (40);
+INSERT INTO t(c2) VALUES (50);
+
+if (!$skip_update)
+{
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+}
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+DROP TABLE t;
+
+--echo # Updating the partition table with a value that crosses the upper limits
+--echo # on both the positive and the negative side.
+
+eval CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+ c2 INT) ENGINE=$engine PARTITION BY HASH(c1) PARTITIONS 4;
+
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+if (!$skip_update)
+{
+UPDATE t SET c1 = 130 where c1 = 127;
+}
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+if (!$skip_update)
+{
+UPDATE t SET c1 = -140 where c1 = 126;
+}
+
+SELECT * FROM t ORDER BY c1 ASC;
+
+DROP TABLE t;
+
+--echo ##############################################################################
+}
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_innodb.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result 2009-02-05 17:47:24 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result 2009-09-04 03:57:11 +0000
@@ -825,3 +825,194 @@ c1
4
5
DROP TABLE t1;
+#############################################################################
+# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
+# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
+##############################################################################
+# Inserting negative autoincrement values into a partition table (partitions >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DROP TABLE t;
+# Reading from a partition table (partitions >= 2 ) after inserting a negative
+# value into the auto increment column
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-2,-20);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-2 -20
+1 30
+DROP TABLE t;
+# Inserting negative auto increment value into a partition table (partitions >= 2)
+# auto increment value > 2.
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-4,-20);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-4 -20
+1 30
+2 40
+DROP TABLE t;
+# Inserting -1 into autoincrement column of a partition table (partition >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+DROP TABLE t;
+# Deleting from an auto increment table after inserting negative values
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t VALUES (-3,-20);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DELETE FROM t WHERE c1 > 1;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+DROP TABLE t;
+# Inserting a positive value that exceeds maximum allowed value for an
+# Auto Increment column (positive maximum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+INSERT INTO t VALUES (128,50);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+INSERT INTO t VALUES (129,60);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+DROP TABLE t;
+# Inserting a negative value that goes below minimum allowed value for an
+# Auto Increment column (negative minimum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-127,30);
+INSERT INTO t VALUES (-128,40);
+INSERT INTO t VALUES (-129,50);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+INSERT INTO t VALUES (-130,60);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 40
+-127 30
+1 10
+2 20
+DROP TABLE t;
+# Updating the partition table with a negative Auto Increment value
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+INSERT INTO t(c2) VALUES (40);
+INSERT INTO t(c2) VALUES (50);
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+4 40
+5 50
+DROP TABLE t;
+# Updating the partition table with a value that crosses the upper limits
+# on both the positive and the negative side.
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='InnoDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = 130 where c1 = 127;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = -140 where c1 = 126;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 30
+1 10
+2 20
+127 40
+DROP TABLE t;
+##############################################################################
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_maria.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_maria.result 2009-04-01 10:06:41 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_maria.result 2009-11-16 20:49:51 +0000
@@ -870,3 +870,194 @@ c1
4
5
DROP TABLE t1;
+#############################################################################
+# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
+# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
+##############################################################################
+# Inserting negative autoincrement values into a partition table (partitions >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MARIA' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DROP TABLE t;
+# Reading from a partition table (partitions >= 2 ) after inserting a negative
+# value into the auto increment column
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MARIA' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-2,-20);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-2 -20
+1 30
+DROP TABLE t;
+# Inserting negative auto increment value into a partition table (partitions >= 2)
+# auto increment value > 2.
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MARIA' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-4,-20);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-4 -20
+1 30
+2 40
+DROP TABLE t;
+# Inserting -1 into autoincrement column of a partition table (partition >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MARIA' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+DROP TABLE t;
+# Deleting from an auto increment table after inserting negative values
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MARIA' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t VALUES (-3,-20);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DELETE FROM t WHERE c1 > 1;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+DROP TABLE t;
+# Inserting a positive value that exceeds maximum allowed value for an
+# Auto Increment column (positive maximum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MARIA' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+INSERT INTO t VALUES (128,50);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+INSERT INTO t VALUES (129,60);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+DROP TABLE t;
+# Inserting a negative value that goes below minimum allowed value for an
+# Auto Increment column (negative minimum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MARIA' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-127,30);
+INSERT INTO t VALUES (-128,40);
+INSERT INTO t VALUES (-129,50);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+INSERT INTO t VALUES (-130,60);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 40
+-127 30
+1 10
+2 20
+DROP TABLE t;
+# Updating the partition table with a negative Auto Increment value
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MARIA' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+INSERT INTO t(c2) VALUES (40);
+INSERT INTO t(c2) VALUES (50);
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+4 40
+5 50
+DROP TABLE t;
+# Updating the partition table with a value that crosses the upper limits
+# on both the positive and the negative side.
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MARIA' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = 130 where c1 = 127;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = -140 where c1 = 126;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 30
+1 10
+2 20
+127 40
+DROP TABLE t;
+##############################################################################
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_memory.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result 2009-07-08 12:11:34 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result 2009-09-04 03:57:11 +0000
@@ -851,3 +851,194 @@ c1
4
5
DROP TABLE t1;
+#############################################################################
+# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
+# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
+##############################################################################
+# Inserting negative autoincrement values into a partition table (partitions >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DROP TABLE t;
+# Reading from a partition table (partitions >= 2 ) after inserting a negative
+# value into the auto increment column
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-2,-20);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-2 -20
+1 30
+DROP TABLE t;
+# Inserting negative auto increment value into a partition table (partitions >= 2)
+# auto increment value > 2.
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-4,-20);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-4 -20
+1 30
+2 40
+DROP TABLE t;
+# Inserting -1 into autoincrement column of a partition table (partition >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+DROP TABLE t;
+# Deleting from an auto increment table after inserting negative values
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t VALUES (-3,-20);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DELETE FROM t WHERE c1 > 1;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+DROP TABLE t;
+# Inserting a positive value that exceeds maximum allowed value for an
+# Auto Increment column (positive maximum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+INSERT INTO t VALUES (128,50);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+INSERT INTO t VALUES (129,60);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+DROP TABLE t;
+# Inserting a negative value that goes below minimum allowed value for an
+# Auto Increment column (negative minimum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-127,30);
+INSERT INTO t VALUES (-128,40);
+INSERT INTO t VALUES (-129,50);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+INSERT INTO t VALUES (-130,60);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 40
+-127 30
+1 10
+2 20
+DROP TABLE t;
+# Updating the partition table with a negative Auto Increment value
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+INSERT INTO t(c2) VALUES (40);
+INSERT INTO t(c2) VALUES (50);
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+4 40
+5 50
+DROP TABLE t;
+# Updating the partition table with a value that crosses the upper limits
+# on both the positive and the negative side.
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='Memory' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = 130 where c1 = 127;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = -140 where c1 = 126;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 30
+1 10
+2 20
+127 40
+DROP TABLE t;
+##############################################################################
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_myisam.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result 2009-07-08 12:11:34 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result 2009-09-04 03:57:11 +0000
@@ -870,3 +870,194 @@ c1
4
5
DROP TABLE t1;
+#############################################################################
+# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
+# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
+##############################################################################
+# Inserting negative autoincrement values into a partition table (partitions >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DROP TABLE t;
+# Reading from a partition table (partitions >= 2 ) after inserting a negative
+# value into the auto increment column
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-2,-20);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-2 -20
+1 30
+DROP TABLE t;
+# Inserting negative auto increment value into a partition table (partitions >= 2)
+# auto increment value > 2.
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-4,-20);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-4 -20
+1 30
+2 40
+DROP TABLE t;
+# Inserting -1 into autoincrement column of a partition table (partition >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+DROP TABLE t;
+# Deleting from an auto increment table after inserting negative values
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t VALUES (-3,-20);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DELETE FROM t WHERE c1 > 1;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+DROP TABLE t;
+# Inserting a positive value that exceeds maximum allowed value for an
+# Auto Increment column (positive maximum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+INSERT INTO t VALUES (128,50);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+INSERT INTO t VALUES (129,60);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+DROP TABLE t;
+# Inserting a negative value that goes below minimum allowed value for an
+# Auto Increment column (negative minimum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-127,30);
+INSERT INTO t VALUES (-128,40);
+INSERT INTO t VALUES (-129,50);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+INSERT INTO t VALUES (-130,60);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 40
+-127 30
+1 10
+2 20
+DROP TABLE t;
+# Updating the partition table with a negative Auto Increment value
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+INSERT INTO t(c2) VALUES (40);
+INSERT INTO t(c2) VALUES (50);
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+4 40
+5 50
+DROP TABLE t;
+# Updating the partition table with a value that crosses the upper limits
+# on both the positive and the negative side.
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='MyISAM' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = 130 where c1 = 127;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = -140 where c1 = 126;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 30
+1 10
+2 20
+127 40
+DROP TABLE t;
+##############################################################################
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_ndb.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_ndb.result 2009-02-18 21:35:28 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_ndb.result 2009-09-04 03:57:11 +0000
@@ -846,3 +846,194 @@ c1
4
5
DROP TABLE t1;
+#############################################################################
+# Bug #45823 - Assertion failure in file row/row0mysql.c line 1386
+# Bug #43988 - AUTO_INCREMENT errors with partitioned InnoDB tables in 5.1.31
+##############################################################################
+# Inserting negative autoincrement values into a partition table (partitions >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DROP TABLE t;
+# Reading from a partition table (partitions >= 2 ) after inserting a negative
+# value into the auto increment column
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-2,-20);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-2 -20
+1 30
+DROP TABLE t;
+# Inserting negative auto increment value into a partition table (partitions >= 2)
+# auto increment value > 2.
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 2;
+INSERT INTO t VALUES (-4,-20);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-4 -20
+1 30
+2 40
+DROP TABLE t;
+# Inserting -1 into autoincrement column of a partition table (partition >= 4)
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+DROP TABLE t;
+# Deleting from an auto increment table after inserting negative values
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+INSERT INTO t VALUES (-3,-20);
+INSERT INTO t(c2) VALUES (40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+2 20
+3 30
+4 40
+DELETE FROM t WHERE c1 > 1;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-3 -20
+-1 -10
+1 10
+DROP TABLE t;
+# Inserting a positive value that exceeds maximum allowed value for an
+# Auto Increment column (positive maximum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+INSERT INTO t VALUES (128,50);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+INSERT INTO t VALUES (129,60);
+ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+DROP TABLE t;
+# Inserting a negative value that goes below minimum allowed value for an
+# Auto Increment column (negative minimum)
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-127,30);
+INSERT INTO t VALUES (-128,40);
+INSERT INTO t VALUES (-129,50);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+INSERT INTO t VALUES (-130,60);
+ERROR 23000: Duplicate entry '-128' for key 'PRIMARY'
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 40
+-127 30
+1 10
+2 20
+DROP TABLE t;
+# Updating the partition table with a negative Auto Increment value
+CREATE TABLE t (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (-1,-10);
+INSERT INTO t(c2) VALUES (30);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-1 -10
+1 10
+2 20
+3 30
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+INSERT INTO t(c2) VALUES (40);
+INSERT INTO t(c2) VALUES (50);
+UPDATE t SET c1 = -6 WHERE c1 = 2;
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-6 20
+-1 -10
+1 10
+3 30
+4 40
+5 50
+DROP TABLE t;
+# Updating the partition table with a value that crosses the upper limits
+# on both the positive and the negative side.
+CREATE TABLE t (c1 TINYINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(c1),
+c2 INT) ENGINE='NDB' PARTITION BY HASH(c1) PARTITIONS 4;
+INSERT INTO t(c2) VALUES (10);
+INSERT INTO t(c2) VALUES (20);
+INSERT INTO t VALUES (126,30);
+INSERT INTO t VALUES (127,40);
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = 130 where c1 = 127;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+1 10
+2 20
+126 30
+127 40
+UPDATE t SET c1 = -140 where c1 = 126;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t ORDER BY c1 ASC;
+c1 c2
+-128 30
+1 10
+2 20
+127 40
+DROP TABLE t;
+##############################################################################
=== modified file 'mysql-test/suite/parts/r/partition_recover_myisam.result'
--- a/mysql-test/suite/parts/r/partition_recover_myisam.result 2008-08-19 09:44:22 +0000
+++ b/mysql-test/suite/parts/r/partition_recover_myisam.result 2009-08-29 21:29:47 +0000
@@ -1,3 +1,5 @@
+call mtr.add_suppression("./test/t1_will_crash");
+call mtr.add_suppression("Got an error from unknown thread, ha_myisam.cc");
CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
FLUSH TABLES;
=== modified file 'mysql-test/suite/parts/t/partition_auto_increment_archive.test'
--- a/mysql-test/suite/parts/t/partition_auto_increment_archive.test 2008-09-08 13:30:01 +0000
+++ b/mysql-test/suite/parts/t/partition_auto_increment_archive.test 2009-09-04 03:57:11 +0000
@@ -30,6 +30,9 @@ let $skip_delete= 1;
let $skip_truncate= 1;
let $skip_update= 1;
let $only_ai_pk= 1;
+# Bug#45823 Assertion failure in file row/row0mysql.c line 1386
+# Archive does not handle negative autoincrement values correctly
+let $skip_negative_auto_inc= 1;
##### Storage engine to be tested
let $engine= 'Archive';
=== modified file 'mysql-test/suite/parts/t/partition_auto_increment_blackhole.test'
--- a/mysql-test/suite/parts/t/partition_auto_increment_blackhole.test 2008-09-08 13:30:01 +0000
+++ b/mysql-test/suite/parts/t/partition_auto_increment_blackhole.test 2009-09-04 03:57:11 +0000
@@ -25,6 +25,9 @@
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
--source include/have_blackhole.inc
+# Bug#45823 Assertion failure in file row/row0mysql.c line 1386
+# Blackhole does not handle negative autoincrement values correctly
+let $skip_negative_auto_inc= 1;
##### Storage engine to be tested
let $engine= 'Blackhole';
=== modified file 'mysql-test/suite/parts/t/partition_recover_myisam.test'
--- a/mysql-test/suite/parts/t/partition_recover_myisam.test 2009-10-09 08:09:24 +0000
+++ b/mysql-test/suite/parts/t/partition_recover_myisam.test 2009-11-16 20:49:51 +0000
@@ -1,4 +1,8 @@
# test the auto-recover (--myisam-recover) of partitioned myisam tables
+
+call mtr.add_suppression("./test/t1_will_crash");
+call mtr.add_suppression("Got an error from unknown thread, ha_myisam.cc");
+
--source include/have_partition.inc
--disable_warnings
--disable_query_log
=== modified file 'mysql-test/suite/rpl/r/rpl_auto_increment.result'
--- a/mysql-test/suite/rpl/r/rpl_auto_increment.result 2009-04-08 16:55:26 +0000
+++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result 2009-11-16 20:49:51 +0000
@@ -244,3 +244,71 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
drop table t1;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb;
+CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=myisam;
+SET SQL_MODE='';
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t2 VALUES(NULL);
+SELECT * FROM t1;
+id
+1
+SELECT * FROM t2;
+id
+1
+INSERT INTO t1 VALUES();
+INSERT INTO t2 VALUES();
+SELECT * FROM t1;
+id
+1
+2
+SELECT * FROM t2;
+id
+1
+2
+INSERT INTO t1 VALUES(0);
+INSERT INTO t2 VALUES(0);
+SELECT * FROM t1;
+id
+1
+2
+3
+SELECT * FROM t2;
+id
+1
+2
+3
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+INSERT INTO t1 VALUES(0);
+INSERT INTO t2 VALUES(0);
+SELECT * FROM t1;
+id
+0
+1
+2
+3
+SELECT * FROM t2;
+id
+0
+1
+2
+3
+INSERT INTO t1 VALUES(4);
+INSERT INTO t2 VALUES(4);
+FLUSH LOGS;
+Comparing tables master:test.t1 and slave:test.t1
+Comparing tables master:test.t2 and slave:test.t2
+DROP TABLE t1;
+DROP TABLE t2;
+Comparing tables master:test.t1 and slave:test.t1
+Comparing tables master:test.t2 and slave:test.t2
+DROP TABLE t1;
+DROP TABLE t2;
+SET SQL_MODE='';
=== added file 'mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result'
--- a/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result 2009-09-30 23:19:36 +0000
@@ -0,0 +1,1041 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+# Test case1: INVOKES A TRIGGER with after insert action
+create table t1(a int, b int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create trigger tr1 after insert on t1 for each row insert into t2(a) values(6);
+create table t3(a int, b int) engine=innodb;
+create table t4(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t5(a int) engine=innodb;
+create trigger tr2 after insert on t3 for each row begin
+insert into t4(a) values(f1_insert_triggered());
+insert into t4(a) values(f1_insert_triggered());
+insert into t5(a) values(8);
+end |
+create table t6(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_insert_triggered() RETURNS INTEGER
+BEGIN
+INSERT INTO t6(a) values(2),(3);
+RETURN 1;
+END//
+begin;
+insert into t1(a,b) values(1,1),(2,1);
+insert into t3(a,b) values(1,1),(2,1);
+update t1 set a = a + 5 where b = 1;
+update t3 set a = a + 5 where b = 1;
+delete from t1 where b = 1;
+delete from t3 where b = 1;
+insert into t2(a) values(3);
+insert into t4(a) values(3);
+commit;
+insert into t1(a,b) values(4,2);
+insert into t3(a,b) values(4,2);
+update t1 set a = a + 5 where b = 2;
+update t3 set a = a + 5 where b = 2;
+delete from t1 where b = 2;
+delete from t3 where b = 2;
+# To verify if insert/update in an autoinc column causes statement to be logged in row format
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; insert into t2(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t4(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; update t1 set a = a + 5 where b = 1
+master-bin.000001 # Query # # use `test`; update t3 set a = a + 5 where b = 1
+master-bin.000001 # Query # # use `test`; delete from t1 where b = 1
+master-bin.000001 # Query # # use `test`; delete from t3 where b = 1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; update t1 set a = a + 5 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; update t3 set a = a + 5 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; delete from t1 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; delete from t3 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+commit;
+#Test if the results are consistent on master and slave
+#for 'INVOKES A TRIGGER with after insert action'
+Comparing tables master:test.t2 and slave:test.t2
+Comparing tables master:test.t4 and slave:test.t4
+Comparing tables master:test.t6 and slave:test.t6
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP FUNCTION f1_insert_triggered;
+# Test case2: INVOKES A TRIGGER with before insert action
+create table t1(a int, b int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create trigger tr1 before insert on t1 for each row insert into t2(a) values(6);
+create table t3(a int, b int) engine=innodb;
+create table t4(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t5(a int) engine=innodb;
+create trigger tr2 before insert on t3 for each row begin
+insert into t4(a) values(f1_insert_triggered());
+insert into t4(a) values(f1_insert_triggered());
+insert into t5(a) values(8);
+end |
+create table t6(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_insert_triggered() RETURNS INTEGER
+BEGIN
+INSERT INTO t6(a) values(2),(3);
+RETURN 1;
+END//
+begin;
+insert into t1(a,b) values(1,1),(2,1);
+insert into t3(a,b) values(1,1),(2,1);
+update t1 set a = a + 5 where b = 1;
+update t3 set a = a + 5 where b = 1;
+delete from t1 where b = 1;
+delete from t3 where b = 1;
+insert into t2(a) values(3);
+insert into t4(a) values(3);
+commit;
+insert into t1(a,b) values(4,2);
+insert into t3(a,b) values(4,2);
+update t1 set a = a + 5 where b = 2;
+update t3 set a = a + 5 where b = 2;
+delete from t1 where b = 2;
+delete from t3 where b = 2;
+# To verify if insert/update in an autoinc column causes statement to be logged in row format
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; insert into t2(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t4(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; update t1 set a = a + 5 where b = 1
+master-bin.000001 # Query # # use `test`; update t3 set a = a + 5 where b = 1
+master-bin.000001 # Query # # use `test`; delete from t1 where b = 1
+master-bin.000001 # Query # # use `test`; delete from t3 where b = 1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; update t1 set a = a + 5 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; update t3 set a = a + 5 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; delete from t1 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; delete from t3 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+commit;
+#Test if the results are consistent on master and slave
+#for 'INVOKES A TRIGGER with before insert action'
+Comparing tables master:test.t2 and slave:test.t2
+Comparing tables master:test.t4 and slave:test.t4
+Comparing tables master:test.t6 and slave:test.t6
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP FUNCTION f1_insert_triggered;
+# Test case3: INVOKES A TRIGGER with after update action
+create table t1(a int, b int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create trigger tr1 after update on t1 for each row insert into t2(a) values(6);
+create table t3(a int, b int) engine=innodb;
+create table t4(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t5(a int) engine=innodb;
+create trigger tr2 after update on t3 for each row begin
+insert into t4(a) values(f1_insert_triggered());
+insert into t4(a) values(f1_insert_triggered());
+insert into t5(a) values(8);
+end |
+create table t6(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_insert_triggered() RETURNS INTEGER
+BEGIN
+INSERT INTO t6(a) values(2),(3);
+RETURN 1;
+END//
+begin;
+insert into t1(a,b) values(1,1),(2,1);
+insert into t3(a,b) values(1,1),(2,1);
+update t1 set a = a + 5 where b = 1;
+update t3 set a = a + 5 where b = 1;
+delete from t1 where b = 1;
+delete from t3 where b = 1;
+insert into t2(a) values(3);
+insert into t4(a) values(3);
+commit;
+insert into t1(a,b) values(4,2);
+insert into t3(a,b) values(4,2);
+update t1 set a = a + 5 where b = 2;
+update t3 set a = a + 5 where b = 2;
+delete from t1 where b = 2;
+delete from t3 where b = 2;
+# To verify if insert/update in an autoinc column causes statement to be logged in row format
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; insert into t2(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t4(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(1,1),(2,1)
+master-bin.000001 # Query # # use `test`; insert into t3(a,b) values(1,1),(2,1)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Update_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Update_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Update_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Update_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; delete from t1 where b = 1
+master-bin.000001 # Query # # use `test`; delete from t3 where b = 1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(4,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t3(a,b) values(4,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Update_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Update_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; delete from t1 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; delete from t3 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+commit;
+#Test if the results are consistent on master and slave
+#for 'INVOKES A TRIGGER with after update action'
+Comparing tables master:test.t2 and slave:test.t2
+Comparing tables master:test.t4 and slave:test.t4
+Comparing tables master:test.t6 and slave:test.t6
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP FUNCTION f1_insert_triggered;
+# Test case4: INVOKES A TRIGGER with before update action
+create table t1(a int, b int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create trigger tr1 before update on t1 for each row insert into t2(a) values(6);
+create table t3(a int, b int) engine=innodb;
+create table t4(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t5(a int) engine=innodb;
+create trigger tr2 before update on t3 for each row begin
+insert into t4(a) values(f1_insert_triggered());
+insert into t4(a) values(f1_insert_triggered());
+insert into t5(a) values(8);
+end |
+create table t6(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_insert_triggered() RETURNS INTEGER
+BEGIN
+INSERT INTO t6(a) values(2),(3);
+RETURN 1;
+END//
+begin;
+insert into t1(a,b) values(1,1),(2,1);
+insert into t3(a,b) values(1,1),(2,1);
+update t1 set a = a + 5 where b = 1;
+update t3 set a = a + 5 where b = 1;
+delete from t1 where b = 1;
+delete from t3 where b = 1;
+insert into t2(a) values(3);
+insert into t4(a) values(3);
+commit;
+insert into t1(a,b) values(4,2);
+insert into t3(a,b) values(4,2);
+update t1 set a = a + 5 where b = 2;
+update t3 set a = a + 5 where b = 2;
+delete from t1 where b = 2;
+delete from t3 where b = 2;
+# To verify if insert/update in an autoinc column causes statement to be logged in row format
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; insert into t2(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t4(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(1,1),(2,1)
+master-bin.000001 # Query # # use `test`; insert into t3(a,b) values(1,1),(2,1)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Update_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Update_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; delete from t1 where b = 1
+master-bin.000001 # Query # # use `test`; delete from t3 where b = 1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(4,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t3(a,b) values(4,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; delete from t1 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; delete from t3 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+commit;
+#Test if the results are consistent on master and slave
+#for 'INVOKES A TRIGGER with before update action'
+Comparing tables master:test.t2 and slave:test.t2
+Comparing tables master:test.t4 and slave:test.t4
+Comparing tables master:test.t6 and slave:test.t6
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP FUNCTION f1_insert_triggered;
+# Test case5: INVOKES A TRIGGER with after delete action
+create table t1(a int, b int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create trigger tr1 after delete on t1 for each row insert into t2(a) values(6);
+create table t3(a int, b int) engine=innodb;
+create table t4(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t5(a int) engine=innodb;
+create trigger tr2 after delete on t3 for each row begin
+insert into t4(a) values(f1_insert_triggered());
+insert into t4(a) values(f1_insert_triggered());
+insert into t5(a) values(8);
+end |
+create table t6(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_insert_triggered() RETURNS INTEGER
+BEGIN
+INSERT INTO t6(a) values(2),(3);
+RETURN 1;
+END//
+begin;
+insert into t1(a,b) values(1,1),(2,1);
+insert into t3(a,b) values(1,1),(2,1);
+update t1 set a = a + 5 where b = 1;
+update t3 set a = a + 5 where b = 1;
+delete from t1 where b = 1;
+delete from t3 where b = 1;
+insert into t2(a) values(3);
+insert into t4(a) values(3);
+commit;
+insert into t1(a,b) values(4,2);
+insert into t3(a,b) values(4,2);
+update t1 set a = a + 5 where b = 2;
+update t3 set a = a + 5 where b = 2;
+delete from t1 where b = 2;
+delete from t3 where b = 2;
+# To verify if insert/update in an autoinc column causes statement to be logged in row format
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; insert into t2(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t4(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(1,1),(2,1)
+master-bin.000001 # Query # # use `test`; insert into t3(a,b) values(1,1),(2,1)
+master-bin.000001 # Query # # use `test`; update t1 set a = a + 5 where b = 1
+master-bin.000001 # Query # # use `test`; update t3 set a = a + 5 where b = 1
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Delete_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Delete_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Delete_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Delete_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(4,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t3(a,b) values(4,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; update t1 set a = a + 5 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; update t3 set a = a + 5 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Delete_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Delete_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+commit;
+#Test if the results are consistent on master and slave
+#for 'INVOKES A TRIGGER with after delete action'
+Comparing tables master:test.t2 and slave:test.t2
+Comparing tables master:test.t4 and slave:test.t4
+Comparing tables master:test.t6 and slave:test.t6
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP FUNCTION f1_insert_triggered;
+# Test case6: INVOKES A TRIGGER with before delete action
+create table t1(a int, b int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create trigger tr1 before delete on t1 for each row insert into t2(a) values(6);
+create table t3(a int, b int) engine=innodb;
+create table t4(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t5(a int) engine=innodb;
+create trigger tr2 before delete on t3 for each row begin
+insert into t4(a) values(f1_insert_triggered());
+insert into t4(a) values(f1_insert_triggered());
+insert into t5(a) values(8);
+end |
+create table t6(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_insert_triggered() RETURNS INTEGER
+BEGIN
+INSERT INTO t6(a) values(2),(3);
+RETURN 1;
+END//
+begin;
+insert into t1(a,b) values(1,1),(2,1);
+insert into t3(a,b) values(1,1),(2,1);
+update t1 set a = a + 5 where b = 1;
+update t3 set a = a + 5 where b = 1;
+delete from t1 where b = 1;
+delete from t3 where b = 1;
+insert into t2(a) values(3);
+insert into t4(a) values(3);
+commit;
+insert into t1(a,b) values(4,2);
+insert into t3(a,b) values(4,2);
+update t1 set a = a + 5 where b = 2;
+update t3 set a = a + 5 where b = 2;
+delete from t1 where b = 2;
+delete from t3 where b = 2;
+# To verify if insert/update in an autoinc column causes statement to be logged in row format
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; insert into t2(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t4(a) values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(1,1),(2,1)
+master-bin.000001 # Query # # use `test`; insert into t3(a,b) values(1,1),(2,1)
+master-bin.000001 # Query # # use `test`; update t1 set a = a + 5 where b = 1
+master-bin.000001 # Query # # use `test`; update t3 set a = a + 5 where b = 1
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Delete_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Delete_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(4,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t3(a,b) values(4,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; update t1 set a = a + 5 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; update t3 set a = a + 5 where b = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Table_map # # table_id: # (test.t5)
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+master-bin.000001 # Table_map # # table_id: # (test.t6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+commit;
+#Test if the results are consistent on master and slave
+#for 'INVOKES A TRIGGER with before delete action'
+Comparing tables master:test.t2 and slave:test.t2
+Comparing tables master:test.t4 and slave:test.t4
+Comparing tables master:test.t6 and slave:test.t6
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP FUNCTION f1_insert_triggered;
+# Test case7: CALLS A FUNCTION which INVOKES A TRIGGER with after insert action
+create table t1(a int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_two_inserts_trigger() RETURNS INTEGER
+BEGIN
+INSERT INTO t2(a) values(2),(3);
+INSERT INTO t2(a) values(2),(3);
+RETURN 1;
+END |
+create trigger tr11 after insert on t2 for each row begin
+insert into t3(a) values(new.a);
+insert into t3(a) values(new.a);
+end |
+begin;
+insert into t1(a) values(f1_two_inserts_trigger());
+insert into t2(a) values(4),(5);
+commit;
+insert into t1(a) values(f1_two_inserts_trigger());
+# To verify if insert/update in an autoinc column causes statement to be logged in row format
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+commit;
+#Test if the results are consistent on master and slave
+#for 'CALLS A FUNCTION which INVOKES A TRIGGER with after insert action'
+Comparing tables master:test.t2 and slave:test.t2
+Comparing tables master:test.t3 and slave:test.t3
+drop table t1;
+drop table t2;
+drop table t3;
+drop function f1_two_inserts_trigger;
+# Test case8: CALLS A FUNCTION which INVOKES A TRIGGER with before insert action
+create table t1(a int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create table t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_two_inserts_trigger() RETURNS INTEGER
+BEGIN
+INSERT INTO t2(a) values(2),(3);
+INSERT INTO t2(a) values(2),(3);
+RETURN 1;
+END |
+create trigger tr11 before insert on t2 for each row begin
+insert into t3(a) values(new.a);
+insert into t3(a) values(new.a);
+end |
+begin;
+insert into t1(a) values(f1_two_inserts_trigger());
+insert into t2(a) values(4),(5);
+commit;
+insert into t1(a) values(f1_two_inserts_trigger());
+# To verify if insert/update in an autoinc column causes statement to be logged in row format
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+commit;
+#Test if the results are consistent on master and slave
+#for 'CALLS A FUNCTION which INVOKES A TRIGGER with before insert action'
+Comparing tables master:test.t2 and slave:test.t2
+Comparing tables master:test.t3 and slave:test.t3
+drop table t1;
+drop table t2;
+drop table t3;
+drop function f1_two_inserts_trigger;
+# Test case9: INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS with after insert action
+CREATE TABLE t1(i1 int not null auto_increment, c1 INT, primary key(i1)) engine=innodb;
+CREATE TABLE t2(i1 int not null auto_increment, c2 INT, primary key(i1)) engine=innodb;
+CREATE TABLE t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create trigger tr16 after insert on t1 for each row insert into t3(a) values(new.c1);
+create trigger tr17 after insert on t2 for each row insert into t3(a) values(new.c2);
+begin;
+INSERT INTO t1(c1) VALUES (11), (12);
+INSERT INTO t2(c2) VALUES (13), (14);
+CREATE VIEW v16 AS SELECT c1, c2 FROM t1, t2;
+INSERT INTO v16(c1) VALUES (15),(16);
+INSERT INTO v16(c2) VALUES (17),(18);
+INSERT INTO v16(c1) VALUES (19),(20);
+INSERT INTO v16(c2) VALUES (21),(22);
+INSERT INTO v16(c1) VALUES (23), (24);
+INSERT INTO v16(c1) VALUES (25), (26);
+commit;
+#Test if the results are consistent on master and slave
+#for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS'
+Comparing tables master:test.t3 and slave:test.t3
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP VIEW v16;
+# Test case10: INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS with before insert action
+CREATE TABLE t1(i1 int not null auto_increment, c1 INT, primary key(i1)) engine=innodb;
+CREATE TABLE t2(i1 int not null auto_increment, c2 INT, primary key(i1)) engine=innodb;
+CREATE TABLE t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+create trigger tr16 before insert on t1 for each row insert into t3(a) values(new.c1);
+create trigger tr17 before insert on t2 for each row insert into t3(a) values(new.c2);
+begin;
+INSERT INTO t1(c1) VALUES (11), (12);
+INSERT INTO t2(c2) VALUES (13), (14);
+CREATE VIEW v16 AS SELECT c1, c2 FROM t1, t2;
+INSERT INTO v16(c1) VALUES (15),(16);
+INSERT INTO v16(c2) VALUES (17),(18);
+INSERT INTO v16(c1) VALUES (19),(20);
+INSERT INTO v16(c2) VALUES (21),(22);
+INSERT INTO v16(c1) VALUES (23), (24);
+INSERT INTO v16(c1) VALUES (25), (26);
+commit;
+#Test if the results are consistent on master and slave
+#for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS'
+Comparing tables master:test.t3 and slave:test.t3
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP VIEW v16;
+# Test case11: INVOKES A FUNCTION TO INSERT TWO OR MORE VALUES INTO A TABLE WITH AUTOINC COLUMN
+create table t1(a int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_two_inserts() RETURNS INTEGER
+BEGIN
+INSERT INTO t2(a) values(2);
+INSERT INTO t2(a) values(2);
+RETURN 1;
+END//
+begin;
+insert into t1(a) values(f1_two_inserts());
+insert into t2(a) values(4),(5);
+commit;
+insert into t1(a) values(f1_two_inserts());
+commit;
+#Test result for INVOKES A FUNCTION TO INSERT TWO OR MORE VALUES on master
+select * from t2 ORDER BY i1;
+i1 a
+1 2
+2 2
+3 4
+4 5
+5 2
+6 2
+#Test result for INVOKES A FUNCTION TO INSERT TWO OR MORE VALUES on slave
+select * from t2 ORDER BY i1;
+i1 a
+1 2
+2 2
+3 4
+4 5
+5 2
+6 2
+drop table t1;
+drop table t2;
+drop function f1_two_inserts;
+# Test case12: INVOKES A FUNCTION TO UPDATE TWO OR MORE VALUES OF A TABLE WITH AUTOINC COLUMN
+create table t1(a int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, b int, primary key(i1)) engine=innodb;
+CREATE FUNCTION f1_two_updates() RETURNS INTEGER
+BEGIN
+update t2 set a = a + 5 where b = 1;
+update t2 set a = a + 5 where b = 2;
+update t2 set a = a + 5 where b = 3;
+update t2 set a = a + 5 where b = 4;
+RETURN 1;
+END//
+insert into t2(a,b) values(1,1);
+insert into t2(a,b) values(2,2);
+insert into t2(a,b) values(3,3);
+insert into t2(a,b) values(4,4);
+insert into t1(a) values(f1_two_updates());
+begin;
+insert into t1(a) values(f1_two_updates());
+commit;
+#Test result for INVOKES A FUNCTION TO UPDATE TWO OR MORE VALUES on master
+select * from t2 ORDER BY i1;
+i1 a b
+1 11 1
+2 12 2
+3 13 3
+4 14 4
+#Test result for INVOKES A FUNCTION TO UPDATE TWO OR MORE VALUES on slave
+select * from t2 ORDER BY i1;
+i1 a b
+1 11 1
+2 12 2
+3 13 3
+4 14 4
+drop table t1;
+drop table t2;
+drop function f1_two_updates;
+# Test case13: UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT
+create table t1(i1 int not null auto_increment, a int, b int, primary key(i1)) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, b int, primary key(i1)) engine=innodb;
+begin;
+insert into t1(a,b) values(1,1),(2,2);
+insert into t2(a,b) values(1,1),(2,2);
+update t1,t2 set t1.a=t1.a+5, t2.a=t2.a+5 where t1.b=t2.b;
+insert into t1(a,b) values(3,3);
+insert into t2(a,b) values(3,3);
+commit;
+# To verify if it works fine when these statements are not be marked as unsafe
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(1,1),(2,2)
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t2(a,b) values(1,1),(2,2)
+master-bin.000001 # Query # # use `test`; update t1,t2 set t1.a=t1.a+5, t2.a=t2.a+5 where t1.b=t2.b
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; insert into t1(a,b) values(3,3)
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; insert into t2(a,b) values(3,3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+#Test if the results are consistent on master and slave
+#for 'UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT'
+Comparing tables master:test.t1 and slave:test.t1
+Comparing tables master:test.t2 and slave:test.t2
+drop table t1;
+drop table t2;
+# Test case14: INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES
+CREATE TABLE t1(i1 int not null auto_increment, c1 INT, primary key(i1)) engine=innodb;
+CREATE TABLE t2(i1 int not null auto_increment, c2 INT, primary key(i1)) engine=innodb;
+begin;
+INSERT INTO t1(c1) VALUES (11), (12);
+INSERT INTO t2(c2) VALUES (13), (14);
+CREATE VIEW v15 AS SELECT c1, c2 FROM t1, t2;
+INSERT INTO v15(c1) VALUES (15),(16);
+INSERT INTO v15(c2) VALUES (17),(18);
+INSERT INTO v15(c1) VALUES (19),(20);
+INSERT INTO v15(c2) VALUES (21),(22);
+INSERT INTO v15(c1) VALUES (23), (24);
+INSERT INTO v15(c2) VALUES (25), (26);
+commit;
+# To verify if it works fine when these statements are not be marked as unsafe
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; INSERT INTO t1(c1) VALUES (11), (12)
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; INSERT INTO t2(c2) VALUES (13), (14)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v15` AS SELECT c1, c2 FROM t1, t2
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; INSERT INTO v15(c1) VALUES (15),(16)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; INSERT INTO v15(c2) VALUES (17),(18)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; INSERT INTO v15(c1) VALUES (19),(20)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; INSERT INTO v15(c2) VALUES (21),(22)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=7
+master-bin.000001 # Query # # use `test`; INSERT INTO v15(c1) VALUES (23), (24)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Intvar # # INSERT_ID=7
+master-bin.000001 # Query # # use `test`; INSERT INTO v15(c2) VALUES (25), (26)
+master-bin.000001 # Xid # # COMMIT /* XID */
+#Test if the results are consistent on master and slave
+#for 'INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES'
+Comparing tables master:test.t1 and slave:test.t1
+Comparing tables master:test.t2 and slave:test.t2
+drop table t1;
+drop table t2;
+drop view v15;
=== modified file 'mysql-test/suite/rpl/r/rpl_bug33931.result'
--- a/mysql-test/suite/rpl/r/rpl_bug33931.result 2009-02-11 11:56:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_bug33931.result 2009-08-28 14:13:27 +0000
@@ -1,5 +1,5 @@
reset master;
-call mtr.add_suppression("Failed during slave thread initialization");
+call mtr.add_suppression("Failed during slave I/O thread initialization");
stop slave;
reset slave;
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
=== modified file 'mysql-test/suite/rpl/r/rpl_do_grant.result'
--- a/mysql-test/suite/rpl/r/rpl_do_grant.result 2009-03-18 13:48:23 +0000
+++ b/mysql-test/suite/rpl/r/rpl_do_grant.result 2009-09-01 11:38:17 +0000
@@ -166,4 +166,7 @@ DROP FUNCTION upgrade_del_func;
DROP FUNCTION upgrade_alter_func;
DROP DATABASE bug42217_db;
DROP USER 'create_rout_db'@'localhost';
+call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
+USE mtr;
+call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
"End of test"
=== modified file 'mysql-test/suite/rpl/r/rpl_extraCol_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result 2008-11-04 07:43:21 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result 2009-08-28 14:13:27 +0000
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
**** Diff Table Def Start ****
*** On Slave ***
STOP SLAVE;
=== modified file 'mysql-test/suite/rpl/r/rpl_extraCol_myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result 2008-11-04 07:43:21 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result 2009-08-28 14:13:27 +0000
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
**** Diff Table Def Start ****
*** On Slave ***
STOP SLAVE;
=== modified file 'mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result'
--- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result 2009-09-18 19:02:57 +0000
+++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result 2009-11-16 20:49:51 +0000
@@ -4,6 +4,10 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+call mtr.add_suppression("Get master clock failed with error: ");
+call mtr.add_suppression("Get master SERVER_ID failed with error: ");
+call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again");
+call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
SELECT IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP");
IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP")
1
=== modified file 'mysql-test/suite/rpl/r/rpl_idempotency.result'
--- a/mysql-test/suite/rpl/r/rpl_idempotency.result 2009-04-05 12:03:04 +0000
+++ b/mysql-test/suite/rpl/r/rpl_idempotency.result 2009-08-25 13:56:50 +0000
@@ -4,7 +4,8 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032");
+call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032");
+call mtr.add_suppression("Slave: Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451");
call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452");
SET @old_slave_exec_mode= @@global.slave_exec_mode;
CREATE TABLE t1 (a INT PRIMARY KEY);
=== modified file 'mysql-test/suite/rpl/r/rpl_init_slave_errors.result'
--- a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result 2009-04-06 00:22:34 +0000
+++ b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result 2009-08-28 14:13:27 +0000
@@ -9,6 +9,7 @@ reset slave;
SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
Reporting the following error: Failed during slave thread initialization
+call mtr.add_suppression("Failed during slave I/O thread initialization");
SET GLOBAL debug= "";
stop slave;
reset slave;
=== modified file 'mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result'
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result 2009-08-29 08:52:22 +0000
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result 2009-09-28 12:41:10 +0000
@@ -885,7 +885,7 @@ master-bin.000001 # Query 1 # use `test_
master-bin.000001 # Xid 1 # #
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=#
+master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, b) ;file_id=#
master-bin.000001 # Xid 1 # #
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
=== modified file 'mysql-test/suite/rpl/r/rpl_loaddata.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddata.result 2008-11-13 19:19:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_loaddata.result 2009-10-27 15:15:53 +0000
@@ -36,7 +36,7 @@ set global sql_slave_skip_counter=1;
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1797 # # master-bin.000001 Yes Yes # 0 0 1797 # None 0 No # No 0 0
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 2009 # # master-bin.000001 Yes Yes # 0 0 2009 # None 0 No # No 0 0
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@@ -46,7 +46,7 @@ change master to master_user='test';
change master to master_user='root';
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1832 # # master-bin.000001 No No # 0 0 1832 # None 0 No # No 0 0
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 2044 # # master-bin.000001 No No # 0 0 2044 # None 0 No # No 0 0
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@@ -86,3 +86,32 @@ CREATE TABLE t1 (word CHAR(20) NOT NULL
LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY'
DROP TABLE IF EXISTS t1;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists b48297_db1;
+drop database if exists b42897_db2;
+create database b48297_db1;
+create database b42897_db2;
+use b48297_db1;
+CREATE TABLE t1 (c1 VARCHAR(256)) engine=MyISAM;;
+use b42897_db2;
+### assertion: works with cross-referenced database
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
+use b48297_db1;
+### assertion: works with fully qualified name on current database
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
+### assertion: works without fully qualified name on current database
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1;
+### create connection without default database
+### connect (conn2,localhost,root,,*NO-ONE*);
+### assertion: works without stating the default database
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
+### disconnect and switch back to master connection
+use b48297_db1;
+Comparing tables master:b48297_db1.t1 and slave:b48297_db1.t1
+DROP DATABASE b48297_db1;
+DROP DATABASE b42897_db2;
=== modified file 'mysql-test/suite/rpl/r/rpl_loaddata_fatal.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result 2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result 2009-09-28 12:41:10 +0000
@@ -53,7 +53,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 465
+Read_Master_Log_Pos 556
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
=== modified file 'mysql-test/suite/rpl/r/rpl_loaddata_map.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddata_map.result 2008-07-18 11:34:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_map.result 2009-09-28 12:41:10 +0000
@@ -20,7 +20,7 @@ master-bin.000001 # Query # # use `test`
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Append_block # # ;file_id=#;block_len=#
master-bin.000001 # Append_block # # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query # # use `test`; load data infile 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2 ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (id) ;file_id=#
==== Verify results on slave ====
[on slave]
select count(*) from t2 /* 5 000 */;
=== modified file 'mysql-test/suite/rpl/r/rpl_loaddatalocal.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result 2009-03-16 08:21:29 +0000
+++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result 2009-09-28 12:41:10 +0000
@@ -54,3 +54,31 @@ a
[on master]
DROP TABLE t1;
[on slave]
+
+Bug #43746:
+"return wrong query string when parse 'load data infile' sql statement"
+
+[master]
+SELECT @@SESSION.sql_mode INTO @old_mode;
+SET sql_mode='ignore_space';
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2), (3), (4);
+SELECT * INTO OUTFILE 'MYSQLD_DATADIR/bug43746.sql' FROM t1;
+TRUNCATE TABLE t1;
+LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
+LOAD/* look mum, with comments in weird places! */DATA/* oh hai */LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql'/* we are */INTO/* from the internets */TABLE t1;
+LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
+LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO */ TABLE t1;
+LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO TABLE */ t1;
+LOAD DATA /*!10000 LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE */ t1;
+LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql'/*!10000 INTO*/TABLE t1;
+LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql'/* empty */INTO TABLE t1;
+LOAD DATA/*!10000 LOCAL */INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO/* empty */TABLE t1;
+LOAD/*!99999 special comments that do not expand */DATA/*!99999 code from the future */LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql'/*!99999 have flux capacitor */INTO/*!99999 will travel */TABLE t1;
+SET sql_mode='PIPES_AS_CONCAT,ANSI_QUOTES,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER';
+LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
+[slave]
+[master]
+DROP TABLE t1;
+SET SESSION sql_mode=@old_mode;
+[slave]
=== modified file 'mysql-test/suite/rpl/r/rpl_log_pos.result'
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result 2008-07-10 16:09:39 +0000
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result 2009-09-24 13:19:06 +0000
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary");
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
=== added file 'mysql-test/suite/rpl/r/rpl_mysql_upgrade.result'
--- a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result 2009-09-28 06:24:19 +0000
@@ -0,0 +1,13 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP DATABASE IF EXISTS `#mysql50#mysqltest-1`;
+CREATE DATABASE `#mysql50#mysqltest-1`;
+Master position is not changed
+STOP SLAVE SQL_THREAD;
+Master position has been changed
+DROP DATABASE `mysqltest-1`;
+DROP DATABASE `#mysql50#mysqltest-1`;
=== modified file 'mysql-test/suite/rpl/r/rpl_packet.result'
--- a/mysql-test/suite/rpl/r/rpl_packet.result 2009-01-23 12:22:05 +0000
+++ b/mysql-test/suite/rpl/r/rpl_packet.result 2009-09-24 13:19:06 +0000
@@ -4,6 +4,8 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
+call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
SET @@global.max_allowed_packet=1024;
@@ -32,6 +34,21 @@ include/start_slave.inc
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
Slave_IO_Running = No (expect No)
+SELECT "Got a packet bigger than 'max_allowed_packet' bytes" AS Last_IO_Error;
+Last_IO_Error
+Got a packet bigger than 'max_allowed_packet' bytes
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
+INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
+Slave_IO_Running = No (expect No)
+SELECT "Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'" AS Last_IO_Error;
+Last_IO_Error
+Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'
==== clean up ====
DROP TABLE t1;
SET @@global.max_allowed_packet= 1024;
=== modified file 'mysql-test/suite/rpl/r/rpl_row_create_table.result'
--- a/mysql-test/suite/rpl/r/rpl_row_create_table.result 2009-05-31 05:44:41 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result 2009-10-06 00:54:00 +0000
@@ -176,7 +176,7 @@ Log_name Pos Event_type Server_id End_lo
# 106 Query # 174 BEGIN
# 174 Table_map # 216 table_id: # (test.t7)
# 216 Write_rows # 272 table_id: # flags: STMT_END_F
-# 272 Query # 343 ROLLBACK
+# 272 Query # 341 COMMIT
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -327,7 +327,7 @@ Log_name Pos Event_type Server_id End_lo
# 1329 Query # 1397 BEGIN
# 1397 Table_map # 1438 table_id: # (test.t1)
# 1438 Write_rows # 1482 table_id: # flags: STMT_END_F
-# 1482 Query # 1553 ROLLBACK
+# 1482 Query # 1551 COMMIT
SHOW TABLES;
Tables_in_test
t1
=== added file 'mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result'
--- a/mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result 2009-09-27 21:02:47 +0000
@@ -0,0 +1,26 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t (a int, b int, c int, key(b));
+SET SQL_LOG_BIN=1;
+CREATE TABLE t (a int, b int, c int);
+INSERT INTO t VALUES (1,2,4);
+INSERT INTO t VALUES (4,3,4);
+DELETE FROM t;
+DROP TABLE t;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t (a int, b int, c int, key(b));
+ALTER TABLE t DISABLE KEYS;
+INSERT INTO t VALUES (1,2,4);
+INSERT INTO t VALUES (4,3,4);
+DELETE FROM t;
+DROP TABLE t;
=== modified file 'mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result'
--- a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result 2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result 2009-09-04 01:33:45 +0000
@@ -4,21 +4,20 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-create database if not exists mysqltest1;
-DROP PROCEDURE IF EXISTS mysqltest1.p1;
-DROP PROCEDURE IF EXISTS mysqltest1.p2;
-DROP TABLE IF EXISTS mysqltest1.t2;
-DROP TABLE IF EXISTS mysqltest1.t1;
-CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=InnoDB;
-CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=InnoDB;
-CREATE PROCEDURE mysqltest1.p1()
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=InnoDB;
+CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=InnoDB;
+CREATE PROCEDURE p1()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb INT;
DECLARE cur1 CURSOR FOR SELECT name,
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
-FROM mysqltest1.t1;
+FROM t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
SET AUTOCOMMIT=0;
@@ -26,21 +25,20 @@ REPEAT
FETCH cur1 INTO spa, spb;
IF NOT done THEN
START TRANSACTION;
-INSERT INTO mysqltest1.t2 VALUES (spa,spb);
+INSERT INTO t2 VALUES (spa,spb);
COMMIT;
END IF;
UNTIL done END REPEAT;
SET AUTOCOMMIT=1;
CLOSE cur1;
END|
-CREATE PROCEDURE mysqltest1.p2()
+CREATE PROCEDURE p2()
BEGIN
-INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
+INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
END|
-CALL mysqltest1.p2();
-CALL mysqltest1.p1();
-DROP PROCEDURE IF EXISTS mysqltest1.p1;
-DROP PROCEDURE IF EXISTS mysqltest1.p2;
-DROP TABLE IF EXISTS mysqltest1.t1;
-DROP TABLE IF EXISTS mysqltest1.t2;
-DROP DATABASE mysqltest1;
+CALL p2();
+CALL p1();
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
=== modified file 'mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result'
--- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result 2009-03-23 01:07:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result 2009-09-01 11:38:17 +0000
@@ -51,3 +51,4 @@ Last_SQL_Errno 9
Last_SQL_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed
drop table t1;
drop table t1;
+call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3");
=== modified file 'mysql-test/suite/rpl/r/rpl_stm_log.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result 2009-03-16 08:21:29 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result 2009-09-28 12:41:10 +0000
@@ -25,7 +25,7 @@ master-bin.000001 # Query 1 # use `test`
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
-master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1
+master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (word) ;file_id=1
show binlog events from 106 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
@@ -193,7 +193,7 @@ master-bin.000001 # Query # # use `test`
master-bin.000001 # Query # # use `test`; drop table t1
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (word) ;file_id=#
master-bin.000001 # Rotate # # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
@@ -218,7 +218,7 @@ slave-bin.000001 # Query 1 # use `test`;
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
-slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
+slave-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (word) ;file_id=1
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def 2009-07-06 22:20:17 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def 2009-09-27 10:12:58 +0000
@@ -10,6 +10,3 @@
#
##############################################################################
-rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx
-rpl_init_slave : Bug#44920 2009-07006 pcrews MTR2 is not processing master.opt input properly on Windows. *Must be done this way due to the nature of the bug*
-
=== added file 'mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test'
--- a/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test 2009-09-30 23:19:36 +0000
@@ -0,0 +1,214 @@
+#
+# Bug45677
+# This test verifies the following two properties:
+# P1) insert/update in an autoinc column causes statement to
+# be logged in row format if binlog_format=mixed.
+# P2) if binlog_format=mixed, and a trigger or function contains
+# two or more inserts/updates in a table that has an autoinc
+# column, then the slave should not go out of sync, even if
+# there are concurrent transactions.
+#
+# Property (P1) is tested by executing an insert and an update on
+# a table that has an autoinc column, and verifying that these
+# statements result in row events in the binlog.
+# Property (P2) is tested by setting up the test scenario and
+# verifying that the tables are identical on master and slave.
+#
+
+source include/have_binlog_format_mixed.inc;
+source include/have_innodb.inc;
+source include/master-slave.inc;
+
+--echo # Test case1: INVOKES A TRIGGER with after insert action
+let $trigger_action = after insert;
+source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
+
+--echo # Test case2: INVOKES A TRIGGER with before insert action
+let $trigger_action = before insert;
+source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
+
+--echo # Test case3: INVOKES A TRIGGER with after update action
+let $trigger_action = after update;
+source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
+
+--echo # Test case4: INVOKES A TRIGGER with before update action
+let $trigger_action = before update;
+source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
+
+--echo # Test case5: INVOKES A TRIGGER with after delete action
+let $trigger_action = after delete;
+source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
+
+--echo # Test case6: INVOKES A TRIGGER with before delete action
+let $trigger_action = before delete;
+source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
+
+--echo # Test case7: CALLS A FUNCTION which INVOKES A TRIGGER with after insert action
+let $insert_action = after insert;
+source extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test;
+
+--echo # Test case8: CALLS A FUNCTION which INVOKES A TRIGGER with before insert action
+let $insert_action = before insert;
+source extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test;
+
+--echo # Test case9: INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS with after insert action
+let $insert_action = after insert;
+source extra/rpl_tests/rpl_auto_increment_insert_view.test;
+
+--echo # Test case10: INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS with before insert action
+let $insert_action = before insert;
+source extra/rpl_tests/rpl_auto_increment_insert_view.test;
+
+--echo # Test case11: INVOKES A FUNCTION TO INSERT TWO OR MORE VALUES INTO A TABLE WITH AUTOINC COLUMN
+connection master;
+create table t1(a int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
+delimiter //;
+CREATE FUNCTION f1_two_inserts() RETURNS INTEGER
+BEGIN
+ INSERT INTO t2(a) values(2);
+ INSERT INTO t2(a) values(2);
+ RETURN 1;
+END//
+delimiter ;//
+begin;
+insert into t1(a) values(f1_two_inserts());
+
+connection master1;
+#The default autocommit is set to 1, so the statement is auto committed
+insert into t2(a) values(4),(5);
+
+connection master;
+commit;
+insert into t1(a) values(f1_two_inserts());
+commit;
+
+connection master;
+--echo #Test result for INVOKES A FUNCTION TO INSERT TWO OR MORE VALUES on master
+select * from t2 ORDER BY i1;
+
+sync_slave_with_master;
+connection slave;
+--echo #Test result for INVOKES A FUNCTION TO INSERT TWO OR MORE VALUES on slave
+select * from t2 ORDER BY i1;
+
+connection master;
+drop table t1;
+drop table t2;
+drop function f1_two_inserts;
+sync_slave_with_master;
+
+--echo # Test case12: INVOKES A FUNCTION TO UPDATE TWO OR MORE VALUES OF A TABLE WITH AUTOINC COLUMN
+connection master;
+create table t1(a int) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, b int, primary key(i1)) engine=innodb;
+delimiter //;
+CREATE FUNCTION f1_two_updates() RETURNS INTEGER
+BEGIN
+ update t2 set a = a + 5 where b = 1;
+ update t2 set a = a + 5 where b = 2;
+ update t2 set a = a + 5 where b = 3;
+ update t2 set a = a + 5 where b = 4;
+ RETURN 1;
+END//
+delimiter ;//
+
+connection master1;
+#The default autocommit is set to 1, so the statement is auto committed
+insert into t2(a,b) values(1,1);
+insert into t2(a,b) values(2,2);
+insert into t2(a,b) values(3,3);
+insert into t2(a,b) values(4,4);
+insert into t1(a) values(f1_two_updates());
+
+connection master;
+begin;
+insert into t1(a) values(f1_two_updates());
+commit;
+
+connection master;
+--echo #Test result for INVOKES A FUNCTION TO UPDATE TWO OR MORE VALUES on master
+select * from t2 ORDER BY i1;
+
+sync_slave_with_master;
+connection slave;
+--echo #Test result for INVOKES A FUNCTION TO UPDATE TWO OR MORE VALUES on slave
+select * from t2 ORDER BY i1;
+
+connection master;
+drop table t1;
+drop table t2;
+drop function f1_two_updates;
+sync_slave_with_master;
+
+--echo # Test case13: UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT
+connection master;
+create table t1(i1 int not null auto_increment, a int, b int, primary key(i1)) engine=innodb;
+create table t2(i1 int not null auto_increment, a int, b int, primary key(i1)) engine=innodb;
+begin;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+insert into t1(a,b) values(1,1),(2,2);
+insert into t2(a,b) values(1,1),(2,2);
+update t1,t2 set t1.a=t1.a+5, t2.a=t2.a+5 where t1.b=t2.b;
+insert into t1(a,b) values(3,3);
+insert into t2(a,b) values(3,3);
+commit;
+--echo # To verify if it works fine when these statements are not be marked as unsafe
+source include/show_binlog_events.inc;
+
+sync_slave_with_master;
+--echo #Test if the results are consistent on master and slave
+--echo #for 'UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT'
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+let $diff_table_1=master:test.t2;
+let $diff_table_2=slave:test.t2;
+source include/diff_tables.inc;
+
+connection master;
+drop table t1;
+drop table t2;
+sync_slave_with_master;
+
+--echo # Test case14: INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES
+connection master;
+CREATE TABLE t1(i1 int not null auto_increment, c1 INT, primary key(i1)) engine=innodb;
+CREATE TABLE t2(i1 int not null auto_increment, c2 INT, primary key(i1)) engine=innodb;
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+begin;
+INSERT INTO t1(c1) VALUES (11), (12);
+INSERT INTO t2(c2) VALUES (13), (14);
+
+CREATE VIEW v15 AS SELECT c1, c2 FROM t1, t2;
+
+INSERT INTO v15(c1) VALUES (15),(16);
+INSERT INTO v15(c2) VALUES (17),(18);
+
+connection master1;
+INSERT INTO v15(c1) VALUES (19),(20);
+INSERT INTO v15(c2) VALUES (21),(22);
+
+connection master;
+INSERT INTO v15(c1) VALUES (23), (24);
+INSERT INTO v15(c2) VALUES (25), (26);
+commit;
+--echo # To verify if it works fine when these statements are not be marked as unsafe
+source include/show_binlog_events.inc;
+
+sync_slave_with_master;
+--echo #Test if the results are consistent on master and slave
+--echo #for 'INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES'
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+let $diff_table_1=master:test.t2;
+let $diff_table_2=slave:test.t2;
+source include/diff_tables.inc;
+
+connection master;
+drop table t1;
+drop table t2;
+drop view v15;
+sync_slave_with_master;
+
=== modified file 'mysql-test/suite/rpl/t/rpl_bug33931.test'
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test 2009-02-11 11:56:25 +0000
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test 2009-08-28 14:13:27 +0000
@@ -15,7 +15,7 @@ reset master;
connection slave;
# Add suppression for expected warnings in slaves error log
-call mtr.add_suppression("Failed during slave thread initialization");
+call mtr.add_suppression("Failed during slave I/O thread initialization");
--disable_warnings
stop slave;
=== modified file 'mysql-test/suite/rpl/t/rpl_do_grant.test'
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test 2009-09-20 03:02:26 +0000
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test 2009-11-16 20:49:51 +0000
@@ -210,5 +210,10 @@ DROP FUNCTION upgrade_del_func;
DROP FUNCTION upgrade_alter_func;
DROP DATABASE bug42217_db;
DROP USER 'create_rout_db'@'localhost';
-
+
+call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
+connection slave;
+USE mtr;
+call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
+
--echo "End of test"
=== modified file 'mysql-test/suite/rpl/t/rpl_drop_temp.test'
--- a/mysql-test/suite/rpl/t/rpl_drop_temp.test 2009-08-28 09:45:57 +0000
+++ b/mysql-test/suite/rpl/t/rpl_drop_temp.test 2009-09-13 20:52:14 +0000
@@ -23,6 +23,8 @@ disconnect con_temp;
--source include/wait_until_disconnected.inc
connection master;
+-- let $wait_binlog_event= DROP
+-- source include/wait_for_binlog_event.inc
sync_slave_with_master;
connection slave;
=== modified file 'mysql-test/suite/rpl/t/rpl_err_ignoredtable.test'
--- a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test 2009-02-05 09:49:32 +0000
+++ b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test 2009-10-20 18:00:07 +0000
@@ -50,7 +50,7 @@ kill @id;
drop table t2,t3;
insert into t4 values (3),(4);
connection master;
---error 0,1053,2013
+--error 0,1317,2013
reap;
connection master1;
save_master_pos;
=== added file 'mysql-test/suite/rpl/t/rpl_get_master_version_and_clock-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock-slave.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock-slave.opt 2009-10-29 02:26:59 +0000
@@ -0,0 +1 @@
+--master-retry-count=60
=== modified file 'mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test'
--- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test 2009-07-17 05:07:43 +0000
+++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test 2009-10-29 02:26:59 +0000
@@ -16,6 +16,10 @@
source include/master-slave.inc;
source include/have_debug.inc;
+call mtr.add_suppression("Get master clock failed with error: ");
+call mtr.add_suppression("Get master SERVER_ID failed with error: ");
+call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again");
+call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
#Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection
connection slave;
let $debug_saved= `select @@global.debug`;
=== modified file 'mysql-test/suite/rpl/t/rpl_idempotency.test'
--- a/mysql-test/suite/rpl/t/rpl_idempotency.test 2009-04-05 12:03:04 +0000
+++ b/mysql-test/suite/rpl/t/rpl_idempotency.test 2009-08-25 13:56:50 +0000
@@ -8,7 +8,8 @@ connection slave;
source include/have_innodb.inc;
# Add suppression for expected warning(s) in slaves error log
-call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032");
+call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032");
+call mtr.add_suppression("Slave: Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451");
call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452");
SET @old_slave_exec_mode= @@global.slave_exec_mode;
=== modified file 'mysql-test/suite/rpl/t/rpl_init_slave_errors.test'
--- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test 2009-04-06 00:22:34 +0000
+++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test 2009-08-28 14:13:27 +0000
@@ -57,6 +57,7 @@ source include/wait_for_slave_to_stop.in
let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1);
echo Reporting the following error: $error;
+call mtr.add_suppression("Failed during slave I/O thread initialization");
SET GLOBAL debug= "";
=== modified file 'mysql-test/suite/rpl/t/rpl_loaddatalocal.test'
--- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test 2009-03-16 08:21:29 +0000
+++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test 2009-09-28 12:41:10 +0000
@@ -98,3 +98,73 @@ DROP TABLE t1;
--echo [on slave]
sync_slave_with_master;
+--echo
+--echo Bug #43746:
+--echo "return wrong query string when parse 'load data infile' sql statement"
+--echo
+
+--echo [master]
+connection master;
+let $MYSQLD_DATADIR= `select @@datadir`;
+SELECT @@SESSION.sql_mode INTO @old_mode;
+
+SET sql_mode='ignore_space';
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2), (3), (4);
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug43746.sql' FROM t1;
+TRUNCATE TABLE t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD/* look mum, with comments in weird places! */DATA/* oh hai */LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql'/* we are */INTO/* from the internets */TABLE t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO */ TABLE t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' /*!10000 INTO TABLE */ t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA /*!10000 LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE */ t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql'/*!10000 INTO*/TABLE t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql'/* empty */INTO TABLE t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA/*!10000 LOCAL */INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO/* empty */TABLE t1;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD/*!99999 special comments that do not expand */DATA/*!99999 code from the future */LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql'/*!99999 have flux capacitor */INTO/*!99999 will travel */TABLE t1;
+
+SET sql_mode='PIPES_AS_CONCAT,ANSI_QUOTES,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER';
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1;
+
+--echo [slave]
+sync_slave_with_master;
+
+# cleanup
+
+--remove_file $MYSQLD_DATADIR/bug43746.sql
+
+--echo [master]
+connection master;
+DROP TABLE t1;
+SET SESSION sql_mode=@old_mode;
+
+--echo [slave]
+sync_slave_with_master;
+
+connection master;
=== modified file 'mysql-test/suite/rpl/t/rpl_log_pos.test'
--- a/mysql-test/suite/rpl/t/rpl_log_pos.test 2008-07-10 16:09:39 +0000
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test 2009-09-24 13:19:06 +0000
@@ -11,6 +11,7 @@
# Passes with rbr no problem, removed statement include [jbm]
source include/master-slave.inc;
+call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary");
source include/show_master_status.inc;
sync_slave_with_master;
source include/stop_slave.inc;
=== added file 'mysql-test/suite/rpl/t/rpl_mysql_upgrade.test'
--- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test 2009-09-28 06:24:19 +0000
@@ -0,0 +1,56 @@
+#############################################################################
+# BUG#43579 mysql_upgrade tries to alter log tables on replicated database
+# Master and slave should be upgraded separately. All statements executed by
+# mysql_upgrade will not be binlogged. --write-binlog and --skip-write-binlog
+# options are added into mysql_upgrade. These options control whether sql
+# statements are binlogged or not.
+#############################################################################
+--source include/master-slave.inc
+
+# Only run test if "mysql_upgrade" is found
+--source include/have_mysql_upgrade.inc
+
+connection master;
+--disable_warnings
+DROP DATABASE IF EXISTS `#mysql50#mysqltest-1`;
+CREATE DATABASE `#mysql50#mysqltest-1`;
+--enable_warnings
+sync_slave_with_master;
+
+connection master;
+let $before_position= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+#With '--force' option, mysql_upgrade always executes all sql statements for upgrading.
+#--skip-write-binlog option disables binlog.
+--exec $MYSQL_UPGRADE --skip-write-binlog --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1
+sync_slave_with_master;
+
+connection master;
+let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+if (`SELECT '$before_position'='$after_position'`)
+{
+ echo Master position is not changed;
+}
+
+#Some log events of the mysql_upgrade's will cause errors on slave.
+connection slave;
+STOP SLAVE SQL_THREAD;
+source include/wait_for_slave_sql_to_stop.inc;
+
+connection master;
+#With '--force' option, mysql_upgrade always executes all sql statements for upgrading.
+--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1
+
+connection master;
+let $after_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+if (!`SELECT '$before_position'='$after_position'`)
+{
+ echo Master position has been changed;
+}
+
+DROP DATABASE `mysqltest-1`;
+connection slave;
+DROP DATABASE `#mysql50#mysqltest-1`;
=== modified file 'mysql-test/suite/rpl/t/rpl_packet.test'
--- a/mysql-test/suite/rpl/t/rpl_packet.test 2009-01-23 12:22:05 +0000
+++ b/mysql-test/suite/rpl/t/rpl_packet.test 2009-09-24 13:19:06 +0000
@@ -5,6 +5,9 @@
# max-out size db name
source include/master-slave.inc;
+source include/have_binlog_format_row.inc;
+call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
+call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
disable_warnings;
@@ -86,6 +89,35 @@ connection slave;
--source include/wait_for_slave_io_to_stop.inc
let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
--echo Slave_IO_Running = $slave_io_running (expect No)
+#
+# Bug#42914: The slave I/O thread must stop after trying to read the above
+# event, However there is no Last_IO_Error report.
+#
+let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
+eval SELECT "$last_io_error" AS Last_IO_Error;
+
+#
+# Bug#42914: On the master, if a binary log event is larger than
+# max_allowed_packet, the error message ER_MASTER_FATAL_ERROR_READING_BINLOG
+# is sent to a slave when it requests a dump from the master, thus leading the
+# I/O thread to stop. However, there is no Last_IO_Error reported.
+#
+source include/master-slave-reset.inc;
+connection master;
+CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
+sync_slave_with_master;
+
+connection master;
+INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
+
+connection slave;
+# The slave I/O thread must stop after receiving
+# ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master.
+--source include/wait_for_slave_io_to_stop.inc
+let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
+--echo Slave_IO_Running = $slave_io_running (expect No)
+let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
+eval SELECT "$last_io_error" AS Last_IO_Error;
--echo ==== clean up ====
connection master;
=== added file 'mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test'
--- a/mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test 2009-09-27 21:02:47 +0000
@@ -0,0 +1,73 @@
+# BUG#47312: RBR: Disabling key on slave breaks replication:
+# HA_ERR_WRONG_INDEX
+#
+# Description
+# ===========
+#
+# This test case checks whether disabling a key on a slave breaks
+# replication or not.
+#
+# Case #1, shows that while not using ALTER TABLE... DISABLE KEYS and
+# the slave has no key defined while the master has one, replication
+# won't break.
+#
+# Case #2, shows that before patch for BUG#47312, if defining key on
+# slave table, and later disable it, replication would break. This
+# has been fixed.
+#
+
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+
+#
+# Case #1: master has key, but slave has not.
+# Replication does not break.
+#
+
+SET SQL_LOG_BIN=0;
+CREATE TABLE t (a int, b int, c int, key(b));
+SET SQL_LOG_BIN=1;
+
+-- connection slave
+
+CREATE TABLE t (a int, b int, c int);
+
+-- connection master
+
+INSERT INTO t VALUES (1,2,4);
+INSERT INTO t VALUES (4,3,4);
+DELETE FROM t;
+
+-- sync_slave_with_master
+
+-- connection master
+DROP TABLE t;
+
+-- sync_slave_with_master
+
+#
+# Case #2: master has key, slave also has one,
+# but it gets disabled sometime.
+# Replication does not break anymore.
+#
+-- source include/master-slave-reset.inc
+-- connection master
+
+CREATE TABLE t (a int, b int, c int, key(b));
+
+-- sync_slave_with_master
+
+ALTER TABLE t DISABLE KEYS;
+
+-- connection master
+
+INSERT INTO t VALUES (1,2,4);
+INSERT INTO t VALUES (4,3,4);
+DELETE FROM t;
+
+-- sync_slave_with_master
+
+-- connection master
+DROP TABLE t;
+
+-- sync_slave_with_master
=== modified file 'mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test'
--- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test 2009-03-23 01:07:25 +0000
+++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test 2009-09-01 11:38:17 +0000
@@ -7,6 +7,7 @@
# 1 - Creates a table and populates it through "LOAD DATA INFILE".
# 2 - Catches error.
##########################################################################
+
--source include/have_binlog_format_mixed_or_statement.inc
--source include/have_innodb.inc
--source include/have_debug.inc
@@ -47,3 +48,5 @@ drop table t1;
connection slave;
drop table t1;
+
+call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3");
=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result 2008-03-14 20:06:01 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result 2009-09-27 22:03:05 +0000
@@ -102,3 +102,4 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+DROP TABLE t1;
=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result 2008-11-04 07:43:21 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result 2009-08-29 08:30:59 +0000
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
**** Diff Table Def Start ****
*** On Slave ***
STOP SLAVE;
=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result 2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result 2009-09-07 05:01:03 +0000
@@ -4,21 +4,20 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-create database if not exists mysqltest1;
-DROP PROCEDURE IF EXISTS mysqltest1.p1;
-DROP PROCEDURE IF EXISTS mysqltest1.p2;
-DROP TABLE IF EXISTS mysqltest1.t2;
-DROP TABLE IF EXISTS mysqltest1.t1;
-CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
-CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
-CREATE PROCEDURE mysqltest1.p1()
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
+CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=NDBCLUSTER;
+CREATE PROCEDURE p1()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb INT;
DECLARE cur1 CURSOR FOR SELECT name,
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
-FROM mysqltest1.t1;
+FROM t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
SET AUTOCOMMIT=0;
@@ -26,21 +25,20 @@ REPEAT
FETCH cur1 INTO spa, spb;
IF NOT done THEN
START TRANSACTION;
-INSERT INTO mysqltest1.t2 VALUES (spa,spb);
+INSERT INTO t2 VALUES (spa,spb);
COMMIT;
END IF;
UNTIL done END REPEAT;
SET AUTOCOMMIT=1;
CLOSE cur1;
END|
-CREATE PROCEDURE mysqltest1.p2()
+CREATE PROCEDURE p2()
BEGIN
-INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
+INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
END|
-CALL mysqltest1.p2();
-CALL mysqltest1.p1();
-DROP PROCEDURE IF EXISTS mysqltest1.p1;
-DROP PROCEDURE IF EXISTS mysqltest1.p2;
-DROP TABLE IF EXISTS mysqltest1.t1;
-DROP TABLE IF EXISTS mysqltest1.t2;
-DROP DATABASE mysqltest1;
+CALL p2();
+CALL p1();
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test 2008-03-14 14:42:27 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test 2009-09-27 22:03:05 +0000
@@ -58,3 +58,4 @@ STOP SLAVE;
# cleanup
--connection master
DROP TABLE t1;
+-- sync_slave_with_master
=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test 2008-03-14 20:06:01 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test 2009-09-27 22:03:05 +0000
@@ -78,3 +78,7 @@ SELECT * FROM t1 ORDER BY a;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
query_vertical SHOW SLAVE STATUS;
+
+-- connection master
+DROP TABLE t1;
+-- sync_slave_with_master
=== modified file 'mysql-test/t/almost_full.test'
--- a/mysql-test/t/almost_full.test 2009-10-28 07:52:34 +0000
+++ b/mysql-test/t/almost_full.test 2009-11-16 20:49:51 +0000
@@ -2,6 +2,8 @@
# Some special cases with empty tables
#
+call mtr.add_suppression("The table 't1' is full");
+
--disable_warnings
drop table if exists t1;
--enable_warnings
=== modified file 'mysql-test/t/alter_table.test'
--- a/mysql-test/t/alter_table.test 2009-10-28 07:52:34 +0000
+++ b/mysql-test/t/alter_table.test 2009-11-16 20:49:51 +0000
@@ -1027,5 +1027,65 @@ INSERT INTO t1 (a) VALUES (11);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
SET @@sql_mode=@save_sql_mode;
+--echo #
+--echo # Bug#45567: Fast ALTER TABLE broken for enum and set
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a ENUM('a1','a2'));
+INSERT INTO t1 VALUES ('a1'),('a2');
+--enable_info
+--echo # No copy: No modification
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2');
+--echo # No copy: Add new enumeration to the end
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a3');
+--echo # Copy: Modify and add new to the end
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx','a5');
+--echo # Copy: Remove from the end
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx');
+--echo # Copy: Add new enumeration
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx');
+--echo # No copy: Add new enumerations to the end
+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx','a5','a6');
+--disable_info
+DROP TABLE t1;
+
+CREATE TABLE t1 (a SET('a1','a2'));
+INSERT INTO t1 VALUES ('a1'),('a2');
+--enable_info
+--echo # No copy: No modification
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2');
+--echo # No copy: Add new to the end
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a3');
+--echo # Copy: Modify and add new to the end
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx','a5');
+--echo # Copy: Remove from the end
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx');
+--echo # Copy: Add new member
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx');
+--echo # No copy: Add new to the end
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6');
+--echo # Copy: Numerical incrase (pack lenght)
+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9','a10');
+--disable_info
+DROP TABLE t1;
+
+#
+# Bug#43508: Renaming timestamp or date column triggers table copy
+#
+
+CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL,
+ f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2);
+
+--echo this should affect no rows as there is no real change
+--enable_info
+ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL;
+--disable_info
+DROP TABLE t1;
--echo End of 5.1 tests
=== modified file 'mysql-test/t/analyse.test'
--- a/mysql-test/t/analyse.test 2009-08-27 10:22:19 +0000
+++ b/mysql-test/t/analyse.test 2009-10-30 09:56:32 +0000
@@ -10,37 +10,14 @@ insert into t1 values (1,2,"","Y","2002-
select count(*) from t1 procedure analyse();
select * from t1 procedure analyse();
select * from t1 procedure analyse(2);
+--error ER_WRONG_USAGE
create table t2 select * from t1 procedure analyse();
-select * from t2;
-drop table t1,t2;
+drop table t1;
--error ER_WRONG_USAGE
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
#
-# Test with impossible where
-#
-create table t1 (a int not null);
-create table t2 select * from t1 where 0=1 procedure analyse();
-show create table t2;
-select * from t1 where 0=1 procedure analyse();
-insert into t1 values(1);
-drop table t2;
-create table t2 select * from t1 where 0=1 procedure analyse();
-show create table t2;
-select * from t2;
-insert into t2 select * from t1 procedure analyse();
-select * from t2;
-insert into t1 values(2);
-drop table t2;
-create table t2 select * from t1 where 0=1 procedure analyse();
-show create table t2;
-select * from t2;
-insert into t2 select * from t1 procedure analyse();
-select * from t2;
-drop table t1,t2;
-
-#
# Bug#2813 - analyse does not quote string values in enums from string
#
@@ -113,3 +90,46 @@ SELECT * FROM (SELECT * FROM t1) d PROCE
DROP TABLE t1;
--echo End of 4.1 tests
+
+--echo #
+--echo # Bug #48293: crash with procedure analyse, view with > 10 columns,
+--echo # having clause...
+--echo #
+
+CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
+ f INT, g INT, h INT, i INT, j INT,k INT);
+INSERT INTO t1 VALUES (),();
+
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+--echo #should have a derived table
+EXPLAIN SELECT * FROM v1;
+--echo #should not crash
+--error ER_WRONG_USAGE
+SELECT * FROM v1 PROCEDURE analyse();
+--echo #should not crash
+--error ER_WRONG_USAGE
+SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
+--echo #should not crash
+--error ER_WRONG_USAGE
+SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
+--echo #should not crash
+--error ER_WRONG_USAGE
+SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
+--echo #should not crash
+--error ER_ORDER_WITH_PROC
+SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1),(2);
+
+--echo # should not crash
+--error ER_WRONG_USAGE
+CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
+
+DROP TABLE t1;
+
+
+--echo End of 5.0 tests
=== modified file 'mysql-test/t/archive.test'
--- a/mysql-test/t/archive.test 2009-10-28 07:52:34 +0000
+++ b/mysql-test/t/archive.test 2009-11-16 20:49:51 +0000
@@ -1601,3 +1601,27 @@ INSERT INTO t1 VALUES (NULL, NULL),(NULL
FLUSH TABLE t1;
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
+
+#
+# BUG#29203 - archive tables have weird values in show table status
+#
+CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
+SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
+ INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
+SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
+ INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
+DROP TABLE t1;
+
+#
+# BUG#46961 - archive engine loses rows during self joining select!
+#
+SET @save_join_buffer_size= @@join_buffer_size;
+SET @@join_buffer_size= 8228;
+CREATE TABLE t1(a CHAR(255)) ENGINE=archive;
+INSERT INTO t1 VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
+ ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
+ ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+SELECT COUNT(t1.a) FROM t1, t1 a, t1 b, t1 c, t1 d, t1 e;
+DROP TABLE t1;
+SET @@join_buffer_size= @save_join_buffer_size;
=== modified file 'mysql-test/t/bug46080.test'
--- a/mysql-test/t/bug46080.test 2009-07-13 11:17:14 +0000
+++ b/mysql-test/t/bug46080.test 2009-09-03 06:38:06 +0000
@@ -3,6 +3,9 @@
--echo # sort_buffer_size cannot allocate
--echo #
+call mtr.add_suppression("Out of memory at line .*, 'my_alloc.c'");
+call mtr.add_suppression("needed .* byte .*k., memory in use: .* bytes .*k");
+
CREATE TABLE t1(a CHAR(255));
INSERT INTO t1 VALUES ('a');
=== added file 'mysql-test/t/bug46760-master.opt'
--- a/mysql-test/t/bug46760-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46760-master.opt 2009-09-18 13:01:18 +0000
@@ -0,0 +1,2 @@
+--innodb-lock-wait-timeout=2
+--innodb-file-per-table
=== added file 'mysql-test/t/bug46760.test'
--- a/mysql-test/t/bug46760.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46760.test 2009-09-18 13:01:18 +0000
@@ -0,0 +1,38 @@
+-- source include/have_innodb.inc
+
+--echo #
+--echo # Bug#46760: Fast ALTER TABLE no longer works for InnoDB
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--echo # By using --enable_info and verifying that number of affected
+--echo # rows is 0 we check that this ALTER TABLE is really carried
+--echo # out as "fast/online" operation, i.e. without full-blown data
+--echo # copying.
+--echo #
+--echo # I.e. info for the below statement should normally look like:
+--echo #
+--echo # affected rows: 0
+--echo # info: Records: 0 Duplicates: 0 Warnings: 0
+
+--enable_info
+ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 10;
+--disable_info
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MySQL Bug#39200: optimize table does not recognize
+--echo # ROW_FORMAT=COMPRESSED
+--echo #
+
+CREATE TABLE t1 (a INT) ROW_FORMAT=compressed;
+SHOW CREATE TABLE t1;
+OPTIMIZE TABLE t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
=== modified file 'mysql-test/t/create.test'
--- a/mysql-test/t/create.test 2009-09-07 20:50:10 +0000
+++ b/mysql-test/t/create.test 2009-11-16 20:49:51 +0000
@@ -1198,6 +1198,23 @@ CREATE TABLE IF NOT EXISTS t2 (a INTEGER
DROP TABLE t1, t2;
+--echo #
+--echo # BUG#46384 - mysqld segfault when trying to create table with same
+--echo # name as existing view
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (1),(2),(3);
+
+CREATE VIEW v1 AS SELECT t1.a FROM t1, t2;
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE v1 AS SELECT * FROM t1;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
--echo End of 5.0 tests
=== modified file 'mysql-test/t/ctype_ldml.test'
--- a/mysql-test/t/ctype_ldml.test 2009-06-04 09:35:29 +0000
+++ b/mysql-test/t/ctype_ldml.test 2009-10-19 13:23:53 +0000
@@ -38,6 +38,14 @@ SELECT * FROM t1 WHERE col1=col2 ORDER B
DROP TABLE t1;
--echo #
+--echo # Bug#45645 Mysql server close all connection and restart using lower function
+--echo #
+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
+INSERT INTO t1 (a) VALUES ('hello!');
+SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
+DROP TABLE t1;
+
+--echo #
--echo # Bug#43827 Server closes connections and restarts
--echo #
# Crash happened with a user-defined utf8 collation,
@@ -86,3 +94,8 @@ select hex(c1) as h, c1 from t1 order by
select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
drop table t1;
+
+--echo Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
+set names latin1;
+show collation like 'latin1_test';
+select "foo" = "foo " collate latin1_test;
=== added file 'mysql-test/t/debug_sync.test'
--- a/mysql-test/t/debug_sync.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/debug_sync.test 2009-09-29 15:38:40 +0000
@@ -0,0 +1,420 @@
+###################### t/debug_sync.test ###############################
+# #
+# Testing of the Debug Sync Facility. #
+# #
+# There is important documentation within sql/debug_sync.cc #
+# #
+# Used objects in this test case: #
+# p0 - synchronization point 0. Non-existent dummy sync point. #
+# s1 - signal 1. #
+# s2 - signal 2. #
+# #
+# Creation: #
+# 2008-02-18 istruewing #
+# #
+########################################################################
+
+#
+# We need the Debug Sync Facility.
+#
+--source include/have_debug_sync.inc
+
+#
+# We are checking privileges, which the embedded server cannot do.
+#
+--source include/not_embedded.inc
+
+#
+# Preparative cleanup.
+#
+--disable_warnings
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Show the special system variable.
+# It shows ON or OFF depending on the command line option --debug-sync.
+# The test case assumes it is ON (command line option present).
+#
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+
+#
+# Syntax. Valid forms.
+#
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
+SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2';
+SET DEBUG_SYNC='p0 SIGNAL s1 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 SIGNAL s1';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2';
+SET DEBUG_SYNC='p0 WAIT_FOR s2 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 WAIT_FOR s2';
+SET DEBUG_SYNC='p0 HIT_LIMIT 3';
+SET DEBUG_SYNC='p0 CLEAR';
+SET DEBUG_SYNC='p0 TEST';
+SET DEBUG_SYNC='RESET';
+
+#
+# Syntax. Valid forms. Lower case.
+#
+set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2 hit_limit 3';
+set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2';
+set debug_sync='p0 signal s1 wait_for s2 timeout 6 hit_limit 3';
+set debug_sync='p0 signal s1 wait_for s2 timeout 6';
+set debug_sync='p0 signal s1 wait_for s2 execute 2 hit_limit 3';
+set debug_sync='p0 signal s1 wait_for s2 execute 2';
+set debug_sync='p0 signal s1 wait_for s2 hit_limit 3';
+set debug_sync='p0 signal s1 wait_for s2';
+set debug_sync='p0 signal s1 execute 2 hit_limit 3';
+set debug_sync='p0 signal s1 execute 2';
+set debug_sync='p0 signal s1 hit_limit 3';
+set debug_sync='p0 signal s1';
+set debug_sync='p0 wait_for s2 timeout 6 execute 2 hit_limit 3';
+set debug_sync='p0 wait_for s2 timeout 6 execute 2';
+set debug_sync='p0 wait_for s2 timeout 6 hit_limit 3';
+set debug_sync='p0 wait_for s2 timeout 6';
+set debug_sync='p0 wait_for s2 execute 2 hit_limit 3';
+set debug_sync='p0 wait_for s2 execute 2';
+set debug_sync='p0 wait_for s2 hit_limit 3';
+set debug_sync='p0 wait_for s2';
+set debug_sync='p0 hit_limit 3';
+set debug_sync='p0 clear';
+set debug_sync='p0 test';
+set debug_sync='reset';
+
+#
+# Syntax. Valid forms. Line wrap, leading, mid, trailing space.
+#
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6
+ EXECUTE 2 HIT_LIMIT 3';
+SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 ';
+SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
+SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
+
+#
+# Syntax. Invalid forms.
+#
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC=' ';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 EXECUTE 2';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 TIMEOUT 6 EXECUTE 2';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 TIMEOUT 6';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 EXECUTE 2';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1 EXECUTE 2';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2 EXECUTE 2';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 EXECUTE 2 SIGNAL s1 TIMEOUT 6';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 TIMEOUT 6 SIGNAL s1';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 EXECUTE 2 TIMEOUT 6 SIGNAL s1';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 CLEAR HIT_LIMIT 3';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='CLEAR';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 CLEAR p0';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='TEST';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 TEST p0';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 RESET';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='RESET p0';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 RESET p0';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 SIGNAL ';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR ';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE ';
+
+#
+# Syntax. Invalid keywords used.
+#
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+SET DEBUG_SYNCx='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 SIGNAx s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOx s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUx 0 EXECUTE 2 HIT_LIMIT 3';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTx 2 HIT_LIMIT 3';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIx 3';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 CLEARx';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 TESTx';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='RESETx';
+
+#
+# Syntax. Invalid numbers. Decimal only.
+#
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 0x6 EXECUTE 2 HIT_LIMIT 3';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 0x2 HIT_LIMIT 3';
+--error ER_PARSE_ERROR
+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 7 EXECUTE 2 HIT_LIMIT 0x3';
+
+#
+# Syntax. Invalid value type.
+#
+--error ER_WRONG_TYPE_FOR_VAR
+SET DEBUG_SYNC= 7;
+
+#
+# Syntax. DEBUG_SYNC is a SESSION-only variable.
+#
+--error ER_LOCAL_VARIABLE
+SET GLOBAL DEBUG_SYNC= 'p0 CLEAR';
+
+#
+# Syntax. The variable value does not need to be a string literal.
+#
+SET @myvar= 'now SIGNAL from_myvar';
+SET DEBUG_SYNC= @myvar;
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+#
+SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24);
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+
+#
+# Functional tests.
+#
+# NOTE: There is the special synchronization point 'now'. It is placed
+# immediately after setting of the DEBUG_SYNC variable.
+# So it is executed before the SET statement ends.
+#
+# NOTE: There is only one global signal (say "signal post" or "flag mast").
+# A SIGNAL action writes its signal into it ("sets a flag").
+# The signal persists until explicitly overwritten.
+# To avoid confusion for later tests, it is recommended to clear
+# the signal by signalling "empty" ("setting the 'empty' flag"):
+# SET DEBUG_SYNC= 'now SIGNAL empty';
+# Preferably you can reset the whole facility with:
+# SET DEBUG_SYNC= 'RESET';
+# The signal is then '' (really empty) which connot be done otherwise.
+#
+
+#
+# Time out immediately. This gives just a warning.
+#
+SET DEBUG_SYNC= 'now SIGNAL something';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+# Suppress warning number
+--replace_column 2 ####
+SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
+#
+# If signal is present already, TIMEOUT 0 does not give a warning.
+#
+SET DEBUG_SYNC= 'now SIGNAL nothing';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
+
+#
+# EXECUTE 0 is effectively a no-op.
+#
+SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0';
+
+#
+# Run into HIT_LIMIT. This gives an error.
+#
+--error ER_DEBUG_SYNC_HIT_LIMIT
+SET DEBUG_SYNC= 'now HIT_LIMIT 1';
+
+#
+# Many actions. Watch the array growing and shrinking in the debug trace:
+# egrep 'query:|debug_sync_action:' mysql-test/var/log/master.trace
+#
+SET DEBUG_SYNC= 'RESET';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'p1abcd SIGNAL s1 EXECUTE 2';
+SET DEBUG_SYNC= 'p2abc SIGNAL s2 EXECUTE 2';
+SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2';
+SET DEBUG_SYNC= 'p4a SIGNAL s4 EXECUTE 2';
+SET DEBUG_SYNC= 'p5abcde SIGNAL s5 EXECUTE 2';
+SET DEBUG_SYNC= 'p6ab SIGNAL s6 EXECUTE 2';
+SET DEBUG_SYNC= 'p7 SIGNAL s7 EXECUTE 2';
+SET DEBUG_SYNC= 'p8abcdef SIGNAL s8 EXECUTE 2';
+SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2';
+#
+# Execute some actions to show they exist. Each sets a distinct signal.
+#
+SET DEBUG_SYNC= 'p4a TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'p1abcd TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'p7 TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'p9abcdef TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'p3abcdef TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+#
+# Clear the actions.
+#
+SET DEBUG_SYNC= 'p1abcd CLEAR';
+SET DEBUG_SYNC= 'p2abc CLEAR';
+SET DEBUG_SYNC= 'p5abcde CLEAR';
+SET DEBUG_SYNC= 'p6ab CLEAR';
+SET DEBUG_SYNC= 'p8abcdef CLEAR';
+SET DEBUG_SYNC= 'p9abcdef CLEAR';
+SET DEBUG_SYNC= 'p3abcdef CLEAR';
+SET DEBUG_SYNC= 'p4a CLEAR';
+SET DEBUG_SYNC= 'p7 CLEAR';
+#
+# Execute some actions to show they have gone.
+#
+SET DEBUG_SYNC= 'p1abcd TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'p7 TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'p9abcdef TEST';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+#
+# Now cleanup. Actions are clear already, but signal needs to be cleared.
+#
+SET DEBUG_SYNC= 'RESET';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+
+#
+# Facility requires SUPER privilege.
+#
+CREATE USER mysqltest_1@localhost;
+GRANT SUPER ON *.* TO mysqltest_1@localhost;
+--echo connection con1, mysqltest_1
+connect (con1,localhost,mysqltest_1,,);
+SET DEBUG_SYNC= 'RESET';
+disconnect con1;
+--echo connection default
+connection default;
+DROP USER mysqltest_1@localhost;
+#
+CREATE USER mysqltest_2@localhost;
+GRANT ALL ON *.* TO mysqltest_2@localhost;
+REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
+--echo connection con1, mysqltest_2
+connect (con1,localhost,mysqltest_2,,);
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET DEBUG_SYNC= 'RESET';
+disconnect con1;
+--echo connection default
+connection default;
+DROP USER mysqltest_2@localhost;
+
+#
+# Example 1.
+#
+# Preparative cleanup.
+--disable_warnings
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+#
+# Test.
+CREATE TABLE t1 (c1 INT);
+ --echo connection con1
+ connect (con1,localhost,root,,);
+ SET DEBUG_SYNC= 'before_lock_tables_takes_lock
+ SIGNAL opened WAIT_FOR flushed';
+ send INSERT INTO t1 VALUES(1);
+--echo connection default
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
+FLUSH TABLE t1;
+ --echo connection con1
+ connection con1;
+ reap;
+ disconnect con1;
+--echo connection default
+connection default;
+DROP TABLE t1;
+
+#
+# Example 2.
+#
+# Preparative cleanup.
+--disable_warnings
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+#
+# Test.
+CREATE TABLE t1 (c1 INT);
+LOCK TABLE t1 WRITE;
+ --echo connection con1
+ connect (con1,localhost,root,,);
+ # Retain action after use. First used by general_log.
+ SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
+ send INSERT INTO t1 VALUES (1);
+--echo connection default
+connection default;
+# Wait until INSERT waits for lock.
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# let INSERT continue.
+UNLOCK TABLES;
+ --echo connection con1
+ connection con1;
+ --echo retrieve INSERT result.
+ reap;
+ disconnect con1;
+--echo connection default
+connection default;
+DROP TABLE t1;
+
+#
+# Cleanup after test case.
+# Otherwise signal would contain 'flushed' here,
+# which could confuse the next test.
+#
+SET DEBUG_SYNC= 'RESET';
+
=== modified file 'mysql-test/t/delete.test'
--- a/mysql-test/t/delete.test 2007-12-07 14:15:58 +0000
+++ b/mysql-test/t/delete.test 2009-09-28 10:48:52 +0000
@@ -292,3 +292,47 @@ DROP TABLE t1;
DROP FUNCTION f1;
--echo End of 5.0 tests
+
+--echo #
+--echo # Bug#46958: Assertion in Diagnostics_area::set_ok_status, trigger,
+--echo # merge table
+--echo #
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+CREATE TABLE t3 ( a INT );
+
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+INSERT INTO t3 VALUES (1), (2);
+
+CREATE TRIGGER tr1 BEFORE DELETE ON t2
+FOR EACH ROW INSERT INTO no_such_table VALUES (1);
+
+--error ER_NO_SUCH_TABLE
+DELETE t1, t2, t3 FROM t1, t2, t3;
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+DROP TABLE t1, t2, t3;
+
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+CREATE TABLE t3 ( a INT );
+
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+INSERT INTO t3 VALUES (1), (2);
+
+CREATE TRIGGER tr1 AFTER DELETE ON t2
+FOR EACH ROW INSERT INTO no_such_table VALUES (1);
+
+--error ER_NO_SUCH_TABLE
+DELETE t1, t2, t3 FROM t1, t2, t3;
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+DROP TABLE t1, t2, t3;
=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def 2009-09-07 20:50:10 +0000
+++ b/mysql-test/t/disabled.def 2009-11-16 20:49:51 +0000
@@ -10,7 +10,8 @@
#
##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
-innodb_bug39438 : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently"
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
-init_connect : Bug#44920 2009-07-06 pcrews MTR not processing master.opt input properly on Windows. *Must be done this way due to the nature of the bug*
-
+partition_innodb_builtin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
+partition_innodb_plugin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
+innodb-autoinc : Bug#48482 2009-11-02 svoj innodb-autoinc.test fails with results difference
+rpl_killed_ddl : Bug#45520: rpl_killed_ddl fails sporadically in pb2
=== modified file 'mysql-test/t/distinct.test'
--- a/mysql-test/t/distinct.test 2008-10-29 17:38:18 +0000
+++ b/mysql-test/t/distinct.test 2009-09-05 20:42:17 +0000
@@ -573,4 +573,44 @@ SELECT DISTINCT a, b, d, c FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug #46159: simple query that never returns
+--echo #
+
+# Set max_heap_table_size to the minimum value so that GROUP BY table in the
+# SELECT query below gets converted to MyISAM
+SET @old_max_heap_table_size = @@max_heap_table_size;
+SET @@max_heap_table_size = 16384;
+
+# Set sort_buffer_size to the mininum value so that remove_duplicates() calls
+# remove_dup_with_compare()
+SET @old_sort_buffer_size = @@sort_buffer_size;
+SET @@sort_buffer_size = 32804;
+
+CREATE TABLE t1(c1 int, c2 VARCHAR(20));
+INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4');
+# Now we just need to pad the table with random data so we have enough unique
+# values to force conversion of the GROUP BY table to MyISAM
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+
+# First rows of the GROUP BY table that will be processed by
+# remove_dup_with_compare()
+SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4;
+
+# The actual test case
+SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1;
+
+# Cleanup
+
+DROP TABLE t1;
+SET @@sort_buffer_size = @old_sort_buffer_size;
+SET @@max_heap_table_size = @old_max_heap_table_size;
+
--echo End of 5.1 tests
=== modified file 'mysql-test/t/explain.test'
--- a/mysql-test/t/explain.test 2009-06-11 16:21:32 +0000
+++ b/mysql-test/t/explain.test 2009-10-29 23:01:54 +0000
@@ -135,6 +135,17 @@ EXPLAIN EXTENDED SELECT COUNT(a) FROM t1
DROP TABLE t1;
+#
+# Bug#45989 memory leak after explain encounters an error in the query
+#
+CREATE TABLE t1(a LONGTEXT);
+INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
+INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
+--error ER_BAD_FIELD_ERROR
+EXPLAIN SELECT DISTINCT 1 FROM t1,
+ (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
+ WHERE t1.a = d1.a;
+DROP TABLE t1;
# End of 5.0 tests.
@@ -156,4 +167,24 @@ flush tables;
SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
drop tables t1, t2;
+--echo #
+--echo # Bug#48295:
+--echo # explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
+--echo #
+
+CREATE TABLE t1 (f1 INT);
+
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+
+# EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE.
+--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+EXPLAIN EXTENDED SELECT 1 FROM t1
+ WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
+SHOW WARNINGS;
+
+SET SESSION sql_mode=@old_sql_mode;
+
+DROP TABLE t1;
+
--echo End of 5.1 tests.
=== modified file 'mysql-test/t/flush_read_lock_kill.test'
--- a/mysql-test/t/flush_read_lock_kill.test 2009-03-06 14:56:17 +0000
+++ b/mysql-test/t/flush_read_lock_kill.test 2009-10-20 18:00:07 +0000
@@ -57,7 +57,7 @@ connection con1;
# debug build running without our --debug=make_global..., will be
# error 0 (no error). The only important thing to test is that on
# debug builds with our --debug=make_global... we don't hang forever.
---error 0,1053,2013
+--error 0,1317,2013
reap;
connection con2;
=== modified file 'mysql-test/t/func_group.test'
--- a/mysql-test/t/func_group.test 2009-04-01 11:10:03 +0000
+++ b/mysql-test/t/func_group.test 2009-10-14 08:46:50 +0000
@@ -1006,3 +1006,51 @@ DROP TABLE t1;
###
--echo End of 5.0 tests
+
+--echo #
+--echo # BUG#47280 - strange results from count(*) with order by multiple
+--echo # columns without where/group
+--echo #
+
+--echo #
+--echo # Initialize test
+--echo #
+
+CREATE TABLE t1 (
+ pk INT NOT NULL,
+ i INT,
+ PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1,11),(2,12),(3,13);
+
+--echo #
+--echo # Start test
+--echo # All the following queries shall return 1 record
+--echo #
+
+--echo
+--echo # Masking all correct values {11...13} for column i in this result.
+--replace_column 2 #
+SELECT MAX(pk) as max, i
+FROM t1
+ORDER BY max;
+
+--echo
+EXPLAIN
+SELECT MAX(pk) as max, i
+FROM t1
+ORDER BY max;
+
+--echo
+--echo # Only 11 is correct for collumn i in this result
+SELECT MAX(pk) as max, i
+FROM t1
+WHERE pk<2
+ORDER BY max;
+
+--echo #
+--echo # Cleanup
+--echo #
+DROP TABLE t1;
+
+--echo End of 5.1 tests
=== modified file 'mysql-test/t/func_in.test'
--- a/mysql-test/t/func_in.test 2009-05-25 08:00:40 +0000
+++ b/mysql-test/t/func_in.test 2009-10-05 05:27:36 +0000
@@ -456,4 +456,89 @@ SELECT SUM( DISTINCT e ) FROM t1 GROUP B
((AVG( 1 ), 1 + c, 1 + d), (AVG( 1 ), 2 + c, 2 + d));
DROP TABLE t1;
+--echo #
+--echo # Bug #44139: Table scan when NULL appears in IN clause
+--echo #
+
+--disable_warnings
+
+CREATE TABLE t1 (
+ c_int INT NOT NULL,
+ c_decimal DECIMAL(5,2) NOT NULL,
+ c_float FLOAT(5, 2) NOT NULL,
+ c_bit BIT(10) NOT NULL,
+ c_date DATE NOT NULL,
+ c_datetime DATETIME NOT NULL,
+ c_timestamp TIMESTAMP NOT NULL,
+ c_time TIME NOT NULL,
+ c_year YEAR NOT NULL,
+ c_char CHAR(10) NOT NULL,
+ INDEX(c_int), INDEX(c_decimal), INDEX(c_float), INDEX(c_bit), INDEX(c_date),
+ INDEX(c_datetime), INDEX(c_timestamp), INDEX(c_time), INDEX(c_year),
+ INDEX(c_char));
+
+INSERT INTO t1 (c_int) VALUES (1), (2), (3), (4), (5);
+INSERT INTO t1 (c_int) SELECT 0 FROM t1;
+INSERT INTO t1 (c_int) SELECT 0 FROM t1;
+
+--enable_warnings
+
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, 1, 2, 3);
+
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, NULL, 2, NULL, 3, NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, NULL);
+
+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, 1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, NULL);
+
+EXPLAIN SELECT * FROM t1 WHERE c_float IN (1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, 1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, NULL);
+
+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, 1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, NULL);
+
+EXPLAIN SELECT * FROM t1 WHERE c_date
+ IN ('2009-09-01', '2009-09-02', '2009-09-03');
+EXPLAIN SELECT * FROM t1 WHERE c_date
+ IN (NULL, '2009-09-01', '2009-09-02', '2009-09-03');
+EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL, NULL);
+
+EXPLAIN SELECT * FROM t1 WHERE c_datetime
+ IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
+EXPLAIN SELECT * FROM t1 WHERE c_datetime
+ IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
+EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL, NULL);
+
+EXPLAIN SELECT * FROM t1 WHERE c_timestamp
+ IN ('2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
+EXPLAIN SELECT * FROM t1 WHERE c_timestamp
+ IN (NULL, '2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
+EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL, NULL);
+
+EXPLAIN SELECT * FROM t1 WHERE c_year IN (1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, 1, 2, 3);
+EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, NULL);
+
+EXPLAIN SELECT * FROM t1 WHERE c_char IN ('1', '2', '3');
+EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, '1', '2', '3');
+EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL);
+EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL);
+
+DROP TABLE t1;
+
+--echo #
+
--echo End of 5.1 tests
=== modified file 'mysql-test/t/func_str.test'
--- a/mysql-test/t/func_str.test 2009-05-13 18:39:35 +0000
+++ b/mysql-test/t/func_str.test 2009-09-10 10:30:03 +0000
@@ -1291,6 +1291,19 @@ INSERT INTO t1 VALUES ('aaaaaaaa');
SELECT LOAD_FILE(a) FROM t1;
DROP TABLE t1;
+#
+# Bug#46815 CONCAT_WS returning wrong data
+#
+CREATE TABLE t1 (f2 VARCHAR(20));
+CREATE TABLE t2 (f2 VARCHAR(20));
+
+INSERT INTO t1 VALUES ('MIN'),('MAX');
+INSERT INTO t2 VALUES ('LOAD');
+
+SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1;
+
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests
=== modified file 'mysql-test/t/gis-rtree.test'
--- a/mysql-test/t/gis-rtree.test 2009-10-28 07:52:34 +0000
+++ b/mysql-test/t/gis-rtree.test 2009-11-16 20:49:51 +0000
@@ -893,4 +893,25 @@ SELECT COUNT(*) FROM t1 IGNORE INDEX (b)
DROP TABLE t1;
+
+--echo #
+--echo # Bug #48258: Assertion failed when using a spatial index
+--echo #
+CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
+INSERT INTO t1 VALUES
+ (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
+ (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
+EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
+DROP TABLE t1;
+
+
--echo End of 5.0 tests.
=== modified file 'mysql-test/t/gis.test'
--- a/mysql-test/t/gis.test 2009-07-10 23:12:13 +0000
+++ b/mysql-test/t/gis.test 2009-10-24 06:57:31 +0000
@@ -655,6 +655,22 @@ insert into t1 values (),(),();
select min(`col002`) from t1 union select `col002` from t1;
drop table t1;
+--echo #
+--echo # Bug #47780: crash when comparing GIS items from subquery
+--echo #
+
+CREATE TABLE t1(a INT, b MULTIPOLYGON);
+INSERT INTO t1 VALUES
+ (0,
+ GEOMFROMTEXT(
+ 'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
+
+--echo # must not crash
+SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
+
+DROP TABLE t1;
+
+
--echo End of 5.0 tests
=== modified file 'mysql-test/t/grant3.test'
--- a/mysql-test/t/grant3.test 2009-02-02 21:20:25 +0000
+++ b/mysql-test/t/grant3.test 2009-10-20 06:17:57 +0000
@@ -163,6 +163,41 @@ connection default;
DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1;
+--echo #
+--echo # Bug#41597 - After rename of user, there are additional grants
+--echo # when grants are reapplied.
+--echo #
+
+CREATE DATABASE temp;
+CREATE TABLE temp.t1(a INT, b VARCHAR(10));
+INSERT INTO temp.t1 VALUES(1, 'name1');
+INSERT INTO temp.t1 VALUES(2, 'name2');
+INSERT INTO temp.t1 VALUES(3, 'name3');
+
+
+CREATE USER 'user1'@'%';
+RENAME USER 'user1'@'%' TO 'user2'@'%';
+--echo # Show privileges after rename and BEFORE grant
+SHOW GRANTS FOR 'user2'@'%';
+GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
+--echo # Show privileges after rename and grant
+SHOW GRANTS FOR 'user2'@'%';
+
+--echo # Connect as the renamed user
+connect (conn1, localhost, user2,,);
+connection conn1;
+SHOW GRANTS;
+SELECT a FROM temp.t1;
+--echo # Check for additional privileges by accessing a
+--echo # non privileged column. We shouldn't be able to
+--echo # access this column.
+--error ER_COLUMNACCESS_DENIED_ERROR
+SELECT b FROM temp.t1;
+disconnect conn1;
+
+connection default;
+DROP USER 'user2'@'%';
+DROP DATABASE temp;
--echo End of 5.0 tests
=== added file 'mysql-test/t/grant_lowercase_fs.test'
--- a/mysql-test/t/grant_lowercase_fs.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/grant_lowercase_fs.test 2009-10-27 08:09:19 +0000
@@ -0,0 +1,30 @@
+-- source include/have_case_insensitive_fs.inc
+-- source include/not_embedded.inc
+
+
+#
+# Bug#41049 does syntax "grant" case insensitive?
+#
+create database db1;
+GRANT CREATE ON db1.* to user_1@localhost;
+GRANT SELECT ON db1.* to USER_1@localhost;
+
+connect (con1,localhost,user_1,,db1);
+CREATE TABLE t1(f1 int);
+--error 1142
+SELECT * FROM t1;
+connect (con2,localhost,USER_1,,db1);
+SELECT * FROM t1;
+--error 1142
+CREATE TABLE t2(f1 int);
+
+connection default;
+disconnect con1;
+disconnect con2;
+
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
+DROP USER user_1@localhost;
+DROP USER USER_1@localhost;
+DROP DATABASE db1;
+use test;
=== modified file 'mysql-test/t/information_schema_db.test'
--- a/mysql-test/t/information_schema_db.test 2009-09-07 20:50:10 +0000
+++ b/mysql-test/t/information_schema_db.test 2009-11-16 20:49:51 +0000
@@ -181,7 +181,6 @@ show fields from testdb_1.v7;
--error ER_TABLEACCESS_DENIED_ERROR
show create view testdb_1.v7;
---error ER_VIEW_NO_EXPLAIN
show create view v4;
#--error ER_VIEW_NO_EXPLAIN
show fields from v4;
=== modified file 'mysql-test/t/innodb-autoinc.test'
--- a/mysql-test/t/innodb-autoinc.test 2009-06-09 15:08:46 +0000
+++ b/mysql-test/t/innodb-autoinc.test 2009-11-16 20:49:51 +0000
@@ -156,7 +156,7 @@ DROP TABLE t1;
#
# Test changes to AUTOINC next value calculation
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(5),(NULL);
@@ -173,7 +173,7 @@ DROP TABLE t1;
# Reset the AUTOINC session variables
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(0);
@@ -193,13 +193,13 @@ DROP TABLE t1;
# Reset the AUTOINC session variables
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(-1);
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL);
INSERT INTO t1 VALUES (250),(NULL);
SELECT * FROM t1;
@@ -214,13 +214,13 @@ DROP TABLE t1;
# Reset the AUTOINC session variables
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(-1);
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
INSERT INTO t1 VALUES (-2);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (2);
@@ -240,13 +240,13 @@ DROP TABLE t1;
# Reset the AUTOINC session variables
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(-1);
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL);
INSERT INTO t1 VALUES (250),(NULL);
SELECT * FROM t1;
@@ -262,7 +262,7 @@ DROP TABLE t1;
# Check for overflow handling when increment is > 1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
@@ -271,7 +271,7 @@ INSERT INTO t1 VALUES(NULL);
INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
# This should just fit
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
SELECT * FROM t1;
@@ -281,7 +281,7 @@ DROP TABLE t1;
# Check for overflow handling when increment and offser are > 1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
@@ -290,7 +290,7 @@ INSERT INTO t1 VALUES(NULL);
INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
# This should fail because of overflow but it doesn't, it seems to be
# a MySQL server bug. It wraps around to 0 for the last value.
# See MySQL Bug# 39828
@@ -313,7 +313,7 @@ DROP TABLE t1;
# Check for overflow handling when increment and offset are odd numbers
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
@@ -322,7 +322,7 @@ INSERT INTO t1 VALUES(NULL);
INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
# This should fail because of overflow but it doesn't. It fails with
# a duplicate entry message because of a MySQL server bug, it wraps
# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace
@@ -344,7 +344,7 @@ DROP TABLE t1;
# and check for large -ve numbers
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
@@ -355,7 +355,7 @@ INSERT INTO t1 VALUES(-92233720368547758
INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
SELECT * FROM t1;
DROP TABLE t1;
@@ -364,7 +364,7 @@ DROP TABLE t1;
# large numbers 2^60
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
@@ -373,7 +373,7 @@ INSERT INTO t1 VALUES(NULL);
INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
# This should fail because of overflow but it doesn't. It wraps around
# and the autoinc values look bogus too.
# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error
@@ -396,7 +396,7 @@ DROP TABLE t1;
#
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
-SHOW VARIABLES LIKE "auto_inc%";
+SHOW VARIABLES LIKE "%auto_inc%";
CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(NULL, 1);
INSERT INTO t1 VALUES(NULL, 2);
@@ -478,3 +478,145 @@ INSERT INTO t2 SELECT c1 FROM t1;
INSERT INTO t2 SELECT NULL FROM t1;
DROP TABLE t1;
DROP TABLE t2;
+#
+# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
+# the index (PRIMARY)
+# This test requires a restart of the server
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (null);
+INSERT INTO t1 VALUES (null);
+ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
+SELECT * FROM t1;
+# Restart the server
+-- source include/restart_mysqld.inc
+# The MySQL and InnoDB data dictionaries should now be out of sync.
+# The select should print message to the error log
+SELECT * FROM t1;
+# MySQL have made a change (http://lists.mysql.com/commits/75268) that no
+# longer results in the two data dictionaries being out of sync. If they
+# revert their changes then this check for ER_AUTOINC_READ_FAILED will need
+# to be enabled.
+-- error ER_AUTOINC_READ_FAILED,1467
+INSERT INTO t1 VALUES(null);
+ALTER TABLE t1 AUTO_INCREMENT = 3;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# If the user has specified negative values for an AUTOINC column then
+# InnoDB should ignore those values when setting the table's max value.
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+# TINYINT
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# SMALLINT
+#
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32767, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32757, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# MEDIUMINT
+#
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# INT
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# BIGINT
+#
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# End negative number check
+
+##
+# 47125: auto_increment start value is ignored if an index is created
+# and engine=innodb
+#
+CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
+CREATE INDEX i1 on T1(c2);
+SHOW CREATE TABLE T1;
+INSERT INTO T1 (c2) values (0);
+SELECT * FROM T1;
+DROP TABLE T1;
=== modified file 'mysql-test/t/innodb_bug39438.test'
--- a/mysql-test/t/innodb_bug39438.test 2008-12-14 20:31:13 +0000
+++ b/mysql-test/t/innodb_bug39438.test 2009-11-03 08:46:04 +0000
@@ -9,6 +9,10 @@
-- source include/have_innodb.inc
+--disable_query_log
+call mtr.add_suppression("InnoDB: Error: table 'test/bug39438'");
+--enable_query_log
+
SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server
=== added file 'mysql-test/t/innodb_bug44369.test'
--- a/mysql-test/t/innodb_bug44369.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_bug44369.test 2009-11-02 14:59:44 +0000
@@ -0,0 +1,21 @@
+# This is the test for bug 44369. We should
+# block table creation with columns match
+# some innodb internal reserved key words,
+# both case sensitively and insensitely.
+
+--source include/have_innodb.inc
+
+# This create table operation should fail.
+--error ER_CANT_CREATE_TABLE
+create table bug44369 (DB_ROW_ID int) engine=innodb;
+
+# This create should fail as well
+--error ER_CANT_CREATE_TABLE
+create table bug44369 (db_row_id int) engine=innodb;
+
+show warnings;
+
+--error ER_CANT_CREATE_TABLE
+create table bug44369 (db_TRX_Id int) engine=innodb;
+
+show warnings;
=== added file 'mysql-test/t/innodb_bug46000.test'
--- a/mysql-test/t/innodb_bug46000.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_bug46000.test 2009-11-16 20:49:51 +0000
@@ -0,0 +1,34 @@
+# This is the test for bug 46000. We shall
+# block any index creation with the name of
+# "GEN_CLUST_INDEX", which is the reserved
+# name for innodb default primary index.
+
+--source include/have_innodb.inc
+
+# This 'create table' operation should fail because of
+# using the reserve name as its index name.
+--error ER_WRONG_NAME_FOR_INDEX
+create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
+
+# Mixed upper/lower case of the reserved key words
+--error ER_WRONG_NAME_FOR_INDEX
+create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
+
+show warnings;
+
+create table bug46000(id int) engine=innodb;
+
+# This 'create index' operation should fail.
+--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_WRONG_NAME_FOR_INDEX
+create index GEN_CLUST_INDEX on bug46000(id);
+
+--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
+show warnings;
+
+# This 'create index' operation should succeed, no
+# temp table left from last failed create index
+# operation.
+create index idx on bug46000(id);
+
+drop table bug46000;
=== added file 'mysql-test/t/innodb_bug47777.test'
--- a/mysql-test/t/innodb_bug47777.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_bug47777.test 2009-11-02 14:41:40 +0000
@@ -0,0 +1,24 @@
+# This is the test for bug 47777. GEOMETRY
+# data is treated as BLOB data in innodb.
+# Consequently, its key value generation/storing
+# should follow the process for the BLOB
+# datatype as well.
+
+--source include/have_innodb.inc
+
+create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
+
+insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
+
+# Verify correct row get inserted.
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+
+# Update table bug47777 should be successful.
+update bug47777 set c2=GeomFromText('POINT(1 1)');
+
+# Verify the row get updated successfully. The original
+# c2 value should be changed to GeomFromText('POINT(1 1)').
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
+
+drop table bug47777;
=== renamed file 'mysql-test/t/bug40113-master.opt' => 'mysql-test/t/innodb_lock_wait_timeout_1-master.opt'
=== renamed file 'mysql-test/t/bug40113.test' => 'mysql-test/t/innodb_lock_wait_timeout_1.test'
--- a/mysql-test/t/bug40113.test 2009-07-13 15:11:16 +0000
+++ b/mysql-test/t/innodb_lock_wait_timeout_1.test 2009-11-03 17:45:52 +0000
@@ -43,4 +43,188 @@ DISCONNECT addconroot;
DROP TABLE t2, t1;
---echo End of 5.0 tests
+--echo # End of 5.0 tests
+
+--echo #
+--echo # Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
+--echo # FOR UPDATE
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int primary key auto_increment,
+ b int, index(b)) engine=innodb;
+insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+set autocommit=0;
+begin;
+select * from t1 where b=5 for update;
+connect (con1, localhost, root,,);
+connection con1;
+--error ER_LOCK_WAIT_TIMEOUT
+insert ignore into t1 (b) select a as b from t1;
+connection default;
+--echo # Cleanup
+--echo #
+disconnect con1;
+commit;
+set autocommit=default;
+drop table t1;
+
+--echo #
+--echo # Bug#41756 Strange error messages about locks from InnoDB
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+--echo # In the default transaction isolation mode, and/or with
+--echo # innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row()
+--echo # in InnoDB does nothing.
+--echo # Thus in order to reproduce the condition that led to the
+--echo # warning, one needs to relax isolation by either
+--echo # setting a weaker tx_isolation value, or by turning on
+--echo # the unsafe replication switch.
+--echo # For testing purposes, choose to tweak the isolation level,
+--echo # since it's settable at runtime, unlike
+--echo # innodb_locks_unsafe_for_binlog, which is
+--echo # only a command-line switch.
+--echo #
+set @@session.tx_isolation="read-committed";
+
+--echo # Prepare data. We need a table with a unique index,
+--echo # for join_read_key to be used. The other column
+--echo # allows to control what passes WHERE clause filter.
+create table t1 (a int primary key, b int) engine=innodb;
+--echo # Let's make sure t1 has sufficient amount of rows
+--echo # to exclude JT_ALL access method when reading it,
+--echo # i.e. make sure that JT_EQ_REF(a) is always preferred.
+insert into t1 values (1,1), (2,null), (3,1), (4,1),
+ (5,1), (6,1), (7,1), (8,1), (9,1), (10,1),
+ (11,1), (12,1), (13,1), (14,1), (15,1),
+ (16,1), (17,1), (18,1), (19,1), (20,1);
+--echo #
+--echo # Demonstrate that for the SELECT statement
+--echo # used later in the test JT_EQ_REF access method is used.
+--echo #
+--vertical_results
+explain
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+ select 2 as a, 2 as b) as t2 for update;
+--horizontal_results
+--echo #
+--echo # Demonstrate that the reported SELECT statement
+--echo # no longer produces warnings.
+--echo #
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+ select 2 as a, 2 as b) as t2 for update;
+commit;
+--echo #
+--echo # Demonstrate that due to lack of inter-sweep "reset" function,
+--echo # we keep some non-matching records locked, even though we know
+--echo # we could unlock them.
+--echo # To do that, show that if there is only one distinct value
+--echo # for a in t2 (a=2), we will keep record (2,null) in t1 locked.
+--echo # But if we add another value for "a" to t2, say 6,
+--echo # join_read_key cache will be pruned at least once,
+--echo # and thus record (2, null) in t1 will get unlocked.
+--echo #
+begin;
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+ select 2 as a, 2 as b) as t2 for update;
+connect (con1,localhost,root,,);
+--echo #
+--echo # Switching to connection con1
+connection con1;
+--echo # We should be able to delete all records from t1 except (2, null),
+--echo # since they were not locked.
+begin;
+--echo # Delete in series of 3 records so that full scan
+--echo # is not used and we're not blocked on record (2,null)
+delete from t1 where a in (1,3,4);
+delete from t1 where a in (5,6,7);
+delete from t1 where a in (8,9,10);
+delete from t1 where a in (11,12,13);
+delete from t1 where a in (14,15,16);
+delete from t1 where a in (17,18);
+delete from t1 where a in (19,20);
+--echo #
+--echo # Record (2, null) is locked. This is actually unnecessary,
+--echo # because the previous select returned no rows.
+--echo # Just demonstrate the effect.
+--echo #
+--error ER_LOCK_WAIT_TIMEOUT
+delete from t1;
+rollback;
+--echo #
+--echo # Switching to connection default
+connection default;
+--echo #
+--echo # Show that the original contents of t1 is intact:
+select * from t1;
+commit;
+--echo #
+--echo # Have a one more record in t2 to show that
+--echo # if join_read_key cache is purned, the current
+--echo # row under the cursor is unlocked (provided, this row didn't
+--echo # match the partial WHERE clause, of course).
+--echo # Sic: the result of this test dependent on the order of retrieval
+--echo # of records --echo # from the derived table, if !
+--echo # We use DELETE to disable the JOIN CACHE. This DELETE modifies no
+--echo # records. It also should leave no InnoDB row locks.
+--echo #
+begin;
+delete t1.* from t1 natural join (select 2 as a, 2 as b union all
+ select 0 as a, 0 as b) as t2;
+--echo # Demonstrate that nothing was deleted form t1
+select * from t1;
+--echo #
+--echo # Switching to connection con1
+connection con1;
+begin;
+--echo # Since there is another distinct record in the derived table
+--echo # the previous matching record in t1 -- (2,null) -- was unlocked.
+delete from t1;
+--echo # We will need the contents of the table again.
+rollback;
+select * from t1;
+commit;
+--echo #
+--echo # Switching to connection default
+connection default;
+rollback;
+begin;
+--echo #
+--echo # Before this patch, we could wrongly unlock a record
+--echo # that was cached and later used in a join. Demonstrate that
+--echo # this is no longer the case.
+--echo # Sic: this test is also order-dependent (i.e. the
+--echo # the bug would show up only if the first record in the union
+--echo # is retreived and processed first.
+--echo #
+--echo # Verify that JT_EQ_REF is used.
+--vertical_results
+explain
+select 1 from t1 natural join (select 3 as a, 2 as b union all
+ select 3 as a, 1 as b) as t2 for update;
+--horizontal_results
+--echo # Lock the record.
+select 1 from t1 natural join (select 3 as a, 2 as b union all
+ select 3 as a, 1 as b) as t2 for update;
+--echo # Switching to connection con1
+connection con1;
+--echo #
+--echo # We should not be able to delete record (3,1) from t1,
+--echo # (previously it was possible).
+--echo #
+--error ER_LOCK_WAIT_TIMEOUT
+delete from t1 where a=3;
+--echo # Switching to connection default
+connection default;
+commit;
+
+disconnect con1;
+set @@session.tx_isolation=default;
+drop table t1;
+
+--echo #
+--echo # End of 5.1 tests
+--echo #
=== modified file 'mysql-test/t/innodb_mysql.test'
--- a/mysql-test/t/innodb_mysql.test 2009-09-07 20:50:10 +0000
+++ b/mysql-test/t/innodb_mysql.test 2009-11-16 20:49:51 +0000
@@ -463,4 +463,33 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRI
DROP TABLE t1;
+--echo #
+--echo # Bug #47963: Wrong results when index is used
+--echo #
+CREATE TABLE t1(
+ a VARCHAR(5) NOT NULL,
+ b VARCHAR(5) NOT NULL,
+ c DATETIME NOT NULL,
+ KEY (c)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00');
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
+EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
+DROP TABLE t1;
+
+
--echo End of 5.1 tests
=== modified file 'mysql-test/t/insert_select.test'
--- a/mysql-test/t/insert_select.test 2009-09-07 20:50:10 +0000
+++ b/mysql-test/t/insert_select.test 2009-11-16 20:49:51 +0000
@@ -392,4 +392,32 @@ insert into t1 values(1),(2),(3);
create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
check table t2 extended;
drop table t1,t2;
+
--echo End of 5.0 tests
+
+# The following is not relevant for MariaDB as we are using Maria for
+# tmp tables.
+
+--echo ##################################################################
+--echo #
+--echo # Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
+--echo #
+
+CREATE TABLE t1(a INT);
+# To force MyISAM temp. table in the following INSERT ... SELECT.
+SET max_heap_table_size = 16384;
+# To overflow the temp. table.
+SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
+SET GLOBAL myisam_data_pointer_size = 2;
+
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+
+call mtr.add_suppression("mysqld: The table '.*#sql.*' is full");
+--error 0,ER_RECORD_FILE_FULL,ER_RECORD_FILE_FULL
+INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
+
+# Cleanup
+SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
=== modified file 'mysql-test/t/join.test'
--- a/mysql-test/t/join.test 2008-10-06 12:37:52 +0000
+++ b/mysql-test/t/join.test 2009-10-30 08:03:18 +0000
@@ -729,4 +729,78 @@ SELECT * FROM t1 JOIN t2 ON b=c ORDER BY
SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
DROP TABLE IF EXISTS t1,t2;
+
+
+--echo #
+--echo # Bug #42116: Mysql crash on specific query
+--echo #
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+CREATE TABLE t3 (a INT, INDEX (a));
+CREATE TABLE t4 (a INT);
+CREATE TABLE t5 (a INT);
+CREATE TABLE t6 (a INT);
+
+INSERT INTO t1 VALUES (1), (1), (1);
+
+INSERT INTO t2 VALUES
+(2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
+
+INSERT INTO t3 VALUES
+(3), (3), (3), (3), (3), (3), (3), (3), (3), (3);
+
+EXPLAIN
+SELECT *
+FROM
+ t1 JOIN t2 ON t1.a = t2.a
+ LEFT JOIN
+ (
+ (
+ t3 LEFT JOIN t4 ON t3.a = t4.a
+ )
+ LEFT JOIN
+ (
+ t5 LEFT JOIN t6 ON t5.a = t6.a
+ )
+ ON t4.a = t5.a
+ )
+ ON t1.a = t3.a;
+
+SELECT *
+FROM
+ t1 JOIN t2 ON t1.a = t2.a
+ LEFT JOIN
+ (
+ (
+ t3 LEFT JOIN t4 ON t3.a = t4.a
+ )
+ LEFT JOIN
+ (
+ t5 LEFT JOIN t6 ON t5.a = t6.a
+ )
+ ON t4.a = t5.a
+ )
+ ON t1.a = t3.a;
+
+DROP TABLE t1,t2,t3,t4,t5,t6;
+
--echo End of 5.0 tests.
+
+
+#
+# Bug#47150 Assertion in Field_long::val_int() on MERGE + TRIGGER + multi-table UPDATE
+#
+CREATE TABLE t1 (f1 int);
+
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2 VALUES (1);
+CREATE VIEW v1 AS SELECT * FROM t2;
+
+PREPARE stmt FROM 'UPDATE t2 AS A NATURAL JOIN v1 B SET B.f1 = 1';
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP VIEW v1;
+DROP TABLE t1, t2;
=== modified file 'mysql-test/t/kill.test'
--- a/mysql-test/t/kill.test 2009-10-28 07:52:34 +0000
+++ b/mysql-test/t/kill.test 2009-11-16 20:49:51 +0000
@@ -99,7 +99,7 @@ select ((@id := kill_id) - kill_id) from
kill @id;
connection conn1;
--- error 1053,2013
+-- error 1317,2013
reap;
connection default;
=== added file 'mysql-test/t/locale.test'
--- a/mysql-test/t/locale.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/locale.test 2009-10-19 08:44:44 +0000
@@ -0,0 +1,18 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo Start of 5.4 tests
+--echo #
+--echo # Bug#43207 wrong LC_TIME names for romanian locale
+--echo #
+SET NAMES utf8;
+SET lc_time_names=ro_RO;
+SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
+SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
+SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
+SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
+SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
+SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
+SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
+--echo End of 5.4 tests
=== modified file 'mysql-test/t/lowercase_fs_off.test'
--- a/mysql-test/t/lowercase_fs_off.test 2009-05-15 10:15:56 +0000
+++ b/mysql-test/t/lowercase_fs_off.test 2009-10-27 10:09:36 +0000
@@ -29,3 +29,65 @@ disconnect master;
connection default;
# End of 4.1 tests
+
+#
+# Bug#41049 does syntax "grant" case insensitive?
+#
+CREATE DATABASE d1;
+USE d1;
+CREATE TABLE T1(f1 INT);
+CREATE TABLE t1(f1 INT);
+GRANT SELECT ON T1 to user_1@localhost;
+
+connect (con1,localhost,user_1,,d1);
+--error ER_TABLEACCESS_DENIED_ERROR
+select * from t1;
+select * from T1;
+connection default;
+GRANT SELECT ON t1 to user_1@localhost;
+connection con1;
+select * from information_schema.table_privileges;
+connection default;
+disconnect con1;
+
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
+DROP USER user_1@localhost;
+DROP DATABASE d1;
+USE test;
+
+CREATE DATABASE db1;
+USE db1;
+CREATE PROCEDURE p1() BEGIN END;
+CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
+
+GRANT USAGE ON db1.* to user_1@localhost;
+GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
+GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
+GRANT UPDATE ON db1.* to USER_1@localhost;
+
+connect (con1,localhost,user_1,,db1);
+call p1();
+call P1();
+select f1(1);
+connect (con2,localhost,USER_1,,db1);
+--error ER_PROCACCESS_DENIED_ERROR
+call p1();
+--error ER_PROCACCESS_DENIED_ERROR
+call P1();
+--error ER_PROCACCESS_DENIED_ERROR
+select f1(1);
+
+connection default;
+disconnect con1;
+disconnect con2;
+
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
+DROP FUNCTION f1;
+DROP PROCEDURE p1;
+DROP USER user_1@localhost;
+DROP USER USER_1@localhost;
+DROP DATABASE db1;
+use test;
+
+# End of 5.0 tests
=== added file 'mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt'
--- a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt 2009-09-09 09:38:50 +0000
@@ -0,0 +1,2 @@
+--lower-case-table-names=2
+--tmpdir=$MYSQLTEST_VARDIR/tmp/MixedCase
=== added file 'mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh'
--- a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh 2009-09-09 09:38:50 +0000
@@ -0,0 +1,6 @@
+# This test requires a non-lowercase tmpdir directory on a case-sensitive
+# filesystem.
+
+d="$MYSQLTEST_VARDIR/tmp/MixedCase"
+test -d "$d" || mkdir "$d"
+rm -f "$d"/*
=== added file 'mysql-test/t/lowercase_mixed_tmpdir_innodb.test'
--- a/mysql-test/t/lowercase_mixed_tmpdir_innodb.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/lowercase_mixed_tmpdir_innodb.test 2009-09-09 09:38:50 +0000
@@ -0,0 +1,12 @@
+--source include/have_lowercase2.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (id int) engine=InnoDB;
+insert into t1 values (1);
+create temporary table t2 engine=InnoDB select * from t1;
+drop temporary table t2;
+drop table t1;
=== modified file 'mysql-test/t/lowercase_table3.test'
--- a/mysql-test/t/lowercase_table3.test 2009-02-13 21:12:59 +0000
+++ b/mysql-test/t/lowercase_table3.test 2009-08-28 14:13:27 +0000
@@ -9,7 +9,7 @@
--source include/have_case_insensitive_file_system.inc
--source include/not_windows.inc
-call mtr.add_suppression("Cannot find or open table test/BUG29839 from .*");
+call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
--disable_warnings
DROP TABLE IF EXISTS t1,T1;
=== modified file 'mysql-test/t/myisam-system.test'
--- a/mysql-test/t/myisam-system.test 2007-12-12 17:19:24 +0000
+++ b/mysql-test/t/myisam-system.test 2009-09-17 11:33:23 +0000
@@ -12,11 +12,11 @@ let $MYSQLD_DATADIR= `select @@datadir`;
drop table if exists t1;
create table t1 (a int) engine=myisam;
--remove_file $MYSQLD_DATADIR/test/t1.MYI
---error 1051,6
+--error ER_BAD_TABLE_ERROR,6
drop table t1;
create table t1 (a int) engine=myisam;
--remove_file $MYSQLD_DATADIR/test/t1.MYD
---error 1105,6,29
+--error ER_BAD_TABLE_ERROR,6,29
drop table t1;
---error 1051
+--error ER_BAD_TABLE_ERROR
drop table t1;
=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test 2009-10-28 07:52:34 +0000
+++ b/mysql-test/t/myisam.test 2009-11-16 20:49:51 +0000
@@ -1549,4 +1549,50 @@ SELECT h+0, d + 0, e, g + 0 FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field
+--echo # (same content / differen checksum)
+--echo #
+
+CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
+INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
+checksum table t1;
+CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
+INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
+checksum table t2;
+CREATE TABLE t3 select * from t1;
+checksum table t3;
+drop table t1,t2,t3;
+
+
+#
+# BUG#47073 - valgrind errs, corruption,failed repair of partition,
+# low myisam_sort_buffer_size
+#
+CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
+INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
+ (6,'0'),(7,'0');
+INSERT INTO t1 SELECT a+10,b FROM t1;
+INSERT INTO t1 SELECT a+20,b FROM t1;
+INSERT INTO t1 SELECT a+40,b FROM t1;
+INSERT INTO t1 SELECT a+80,b FROM t1;
+INSERT INTO t1 SELECT a+160,b FROM t1;
+INSERT INTO t1 SELECT a+320,b FROM t1;
+INSERT INTO t1 SELECT a+640,b FROM t1;
+INSERT INTO t1 SELECT a+1280,b FROM t1;
+INSERT INTO t1 SELECT a+2560,b FROM t1;
+INSERT INTO t1 SELECT a+5120,b FROM t1;
+SET myisam_sort_buffer_size=4;
+REPAIR TABLE t1;
+
+SET myisam_repair_threads=2;
+# May report different values depending on threads activity.
+--disable_result_log
+REPAIR TABLE t1;
+--enable_result_log
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
+CHECK TABLE t1;
+DROP TABLE t1;
+
--echo End of 5.1 tests
=== modified file 'mysql-test/t/myisam_crash_before_flush_keys.test'
--- a/mysql-test/t/myisam_crash_before_flush_keys.test 2009-04-06 07:01:17 +0000
+++ b/mysql-test/t/myisam_crash_before_flush_keys.test 2009-10-14 11:26:16 +0000
@@ -26,12 +26,6 @@ SET SESSION debug="d,crash_before_flush_
--error 2013
FLUSH TABLE t1;
---echo # Run MYISAMCHK tool to check the table t1 and repair
---replace_result $MYISAMCHK MYISAMCHK $MYSQLD_DATADIR MYSQLD_DATADIR
---error 255
---exec $MYISAMCHK -cs $MYSQLD_DATADIR/test/t1 2>&1
---exec $MYISAMCHK -rs $MYSQLD_DATADIR/test/t1
-
--echo # Write file to make mysql-test-run.pl start the server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@@ -42,8 +36,6 @@ FLUSH TABLE t1;
--echo # it to be back online again
--source include/wait_until_connected_again.inc
-SHOW CREATE TABLE t1;
-
-SELECT * FROM t1 FORCE INDEX (PRIMARY);
-
+# Must report that the table wasn't closed properly
+CHECK TABLE t1;
DROP TABLE t1;
=== modified file 'mysql-test/t/mysqlbinlog.test'
--- a/mysql-test/t/mysqlbinlog.test 2009-05-08 17:24:15 +0000
+++ b/mysql-test/t/mysqlbinlog.test 2009-09-30 02:31:25 +0000
@@ -71,7 +71,8 @@ select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLD_DATADIR/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=330 $MYSQLD_DATADIR/master-bin.000002
+
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -107,7 +108,7 @@ select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=239 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=330 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 mysqlbinlog does not accept input from stdin
--disable_query_log
@@ -377,6 +378,68 @@ FLUSH LOGS;
# We do not need the results, just make sure that mysqlbinlog does not crash
--exec $MYSQL_BINLOG --hexdump --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 >/dev/null
+#
+# #46998
+# This test verifies if the 'BEGIN', 'COMMIT' and 'ROLLBACK' are output
+# in regardless of database filtering
+#
+
+RESET MASTER;
+FLUSH LOGS;
+
+# The following three test cases were wrtten into binlog_transaction.000001
+# Test case1: Test if the 'BEGIN' and 'COMMIT' are output for the 'test' database
+# in transaction1 base on innodb engine tables
+# use test;
+# create table t1(a int) engine= innodb;
+# use mysql;
+# create table t2(a int) engine= innodb;
+# Transaction1 begin
+# begin;
+# use test;
+# insert into t1 (a) values (1);
+# use mysql;
+# insert into t2 (a) values (1);
+# commit;
+# Transaction1 end
+
+# Test case2: Test if the 'BEGIN' and 'ROLLBACK' are output for the 'test' database
+# in transaction2 base on innodb and myisam engine tables
+# use test;
+# create table t3(a int) engine= innodb;
+# use mysql;
+# create table t4(a int) engine= myisam;
+# Transaction2 begin
+# begin;
+# use test;
+# insert into t3 (a) values (2);
+# use mysql;
+# insert into t4 (a) values (2);
+# rollback;
+# Transaction2 end
+
+# Test case3: Test if the 'BEGIN' and 'COMMIT' are output for the 'test' database
+# in transaction3 base on NDB engine tables
+# use test;
+# create table t5(a int) engine= NDB;
+# use mysql;
+# create table t6(a int) engine= NDB;
+# Transaction3 begin
+# begin;
+# use test;
+# insert into t5 (a) values (3);
+# use mysql;
+# insert into t6 (a) values (3);
+# commit;
+# Transaction3 end
+
+--echo #
+--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is exist
+--exec $MYSQL_BINLOG --database=test --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
+--echo #
+--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is not exist
+--exec $MYSQL_BINLOG --database=not_exist --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
+
--echo End of 5.0 tests
--echo End of 5.1 tests
=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test 2009-05-27 20:54:40 +0000
+++ b/mysql-test/t/mysqltest.test 2009-10-08 09:30:03 +0000
@@ -853,16 +853,21 @@ while ($outer)
eval SELECT '$outer = outer loop variable after dec' AS "";
}
+# Test source in an if in a while which is false on 1st iteration
+# Also test --error in same context
let $outer= 2; # Number of outer loops
+let $ifval= 0; # false 1st time
while ($outer)
{
- eval SELECT '$outer = outer loop variable after while' AS "";
+ echo outer=$outer ifval=$ifval;
- echo here is the sourced script;
-
- eval SELECT '$outer = outer loop variable before dec' AS "";
+ if ($ifval) {
+ --source $MYSQLTEST_VARDIR/tmp/sourced.inc
+ --error ER_NO_SUCH_TABLE
+ SELECT * from nowhere;
+ }
dec $outer;
- eval SELECT '$outer = outer loop variable after dec' AS "";
+ inc $ifval;
}
@@ -1663,6 +1668,20 @@ EOF
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+# Test append_file within while
+let $outer= 2; # Number of outer loops
+while ($outer)
+{
+ append_file $MYSQLTEST_VARDIR/tmp/app_while.tmp;
+These lines should be repeated,
+if things work as expected
+EOF
+ dec $outer;
+}
+
+cat_file $MYSQLTEST_VARDIR/tmp/app_while.tmp;
+remove_file $MYSQLTEST_VARDIR/tmp/app_while.tmp;
+
# ----------------------------------------------------------------------------
# test for cat_file
# ----------------------------------------------------------------------------
@@ -1710,10 +1729,6 @@ EOF
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
--diff_files $MYSQLTEST_VARDIR/tmp/diff2.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
-# Write the below commands to a intermediary file and execute them with
-# mysqltest in --exec, since the output will vary depending on what "diff"
-# is available it is sent to /dev/null
---write_file $MYSQLTEST_VARDIR/tmp/diff.test
# Compare files that differ in size
--error 2
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff3.tmp
@@ -1725,13 +1740,6 @@ EOF
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff4.tmp
--error 1
--diff_files $MYSQLTEST_VARDIR/tmp/diff4.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
-exit;
-EOF
-
-# Execute the above diffs, and send their output to /dev/null - only
-# interesting to see that it returns correct error codes
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/diff.test > /dev/null 2>&1
-
# Compare equal files, again...
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
@@ -1740,7 +1748,6 @@ EOF
--remove_file $MYSQLTEST_VARDIR/tmp/diff2.tmp
--remove_file $MYSQLTEST_VARDIR/tmp/diff3.tmp
--remove_file $MYSQLTEST_VARDIR/tmp/diff4.tmp
---remove_file $MYSQLTEST_VARDIR/tmp/diff.test
# ----------------------------------------------------------------------------
=== modified file 'mysql-test/t/named_pipe.test'
--- a/mysql-test/t/named_pipe.test 2007-09-24 10:42:44 +0000
+++ b/mysql-test/t/named_pipe.test 2009-11-03 00:19:37 +0000
@@ -9,6 +9,11 @@ if (`SELECT '$nmp' != 'ON'`){
skip No named pipe support;
}
+# Connect using named pipe for testing
+connect(pipe_con,localhost,root,,,,,PIPE);
+
# Source select test case
-- source include/common-tests.inc
+connection default;
+disconnect pipe_con;
=== modified file 'mysql-test/t/not_partition.test'
--- a/mysql-test/t/not_partition.test 2009-01-08 14:16:44 +0000
+++ b/mysql-test/t/not_partition.test 2009-09-02 21:29:11 +0000
@@ -15,7 +15,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
# Bug#39893: Crash if select on a partitioned table,
# when partitioning is disabled
FLUSH TABLES;
---copy_file $MYSQLTEST_VARDIR/std_data_ln/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
+--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
SELECT * FROM t1;
TRUNCATE TABLE t1;
ANALYZE TABLE t1;
=== modified file 'mysql-test/t/olap.test'
--- a/mysql-test/t/olap.test 2007-11-21 16:53:44 +0000
+++ b/mysql-test/t/olap.test 2009-10-30 15:54:53 +0000
@@ -375,4 +375,19 @@ INSERT INTO t1 VALUES(0);
SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
DROP TABLE t1;
+--echo #
+--echo # Bug #48131: crash group by with rollup, distinct,
+--echo # filesort, with temporary tables
+--echo #
+
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (100);
+
+SELECT a, b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
+SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
+
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests
=== modified file 'mysql-test/t/order_by.test'
--- a/mysql-test/t/order_by.test 2009-10-28 07:52:34 +0000
+++ b/mysql-test/t/order_by.test 2009-11-16 20:49:51 +0000
@@ -1404,3 +1404,35 @@ SELECT DISTINCT a FROM t1 WHERE b = 1 OR
SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9;
DROP TABLE t1;
+
+--echo #
+--echo # Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join buffering
+--echo # is used
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, KEY (a));
+
+INSERT INTO t1 VALUES (0, NULL), (1, NULL), (2, NULL), (3, NULL);
+INSERT INTO t1 SELECT a+4, b FROM t1;
+INSERT INTO t1 SELECT a+8, b FROM t1;
+
+CREATE TABLE t2 (a INT, b INT);
+
+INSERT INTO t2 VALUES (0,NULL), (1,NULL), (2,NULL), (3,NULL), (4,NULL);
+INSERT INTO t2 SELECT a+4, b FROM t2;
+
+--echo # shouldn't have "using filesort"
+EXPLAIN
+SELECT * FROM t1 FORCE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
+
+--echo # should have "using filesort"
+EXPLAIN
+SELECT * FROM t1 USE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
+
+--echo # should have "using filesort"
+EXPLAIN
+SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
+
+DROP TABLE t1, t2;
+
+--echo End of 5.1 tests
=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test 2009-11-06 17:22:32 +0000
+++ b/mysql-test/t/partition.test 2009-11-16 20:49:51 +0000
@@ -62,6 +62,19 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
#
+# Bug#44059: rec_per_key on empty partition gives weird optimiser results
+#
+create table t1 (a int, b int, key(a))
+partition by list (a)
+( partition p0 values in (1),
+ partition p1 values in (2));
+insert into t1 values (1,1),(2,1),(2,2),(2,3);
+show indexes from t1;
+analyze table t1;
+show indexes from t1;
+drop table t1;
+
+#
# Bug#36001: Partitions: spelling and using some error messages
#
--error ER_FOREIGN_KEY_ON_PARTITIONED
=== modified file 'mysql-test/t/partition_csv.test'
--- a/mysql-test/t/partition_csv.test 2009-07-31 23:39:26 +0000
+++ b/mysql-test/t/partition_csv.test 2009-09-03 06:38:06 +0000
@@ -10,6 +10,8 @@
--source include/have_partition.inc
--source include/have_csv.inc
+call mtr.add_suppression("Failed to write to mysql.general_log");
+
#
# Bug#19307: Partitions: csv delete failure
# = CSV engine crashes
=== modified file 'mysql-test/t/partition_innodb.test'
--- a/mysql-test/t/partition_innodb.test 2009-06-09 15:08:46 +0000
+++ b/mysql-test/t/partition_innodb.test 2009-11-16 20:49:51 +0000
@@ -6,6 +6,23 @@ drop table if exists t1;
--enable_warnings
#
+# Bug#47029: Crash when reorganize partition with subpartition
+#
+create table t1 (a int not null,
+ b datetime not null,
+ primary key (a,b))
+engine=innodb
+partition by range (to_days(b))
+subpartition by hash (a)
+subpartitions 2
+( partition p0 values less than (to_days('2009-01-01')),
+ partition p1 values less than (to_days('2009-02-01')),
+ partition p2 values less than (to_days('2009-03-01')),
+ partition p3 values less than maxvalue);
+alter table t1 reorganize partition p1,p2 into
+( partition p2 values less than (to_days('2009-03-01')));
+drop table t1;
+#
# Bug#40595: Non-matching rows not released with READ-COMMITTED on tables
# with partitions
CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
@@ -270,3 +287,15 @@ PARTITION BY RANGE (int_column)
(PARTITION p1 VALUES LESS THAN (5));
show create table t1;
drop table t1;
+
+#
+# BUG#46483 - drop table of partitioned table may leave extraneous file
+# Note: was only repeatable with InnoDB plugin
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB
+ PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
+CREATE INDEX i1 ON t1 (a);
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+# Before the fix it should show extra file like #sql-2405_2.par
+--list_files $MYSQLD_DATADIR/test/ *
=== added file 'mysql-test/t/partition_innodb_builtin.test'
--- a/mysql-test/t/partition_innodb_builtin.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/partition_innodb_builtin.test 2009-09-25 09:26:49 +0000
@@ -0,0 +1,67 @@
+--source include/have_partition.inc
+--source include/have_innodb.inc
+--source include/have_not_innodb_plugin.inc
+
+#
+# Bug#32430 - show engine innodb status causes errors
+#
+SET NAMES utf8;
+CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
+ENGINE=InnoDB
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION `p0``\""e` VALUES LESS THAN (100)
+ (SUBPARTITION `sp0``\""e`,
+ SUBPARTITION `sp1``\""e`),
+ PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
+ (SUBPARTITION `sp2``\""e`,
+ SUBPARTITION `sp3``\""e`));
+INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
+START TRANSACTION;
+--echo # con1
+connect(con1,localhost,root,,);
+SET NAMES utf8;
+START TRANSACTION;
+--echo # default connection
+connection default;
+UPDATE `t``\""e` SET a = 16 WHERE a = 0;
+--echo # con1
+connection con1;
+UPDATE `t``\""e` SET a = 8 WHERE a = 22;
+let $id_1= `SELECT CONNECTION_ID()`;
+SEND;
+UPDATE `t``\""e` SET a = 12 WHERE a = 0;
+--echo # default connection
+connection default;
+let $wait_timeout= 2;
+let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE ID = $id_1 AND STATE = 'Searching rows for update';
+--source include/wait_condition.inc
+#--echo # tested wait condition $wait_condition_reps times
+--error ER_LOCK_DEADLOCK
+UPDATE `t``\""e` SET a = 4 WHERE a = 22;
+--echo # First table reported in 'SHOW ENGINE InnoDB STATUS'
+# RECORD LOCKS space id 0 page no 50 n bits 80 index `PRIMARY` in \
+# Database `test`, Table `t1`, Partition `p0`, Subpartition `sp0` \
+# trx id 0 775
+# NOTE: replace_regex is very slow on match copy/past '(.*)' regex's
+# on big texts, removing a lot of text before + after makes it much faster.
+#/.*in (.*) trx.*/\1/
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+SHOW ENGINE InnoDB STATUS;
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+# INNODB_LOCKS only exists in innodb_plugin
+#SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+SHOW ENGINE InnoDB STATUS;
+set @@sql_mode = @old_sql_mode;
+--echo # con1
+connection con1;
+REAP;
+ROLLBACK;
+disconnect con1;
+--echo # default connection
+connection default;
+DROP TABLE `t``\""e`;
+SET NAMES DEFAULT;
=== added file 'mysql-test/t/partition_innodb_plugin.test'
--- a/mysql-test/t/partition_innodb_plugin.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/partition_innodb_plugin.test 2009-09-25 09:26:49 +0000
@@ -0,0 +1,75 @@
+--source include/have_partition.inc
+--source include/have_innodb.inc
+--source suite/innodb/include/have_innodb_plugin.inc
+
+#
+# Bug#32430 - show engine innodb status causes errors
+#
+SET NAMES utf8;
+CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
+ENGINE=InnoDB
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION `p0``\""e` VALUES LESS THAN (100)
+ (SUBPARTITION `sp0``\""e`,
+ SUBPARTITION `sp1``\""e`),
+ PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
+ (SUBPARTITION `sp2``\""e`,
+ SUBPARTITION `sp3``\""e`));
+INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
+START TRANSACTION;
+--echo # con1
+connect(con1,localhost,root,,);
+SET NAMES utf8;
+START TRANSACTION;
+--echo # default connection
+connection default;
+UPDATE `t``\""e` SET a = 16 WHERE a = 0;
+--echo # con1
+connection con1;
+UPDATE `t``\""e` SET a = 8 WHERE a = 22;
+let $id_1= `SELECT CONNECTION_ID()`;
+SEND;
+UPDATE `t``\""e` SET a = 12 WHERE a = 0;
+--echo # default connection
+connection default;
+let $wait_timeout= 2;
+let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE ID = $id_1 AND STATE = 'Searching rows for update';
+--source include/wait_condition.inc
+#--echo # tested wait condition $wait_condition_reps times
+# INNODB_LOCKS only exists in innodb_plugin
+--sorted_result
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+--sorted_result
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+set @@sql_mode = @old_sql_mode;
+--error ER_LOCK_DEADLOCK
+UPDATE `t``\""e` SET a = 4 WHERE a = 22;
+--echo # First table reported in 'SHOW ENGINE InnoDB STATUS'
+# RECORD LOCKS space id 0 page no 50 n bits 80 index `PRIMARY` in \
+# Database `test`, Table `t1`, Partition `p0`, Subpartition `sp0` \
+# trx id 0 775
+# NOTE: replace_regex is very slow on match copy/past '(.*)' regex's
+# on big texts, removing a lot of text before + after makes it much faster.
+#/.*in (.*) trx.*/\1/
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+SHOW ENGINE InnoDB STATUS;
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+SHOW ENGINE InnoDB STATUS;
+set @@sql_mode = @old_sql_mode;
+--echo # con1
+connection con1;
+REAP;
+ROLLBACK;
+disconnect con1;
+--echo # default connection
+connection default;
+DROP TABLE `t``\""e`;
+SET NAMES DEFAULT;
=== added file 'mysql-test/t/partition_open_files_limit-master.opt'
--- a/mysql-test/t/partition_open_files_limit-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/partition_open_files_limit-master.opt 2009-10-08 13:36:43 +0000
@@ -0,0 +1 @@
+--open-files-limit=5 --max_connections=2 --table_open_cache=1
=== added file 'mysql-test/t/partition_open_files_limit.test'
--- a/mysql-test/t/partition_open_files_limit.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/partition_open_files_limit.test 2009-10-09 14:12:01 +0000
@@ -0,0 +1,26 @@
+--source include/have_partition.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS `t1`;
+--enable_warnings
+
+# On some platforms the lowest possible open_files_limit is too high...
+let $max_open_files_limit= `SELECT @@open_files_limit > 511`;
+if ($max_open_files_limit)
+{
+ skip Need open_files_limit to be lower than 512;
+}
+
+#
+--echo # Bug#46922: crash when adding partitions and open_files_limit is reached
+#
+CREATE TABLE t1 (a INT PRIMARY KEY)
+ENGINE=MyISAM PARTITION BY KEY () PARTITIONS 1;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
+--echo # if the bug exists, then crash will happen here
+--replace_regex /file '.*'/file '<partition file>'/
+--error 23
+ALTER TABLE t1 ADD PARTITION PARTITIONS 511;
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
=== modified file 'mysql-test/t/plugin.test'
--- a/mysql-test/t/plugin.test 2009-06-10 08:59:49 +0000
+++ b/mysql-test/t/plugin.test 2009-10-08 08:39:15 +0000
@@ -1,3 +1,4 @@
+--source include/not_windows_embedded.inc
--source include/have_example_plugin.inc
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
=== modified file 'mysql-test/t/plugin_load.test'
--- a/mysql-test/t/plugin_load.test 2008-01-26 00:05:15 +0000
+++ b/mysql-test/t/plugin_load.test 2009-10-08 08:39:15 +0000
@@ -1,3 +1,4 @@
+--source include/not_windows_embedded.inc
--source include/have_example_plugin.inc
SELECT @@global.example_enum_var = 'e2';
=== modified file 'mysql-test/t/ps_not_windows.test'
--- a/mysql-test/t/ps_not_windows.test 2009-05-22 17:53:25 +0000
+++ b/mysql-test/t/ps_not_windows.test 2009-11-16 20:49:51 +0000
@@ -2,7 +2,7 @@
--source include/not_embedded.inc
# Non-windows specific ps tests.
--source include/not_windows.inc
-# Requires ability to install plugins.
+# requires dynamic loading
--source include/have_dynamic_loading.inc
#
=== modified file 'mysql-test/t/query_cache.test'
--- a/mysql-test/t/query_cache.test 2009-02-19 09:01:25 +0000
+++ b/mysql-test/t/query_cache.test 2009-11-16 20:49:51 +0000
@@ -1294,7 +1294,7 @@ SET GLOBAL query_cache_size= default;
# Bug #31157: Crash when select+order by the avg of some field within the
# group by
#
-
+SET GLOBAL query_cache_size=1024*1024*512;
CREATE TABLE t1 (a ENUM('rainbow'));
INSERT INTO t1 VALUES (),(),(),(),();
SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
@@ -1305,6 +1305,7 @@ INSERT INTO t1 SET a = 'aaaa';
SELECT 1 FROM t1 GROUP BY
(SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
--echo End of 5.1 tests
=== modified file 'mysql-test/t/range.test'
--- a/mysql-test/t/range.test 2008-03-27 02:18:46 +0000
+++ b/mysql-test/t/range.test 2009-11-02 12:24:07 +0000
@@ -1046,3 +1046,218 @@ explain select * from t2 where a=1000 an
drop table t1, t2;
+#
+# Bug#42846: wrong result returned for range scan when using covering index
+#
+CREATE TABLE t1( a INT, b INT, KEY( a, b ) );
+
+CREATE TABLE t2( a INT, b INT, KEY( a, b ) );
+
+CREATE TABLE t3( a INT, b INT, KEY( a, b ) );
+
+INSERT INTO t1( a, b )
+VALUES (0, 1), (1, 2), (1, 4), (2, 3), (5, 0), (9, 7);
+
+INSERT INTO t2( a, b )
+VALUES ( 1, 1), ( 2, 1), ( 3, 1), ( 4, 1), ( 5, 1),
+ ( 6, 1), ( 7, 1), ( 8, 1), ( 9, 1), (10, 1),
+ (11, 1), (12, 1), (13, 1), (14, 1), (15, 1),
+ (16, 1), (17, 1), (18, 1), (19, 1), (20, 1);
+
+INSERT INTO t2 SELECT a, 2 FROM t2 WHERE b = 1;
+INSERT INTO t2 SELECT a, 3 FROM t2 WHERE b = 1;
+
+# To make range scan compelling to the optimizer
+INSERT INTO t2 SELECT -1, -1 FROM t2;
+INSERT INTO t2 SELECT -1, -1 FROM t2;
+INSERT INTO t2 SELECT -1, -1 FROM t2;
+
+INSERT INTO t3
+VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0),
+ (6, 0), (7, 0), (8, 0), (9, 0), (10, 0);
+
+# To make range scan compelling to the optimizer
+INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
+INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
+
+
+#
+# Problem#1 Test queries. Will give missing results unless Problem#1 is fixed.
+# With one exception, they are independent of Problem#2.
+#
+SELECT * FROM t1 WHERE
+3 <= a AND a < 5 OR
+5 < a AND b = 3 OR
+3 <= a;
+
+EXPLAIN
+SELECT * FROM t1 WHERE
+3 <= a AND a < 5 OR
+5 < a AND b = 3 OR
+3 <= a;
+
+# Query below: Tests both Problem#1 and Problem#2 (EXPLAIN differs as well)
+SELECT * FROM t1 WHERE
+3 <= a AND a < 5 OR
+5 <= a AND b = 3 OR
+3 <= a;
+
+EXPLAIN
+SELECT * FROM t1 WHERE
+3 <= a AND a < 5 OR
+5 <= a AND b = 3 OR
+3 <= a;
+
+SELECT * FROM t1 WHERE
+3 <= a AND a <= 5 OR
+5 <= a AND b = 3 OR
+3 <= a;
+
+EXPLAIN
+SELECT * FROM t1 WHERE
+3 <= a AND a <= 5 OR
+5 <= a AND b = 3 OR
+3 <= a;
+
+SELECT * FROM t1 WHERE
+3 <= a AND a <= 5 OR
+3 <= a;
+
+EXPLAIN
+SELECT * FROM t1 WHERE
+3 <= a AND a <= 5 OR
+3 <= a;
+
+#
+# Problem#2 Test queries.
+# These queries will give missing results if Problem#1 is fixed.
+# But Problem#1 also hides this bug.
+#
+SELECT * FROM t2 WHERE
+5 <= a AND a < 10 AND b = 1 OR
+15 <= a AND a < 20 AND b = 3
+OR
+1 <= a AND b = 1;
+
+EXPLAIN
+SELECT * FROM t2 WHERE
+5 <= a AND a < 10 AND b = 1 OR
+15 <= a AND a < 20 AND b = 3
+OR
+1 <= a AND b = 1;
+
+SELECT * FROM t2 WHERE
+5 <= a AND a < 10 AND b = 2 OR
+15 <= a AND a < 20 AND b = 3
+OR
+1 <= a AND b = 1;
+
+EXPLAIN
+SELECT * FROM t2 WHERE
+5 <= a AND a < 10 AND b = 2 OR
+15 <= a AND a < 20 AND b = 3
+OR
+1 <= a AND b = 1;
+
+SELECT * FROM t3 WHERE
+5 <= a AND a < 10 AND b = 3 OR
+a < 5 OR
+a < 10;
+
+EXPLAIN
+SELECT * FROM t3 WHERE
+5 <= a AND a < 10 AND b = 3 OR
+a < 5 OR
+a < 10;
+
+DROP TABLE t1, t2, t3;
+
+--echo #
+--echo # Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
+--echo #
+
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES (1), (NULL);
+SELECT * FROM t1 WHERE a <> NULL and (a <> NULL or a <= NULL);
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#47925: regression of range optimizer and date comparison in 5.1.39!
+--echo #
+CREATE TABLE t1 ( a DATE, KEY ( a ) );
+CREATE TABLE t2 ( a DATETIME, KEY ( a ) );
+
+--echo # Make optimizer choose range scan
+INSERT INTO t1 VALUES ('2009-09-22'), ('2009-09-22'), ('2009-09-22');
+INSERT INTO t1 VALUES ('2009-09-23'), ('2009-09-23'), ('2009-09-23');
+
+INSERT INTO t2 VALUES ('2009-09-22 12:00:00'), ('2009-09-22 12:00:00'),
+ ('2009-09-22 12:00:00');
+INSERT INTO t2 VALUES ('2009-09-23 12:00:00'), ('2009-09-23 12:00:00'),
+ ('2009-09-23 12:00:00');
+
+--echo # DATE vs DATE
+--replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X
+EXPLAIN
+SELECT * FROM t1 WHERE a >= '2009/09/23';
+SELECT * FROM t1 WHERE a >= '2009/09/23';
+SELECT * FROM t1 WHERE a >= '20090923';
+SELECT * FROM t1 WHERE a >= 20090923;
+SELECT * FROM t1 WHERE a >= '2009-9-23';
+SELECT * FROM t1 WHERE a >= '2009.09.23';
+SELECT * FROM t1 WHERE a >= '2009:09:23';
+
+--echo # DATE vs DATETIME
+--replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X
+EXPLAIN
+SELECT * FROM t2 WHERE a >= '2009/09/23';
+SELECT * FROM t2 WHERE a >= '2009/09/23';
+SELECT * FROM t2 WHERE a >= '2009/09/23';
+SELECT * FROM t2 WHERE a >= '20090923';
+SELECT * FROM t2 WHERE a >= 20090923;
+SELECT * FROM t2 WHERE a >= '2009-9-23';
+SELECT * FROM t2 WHERE a >= '2009.09.23';
+SELECT * FROM t2 WHERE a >= '2009:09:23';
+
+--echo # DATETIME vs DATETIME
+--replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X
+EXPLAIN
+SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00';
+SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00';
+SELECT * FROM t2 WHERE a >= '20090923120000';
+SELECT * FROM t2 WHERE a >= 20090923120000;
+SELECT * FROM t2 WHERE a >= '2009-9-23 12:00:00';
+SELECT * FROM t2 WHERE a >= '2009.09.23 12:00:00';
+SELECT * FROM t2 WHERE a >= '2009:09:23 12:00:00';
+
+--echo # DATETIME vs DATE
+--replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X
+EXPLAIN
+SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
+SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
+SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
+SELECT * FROM t1 WHERE a >= '20090923000000';
+SELECT * FROM t1 WHERE a >= 20090923000000;
+SELECT * FROM t1 WHERE a >= '2009-9-23 00:00:00';
+SELECT * FROM t1 WHERE a >= '2009.09.23 00:00:00';
+SELECT * FROM t1 WHERE a >= '2009:09:23 00:00:00';
+
+--echo # Test of the new get_date_from_str implementation
+--echo # Behavior differs slightly between the trunk and mysql-pe.
+--echo # The former may give errors for the truncated values, while the latter
+--echo # gives warnings. The purpose of this test is not to interfere, and only
+--echo # preserve existing behavior.
+SELECT str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND
+ str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20';
+
+SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
+ str_to_date('2007-20-00', '%Y-%m-%d') <= '';
+
+SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20';
+SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '';
+
+SELECT str_to_date('', '%Y-%m-%d');
+
+DROP TABLE t1, t2;
+
+--echo End of 5.1 tests
=== modified file 'mysql-test/t/select.test'
--- a/mysql-test/t/select.test 2009-06-26 19:57:42 +0000
+++ b/mysql-test/t/select.test 2009-10-30 14:13:13 +0000
@@ -3739,7 +3739,40 @@ EXPLAIN EXTENDED SELECT a, b FROM t1 WHE
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when
+--echo # forcing a spatial index
+--echo #
+CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
+INSERT INTO t1 VALUES
+ (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
+ (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
+EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
+SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
+EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
+SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug #48291 : crash with row() operator,select into @var, and
+--echo # subquery returning multiple rows
+--echo #
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (2),(3);
+
+--echo # Should not crash
+--error ER_SUBQUERY_NO_1_ROW
+SELECT 1 FROM t1 WHERE a <> 1 AND NOT
+ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1))
+INTO @var0;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
#
=== added file 'mysql-test/t/sp-bugs.test'
--- a/mysql-test/t/sp-bugs.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/sp-bugs.test 2009-10-26 09:55:57 +0000
@@ -0,0 +1,61 @@
+# Test file for stored procedure bugfixes
+
+--echo #
+--echo # Bug #47412: Valgrind warnings / user can read uninitalized memory
+--echo # using SP variables
+--echo #
+
+CREATE SCHEMA testdb;
+USE testdb;
+DELIMITER |;
+CREATE FUNCTION f2 () RETURNS INTEGER
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
+ RETURN f_not_exists () ;
+END|
+CREATE PROCEDURE p3 ( arg1 VARCHAR(32) )
+BEGIN
+ CALL p_not_exists ( );
+END|
+DELIMITER ;|
+--echo # should not return valgrind warnings
+--error ER_SP_DOES_NOT_EXIST
+CALL p3 ( f2 () );
+
+DROP SCHEMA testdb;
+
+CREATE SCHEMA testdb;
+USE testdb;
+DELIMITER |;
+CREATE FUNCTION f2 () RETURNS INTEGER
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
+ RETURN f_not_exists () ;
+END|
+CREATE PROCEDURE p3 ( arg2 INTEGER )
+BEGIN
+ CALL p_not_exists ( );
+END|
+DELIMITER ;|
+--echo # should not return valgrind warnings
+--error ER_SP_DOES_NOT_EXIST
+CALL p3 ( f2 () );
+
+DROP SCHEMA testdb;
+
+CREATE SCHEMA testdb;
+USE testdb;
+DELIMITER |;
+CREATE FUNCTION f2 () RETURNS INTEGER
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
+ RETURN f_not_exists () ;
+END|
+DELIMITER ;|
+--echo # should not return valgrind warnings
+SELECT f2 ();
+
+DROP SCHEMA testdb;
+
+
+--echo End of 5.1 tests
=== modified file 'mysql-test/t/sp-error.test'
--- a/mysql-test/t/sp-error.test 2009-05-27 15:19:44 +0000
+++ b/mysql-test/t/sp-error.test 2009-10-19 13:55:04 +0000
@@ -2448,3 +2448,27 @@ SELECT AVG (a) FROM t1 WHERE b = 999999;
--error ER_SP_DOES_NOT_EXIST
SELECT non_existent (a) FROM t1 WHERE b = 999999;
DROP TABLE t1;
+
+--echo #
+--echo # Bug #47788: Crash in TABLE_LIST::hide_view_error on UPDATE + VIEW +
+--echo # SP + MERGE + ALTER
+--echo #
+
+CREATE TABLE t1 (pk INT, b INT, KEY (b));
+CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+
+CREATE PROCEDURE p1 (a int) UPDATE IGNORE v1 SET b = a;
+
+--error ER_NON_UPDATABLE_TABLE
+CALL p1(5);
+
+ALTER TABLE t1 CHANGE COLUMN b b2 INT;
+
+--error ER_VIEW_INVALID
+CALL p1(7);
+
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test 2009-06-04 11:53:15 +0000
+++ b/mysql-test/t/sp.test 2009-10-23 13:54:58 +0000
@@ -8242,6 +8242,28 @@ while ($tab_count)
DROP PROCEDURE p1;
DROP TABLE t1;
+
+--echo #
+--echo # Bug #46629: Item_in_subselect::val_int(): Assertion `0'
+--echo # on subquery inside a SP
+--echo #
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT, b INT PRIMARY KEY);
+
+DELIMITER |;
+CREATE PROCEDURE p1 ()
+BEGIN
+ SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B);
+END|
+DELIMITER ;|
+--error ER_BAD_FIELD_ERROR
+CALL p1;
+--error ER_BAD_FIELD_ERROR
+CALL p1;
+DROP PROCEDURE p1;
+DROP TABLE t1, t2;
+
+
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------
=== added file 'mysql-test/t/status-master.opt'
--- a/mysql-test/t/status-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/status-master.opt 2009-08-27 13:17:09 +0000
@@ -0,0 +1 @@
+--log-output=table,file
=== modified file 'mysql-test/t/subselect.test'
--- a/mysql-test/t/subselect.test 2009-11-06 17:22:32 +0000
+++ b/mysql-test/t/subselect.test 2009-11-16 20:49:51 +0000
@@ -30,7 +30,7 @@ SELECT 1 IN (SELECT 1);
SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
-- error ER_WRONG_USAGE
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
--- error ER_WRONG_USAGE
+-- error ER_WRONG_PARAMETERS_TO_PROCEDURE
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-- error ER_BAD_FIELD_ERROR
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
@@ -3554,4 +3554,19 @@ where v in(select v
where t1.g=t2.g) is unknown;
drop table t1, t2;
+#
+# Bug #31157: Crash when select+order by the avg of some field within the
+# group by
+#
+CREATE TABLE t1 (a ENUM('rainbow'));
+INSERT INTO t1 VALUES (),(),(),(),();
+SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
+DROP TABLE t1;
+CREATE TABLE t1 (a LONGBLOB);
+INSERT INTO t1 SET a = 'aaaa';
+INSERT INTO t1 SET a = 'aaaa';
+SELECT 1 FROM t1 GROUP BY
+ (SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
+DROP TABLE t1;
+
--echo End of 5.1 tests.
=== modified file 'mysql-test/t/subselect3.test'
--- a/mysql-test/t/subselect3.test 2009-10-15 21:38:29 +0000
+++ b/mysql-test/t/subselect3.test 2009-11-16 20:49:51 +0000
@@ -730,3 +730,69 @@ where
from t4, t5 limit 2));
drop table t0, t1, t2, t3, t4, t5;
+
+--echo #
+--echo # BUG#48177 - SELECTs with NOT IN subqueries containing NULL
+--echo # values return too many records
+--echo #
+
+CREATE TABLE t1 (
+ i1 int DEFAULT NULL,
+ i2 int DEFAULT NULL
+) ;
+
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (2, 3);
+INSERT INTO t1 VALUES (4, NULL);
+INSERT INTO t1 VALUES (4, 0);
+INSERT INTO t1 VALUES (NULL, NULL);
+
+CREATE TABLE t2 (
+ i1 int DEFAULT NULL,
+ i2 int DEFAULT NULL
+) ;
+
+INSERT INTO t2 VALUES (4, NULL);
+INSERT INTO t2 VALUES (5, 0);
+
+--echo
+--echo Data in t1
+SELECT i1, i2 FROM t1;
+
+--echo
+--echo Data in subquery (should be filtered out)
+SELECT i1, i2 FROM t2 ORDER BY i1;
+
+FLUSH STATUS;
+
+--echo
+SELECT i1, i2
+FROM t1
+WHERE (i1, i2)
+ NOT IN (SELECT i1, i2 FROM t2);
+
+--echo
+--echo # Check that the subquery only has to be evaluated once
+--echo # for all-NULL values even though there are two (NULL,NULL) records
+--echo # Baseline:
+SHOW STATUS LIKE '%Handler_read_rnd_next';
+
+--echo
+INSERT INTO t1 VALUES (NULL, NULL);
+FLUSH STATUS;
+
+--echo
+SELECT i1, i2
+FROM t1
+WHERE (i1, i2)
+ NOT IN (SELECT i1, i2 FROM t2);
+
+--echo
+--echo # Handler_read_rnd_next should be one more than baseline
+--echo # (read record from t1, but do not read from t2)
+SHOW STATUS LIKE '%Handler_read_rnd_next';
+
+
+DROP TABLE t1,t2;
+
+--echo End of 5.1 tests
=== added file 'mysql-test/t/subselect4.test'
--- a/mysql-test/t/subselect4.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/subselect4.test 2009-09-18 09:34:08 +0000
@@ -0,0 +1,64 @@
+# General purpose bug fix tests go here : subselect.test too large
+
+
+--echo #
+--echo # Bug #46791: Assertion failed:(table->key_read==0),function unknown
+--echo # function,file sql_base.cc
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 VALUES (1,1),(2,2);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES (1,1),(2,2);
+CREATE TABLE t3 LIKE t1;
+
+--echo # should have 1 impossible where and 2 dependent subqueries
+EXPLAIN
+SELECT 1 FROM t1
+WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
+ORDER BY count(*);
+
+--echo # should not crash the next statement
+SELECT 1 FROM t1
+WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
+ORDER BY count(*);
+
+--echo # should not crash: the crash is caused by the previous statement
+SELECT 1;
+
+DROP TABLE t1,t2,t3;
+
+--echo #
+--echo # Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing
+--echo # query
+--echo #
+
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ PRIMARY KEY (a),
+ KEY b (b)
+);
+INSERT INTO t1 VALUES (1, 1), (2, 1);
+
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 SELECT * FROM t1;
+
+CREATE TABLE t3 LIKE t1;
+INSERT INTO t3 SELECT * FROM t1;
+
+--echo # Should not crash.
+--echo # Should have 1 impossible where and 2 dependent subqs.
+EXPLAIN
+SELECT
+ (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+FROM t3 WHERE 1 = 0 GROUP BY 1;
+
+--echo # should return 0 rows
+SELECT
+ (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+FROM t3 WHERE 1 = 0 GROUP BY 1;
+
+DROP TABLE t1,t2,t3;
+
+--echo End of 5.0 tests.
=== modified file 'mysql-test/t/type_bit.test'
--- a/mysql-test/t/type_bit.test 2008-12-09 13:31:22 +0000
+++ b/mysql-test/t/type_bit.test 2009-10-08 15:36:36 +0000
@@ -397,6 +397,17 @@ insert into t2bit7 values (b'11001101111
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
drop table t1bit7, t2bit7;
+
+--echo #
+--echo # Bug42803: Field_bit does not have unsigned_flag field,
+--echo # can lead to bad memory access
+--echo #
+CREATE TABLE t1 (a BIT(7), b BIT(9), KEY(a, b));
+INSERT INTO t1 VALUES(0, 0), (5, 3), (5, 6), (6, 4), (7, 0);
+EXPLAIN SELECT a+0, b+0 FROM t1 WHERE a > 4 and b < 7 ORDER BY 2;
+DROP TABLE t1;
+
+
--echo End of 5.0 tests
#
=== modified file 'mysql-test/t/type_newdecimal.test'
--- a/mysql-test/t/type_newdecimal.test 2009-08-24 19:47:08 +0000
+++ b/mysql-test/t/type_newdecimal.test 2009-11-02 11:21:39 +0000
@@ -1286,137 +1286,3 @@ CREATE TABLE t1 SELECT 1 % .123456789123
DESCRIBE t1;
SELECT my_col FROM t1;
DROP TABLE t1;
-
---echo #
---echo # Bug#45261: Crash, stored procedure + decimal
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 SELECT
- /* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.1 /* 1 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 40 */ 1000000000000000000000000000000000000001.1000000000000000000000000000000000000001 /* 40 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 1 */ 1.10000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 80 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 1 */ 1.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- .100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 45 */ 123456789012345678901234567890123456789012345.123456789012345678901234567890123456789012345 /* 45 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 65 */ 12345678901234567890123456789012345678901234567890123456789012345.1 /* 1 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 66 */ 123456789012345678901234567890123456789012345678901234567890123456.1 /* 1 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- .123456789012345678901234567890123456789012345678901234567890123456 /* 66 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT 123.1234567890123456789012345678901 /* 31 */ AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Test that the integer and decimal parts are properly calculated.
---echo #
-
-CREATE TABLE t1 (a DECIMAL(30,30));
-INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
-CREATE TABLE t2 SELECT MIN(a + 0.0000000000000000000000000000001) AS c1 FROM t1;
-DESC t2;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DECIMAL(30,30));
-INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
-CREATE TABLE t2 SELECT IFNULL(a + 0.0000000000000000000000000000001, NULL) AS c1 FROM t1;
-DESC t2;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DECIMAL(30,30));
-INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
-CREATE TABLE t2 SELECT CASE a WHEN 0.1 THEN 0.0000000000000000000000000000000000000000000000000000000000000000001 END AS c1 FROM t1;
-DESC t2;
-DROP TABLE t1,t2;
-
---echo #
---echo # Test that variables get maximum precision.
---echo #
-
-SET @decimal= 1.1;
-CREATE TABLE t1 SELECT @decimal AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
=== modified file 'mysql-test/t/udf.test'
--- a/mysql-test/t/udf.test 2007-11-27 15:19:51 +0000
+++ b/mysql-test/t/udf.test 2009-09-07 09:57:22 +0000
@@ -436,4 +436,16 @@ SELECT * FROM t2 WHERE a = sequence();
DROP FUNCTION sequence;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
+--echo #
+CREATE TABLE t1 ( a INT );
+
+INSERT INTO t1 VALUES (1), (2), (3);
+
+SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b` + 1, 1 );
+SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b`, 1 );
+
+DROP TABLE t1;
+
--echo End of 5.0 tests.
=== modified file 'mysql-test/t/update.test'
--- a/mysql-test/t/update.test 2008-11-28 16:36:07 +0000
+++ b/mysql-test/t/update.test 2009-10-23 13:09:14 +0000
@@ -452,3 +452,18 @@ DROP TABLE t1;
DROP FUNCTION f1;
--echo End of 5.0 tests
+
+--echo #
+--echo # Bug #47919 assert in open_table during ALTER temporary table
+--echo #
+
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
+CREATE TEMPORARY TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+ALTER TABLE t2 COMMENT = 'ABC';
+UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
+ALTER TABLE t2 COMMENT = 'DEF';
+
+DROP TABLE t1, t2;
=== modified file 'mysql-test/t/upgrade.test'
--- a/mysql-test/t/upgrade.test 2009-04-30 12:46:49 +0000
+++ b/mysql-test/t/upgrade.test 2009-08-25 13:56:50 +0000
@@ -124,6 +124,8 @@ with_check_option=0
timestamp=2009-04-10 11:53:37
create-version=1
source=select f1 from `a-b-c`.t1 a, information_schema.tables b\nwhere a.f1 = b.table_name
+client_cs_name=utf8
+connection_cl_name=utf8_general_ci
EOF
show databases like '%a-b-c%';
=== modified file 'mysql-test/t/view_grant.test'
--- a/mysql-test/t/view_grant.test 2009-08-21 14:41:48 +0000
+++ b/mysql-test/t/view_grant.test 2009-10-16 11:12:21 +0000
@@ -1382,6 +1382,153 @@ DROP VIEW test.v3;
DROP USER mysqluser1@localhost;
USE test;
+--echo #
+--echo # Bug#35996: SELECT + SHOW VIEW should be enough to display view
+--echo # definition
+--echo #
+-- source include/not_embedded.inc
+CREATE USER mysqluser1@localhost;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+GRANT USAGE, SELECT, CREATE VIEW, SHOW VIEW
+ON mysqltest2.* TO mysqluser1@localhost;
+
+USE mysqltest1;
+
+CREATE TABLE t1( a INT );
+CREATE TABLE t2( a INT, b INT );
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+CREATE VIEW v1 AS SELECT 1 AS a;
+CREATE VIEW v2 AS SELECT 1 AS a, 2 AS b;
+
+GRANT SELECT ON TABLE t1 TO mysqluser1@localhost;
+GRANT SELECT (a, b) ON TABLE t2 TO mysqluser1@localhost;
+GRANT EXECUTE ON FUNCTION f1 TO mysqluser1@localhost;
+GRANT SELECT ON TABLE v1 TO mysqluser1@localhost;
+GRANT SELECT (a, b) ON TABLE v2 TO mysqluser1@localhost;
+
+CREATE VIEW v_t1 AS SELECT * FROM t1;
+CREATE VIEW v_t2 AS SELECT * FROM t2;
+CREATE VIEW v_f1 AS SELECT f1() AS a;
+CREATE VIEW v_v1 AS SELECT * FROM v1;
+CREATE VIEW v_v2 AS SELECT * FROM v2;
+
+GRANT SELECT, SHOW VIEW ON v_t1 TO mysqluser1@localhost;
+GRANT SELECT, SHOW VIEW ON v_t2 TO mysqluser1@localhost;
+GRANT SELECT, SHOW VIEW ON v_f1 TO mysqluser1@localhost;
+GRANT SELECT, SHOW VIEW ON v_v1 TO mysqluser1@localhost;
+GRANT SELECT, SHOW VIEW ON v_v2 TO mysqluser1@localhost;
+
+--connect (connection1, localhost, mysqluser1,, mysqltest2)
+CREATE VIEW v_mysqluser1_t1 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW v_mysqluser1_t2 AS SELECT * FROM mysqltest1.t2;
+CREATE VIEW v_mysqluser1_f1 AS SELECT mysqltest1.f1() AS a;
+CREATE VIEW v_mysqluser1_v1 AS SELECT * FROM mysqltest1.v1;
+CREATE VIEW v_mysqluser1_v2 AS SELECT * FROM mysqltest1.v2;
+
+SHOW CREATE VIEW mysqltest1.v_t1;
+SHOW CREATE VIEW mysqltest1.v_t2;
+SHOW CREATE VIEW mysqltest1.v_f1;
+SHOW CREATE VIEW mysqltest1.v_v1;
+SHOW CREATE VIEW mysqltest1.v_v2;
+
+SHOW CREATE VIEW v_mysqluser1_t1;
+SHOW CREATE VIEW v_mysqluser1_t2;
+SHOW CREATE VIEW v_mysqluser1_f1;
+SHOW CREATE VIEW v_mysqluser1_v1;
+SHOW CREATE VIEW v_mysqluser1_v2;
+
+--connection default
+REVOKE SELECT ON TABLE t1 FROM mysqluser1@localhost;
+REVOKE SELECT (a) ON TABLE t2 FROM mysqluser1@localhost;
+REVOKE EXECUTE ON FUNCTION f1 FROM mysqluser1@localhost;
+REVOKE SELECT ON TABLE v1 FROM mysqluser1@localhost;
+
+--connection connection1
+SHOW CREATE VIEW mysqltest1.v_t1;
+SHOW CREATE VIEW mysqltest1.v_t2;
+SHOW CREATE VIEW mysqltest1.v_f1;
+SHOW CREATE VIEW mysqltest1.v_v1;
+SHOW CREATE VIEW mysqltest1.v_v2;
+
+SHOW CREATE VIEW v_mysqluser1_t1;
+SHOW CREATE VIEW v_mysqluser1_t2;
+SHOW CREATE VIEW v_mysqluser1_f1;
+SHOW CREATE VIEW v_mysqluser1_v1;
+SHOW CREATE VIEW v_mysqluser1_v2;
+
+--connection default
+--echo # Testing the case when the views reference missing objects.
+--echo # Obviously, there are no privileges to check for, so we
+--echo # need only each object type once.
+DROP TABLE t1;
+DROP FUNCTION f1;
+DROP VIEW v1;
+
+--connection connection1
+SHOW CREATE VIEW mysqltest1.v_t1;
+SHOW CREATE VIEW mysqltest1.v_f1;
+SHOW CREATE VIEW mysqltest1.v_v1;
+
+SHOW CREATE VIEW v_mysqluser1_t1;
+SHOW CREATE VIEW v_mysqluser1_f1;
+SHOW CREATE VIEW v_mysqluser1_v1;
+
+--connection default
+REVOKE SHOW VIEW ON v_t1 FROM mysqluser1@localhost;
+REVOKE SHOW VIEW ON v_f1 FROM mysqluser1@localhost;
+REVOKE SHOW VIEW ON v_v1 FROM mysqluser1@localhost;
+
+--connection connection1
+--error ER_TABLEACCESS_DENIED_ERROR
+SHOW CREATE VIEW mysqltest1.v_t1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SHOW CREATE VIEW mysqltest1.v_f1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SHOW CREATE VIEW mysqltest1.v_v1;
+SHOW CREATE VIEW v_mysqluser1_t1;
+SHOW CREATE VIEW v_mysqluser1_f1;
+SHOW CREATE VIEW v_mysqluser1_v1;
+
+--disconnect connection1
+--connection default
+DROP USER mysqluser1@localhost;
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+USE test;
+
+CREATE TABLE t1( a INT );
+CREATE DEFINER = no_such_user@no_such_host VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+DROP TABLE t1;
+DROP VIEW v1;
+
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
+--echo #
+--echo # Bug #46019: ERROR 1356 When selecting from within another
+--echo # view that has Group By
+--echo #
+CREATE DATABASE mysqltest1;
+USE mysqltest1;
+
+CREATE TABLE t1 (a INT);
+
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT a FROM t1 GROUP BY a;
+CREATE SQL SECURITY INVOKER VIEW v2 AS SELECT a FROM v1;
+
+CREATE USER mysqluser1;
+
+GRANT SELECT ON TABLE t1 TO mysqluser1;
+GRANT SELECT, SHOW VIEW ON TABLE v1 TO mysqluser1;
+GRANT SELECT, SHOW VIEW ON TABLE v2 TO mysqluser1;
+
+--connect (mysqluser1, localhost, mysqluser1,,mysqltest1)
+SELECT a FROM v1;
+SELECT a FROM v2;
+
+--connection default
+--disconnect mysqluser1
+DROP USER mysqluser1;
+DROP DATABASE mysqltest1;
=== modified file 'mysql-test/t/warnings.test'
--- a/mysql-test/t/warnings.test 2009-10-28 07:52:34 +0000
+++ b/mysql-test/t/warnings.test 2009-11-16 20:49:51 +0000
@@ -227,4 +227,11 @@ insert into t2 values(@q);
drop table t1, t2;
+#
+# Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table
+#
+--error ER_BAD_TABLE_ERROR
+DROP TABLE t1;
+SHOW ERRORS;
+
--echo End of 5.0 tests
=== modified file 'mysql-test/t/windows.test'
--- a/mysql-test/t/windows.test 2009-02-12 09:52:01 +0000
+++ b/mysql-test/t/windows.test 2009-09-22 11:22:07 +0000
@@ -92,3 +92,9 @@ execute abc;
execute abc;
deallocate prepare abc;
+--echo #
+--echo # Bug#45498: Socket variable not available on Windows
+--echo #
+
+SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME = 'socket';
=== modified file 'mysql-test/t/xa.test'
--- a/mysql-test/t/xa.test 2009-06-25 15:25:23 +0000
+++ b/mysql-test/t/xa.test 2009-10-28 15:39:08 +0000
@@ -149,6 +149,68 @@ xa end 'a';
xa prepare 'a';
xa commit 'a';
+#
+# BUG#43171 - Assertion failed: thd->transaction.xid_state.xid.is_null()
+#
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1),(2);
+connect(con1,localhost,root,,);
+
+# Part 1: Prepare to test XA START after regular transaction deadlock
+BEGIN;
+UPDATE t1 SET a=3 WHERE a=1;
+
+connection default;
+BEGIN;
+UPDATE t1 SET a=4 WHERE a=2;
+
+connection con1;
+let $conn_id= `SELECT CONNECTION_ID()`;
+SEND UPDATE t1 SET a=5 WHERE a=2;
+
+connection default;
+let $wait_timeout= 2;
+let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE ID=$conn_id AND STATE='Searching rows for update';
+--source include/wait_condition.inc
+
+--error ER_LOCK_DEADLOCK
+UPDATE t1 SET a=5 WHERE a=1;
+ROLLBACK;
+
+# Part 2: Prepare to test XA START after XA transaction deadlock
+connection con1;
+REAP;
+ROLLBACK;
+BEGIN;
+UPDATE t1 SET a=3 WHERE a=1;
+
+connection default;
+XA START 'xid1';
+UPDATE t1 SET a=4 WHERE a=2;
+
+connection con1;
+SEND UPDATE t1 SET a=5 WHERE a=2;
+
+connection default;
+let $wait_timeout= 2;
+let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE ID=$conn_id AND STATE='Searching rows for update';
+--source include/wait_condition.inc
+
+--error ER_LOCK_DEADLOCK
+UPDATE t1 SET a=5 WHERE a=1;
+--error ER_XA_RBDEADLOCK
+XA END 'xid1';
+XA ROLLBACK 'xid1';
+
+XA START 'xid1';
+XA END 'xid1';
+XA ROLLBACK 'xid1';
+
+disconnect con1;
+DROP TABLE t1;
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
=== modified file 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp 2009-10-30 18:50:56 +0000
+++ b/mysql-test/valgrind.supp 2009-11-16 20:49:51 +0000
@@ -1,4 +1,3 @@
-#
# Suppress some common (not fatal) errors in system libraries found by valgrind
#
@@ -894,3 +893,101 @@
obj: /lib64/libnss_dns-*so)
fun: gethostbyaddr_r
}
+
+# suppressions for glibc 2.6.1 64 bit
+
+{
+ Mem loss within nptl_pthread_exit_hack_handler 6
+ Memcheck:Leak
+ fun:malloc
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/libc-*.so
+ obj:*/ld-*.so
+ obj:*/libc-*.so
+ fun:__libc_dlopen_mode
+ fun:pthread_cancel_init
+ fun:_Unwind_ForcedUnwind
+ fun:__pthread_unwind
+ fun:pthread_exit
+ fun:nptl_pthread_exit_hack_handler
+}
+
+{
+ Mem loss within nptl_pthread_exit_hack_handler 7
+ Memcheck:Leak
+ fun:malloc
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/libc-*.so
+ obj:*/ld-*.so
+ obj:*/libc-*.so
+ fun:__libc_dlopen_mode
+ fun:pthread_cancel_init
+ fun:_Unwind_ForcedUnwind
+ fun:__pthread_unwind
+ fun:pthread_exit
+ fun:nptl_pthread_exit_hack_handler
+ fun:start_thread
+ fun:clone
+}
+
+{
+ Mem loss within nptl_pthread_exit_hack_handler 8
+ Memcheck:Leak
+ fun:calloc
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/libc-*.so
+ obj:*/ld-*.so
+ obj:*/libc-*.so
+ fun:__libc_dlopen_mode
+ fun:pthread_cancel_init
+ fun:_Unwind_ForcedUnwind
+ fun:__pthread_unwind
+ fun:pthread_exit
+ fun:nptl_pthread_exit_hack_handler
+ fun:start_thread
+ fun:clone
+}
+
+{
+ Mem loss within nptl_pthread_exit_hack_handler 8
+ Memcheck:Leak
+ fun:calloc
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/ld-*.so
+ obj:*/libc-*.so
+ obj:*/ld-*.so
+ obj:*/libc-*.so
+ fun:__libc_dlopen_mode
+ fun:pthread_cancel_init
+ fun:_Unwind_ForcedUnwind
+ fun:__pthread_unwind
+ fun:pthread_exit
+ fun:nptl_pthread_exit_hack_handler
+}
+
+#
+# Pthread doesn't free all thread specific memory before program exists
+#
+{
+ pthread allocate_tls memory loss in 2.6.1.
+ Memcheck:Leak
+ fun:calloc
+ obj:*/ld-*.so
+ fun:_dl_allocate_tls
+ fun:pthread_create*
+}
=== modified file 'mysys/CMakeLists.txt'
--- a/mysys/CMakeLists.txt 2008-10-10 15:28:41 +0000
+++ b/mysys/CMakeLists.txt 2009-11-16 20:49:51 +0000
@@ -29,7 +29,7 @@ SET(MYSYS_SOURCES array.c charset-def.c
errors.c hash.c list.c md5.c mf_brkhant.c mf_cache.c mf_dirname.c mf_fn_ext.c
mf_format.c mf_getdate.c mf_iocache.c mf_iocache2.c mf_keycache.c my_safehash.c
mf_keycaches.c mf_loadpath.c mf_pack.c mf_path.c mf_qsort.c mf_qsort2.c
- mf_radix.c mf_same.c mf_sort.c mf_soundex.c mf_strip.c mf_arr_appstr.c mf_tempdir.c
+ mf_radix.c mf_same.c mf_sort.c mf_soundex.c mf_arr_appstr.c mf_tempdir.c
mf_tempfile.c mf_unixpath.c mf_wcomp.c mf_wfile.c mulalloc.c my_access.c
my_aes.c my_alarm.c my_alloc.c my_append.c my_bit.c my_bitmap.c my_chmod.c my_chsize.c
my_clock.c my_compress.c my_conio.c my_copy.c my_crc32.c my_create.c my_delete.c
=== modified file 'mysys/Makefile.am'
--- a/mysys/Makefile.am 2009-09-07 20:50:10 +0000
+++ b/mysys/Makefile.am 2009-11-16 20:49:51 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2000-2006 MySQL AB
+# Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,32 +20,32 @@ INCLUDES = @ZLIB_INCLUDES@ -I$(top_buil
-I$(top_srcdir)/include -I$(srcdir)
pkglib_LIBRARIES = libmysys.a
LDADD = libmysys.a $(top_builddir)/strings/libmystrings.a $(top_builddir)/dbug/libdbug.a
-noinst_HEADERS = mysys_priv.h my_static.h my_handler_errors.h my_safehash.h
+noinst_HEADERS = mysys_priv.h my_static.h my_handler_errors.h \
+ my_safehash.h
libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
mf_path.c mf_loadpath.c my_file.c \
my_open.c my_create.c my_dup.c my_seek.c my_read.c \
my_pread.c my_write.c my_getpagesize.c \
- my_safehash.c \
- mf_keycache.c mf_keycaches.c my_crc32.c \
+ my_crc32.c \
mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \
my_malloc.c my_realloc.c my_once.c mulalloc.c \
my_alloc.c safemalloc.c my_new.cc \
- my_vle.c my_atomic.c lf_hash.c \
- lf_dynarray.c lf_alloc-pin.c \
+ my_vle.c my_atomic.c \
+ my_safehash.c lf_hash.c lf_dynarray.c lf_alloc-pin.c \
+ my_rnd.c my_uuid.c my_chmod.c \
my_fopen.c my_fstream.c my_getsystime.c \
- my_rnd.c my_uuid.c \
my_error.c errors.c my_div.c my_messnc.c \
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
my_symlink.c my_symlink2.c \
- mf_pack.c mf_unixpath.c mf_strip.c mf_arr_appstr.c \
+ mf_pack.c mf_unixpath.c mf_arr_appstr.c \
mf_wcomp.c mf_wfile.c my_gethwaddr.c \
mf_qsort.c mf_qsort2.c mf_sort.c \
ptr_cmp.c mf_radix.c queues.c my_getncpus.c \
tree.c trie.c list.c hash.c array.c string.c typelib.c \
my_copy.c my_append.c my_lib.c \
my_delete.c my_rename.c my_redel.c \
- my_chsize.c my_chmod.c my_clock.c \
+ my_chsize.c my_clock.c \
my_quick.c my_lockmem.c my_static.c \
my_sync.c my_getopt.c my_mkdir.c \
default_modify.c default.c \
@@ -57,12 +57,19 @@ libmysys_a_SOURCES = my_init.c my_get
my_memmem.c stacktrace.c \
my_windac.c my_access.c base64.c my_libwrap.c \
wqueue.c
-if THREAD
-libmysys_a_SOURCES+= thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
- thr_mutex.c thr_rwlock.c waiting_threads.c
+
+if NEED_THREAD
+# mf_keycache is used only in the server, so it is safe to leave the file
+# out of the non-threaded library.
+# In fact, it will currently not compile without thread support.
+libmysys_a_SOURCES += mf_keycache.c mf_keycaches.c
endif
-EXTRA_DIST = CMakeLists.txt mf_soundex.c \
+
+EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
+ thr_mutex.c thr_rwlock.c waiting_threads.c \
+ CMakeLists.txt mf_soundex.c \
my_conio.c my_wincond.c my_winthread.c
+libmysys_a_LIBADD = @THREAD_LOBJECTS@
# test_dir_DEPENDENCIES= $(LIBRARIES)
# testhash_DEPENDENCIES= $(LIBRARIES)
# test_charset_DEPENDENCIES= $(LIBRARIES)
@@ -76,6 +83,8 @@ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\"
-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
@DEFS@
+libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
+
# I hope this always does the right thing. Otherwise this is only test programs
FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
=== modified file 'mysys/hash.c'
--- a/mysys/hash.c 2009-09-07 20:50:10 +0000
+++ b/mysys/hash.c 2009-11-16 20:49:51 +0000
@@ -338,13 +338,8 @@ my_bool my_hash_insert(HASH *info, const
{
int flag;
size_t idx,halfbuff,hash_nr,first_index;
- uchar *ptr_to_rec,*ptr_to_rec2;
- HASH_LINK *data,*empty,*gpos,*gpos2,*pos;
-
- LINT_INIT(gpos);
- LINT_INIT(gpos2);
- LINT_INIT(ptr_to_rec);
- LINT_INIT(ptr_to_rec2);
+ uchar *UNINIT_VAR(ptr_to_rec),*UNINIT_VAR(ptr_to_rec2);
+ HASH_LINK *data,*empty,*UNINIT_VAR(gpos),*UNINIT_VAR(gpos2),*pos;
if (info->flags & HASH_UNIQUE)
{
=== modified file 'mysys/mf_keycache.c'
--- a/mysys/mf_keycache.c 2009-09-07 20:50:10 +0000
+++ b/mysys/mf_keycache.c 2009-11-16 20:49:51 +0000
@@ -13,7 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/*
+/**
+ @file
These functions handle keyblock cacheing for ISAM and MyISAM tables.
One cache can handle many files.
@@ -36,7 +37,9 @@
blocks_unused is the sum of never used blocks in the pool and of currently
free blocks. blocks_used is the number of blocks fetched from the pool and
as such gives the maximum number of in-use blocks at any time.
+*/
+/*
Key Cache Locking
=================
@@ -368,8 +371,8 @@ static inline uint next_power(uint value
*/
int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
- size_t use_mem, uint division_limit,
- uint age_threshold)
+ size_t use_mem, uint division_limit,
+ uint age_threshold)
{
ulong blocks, hash_links;
size_t length;
@@ -560,8 +563,8 @@ err:
*/
int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
- size_t use_mem, uint division_limit,
- uint age_threshold)
+ size_t use_mem, uint division_limit,
+ uint age_threshold)
{
int blocks;
DBUG_ENTER("resize_key_cache");
@@ -760,6 +763,13 @@ void end_key_cache(KEY_CACHE *keycache,
(ulong) keycache->global_cache_r_requests,
(ulong) keycache->global_cache_read));
+ /*
+ Reset these values to be able to detect a disabled key cache.
+ See Bug#44068 (RESTORE can disable the MyISAM Key Cache).
+ */
+ keycache->blocks_used= 0;
+ keycache->blocks_unused= 0;
+
if (cleanup)
{
pthread_mutex_destroy(&keycache->cache_lock);
@@ -1343,7 +1353,11 @@ static void unreg_request(KEY_CACHE *key
DBUG_ASSERT(block->prev_changed && *block->prev_changed == block);
DBUG_ASSERT(!block->next_used);
DBUG_ASSERT(!block->prev_used);
- if (! --block->requests)
+ /*
+ Unregister the request, but do not link erroneous blocks into the
+ LRU ring.
+ */
+ if (!--block->requests && !(block->status & BLOCK_ERROR))
{
my_bool hot;
if (block->hits_left)
@@ -1425,8 +1439,7 @@ static void wait_for_readers(KEY_CACHE *
#ifdef THREAD
struct st_my_thread_var *thread= my_thread_var;
DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE));
- DBUG_ASSERT(!(block->status & (BLOCK_ERROR | BLOCK_IN_FLUSH |
- BLOCK_CHANGED)));
+ DBUG_ASSERT(!(block->status & (BLOCK_IN_FLUSH | BLOCK_CHANGED)));
DBUG_ASSERT(block->hash_link);
DBUG_ASSERT(block->hash_link->block == block);
/* Linked in file_blocks or changed_blocks hash. */
@@ -1716,6 +1729,7 @@ restart:
- block assigned but not yet read from file (invalid data).
*/
+#ifdef THREAD
if (keycache->in_resize)
{
/* This is a request during a resize operation */
@@ -1957,6 +1971,9 @@ restart:
}
DBUG_RETURN(0);
}
+#else /* THREAD */
+ DBUG_ASSERT(!keycache->in_resize);
+#endif
if (page_status == PAGE_READ &&
(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
@@ -2210,9 +2227,9 @@ restart:
thread might change the block->hash_link value
*/
error= my_pwrite(block->hash_link->file,
- block->buffer+block->offset,
+ block->buffer + block->offset,
block->length - block->offset,
- block->hash_link->diskpos+ block->offset,
+ block->hash_link->diskpos + block->offset,
MYF(MY_NABP | MY_WAIT_IF_FULL));
keycache_pthread_mutex_lock(&keycache->cache_lock);
@@ -2536,7 +2553,6 @@ uchar *key_cache_read(KEY_CACHE *keycach
reg1 BLOCK_LINK *block;
uint read_length;
uint offset;
- uint status;
int page_st;
/*
@@ -2571,9 +2587,11 @@ uchar *key_cache_read(KEY_CACHE *keycach
do
{
/* Cache could be disabled in a later iteration. */
-
if (!keycache->can_be_used)
- goto no_key_cache;
+ {
+ KEYCACHE_DBUG_PRINT("key_cache_read", ("keycache cannot be used"));
+ goto no_key_cache;
+ }
/* Start reading at the beginning of the cache block. */
filepos-= offset;
/* Do not read beyond the end of the cache block. */
@@ -2634,7 +2652,7 @@ uchar *key_cache_read(KEY_CACHE *keycach
}
/* block status may have added BLOCK_ERROR in the above 'if'. */
- if (!((status= block->status) & BLOCK_ERROR))
+ if (!(block->status & BLOCK_ERROR))
{
#ifndef THREAD
if (! return_buffer)
@@ -2660,14 +2678,22 @@ uchar *key_cache_read(KEY_CACHE *keycach
remove_reader(block);
- /*
- Link the block into the LRU ring if it's the last submitted
- request for the block. This enables eviction for the block.
- */
- unreg_request(keycache, block, 1);
+ /* Error injection for coverage testing. */
+ DBUG_EXECUTE_IF("key_cache_read_block_error",
+ block->status|= BLOCK_ERROR;);
- if (status & BLOCK_ERROR)
+ /* Do not link erroneous blocks into the LRU ring, but free them. */
+ if (!(block->status & BLOCK_ERROR))
+ {
+ /*
+ Link the block into the LRU ring if it's the last submitted
+ request for the block. This enables eviction for the block.
+ */
+ unreg_request(keycache, block, 1);
+ }
+ else
{
+ free_block(keycache, block);
error= 1;
break;
}
@@ -2677,7 +2703,7 @@ uchar *key_cache_read(KEY_CACHE *keycach
if (return_buffer)
DBUG_RETURN(block->buffer);
#endif
- next_block:
+ next_block:
buff+= read_length;
filepos+= read_length+offset;
offset= 0;
@@ -2685,6 +2711,7 @@ uchar *key_cache_read(KEY_CACHE *keycach
} while ((length-= read_length));
goto end;
}
+ KEYCACHE_DBUG_PRINT("key_cache_read", ("keycache not initialized"));
no_key_cache:
/* Key cache is not used */
@@ -2705,6 +2732,7 @@ end:
dec_counter_for_resize_op(keycache);
keycache_pthread_mutex_unlock(&keycache->cache_lock);
}
+ DBUG_PRINT("exit", ("error: %d", error ));
DBUG_RETURN(error ? (uchar*) 0 : start);
}
@@ -2913,19 +2941,27 @@ int key_cache_insert(KEY_CACHE *keycache
DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE));
} /* end of if (!(block->status & BLOCK_ERROR)) */
-
remove_reader(block);
- /*
- Link the block into the LRU ring if it's the last submitted
- request for the block. This enables eviction for the block.
- */
- unreg_request(keycache, block, 1);
-
- error= (block->status & BLOCK_ERROR);
+ /* Error injection for coverage testing. */
+ DBUG_EXECUTE_IF("key_cache_insert_block_error",
+ block->status|= BLOCK_ERROR; errno=EIO;);
- if (error)
+ /* Do not link erroneous blocks into the LRU ring, but free them. */
+ if (!(block->status & BLOCK_ERROR))
+ {
+ /*
+ Link the block into the LRU ring if it's the last submitted
+ request for the block. This enables eviction for the block.
+ */
+ unreg_request(keycache, block, 1);
+ }
+ else
+ {
+ free_block(keycache, block);
+ error= 1;
break;
+ }
buff+= read_length;
filepos+= read_length+offset;
@@ -3206,14 +3242,24 @@ int key_cache_write(KEY_CACHE *keycache,
*/
remove_reader(block);
- /*
- Link the block into the LRU ring if it's the last submitted
- request for the block. This enables eviction for the block.
- */
- unreg_request(keycache, block, 1);
+ /* Error injection for coverage testing. */
+ DBUG_EXECUTE_IF("key_cache_write_block_error",
+ block->status|= BLOCK_ERROR;);
- if (block->status & BLOCK_ERROR)
+ /* Do not link erroneous blocks into the LRU ring, but free them. */
+ if (!(block->status & BLOCK_ERROR))
+ {
+ /*
+ Link the block into the LRU ring if it's the last submitted
+ request for the block. This enables eviction for the block.
+ */
+ unreg_request(keycache, block, 1);
+ }
+ else
{
+ /* Pretend a "clean" block to avoid complications. */
+ block->status&= ~(BLOCK_CHANGED);
+ free_block(keycache, block);
error= 1;
break;
}
@@ -3288,8 +3334,9 @@ static void free_block(KEY_CACHE *keycac
{
KEYCACHE_THREAD_TRACE("free block");
KEYCACHE_DBUG_PRINT("free_block",
- ("block %u to be freed, hash_link %p",
- BLOCK_NUMBER(block), block->hash_link));
+ ("block %u to be freed, hash_link %p status: %u",
+ BLOCK_NUMBER(block), block->hash_link,
+ block->status));
/*
Assert that the block is not free already. And that it is in a clean
state. Note that the block might just be assigned to a hash_link and
@@ -3371,10 +3418,14 @@ static void free_block(KEY_CACHE *keycac
if (block->status & BLOCK_IN_EVICTION)
return;
- /* Here the block must be in the LRU ring. Unlink it again. */
- DBUG_ASSERT(block->next_used && block->prev_used &&
- *block->prev_used == block);
- unlink_block(keycache, block);
+ /* Error blocks are not put into the LRU ring. */
+ if (!(block->status & BLOCK_ERROR))
+ {
+ /* Here the block must be in the LRU ring. Unlink it again. */
+ DBUG_ASSERT(block->next_used && block->prev_used &&
+ *block->prev_used == block);
+ unlink_block(keycache, block);
+ }
if (block->temperature == BLOCK_WARM)
keycache->warm_blocks--;
block->temperature= BLOCK_COLD;
@@ -3463,8 +3514,7 @@ static int flush_cached_blocks(KEY_CACHE
(BLOCK_READ | BLOCK_IN_FLUSH | BLOCK_CHANGED | BLOCK_IN_USE));
block->status|= BLOCK_IN_FLUSHWRITE;
keycache_pthread_mutex_unlock(&keycache->cache_lock);
- error= my_pwrite(file,
- block->buffer+block->offset,
+ error= my_pwrite(file, block->buffer+block->offset,
block->length - block->offset,
block->hash_link->diskpos+ block->offset,
MYF(MY_NABP | MY_WAIT_IF_FULL));
@@ -3491,7 +3541,6 @@ static int flush_cached_blocks(KEY_CACHE
right queue anyway.
*/
link_to_file_list(keycache, block, file, 1);
-
}
block->status&= ~BLOCK_IN_FLUSH;
/*
@@ -3527,7 +3576,7 @@ static int flush_cached_blocks(KEY_CACHE
/*
- flush all key blocks for a file to disk, but don't do any mutex locks.
+ Flush all key blocks for a file to disk, but don't do any mutex locks.
SYNOPSIS
flush_key_blocks_int()
@@ -3693,7 +3742,6 @@ restart:
{
/* It's a temporary file */
DBUG_ASSERT(!(block->status & BLOCK_REASSIGNED));
-
/*
free_block() must not be called with BLOCK_CHANGED. Note
that we must not change the BLOCK_CHANGED flag outside of
@@ -4404,8 +4452,8 @@ static void keycache_debug_print(const c
va_start(args,fmt);
if (keycache_debug_log)
{
- VOID(vfprintf(keycache_debug_log, fmt, args));
- VOID(fputc('\n',keycache_debug_log));
+ (void) vfprintf(keycache_debug_log, fmt, args);
+ (void) fputc('\n',keycache_debug_log);
}
va_end(args);
}
=== removed file 'mysys/mf_strip.c'
--- a/mysys/mf_strip.c 2007-05-10 09:59:39 +0000
+++ b/mysys/mf_strip.c 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* T|mmer en str{ng p{ slut_space */
-
-#include "mysys_priv.h"
-
-/*
- strip_sp(char * str)
- Strips end-space from string and returns new length.
-*/
-
-size_t strip_sp(register char * str)
-{
- reg2 char * found;
- reg3 char * start;
-
- start=found=str;
-
- while (*str)
- {
- if (*str != ' ')
- {
- while (*++str && *str != ' ') {};
- if (!*str)
- return (size_t) (str-start); /* Return stringlength */
- }
- found=str;
- while (*++str == ' ') {};
- }
- *found= '\0'; /* Stripp at first space */
- return (size_t) (found-start);
-} /* strip_sp */
=== modified file 'mysys/my_copy.c'
--- a/mysys/my_copy.c 2009-11-06 17:22:32 +0000
+++ b/mysys/my_copy.c 2009-11-16 20:49:51 +0000
@@ -89,6 +89,13 @@ int my_copy(const char *from, const char
goto err;
}
+ /* sync the destination file */
+ if (MyFlags & MY_SYNC)
+ {
+ if (my_sync(to_file, MyFlags))
+ goto err;
+ }
+
if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags))
DBUG_RETURN(-1); /* Error on close */
=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c 2009-10-15 21:38:29 +0000
+++ b/mysys/my_getopt.c 2009-11-16 20:49:51 +0000
@@ -1017,10 +1017,12 @@ static void init_one_value(const struct
case GET_LL:
*((longlong*) variable)= (longlong) getopt_ll_limit_value((longlong) value, option, NULL);
break;
- case GET_ULL: /* Fall through */
- case GET_SET:
+ case GET_ULL:
*((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL);
break;
+ case GET_SET:
+ *((ulonglong*) variable)= (ulonglong) value;
+ break;
case GET_DOUBLE:
*((double*) variable)= (double) value;
break;
=== modified file 'mysys/my_largepage.c'
--- a/mysys/my_largepage.c 2007-10-02 07:32:33 +0000
+++ b/mysys/my_largepage.c 2009-09-18 07:19:02 +0000
@@ -121,7 +121,7 @@ uchar* my_large_malloc_int(size_t size,
DBUG_ENTER("my_large_malloc_int");
/* Align block size to my_large_page_size */
- size = ((size - 1) & ~(my_large_page_size - 1)) + my_large_page_size;
+ size= MY_ALIGN(size, (size_t) my_large_page_size);
shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | SHM_R | SHM_W);
if (shmid < 0)
=== modified file 'mysys/my_static.c'
--- a/mysys/my_static.c 2009-04-25 10:05:32 +0000
+++ b/mysys/my_static.c 2009-11-16 20:49:51 +0000
@@ -104,6 +104,13 @@ static const char *proc_info_dummy(void
/* this is to be able to call set_thd_proc_info from the C code */
const char *(*proc_info_hook)(void *, const char *, const char *, const char *,
const unsigned int)= proc_info_dummy;
+#if defined(ENABLED_DEBUG_SYNC)
+/**
+ Global pointer to be set if callback function is defined
+ (e.g. in mysqld). See sql/debug_sync.cc.
+*/
+void (*debug_sync_C_callback_ptr)(const char *, size_t);
+#endif /* defined(ENABLED_DEBUG_SYNC) */
#ifdef __WIN__
/* from my_getsystime.c */
=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c 2009-02-19 09:01:25 +0000
+++ b/mysys/my_thr_init.c 2009-11-16 20:49:51 +0000
@@ -134,10 +134,11 @@ my_bool my_thread_global_init(void)
pthread_attr_t dummy_thread_attr;
pthread_attr_init(&dummy_thread_attr);
- pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_DETACHED);
+ pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_JOINABLE);
- pthread_create(&dummy_thread,&dummy_thread_attr,
- nptl_pthread_exit_hack_handler, NULL);
+ if (pthread_create(&dummy_thread,&dummy_thread_attr,
+ nptl_pthread_exit_hack_handler, NULL) == 0)
+ (void)pthread_join(dummy_thread, NULL);
}
#endif /* TARGET_OS_LINUX */
=== modified file 'mysys/my_wincond.c'
--- a/mysys/my_wincond.c 2009-03-22 12:16:09 +0000
+++ b/mysys/my_wincond.c 2009-11-16 20:49:51 +0000
@@ -121,7 +121,6 @@ int pthread_cond_timedwait(pthread_cond_
LeaveCriticalSection(&cond->lock_waiting);
LeaveCriticalSection(mutex);
-
result= WaitForMultipleObjects(2, cond->events, FALSE, timeout);
EnterCriticalSection(&cond->lock_waiting);
=== modified file 'mysys/thr_lock.c'
--- a/mysys/thr_lock.c 2009-04-25 09:04:38 +0000
+++ b/mysys/thr_lock.c 2009-11-16 20:49:51 +0000
@@ -420,6 +420,28 @@ wait_for_lock(struct st_lock_list *wait,
my_bool can_deadlock= test(data->owner->info->n_cursors);
DBUG_ENTER("wait_for_lock");
+ /*
+ One can use this to signal when a thread is going to wait for a lock.
+ See debug_sync.cc.
+
+ Beware of waiting for a signal here. The lock has aquired its mutex.
+ While waiting on a signal here, the locking thread could not aquire
+ the mutex to release the lock. One could lock up the table
+ completely.
+
+ In detail it works so: When thr_lock() tries to acquire a table
+ lock, it locks the lock->mutex, checks if it can have the lock, and
+ if not, it calls wait_for_lock(). Here it unlocks the table lock
+ while waiting on a condition. The sync point is located before this
+ wait for condition. If we have a waiting action here, we hold the
+ the table locks mutex all the time. Any attempt to look at the table
+ lock by another thread blocks it immediately on lock->mutex. This
+ can easily become an unexpected and unobvious blockage. So be
+ warned: Do not request a WAIT_FOR action for the 'wait_for_lock'
+ sync point unless you really know what you do.
+ */
+ DEBUG_SYNC_C("wait_for_lock");
+
if (!in_wait_list)
{
(*wait->last)=data; /* Wait for lock */
=== modified file 'mysys/typelib.c'
--- a/mysys/typelib.c 2009-10-15 21:38:29 +0000
+++ b/mysys/typelib.c 2009-11-16 20:49:51 +0000
@@ -190,7 +190,10 @@ my_ulonglong find_typeset(char *x, TYPEL
{
(*err)++;
i= x;
- while (*x && *x != field_separator) x++;
+ while (*x && *x != field_separator)
+ x++;
+ if (x[0] && x[1]) // skip separator if found
+ x++;
if ((find= find_type(i, lib, 2 | 8) - 1) < 0)
DBUG_RETURN(0);
result|= (ULL(1) << find);
=== modified file 'regex/CMakeLists.txt'
--- a/regex/CMakeLists.txt 2008-05-22 22:25:21 +0000
+++ b/regex/CMakeLists.txt 2009-10-09 07:53:29 +0000
@@ -18,7 +18,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-SET(REGEX_SOURCES debug.c regcomp.c regerror.c regexec.c regfree.c reginit.c split.c)
+SET(REGEX_SOURCES regcomp.c regerror.c regexec.c regfree.c reginit.c)
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(regex ${REGEX_SOURCES})
=== modified file 'scripts/make_win_bin_dist'
--- a/scripts/make_win_bin_dist 2009-10-15 21:52:31 +0000
+++ b/scripts/make_win_bin_dist 2009-11-16 20:49:51 +0000
@@ -350,6 +350,7 @@ fi
mkdir $DESTDIR/mysql-test
cp mysql-test/mysql-test-run.pl $DESTDIR/mysql-test/
+cp mysql-test/mysql-stress-test.pl $DESTDIR/mysql-test/
cp mysql-test/README $DESTDIR/mysql-test/
cp -R mysql-test/{t,r,include,suite,std_data,lib} $DESTDIR/mysql-test/
=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql 2009-05-15 12:57:51 +0000
+++ b/scripts/mysql_system_tables.sql 2009-10-27 10:09:36 +0000
@@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS time_zone_lea
CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
-CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
+CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
-- Create general_log if CSV is enabled.
=== modified file 'scripts/mysql_system_tables_fix.sql'
--- a/scripts/mysql_system_tables_fix.sql 2009-03-11 20:30:56 +0000
+++ b/scripts/mysql_system_tables_fix.sql 2009-10-27 10:09:36 +0000
@@ -337,6 +337,10 @@ ALTER TABLE procs_priv
MODIFY Proc_priv set('Execute','Alter Routine','Grant')
COLLATE utf8_general_ci DEFAULT '' NOT NULL;
+ALTER IGNORE TABLE procs_priv
+ MODIFY Routine_name char(64)
+ COLLATE utf8_general_ci DEFAULT '' NOT NULL;
+
ALTER TABLE procs_priv
ADD Routine_type enum('FUNCTION','PROCEDURE')
COLLATE utf8_general_ci NOT NULL AFTER Routine_name;
=== modified file 'sql-common/client.c'
--- a/sql-common/client.c 2009-10-15 21:38:29 +0000
+++ b/sql-common/client.c 2009-11-16 20:49:51 +0000
@@ -389,7 +389,7 @@ HANDLE create_named_pipe(MYSQL *mysql, u
0,
NULL,
OPEN_EXISTING,
- 0,
+ FILE_FLAG_OVERLAPPED,
NULL )) != INVALID_HANDLE_VALUE)
break;
if (GetLastError() != ERROR_PIPE_BUSY)
@@ -623,7 +623,7 @@ HANDLE create_shared_memory(MYSQL *mysql
err2:
if (error_allow == 0)
{
- net->vio= vio_new_win32shared_memory(net,handle_file_map,handle_map,
+ net->vio= vio_new_win32shared_memory(handle_file_map,handle_map,
event_server_wrote,
event_server_read,event_client_wrote,
event_client_read,event_conn_closed);
@@ -2033,7 +2033,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
}
else
{
- net->vio=vio_new_win32pipe(hPipe);
+ net->vio= vio_new_win32pipe(hPipe);
my_snprintf(host_info=buff, sizeof(buff)-1,
ER(CR_NAMEDPIPE_CONNECTION), unix_socket);
}
=== modified file 'sql-common/my_time.c'
--- a/sql-common/my_time.c 2009-09-01 11:04:56 +0000
+++ b/sql-common/my_time.c 2009-09-17 15:25:52 +0000
@@ -165,7 +165,7 @@ str_to_datetime(const char *str, uint le
uint add_hours= 0, start_loop;
ulong not_zero_date, allow_space;
my_bool is_internal_format;
- const char *pos, *last_field_pos;
+ const char *pos, *UNINIT_VAR(last_field_pos);
const char *end=str+length;
const uchar *format_position;
my_bool found_delimitier= 0, found_space= 0;
@@ -174,7 +174,6 @@ str_to_datetime(const char *str, uint le
DBUG_PRINT("ENTER",("str: %.*s",length,str));
LINT_INIT(field_length);
- LINT_INIT(last_field_pos);
*was_cut= 0;
=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt 2009-09-15 10:46:35 +0000
+++ b/sql/CMakeLists.txt 2009-11-16 20:49:51 +0000
@@ -65,6 +65,7 @@ SET (SQL_SOURCE
sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc
sql_list.cc sql_load.cc sql_manager.cc sql_map.cc sql_parse.cc
sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
+ debug_sync.cc debug_sync.h
sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc
sql_table.cc sql_test.cc sql_trigger.cc sql_udf.cc sql_union.cc
sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc
=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am 2009-09-15 10:46:35 +0000
+++ b/sql/Makefile.am 2009-11-16 20:49:51 +0000
@@ -59,6 +59,7 @@ noinst_HEADERS = item.h item_func.h item
ha_ndbcluster.h ha_ndbcluster_cond.h \
ha_ndbcluster_binlog.h ha_ndbcluster_tables.h \
ha_partition.h rpl_constants.h \
+ debug_sync.h \
opt_range.h protocol.h rpl_tblmap.h rpl_utility.h \
rpl_reporting.h \
log.h log_slow.h sql_show.h rpl_rli.h rpl_mi.h \
@@ -103,6 +104,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.
discover.cc time.cc opt_range.cc opt_sum.cc \
records.cc filesort.cc handler.cc \
ha_partition.cc \
+ debug_sync.cc \
sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
=== added file 'sql/debug_sync.cc'
--- a/sql/debug_sync.cc 1970-01-01 00:00:00 +0000
+++ b/sql/debug_sync.cc 2009-10-04 09:53:02 +0000
@@ -0,0 +1,1906 @@
+/* Copyright (C) 2008 MySQL AB, 2008 - 2009 Sun Microsystems, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/**
+ == Debug Sync Facility ==
+
+ The Debug Sync Facility allows placement of synchronization points in
+ the server code by using the DEBUG_SYNC macro:
+
+ open_tables(...)
+
+ DEBUG_SYNC(thd, "after_open_tables");
+
+ lock_tables(...)
+
+ When activated, a sync point can
+
+ - Emit a signal and/or
+ - Wait for a signal
+
+ Nomenclature:
+
+ - signal: A value of a global variable that persists
+ until overwritten by a new signal. The global
+ variable can also be seen as a "signal post"
+ or "flag mast". Then the signal is what is
+ attached to the "signal post" or "flag mast".
+
+ - emit a signal: Assign the value (the signal) to the global
+ variable ("set a flag") and broadcast a
+ global condition to wake those waiting for
+ a signal.
+
+ - wait for a signal: Loop over waiting for the global condition until
+ the global value matches the wait-for signal.
+
+ By default, all sync points are inactive. They do nothing (except to
+ burn a couple of CPU cycles for checking if they are active).
+
+ A sync point becomes active when an action is requested for it.
+ To do so, put a line like this in the test case file:
+
+ SET DEBUG_SYNC= 'after_open_tables SIGNAL opened WAIT_FOR flushed';
+
+ This activates the sync point 'after_open_tables'. It requests it to
+ emit the signal 'opened' and wait for another thread to emit the signal
+ 'flushed' when the thread's execution runs through the sync point.
+
+ For every sync point there can be one action per thread only. Every
+ thread can request multiple actions, but only one per sync point. In
+ other words, a thread can activate multiple sync points.
+
+ Here is an example how to activate and use the sync points:
+
+ --connection conn1
+ SET DEBUG_SYNC= 'after_open_tables SIGNAL opened WAIT_FOR flushed';
+ send INSERT INTO t1 VALUES(1);
+ --connection conn2
+ SET DEBUG_SYNC= 'now WAIT_FOR opened';
+ SET DEBUG_SYNC= 'after_abort_locks SIGNAL flushed';
+ FLUSH TABLE t1;
+
+ When conn1 runs through the INSERT statement, it hits the sync point
+ 'after_open_tables'. It notices that it is active and executes its
+ action. It emits the signal 'opened' and waits for another thread to
+ emit the signal 'flushed'.
+
+ conn2 waits immediately at the special sync point 'now' for another
+ thread to emit the 'opened' signal.
+
+ A signal remains in effect until it is overwritten. If conn1 signals
+ 'opened' before conn2 reaches 'now', conn2 will still find the 'opened'
+ signal. It does not wait in this case.
+
+ When conn2 reaches 'after_abort_locks', it signals 'flushed', which lets
+ conn1 awake.
+
+ Normally the activation of a sync point is cleared when it has been
+ executed. Sometimes it is necessary to keep the sync point active for
+ another execution. You can add an execute count to the action:
+
+ SET DEBUG_SYNC= 'name SIGNAL sig EXECUTE 3';
+
+ This sets the signal point's activation counter to 3. Each execution
+ decrements the counter. After the third execution the sync point
+ becomes inactive.
+
+ One of the primary goals of this facility is to eliminate sleeps from
+ the test suite. In most cases it should be possible to rewrite test
+ cases so that they do not need to sleep. (But this facility cannot
+ synchronize multiple processes.) However, to support test development,
+ and as a last resort, sync point waiting times out. There is a default
+ timeout, but it can be overridden:
+
+ SET DEBUG_SYNC= 'name WAIT_FOR sig TIMEOUT 10 EXECUTE 2';
+
+ TIMEOUT 0 is special: If the signal is not present, the wait times out
+ immediately.
+
+ When a wait timed out (even on TIMEOUT 0), a warning is generated so
+ that it shows up in the test result.
+
+ You can throw an error message and kill the query when a synchronization
+ point is hit a certain number of times:
+
+ SET DEBUG_SYNC= 'name HIT_LIMIT 3';
+
+ Or combine it with signal and/or wait:
+
+ SET DEBUG_SYNC= 'name SIGNAL sig EXECUTE 2 HIT_LIMIT 3';
+
+ Here the first two hits emit the signal, the third hit returns the error
+ message and kills the query.
+
+ For cases where you are not sure that an action is taken and thus
+ cleared in any case, you can force to clear (deactivate) a sync point:
+
+ SET DEBUG_SYNC= 'name CLEAR';
+
+ If you want to clear all actions and clear the global signal, use:
+
+ SET DEBUG_SYNC= 'RESET';
+
+ This is the only way to reset the global signal to an empty string.
+
+ For testing of the facility itself you can execute a sync point just
+ as if it had been hit:
+
+ SET DEBUG_SYNC= 'name TEST';
+
+
+ === Formal Syntax ===
+
+ The string to "assign" to the DEBUG_SYNC variable can contain:
+
+ {RESET |
+ <sync point name> TEST |
+ <sync point name> CLEAR |
+ <sync point name> {{SIGNAL <signal name> |
+ WAIT_FOR <signal name> [TIMEOUT <seconds>]}
+ [EXECUTE <count>] &| HIT_LIMIT <count>}
+
+ Here '&|' means 'and/or'. This means that one of the sections
+ separated by '&|' must be present or both of them.
+
+
+ === Activation/Deactivation ===
+
+ The facility is an optional part of the MySQL server.
+ It is enabled in a debug server by default.
+
+ ./configure --enable-debug-sync
+
+ The Debug Sync Facility, when compiled in, is disabled by default. It
+ can be enabled by a mysqld command line option:
+
+ --debug-sync-timeout[=default_wait_timeout_value_in_seconds]
+
+ 'default_wait_timeout_value_in_seconds' is the default timeout for the
+ WAIT_FOR action. If set to zero, the facility stays disabled.
+
+ The facility is enabled by default in the test suite, but can be
+ disabled with:
+
+ mysql-test-run.pl ... --debug-sync-timeout=0 ...
+
+ Likewise the default wait timeout can be set:
+
+ mysql-test-run.pl ... --debug-sync-timeout=10 ...
+
+ The command line option influences the readable value of the system
+ variable 'debug_sync'.
+
+ * If the facility is not compiled in, the system variable does not exist.
+
+ * If --debug-sync-timeout=0 the value of the variable reads as "OFF".
+
+ * Otherwise the value reads as "ON - current signal: " followed by the
+ current signal string, which can be empty.
+
+ The readable variable value is the same, regardless if read as global
+ or session value.
+
+ Setting the 'debug-sync' system variable requires 'SUPER' privilege.
+ You can never read back the string that you assigned to the variable,
+ unless you assign the value that the variable does already have. But
+ that would give a parse error. A syntactically correct string is
+ parsed into a debug sync action and stored apart from the variable value.
+
+
+ === Implementation ===
+
+ Pseudo code for a sync point:
+
+ #define DEBUG_SYNC(thd, sync_point_name)
+ if (unlikely(opt_debug_sync_timeout))
+ debug_sync(thd, STRING_WITH_LEN(sync_point_name))
+
+ The sync point performs a binary search in a sorted array of actions
+ for this thread.
+
+ The SET DEBUG_SYNC statement adds a requested action to the array or
+ overwrites an existing action for the same sync point. When it adds a
+ new action, the array is sorted again.
+
+
+ === A typical synchronization pattern ===
+
+ There are quite a few places in MySQL, where we use a synchronization
+ pattern like this:
+
+ pthread_mutex_lock(&mutex);
+ thd->enter_cond(&condition_variable, &mutex, new_message);
+ #if defined(ENABLE_DEBUG_SYNC)
+ if (!thd->killed && !end_of_wait_condition)
+ DEBUG_SYNC(thd, "sync_point_name");
+ #endif
+ while (!thd->killed && !end_of_wait_condition)
+ pthread_cond_wait(&condition_variable, &mutex);
+ thd->exit_cond(old_message);
+
+ Here some explanations:
+
+ thd->enter_cond() is used to register the condition variable and the
+ mutex in thd->mysys_var. This is done to allow the thread to be
+ interrupted (killed) from its sleep. Another thread can find the
+ condition variable to signal and mutex to use for synchronization in
+ this thread's THD::mysys_var.
+
+ thd->enter_cond() requires the mutex to be acquired in advance.
+
+ thd->exit_cond() unregisters the condition variable and mutex and
+ releases the mutex.
+
+ If you want to have a Debug Sync point with the wait, please place it
+ behind enter_cond(). Only then you can safely decide, if the wait will
+ be taken. Also you will have THD::proc_info correct when the sync
+ point emits a signal. DEBUG_SYNC sets its own proc_info, but restores
+ the previous one before releasing its internal mutex. As soon as
+ another thread sees the signal, it does also see the proc_info from
+ before entering the sync point. In this case it will be "new_message",
+ which is associated with the wait that is to be synchronized.
+
+ In the example above, the wait condition is repeated before the sync
+ point. This is done to skip the sync point, if no wait takes place.
+ The sync point is before the loop (not inside the loop) to have it hit
+ once only. It is possible that the condition variable is signaled
+ multiple times without the wait condition to be true.
+
+ A bit off-topic: At some places, the loop is taken around the whole
+ synchronization pattern:
+
+ while (!thd->killed && !end_of_wait_condition)
+ {
+ pthread_mutex_lock(&mutex);
+ thd->enter_cond(&condition_variable, &mutex, new_message);
+ if (!thd->killed [&& !end_of_wait_condition])
+ {
+ [DEBUG_SYNC(thd, "sync_point_name");]
+ pthread_cond_wait(&condition_variable, &mutex);
+ }
+ thd->exit_cond(old_message);
+ }
+
+ Note that it is important to repeat the test for thd->killed after
+ enter_cond(). Otherwise the killing thread may kill this thread after
+ it tested thd->killed in the loop condition and before it registered
+ the condition variable and mutex in enter_cond(). In this case, the
+ killing thread does not know that this thread is going to wait on a
+ condition variable. It would just set THD::killed. But if we would not
+ test it again, we would go asleep though we are killed. If the killing
+ thread would kill us when we are after the second test, but still
+ before sleeping, we hold the mutex, which is registered in mysys_var.
+ The killing thread would try to acquire the mutex before signaling
+ the condition variable. Since the mutex is only released implicitly in
+ pthread_cond_wait(), the signaling happens at the right place. We
+ have a safe synchronization.
+
+ === Co-work with the DBUG facility ===
+
+ When running the MySQL test suite with the --debug command line
+ option, the Debug Sync Facility writes trace messages to the DBUG
+ trace. The following shell commands proved very useful in extracting
+ relevant information:
+
+ egrep 'query:|debug_sync_exec:' mysql-test/var/log/mysqld.1.trace
+
+ It shows all executed SQL statements and all actions executed by
+ synchronization points.
+
+ Sometimes it is also useful to see, which synchronization points have
+ been run through (hit) with or without executing actions. Then add
+ "|debug_sync_point:" to the egrep pattern.
+
+ === Further reading ===
+
+ For a discussion of other methods to synchronize threads see
+ http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronization
+
+ For complete syntax tests, functional tests, and examples see the test
+ case debug_sync.test.
+
+ See also worklog entry WL#4259 - Test Synchronization Facility
+*/
+
+#include "debug_sync.h"
+
+#if defined(ENABLED_DEBUG_SYNC)
+
+/*
+ Due to weaknesses in our include files, we need to include
+ mysql_priv.h here. To have THD declared, we need to include
+ sql_class.h. This includes log_event.h, which in turn requires
+ declarations from mysql_priv.h (e.g. OPTION_AUTO_IS_NULL).
+ mysql_priv.h includes almost everything, so is sufficient here.
+*/
+#include "mysql_priv.h"
+
+/*
+ Action to perform at a synchronization point.
+ NOTE: This structure is moved around in memory by realloc(), qsort(),
+ and memmove(). Do not add objects with non-trivial constuctors
+ or destructors, which might prevent moving of this structure
+ with these functions.
+*/
+struct st_debug_sync_action
+{
+ ulong activation_count; /* max(hit_limit, execute) */
+ ulong hit_limit; /* hits before kill query */
+ ulong execute; /* executes before self-clear */
+ ulong timeout; /* wait_for timeout */
+ String signal; /* signal to emit */
+ String wait_for; /* signal to wait for */
+ String sync_point; /* sync point name */
+ bool need_sort; /* if new action, array needs sort */
+};
+
+/* Debug sync control. Referenced by THD. */
+struct st_debug_sync_control
+{
+ st_debug_sync_action *ds_action; /* array of actions */
+ uint ds_active; /* # active actions */
+ uint ds_allocated; /* # allocated actions */
+ ulonglong dsp_hits; /* statistics */
+ ulonglong dsp_executed; /* statistics */
+ ulonglong dsp_max_active; /* statistics */
+ /*
+ thd->proc_info points at unsynchronized memory.
+ It must not go away as long as the thread exists.
+ */
+ char ds_proc_info[80]; /* proc_info string */
+};
+
+
+/**
+ Definitions for the debug sync facility.
+ 1. Global string variable to hold a "signal" ("signal post", "flag mast").
+ 2. Global condition variable for signaling and waiting.
+ 3. Global mutex to synchronize access to the above.
+*/
+struct st_debug_sync_globals
+{
+ String ds_signal; /* signal variable */
+ pthread_cond_t ds_cond; /* condition variable */
+ pthread_mutex_t ds_mutex; /* mutex variable */
+ ulonglong dsp_hits; /* statistics */
+ ulonglong dsp_executed; /* statistics */
+ ulonglong dsp_max_active; /* statistics */
+};
+static st_debug_sync_globals debug_sync_global; /* All globals in one object */
+
+/**
+ Callback pointer for C files.
+*/
+extern "C" void (*debug_sync_C_callback_ptr)(const char *, size_t);
+
+
+/**
+ Callback for debug sync, to be used by C files. See thr_lock.c for example.
+
+ @description
+
+ We cannot place a sync point directly in C files (like those in mysys or
+ certain storage engines written mostly in C like MyISAM or Maria). Because
+ they are C code and do not include mysql_priv.h. So they do not know the
+ macro DEBUG_SYNC(thd, sync_point_name). The macro needs a 'thd' argument.
+ Hence it cannot be used in files outside of the sql/ directory.
+
+ The workaround is to call back simple functions like this one from
+ non-sql/ files.
+
+ We want to allow modules like thr_lock to be used without sql/ and
+ especially without Debug Sync. So we cannot just do a simple call
+ of the callback function. Instead we provide a global pointer in
+ the other file, which is to be set to the callback by Debug Sync.
+ If the pointer is not set, no call back will be done. If Debug
+ Sync sets the pointer to a callback function like this one, it will
+ be called. That way thr_lock.c does not have an undefined reference
+ to Debug Sync and can be used without it. Debug Sync, in contrast,
+ has an undefined reference to that pointer and thus requires
+ thr_lock to be linked too. But this is not a problem as it is part
+ of the MySQL server anyway.
+
+ @note
+ The callback pointer in C files is set only if debug sync is
+ initialized. And this is done only if opt_debug_sync_timeout is set.
+*/
+
+static void debug_sync_C_callback(const char *sync_point_name,
+ size_t name_len)
+{
+ if (unlikely(opt_debug_sync_timeout))
+ debug_sync(current_thd, sync_point_name, name_len);
+}
+
+
+/**
+ Initialize the debug sync facility at server start.
+
+ @return status
+ @retval 0 ok
+ @retval != 0 error
+*/
+
+int debug_sync_init(void)
+{
+ DBUG_ENTER("debug_sync_init");
+
+ if (opt_debug_sync_timeout)
+ {
+ int rc;
+
+ /* Initialize the global variables. */
+ debug_sync_global.ds_signal.length(0);
+ if ((rc= pthread_cond_init(&debug_sync_global.ds_cond, NULL)) ||
+ (rc= pthread_mutex_init(&debug_sync_global.ds_mutex,
+ MY_MUTEX_INIT_FAST)))
+ DBUG_RETURN(rc); /* purecov: inspected */
+
+ /* Set the call back pointer in C files. */
+ debug_sync_C_callback_ptr= debug_sync_C_callback;
+ }
+
+ DBUG_RETURN(0);
+}
+
+
+/**
+ End the debug sync facility.
+
+ @description
+ This is called at server shutdown or after a thread initialization error.
+*/
+
+void debug_sync_end(void)
+{
+ DBUG_ENTER("debug_sync_end");
+
+ /* End the facility only if it had been initialized. */
+ if (debug_sync_C_callback_ptr)
+ {
+ /* Clear the call back pointer in C files. */
+ debug_sync_C_callback_ptr= NULL;
+
+ /* Destroy the global variables. */
+ debug_sync_global.ds_signal.free();
+ (void) pthread_cond_destroy(&debug_sync_global.ds_cond);
+ (void) pthread_mutex_destroy(&debug_sync_global.ds_mutex);
+
+ /* Print statistics. */
+ {
+ char llbuff[22];
+ sql_print_information("Debug sync points hit: %22s",
+ llstr(debug_sync_global.dsp_hits, llbuff));
+ sql_print_information("Debug sync points executed: %22s",
+ llstr(debug_sync_global.dsp_executed, llbuff));
+ sql_print_information("Debug sync points max active per thread: %22s",
+ llstr(debug_sync_global.dsp_max_active, llbuff));
+ }
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+
+/* purecov: begin tested */
+
+/**
+ Disable the facility after lack of memory if no error can be returned.
+
+ @note
+ Do not end the facility here because the global variables can
+ be in use by other threads.
+*/
+
+static void debug_sync_emergency_disable(void)
+{
+ DBUG_ENTER("debug_sync_emergency_disable");
+
+ opt_debug_sync_timeout= 0;
+
+ DBUG_PRINT("debug_sync",
+ ("Debug Sync Facility disabled due to lack of memory."));
+ sql_print_error("Debug Sync Facility disabled due to lack of memory.");
+
+ DBUG_VOID_RETURN;
+}
+
+/* purecov: end */
+
+
+/**
+ Initialize the debug sync facility at thread start.
+
+ @param[in] thd thread handle
+*/
+
+void debug_sync_init_thread(THD *thd)
+{
+ DBUG_ENTER("debug_sync_init_thread");
+ DBUG_ASSERT(thd);
+
+ if (opt_debug_sync_timeout)
+ {
+ thd->debug_sync_control= (st_debug_sync_control*)
+ my_malloc(sizeof(st_debug_sync_control), MYF(MY_WME | MY_ZEROFILL));
+ if (!thd->debug_sync_control)
+ {
+ /*
+ Error is reported by my_malloc().
+ We must disable the facility. We have no way to return an error.
+ */
+ debug_sync_emergency_disable(); /* purecov: tested */
+ }
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ End the debug sync facility at thread end.
+
+ @param[in] thd thread handle
+*/
+
+void debug_sync_end_thread(THD *thd)
+{
+ DBUG_ENTER("debug_sync_end_thread");
+ DBUG_ASSERT(thd);
+
+ if (thd->debug_sync_control)
+ {
+ st_debug_sync_control *ds_control= thd->debug_sync_control;
+
+ /*
+ This synchronization point can be used to synchronize on thread end.
+ This is the latest point in a THD's life, where this can be done.
+ */
+ DEBUG_SYNC(thd, "thread_end");
+
+ if (ds_control->ds_action)
+ {
+ st_debug_sync_action *action= ds_control->ds_action;
+ st_debug_sync_action *action_end= action + ds_control->ds_allocated;
+ for (; action < action_end; action++)
+ {
+ action->signal.free();
+ action->wait_for.free();
+ action->sync_point.free();
+ }
+ my_free(ds_control->ds_action, MYF(0));
+ }
+
+ /* Statistics. */
+ pthread_mutex_lock(&debug_sync_global.ds_mutex);
+ debug_sync_global.dsp_hits+= ds_control->dsp_hits;
+ debug_sync_global.dsp_executed+= ds_control->dsp_executed;
+ if (debug_sync_global.dsp_max_active < ds_control->dsp_max_active)
+ debug_sync_global.dsp_max_active= ds_control->dsp_max_active;
+ pthread_mutex_unlock(&debug_sync_global.ds_mutex);
+
+ my_free(ds_control, MYF(0));
+ thd->debug_sync_control= NULL;
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Move a string by length.
+
+ @param[out] to buffer for the resulting string
+ @param[in] to_end end of buffer
+ @param[in] from source string
+ @param[in] length number of bytes to copy
+
+ @return pointer to end of copied string
+*/
+
+static char *debug_sync_bmove_len(char *to, char *to_end,
+ const char *from, size_t length)
+{
+ DBUG_ASSERT(to);
+ DBUG_ASSERT(to_end);
+ DBUG_ASSERT(!length || from);
+ set_if_smaller(length, (size_t) (to_end - to));
+ memcpy(to, from, length);
+ return (to + length);
+}
+
+
+#if !defined(DBUG_OFF)
+
+/**
+ Create a string that describes an action.
+
+ @param[out] result buffer for the resulting string
+ @param[in] size size of result buffer
+ @param[in] action action to describe
+*/
+
+static void debug_sync_action_string(char *result, uint size,
+ st_debug_sync_action *action)
+{
+ char *wtxt= result;
+ char *wend= wtxt + size - 1; /* Allow emergency '\0'. */
+ DBUG_ASSERT(result);
+ DBUG_ASSERT(action);
+
+ /* If an execute count is present, signal or wait_for are needed too. */
+ DBUG_ASSERT(!action->execute ||
+ action->signal.length() || action->wait_for.length());
+
+ if (action->execute)
+ {
+ if (action->signal.length())
+ {
+ wtxt= debug_sync_bmove_len(wtxt, wend, STRING_WITH_LEN("SIGNAL "));
+ wtxt= debug_sync_bmove_len(wtxt, wend, action->signal.ptr(),
+ action->signal.length());
+ }
+ if (action->wait_for.length())
+ {
+ if ((wtxt == result) && (wtxt < wend))
+ *(wtxt++)= ' ';
+ wtxt= debug_sync_bmove_len(wtxt, wend, STRING_WITH_LEN(" WAIT_FOR "));
+ wtxt= debug_sync_bmove_len(wtxt, wend, action->wait_for.ptr(),
+ action->wait_for.length());
+
+ if (action->timeout != opt_debug_sync_timeout)
+ {
+ wtxt+= my_snprintf(wtxt, wend - wtxt, " TIMEOUT %lu", action->timeout);
+ }
+ }
+ if (action->execute != 1)
+ {
+ wtxt+= my_snprintf(wtxt, wend - wtxt, " EXECUTE %lu", action->execute);
+ }
+ }
+ if (action->hit_limit)
+ {
+ wtxt+= my_snprintf(wtxt, wend - wtxt, "%sHIT_LIMIT %lu",
+ (wtxt == result) ? "" : " ", action->hit_limit);
+ }
+
+ /*
+ If (wtxt == wend) string may not be terminated.
+ There is one byte left for an emergency termination.
+ */
+ *wtxt= '\0';
+}
+
+
+/**
+ Print actions.
+
+ @param[in] thd thread handle
+*/
+
+static void debug_sync_print_actions(THD *thd)
+{
+ st_debug_sync_control *ds_control= thd->debug_sync_control;
+ uint idx;
+ DBUG_ENTER("debug_sync_print_actions");
+ DBUG_ASSERT(thd);
+
+ if (!ds_control)
+ DBUG_VOID_RETURN;
+
+ for (idx= 0; idx < ds_control->ds_active; idx++)
+ {
+ const char *dsp_name= ds_control->ds_action[idx].sync_point.c_ptr();
+ char action_string[256];
+
+ debug_sync_action_string(action_string, sizeof(action_string),
+ ds_control->ds_action + idx);
+ DBUG_PRINT("debug_sync_list", ("%s %s", dsp_name, action_string));
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+#endif /* !defined(DBUG_OFF) */
+
+
+/**
+ Compare two actions by sync point name length, string.
+
+ @param[in] arg1 reference to action1
+ @param[in] arg2 reference to action2
+
+ @return difference
+ @retval == 0 length1/string1 is same as length2/string2
+ @retval < 0 length1/string1 is smaller
+ @retval > 0 length1/string1 is bigger
+*/
+
+static int debug_sync_qsort_cmp(const void* arg1, const void* arg2)
+{
+ st_debug_sync_action *action1= (st_debug_sync_action*) arg1;
+ st_debug_sync_action *action2= (st_debug_sync_action*) arg2;
+ int diff;
+ DBUG_ASSERT(action1);
+ DBUG_ASSERT(action2);
+
+ if (!(diff= action1->sync_point.length() - action2->sync_point.length()))
+ diff= memcmp(action1->sync_point.ptr(), action2->sync_point.ptr(),
+ action1->sync_point.length());
+
+ return diff;
+}
+
+
+/**
+ Find a debug sync action.
+
+ @param[in] actionarr array of debug sync actions
+ @param[in] quantity number of actions in array
+ @param[in] dsp_name name of debug sync point to find
+ @param[in] name_len length of name of debug sync point
+
+ @return action
+ @retval != NULL found sync point in array
+ @retval NULL not found
+
+ @description
+ Binary search. Array needs to be sorted by length, sync point name.
+*/
+
+static st_debug_sync_action *debug_sync_find(st_debug_sync_action *actionarr,
+ int quantity,
+ const char *dsp_name,
+ uint name_len)
+{
+ st_debug_sync_action *action;
+ int low ;
+ int high ;
+ int mid ;
+ int diff ;
+ DBUG_ASSERT(actionarr);
+ DBUG_ASSERT(dsp_name);
+ DBUG_ASSERT(name_len);
+
+ low= 0;
+ high= quantity;
+
+ while (low < high)
+ {
+ mid= (low + high) / 2;
+ action= actionarr + mid;
+ if (!(diff= name_len - action->sync_point.length()) &&
+ !(diff= memcmp(dsp_name, action->sync_point.ptr(), name_len)))
+ return action;
+ if (diff > 0)
+ low= mid + 1;
+ else
+ high= mid - 1;
+ }
+
+ if (low < quantity)
+ {
+ action= actionarr + low;
+ if ((name_len == action->sync_point.length()) &&
+ !memcmp(dsp_name, action->sync_point.ptr(), name_len))
+ return action;
+ }
+
+ return NULL;
+}
+
+
+/**
+ Reset the debug sync facility.
+
+ @param[in] thd thread handle
+
+ @description
+ Remove all actions of this thread.
+ Clear the global signal.
+*/
+
+static void debug_sync_reset(THD *thd)
+{
+ st_debug_sync_control *ds_control= thd->debug_sync_control;
+ DBUG_ENTER("debug_sync_reset");
+ DBUG_ASSERT(thd);
+ DBUG_ASSERT(ds_control);
+
+ /* Remove all actions of this thread. */
+ ds_control->ds_active= 0;
+
+ /* Clear the global signal. */
+ pthread_mutex_lock(&debug_sync_global.ds_mutex);
+ debug_sync_global.ds_signal.length(0);
+ pthread_mutex_unlock(&debug_sync_global.ds_mutex);
+
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Remove a debug sync action.
+
+ @param[in] ds_control control object
+ @param[in] action action to be removed
+
+ @description
+ Removing an action mainly means to decrement the ds_active counter.
+ But if the action is between other active action in the array, then
+ the array needs to be shrinked. The active actions above the one to
+ be removed have to be moved down by one slot.
+*/
+
+static void debug_sync_remove_action(st_debug_sync_control *ds_control,
+ st_debug_sync_action *action)
+{
+ uint dsp_idx= action - ds_control->ds_action;
+ DBUG_ENTER("debug_sync_remove_action");
+ DBUG_ASSERT(ds_control);
+ DBUG_ASSERT(ds_control == current_thd->debug_sync_control);
+ DBUG_ASSERT(action);
+ DBUG_ASSERT(dsp_idx < ds_control->ds_active);
+
+ /* Decrement the number of currently active actions. */
+ ds_control->ds_active--;
+
+ /*
+ If this was not the last active action in the array, we need to
+ shift remaining active actions down to keep the array gap-free.
+ Otherwise binary search might fail or take longer than necessary at
+ least. Also new actions are always put to the end of the array.
+ */
+ if (ds_control->ds_active > dsp_idx)
+ {
+ /*
+ Do not make save_action an object of class st_debug_sync_action.
+ Its destructor would tamper with the String pointers.
+ */
+ uchar save_action[sizeof(st_debug_sync_action)];
+
+ /*
+ Copy the to-be-removed action object to temporary storage before
+ the shift copies the string pointers over. Do not use assignment
+ because it would use assignment operator methods for the Strings.
+ This would copy the strings. The shift below overwrite the string
+ pointers without freeing them first. By using memmove() we save
+ the pointers, which are overwritten by the shift.
+ */
+ memmove(save_action, action, sizeof(st_debug_sync_action));
+
+ /* Move actions down. */
+ memmove(ds_control->ds_action + dsp_idx,
+ ds_control->ds_action + dsp_idx + 1,
+ (ds_control->ds_active - dsp_idx) *
+ sizeof(st_debug_sync_action));
+
+ /*
+ Copy back the saved action object to the now free array slot. This
+ replaces the double references of String pointers that have been
+ produced by the shift. Again do not use an assignment operator to
+ avoid string allocation/copy.
+ */
+ memmove(ds_control->ds_action + ds_control->ds_active, save_action,
+ sizeof(st_debug_sync_action));
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Get a debug sync action.
+
+ @param[in] thd thread handle
+ @param[in] dsp_name debug sync point name
+ @param[in] name_len length of sync point name
+
+ @return action
+ @retval != NULL ok
+ @retval NULL error
+
+ @description
+ Find the debug sync action for a debug sync point or make a new one.
+*/
+
+static st_debug_sync_action *debug_sync_get_action(THD *thd,
+ const char *dsp_name,
+ uint name_len)
+{
+ st_debug_sync_control *ds_control= thd->debug_sync_control;
+ st_debug_sync_action *action;
+ DBUG_ENTER("debug_sync_get_action");
+ DBUG_ASSERT(thd);
+ DBUG_ASSERT(dsp_name);
+ DBUG_ASSERT(name_len);
+ DBUG_ASSERT(ds_control);
+ DBUG_PRINT("debug_sync", ("sync_point: '%.*s'", (int) name_len, dsp_name));
+ DBUG_PRINT("debug_sync", ("active: %u allocated: %u",
+ ds_control->ds_active, ds_control->ds_allocated));
+
+ /* There cannot be more active actions than allocated. */
+ DBUG_ASSERT(ds_control->ds_active <= ds_control->ds_allocated);
+ /* If there are active actions, the action array must be present. */
+ DBUG_ASSERT(!ds_control->ds_active || ds_control->ds_action);
+
+ /* Try to reuse existing action if there is one for this sync point. */
+ if (ds_control->ds_active &&
+ (action= debug_sync_find(ds_control->ds_action, ds_control->ds_active,
+ dsp_name, name_len)))
+ {
+ /* Reuse an already active sync point action. */
+ DBUG_ASSERT((uint)(action - ds_control->ds_action) < ds_control->ds_active);
+ DBUG_PRINT("debug_sync", ("reuse action idx: %ld",
+ (long) (action - ds_control->ds_action)));
+ }
+ else
+ {
+ /* Create a new action. */
+ int dsp_idx= ds_control->ds_active++;
+ set_if_bigger(ds_control->dsp_max_active, ds_control->ds_active);
+ if (ds_control->ds_active > ds_control->ds_allocated)
+ {
+ uint new_alloc= ds_control->ds_active + 3;
+ void *new_action= my_realloc(ds_control->ds_action,
+ new_alloc * sizeof(st_debug_sync_action),
+ MYF(MY_WME | MY_ALLOW_ZERO_PTR));
+ if (!new_action)
+ {
+ /* Error is reported by my_malloc(). */
+ goto err; /* purecov: tested */
+ }
+ ds_control->ds_action= (st_debug_sync_action*) new_action;
+ ds_control->ds_allocated= new_alloc;
+ /* Clear memory as we do not run string constructors here. */
+ bzero((uchar*) (ds_control->ds_action + dsp_idx),
+ (new_alloc - dsp_idx) * sizeof(st_debug_sync_action));
+ }
+ DBUG_PRINT("debug_sync", ("added action idx: %u", dsp_idx));
+ action= ds_control->ds_action + dsp_idx;
+ if (action->sync_point.copy(dsp_name, name_len, system_charset_info))
+ {
+ /* Error is reported by my_malloc(). */
+ goto err; /* purecov: tested */
+ }
+ action->need_sort= TRUE;
+ }
+ DBUG_ASSERT(action >= ds_control->ds_action);
+ DBUG_ASSERT(action < ds_control->ds_action + ds_control->ds_active);
+ DBUG_PRINT("debug_sync", ("action: 0x%lx array: 0x%lx count: %u",
+ (long) action, (long) ds_control->ds_action,
+ ds_control->ds_active));
+
+ DBUG_RETURN(action);
+
+ /* purecov: begin tested */
+ err:
+ DBUG_RETURN(NULL);
+ /* purecov: end */
+}
+
+
+/**
+ Set a debug sync action.
+
+ @param[in] thd thread handle
+ @param[in] action synchronization action
+
+ @return status
+ @retval FALSE ok
+ @retval TRUE error
+
+ @description
+ This is called from the debug sync parser. It arms the action for
+ the requested sync point. If the action parsed into an empty action,
+ it is removed instead.
+
+ Setting an action for a sync point means to make the sync point
+ active. When it is hit it will execute this action.
+
+ Before parsing, we "get" an action object. This is placed at the
+ end of the thread's action array unless the requested sync point
+ has an action already.
+
+ Then the parser fills the action object from the request string.
+
+ Finally the action is "set" for the sync point. If it was parsed
+ to be empty, it is removed from the array. If it did belong to a
+ sync point before, the sync point becomes inactive. If the action
+ became non-empty and it did not belong to a sync point before (it
+ was added at the end of the action array), the action array needs
+ to be sorted by sync point.
+
+ If the sync point name is "now", it is executed immediately.
+*/
+
+static bool debug_sync_set_action(THD *thd, st_debug_sync_action *action)
+{
+ st_debug_sync_control *ds_control= thd->debug_sync_control;
+ bool is_dsp_now= FALSE;
+ DBUG_ENTER("debug_sync_set_action");
+ DBUG_ASSERT(thd);
+ DBUG_ASSERT(action);
+ DBUG_ASSERT(ds_control);
+
+ action->activation_count= max(action->hit_limit, action->execute);
+ if (!action->activation_count)
+ {
+ debug_sync_remove_action(ds_control, action);
+ DBUG_PRINT("debug_sync", ("action cleared"));
+ }
+ else
+ {
+ const char *dsp_name= action->sync_point.c_ptr();
+ DBUG_EXECUTE("debug_sync", {
+ /* Functions as DBUG_PRINT args can change keyword and line nr. */
+ const char *sig_emit= action->signal.c_ptr();
+ const char *sig_wait= action->wait_for.c_ptr();
+ DBUG_PRINT("debug_sync",
+ ("sync_point: '%s' activation_count: %lu hit_limit: %lu "
+ "execute: %lu timeout: %lu signal: '%s' wait_for: '%s'",
+ dsp_name, action->activation_count,
+ action->hit_limit, action->execute, action->timeout,
+ sig_emit, sig_wait));});
+
+ /* Check this before sorting the array. action may move. */
+ is_dsp_now= !my_strcasecmp(system_charset_info, dsp_name, "now");
+
+ if (action->need_sort)
+ {
+ action->need_sort= FALSE;
+ /* Sort actions by (name_len, name). */
+ my_qsort(ds_control->ds_action, ds_control->ds_active,
+ sizeof(st_debug_sync_action), debug_sync_qsort_cmp);
+ }
+ }
+ DBUG_EXECUTE("debug_sync_list", debug_sync_print_actions(thd););
+
+ /* Execute the special sync point 'now' if activated above. */
+ if (is_dsp_now)
+ {
+ DEBUG_SYNC(thd, "now");
+ /*
+ If HIT_LIMIT for sync point "now" was 1, the execution of the sync
+ point decremented it to 0. In this case the following happened:
+
+ - an error message was reported with my_error() and
+ - the statement was killed with thd->killed= THD::KILL_QUERY.
+
+ If a statement reports an error, it must not call send_ok().
+ The calling functions will not call send_ok(), if we return TRUE
+ from this function.
+
+ thd->killed is also set if the wait is interrupted from a
+ KILL or KILL QUERY statement. In this case, no error is reported
+ and shall not be reported as a result of SET DEBUG_SYNC.
+ Hence, we check for the first condition above.
+ */
+ if (thd->is_error())
+ DBUG_RETURN(TRUE);
+ }
+
+ DBUG_RETURN(FALSE);
+}
+
+
+/**
+ Extract a token from a string.
+
+ @param[out] token_p returns start of token
+ @param[out] token_length_p returns length of token
+ @param[in,out] ptr current string pointer, adds '\0' terminators
+
+ @return string pointer or NULL
+ @retval != NULL ptr behind token terminator or at string end
+ @retval NULL no token found in remainder of string
+
+ @note
+ This function assumes that the string is in system_charset_info,
+ that this charset is single byte for ASCII NUL ('\0'), that no
+ character except of ASCII NUL ('\0') contains a byte with value 0,
+ and that ASCII NUL ('\0') is used as the string terminator.
+
+ This function needs to return tokens that are terminated with ASCII
+ NUL ('\0'). The tokens are used in my_strcasecmp(). Unfortunately
+ there is no my_strncasecmp().
+
+ To return the last token without copying it, we require the input
+ string to be nul terminated.
+
+ @description
+ This function skips space characters at string begin.
+
+ It returns a pointer to the first non-space character in *token_p.
+
+ If no non-space character is found before the string terminator
+ ASCII NUL ('\0'), the function returns NULL. *token_p and
+ *token_length_p remain unchanged in this case (they are not set).
+
+ The function takes a space character or an ASCII NUL ('\0') as a
+ terminator of the token. The space character could be multi-byte.
+
+ It returns the length of the token in bytes, excluding the
+ terminator, in *token_length_p.
+
+ If the terminator of the token is ASCII NUL ('\0'), it returns a
+ pointer to the terminator (string end).
+
+ If the terminator is a space character, it replaces the the first
+ byte of the terminator character by ASCII NUL ('\0'), skips the (now
+ corrupted) terminator character, and skips all following space
+ characters. It returns a pointer to the next non-space character or
+ to the string terminator ASCII NUL ('\0').
+*/
+
+static char *debug_sync_token(char **token_p, uint *token_length_p, char *ptr)
+{
+ DBUG_ASSERT(token_p);
+ DBUG_ASSERT(token_length_p);
+ DBUG_ASSERT(ptr);
+
+ /* Skip leading space */
+ while (my_isspace(system_charset_info, *ptr))
+ ptr+= my_mbcharlen(system_charset_info, (uchar) *ptr);
+
+ if (!*ptr)
+ {
+ ptr= NULL;
+ goto end;
+ }
+
+ /* Get token start. */
+ *token_p= ptr;
+
+ /* Find token end. */
+ while (*ptr && !my_isspace(system_charset_info, *ptr))
+ ptr+= my_mbcharlen(system_charset_info, (uchar) *ptr);
+
+ /* Get token length. */
+ *token_length_p= ptr - *token_p;
+
+ /* If necessary, terminate token. */
+ if (*ptr)
+ {
+ /* Get terminator character length. */
+ uint mbspacelen= my_mbcharlen(system_charset_info, (uchar) *ptr);
+
+ /* Terminate token. */
+ *ptr= '\0';
+
+ /* Skip the terminator. */
+ ptr+= mbspacelen;
+
+ /* Skip trailing space */
+ while (my_isspace(system_charset_info, *ptr))
+ ptr+= my_mbcharlen(system_charset_info, (uchar) *ptr);
+ }
+
+ end:
+ return ptr;
+}
+
+
+/**
+ Extract a number from a string.
+
+ @param[out] number_p returns number
+ @param[in] actstrptr current pointer in action string
+
+ @return string pointer or NULL
+ @retval != NULL ptr behind token terminator or at string end
+ @retval NULL no token found or token is not valid number
+
+ @note
+ The same assumptions about charset apply as for debug_sync_token().
+
+ @description
+ This function fetches a token from the string and converts it
+ into a number.
+
+ If there is no token left in the string, or the token is not a valid
+ decimal number, NULL is returned. The result in *number_p is
+ undefined in this case.
+*/
+
+static char *debug_sync_number(ulong *number_p, char *actstrptr)
+{
+ char *ptr;
+ char *ept;
+ char *token;
+ uint token_length;
+ DBUG_ASSERT(number_p);
+ DBUG_ASSERT(actstrptr);
+
+ /* Get token from string. */
+ if (!(ptr= debug_sync_token(&token, &token_length, actstrptr)))
+ goto end;
+
+ *number_p= strtoul(token, &ept, 10);
+ if (*ept)
+ ptr= NULL;
+
+ end:
+ return ptr;
+}
+
+
+/**
+ Evaluate a debug sync action string.
+
+ @param[in] thd thread handle
+ @param[in,out] action_str action string to receive '\0' terminators
+
+ @return status
+ @retval FALSE ok
+ @retval TRUE error
+
+ @description
+ This is called when the DEBUG_SYNC system variable is set.
+ Parse action string, build a debug sync action, activate it.
+
+ Before parsing, we "get" an action object. This is placed at the
+ end of the thread's action array unless the requested sync point
+ has an action already.
+
+ Then the parser fills the action object from the request string.
+
+ Finally the action is "set" for the sync point. This means that the
+ sync point becomes active or inactive, depending on the action
+ values.
+
+ @note
+ The input string needs to be ASCII NUL ('\0') terminated. We split
+ nul-terminated tokens in it without copy.
+
+ @see the function comment of debug_sync_token() for more constraints
+ for the string.
+*/
+
+static bool debug_sync_eval_action(THD *thd, char *action_str)
+{
+ st_debug_sync_action *action= NULL;
+ const char *errmsg;
+ char *ptr;
+ char *token;
+ uint token_length= 0;
+ DBUG_ENTER("debug_sync_eval_action");
+ DBUG_ASSERT(thd);
+ DBUG_ASSERT(action_str);
+
+ /*
+ Get debug sync point name. Or a special command.
+ */
+ if (!(ptr= debug_sync_token(&token, &token_length, action_str)))
+ {
+ errmsg= "Missing synchronization point name";
+ goto err;
+ }
+
+ /*
+ If there is a second token, the first one is the sync point name.
+ */
+ if (*ptr)
+ {
+ /* Get an action object to collect the requested action parameters. */
+ action= debug_sync_get_action(thd, token, token_length);
+ if (!action)
+ {
+ /* Error message is sent. */
+ DBUG_RETURN(TRUE); /* purecov: tested */
+ }
+ }
+
+ /*
+ Get kind of action to be taken at sync point.
+ */
+ if (!(ptr= debug_sync_token(&token, &token_length, ptr)))
+ {
+ /* No action present. Try special commands. Token unchanged. */
+
+ /*
+ Try RESET.
+ */
+ if (!my_strcasecmp(system_charset_info, token, "RESET"))
+ {
+ /* It is RESET. Reset all actions and global signal. */
+ debug_sync_reset(thd);
+ goto end;
+ }
+
+ /* Token unchanged. It still contains sync point name. */
+ errmsg= "Missing action after synchronization point name '%.*s'";
+ goto err;
+ }
+
+ /*
+ Check for pseudo actions first. Start with actions that work on
+ an existing action.
+ */
+ DBUG_ASSERT(action);
+
+ /*
+ Try TEST.
+ */
+ if (!my_strcasecmp(system_charset_info, token, "TEST"))
+ {
+ /* It is TEST. Nothing must follow it. */
+ if (*ptr)
+ {
+ errmsg= "Nothing must follow action TEST";
+ goto err;
+ }
+
+ /* Execute sync point. */
+ debug_sync(thd, action->sync_point.ptr(), action->sync_point.length());
+ /* Fix statistics. This was not a real hit of the sync point. */
+ thd->debug_sync_control->dsp_hits--;
+ goto end;
+ }
+
+ /*
+ Now check for actions that define a new action.
+ Initialize action. Do not use bzero(). Strings may have malloced.
+ */
+ action->activation_count= 0;
+ action->hit_limit= 0;
+ action->execute= 0;
+ action->timeout= 0;
+ action->signal.length(0);
+ action->wait_for.length(0);
+
+ /*
+ Try CLEAR.
+ */
+ if (!my_strcasecmp(system_charset_info, token, "CLEAR"))
+ {
+ /* It is CLEAR. Nothing must follow it. */
+ if (*ptr)
+ {
+ errmsg= "Nothing must follow action CLEAR";
+ goto err;
+ }
+
+ /* Set (clear/remove) action. */
+ goto set_action;
+ }
+
+ /*
+ Now check for real sync point actions.
+ */
+
+ /*
+ Try SIGNAL.
+ */
+ if (!my_strcasecmp(system_charset_info, token, "SIGNAL"))
+ {
+ /* It is SIGNAL. Signal name must follow. */
+ if (!(ptr= debug_sync_token(&token, &token_length, ptr)))
+ {
+ errmsg= "Missing signal name after action SIGNAL";
+ goto err;
+ }
+ if (action->signal.copy(token, token_length, system_charset_info))
+ {
+ /* Error is reported by my_malloc(). */
+ /* purecov: begin tested */
+ errmsg= NULL;
+ goto err;
+ /* purecov: end */
+ }
+
+ /* Set default for EXECUTE option. */
+ action->execute= 1;
+
+ /* Get next token. If none follows, set action. */
+ if (!(ptr= debug_sync_token(&token, &token_length, ptr)))
+ goto set_action;
+ }
+
+ /*
+ Try WAIT_FOR.
+ */
+ if (!my_strcasecmp(system_charset_info, token, "WAIT_FOR"))
+ {
+ /* It is WAIT_FOR. Wait_for signal name must follow. */
+ if (!(ptr= debug_sync_token(&token, &token_length, ptr)))
+ {
+ errmsg= "Missing signal name after action WAIT_FOR";
+ goto err;
+ }
+ if (action->wait_for.copy(token, token_length, system_charset_info))
+ {
+ /* Error is reported by my_malloc(). */
+ /* purecov: begin tested */
+ errmsg= NULL;
+ goto err;
+ /* purecov: end */
+ }
+
+ /* Set default for EXECUTE and TIMEOUT options. */
+ action->execute= 1;
+ action->timeout= opt_debug_sync_timeout;
+
+ /* Get next token. If none follows, set action. */
+ if (!(ptr= debug_sync_token(&token, &token_length, ptr)))
+ goto set_action;
+
+ /*
+ Try TIMEOUT.
+ */
+ if (!my_strcasecmp(system_charset_info, token, "TIMEOUT"))
+ {
+ /* It is TIMEOUT. Number must follow. */
+ if (!(ptr= debug_sync_number(&action->timeout, ptr)))
+ {
+ errmsg= "Missing valid number after TIMEOUT";
+ goto err;
+ }
+
+ /* Get next token. If none follows, set action. */
+ if (!(ptr= debug_sync_token(&token, &token_length, ptr)))
+ goto set_action;
+ }
+ }
+
+ /*
+ Try EXECUTE.
+ */
+ if (!my_strcasecmp(system_charset_info, token, "EXECUTE"))
+ {
+ /*
+ EXECUTE requires either SIGNAL and/or WAIT_FOR to be present.
+ In this case action->execute has been preset to 1.
+ */
+ if (!action->execute)
+ {
+ errmsg= "Missing action before EXECUTE";
+ goto err;
+ }
+
+ /* Number must follow. */
+ if (!(ptr= debug_sync_number(&action->execute, ptr)))
+ {
+ errmsg= "Missing valid number after EXECUTE";
+ goto err;
+ }
+
+ /* Get next token. If none follows, set action. */
+ if (!(ptr= debug_sync_token(&token, &token_length, ptr)))
+ goto set_action;
+ }
+
+ /*
+ Try HIT_LIMIT.
+ */
+ if (!my_strcasecmp(system_charset_info, token, "HIT_LIMIT"))
+ {
+ /* Number must follow. */
+ if (!(ptr= debug_sync_number(&action->hit_limit, ptr)))
+ {
+ errmsg= "Missing valid number after HIT_LIMIT";
+ goto err;
+ }
+
+ /* Get next token. If none follows, set action. */
+ if (!(ptr= debug_sync_token(&token, &token_length, ptr)))
+ goto set_action;
+ }
+
+ errmsg= "Illegal or out of order stuff: '%.*s'";
+
+ err:
+ if (errmsg)
+ {
+ /*
+ NOTE: errmsg must either have %.*s or none % at all.
+ It can be NULL if an error message is already reported
+ (e.g. by my_malloc()).
+ */
+ set_if_smaller(token_length, 64); /* Limit error message length. */
+ my_printf_error(ER_PARSE_ERROR, errmsg, MYF(0), token_length, token);
+ }
+ if (action)
+ debug_sync_remove_action(thd->debug_sync_control, action);
+ DBUG_RETURN(TRUE);
+
+ set_action:
+ DBUG_RETURN(debug_sync_set_action(thd, action));
+
+ end:
+ DBUG_RETURN(FALSE);
+}
+
+
+/**
+ Check if the system variable 'debug_sync' can be set.
+
+ @param[in] thd thread handle
+ @param[in] var set variable request
+
+ @return status
+ @retval FALSE ok, variable can be set
+ @retval TRUE error, variable cannot be set
+*/
+
+bool sys_var_debug_sync::check(THD *thd, set_var *var)
+{
+ DBUG_ENTER("sys_var_debug_sync::check");
+ DBUG_ASSERT(thd);
+ DBUG_ASSERT(var);
+
+ /*
+ Variable can be set for the session only.
+
+ This could be changed later. Then we need to have a global array of
+ actions in addition to the thread local ones. SET GLOBAL would
+ manage the global array, SET [SESSION] the local array. A sync point
+ would need to look for a local and a global action. Setting and
+ executing of global actions need to be protected by a mutex.
+
+ The purpose of global actions could be to allow synchronizing with
+ connectionless threads that cannot execute SET statements.
+ */
+ if (var->type == OPT_GLOBAL)
+ {
+ my_error(ER_LOCAL_VARIABLE, MYF(0), name);
+ DBUG_RETURN(TRUE);
+ }
+
+ /*
+ Do not check for disabled facility. Test result should not
+ unnecessarily differ from enabled facility.
+ */
+
+ /*
+ Facility requires SUPER privilege. Sync points could be inside
+ global mutexes (e.g. LOCK_open). Waiting there forever would
+ stall the whole server.
+ */
+ DBUG_RETURN(check_global_access(thd, SUPER_ACL));
+}
+
+
+/**
+ Set the system variable 'debug_sync'.
+
+ @param[in] thd thread handle
+ @param[in] var set variable request
+
+ @return status
+ @retval FALSE ok, variable is set
+ @retval TRUE error, variable could not be set
+
+ @note
+ "Setting" of the system variable 'debug_sync' does not mean to
+ assign a value to it as usual. Instead a debug sync action is parsed
+ from the input string and stored apart from the variable value.
+
+ @note
+ For efficiency reasons, the action string parser places '\0'
+ terminators in the string. So we need to take a copy here.
+*/
+
+bool sys_var_debug_sync::update(THD *thd, set_var *var)
+{
+ char *val_str;
+ String *val_ptr;
+ String val_buf;
+ DBUG_ENTER("sys_var_debug_sync::update");
+ DBUG_ASSERT(thd);
+
+ /*
+ Depending on the value type (string literal, user variable, ...)
+ val_buf receives a copy of the value or not. But we always need
+ a copy. So we take a copy, if it is not done by val_str().
+ If val_str() puts a copy into val_buf, then it returns &val_buf,
+ otherwise it returns a pointer to the string object that we need
+ to copy.
+ */
+ val_ptr= var ? var->value->val_str(&val_buf) : &val_buf;
+ if (val_ptr != &val_buf)
+ {
+ val_buf.copy(*val_ptr);
+ }
+ val_str= val_buf.c_ptr();
+ DBUG_PRINT("debug_sync", ("set action: '%s'", val_str));
+
+ /*
+ debug_sync_eval_action() places '\0' in the string, which itself
+ must be '\0' terminated.
+ */
+ DBUG_RETURN(opt_debug_sync_timeout ?
+ debug_sync_eval_action(thd, val_str) :
+ FALSE);
+}
+
+
+/**
+ Retrieve the value of the system variable 'debug_sync'.
+
+ @param[in] thd thread handle
+ @param[in] type variable type, unused
+ @param[in] base variable base, unused
+
+ @return string
+ @retval != NULL ok, string pointer
+ @retval NULL memory allocation error
+
+ @note
+ The value of the system variable 'debug_sync' reflects if
+ the facility is enabled ("ON") or disabled (default, "OFF").
+
+ When "ON", the current signal is added.
+*/
+
+uchar *sys_var_debug_sync::value_ptr(THD *thd,
+ enum_var_type type __attribute__((unused)),
+ LEX_STRING *base __attribute__((unused)))
+{
+ char *value;
+ DBUG_ENTER("sys_var_debug_sync::value_ptr");
+ DBUG_ASSERT(thd);
+
+ if (opt_debug_sync_timeout)
+ {
+ static char on[]= "ON - current signal: '";
+
+ // Ensure exclusive access to debug_sync_global.ds_signal
+ pthread_mutex_lock(&debug_sync_global.ds_mutex);
+
+ size_t lgt= (sizeof(on) /* includes '\0' */ +
+ debug_sync_global.ds_signal.length() + 1 /* for '\'' */);
+ char *vend;
+ char *vptr;
+
+ if ((value= (char*) alloc_root(thd->mem_root, lgt)))
+ {
+ vend= value + lgt - 1; /* reserve space for '\0'. */
+ vptr= debug_sync_bmove_len(value, vend, STRING_WITH_LEN(on));
+ vptr= debug_sync_bmove_len(vptr, vend, debug_sync_global.ds_signal.ptr(),
+ debug_sync_global.ds_signal.length());
+ if (vptr < vend)
+ *(vptr++)= '\'';
+ *vptr= '\0'; /* We have one byte reserved for the worst case. */
+ }
+ pthread_mutex_unlock(&debug_sync_global.ds_mutex);
+ }
+ else
+ {
+ /* purecov: begin tested */
+ value= strmake_root(thd->mem_root, STRING_WITH_LEN("OFF"));
+ /* purecov: end */
+ }
+
+ DBUG_RETURN((uchar*) value);
+}
+
+
+/**
+ Execute requested action at a synchronization point.
+
+ @param[in] thd thread handle
+ @param[in] action action to be executed
+
+ @note
+ This is to be called only if activation count > 0.
+*/
+
+static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
+{
+ IF_DBUG(const char *dsp_name= action->sync_point.c_ptr());
+ IF_DBUG(const char *sig_emit= action->signal.c_ptr());
+ IF_DBUG(const char *sig_wait= action->wait_for.c_ptr());
+ DBUG_ENTER("debug_sync_execute");
+ DBUG_ASSERT(thd);
+ DBUG_ASSERT(action);
+ DBUG_PRINT("debug_sync",
+ ("sync_point: '%s' activation_count: %lu hit_limit: %lu "
+ "execute: %lu timeout: %lu signal: '%s' wait_for: '%s'",
+ dsp_name, action->activation_count, action->hit_limit,
+ action->execute, action->timeout, sig_emit, sig_wait));
+
+ DBUG_ASSERT(action->activation_count);
+ action->activation_count--;
+
+ if (action->execute)
+ {
+ const char *old_proc_info;
+
+ action->execute--;
+
+ /*
+ If we will be going to wait, set proc_info for the PROCESSLIST table.
+ Do this before emitting the signal, so other threads can see it
+ if they awake before we enter_cond() below.
+ */
+ if (action->wait_for.length())
+ {
+ st_debug_sync_control *ds_control= thd->debug_sync_control;
+ strxnmov(ds_control->ds_proc_info, sizeof(ds_control->ds_proc_info)-1,
+ "debug sync point: ", action->sync_point.c_ptr(), NullS);
+ old_proc_info= thd->proc_info;
+ thd_proc_info(thd, ds_control->ds_proc_info);
+ }
+
+ /*
+ Take mutex to ensure that only one thread access
+ debug_sync_global.ds_signal at a time. Need to take mutex for
+ read access too, to create a memory barrier in order to avoid that
+ threads just reads an old cached version of the signal.
+ */
+ pthread_mutex_lock(&debug_sync_global.ds_mutex);
+
+ if (action->signal.length())
+ {
+ /* Copy the signal to the global variable. */
+ if (debug_sync_global.ds_signal.copy(action->signal))
+ {
+ /*
+ Error is reported by my_malloc().
+ We must disable the facility. We have no way to return an error.
+ */
+ debug_sync_emergency_disable(); /* purecov: tested */
+ }
+ /* Wake threads waiting in a sync point. */
+ pthread_cond_broadcast(&debug_sync_global.ds_cond);
+ DBUG_PRINT("debug_sync_exec", ("signal '%s' at: '%s'",
+ sig_emit, dsp_name));
+ } /* end if (action->signal.length()) */
+
+ if (action->wait_for.length())
+ {
+ pthread_mutex_t *old_mutex;
+ pthread_cond_t *old_cond;
+ int error= 0;
+ struct timespec abstime;
+
+ /*
+ We don't use enter_cond()/exit_cond(). They do not save old
+ mutex and cond. This would prohibit the use of DEBUG_SYNC
+ between other places of enter_cond() and exit_cond().
+ */
+ old_mutex= thd->mysys_var->current_mutex;
+ old_cond= thd->mysys_var->current_cond;
+ thd->mysys_var->current_mutex= &debug_sync_global.ds_mutex;
+ thd->mysys_var->current_cond= &debug_sync_global.ds_cond;
+
+ set_timespec(abstime, action->timeout);
+ DBUG_EXECUTE("debug_sync_exec", {
+ /* Functions as DBUG_PRINT args can change keyword and line nr. */
+ const char *sig_glob= debug_sync_global.ds_signal.c_ptr();
+ DBUG_PRINT("debug_sync_exec",
+ ("wait for '%s' at: '%s' curr: '%s'",
+ sig_wait, dsp_name, sig_glob));});
+
+ /*
+ Wait until global signal string matches the wait_for string.
+ Interrupt when thread or query is killed or facility disabled.
+ The facility can become disabled when some thread cannot get
+ the required dynamic memory allocated.
+ */
+ while (stringcmp(&debug_sync_global.ds_signal, &action->wait_for) &&
+ !thd->killed && opt_debug_sync_timeout)
+ {
+ error= pthread_cond_timedwait(&debug_sync_global.ds_cond,
+ &debug_sync_global.ds_mutex,
+ &abstime);
+ DBUG_EXECUTE("debug_sync", {
+ /* Functions as DBUG_PRINT args can change keyword and line nr. */
+ const char *sig_glob= debug_sync_global.ds_signal.c_ptr();
+ DBUG_PRINT("debug_sync",
+ ("awoke from %s global: %s error: %d",
+ sig_wait, sig_glob, error));});
+ if (error == ETIMEDOUT || error == ETIME)
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_DEBUG_SYNC_TIMEOUT, ER(ER_DEBUG_SYNC_TIMEOUT));
+ break;
+ }
+ error= 0;
+ }
+ DBUG_EXECUTE("debug_sync_exec",
+ if (thd->killed)
+ DBUG_PRINT("debug_sync_exec",
+ ("killed %d from '%s' at: '%s'",
+ thd->killed, sig_wait, dsp_name));
+ else
+ DBUG_PRINT("debug_sync_exec",
+ ("%s from '%s' at: '%s'",
+ error ? "timeout" : "resume",
+ sig_wait, dsp_name)););
+
+ /*
+ We don't use enter_cond()/exit_cond(). They do not save old
+ mutex and cond. This would prohibit the use of DEBUG_SYNC
+ between other places of enter_cond() and exit_cond(). The
+ protected mutex must always unlocked _before_ mysys_var->mutex
+ is locked. (See comment in THD::exit_cond().)
+ */
+ pthread_mutex_unlock(&debug_sync_global.ds_mutex);
+ pthread_mutex_lock(&thd->mysys_var->mutex);
+ thd->mysys_var->current_mutex= old_mutex;
+ thd->mysys_var->current_cond= old_cond;
+ thd_proc_info(thd, old_proc_info);
+ pthread_mutex_unlock(&thd->mysys_var->mutex);
+
+ }
+ else
+ {
+ /* In case we don't wait, we just release the mutex. */
+ pthread_mutex_unlock(&debug_sync_global.ds_mutex);
+ } /* end if (action->wait_for.length()) */
+
+ } /* end if (action->execute) */
+
+ /* hit_limit is zero for infinite. Don't decrement unconditionally. */
+ if (action->hit_limit)
+ {
+ if (!--action->hit_limit)
+ {
+ thd->killed= THD::KILL_QUERY;
+ my_error(ER_DEBUG_SYNC_HIT_LIMIT, MYF(0));
+ }
+ DBUG_PRINT("debug_sync_exec", ("hit_limit: %lu at: '%s'",
+ action->hit_limit, dsp_name));
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Execute requested action at a synchronization point.
+
+ @param[in] thd thread handle
+ @param[in] sync_point_name name of synchronization point
+ @param[in] name_len length of sync point name
+*/
+
+void debug_sync(THD *thd, const char *sync_point_name, size_t name_len)
+{
+ st_debug_sync_control *ds_control= thd->debug_sync_control;
+ st_debug_sync_action *action;
+ DBUG_ENTER("debug_sync");
+ DBUG_ASSERT(thd);
+ DBUG_ASSERT(sync_point_name);
+ DBUG_ASSERT(name_len);
+ DBUG_ASSERT(ds_control);
+ DBUG_PRINT("debug_sync_point", ("hit: '%s'", sync_point_name));
+
+ /* Statistics. */
+ ds_control->dsp_hits++;
+
+ if (ds_control->ds_active &&
+ (action= debug_sync_find(ds_control->ds_action, ds_control->ds_active,
+ sync_point_name, name_len)) &&
+ action->activation_count)
+ {
+ /* Sync point is active (action exists). */
+ debug_sync_execute(thd, action);
+
+ /* Statistics. */
+ ds_control->dsp_executed++;
+
+ /* If action became inactive, remove it to shrink the search array. */
+ if (!action->activation_count)
+ debug_sync_remove_action(ds_control, action);
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+#endif /* defined(ENABLED_DEBUG_SYNC) */
=== added file 'sql/debug_sync.h'
--- a/sql/debug_sync.h 1970-01-01 00:00:00 +0000
+++ b/sql/debug_sync.h 2009-09-29 15:38:40 +0000
@@ -0,0 +1,60 @@
+#ifndef DEBUG_SYNC_INCLUDED
+#define DEBUG_SYNC_INCLUDED
+
+/* Copyright (C) 2008 Sun Microsystems, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/**
+ @file
+
+ Declarations for the Debug Sync Facility. See debug_sync.cc for details.
+*/
+
+#ifdef USE_PRAGMA_INTERFACE
+#pragma interface /* gcc class implementation */
+#endif
+
+#include <my_global.h>
+
+class THD;
+
+#if defined(ENABLED_DEBUG_SYNC)
+
+/* Macro to be put in the code at synchronization points. */
+#define DEBUG_SYNC(_thd_, _sync_point_name_) \
+ do { if (unlikely(opt_debug_sync_timeout)) \
+ debug_sync(_thd_, STRING_WITH_LEN(_sync_point_name_)); \
+ } while (0)
+
+/* Command line option --debug-sync-timeout. See mysqld.cc. */
+extern uint opt_debug_sync_timeout;
+
+/* Default WAIT_FOR timeout if command line option is given without argument. */
+#define DEBUG_SYNC_DEFAULT_WAIT_TIMEOUT 300
+
+/* Debug Sync prototypes. See debug_sync.cc. */
+extern int debug_sync_init(void);
+extern void debug_sync_end(void);
+extern void debug_sync_init_thread(THD *thd);
+extern void debug_sync_end_thread(THD *thd);
+extern void debug_sync(THD *thd, const char *sync_point_name, size_t name_len);
+
+#else /* defined(ENABLED_DEBUG_SYNC) */
+
+#define DEBUG_SYNC(_thd_, _sync_point_name_) /* disabled DEBUG_SYNC */
+
+#endif /* defined(ENABLED_DEBUG_SYNC) */
+
+#endif /* DEBUG_SYNC_INCLUDED */
=== modified file 'sql/event_data_objects.cc'
--- a/sql/event_data_objects.cc 2009-09-15 10:46:35 +0000
+++ b/sql/event_data_objects.cc 2009-11-16 20:49:51 +0000
@@ -1432,7 +1432,7 @@ Event_job_data::execute(THD *thd, bool d
thd->set_query(sp_sql.c_ptr_safe(), sp_sql.length());
{
- Parser_state parser_state(thd, thd->query, thd->query_length);
+ Parser_state parser_state(thd, thd->query(), thd->query_length());
lex_start(thd);
if (parse_sql(thd, & parser_state, creation_ctx))
=== modified file 'sql/events.cc'
--- a/sql/events.cc 2009-10-15 21:38:29 +0000
+++ b/sql/events.cc 2009-11-16 20:49:51 +0000
@@ -464,7 +464,7 @@ Events::create_event(THD *thd, Event_par
if (!dropped)
{
/* Binlog the create event. */
- DBUG_ASSERT(thd->query && thd->query_length);
+ DBUG_ASSERT(thd->query() && thd->query_length());
String log_query;
if (create_query_string(thd, &log_query))
{
@@ -594,8 +594,8 @@ Events::update_event(THD *thd, Event_par
event_queue->update_event(thd, parse_data->dbname, parse_data->name,
new_element);
/* Binlog the alter event. */
- DBUG_ASSERT(thd->query && thd->query_length);
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ DBUG_ASSERT(thd->query() && thd->query_length());
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
}
pthread_mutex_unlock(&LOCK_event_metadata);
@@ -669,8 +669,8 @@ Events::drop_event(THD *thd, LEX_STRING
if (event_queue)
event_queue->drop_event(thd, dbname, name);
/* Binlog the drop event. */
- DBUG_ASSERT(thd->query && thd->query_length);
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ DBUG_ASSERT(thd->query() && thd->query_length());
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
pthread_mutex_unlock(&LOCK_event_metadata);
DBUG_RETURN(ret);
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2009-10-15 21:38:29 +0000
+++ b/sql/field.cc 2009-11-16 20:49:51 +0000
@@ -1,4 +1,4 @@
-/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2481,97 +2481,12 @@ Field_new_decimal::Field_new_decimal(uin
{
precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg);
set_if_smaller(precision, DECIMAL_MAX_PRECISION);
- DBUG_ASSERT(precision >= dec);
DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) &&
(dec <= DECIMAL_MAX_SCALE));
bin_size= my_decimal_get_binary_size(precision, dec);
}
-/**
- Create a field to hold a decimal value from an item.
-
- @remark The MySQL DECIMAL data type has a characteristic that needs to be
- taken into account when deducing the type from a Item_decimal.
-
- But first, let's briefly recap what is the new MySQL DECIMAL type:
-
- The declaration syntax for a decimal is DECIMAL(M,D), where:
-
- * M is the maximum number of digits (the precision).
- It has a range of 1 to 65.
- * D is the number of digits to the right of the decimal separator (the scale).
- It has a range of 0 to 30 and must be no larger than M.
-
- D and M are used to determine the storage requirements for the integer
- and fractional parts of each value. The integer part is to the left of
- the decimal separator and to the right is the fractional part. Hence:
-
- M is the number of digits for the integer and fractional part.
- D is the number of digits for the fractional part.
-
- Consequently, M - D is the number of digits for the integer part. For
- example, a DECIMAL(20,10) column has ten digits on either side of
- the decimal separator.
-
- The characteristic that needs to be taken into account is that the
- backing type for Item_decimal is a my_decimal that has a higher
- precision (DECIMAL_MAX_POSSIBLE_PRECISION, see my_decimal.h) than
- DECIMAL.
-
- Drawing a comparison between my_decimal and DECIMAL:
-
- * M has a range of 1 to 81.
- * D has a range of 0 to 81.
-
- There can be a difference in range if the decimal contains a integer
- part. This is because the fractional part must always be on a group
- boundary, leaving at least one group for the integer part. Since each
- group is 9 (DIG_PER_DEC1) digits and there are 9 (DECIMAL_BUFF_LENGTH)
- groups, the fractional part is limited to 72 digits if there is at
- least one digit in the integral part.
-
- Although the backing type for a DECIMAL is also my_decimal, every
- time a my_decimal is stored in a DECIMAL field, the precision and
- scale are explicitly capped at 65 (DECIMAL_MAX_PRECISION) and 30
- (DECIMAL_MAX_SCALE) digits, following my_decimal truncation procedure
- (FIX_INTG_FRAC_ERROR).
-*/
-
-Field_new_decimal *
-Field_new_decimal::new_decimal_field(const Item *item)
-{
- uint32 len;
- uint intg= item->decimal_int_part(), scale= item->decimals;
-
- DBUG_ASSERT(item->decimal_precision() >= item->decimals);
-
- /*
- Employ a procedure along the lines of the my_decimal truncation process:
- - If the integer part is equal to or bigger than the maximum precision:
- Truncate integer part to fit and the fractional becomes zero.
- - Otherwise:
- Truncate fractional part to fit.
- */
- if (intg >= DECIMAL_MAX_PRECISION)
- {
- intg= DECIMAL_MAX_PRECISION;
- scale= 0;
- }
- else
- {
- uint room= min(DECIMAL_MAX_PRECISION - intg, DECIMAL_MAX_SCALE);
- if (scale > room)
- scale= room;
- }
-
- len= my_decimal_precision_to_length(intg + scale, scale, item->unsigned_flag);
-
- return new Field_new_decimal(len, item->maybe_null, item->name, scale,
- item->unsigned_flag);
-}
-
-
int Field_new_decimal::reset(void)
{
store_value(&decimal_zero);
@@ -6555,20 +6470,9 @@ uint Field::is_equal(Create_field *new_f
}
-/* If one of the fields is binary and the other one isn't return 1 else 0 */
-
-bool Field_str::compare_str_field_flags(Create_field *new_field, uint32 flag_arg)
-{
- return (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
- !(flag_arg & (BINCMP_FLAG | BINARY_FLAG))) ||
- (!(new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
- (flag_arg & (BINCMP_FLAG | BINARY_FLAG))));
-}
-
-
uint Field_str::is_equal(Create_field *new_field)
{
- if (compare_str_field_flags(new_field, flags))
+ if (field_flags_are_binary() != new_field->field_flags_are_binary())
return 0;
return ((new_field->sql_type == real_type()) &&
@@ -8334,7 +8238,7 @@ uint Field_blob::max_packed_col_length(u
uint Field_blob::is_equal(Create_field *new_field)
{
- if (compare_str_field_flags(new_field, flags))
+ if (field_flags_are_binary() != new_field->field_flags_are_binary())
return 0;
return ((new_field->sql_type == get_blob_type_from_length(max_data_length()))
@@ -8838,38 +8742,81 @@ bool Field::eq_def(Field *field)
/**
+ Compare the first t1::count type names.
+
+ @return TRUE if the type names of t1 match those of t2. FALSE otherwise.
+*/
+
+static bool compare_type_names(CHARSET_INFO *charset, TYPELIB *t1, TYPELIB *t2)
+{
+ for (uint i= 0; i < t1->count; i++)
+ if (my_strnncoll(charset,
+ (const uchar*) t1->type_names[i],
+ t1->type_lengths[i],
+ (const uchar*) t2->type_names[i],
+ t2->type_lengths[i]))
+ return FALSE;
+ return TRUE;
+}
+
+/**
@return
returns 1 if the fields are equally defined
*/
bool Field_enum::eq_def(Field *field)
{
+ TYPELIB *values;
+
if (!Field::eq_def(field))
- return 0;
- return compare_enum_values(((Field_enum*) field)->typelib);
-}
+ return FALSE;
+ values= ((Field_enum*) field)->typelib;
-bool Field_enum::compare_enum_values(TYPELIB *values)
-{
+ /* Definition must be strictly equal. */
if (typelib->count != values->count)
return FALSE;
- for (uint i= 0; i < typelib->count; i++)
- if (my_strnncoll(field_charset,
- (const uchar*) typelib->type_names[i],
- typelib->type_lengths[i],
- (const uchar*) values->type_names[i],
- values->type_lengths[i]))
- return FALSE;
- return TRUE;
+
+ return compare_type_names(field_charset, typelib, values);
}
+/**
+ Check whether two fields can be considered 'equal' for table
+ alteration purposes. Fields are equal if they retain the same
+ pack length and if new members are added to the end of the list.
+
+ @return IS_EQUAL_YES if fields are compatible.
+ IS_EQUAL_NO otherwise.
+*/
+
uint Field_enum::is_equal(Create_field *new_field)
{
- if (!Field_str::is_equal(new_field))
- return 0;
- return compare_enum_values(new_field->interval);
+ TYPELIB *values= new_field->interval;
+
+ /*
+ The fields are compatible if they have the same flags,
+ type, charset and have the same underlying length.
+ */
+ if (new_field->field_flags_are_binary() != field_flags_are_binary() ||
+ new_field->sql_type != real_type() ||
+ new_field->charset != field_charset ||
+ new_field->pack_length != pack_length())
+ return IS_EQUAL_NO;
+
+ /*
+ Changing the definition of an ENUM or SET column by adding a new
+ enumeration or set members to the end of the list of valid member
+ values only alters table metadata and not table data.
+ */
+ if (typelib->count > values->count)
+ return IS_EQUAL_NO;
+
+ /* Check whether there are modification before the end. */
+ if (! compare_type_names(field_charset, typelib, new_field->interval))
+ return IS_EQUAL_NO;
+
+ return IS_EQUAL_YES;
}
@@ -9622,7 +9569,7 @@ bool Create_field::init(THD *thd, char *
}
if (length == 0)
- fld_length= 0; /* purecov: inspected */
+ fld_length= NULL; /* purecov: inspected */
}
sign_len= fld_type_modifier & UNSIGNED_FLAG ? 0 : 1;
@@ -9774,8 +9721,7 @@ bool Create_field::init(THD *thd, char *
case MYSQL_TYPE_TIMESTAMP:
if (fld_length == NULL)
{
- /* Compressed date YYYYMMDDHHMMSS */
- length= MAX_DATETIME_COMPRESSED_WIDTH;
+ length= MAX_DATETIME_WIDTH;
}
else if (length != MAX_DATETIME_WIDTH)
{
@@ -9839,7 +9785,7 @@ bool Create_field::init(THD *thd, char *
sql_type= MYSQL_TYPE_NEWDATE;
/* fall trough */
case MYSQL_TYPE_NEWDATE:
- length= 10;
+ length= MAX_DATE_WIDTH;
break;
case MYSQL_TYPE_TIME:
length= 10;
@@ -9920,6 +9866,17 @@ bool Create_field::init(THD *thd, char *
DBUG_RETURN(TRUE);
}
+ switch (fld_type) {
+ case MYSQL_TYPE_DATE:
+ case MYSQL_TYPE_NEWDATE:
+ case MYSQL_TYPE_TIME:
+ case MYSQL_TYPE_DATETIME:
+ case MYSQL_TYPE_TIMESTAMP:
+ charset= &my_charset_bin;
+ flags|= BINCMP_FLAG;
+ default: break;
+ }
+
DBUG_RETURN(FALSE); /* success */
}
=== modified file 'sql/field.h'
--- a/sql/field.h 2009-10-15 21:38:29 +0000
+++ b/sql/field.h 2009-11-16 20:49:51 +0000
@@ -1,4 +1,4 @@
-/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+/* Copyright 2000-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -472,6 +472,13 @@ public:
/* maximum possible display length */
virtual uint32 max_display_length()= 0;
+ /**
+ Whether a field being created is compatible with a existing one.
+
+ Used by the ALTER TABLE code to evaluate whether the new definition
+ of a table is compatible with the old definition so that it can
+ determine if data needs to be copied over (table data change).
+ */
virtual uint is_equal(Create_field *new_field);
/* convert decimal to longlong with overflow check */
longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
@@ -603,15 +610,17 @@ protected:
handle_int64(to, from, low_byte_first_from, table->s->db_low_byte_first);
return from + sizeof(int64);
}
+
+ bool field_flags_are_binary()
+ {
+ return (flags & (BINCMP_FLAG | BINARY_FLAG)) != 0;
+ }
+
};
class Field_num :public Field {
public:
- /**
- The scale of the Field's value, i.e. the number of digits to the right
- of the decimal point.
- */
const uint8 dec;
bool zerofill,unsigned_flag; // Purify cannot handle bit fields
Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
@@ -662,7 +671,6 @@ public:
friend class Create_field;
my_decimal *val_decimal(my_decimal *);
virtual bool str_needs_quotes() { return TRUE; }
- bool compare_str_field_flags(Create_field *new_field, uint32 flags);
uint is_equal(Create_field *new_field);
};
@@ -770,11 +778,6 @@ public:
Field_new_decimal(uint32 len_arg, bool maybe_null_arg,
const char *field_name_arg, uint8 dec_arg,
bool unsigned_arg);
- /*
- Create a field to hold a decimal value from an item.
- Truncates the precision and/or scale if necessary.
- */
- static Field_new_decimal *new_decimal_field(const Item *item);
enum_field_types type() const { return MYSQL_TYPE_NEWDECIMAL;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
Item_result result_type () const { return DECIMAL_RESULT; }
@@ -1277,12 +1280,12 @@ public:
Field_date(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
+ :Field_str(ptr_arg, MAX_DATE_WIDTH, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, cs)
{}
Field_date(bool maybe_null_arg, const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_str((uchar*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
+ :Field_str((uchar*) 0, MAX_DATE_WIDTH, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, cs) {}
enum_field_types type() const { return MYSQL_TYPE_DATE;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
@@ -1392,12 +1395,12 @@ public:
Field_datetime(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg,
+ :Field_str(ptr_arg, MAX_DATETIME_WIDTH, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, cs)
{}
Field_datetime(bool maybe_null_arg, const char *field_name_arg,
CHARSET_INFO *cs)
- :Field_str((uchar*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
+ :Field_str((uchar*) 0, MAX_DATETIME_WIDTH, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, cs) {}
enum_field_types type() const { return MYSQL_TYPE_DATETIME;}
#ifdef HAVE_LONG_LONG
@@ -1862,7 +1865,6 @@ public:
CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
private:
int do_save_field_metadata(uchar *first_byte);
- bool compare_enum_values(TYPELIB *values);
uint is_equal(Create_field *new_field);
};
@@ -2070,6 +2072,11 @@ public:
Item *on_update_value, LEX_STRING *comment, char *change,
List<String> *interval_list, CHARSET_INFO *cs,
uint uint_geom_type);
+
+ bool field_flags_are_binary()
+ {
+ return (flags & (BINCMP_FLAG | BINARY_FLAG)) != 0;
+ }
};
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2009-09-07 20:50:10 +0000
+++ b/sql/ha_ndbcluster.cc 2009-11-16 20:49:51 +0000
@@ -5527,7 +5527,7 @@ int ha_ndbcluster::create(const char *na
if (share && !do_event_op)
share->flags|= NSF_NO_BINLOG;
ndbcluster_log_schema_op(thd, share,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
share->db, share->table_name,
m_table->getObjectId(),
m_table->getObjectVersion(),
@@ -5969,7 +5969,8 @@ int ha_ndbcluster::rename_table(const ch
*/
if (!is_old_table_tmpfile)
ndbcluster_log_schema_op(current_thd, share,
- current_thd->query, current_thd->query_length,
+ current_thd->query(),
+ current_thd->query_length(),
old_dbname, m_tabname,
ndb_table_id, ndb_table_version,
SOT_RENAME_TABLE,
@@ -6164,7 +6165,7 @@ retry_temporary_error1:
current_thd->lex->sql_command != SQLCOM_TRUNCATE)
{
ndbcluster_log_schema_op(thd, share,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
share->db, share->table_name,
ndb_table_id, ndb_table_version,
SOT_DROP_TABLE, 0, 0, 1);
@@ -6887,7 +6888,7 @@ static void ndbcluster_drop_database(han
THD *thd= current_thd;
ha_ndbcluster::set_dbname(path, db);
ndbcluster_log_schema_op(thd, 0,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
db, "", 0, 0, SOT_DROP_DB, 0, 0, 0);
#endif
DBUG_VOID_RETURN;
@@ -9429,9 +9430,11 @@ ndb_util_thread_fail:
pthread_cond_signal(&COND_ndb_util_ready);
pthread_mutex_unlock(&LOCK_ndb_util_thread);
DBUG_PRINT("exit", ("ndb_util_thread"));
+
+ DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
pthread_exit(0);
- DBUG_RETURN(NULL);
+ return NULL; // Avoid compiler warnings
}
/*
@@ -10254,13 +10257,13 @@ int ndbcluster_alter_tablespace(handlert
#ifdef HAVE_NDB_BINLOG
if (is_tablespace)
ndbcluster_log_schema_op(thd, 0,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
"", alter_info->tablespace_name,
0, 0,
SOT_TABLESPACE, 0, 0, 0);
else
ndbcluster_log_schema_op(thd, 0,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
"", alter_info->logfile_group_name,
0, 0,
SOT_LOGFILE_GROUP, 0, 0, 0);
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2009-09-07 20:50:10 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2009-11-16 20:49:51 +0000
@@ -241,8 +241,8 @@ static void dbug_print_table(const char
static void run_query(THD *thd, char *buf, char *end,
const int *no_print_error, my_bool disable_binlog)
{
- ulong save_thd_query_length= thd->query_length;
- char *save_thd_query= thd->query;
+ ulong save_thd_query_length= thd->query_length();
+ char *save_thd_query= thd->query();
ulong save_thread_id= thd->variables.pseudo_thread_id;
struct system_status_var save_thd_status_var= thd->status_var;
THD_TRANS save_thd_transaction_all= thd->transaction.all;
@@ -259,12 +259,12 @@ static void run_query(THD *thd, char *bu
if (disable_binlog)
thd->options&= ~OPTION_BIN_LOG;
- DBUG_PRINT("query", ("%s", thd->query));
+ DBUG_PRINT("query", ("%s", thd->query()));
DBUG_ASSERT(!thd->in_sub_stmt);
DBUG_ASSERT(!thd->prelocked_mode);
- mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
+ mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon);
if (no_print_error && thd->is_slave_error)
{
@@ -3665,9 +3665,11 @@ pthread_handler_t ndb_binlog_thread_func
ndb_binlog_thread_running= -1;
pthread_mutex_unlock(&injector_mutex);
pthread_cond_signal(&injector_cond);
+
+ DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
pthread_exit(0);
- DBUG_RETURN(NULL);
+ return NULL; // Avoid compiler warnings
}
lex_start(thd);
@@ -4378,10 +4380,11 @@ err:
(void) pthread_cond_signal(&injector_cond);
DBUG_PRINT("exit", ("ndb_binlog_thread"));
- my_thread_end();
+ DBUG_LEAVE; // Must match DBUG_ENTER()
+ my_thread_end();
pthread_exit(0);
- DBUG_RETURN(NULL);
+ return NULL; // Avoid compiler warnings
}
bool
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2009-11-06 17:22:32 +0000
+++ b/sql/ha_partition.cc 2009-11-16 20:49:51 +0000
@@ -239,6 +239,7 @@ void ha_partition::init_handler_variable
m_curr_key_info[0]= NULL;
m_curr_key_info[1]= NULL;
is_clone= FALSE,
+ m_part_func_monotonicity_info= NON_MONOTONIC;
auto_increment_lock= FALSE;
auto_increment_safe_stmt_log_lock= FALSE;
/*
@@ -705,6 +706,7 @@ int ha_partition::rename_partitions(cons
if (m_is_sub_partitioned)
{
List_iterator<partition_element> sub_it(part_elem->subpartitions);
+ j= 0;
do
{
sub_elem= sub_it++;
@@ -1278,10 +1280,10 @@ void ha_partition::cleanup_new_partition
m_file= m_added_file;
m_added_file= NULL;
+ external_lock(ha_thd(), F_UNLCK);
/* delete_table also needed, a bit more complex */
close();
- m_added_file= m_file;
m_file= save_m_file;
}
DBUG_VOID_RETURN;
@@ -2464,11 +2466,18 @@ int ha_partition::open(const char *name,
}
}
+ /* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
+ if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
+ DBUG_RETURN(1);
+ bitmap_clear_all(&m_bulk_insert_started);
/* Initialize the bitmap we use to determine what partitions are used */
if (!is_clone)
{
if (bitmap_init(&(m_part_info->used_partitions), NULL, m_tot_parts, TRUE))
+ {
+ bitmap_free(&m_bulk_insert_started);
DBUG_RETURN(1);
+ }
bitmap_set_all(&(m_part_info->used_partitions));
}
@@ -2552,12 +2561,18 @@ int ha_partition::open(const char *name,
calling open on all individual handlers.
*/
m_handler_status= handler_opened;
+ if (m_part_info->part_expr)
+ m_part_func_monotonicity_info=
+ m_part_info->part_expr->get_monotonicity_info();
+ else if (m_part_info->list_of_part_fields)
+ m_part_func_monotonicity_info= MONOTONIC_STRICT_INCREASING;
info(HA_STATUS_VARIABLE | HA_STATUS_CONST);
DBUG_RETURN(0);
err_handler:
while (file-- != m_file)
(*file)->close();
+ bitmap_free(&m_bulk_insert_started);
if (!is_clone)
bitmap_free(&(m_part_info->used_partitions));
@@ -2605,6 +2620,7 @@ int ha_partition::close(void)
DBUG_ASSERT(table->s == table_share);
delete_queue(&m_queue);
+ bitmap_free(&m_bulk_insert_started);
if (!is_clone)
bitmap_free(&(m_part_info->used_partitions));
file= m_file;
@@ -3021,10 +3037,12 @@ int ha_partition::write_row(uchar * buf)
}
m_last_part= part_id;
DBUG_PRINT("info", ("Insert in partition %d", part_id));
+ start_part_bulk_insert(thd, part_id);
+
tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */
error= m_file[part_id]->ha_write_row(buf);
if (have_auto_increment && !table->s->next_number_keypart)
- set_auto_increment_if_higher(table->next_number_field->val_int());
+ set_auto_increment_if_higher(table->next_number_field);
reenable_binlog(thd);
exit:
table->timestamp_field_type= orig_timestamp_type;
@@ -3083,6 +3101,7 @@ int ha_partition::update_row(const uchar
}
m_last_part= new_part_id;
+ start_part_bulk_insert(thd, new_part_id);
if (new_part_id == old_part_id)
{
DBUG_PRINT("info", ("Update in partition %d", new_part_id));
@@ -3128,7 +3147,7 @@ exit:
HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
if (!ha_data->auto_inc_initialized)
info(HA_STATUS_AUTO);
- set_auto_increment_if_higher(table->found_next_number_field->val_int());
+ set_auto_increment_if_higher(table->found_next_number_field);
}
table->timestamp_field_type= orig_timestamp_type;
DBUG_RETURN(error);
@@ -3247,23 +3266,112 @@ int ha_partition::delete_all_rows()
DESCRIPTION
rows == 0 means we will probably insert many rows
*/
-
void ha_partition::start_bulk_insert(ha_rows rows)
{
- handler **file;
DBUG_ENTER("ha_partition::start_bulk_insert");
- rows= rows ? rows/m_tot_parts + 1 : 0;
- file= m_file;
- do
- {
- (*file)->ha_start_bulk_insert(rows);
- } while (*(++file));
+ m_bulk_inserted_rows= 0;
+ bitmap_clear_all(&m_bulk_insert_started);
+ /* use the last bit for marking if bulk_insert_started was called */
+ bitmap_set_bit(&m_bulk_insert_started, m_tot_parts);
DBUG_VOID_RETURN;
}
/*
+ Check if start_bulk_insert has been called for this partition,
+ if not, call it and mark it called
+*/
+void ha_partition::start_part_bulk_insert(THD *thd, uint part_id)
+{
+ long old_buffer_size;
+ if (!bitmap_is_set(&m_bulk_insert_started, part_id) &&
+ bitmap_is_set(&m_bulk_insert_started, m_tot_parts))
+ {
+ old_buffer_size= thd->variables.read_buff_size;
+ /* Update read_buffer_size for this partition */
+ thd->variables.read_buff_size= estimate_read_buffer_size(old_buffer_size);
+ m_file[part_id]->ha_start_bulk_insert(guess_bulk_insert_rows());
+ bitmap_set_bit(&m_bulk_insert_started, part_id);
+ thd->variables.read_buff_size= old_buffer_size;
+ }
+ m_bulk_inserted_rows++;
+}
+
+/*
+ Estimate the read buffer size for each partition.
+ SYNOPSIS
+ ha_partition::estimate_read_buffer_size()
+ original_size read buffer size originally set for the server
+ RETURN VALUE
+ estimated buffer size.
+ DESCRIPTION
+ If the estimated number of rows to insert is less than 10 (but not 0)
+ the new buffer size is same as original buffer size.
+ In case of first partition of when partition function is monotonic
+ new buffer size is same as the original buffer size.
+ For rest of the partition total buffer of 10*original_size is divided
+ equally if number of partition is more than 10 other wise each partition
+ will be allowed to use original buffer size.
+*/
+long ha_partition::estimate_read_buffer_size(long original_size)
+{
+ /*
+ If number of rows to insert is less than 10, but not 0,
+ return original buffer size.
+ */
+ if (estimation_rows_to_insert && (estimation_rows_to_insert < 10))
+ return (original_size);
+ /*
+ If first insert/partition and monotonic partition function,
+ allow using buffer size originally set.
+ */
+ if (!m_bulk_inserted_rows &&
+ m_part_func_monotonicity_info != NON_MONOTONIC &&
+ m_tot_parts > 1)
+ return original_size;
+ /*
+ Allow total buffer used in all partition to go up to 10*read_buffer_size.
+ 11*read_buffer_size in case of monotonic partition function.
+ */
+
+ if (m_tot_parts < 10)
+ return original_size;
+ return (original_size * 10 / m_tot_parts);
+}
+
+/*
+ Try to predict the number of inserts into this partition.
+
+ If less than 10 rows (including 0 which means Unknown)
+ just give that as a guess
+ If monotonic partitioning function was used
+ guess that 50 % of the inserts goes to the first partition
+ For all other cases, guess on equal distribution between the partitions
+*/
+ha_rows ha_partition::guess_bulk_insert_rows()
+{
+ DBUG_ENTER("guess_bulk_insert_rows");
+
+ if (estimation_rows_to_insert < 10)
+ DBUG_RETURN(estimation_rows_to_insert);
+
+ /* If first insert/partition and monotonic partition function, guess 50%. */
+ if (!m_bulk_inserted_rows &&
+ m_part_func_monotonicity_info != NON_MONOTONIC &&
+ m_tot_parts > 1)
+ DBUG_RETURN(estimation_rows_to_insert / 2);
+
+ /* Else guess on equal distribution (+1 is to avoid returning 0/Unknown) */
+ if (m_bulk_inserted_rows < estimation_rows_to_insert)
+ DBUG_RETURN(((estimation_rows_to_insert - m_bulk_inserted_rows)
+ / m_tot_parts) + 1);
+ /* The estimation was wrong, must say 'Unknown' */
+ DBUG_RETURN(0);
+}
+
+
+/*
Finish a large batch of insert rows
SYNOPSIS
@@ -3273,21 +3381,29 @@ void ha_partition::start_bulk_insert(ha_
RETURN VALUE
>0 Error code
0 Success
+
+ Note: end_bulk_insert can be called without start_bulk_insert
+ being called, see bug¤44108.
+
*/
int ha_partition::end_bulk_insert(bool abort)
{
int error= 0;
- handler **file;
+ uint i;
DBUG_ENTER("ha_partition::end_bulk_insert");
- file= m_file;
- do
+ if (!bitmap_is_set(&m_bulk_insert_started, m_tot_parts))
+ DBUG_RETURN(error);
+
+ for (i= 0; i < m_tot_parts; i++)
{
int tmp;
- if ((tmp= (*file)->ha_end_bulk_insert(abort)))
+ if (bitmap_is_set(&m_bulk_insert_started, i) &&
+ (tmp= m_file[i]->ha_end_bulk_insert(abort)))
error= tmp;
- } while (*(++file));
+ }
+ bitmap_clear_all(&m_bulk_insert_started);
DBUG_RETURN(error);
}
@@ -4896,8 +5012,9 @@ int ha_partition::info(uint flag)
If the handler doesn't support statistics, it should set all of the
above to 0.
- We will allow the first handler to set the rec_per_key and use
- this as an estimate on the total table.
+ We first scans through all partitions to get the one holding most rows.
+ We will then allow the handler with the most rows to set
+ the rec_per_key and use this as an estimate on the total table.
max_data_file_length: Maximum data file length
We ignore it, is only used in
@@ -4909,14 +5026,33 @@ int ha_partition::info(uint flag)
ref_length: We set this to the value calculated
and stored in local object
create_time: Creation time of table
- Set by first handler
- So we calculate these constants by using the variables on the first
- handler.
+ So we calculate these constants by using the variables from the
+ handler with most rows.
*/
- handler *file;
+ handler *file, **file_array;
+ ulonglong max_records= 0;
+ uint32 i= 0;
+ uint32 handler_instance= 0;
+
+ file_array= m_file;
+ do
+ {
+ file= *file_array;
+ /* Get variables if not already done */
+ if (!(flag & HA_STATUS_VARIABLE) ||
+ !bitmap_is_set(&(m_part_info->used_partitions),
+ (file_array - m_file)))
+ file->info(HA_STATUS_VARIABLE);
+ if (file->stats.records > max_records)
+ {
+ max_records= file->stats.records;
+ handler_instance= i;
+ }
+ i++;
+ } while (*(++file_array));
- file= m_file[0];
+ file= m_file[handler_instance];
file->info(HA_STATUS_CONST);
stats.create_time= file->stats.create_time;
ref_length= m_ref_length;
=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h 2009-02-19 09:01:25 +0000
+++ b/sql/ha_partition.h 2009-11-16 20:49:51 +0000
@@ -176,6 +176,11 @@ private:
This to ensure it will work with statement based replication.
*/
bool auto_increment_safe_stmt_log_lock;
+ /** For optimizing ha_start_bulk_insert calls */
+ MY_BITMAP m_bulk_insert_started;
+ ha_rows m_bulk_inserted_rows;
+ /** used for prediction of start_bulk_insert rows */
+ enum_monotonicity_info m_part_func_monotonicity_info;
public:
handler *clone(MEM_ROOT *mem_root);
virtual void set_part_info(partition_info *part_info)
@@ -353,7 +358,6 @@ public:
Bulk inserts are supported if all underlying handlers support it.
start_bulk_insert and end_bulk_insert is called before and after a
number of calls to write_row.
- Not yet though.
*/
virtual int write_row(uchar * buf);
virtual int update_row(const uchar * old_data, uchar * new_data);
@@ -361,6 +365,11 @@ public:
virtual int delete_all_rows(void);
virtual void start_bulk_insert(ha_rows rows);
virtual int end_bulk_insert(bool);
+private:
+ ha_rows guess_bulk_insert_rows();
+ void start_part_bulk_insert(THD *thd, uint part_id);
+ long estimate_read_buffer_size(long original_size);
+public:
virtual bool is_fatal_error(int error, uint flags)
{
@@ -764,10 +773,10 @@ public:
if (m_handler_status < handler_initialized ||
m_handler_status >= handler_closed)
DBUG_RETURN(PARTITION_ENABLED_TABLE_FLAGS);
- else
- DBUG_RETURN((m_file[0]->ha_table_flags() &
- ~(PARTITION_DISABLED_TABLE_FLAGS)) |
- (PARTITION_ENABLED_TABLE_FLAGS));
+
+ DBUG_RETURN((m_file[0]->ha_table_flags() &
+ ~(PARTITION_DISABLED_TABLE_FLAGS)) |
+ (PARTITION_ENABLED_TABLE_FLAGS));
}
/*
@@ -936,9 +945,11 @@ private:
auto_increment_lock= FALSE;
}
}
- virtual void set_auto_increment_if_higher(const ulonglong nr)
+ virtual void set_auto_increment_if_higher(Field *field)
{
HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
+ ulonglong nr= (((Field_num*) field)->unsigned_flag ||
+ field->val_int() > 0) ? field->val_int() : 0;
lock_auto_increment();
DBUG_ASSERT(ha_data->auto_inc_initialized == TRUE);
/* must check when the mutex is taken */
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2009-09-09 21:06:57 +0000
+++ b/sql/handler.cc 2009-11-16 20:49:51 +0000
@@ -1316,7 +1316,8 @@ int ha_rollback_trans(THD *thd, bool all
}
trans->ha_list= 0;
trans->no_2pc=0;
- if (is_real_trans && thd->transaction_rollback_request)
+ if (is_real_trans && thd->transaction_rollback_request &&
+ thd->transaction.xid_state.xa_state != XA_NOTR)
thd->transaction.xid_state.rm_error= thd->main_da.sql_errno();
if (all)
thd->variables.tx_isolation=thd->session_tx_isolation;
@@ -1890,12 +1891,42 @@ bool ha_flush_logs(handlerton *db_type)
return FALSE;
}
+
+/**
+ @brief make canonical filename
+
+ @param[in] file table handler
+ @param[in] path original path
+ @param[out] tmp_path buffer for canonized path
+
+ @details Lower case db name and table name path parts for
+ non file based tables when lower_case_table_names
+ is 2 (store as is, compare in lower case).
+ Filesystem path prefix (mysql_data_home or tmpdir)
+ is left intact.
+
+ @note tmp_path may be left intact if no conversion was
+ performed.
+
+ @retval canonized path
+
+ @todo This may be done more efficiently when table path
+ gets built. Convert this function to something like
+ ASSERT_CANONICAL_FILENAME.
+*/
const char *get_canonical_filename(handler *file, const char *path,
char *tmp_path)
{
+ uint i;
if (lower_case_table_names != 2 || (file->ha_table_flags() & HA_FILE_BASED))
return path;
+ for (i= 0; i <= mysql_tmpdir_list.max; i++)
+ {
+ if (is_prefix(path, mysql_tmpdir_list.list[i]))
+ return path;
+ }
+
/* Ensure that table handler get path in lower case */
if (tmp_path != path)
strmov(tmp_path, path);
@@ -3479,14 +3510,10 @@ int handler::index_next_same(uchar *buf,
if (!(error=index_next(buf)))
{
my_ptrdiff_t ptrdiff= buf - table->record[0];
- uchar *save_record_0;
- KEY *key_info;
- KEY_PART_INFO *key_part;
- KEY_PART_INFO *key_part_end;
- LINT_INIT(save_record_0);
- LINT_INIT(key_info);
- LINT_INIT(key_part);
- LINT_INIT(key_part_end);
+ uchar *UNINIT_VAR(save_record_0);
+ KEY *UNINIT_VAR(key_info);
+ KEY_PART_INFO *UNINIT_VAR(key_part);
+ KEY_PART_INFO *UNINIT_VAR(key_part_end);
/*
key_cmp_if_same() compares table->record[0] against 'key'.
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2009-10-15 21:38:29 +0000
+++ b/sql/handler.h 2009-11-16 20:49:51 +0000
@@ -398,7 +398,6 @@ struct xid_t {
my_xid get_my_xid()
{
return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&
- !memcmp(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id)) &&
!memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
quick_get_my_xid() : 0;
}
@@ -920,6 +919,15 @@ typedef struct st_ha_create_information
ulong key_block_size;
SQL_LIST merge_list;
handlerton *db_type;
+ /**
+ Row type of the table definition.
+
+ Defaults to ROW_TYPE_DEFAULT for all non-ALTER statements.
+ For ALTER TABLE defaults to ROW_TYPE_NOT_USED (means "keep the current").
+
+ Can be changed either explicitly by the parser.
+ If nothing speficied inherits the value of the original table (if present).
+ */
enum row_type row_type;
uint null_bits; /* NULL bits at start of record */
uint options; /* OR of HA_CREATE_ options */
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2009-10-15 21:38:29 +0000
+++ b/sql/item.cc 2009-11-16 20:49:51 +0000
@@ -433,26 +433,17 @@ Item::Item(THD *thd, Item *item):
}
-/**
- Decimal precision of the item.
-
- @remark The precision must not be capped as it can be used in conjunction
- with Item::decimals to determine the size of the integer part when
- constructing a decimal data type.
-
- @see Item::decimal_int_part()
- @see Item::decimals
-*/
-
uint Item::decimal_precision() const
{
- uint precision= max_length;
Item_result restype= result_type();
if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
- precision= my_decimal_length_to_precision(max_length, decimals, unsigned_flag);
-
- return precision;
+ {
+ uint prec=
+ my_decimal_length_to_precision(max_length, decimals, unsigned_flag);
+ return min(prec, DECIMAL_MAX_PRECISION);
+ }
+ return min(max_length, DECIMAL_MAX_PRECISION);
}
@@ -4917,7 +4908,9 @@ Field *Item::tmp_table_field_from_field_
switch (field_type()) {
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
- field= Field_new_decimal::new_decimal_field(this);
+ field= new Field_new_decimal((uchar*) 0, max_length, null_ptr, 0,
+ Field::NONE, name, decimals, 0,
+ unsigned_flag);
break;
case MYSQL_TYPE_TINY:
field= new Field_tiny((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
@@ -6340,9 +6333,26 @@ bool Item_direct_view_ref::fix_fields(TH
/* view fild reference must be defined */
DBUG_ASSERT(*ref);
/* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */
- if (!(*ref)->fixed &&
- ((*ref)->fix_fields(thd, ref)))
+ if ((*ref)->fixed)
+ {
+ Item *ref_item= (*ref)->real_item();
+ if (ref_item->type() == Item::FIELD_ITEM)
+ {
+ /*
+ In some cases we need to update table read set(see bug#47150).
+ If ref item is FIELD_ITEM and fixed then field and table
+ have proper values. So we can use them for update.
+ */
+ Field *fld= ((Item_field*) ref_item)->field;
+ DBUG_ASSERT(fld && fld->table);
+ if (thd->mark_used_columns == MARK_COLUMNS_READ)
+ bitmap_set_bit(fld->table->read_set, fld->field_index);
+ }
+ }
+ else if (!(*ref)->fixed &&
+ ((*ref)->fix_fields(thd, ref)))
return TRUE;
+
return Item_direct_ref::fix_fields(thd, reference);
}
@@ -6858,52 +6868,61 @@ void resolve_const_item(THD *thd, Item *
}
/**
- Compare the value stored in field, with the original item.
+ Compare the value stored in field with the expression from the query.
- @param field field which the item is converted and stored in
- @param item original item
+ @param field Field which the Item is stored in after conversion
+ @param item Original expression from query
- @return Return an integer greater than, equal to, or less than 0 if
- the value stored in the field is greater than, equal to,
- or less than the original item
+ @return Returns an integer greater than, equal to, or less than 0 if
+ the value stored in the field is greater than, equal to,
+ or less than the original Item. A 0 may also be returned if
+ out of memory.
@note We only use this on the range optimizer/partition pruning,
because in some cases we can't store the value in the field
without some precision/character loss.
*/
-int stored_field_cmp_to_item(Field *field, Item *item)
+int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
{
-
Item_result res_type=item_cmp_type(field->result_type(),
item->result_type());
if (res_type == STRING_RESULT)
{
char item_buff[MAX_FIELD_WIDTH];
char field_buff[MAX_FIELD_WIDTH];
- String item_tmp(item_buff,sizeof(item_buff),&my_charset_bin),*item_result;
+
+ String item_tmp(item_buff,sizeof(item_buff),&my_charset_bin);
String field_tmp(field_buff,sizeof(field_buff),&my_charset_bin);
- enum_field_types field_type;
- item_result=item->val_str(&item_tmp);
+ String *item_result= item->val_str(&item_tmp);
+ /*
+ Some implementations of Item::val_str(String*) actually modify
+ the field Item::null_value, hence we can't check it earlier.
+ */
if (item->null_value)
return 0;
- field->val_str(&field_tmp);
+ String *field_result= field->val_str(&field_tmp);
- /*
- If comparing DATE with DATETIME, append the time-part to the DATE.
- So that the strings are equally formatted.
- A DATE converted to string is 10 characters, and a DATETIME converted
- to string is 19 characters.
- */
- field_type= field->type();
- if (field_type == MYSQL_TYPE_DATE &&
- item_result->length() == 19)
- field_tmp.append(" 00:00:00");
- else if (field_type == MYSQL_TYPE_DATETIME &&
- item_result->length() == 10)
- item_result->append(" 00:00:00");
+ enum_field_types field_type= field->type();
+
+ if (field_type == MYSQL_TYPE_DATE || field_type == MYSQL_TYPE_DATETIME)
+ {
+ enum_mysql_timestamp_type type= MYSQL_TIMESTAMP_ERROR;
- return stringcmp(&field_tmp,item_result);
+ if (field_type == MYSQL_TYPE_DATE)
+ type= MYSQL_TIMESTAMP_DATE;
+
+ if (field_type == MYSQL_TYPE_DATETIME)
+ type= MYSQL_TIMESTAMP_DATETIME;
+
+ const char *field_name= field->field_name;
+ MYSQL_TIME field_time, item_time;
+ get_mysql_time_from_str(thd, field_result, type, field_name, &field_time);
+ get_mysql_time_from_str(thd, item_result, type, field_name, &item_time);
+
+ return my_time_compare(&field_time, &item_time);
+ }
+ return stringcmp(field_result, item_result);
}
if (res_type == INT_RESULT)
return 0; // Both are of type int
=== modified file 'sql/item.h'
--- a/sql/item.h 2009-10-15 21:38:29 +0000
+++ b/sql/item.h 2009-11-16 20:49:51 +0000
@@ -766,10 +766,9 @@ public:
virtual cond_result eq_cmp_result() const { return COND_OK; }
inline uint float_length(uint decimals_par) const
{ return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;}
- /** Returns the uncapped decimal precision of this item. */
virtual uint decimal_precision() const;
inline int decimal_int_part() const
- { return decimal_precision() - decimals; }
+ { return my_decimal_int_part(decimal_precision(), decimals); }
/*
Returns true if this is constant (during query execution, i.e. its value
will not change until next fix_fields) and its value is known.
@@ -3160,4 +3159,4 @@ void mark_select_range_as_dependent(THD
extern Cached_item *new_Cached_item(THD *thd, Item *item);
extern Item_result item_cmp_type(Item_result a,Item_result b);
extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item);
-extern int stored_field_cmp_to_item(Field *field, Item *item);
+extern int stored_field_cmp_to_item(THD *thd, Field *field, Item *item);
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2009-10-15 21:38:29 +0000
+++ b/sql/item_cmpfunc.cc 2009-11-16 20:49:51 +0000
@@ -189,6 +189,7 @@ enum_field_types agg_field_type(Item **i
collect_cmp_types()
items Array of items to collect types from
nitems Number of items in the array
+ skip_nulls Don't collect types of NULL items if TRUE
DESCRIPTION
This function collects different result types for comparison of the first
@@ -199,7 +200,7 @@ enum_field_types agg_field_type(Item **i
Bitmap of collected types - otherwise
*/
-static uint collect_cmp_types(Item **items, uint nitems)
+static uint collect_cmp_types(Item **items, uint nitems, bool skip_nulls= FALSE)
{
uint i;
uint found_types;
@@ -208,6 +209,8 @@ static uint collect_cmp_types(Item **ite
found_types= 0;
for (i= 1; i < nitems ; i++)
{
+ if (skip_nulls && items[i]->type() == Item::NULL_ITEM)
+ continue; // Skip NULL constant items
if ((left_result == ROW_RESULT ||
items[i]->result_type() == ROW_RESULT) &&
cmp_row_type(items[0], items[i]))
@@ -215,6 +218,12 @@ static uint collect_cmp_types(Item **ite
found_types|= 1<< (uint)item_cmp_type(left_result,
items[i]->result_type());
}
+ /*
+ Even if all right-hand items are NULLs and we are skipping them all, we need
+ at least one type bit in the found_type bitmask.
+ */
+ if (skip_nulls && !found_types)
+ found_types= 1 << (uint)left_result;
return found_types;
}
@@ -627,56 +636,51 @@ int Arg_comparator::set_compare_func(Ite
return 0;
}
-
/**
- @brief Convert date provided in a string to the int representation.
+ Parse date provided in a string to a MYSQL_TIME.
- @param[in] thd thread handle
- @param[in] str a string to convert
- @param[in] warn_type type of the timestamp for issuing the warning
- @param[in] warn_name field name for issuing the warning
- @param[out] error_arg could not extract a DATE or DATETIME
-
- @details Convert date provided in the string str to the int
- representation. If the string contains wrong date or doesn't
- contain it at all then a warning is issued. The warn_type and
- the warn_name arguments are used as the name and the type of the
- field when issuing the warning. If any input was discarded
- (trailing or non-timestampy characters), was_cut will be non-zero.
- was_type will return the type str_to_datetime() could correctly
- extract.
-
- @return
- converted value. 0 on error and on zero-dates -- check 'failure'
+ @param[in] thd Thread handle
+ @param[in] str A string to convert
+ @param[in] warn_type Type of the timestamp for issuing the warning
+ @param[in] warn_name Field name for issuing the warning
+ @param[out] l_time The MYSQL_TIME objects is initialized.
+
+ Parses a date provided in the string str into a MYSQL_TIME object. If the
+ string contains an incorrect date or doesn't correspond to a date at all
+ then a warning is issued. The warn_type and the warn_name arguments are used
+ as the name and the type of the field when issuing the warning. If any input
+ was discarded (trailing or non-timestamp-y characters), return value will be
+ TRUE.
+
+ @return Status flag
+ @retval FALSE Success.
+ @retval True Indicates failure.
*/
-static ulonglong
-get_date_from_str(THD *thd, String *str, timestamp_type warn_type,
- char *warn_name, bool *error_arg)
+bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
+ const char *warn_name, MYSQL_TIME *l_time)
{
- ulonglong value= 0;
+ bool value;
int error;
- MYSQL_TIME l_time;
- enum_mysql_timestamp_type ret;
+ enum_mysql_timestamp_type timestamp_type;
- ret= str_to_datetime(str->ptr(), str->length(), &l_time,
- (TIME_FUZZY_DATE | MODE_INVALID_DATES |
- (thd->variables.sql_mode &
- (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE))),
- &error);
+ timestamp_type=
+ str_to_datetime(str->ptr(), str->length(), l_time,
+ (TIME_FUZZY_DATE | MODE_INVALID_DATES |
+ (thd->variables.sql_mode &
+ (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE))),
+ &error);
- if (ret == MYSQL_TIMESTAMP_DATETIME || ret == MYSQL_TIMESTAMP_DATE)
- {
+ if (timestamp_type == MYSQL_TIMESTAMP_DATETIME ||
+ timestamp_type == MYSQL_TIMESTAMP_DATE)
/*
Do not return yet, we may still want to throw a "trailing garbage"
warning.
*/
- *error_arg= FALSE;
- value= TIME_to_ulonglong_datetime(&l_time);
- }
+ value= FALSE;
else
{
- *error_arg= TRUE;
+ value= TRUE;
error= 1; /* force warning */
}
@@ -689,6 +693,37 @@ get_date_from_str(THD *thd, String *str,
}
+/**
+ @brief Convert date provided in a string to the int representation.
+
+ @param[in] thd thread handle
+ @param[in] str a string to convert
+ @param[in] warn_type type of the timestamp for issuing the warning
+ @param[in] warn_name field name for issuing the warning
+ @param[out] error_arg could not extract a DATE or DATETIME
+
+ @details Convert date provided in the string str to the int
+ representation. If the string contains wrong date or doesn't
+ contain it at all then a warning is issued. The warn_type and
+ the warn_name arguments are used as the name and the type of the
+ field when issuing the warning.
+
+ @return
+ converted value. 0 on error and on zero-dates -- check 'failure'
+*/
+static ulonglong get_date_from_str(THD *thd, String *str,
+ timestamp_type warn_type,
+ const char *warn_name, bool *error_arg)
+{
+ MYSQL_TIME l_time;
+ *error_arg= get_mysql_time_from_str(thd, str, warn_type, warn_name, &l_time);
+
+ if (*error_arg)
+ return 0;
+ return TIME_to_ulonglong_datetime(&l_time);
+}
+
+
/*
Check whether compare_datetime() can be used to compare items.
@@ -1549,61 +1584,73 @@ longlong Item_in_optimizer::val_int()
if (cache->null_value)
{
+ /*
+ We're evaluating
+ "<outer_value_list> [NOT] IN (SELECT <inner_value_list>...)"
+ where one or more of the outer values is NULL.
+ */
if (((Item_in_subselect*)args[1])->is_top_level_item())
{
/*
- We're evaluating "NULL IN (SELECT ...)". The result can be NULL or
- FALSE, and we can return one instead of another. Just return NULL.
+ We're evaluating a top level item, e.g.
+ "<outer_value_list> IN (SELECT <inner_value_list>...)",
+ and in this case a NULL value in the outer_value_list means
+ that the result shall be NULL/FALSE (makes no difference for
+ top level items). The cached value is NULL, so just return
+ NULL.
*/
null_value= 1;
}
else
{
- if (!((Item_in_subselect*)args[1])->is_correlated &&
- result_for_null_param != UNKNOWN)
+ /*
+ We're evaluating an item where a NULL value in either the
+ outer or inner value list does not automatically mean that we
+ can return NULL/FALSE. An example of such a query is
+ "<outer_value_list> NOT IN (SELECT <inner_value_list>...)"
+ The result when there is at least one NULL value is: NULL if the
+ SELECT evaluated over the non-NULL values produces at least
+ one row, FALSE otherwise
+ */
+ Item_in_subselect *item_subs=(Item_in_subselect*)args[1];
+ bool all_left_cols_null= true;
+ const uint ncols= cache->cols();
+
+ /*
+ Turn off the predicates that are based on column compares for
+ which the left part is currently NULL
+ */
+ for (uint i= 0; i < ncols; i++)
{
- /* Use cached value from previous execution */
- null_value= result_for_null_param;
+ if (cache->element_index(i)->null_value)
+ item_subs->set_cond_guard_var(i, FALSE);
+ else
+ all_left_cols_null= false;
}
- else
+
+ if (!((Item_in_subselect*)args[1])->is_correlated &&
+ all_left_cols_null && result_for_null_param != UNKNOWN)
{
- /*
- We're evaluating "NULL IN (SELECT ...)". The result is:
- FALSE if SELECT produces an empty set, or
- NULL otherwise.
- We disable the predicates we've pushed down into subselect, run the
- subselect and see if it has produced any rows.
+ /*
+ This is a non-correlated subquery, all values in the outer
+ value list are NULL, and we have already evaluated the
+ subquery for all NULL values: Return the same result we
+ did last time without evaluating the subquery.
*/
- Item_in_subselect *item_subs=(Item_in_subselect*)args[1];
- if (cache->cols() == 1)
- {
- item_subs->set_cond_guard_var(0, FALSE);
- (void) args[1]->val_bool_result();
- result_for_null_param= null_value= !item_subs->engine->no_rows();
- item_subs->set_cond_guard_var(0, TRUE);
- }
- else
- {
- uint i;
- uint ncols= cache->cols();
- /*
- Turn off the predicates that are based on column compares for
- which the left part is currently NULL
- */
- for (i= 0; i < ncols; i++)
- {
- if (cache->element_index(i)->null_value)
- item_subs->set_cond_guard_var(i, FALSE);
- }
-
- (void) args[1]->val_bool_result();
- result_for_null_param= null_value= !item_subs->engine->no_rows();
-
- /* Turn all predicates back on */
- for (i= 0; i < ncols; i++)
- item_subs->set_cond_guard_var(i, TRUE);
- }
+ null_value= result_for_null_param;
+ }
+ else
+ {
+ /* The subquery has to be evaluated */
+ (void) args[1]->val_bool_result();
+ null_value= !item_subs->engine->no_rows();
+ if (all_left_cols_null)
+ result_for_null_param= null_value;
}
+
+ /* Turn all predicates back on */
+ for (uint i= 0; i < ncols; i++)
+ item_subs->set_cond_guard_var(i, TRUE);
}
return 0;
}
@@ -2181,7 +2228,7 @@ uint Item_func_ifnull::decimal_precision
int arg1_int_part= args[1]->decimal_int_part();
int max_int_part= max(arg0_int_part, arg1_int_part);
int precision= max_int_part + decimals;
- return precision;
+ return min(precision, DECIMAL_MAX_PRECISION);
}
@@ -2365,7 +2412,7 @@ uint Item_func_if::decimal_precision() c
int arg1_prec= args[1]->decimal_int_part();
int arg2_prec= args[2]->decimal_int_part();
int precision=max(arg1_prec,arg2_prec) + decimals;
- return precision;
+ return min(precision, DECIMAL_MAX_PRECISION);
}
@@ -2782,7 +2829,7 @@ uint Item_func_case::decimal_precision()
if (else_expr_num != -1)
set_if_bigger(max_int_part, args[else_expr_num]->decimal_int_part());
- return max_int_part + decimals;
+ return min(max_int_part + decimals, DECIMAL_MAX_PRECISION);
}
@@ -3523,7 +3570,7 @@ void Item_func_in::fix_length_and_dec()
uint type_cnt= 0, i;
Item_result cmp_type= STRING_RESULT;
left_result_type= args[0]->result_type();
- if (!(found_types= collect_cmp_types(args, arg_count)))
+ if (!(found_types= collect_cmp_types(args, arg_count, true)))
return;
for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++)
@@ -3701,9 +3748,11 @@ void Item_func_in::fix_length_and_dec()
uint j=0;
for (uint i=1 ; i < arg_count ; i++)
{
- array->set(j,args[i]);
if (!args[i]->null_value) // Skip NULL values
+ {
+ array->set(j,args[i]);
j++;
+ }
else
have_null= 1;
}
=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h 2009-08-20 15:51:02 +0000
+++ b/sql/item_cmpfunc.h 2009-11-16 20:49:51 +0000
@@ -1722,3 +1722,6 @@ inline Item *and_conds(Item *a, Item *b)
}
Item *and_expressions(Item *a, Item *b, Item **org_item);
+
+bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
+ const char *warn_name, MYSQL_TIME *l_time);
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2009-10-15 21:38:29 +0000
+++ b/sql/item_func.cc 2009-11-16 20:49:51 +0000
@@ -435,8 +435,7 @@ bool Item_func::eq(const Item *item, boo
Field *Item_func::tmp_table_field(TABLE *table)
{
- Field *field;
- LINT_INIT(field);
+ Field *field= NULL;
switch (result_type()) {
case INT_RESULT:
@@ -451,8 +450,45 @@ Field *Item_func::tmp_table_field(TABLE
case STRING_RESULT:
return make_string_field(table);
case DECIMAL_RESULT:
- field= Field_new_decimal::new_decimal_field(this);
+ {
+ uint8 dec= decimals;
+ uint8 intg= decimal_precision() - dec;
+ uint32 len= max_length;
+
+ /*
+ Trying to put too many digits overall in a DECIMAL(prec,dec)
+ will always throw a warning. We must limit dec to
+ DECIMAL_MAX_SCALE however to prevent an assert() later.
+ */
+
+ if (dec > 0)
+ {
+ int overflow;
+
+ dec= min(dec, DECIMAL_MAX_SCALE);
+
+ /*
+ If the value still overflows the field with the corrected dec,
+ we'll throw out decimals rather than integers. This is still
+ bad and of course throws a truncation warning.
+ */
+
+ const int required_length=
+ my_decimal_precision_to_length(intg + dec, dec,
+ unsigned_flag);
+
+ overflow= required_length - len;
+
+ if (overflow > 0)
+ dec= max(0, dec - overflow); // too long, discard fract
+ else
+ /* Corrected value fits. */
+ len= required_length;
+ }
+
+ field= new Field_new_decimal(len, maybe_null, name, dec, unsigned_flag);
break;
+ }
case ROW_RESULT:
default:
// This case should never be chosen
@@ -4239,9 +4275,8 @@ void Item_func_set_user_var::save_item_r
bool
Item_func_set_user_var::update()
{
- bool res;
+ bool res= 0;
DBUG_ENTER("Item_func_set_user_var::update");
- LINT_INIT(res);
switch (cached_result_type) {
case REAL_RESULT:
@@ -4744,19 +4779,6 @@ void Item_func_get_user_var::fix_length_
}
-uint Item_func_get_user_var::decimal_precision() const
-{
- uint precision= max_length;
- Item_result restype= result_type();
-
- /* Default to maximum as the precision is unknown a priori. */
- if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
- precision= DECIMAL_MAX_PRECISION;
-
- return precision;
-}
-
-
bool Item_func_get_user_var::const_item() const
{
return (!var_entry || current_thd->query_id != var_entry->update_query_id);
=== modified file 'sql/item_func.h'
--- a/sql/item_func.h 2009-10-15 21:38:29 +0000
+++ b/sql/item_func.h 2009-11-16 20:49:51 +0000
@@ -1393,7 +1393,6 @@ public:
table_map used_tables() const
{ return const_item() ? 0 : RAND_TABLE_BIT; }
bool eq(const Item *item, bool binary_cmp) const;
- uint decimal_precision() const;
private:
bool set_value(THD *thd, sp_rcontext *ctx, Item **it);
=== modified file 'sql/item_geofunc.cc'
--- a/sql/item_geofunc.cc 2009-07-10 23:12:13 +0000
+++ b/sql/item_geofunc.cc 2009-10-24 06:57:31 +0000
@@ -84,7 +84,9 @@ String *Item_func_geometry_from_wkb::val
if (args[0]->field_type() == MYSQL_TYPE_GEOMETRY)
{
- return args[0]->val_str(str);
+ String *str_ret= args[0]->val_str(str);
+ null_value= args[0]->null_value;
+ return str_ret;
}
wkb= args[0]->val_str(&arg_val);
@@ -94,7 +96,10 @@ String *Item_func_geometry_from_wkb::val
str->set_charset(&my_charset_bin);
if (str->reserve(SRID_SIZE, 512))
- return 0;
+ {
+ null_value= TRUE; /* purecov: inspected */
+ return 0; /* purecov: inspected */
+ }
str->length(0);
str->q_append(srid);
if ((null_value=
=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc 2009-09-07 20:50:10 +0000
+++ b/sql/item_strfunc.cc 2009-11-16 20:49:51 +0000
@@ -632,6 +632,7 @@ String *Item_func_concat_ws::val_str(Str
String tmp_sep_str(tmp_str_buff, sizeof(tmp_str_buff),default_charset_info),
*sep_str, *res, *res2,*use_as_buff;
uint i;
+ bool is_const= 0;
null_value=0;
if (!(sep_str= args[0]->val_str(&tmp_sep_str)))
@@ -645,7 +646,11 @@ String *Item_func_concat_ws::val_str(Str
// If not, return the empty string
for (i=1; i < arg_count; i++)
if ((res= args[i]->val_str(str)))
+ {
+ is_const= args[i]->const_item() || !args[i]->used_tables();
break;
+ }
+
if (i == arg_count)
return &my_empty_string;
@@ -663,7 +668,7 @@ String *Item_func_concat_ws::val_str(Str
current_thd->variables.max_allowed_packet);
goto null;
}
- if (res->alloced_length() >=
+ if (!is_const && res->alloced_length() >=
res->length() + sep_str->length() + res2->length())
{ // Use old buffer
res->append(*sep_str); // res->length() > 0 always
=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc 2009-09-15 10:46:35 +0000
+++ b/sql/item_subselect.cc 2009-11-16 20:49:51 +0000
@@ -159,17 +159,14 @@ bool Item_subselect::fix_fields(THD *thd
return TRUE;
in_fix_fields++;
- res= engine->prepare();
- // all transformation is done (used by prepared statements)
- changed= 1;
-
- if (!res)
+ if (!(res= engine->prepare()))
{
+ // all transformation is done (used by prepared statements)
+ changed= 1;
+
if (substitution)
{
- int ret= 0;
-
// did we changed top item of WHERE condition
if (unit->outer_select()->where == (*ref))
unit->outer_select()->where= substitution; // correct WHERE for PS
@@ -183,22 +180,20 @@ bool Item_subselect::fix_fields(THD *thd
substitution= 0;
thd->where= "checking transformed subquery";
if (!(*ref)->fixed)
- ret= (*ref)->fix_fields(thd, ref);
- thd->where= save_where;
- in_fix_fields--;
- return ret;
+ res= (*ref)->fix_fields(thd, ref);
+ goto end;
}
// Is it one field subselect?
if (engine->cols() > max_columns)
{
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
- in_fix_fields--;
- return TRUE;
+ res= 1;
+ goto end;
}
fix_length_and_dec();
}
else
- goto err;
+ goto end;
if ((uncacheable= engine->uncacheable()))
{
@@ -208,7 +203,7 @@ bool Item_subselect::fix_fields(THD *thd
}
fixed= 1;
-err:
+end:
in_fix_fields--;
thd->where= save_where;
return res;
@@ -339,9 +334,14 @@ void Item_subselect::update_used_tables(
void Item_subselect::print(String *str, enum_query_type query_type)
{
- str->append('(');
- engine->print(str, query_type);
- str->append(')');
+ if (engine)
+ {
+ str->append('(');
+ engine->print(str, query_type);
+ str->append(')');
+ }
+ else
+ str->append("(...)");
}
@@ -1977,6 +1977,7 @@ int subselect_single_select_engine::exec
tab->read_record.record= tab->table->record[0];
tab->read_record.thd= join->thd;
tab->read_record.ref_length= tab->table->file->ref_length;
+ tab->read_record.unlock_row= rr_unlock_row;
*(last_changed_tab++)= tab;
break;
}
=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc 2009-10-15 21:38:29 +0000
+++ b/sql/item_sum.cc 2009-11-16 20:49:51 +0000
@@ -517,7 +517,8 @@ Field *Item_sum::create_tmp_field(bool g
name, table->s, collation.collation);
break;
case DECIMAL_RESULT:
- field= Field_new_decimal::new_decimal_field(this);
+ field= new Field_new_decimal(max_length, maybe_null, name,
+ decimals, unsigned_flag);
break;
case ROW_RESULT:
default:
=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc 2009-10-15 21:38:29 +0000
+++ b/sql/item_timefunc.cc 2009-11-16 20:49:51 +0000
@@ -278,9 +278,9 @@ static bool extract_date_time(DATE_TIME_
int strict_week_number_year= -1;
int frac_part;
bool usa_time= 0;
- bool sunday_first_n_first_week_non_iso;
- bool strict_week_number;
- bool strict_week_number_year_type;
+ bool UNINIT_VAR(sunday_first_n_first_week_non_iso);
+ bool UNINIT_VAR(strict_week_number);
+ bool UNINIT_VAR(strict_week_number_year_type);
const char *val_begin= val;
const char *val_end= val + length;
const char *ptr= format->format.str;
@@ -1350,15 +1350,11 @@ bool get_interval_value(Item *args,inter
String *str_value, INTERVAL *interval)
{
ulonglong array[5];
- longlong value;
- const char *str;
- size_t length;
+ longlong UNINIT_VAR(value);
+ const char *UNINIT_VAR(str);
+ size_t UNINIT_VAR(length);
CHARSET_INFO *cs=str_value->charset();
- LINT_INIT(value);
- LINT_INIT(str);
- LINT_INIT(length);
-
bzero((char*) interval,sizeof(*interval));
if ((int) int_type <= INTERVAL_MICROSECOND)
{
=== modified file 'sql/item_xmlfunc.cc'
--- a/sql/item_xmlfunc.cc 2009-09-07 20:50:10 +0000
+++ b/sql/item_xmlfunc.cc 2009-11-16 20:49:51 +0000
@@ -1354,8 +1354,7 @@ my_xpath_lex_scan(MY_XPATH *xpath,
MY_XPATH_LEX *lex, const char *beg, const char *end)
{
int ch, ctype, length;
- for ( ; beg < end && *beg == ' ' ; beg++) // skip leading spaces
- ;
+ for ( ; beg < end && *beg == ' ' ; beg++) ; // skip leading spaces
lex->beg= beg;
if (beg >= end)
@@ -1424,8 +1423,7 @@ my_xpath_lex_scan(MY_XPATH *xpath,
if (my_xdigit(ch)) // a sequence of digits
{
- for ( ; beg < end && my_xdigit(*beg) ; beg++)
- ;
+ for ( ; beg < end && my_xdigit(*beg) ; beg++) ;
lex->end= beg;
lex->term= MY_XPATH_LEX_DIGITS;
return;
@@ -1433,8 +1431,7 @@ my_xpath_lex_scan(MY_XPATH *xpath,
if (ch == '"' || ch == '\'') // a string: either '...' or "..."
{
- for ( ; beg < end && *beg != ch ; beg++)
- ;
+ for ( ; beg < end && *beg != ch ; beg++) ;
if (beg < end)
{
lex->end= beg+1;
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2009-11-06 17:22:32 +0000
+++ b/sql/log.cc 2009-11-16 20:49:51 +0000
@@ -153,7 +153,7 @@ private:
class binlog_trx_data {
public:
binlog_trx_data()
- : at_least_one_stmt(0), incident(FALSE), m_pending(0),
+ : at_least_one_stmt_committed(0), incident(FALSE), m_pending(0),
before_stmt_pos(MY_OFF_T_UNDEF)
{
trans_log.end_of_file= max_binlog_cache_size;
@@ -182,7 +182,10 @@ public:
{
DBUG_PRINT("info", ("truncating to position %lu", (ulong) pos));
DBUG_PRINT("info", ("before_stmt_pos=%lu", (ulong) pos));
- delete pending();
+ if (pending())
+ {
+ delete pending();
+ }
set_pending(0);
reinit_io_cache(&trans_log, WRITE_CACHE, pos, 0, 0);
trans_log.end_of_file= max_binlog_cache_size;
@@ -192,12 +195,12 @@ public:
/*
The only valid positions that can be truncated to are at the
beginning of a statement. We are relying on this fact to be able
- to set the at_least_one_stmt flag correctly. In other word, if
+ to set the at_least_one_stmt_committed flag correctly. In other word, if
we are truncating to the beginning of the transaction cache,
there will be no statements in the cache, otherwhise, we will
have at least one statement in the transaction cache.
*/
- at_least_one_stmt= (pos > 0);
+ at_least_one_stmt_committed= (pos > 0);
}
/*
@@ -239,7 +242,7 @@ public:
Boolean that is true if there is at least one statement in the
transaction cache.
*/
- bool at_least_one_stmt;
+ bool at_least_one_stmt_committed;
bool incident;
private:
@@ -1035,14 +1038,10 @@ bool LOGGER::general_log_write(THD *thd,
Log_event_handler **current_handler= general_log_handler_list;
char user_host_buff[MAX_USER_HOST_SIZE + 1];
Security_context *sctx= thd->security_ctx;
- ulong id;
uint user_host_len= 0;
time_t current_time;
- if (thd)
- id= thd->thread_id; /* Normal thread */
- else
- id= 0; /* Log from connect handler */
+ DBUG_ASSERT(thd);
lock_shared();
if (!opt_log)
@@ -1061,7 +1060,7 @@ bool LOGGER::general_log_write(THD *thd,
while (*current_handler)
error|= (*current_handler++)->
log_general(thd, current_time, user_host_buff,
- user_host_len, id,
+ user_host_len, thd->thread_id,
command_name[(uint) command].str,
command_name[(uint) command].length,
query, query_length,
@@ -1287,7 +1286,7 @@ static bool stmt_has_updated_trans_table
{
Ha_trx_info *ha_info;
- for (ha_info= thd->transaction.stmt.ha_list; ha_info; ha_info= ha_info->next())
+ for (ha_info= thd->transaction.stmt.ha_list; ha_info && ha_info->is_started(); ha_info= ha_info->next())
{
if (ha_info->is_trx_read_write() && ha_info->ht() != binlog_hton)
return (TRUE);
@@ -1535,9 +1534,9 @@ static int binlog_commit(handlerton *hto
/*
We commit the transaction if:
- - We are not in a transaction and committing a statement, or
+ - We are not in a transaction and committing a statement, or
- - We are in a transaction and a full transaction is committed
+ - We are in a transaction and a full transaction is committed
Otherwise, we accumulate the statement
*/
@@ -1550,21 +1549,18 @@ static int binlog_commit(handlerton *hto
YESNO(in_transaction),
YESNO(thd->transaction.all.modified_non_trans_table),
YESNO(thd->transaction.stmt.modified_non_trans_table)));
- if (thd->options & OPTION_BIN_LOG)
- {
- if (!in_transaction || all)
- {
- Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, TRUE, 0);
- error= binlog_end_trans(thd, trx_data, &qev, all);
- goto end;
- }
- }
- else
+
+ if (!in_transaction || all ||
+ (!all && !trx_data->at_least_one_stmt_committed &&
+ !stmt_has_updated_trans_table(thd) &&
+ thd->transaction.stmt.modified_non_trans_table))
{
- trx_data->reset();
+ Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, TRUE, 0);
+ error= binlog_end_trans(thd, trx_data, &qev, all);
}
-end:
+ trx_data->at_least_one_stmt_committed = my_b_tell(&trx_data->trans_log) > 0;
+
if (!all)
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit
DBUG_RETURN(error);
@@ -1630,15 +1626,18 @@ static int binlog_rollback(handlerton *h
{
/*
We flush the cache with a rollback, wrapped in a beging/rollback if:
- . aborting a transcation that modified a non-transactional table or;
+ . aborting a transaction that modified a non-transactional table;
. aborting a statement that modified both transactional and
- non-transctional tables but which is not in the boundaries of any
- transaction;
+ non-transactional tables but which is not in the boundaries of any
+ transaction or there was no early change;
. the OPTION_KEEP_LOG is activate.
*/
if ((all && thd->transaction.all.modified_non_trans_table) ||
(!all && thd->transaction.stmt.modified_non_trans_table &&
!(thd->options & (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT))) ||
+ (!all && thd->transaction.stmt.modified_non_trans_table &&
+ !trx_data->at_least_one_stmt_committed &&
+ thd->current_stmt_binlog_row_based) ||
((thd->options & OPTION_KEEP_LOG)))
{
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, TRUE, 0);
@@ -1730,7 +1729,7 @@ static int binlog_savepoint_set(handlert
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
int const error=
thd->binlog_query(THD::STMT_QUERY_TYPE,
- thd->query, thd->query_length, TRUE, FALSE, errcode);
+ thd->query(), thd->query_length(), TRUE, FALSE, errcode);
DBUG_RETURN(error);
}
@@ -1749,7 +1748,7 @@ static int binlog_savepoint_rollback(han
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
int error=
thd->binlog_query(THD::STMT_QUERY_TYPE,
- thd->query, thd->query_length, TRUE, FALSE, errcode);
+ thd->query(), thd->query_length(), TRUE, FALSE, errcode);
DBUG_RETURN(error);
}
binlog_trans_log_truncate(thd, *(my_off_t*)sv);
@@ -3641,7 +3640,7 @@ void MYSQL_BIN_LOG::new_file_impl(bool n
}
old_name=name;
name=0; // Don't free name
- close(LOG_CLOSE_TO_BE_OPENED);
+ close(LOG_CLOSE_TO_BE_OPENED | LOG_CLOSE_INDEX);
/*
Note that at this point, log_state != LOG_CLOSED (important for is_open()).
@@ -3656,8 +3655,10 @@ void MYSQL_BIN_LOG::new_file_impl(bool n
trigger temp tables deletion on slaves.
*/
- open(old_name, log_type, new_name_ptr,
- io_cache_type, no_auto_events, max_size, 1);
+ /* reopen index binlog file, BUG#34582 */
+ if (!open_index_file(index_file_name, 0))
+ open(old_name, log_type, new_name_ptr,
+ io_cache_type, no_auto_events, max_size, 1);
my_free(old_name,MYF(0));
end:
@@ -4096,8 +4097,8 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
binlog_[wild_]{do|ignore}_table?" (WL#1049)"
*/
const char *local_db= event_info->get_db();
- if ((thd && !(thd->options & OPTION_BIN_LOG)) ||
- (!binlog_filter->db_ok(local_db)))
+ if ((!(thd->options & OPTION_BIN_LOG)) ||
+ (!binlog_filter->db_ok(local_db)))
{
VOID(pthread_mutex_unlock(&LOCK_log));
DBUG_RETURN(0);
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2009-10-15 21:38:29 +0000
+++ b/sql/log_event.cc 2009-11-16 20:49:51 +0000
@@ -1851,6 +1851,7 @@ Rows_log_event::print_verbose_one_row(IO
{
const uchar *value0= value;
const uchar *null_bits= value;
+ uint null_bit_index= 0;
char typestr[64]= "";
value+= (m_width + 7) / 8;
@@ -1859,7 +1860,8 @@ Rows_log_event::print_verbose_one_row(IO
for (size_t i= 0; i < td->size(); i ++)
{
- int is_null= (null_bits[i / 8] >> (i % 8)) & 0x01;
+ int is_null= (null_bits[null_bit_index / 8]
+ >> (null_bit_index % 8)) & 0x01;
if (bitmap_is_set(cols_bitmap, i) == 0)
continue;
@@ -1896,6 +1898,8 @@ Rows_log_event::print_verbose_one_row(IO
}
my_b_printf(file, "\n");
+
+ null_bit_index++;
}
return value - value0;
}
@@ -3038,7 +3042,7 @@ int Query_log_event::do_apply_event(Rela
thd->query_id = next_query_id();
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->variables.pseudo_thread_id= thread_id; // for temp tables
- DBUG_PRINT("query",("%s",thd->query));
+ DBUG_PRINT("query",("%s", thd->query()));
if (ignored_error_code((expected_error= error_code)) ||
!unexpected_error_code(expected_error))
@@ -3132,7 +3136,7 @@ int Query_log_event::do_apply_event(Rela
/* Execute the query (note that we bypass dispatch_command()) */
const char* found_semicolon= NULL;
- mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
+ mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon);
log_slow_statement(thd);
}
else
@@ -3144,7 +3148,7 @@ int Query_log_event::do_apply_event(Rela
we exit gracefully; otherwise we warn about the bad error and tell DBA
to check/fix it.
*/
- if (mysql_test_parse_for_slave(thd, thd->query, thd->query_length))
+ if (mysql_test_parse_for_slave(thd, thd->query(), thd->query_length()))
clear_all_errors(thd, const_cast<Relay_log_info*>(rli)); /* Can ignore query */
else
{
@@ -3154,7 +3158,7 @@ Query partially completed on the master
and was aborted. There is a chance that your master is inconsistent at this \
point. If you are sure that your master is ok, run this query manually on the \
slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; \
-START SLAVE; . Query: '%s'", expected_error, thd->query);
+START SLAVE; . Query: '%s'", expected_error, thd->query());
thd->is_slave_error= 1;
}
goto end;
@@ -3162,7 +3166,7 @@ START SLAVE; . Query: '%s'", expected_er
/* If the query was not ignored, it is printed to the general log */
if (!thd->is_error() || thd->main_da.sql_errno() != ER_SLAVE_IGNORED_TABLE)
- general_log_write(thd, COM_QUERY, thd->query, thd->query_length);
+ general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
compare_errors:
@@ -3854,6 +3858,7 @@ bool Format_description_log_event::write
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
{
+ int ret= 0;
DBUG_ENTER("Format_description_log_event::do_apply_event");
#ifdef USING_TRANSACTIONS
@@ -3895,17 +3900,21 @@ int Format_description_log_event::do_app
0, then 96, then jump to first really asked event (which is
>96). So this is ok.
*/
- DBUG_RETURN(Start_log_event_v3::do_apply_event(rli));
+ ret= Start_log_event_v3::do_apply_event(rli);
}
- DBUG_RETURN(0);
+
+ if (!ret)
+ {
+ /* Save the information describing this binlog */
+ delete rli->relay_log.description_event_for_exec;
+ const_cast<Relay_log_info *>(rli)->relay_log.description_event_for_exec= this;
+ }
+
+ DBUG_RETURN(ret);
}
int Format_description_log_event::do_update_pos(Relay_log_info *rli)
{
- /* save the information describing this binlog */
- delete rli->relay_log.description_event_for_exec;
- rli->relay_log.description_event_for_exec= this;
-
if (server_id == (uint32) ::server_id)
{
/*
@@ -4009,7 +4018,7 @@ uint Load_log_event::get_query_buffer_le
}
-void Load_log_event::print_query(bool need_db, char *buf,
+void Load_log_event::print_query(bool need_db, const char *cs, char *buf,
char **end, char **fn_start, char **fn_end)
{
char *pos= buf;
@@ -4033,9 +4042,9 @@ void Load_log_event::print_query(bool ne
pos= strmov(pos+fname_len, "' ");
if (sql_ex.opt_flags & REPLACE_FLAG)
- pos= strmov(pos, " REPLACE ");
+ pos= strmov(pos, "REPLACE ");
else if (sql_ex.opt_flags & IGNORE_FLAG)
- pos= strmov(pos, " IGNORE ");
+ pos= strmov(pos, "IGNORE ");
pos= strmov(pos ,"INTO");
@@ -4046,8 +4055,16 @@ void Load_log_event::print_query(bool ne
memcpy(pos, table_name, table_name_len);
pos+= table_name_len;
- /* We have to create all optinal fields as the default is not empty */
- pos= strmov(pos, "` FIELDS TERMINATED BY ");
+ if (cs != NULL)
+ {
+ pos= strmov(pos ,"` CHARACTER SET ");
+ pos= strmov(pos , cs);
+ }
+ else
+ pos= strmov(pos, "`");
+
+ /* We have to create all optional fields as the default is not empty */
+ pos= strmov(pos, " FIELDS TERMINATED BY ");
pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
pos= strmov(pos, " OPTIONALLY ");
@@ -4101,7 +4118,7 @@ void Load_log_event::pack_info(Protocol
if (!(buf= (char*) my_malloc(get_query_buffer_length(), MYF(MY_WME))))
return;
- print_query(TRUE, buf, &end, 0, 0);
+ print_query(TRUE, NULL, buf, &end, 0, 0);
protocol->store(buf, end-buf, &my_charset_bin);
my_free(buf, MYF(0));
}
@@ -4366,9 +4383,9 @@ void Load_log_event::print(FILE* file_ar
my_b_printf(&cache, "INFILE '%-*s' ", fname_len, fname);
if (sql_ex.opt_flags & REPLACE_FLAG)
- my_b_printf(&cache," REPLACE ");
+ my_b_printf(&cache,"REPLACE ");
else if (sql_ex.opt_flags & IGNORE_FLAG)
- my_b_printf(&cache," IGNORE ");
+ my_b_printf(&cache,"IGNORE ");
my_b_printf(&cache, "INTO TABLE `%s`", table_name);
my_b_printf(&cache, " FIELDS TERMINATED BY ");
@@ -4480,8 +4497,8 @@ int Load_log_event::do_apply_event(NET*
new_db.length= db_len;
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
thd->set_db(new_db.str, new_db.length);
- DBUG_ASSERT(thd->query == 0);
- thd->query_length= 0; // Should not be needed
+ DBUG_ASSERT(thd->query() == 0);
+ thd->set_query_inner(NULL, 0); // Should not be needed
thd->is_slave_error= 0;
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
@@ -4576,8 +4593,7 @@ int Load_log_event::do_apply_event(NET*
goto error;
}
- print_query(FALSE, load_data_query, &end, (char **)&thd->lex->fname_start,
- (char **)&thd->lex->fname_end);
+ print_query(FALSE, NULL, load_data_query, &end, NULL, NULL);
*end= 0;
thd->set_query(load_data_query, (uint) (end - load_data_query));
@@ -6734,7 +6750,7 @@ void Execute_load_query_log_event::print
my_b_printf(&cache, "\'");
if (dup_handling == LOAD_DUP_REPLACE)
my_b_printf(&cache, " REPLACE");
- my_b_printf(&cache, " INTO ");
+ my_b_printf(&cache, " INTO");
my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end);
my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
}
@@ -7497,6 +7513,7 @@ int Rows_log_event::do_apply_event(Relay
thd->reset_current_stmt_binlog_row_based();
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
thd->is_slave_error= 1;
+ DBUG_RETURN(error);
}
/*
This code would ideally be placed in do_update_pos() instead, but
@@ -7525,6 +7542,14 @@ int Rows_log_event::do_apply_event(Relay
const_cast<Relay_log_info*>(rli)->last_event_start_time= my_time(0);
}
+ if (get_flags(STMT_END_F))
+ if ((error= rows_event_stmt_cleanup(rli, thd)))
+ rli->report(ERROR_LEVEL, error,
+ "Error in %s event: commit of row events failed, "
+ "table `%s`.`%s`",
+ get_type_str(), m_table->s->db.str,
+ m_table->s->table_name.str);
+
DBUG_RETURN(error);
}
@@ -7623,33 +7648,19 @@ Rows_log_event::do_update_pos(Relay_log_
if (get_flags(STMT_END_F))
{
- if ((error= rows_event_stmt_cleanup(rli, thd)) == 0)
- {
- /*
- Indicate that a statement is finished.
- Step the group log position if we are not in a transaction,
- otherwise increase the event log position.
- */
- rli->stmt_done(log_pos, when);
-
- /*
- Clear any errors pushed in thd->net.last_err* if for example "no key
- found" (as this is allowed). This is a safety measure; apparently
- those errors (e.g. when executing a Delete_rows_log_event of a
- non-existing row, like in rpl_row_mystery22.test,
- thd->net.last_error = "Can't find record in 't1'" and last_errno=1032)
- do not become visible. We still prefer to wipe them out.
- */
- thd->clear_error();
- }
- else
- {
- rli->report(ERROR_LEVEL, error,
- "Error in %s event: commit of row events failed, "
- "table `%s`.`%s`",
- get_type_str(), m_table->s->db.str,
- m_table->s->table_name.str);
- }
+ /*
+ Indicate that a statement is finished.
+ Step the group log position if we are not in a transaction,
+ otherwise increase the event log position.
+ */
+ rli->stmt_done(log_pos, when);
+ /*
+ Clear any errors in thd->net.last_err*. It is not known if this is
+ needed or not. It is believed that any errors that may exist in
+ thd->net.last_err* are allowed. Examples of errors are "key not
+ found", which is produced in the test case rpl_row_conflicts.test
+ */
+ thd->clear_error();
}
else
{
@@ -8314,6 +8325,16 @@ Write_rows_log_event::do_before_row_oper
/* Honor next number column if present */
m_table->next_number_field= m_table->found_next_number_field;
+ /*
+ * Fixed Bug#45999, In RBR, Store engine of Slave auto-generates new
+ * sequence numbers for auto_increment fields if the values of them are 0.
+ * If generateing a sequence number is decided by the values of
+ * table->auto_increment_field_not_null and SQL_MODE(if includes
+ * MODE_NO_AUTO_VALUE_ON_ZERO) in update_auto_increment function.
+ * SQL_MODE of slave sql thread is always consistency with master's.
+ * In RBR, auto_increment fields never are NULL.
+ */
+ m_table->auto_increment_field_not_null= TRUE;
return error;
}
@@ -8323,6 +8344,7 @@ Write_rows_log_event::do_after_row_opera
{
int local_error= 0;
m_table->next_number_field=0;
+ m_table->auto_increment_field_not_null= FALSE;
if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 ||
m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER)
{
@@ -8826,11 +8848,11 @@ int Rows_log_event::find_row(const Relay
*/
store_record(table,record[1]);
- if (table->s->keys > 0)
+ if (table->s->keys > 0 && table->s->keys_in_use.is_set(0))
{
DBUG_PRINT("info",("locating record using primary key (index_read)"));
- /* We have a key: search the table using the index */
+ /* The 0th key is active: search the table using the index */
if (!table->file->inited && (error= table->file->ha_index_init(0, FALSE)))
{
DBUG_PRINT("info",("ha_index_init returns error %d",error));
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2009-09-07 20:50:10 +0000
+++ b/sql/log_event.h 2009-11-16 20:49:51 +0000
@@ -1960,15 +1960,15 @@ private:
class Load_log_event: public Log_event
{
private:
- uint get_query_buffer_length();
- void print_query(bool need_db, char *buf, char **end,
- char **fn_start, char **fn_end);
protected:
int copy_log_event(const char *buf, ulong event_len,
int body_offset,
const Format_description_log_event* description_event);
public:
+ uint get_query_buffer_length();
+ void print_query(bool need_db, const char *cs, char *buf, char **end,
+ char **fn_start, char **fn_end);
ulong thread_id;
ulong slave_proxy_id;
uint32 table_name_len;
=== modified file 'sql/log_event_old.cc'
--- a/sql/log_event_old.cc 2009-05-19 09:28:05 +0000
+++ b/sql/log_event_old.cc 2009-11-16 20:49:51 +0000
@@ -1814,33 +1814,6 @@ int Old_rows_log_event::do_apply_event(R
const_cast<Relay_log_info*>(rli)->last_event_start_time= my_time(0);
}
- DBUG_RETURN(0);
-}
-
-
-Log_event::enum_skip_reason
-Old_rows_log_event::do_shall_skip(Relay_log_info *rli)
-{
- /*
- If the slave skip counter is 1 and this event does not end a
- statement, then we should not start executing on the next event.
- Otherwise, we defer the decision to the normal skipping logic.
- */
- if (rli->slave_skip_counter == 1 && !get_flags(STMT_END_F))
- return Log_event::EVENT_SKIP_IGNORE;
- else
- return Log_event::do_shall_skip(rli);
-}
-
-int
-Old_rows_log_event::do_update_pos(Relay_log_info *rli)
-{
- DBUG_ENTER("Old_rows_log_event::do_update_pos");
- int error= 0;
-
- DBUG_PRINT("info", ("flags: %s",
- get_flags(STMT_END_F) ? "STMT_END_F " : ""));
-
if (get_flags(STMT_END_F))
{
/*
@@ -1869,7 +1842,12 @@ Old_rows_log_event::do_update_pos(Relay_
are involved, commit the transaction and flush the pending event to the
binlog.
*/
- error= ha_autocommit_or_rollback(thd, 0);
+ if ((error= ha_autocommit_or_rollback(thd, 0)))
+ rli->report(ERROR_LEVEL, error,
+ "Error in %s event: commit of row events failed, "
+ "table `%s`.`%s`",
+ get_type_str(), m_table->s->db.str,
+ m_table->s->table_name.str);
/*
Now what if this is not a transactional engine? we still need to
@@ -1882,33 +1860,51 @@ Old_rows_log_event::do_update_pos(Relay_
*/
thd->reset_current_stmt_binlog_row_based();
- rli->cleanup_context(thd, 0);
- if (error == 0)
- {
- /*
- Indicate that a statement is finished.
- Step the group log position if we are not in a transaction,
- otherwise increase the event log position.
- */
- rli->stmt_done(log_pos, when);
+ const_cast<Relay_log_info*>(rli)->cleanup_context(thd, 0);
+ }
- /*
- Clear any errors pushed in thd->net.client_last_err* if for
- example "no key found" (as this is allowed). This is a safety
- measure; apparently those errors (e.g. when executing a
- Delete_rows_log_event_old of a non-existing row, like in
- rpl_row_mystery22.test, thd->net.last_error = "Can't
- find record in 't1'" and last_errno=1032) do not become
- visible. We still prefer to wipe them out.
- */
- thd->clear_error();
- }
- else
- rli->report(ERROR_LEVEL, error,
- "Error in %s event: commit of row events failed, "
- "table `%s`.`%s`",
- get_type_str(), m_table->s->db.str,
- m_table->s->table_name.str);
+ DBUG_RETURN(error);
+}
+
+
+Log_event::enum_skip_reason
+Old_rows_log_event::do_shall_skip(Relay_log_info *rli)
+{
+ /*
+ If the slave skip counter is 1 and this event does not end a
+ statement, then we should not start executing on the next event.
+ Otherwise, we defer the decision to the normal skipping logic.
+ */
+ if (rli->slave_skip_counter == 1 && !get_flags(STMT_END_F))
+ return Log_event::EVENT_SKIP_IGNORE;
+ else
+ return Log_event::do_shall_skip(rli);
+}
+
+int
+Old_rows_log_event::do_update_pos(Relay_log_info *rli)
+{
+ DBUG_ENTER("Old_rows_log_event::do_update_pos");
+ int error= 0;
+
+ DBUG_PRINT("info", ("flags: %s",
+ get_flags(STMT_END_F) ? "STMT_END_F " : ""));
+
+ if (get_flags(STMT_END_F))
+ {
+ /*
+ Indicate that a statement is finished.
+ Step the group log position if we are not in a transaction,
+ otherwise increase the event log position.
+ */
+ rli->stmt_done(log_pos, when);
+ /*
+ Clear any errors in thd->net.last_err*. It is not known if this is
+ needed or not. It is believed that any errors that may exist in
+ thd->net.last_err* are allowed. Examples of errors are "key not
+ found", which is produced in the test case rpl_row_conflicts.test
+ */
+ thd->clear_error();
}
else
{
=== modified file 'sql/my_decimal.h'
--- a/sql/my_decimal.h 2009-10-15 21:38:29 +0000
+++ b/sql/my_decimal.h 2009-11-16 20:49:51 +0000
@@ -48,12 +48,10 @@ C_MODE_END
digits * number of decimal digits in one our big digit - number of decimal
digits in one our big digit decreased by 1 (because we always put decimal
point on the border of our big digits))
-
- This value is 65 due to historical reasons partly due to it being used
- as the maximum allowed precision and not the actual maximum precision.
*/
#define DECIMAL_MAX_PRECISION (DECIMAL_MAX_POSSIBLE_PRECISION - 8*2)
#define DECIMAL_MAX_SCALE 30
+#define DECIMAL_NOT_SPECIFIED 31
/**
maximum length of string representation (number of maximum decimal
@@ -77,6 +75,12 @@ inline uint my_decimal_size(uint precisi
}
+inline int my_decimal_int_part(uint precision, uint decimals)
+{
+ return precision - ((decimals == DECIMAL_NOT_SPECIFIED) ? 0 : decimals);
+}
+
+
/**
my_decimal class limits 'decimal_t' type to what we need in MySQL.
@@ -180,7 +184,7 @@ inline uint my_decimal_length_to_precisi
}
inline uint32 my_decimal_precision_to_length_no_truncation(uint precision,
- uint scale,
+ uint8 scale,
bool unsigned_flag)
{
/*
@@ -192,7 +196,7 @@ inline uint32 my_decimal_precision_to_le
(unsigned_flag || !precision ? 0 : 1));
}
-inline uint32 my_decimal_precision_to_length(uint precision, uint scale,
+inline uint32 my_decimal_precision_to_length(uint precision, uint8 scale,
bool unsigned_flag)
{
/*
=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h 2009-10-15 21:52:31 +0000
+++ b/sql/mysql_priv.h 2009-11-16 20:49:51 +0000
@@ -2303,10 +2303,9 @@ enum enum_explain_filename_mode
{
EXPLAIN_ALL_VERBOSE= 0,
EXPLAIN_PARTITIONS_VERBOSE,
- EXPLAIN_PARTITIONS_AS_COMMENT,
- EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING
+ EXPLAIN_PARTITIONS_AS_COMMENT
};
-uint explain_filename(const char *from, char *to, uint to_length,
+uint explain_filename(THD* thd, const char *from, char *to, uint to_length,
enum_explain_filename_mode explain_mode);
uint filename_to_tablename(const char *from, char *to, uint to_length);
uint tablename_to_filename(const char *from, char *to, uint to_length);
@@ -2460,6 +2459,7 @@ inline void setup_table_map(TABLE *table
table->tablenr= tablenr;
table->map= (table_map) 1 << tablenr;
table->force_index= table_list->force_index;
+ table->force_index_order= table->force_index_group= 0;
table->covering_keys= table->s->keys_for_keyread;
table->merge_keys.clear_all();
}
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-10-31 19:22:50 +0000
+++ b/sql/mysqld.cc 2009-11-16 20:49:51 +0000
@@ -28,6 +28,7 @@
#include "mysys_err.h"
#include "events.h"
#include <waiting_threads.h>
+#include "debug_sync.h"
#include "../storage/myisam/ha_myisam.h"
@@ -497,6 +498,9 @@ my_bool lower_case_file_system= 0;
my_bool opt_large_pages= 0;
my_bool opt_myisam_use_mmap= 0;
uint opt_large_page_size= 0;
+#if defined(ENABLED_DEBUG_SYNC)
+uint opt_debug_sync_timeout= 0;
+#endif /* defined(ENABLED_DEBUG_SYNC) */
my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
/*
True if there is at least one per-hour limit for some user, so we should
@@ -1136,13 +1140,13 @@ void kill_mysql(void)
#if defined(__NETWARE__)
extern "C" void kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
+#define RETURN_FROM_KILL_SERVER return
#elif !defined(__WIN__)
static void *kill_server(void *sig_ptr)
-#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
+#define RETURN_FROM_KILL_SERVER return 0
#else
static void __cdecl kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
+#define RETURN_FROM_KILL_SERVER return
#endif
{
DBUG_ENTER("kill_server");
@@ -1150,7 +1154,10 @@ static void __cdecl kill_server(int sig_
int sig=(int) (long) sig_ptr; // This is passed a int
// if there is a signal during the kill in progress, ignore the other
if (kill_in_progress) // Safety
+ {
+ DBUG_LEAVE;
RETURN_FROM_KILL_SERVER;
+ }
kill_in_progress=TRUE;
abort_loop=1; // This should be set
if (sig != 0) // 0 is not a valid signal number
@@ -1185,12 +1192,19 @@ static void __cdecl kill_server(int sig_
pthread_join(select_thread, NULL); // wait for main thread
#endif /* __NETWARE__ */
+ DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
pthread_exit(0);
/* purecov: end */
-#endif /* EMBEDDED_LIBRARY */
+ RETURN_FROM_KILL_SERVER; // Avoid compiler warnings
+
+#else /* EMBEDDED_LIBRARY*/
+
+ DBUG_LEAVE;
RETURN_FROM_KILL_SERVER;
+
+#endif /* EMBEDDED_LIBRARY */
}
@@ -1354,6 +1368,10 @@ void clean_up(bool print_message)
#ifdef USE_REGEX
my_regex_end();
#endif
+#if defined(ENABLED_DEBUG_SYNC)
+ /* End the debug sync facility. See debug_sync.cc. */
+ debug_sync_end();
+#endif /* defined(ENABLED_DEBUG_SYNC) */
#if !defined(EMBEDDED_LIBRARY)
if (!opt_bootstrap)
@@ -1777,7 +1795,7 @@ static void network_init(void)
saPipeSecurity.lpSecurityDescriptor = &sdPipeDescriptor;
saPipeSecurity.bInheritHandle = FALSE;
if ((hPipe= CreateNamedPipe(pipe_name,
- PIPE_ACCESS_DUPLEX,
+ PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE |
PIPE_READMODE_BYTE |
PIPE_WAIT,
@@ -2012,8 +2030,9 @@ bool one_thread_per_connection_end(THD *
my_thread_end();
(void) pthread_cond_broadcast(&COND_thread_count);
+ DBUG_LEAVE; // Must match DBUG_ENTER()
pthread_exit(0);
- DBUG_RETURN(0); // Impossible
+ return 0; // Avoid compiler warnings
}
@@ -2580,7 +2599,7 @@ terribly wrong...\n");
}
fprintf(stderr, "Trying to get some variables.\n\
Some pointers may be invalid and cause the dump to abort...\n");
- my_safe_print_str("thd->query", thd->query, 1024);
+ my_safe_print_str("thd->query", thd->query(), 1024);
fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id);
fprintf(stderr, "thd->killed=%s\n", kreason);
}
@@ -2837,7 +2856,9 @@ pthread_handler_t signal_hand(void *arg
DBUG_PRINT("quit",("signal_handler: calling my_thread_end()"));
my_thread_end();
signal_thread_in_use= 0;
+ DBUG_LEAVE; // Must match DBUG_ENTER()
pthread_exit(0); // Safety
+ return 0; // Avoid compiler warnings
}
switch (sig) {
case SIGTERM:
@@ -3557,6 +3578,12 @@ static int init_common_variables(const c
sys_var_slow_log_path.value= my_strdup(s, MYF(0));
sys_var_slow_log_path.value_length= strlen(s);
+#if defined(ENABLED_DEBUG_SYNC)
+ /* Initialize the debug sync facility. See debug_sync.cc. */
+ if (debug_sync_init())
+ return 1; /* purecov: tested */
+#endif /* defined(ENABLED_DEBUG_SYNC) */
+
#if (ENABLE_TEMP_POOL)
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
return 1;
@@ -4909,10 +4936,10 @@ static bool read_init_file(char *file_na
DBUG_ENTER("read_init_file");
DBUG_PRINT("enter",("name: %s",file_name));
if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME))))
- DBUG_RETURN(1);
+ DBUG_RETURN(TRUE);
bootstrap(file);
(void) my_fclose(file,MYF(MY_WME));
- DBUG_RETURN(0);
+ DBUG_RETURN(FALSE);
}
@@ -4966,7 +4993,7 @@ void create_thread_to_handle_connection(
handle_one_connection,
(void*) thd)))
{
- /* purify: begin inspected */
+ /* purecov: begin inspected */
DBUG_PRINT("error",
("Can't create thread to handle request (error %d)",
error));
@@ -5324,17 +5351,26 @@ pthread_handler_t handle_connections_soc
pthread_handler_t handle_connections_namedpipes(void *arg)
{
HANDLE hConnectedPipe;
- BOOL fConnected;
+ OVERLAPPED connectOverlapped = {0};
THD *thd;
my_thread_init();
DBUG_ENTER("handle_connections_namedpipes");
- (void) my_pthread_getprio(pthread_self()); // For debugging
+ connectOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
DBUG_PRINT("general",("Waiting for named pipe connections."));
while (!abort_loop)
{
/* wait for named pipe connection */
- fConnected = ConnectNamedPipe(hPipe, NULL);
+ BOOL fConnected= ConnectNamedPipe(hPipe, &connectOverlapped);
+ if (!fConnected && (GetLastError() == ERROR_IO_PENDING))
+ {
+ /*
+ ERROR_IO_PENDING says async IO has started but not yet finished.
+ GetOverlappedResult will wait for completion.
+ */
+ DWORD bytes;
+ fConnected= GetOverlappedResult(hPipe, &connectOverlapped,&bytes, TRUE);
+ }
if (abort_loop)
break;
if (!fConnected)
@@ -5343,7 +5379,7 @@ pthread_handler_t handle_connections_nam
{
CloseHandle(hPipe);
if ((hPipe= CreateNamedPipe(pipe_name,
- PIPE_ACCESS_DUPLEX,
+ PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE |
PIPE_READMODE_BYTE |
PIPE_WAIT,
@@ -5363,7 +5399,7 @@ pthread_handler_t handle_connections_nam
hConnectedPipe = hPipe;
/* create new pipe for new connection */
if ((hPipe = CreateNamedPipe(pipe_name,
- PIPE_ACCESS_DUPLEX,
+ PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE |
PIPE_READMODE_BYTE |
PIPE_WAIT,
@@ -5385,7 +5421,7 @@ pthread_handler_t handle_connections_nam
CloseHandle(hConnectedPipe);
continue;
}
- if (!(thd->net.vio = vio_new_win32pipe(hConnectedPipe)) ||
+ if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) ||
my_net_init(&thd->net, thd->net.vio))
{
close_connection(thd, ER_OUT_OF_RESOURCES, 1);
@@ -5396,7 +5432,7 @@ pthread_handler_t handle_connections_nam
thd->security_ctx->host= my_strdup(my_localhost, MYF(0));
create_new_thread(thd);
}
-
+ CloseHandle(connectOverlapped.hEvent);
decrement_handler_count();
DBUG_RETURN(0);
}
@@ -5573,8 +5609,7 @@ pthread_handler_t handle_connections_sha
errmsg= "Could not set client to read mode";
goto errorconn;
}
- if (!(thd->net.vio= vio_new_win32shared_memory(&thd->net,
- handle_client_file_map,
+ if (!(thd->net.vio= vio_new_win32shared_memory(handle_client_file_map,
handle_client_map,
event_client_wrote,
event_client_read,
@@ -5814,6 +5849,9 @@ enum options_mysqld
OPT_LOG_SLOW_SLAVE_STATEMENTS,
OPT_DEBUG_CRC, OPT_DEBUG_ON, OPT_OLD_MODE,
OPT_TEST_IGNORE_WRONG_OPTIONS,
+#if defined(ENABLED_DEBUG_SYNC)
+ OPT_DEBUG_SYNC_TIMEOUT,
+#endif /* defined(ENABLED_DEBUG_SYNC) */
OPT_SLAVE_EXEC_MODE,
OPT_DEADLOCK_SEARCH_DEPTH_SHORT,
OPT_DEADLOCK_SEARCH_DEPTH_LONG,
@@ -6634,6 +6672,14 @@ log and this option does nothing anymore
"Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK.",
(uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#if defined(ENABLED_DEBUG_SYNC)
+ {"debug-sync-timeout", OPT_DEBUG_SYNC_TIMEOUT,
+ "Enable the debug sync facility "
+ "and optionally specify a default wait timeout in seconds. "
+ "A zero value keeps the facility disabled.",
+ (uchar**) &opt_debug_sync_timeout, 0,
+ 0, GET_UINT, OPT_ARG, 0, 0, UINT_MAX, 0, 0, 0},
+#endif /* defined(ENABLED_DEBUG_SYNC) */
{"temp-pool", OPT_TEMP_POOL,
#if (ENABLE_TEMP_POOL)
"Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.",
@@ -7846,6 +7892,9 @@ static int mysql_init_variables(void)
bzero((uchar*) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
bzero((char *) &global_status_var, sizeof(global_status_var));
opt_large_pages= 0;
+#if defined(ENABLED_DEBUG_SYNC)
+ opt_debug_sync_timeout= 0;
+#endif /* defined(ENABLED_DEBUG_SYNC) */
key_map_full.set_all();
/* Character sets */
@@ -8658,6 +8707,22 @@ mysqld_get_one_option(int optid,
/* Used for testing options */
opt_ignore_wrong_options= 1;
break;
+#if defined(ENABLED_DEBUG_SYNC)
+ case OPT_DEBUG_SYNC_TIMEOUT:
+ /*
+ Debug Sync Facility. See debug_sync.cc.
+ Default timeout for WAIT_FOR action.
+ Default value is zero (facility disabled).
+ If option is given without an argument, supply a non-zero value.
+ */
+ if (!argument)
+ {
+ /* purecov: begin tested */
+ opt_debug_sync_timeout= DEBUG_SYNC_DEFAULT_WAIT_TIMEOUT;
+ /* purecov: end */
+ }
+ break;
+#endif /* defined(ENABLED_DEBUG_SYNC) */
}
return 0;
}
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2009-10-15 21:38:29 +0000
+++ b/sql/opt_range.cc 2009-11-16 20:49:51 +0000
@@ -5710,6 +5710,27 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND
!(conf_func->compare_collation()->state & MY_CS_BINSORT))
goto end;
+ if (key_part->image_type == Field::itMBR)
+ {
+ switch (type) {
+ case Item_func::SP_EQUALS_FUNC:
+ case Item_func::SP_DISJOINT_FUNC:
+ case Item_func::SP_INTERSECTS_FUNC:
+ case Item_func::SP_TOUCHES_FUNC:
+ case Item_func::SP_CROSSES_FUNC:
+ case Item_func::SP_WITHIN_FUNC:
+ case Item_func::SP_CONTAINS_FUNC:
+ case Item_func::SP_OVERLAPS_FUNC:
+ break;
+ default:
+ /*
+ We cannot involve spatial indexes for queries that
+ don't use MBREQUALS(), MBRDISJOINT(), etc. functions.
+ */
+ goto end;
+ }
+ }
+
if (param->using_real_indexes)
optimize_range= field->optimize_range(param->real_keynr[key_part->key],
key_part->part);
@@ -5877,6 +5898,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND
if (type == Item_func::LT_FUNC && (value->val_int() > 0))
type = Item_func::LE_FUNC;
else if (type == Item_func::GT_FUNC &&
+ (field->type() != FIELD_TYPE_BIT) &&
!((Field_num*)field)->unsigned_flag &&
!((Item_int*)value)->unsigned_flag &&
(value->val_int() < 0))
@@ -5891,6 +5913,17 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND
goto end;
}
field->table->in_use->variables.sql_mode= orig_sql_mode;
+
+ /*
+ Any sargable predicate except "<=>" involving NULL as a constant is always
+ FALSE
+ */
+ if (type != Item_func::EQUAL_FUNC && field->is_real_null())
+ {
+ tree= &null_element;
+ goto end;
+ }
+
str= (uchar*) alloc_root(alloc, key_part->store_length+1);
if (!str)
goto end;
@@ -5914,7 +5947,9 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND
*/
if (field->result_type() == INT_RESULT &&
value->result_type() == INT_RESULT &&
- ((Field_num*)field)->unsigned_flag && !((Item_int*)value)->unsigned_flag)
+ ((field->type() == FIELD_TYPE_BIT ||
+ ((Field_num *) field)->unsigned_flag) &&
+ !((Item_int*) value)->unsigned_flag))
{
longlong item_val= value->val_int();
if (item_val < 0)
@@ -5934,7 +5969,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND
switch (type) {
case Item_func::LT_FUNC:
- if (stored_field_cmp_to_item(field,value) == 0)
+ if (stored_field_cmp_to_item(param->thd, field, value) == 0)
tree->max_flag=NEAR_MAX;
/* fall through */
case Item_func::LE_FUNC:
@@ -5949,14 +5984,14 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND
case Item_func::GT_FUNC:
/* Don't use open ranges for partial key_segments */
if ((!(key_part->flag & HA_PART_KEY_SEG)) &&
- (stored_field_cmp_to_item(field, value) <= 0))
+ (stored_field_cmp_to_item(param->thd, field, value) <= 0))
tree->min_flag=NEAR_MIN;
tree->max_flag= NO_MAX_RANGE;
break;
case Item_func::GE_FUNC:
/* Don't use open ranges for partial key_segments */
if ((!(key_part->flag & HA_PART_KEY_SEG)) &&
- (stored_field_cmp_to_item(field,value) < 0))
+ (stored_field_cmp_to_item(param->thd, field, value) < 0))
tree->min_flag= NEAR_MIN;
tree->max_flag=NO_MAX_RANGE;
break;
@@ -6510,6 +6545,63 @@ get_range(SEL_ARG **e1,SEL_ARG **e2,SEL_
}
+/**
+ Combine two range expression under a common OR. On a logical level, the
+ transformation is key_or( expr1, expr2 ) => expr1 OR expr2.
+
+ Both expressions are assumed to be in the SEL_ARG format. In a logic sense,
+ theformat is reminiscent of DNF, since an expression such as the following
+
+ ( 1 < kp1 < 10 AND p1 ) OR ( 10 <= kp2 < 20 AND p2 )
+
+ where there is a key consisting of keyparts ( kp1, kp2, ..., kpn ) and p1
+ and p2 are valid SEL_ARG expressions over keyparts kp2 ... kpn, is a valid
+ SEL_ARG condition. The disjuncts appear ordered by the minimum endpoint of
+ the first range and ranges must not overlap. It follows that they are also
+ ordered by maximum endpoints. Thus
+
+ ( 1 < kp1 <= 2 AND ( kp2 = 2 OR kp2 = 3 ) ) OR kp1 = 3
+
+ Is a a valid SER_ARG expression for a key of at least 2 keyparts.
+
+ For simplicity, we will assume that expr2 is a single range predicate,
+ i.e. on the form ( a < x < b AND ... ). It is easy to generalize to a
+ disjunction of several predicates by subsequently call key_or for each
+ disjunct.
+
+ The algorithm iterates over each disjunct of expr1, and for each disjunct
+ where the first keypart's range overlaps with the first keypart's range in
+ expr2:
+
+ If the predicates are equal for the rest of the keyparts, or if there are
+ no more, the range in expr2 has its endpoints copied in, and the SEL_ARG
+ node in expr2 is deallocated. If more ranges became connected in expr1, the
+ surplus is also dealocated. If they differ, two ranges are created.
+
+ - The range leading up to the overlap. Empty if endpoints are equal.
+
+ - The overlapping sub-range. May be the entire range if they are equal.
+
+ Finally, there may be one more range if expr2's first keypart's range has a
+ greater maximum endpoint than the last range in expr1.
+
+ For the overlapping sub-range, we recursively call key_or. Thus in order to
+ compute key_or of
+
+ (1) ( 1 < kp1 < 10 AND 1 < kp2 < 10 )
+
+ (2) ( 2 < kp1 < 20 AND 4 < kp2 < 20 )
+
+ We create the ranges 1 < kp <= 2, 2 < kp1 < 10, 10 <= kp1 < 20. For the
+ first one, we simply hook on the condition for the second keypart from (1)
+ : 1 < kp2 < 10. For the second range 2 < kp1 < 10, key_or( 1 < kp2 < 10, 4
+ < kp2 < 20 ) is called, yielding 1 < kp2 < 20. For the last range, we reuse
+ the range 4 < kp2 < 20 from (2) for the second keypart. The result is thus
+
+ ( 1 < kp1 <= 2 AND 1 < kp2 < 10 ) OR
+ ( 2 < kp1 < 10 AND 1 < kp2 < 20 ) OR
+ ( 10 <= kp1 < 20 AND 4 < kp2 < 20 )
+*/
static SEL_ARG *
key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
{
@@ -6661,7 +6753,21 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *
key1=key1->tree_delete(save);
}
last->copy_min(tmp);
- if (last->copy_min(key2) || last->copy_max(key2))
+ bool full_range= last->copy_min(key2);
+ if (!full_range)
+ {
+ if (last->next && key2->cmp_max_to_min(last->next) >= 0)
+ {
+ last->max_value= last->next->min_value;
+ if (last->next->min_flag & NEAR_MIN)
+ last->max_flag&= ~NEAR_MAX;
+ else
+ last->max_flag|= NEAR_MAX;
+ }
+ else
+ full_range= last->copy_max(key2);
+ }
+ if (full_range)
{ // Full range
key1->free_tree();
for (; key2 ; key2=key2->next)
@@ -6671,8 +6777,6 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *
return 0;
}
}
- key2=key2->next;
- continue;
}
if (cmp >= 0 && tmp->cmp_min_to_min(key2) < 0)
=== modified file 'sql/opt_sum.cc'
--- a/sql/opt_sum.cc 2009-09-07 20:50:10 +0000
+++ b/sql/opt_sum.cc 2009-11-16 20:49:51 +0000
@@ -97,7 +97,8 @@ static ulonglong get_exact_record_count(
@note
This function is only called for queries with sum functions and no
- GROUP BY part.
+ GROUP BY part. This means that the result set shall contain a single
+ row only
@retval
0 no errors
=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc 2009-02-19 09:01:25 +0000
+++ b/sql/partition_info.cc 2009-11-16 20:49:51 +0000
@@ -483,10 +483,8 @@ static bool check_engine_condition(parti
{
DBUG_RETURN(TRUE);
}
- else
- {
- DBUG_RETURN(FALSE);
- }
+
+ DBUG_RETURN(FALSE);
}
=== modified file 'sql/records.cc'
--- a/sql/records.cc 2009-05-06 12:03:24 +0000
+++ b/sql/records.cc 2009-11-16 20:49:51 +0000
@@ -57,10 +57,12 @@ void init_read_record_idx(READ_RECORD *i
{
empty_record(table);
bzero((char*) info,sizeof(*info));
+ info->thd= thd;
info->table= table;
info->file= table->file;
info->record= table->record[0];
info->print_error= print_error;
+ info->unlock_row= rr_unlock_row;
table->status=0; /* And it's always found */
if (!table->file->inited)
@@ -186,6 +188,7 @@ void init_read_record(READ_RECORD *info,
}
info->select=select;
info->print_error=print_error;
+ info->unlock_row= rr_unlock_row;
info->ignore_not_found_rows= 0;
table->status=0; /* And it's always found */
@@ -292,6 +295,12 @@ void end_read_record(READ_RECORD *info)
static int rr_handle_error(READ_RECORD *info, int error)
{
+ if (info->thd->killed)
+ {
+ info->thd->send_kill_message();
+ return 1;
+ }
+
if (error == HA_ERR_END_OF_FILE)
error= -1;
else
@@ -312,12 +321,7 @@ static int rr_quick(READ_RECORD *info)
int tmp;
while ((tmp= info->select->quick->get_next()))
{
- if (info->thd->killed)
- {
- my_error(ER_SERVER_SHUTDOWN, MYF(0));
- return 1;
- }
- if (tmp != HA_ERR_RECORD_DELETED)
+ if (info->thd->killed || (tmp != HA_ERR_RECORD_DELETED))
{
tmp= rr_handle_error(info, tmp);
break;
@@ -380,16 +384,11 @@ int rr_sequential(READ_RECORD *info)
int tmp;
while ((tmp=info->file->rnd_next(info->record)))
{
- if (info->thd->killed)
- {
- info->thd->send_kill_message();
- return 1;
- }
/*
rnd_next can return RECORD_DELETED for MyISAM when one thread is
reading and another deleting without locks.
*/
- if (tmp != HA_ERR_RECORD_DELETED)
+ if (info->thd->killed || (tmp != HA_ERR_RECORD_DELETED))
{
tmp= rr_handle_error(info, tmp);
break;
=== modified file 'sql/repl_failsafe.cc'
--- a/sql/repl_failsafe.cc 2009-05-15 12:57:51 +0000
+++ b/sql/repl_failsafe.cc 2009-09-23 13:10:23 +0000
@@ -638,9 +638,11 @@ err:
if (recovery_captain)
mysql_close(recovery_captain);
delete thd;
+
+ DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
pthread_exit(0);
- DBUG_RETURN(0);
+ return 0; // Avoid compiler warnings
}
#endif
=== modified file 'sql/rpl_filter.cc'
--- a/sql/rpl_filter.cc 2009-09-07 20:50:10 +0000
+++ b/sql/rpl_filter.cc 2009-11-16 20:49:51 +0000
@@ -155,8 +155,10 @@ Rpl_filter::db_ok(const char* db)
and db was not selected, do not replicate.
*/
if (!db)
+ {
+ DBUG_PRINT("exit", ("Don't replicate"));
DBUG_RETURN(0);
-
+ }
if (!do_db.is_empty()) // if the do's are not empty
{
I_List_iterator<i_string> it(do_db);
@@ -167,6 +169,7 @@ Rpl_filter::db_ok(const char* db)
if (!strcmp(tmp->ptr, db))
DBUG_RETURN(1); // match
}
+ DBUG_PRINT("exit", ("Don't replicate"));
DBUG_RETURN(0);
}
else // there are some elements in the don't, otherwise we cannot get here
@@ -177,7 +180,10 @@ Rpl_filter::db_ok(const char* db)
while ((tmp=it++))
{
if (!strcmp(tmp->ptr, db))
+ {
+ DBUG_PRINT("exit", ("Don't replicate"));
DBUG_RETURN(0); // match
+ }
}
DBUG_RETURN(1);
}
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2009-10-26 11:35:42 +0000
+++ b/sql/set_var.cc 2009-11-16 20:49:51 +0000
@@ -553,11 +553,11 @@ static sys_var_const sys_skip_network
static sys_var_const sys_skip_show_database(&vars, "skip_show_database",
OPT_GLOBAL, SHOW_BOOL,
(uchar*) &opt_skip_show_db);
-#ifdef HAVE_SYS_UN_H
+
static sys_var_const sys_socket(&vars, "socket",
OPT_GLOBAL, SHOW_CHAR_PTR,
(uchar*) &mysqld_unix_port);
-#endif
+
#ifdef HAVE_THR_SETCONCURRENCY
/* purecov: begin tested */
static sys_var_const sys_thread_concurrency(&vars, "thread_concurrency",
@@ -649,6 +649,12 @@ static sys_var_long_ptr sys_table_cache_
&table_cache_size);
static sys_var_long_ptr sys_table_lock_wait_timeout(&vars, "table_lock_wait_timeout",
&table_lock_wait_timeout);
+
+#if defined(ENABLED_DEBUG_SYNC)
+/* Debug Sync Facility. Implemented in debug_sync.cc. */
+static sys_var_debug_sync sys_debug_sync(&vars, "debug_sync");
+#endif /* defined(ENABLED_DEBUG_SYNC) */
+
static sys_var_long_ptr sys_thread_cache_size(&vars, "thread_cache_size",
&thread_cache_size);
#if HAVE_POOL_OF_THREADS == 1
@@ -3446,8 +3452,7 @@ int set_var_init()
uint count= 0;
DBUG_ENTER("set_var_init");
- for (sys_var *var=vars.first; var; var= var->next, count++)
- ;
+ for (sys_var *var=vars.first; var; var= var->next, count++) ;
if (hash_init(&system_variable_hash, system_charset_info, count, 0,
0, (hash_get_key) get_sys_var_length, 0, HASH_UNIQUE))
@@ -4255,6 +4260,7 @@ end_with_read_lock:
}
+#ifndef DBUG_OFF
/* even session variable here requires SUPER, because of -#o,file */
bool sys_var_thd_dbug::check(THD *thd, set_var *var)
{
@@ -4302,6 +4308,8 @@ uchar *sys_var_thd_dbug::value_ptr(THD *
}
return (uchar*) thd->strdup(buf);
}
+#endif /* DBUG_OFF */
+
#ifdef HAVE_EVENT_SCHEDULER
bool sys_var_event_scheduler::check(THD *thd, set_var *var)
=== modified file 'sql/set_var.h'
--- a/sql/set_var.h 2009-09-15 10:46:35 +0000
+++ b/sql/set_var.h 2009-11-16 20:49:51 +0000
@@ -634,6 +634,7 @@ public:
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
+#ifndef DBUG_OFF
class sys_var_thd_dbug :public sys_var_thd
{
public:
@@ -647,8 +648,23 @@ public:
void set_default(THD *thd, enum_var_type type) { DBUG_POP(); }
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
};
+#endif /* DBUG_OFF */
-
+#if defined(ENABLED_DEBUG_SYNC)
+/* Debug Sync Facility. Implemented in debug_sync.cc. */
+class sys_var_debug_sync :public sys_var_thd
+{
+public:
+ sys_var_debug_sync(sys_var_chain *chain, const char *name_arg)
+ :sys_var_thd(name_arg)
+ { chain_sys_var(chain); }
+ bool check(THD *thd, set_var *var);
+ bool update(THD *thd, set_var *var);
+ SHOW_TYPE show_type() { return SHOW_CHAR; }
+ bool check_update_type(Item_result type) { return type != STRING_RESULT; }
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+};
+#endif /* defined(ENABLED_DEBUG_SYNC) */
/* some variables that require special handling */
=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt 2009-10-15 21:38:29 +0000
+++ b/sql/share/errmsg.txt 2009-11-16 20:49:51 +0000
@@ -4702,7 +4702,7 @@ ER_NOT_SUPPORTED_YET 42000
swe "Denna version av MySQL kan �u inte utf�'%s'"
ER_MASTER_FATAL_ERROR_READING_BINLOG
nla "Kreeg fatale fout %d: '%-.128s' van master tijdens lezen van data uit binaire log"
- eng "Got fatal error %d: '%-.128s' from master when reading data from binary log"
+ eng "Got fatal error %d from master when reading data from binary log: '%-.128s'"
ger "Schwerer Fehler %d: '%-.128s vom Master beim Lesen des bin�n Logs"
ita "Errore fatale %d: '%-.128s' dal master leggendo i dati dal log binario"
por "Obteve fatal erro %d: '%-.128s' do master quando lendo dados do binary log"
@@ -6206,3 +6206,10 @@ ER_TOO_MANY_CONCURRENT_TRXS
WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED
eng "Non-ASCII separator arguments are not fully supported"
+
+ER_DEBUG_SYNC_TIMEOUT
+ eng "debug sync point wait timed out"
+ ger "Debug Sync Point Wartezeit �hritten"
+ER_DEBUG_SYNC_HIT_LIMIT
+ eng "debug sync point hit limit reached"
+ ger "Debug Sync Point Hit Limit erreicht"
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc 2009-11-06 17:22:32 +0000
+++ b/sql/slave.cc 2009-11-16 20:49:51 +0000
@@ -1238,7 +1238,8 @@ static int create_table_from_dump(THD* t
thd->db = (char*)db;
DBUG_ASSERT(thd->db != 0);
thd->db_length= strlen(thd->db);
- mysql_parse(thd, thd->query, packet_len, &found_semicolon); // run create table
+ /* run create table */
+ mysql_parse(thd, thd->query(), packet_len, &found_semicolon);
thd->db = save_db; // leave things the way the were before
thd->db_length= save_db_length;
thd->options = save_options;
@@ -2033,8 +2034,7 @@ static int has_temporary_error(THD *thd)
@retval 2 No error calling ev->apply_event(), but error calling
ev->update_pos().
*/
-int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
- bool skip)
+int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli)
{
int exec_res= 0;
@@ -2079,37 +2079,33 @@ int apply_event_and_update_pos(Log_event
ev->when= my_time(0);
ev->thd = thd; // because up to this point, ev->thd == 0
- if (skip)
- {
- int reason= ev->shall_skip(rli);
- if (reason == Log_event::EVENT_SKIP_COUNT)
- --rli->slave_skip_counter;
- pthread_mutex_unlock(&rli->data_lock);
- if (reason == Log_event::EVENT_SKIP_NOT)
- exec_res= ev->apply_event(rli);
+ int reason= ev->shall_skip(rli);
+ if (reason == Log_event::EVENT_SKIP_COUNT)
+ --rli->slave_skip_counter;
+ pthread_mutex_unlock(&rli->data_lock);
+ if (reason == Log_event::EVENT_SKIP_NOT)
+ exec_res= ev->apply_event(rli);
+
#ifndef DBUG_OFF
- /*
- This only prints information to the debug trace.
+ /*
+ This only prints information to the debug trace.
- TODO: Print an informational message to the error log?
- */
- static const char *const explain[] = {
- // EVENT_SKIP_NOT,
- "not skipped",
- // EVENT_SKIP_IGNORE,
- "skipped because event should be ignored",
- // EVENT_SKIP_COUNT
- "skipped because event skip counter was non-zero"
- };
- DBUG_PRINT("info", ("OPTION_BEGIN: %d; IN_STMT: %d",
- thd->options & OPTION_BEGIN ? 1 : 0,
- rli->get_flag(Relay_log_info::IN_STMT)));
- DBUG_PRINT("skip_event", ("%s event was %s",
- ev->get_type_str(), explain[reason]));
+ TODO: Print an informational message to the error log?
+ */
+ static const char *const explain[] = {
+ // EVENT_SKIP_NOT,
+ "not skipped",
+ // EVENT_SKIP_IGNORE,
+ "skipped because event should be ignored",
+ // EVENT_SKIP_COUNT
+ "skipped because event skip counter was non-zero"
+ };
+ DBUG_PRINT("info", ("OPTION_BEGIN: %d; IN_STMT: %d",
+ thd->options & OPTION_BEGIN ? 1 : 0,
+ rli->get_flag(Relay_log_info::IN_STMT)));
+ DBUG_PRINT("skip_event", ("%s event was %s",
+ ev->get_type_str(), explain[reason]));
#endif
- }
- else
- exec_res= ev->apply_event(rli);
DBUG_PRINT("info", ("apply_event error = %d", exec_res));
if (exec_res == 0)
@@ -2229,7 +2225,7 @@ static int exec_relay_log_event(THD* thd
delete ev;
DBUG_RETURN(1);
}
- exec_res= apply_event_and_update_pos(ev, thd, rli, TRUE);
+ exec_res= apply_event_and_update_pos(ev, thd, rli);
/*
Format_description_log_event should not be deleted because it will be
@@ -2629,15 +2625,19 @@ Log entry on master is longer than max_a
slave. If the entry is correct, restart the server with a higher value of \
max_allowed_packet",
thd->variables.max_allowed_packet);
+ mi->report(ERROR_LEVEL, ER_NET_PACKET_TOO_LARGE,
+ "%s", ER(ER_NET_PACKET_TOO_LARGE));
goto err;
case ER_MASTER_FATAL_ERROR_READING_BINLOG:
- sql_print_error(ER(mysql_error_number), mysql_error_number,
- mysql_error(mysql));
+ mi->report(ERROR_LEVEL, ER_MASTER_FATAL_ERROR_READING_BINLOG,
+ ER(ER_MASTER_FATAL_ERROR_READING_BINLOG),
+ mysql_error_number, mysql_error(mysql));
goto err;
- case EE_OUTOFMEMORY:
- case ER_OUTOFMEMORY:
+ case ER_OUT_OF_RESOURCES:
sql_print_error("\
Stopping slave I/O thread due to out-of-memory error from master");
+ mi->report(ERROR_LEVEL, ER_OUT_OF_RESOURCES,
+ "%s", ER(ER_OUT_OF_RESOURCES));
goto err;
}
if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings,
@@ -2746,9 +2746,11 @@ err:
pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
pthread_mutex_unlock(&mi->run_lock);
+
+ DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
pthread_exit(0);
- DBUG_RETURN(0); // Can't return anything here
+ return 0; // Avoid compiler warnings
}
/*
@@ -3104,10 +3106,11 @@ the slave SQL thread with \"SLAVE START\
pthread_cond_broadcast(&rli->stop_cond);
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
pthread_mutex_unlock(&rli->run_lock); // tell the world we are done
-
+
+ DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
pthread_exit(0);
- DBUG_RETURN(0); // Can't return anything here
+ return 0; // Avoid compiler warnings
}
@@ -3705,7 +3708,7 @@ extern "C" void slave_io_thread_detach_v
{
#ifdef SIGNAL_WITH_VIO_CLOSE
THD *thd= current_thd;
- if (thd->slave_thread)
+ if (thd && thd->slave_thread)
thd->clear_active_vio();
#endif
}
=== modified file 'sql/slave.h'
--- a/sql/slave.h 2009-09-15 01:04:15 +0000
+++ b/sql/slave.h 2009-11-16 20:49:51 +0000
@@ -191,8 +191,7 @@ int purge_relay_logs(Relay_log_info* rli
void set_slave_thread_options(THD* thd);
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli);
void rotate_relay_log(Master_info* mi);
-int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
- bool skip);
+int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli);
pthread_handler_t handle_slave_io(void *arg);
pthread_handler_t handle_slave_sql(void *arg);
=== modified file 'sql/sp.cc'
--- a/sql/sp.cc 2009-07-28 22:39:58 +0000
+++ b/sql/sp.cc 2009-10-16 10:29:42 +0000
@@ -997,7 +997,7 @@ sp_drop_routine(THD *thd, int type, sp_n
if (ret == SP_OK)
{
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
sp_cache_invalidate();
}
@@ -1067,7 +1067,7 @@ sp_update_routine(THD *thd, int type, sp
if (ret == SP_OK)
{
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
sp_cache_invalidate();
}
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2009-09-15 10:46:35 +0000
+++ b/sql/sp_head.cc 2009-11-16 20:49:51 +0000
@@ -334,16 +334,18 @@ bool
sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
{
Item *expr_item;
+ enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
+ bool save_abort_on_warning= thd->abort_on_warning;
+ bool save_stmt_modified_non_trans_table=
+ thd->transaction.stmt.modified_non_trans_table;
DBUG_ENTER("sp_eval_expr");
if (!*expr_item_ptr)
- DBUG_RETURN(TRUE);
+ goto error;
if (!(expr_item= sp_prepare_func_item(thd, expr_item_ptr)))
- DBUG_RETURN(TRUE);
-
- bool err_status= FALSE;
+ goto error;
/*
Set THD flags to emit warnings/errors in case of overflow/type errors
@@ -352,10 +354,6 @@ sp_eval_expr(THD *thd, Field *result_fie
Save original values and restore them after save.
*/
- enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
- bool save_abort_on_warning= thd->abort_on_warning;
- bool save_stmt_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
-
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
thd->abort_on_warning=
thd->variables.sql_mode &
@@ -370,13 +368,18 @@ sp_eval_expr(THD *thd, Field *result_fie
thd->abort_on_warning= save_abort_on_warning;
thd->transaction.stmt.modified_non_trans_table= save_stmt_modified_non_trans_table;
- if (thd->is_error())
- {
- /* Return error status if something went wrong. */
- err_status= TRUE;
- }
+ if (!thd->is_error())
+ DBUG_RETURN(FALSE);
- DBUG_RETURN(err_status);
+error:
+ /*
+ In case of error during evaluation, leave the result field set to NULL.
+ Sic: we can't do it in the beginning of the function because the
+ result field might be needed for its own re-evaluation, e.g. case of
+ set x = x + 1;
+ */
+ result_field->set_null();
+ DBUG_RETURN (TRUE);
}
@@ -2824,8 +2827,8 @@ sp_instr_stmt::execute(THD *thd, uint *n
DBUG_ENTER("sp_instr_stmt::execute");
DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
- query= thd->query;
- query_length= thd->query_length;
+ query= thd->query();
+ query_length= thd->query_length();
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
/* This s-p instr is profilable and will be captured. */
thd->profiling.set_query_source(m_query.str, m_query.length);
@@ -2838,10 +2841,11 @@ sp_instr_stmt::execute(THD *thd, uint *n
queries with SP vars can't be cached)
*/
if (unlikely((thd->options & OPTION_LOG_OFF)==0))
- general_log_write(thd, COM_QUERY, thd->query, thd->query_length);
+ general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
if (query_cache_send_result_to_client(thd,
- thd->query, thd->query_length) <= 0)
+ thd->query(),
+ thd->query_length()) <= 0)
{
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_acl.cc 2009-11-16 20:49:51 +0000
@@ -263,8 +263,7 @@ my_bool acl_init(bool dont_read_acl_tabl
acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0,
(hash_get_key) acl_entry_get_key,
(hash_free_key) free,
- lower_case_file_system ?
- system_charset_info : &my_charset_bin);
+ &my_charset_utf8_bin);
if (dont_read_acl_tables)
{
DBUG_RETURN(0); /* purecov: tested */
@@ -2252,10 +2251,13 @@ public:
ulong sort;
size_t key_length;
GRANT_NAME(const char *h, const char *d,const char *u,
- const char *t, ulong p);
- GRANT_NAME (TABLE *form);
+ const char *t, ulong p, bool is_routine);
+ GRANT_NAME (TABLE *form, bool is_routine);
virtual ~GRANT_NAME() {};
virtual bool ok() { return privs != 0; }
+ void set_user_details(const char *h, const char *d,
+ const char *u, const char *t,
+ bool is_routine);
};
@@ -2273,38 +2275,48 @@ public:
};
-
-GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
- const char *t, ulong p)
- :privs(p)
+void GRANT_NAME::set_user_details(const char *h, const char *d,
+ const char *u, const char *t,
+ bool is_routine)
{
/* Host given by user */
update_hostname(&host, strdup_root(&memex, h));
- db = strdup_root(&memex,d);
+ if (db != d)
+ {
+ db= strdup_root(&memex, d);
+ if (lower_case_table_names)
+ my_casedn_str(files_charset_info, db);
+ }
user = strdup_root(&memex,u);
sort= get_sort(3,host.hostname,db,user);
- tname= strdup_root(&memex,t);
- if (lower_case_table_names)
+ if (tname != t)
{
- my_casedn_str(files_charset_info, db);
- my_casedn_str(files_charset_info, tname);
+ tname= strdup_root(&memex, t);
+ if (lower_case_table_names || is_routine)
+ my_casedn_str(files_charset_info, tname);
}
key_length= strlen(d) + strlen(u)+ strlen(t)+3;
hash_key= (char*) alloc_root(&memex,key_length);
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
}
+GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
+ const char *t, ulong p, bool is_routine)
+ :db(0), tname(0), privs(p)
+{
+ set_user_details(h, d, u, t, is_routine);
+}
GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
const char *t, ulong p, ulong c)
- :GRANT_NAME(h,d,u,t,p), cols(c)
+ :GRANT_NAME(h,d,u,t,p, FALSE), cols(c)
{
(void) hash_init2(&hash_columns,4,system_charset_info,
0,0,0, (hash_get_key) get_key_column,0,0);
}
-GRANT_NAME::GRANT_NAME(TABLE *form)
+GRANT_NAME::GRANT_NAME(TABLE *form, bool is_routine)
{
update_hostname(&host, get_field(&memex, form->field[0]));
db= get_field(&memex,form->field[1]);
@@ -2322,6 +2334,9 @@ GRANT_NAME::GRANT_NAME(TABLE *form)
if (lower_case_table_names)
{
my_casedn_str(files_charset_info, db);
+ }
+ if (lower_case_table_names || is_routine)
+ {
my_casedn_str(files_charset_info, tname);
}
key_length= (strlen(db) + strlen(user) + strlen(tname) + 3);
@@ -2333,7 +2348,7 @@ GRANT_NAME::GRANT_NAME(TABLE *form)
GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
- :GRANT_NAME(form)
+ :GRANT_NAME(form, FALSE)
{
uchar key[MAX_KEY_LENGTH];
@@ -3185,7 +3200,7 @@ int mysql_table_grant(THD *thd, TABLE_LI
if (!result) /* success */
{
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
rw_unlock(&LOCK_grant);
@@ -3328,7 +3343,7 @@ bool mysql_routine_grant(THD *thd, TABLE
}
grant_name= new GRANT_NAME(Str->host.str, db_name,
Str->user.str, table_name,
- rights);
+ rights, TRUE);
if (!grant_name)
{
result= TRUE;
@@ -3350,7 +3365,7 @@ bool mysql_routine_grant(THD *thd, TABLE
if (write_to_binlog)
{
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
rw_unlock(&LOCK_grant);
@@ -3462,7 +3477,7 @@ bool mysql_grant(THD *thd, const char *d
if (!result)
{
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
rw_unlock(&LOCK_grant);
@@ -3539,10 +3554,10 @@ static my_bool grant_load_procs_priv(TAB
MEM_ROOT **save_mem_root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**,
THR_MALLOC);
DBUG_ENTER("grant_load_procs_priv");
- (void) hash_init(&proc_priv_hash,system_charset_info,
+ (void) hash_init(&proc_priv_hash, &my_charset_utf8_bin,
0,0,0, (hash_get_key) get_grant_table,
0,0);
- (void) hash_init(&func_priv_hash,system_charset_info,
+ (void) hash_init(&func_priv_hash, &my_charset_utf8_bin,
0,0,0, (hash_get_key) get_grant_table,
0,0);
p_table->file->ha_index_init(0, 1);
@@ -3556,7 +3571,7 @@ static my_bool grant_load_procs_priv(TAB
{
GRANT_NAME *mem_check;
HASH *hash;
- if (!(mem_check=new (memex_ptr) GRANT_NAME(p_table)))
+ if (!(mem_check=new (memex_ptr) GRANT_NAME(p_table, TRUE)))
{
/* This could only happen if we are out memory */
goto end_unlock;
@@ -3640,7 +3655,7 @@ static my_bool grant_load(THD *thd, TABL
thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
- (void) hash_init(&column_priv_hash,system_charset_info,
+ (void) hash_init(&column_priv_hash, &my_charset_utf8_bin,
0,0,0, (hash_get_key) get_grant_table,
(hash_free_key) free_grant_table,0);
@@ -4073,8 +4088,7 @@ bool check_column_grant_in_table_ref(THD
db_name= table_ref->view_db.str;
table_name= table_ref->view_name.str;
if (table_ref->belong_to_view &&
- (thd->lex->sql_command == SQLCOM_SHOW_FIELDS ||
- thd->lex->sql_command == SQLCOM_SHOW_CREATE))
+ thd->lex->sql_command == SQLCOM_SHOW_FIELDS)
{
view_privs= get_column_grant(thd, grant, db_name, table_name, name);
if (view_privs & VIEW_ANY_ACL)
@@ -5438,9 +5452,21 @@ static int handle_grant_struct(uint stru
case 2:
case 3:
- grant_name->user= strdup_root(&mem, user_to->user.str);
- update_hostname(&grant_name->host,
- strdup_root(&mem, user_to->host.str));
+ /*
+ Update the grant structure with the new user name and
+ host name
+ */
+ grant_name->set_user_details(user_to->host.str, grant_name->db,
+ user_to->user.str, grant_name->tname,
+ TRUE);
+
+ /*
+ Since username is part of the hash key, when the user name
+ is renamed, the hash key is changed. Update the hash to
+ ensure that the position matches the new hash key value
+ */
+ hash_update(&column_priv_hash, (uchar*) grant_name,
+ (uchar*) grant_name->hash_key, grant_name->key_length);
break;
}
}
@@ -5663,7 +5689,7 @@ bool mysql_create_user(THD *thd, List <L
my_error(ER_CANNOT_USER, MYF(0), "CREATE USER", wrong_users.c_ptr_safe());
if (some_users_created)
- write_bin_log(thd, FALSE, thd->query, thd->query_length);
+ write_bin_log(thd, FALSE, thd->query(), thd->query_length());
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
@@ -5736,7 +5762,7 @@ bool mysql_drop_user(THD *thd, List <LEX
my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr_safe());
if (some_users_deleted)
- write_bin_log(thd, FALSE, thd->query, thd->query_length);
+ write_bin_log(thd, FALSE, thd->query(), thd->query_length());
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
@@ -5821,7 +5847,7 @@ bool mysql_rename_user(THD *thd, List <L
my_error(ER_CANNOT_USER, MYF(0), "RENAME USER", wrong_users.c_ptr_safe());
if (some_users_renamed && mysql_bin_log.is_open())
- write_bin_log(thd, FALSE, thd->query, thd->query_length);
+ write_bin_log(thd, FALSE, thd->query(), thd->query_length());
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
@@ -6003,7 +6029,7 @@ bool mysql_revoke_all(THD *thd, List <L
VOID(pthread_mutex_unlock(&acl_cache->lock));
- write_bin_log(thd, FALSE, thd->query, thd->query_length);
+ write_bin_log(thd, FALSE, thd->query(), thd->query_length());
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
@@ -6117,7 +6143,7 @@ bool sp_revoke_privileges(THD *thd, cons
for (counter= 0, revoked= 0 ; counter < hash->records ; )
{
GRANT_NAME *grant_proc= (GRANT_NAME*) hash_element(hash, counter);
- if (!my_strcasecmp(system_charset_info, grant_proc->db, sp_db) &&
+ if (!my_strcasecmp(&my_charset_utf8_bin, grant_proc->db, sp_db) &&
!my_strcasecmp(system_charset_info, grant_proc->tname, sp_name))
{
LEX_USER lex_user;
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_base.cc 2009-11-16 20:49:51 +0000
@@ -17,6 +17,7 @@
/* Basic functions needed by many modules */
#include "mysql_priv.h"
+#include "debug_sync.h"
#include "sql_select.h"
#include "sp_head.h"
#include "sp.h"
@@ -24,6 +25,7 @@
#include <m_ctype.h>
#include <my_dir.h>
#include <hash.h>
+#include "rpl_filter.h"
#ifdef __WIN__
#include <io.h>
#endif
@@ -106,7 +108,7 @@ static bool open_new_frm(THD *thd, TABLE
static void close_old_data_files(THD *thd, TABLE *table, bool morph_locks,
bool send_refresh);
static bool
-has_two_write_locked_tables_with_auto_increment(TABLE_LIST *tables);
+has_write_table_with_auto_increment(TABLE_LIST *tables);
extern "C" uchar *table_cache_key(const uchar *record, size_t *length,
@@ -950,6 +952,7 @@ bool close_cached_tables(THD *thd, TABLE
close_old_data_files(thd,thd->open_tables,1,1);
mysql_ha_flush(thd);
+ DEBUG_SYNC(thd, "after_flush_unlock");
bool found=1;
/* Wait until all threads has closed all the tables we had locked */
@@ -1545,6 +1548,7 @@ void close_temporary_tables(THD *thd)
s_query.length() - 1 /* to remove trailing ',' */,
0, FALSE, 0);
qinfo.db= db.ptr();
+ qinfo.db_len= db.length();
thd->variables.character_set_client= cs_save;
mysql_bin_log.write(&qinfo);
thd->variables.pseudo_thread_id= save_pseudo_thread_id;
@@ -2306,7 +2310,8 @@ bool reopen_name_locked_table(THD* thd,
table->tablenr=thd->current_tablenr++;
table->used_fields=0;
table->const_table=0;
- table->null_row= table->maybe_null= table->force_index= 0;
+ table->null_row= table->maybe_null= 0;
+ table->force_index= table->force_index_order= table->force_index_group= 0;
table->status=STATUS_NO_RECORD;
DBUG_RETURN(FALSE);
}
@@ -2964,7 +2969,8 @@ TABLE *open_table(THD *thd, TABLE_LIST *
table->tablenr=thd->current_tablenr++;
table->used_fields=0;
table->const_table=0;
- table->null_row= table->maybe_null= table->force_index= 0;
+ table->null_row= table->maybe_null= 0;
+ table->force_index= table->force_index_order= table->force_index_group= 0;
table->status=STATUS_NO_RECORD;
table->insert_values= 0;
table->fulltext_searched= 0;
@@ -5112,7 +5118,16 @@ static void mark_real_tables_as_free_for
int decide_logging_format(THD *thd, TABLE_LIST *tables)
{
- if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG))
+ /*
+ In SBR mode, we are only proceeding if we are binlogging this
+ statement, ie, the filtering rules won't later filter this out.
+
+ This check here is needed to prevent some spurious error to be
+ raised in some cases (See BUG#42829).
+ */
+ if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG) &&
+ (thd->variables.binlog_format != BINLOG_FORMAT_STMT ||
+ binlog_filter->db_ok(thd->db)))
{
/*
Compute the starting vectors for the computations by creating a
@@ -5295,18 +5310,22 @@ int lock_tables(THD *thd, TABLE_LIST *ta
thd->in_lock_tables=1;
thd->options|= OPTION_TABLE_LOCK;
/*
- If we have >= 2 different tables to update with auto_inc columns,
- statement-based binlogging won't work. We can solve this problem in
- mixed mode by switching to row-based binlogging:
- */
- if (thd->variables.binlog_format == BINLOG_FORMAT_MIXED &&
- has_two_write_locked_tables_with_auto_increment(tables))
+ A query that modifies autoinc column in sub-statement can make the
+ master and slave inconsistent.
+ We can solve these problems in mixed mode by switching to binlogging
+ if at least one updated table is used by sub-statement
+ */
+ /* The BINLOG_FORMAT_MIXED judgement is saved for suppressing
+ warnings, but it will be removed by fixing bug#45827 */
+ if (thd->variables.binlog_format == BINLOG_FORMAT_MIXED && tables &&
+ has_write_table_with_auto_increment(thd->lex->first_not_own_table()))
{
thd->lex->set_stmt_unsafe();
- thd->set_current_stmt_binlog_row_based_if_mixed();
}
}
+ DEBUG_SYNC(thd, "before_lock_tables_takes_lock");
+
if (! (thd->lock= mysql_lock_tables(thd, start, (uint) (ptr - start),
lock_flag, need_reopen)))
{
@@ -8830,47 +8849,31 @@ void mysql_wait_completed_table(ALTER_PA
/*
- Tells if two (or more) tables have auto_increment columns and we want to
- lock those tables with a write lock.
+ Check if one (or more) write tables have auto_increment columns.
- SYNOPSIS
- has_two_write_locked_tables_with_auto_increment
- tables Table list
+ @param[in] tables Table list
+
+ @retval 0 if at least one write tables has an auto_increment column
+ @retval 1 otherwise
NOTES:
Call this function only when you have established the list of all tables
which you'll want to update (including stored functions, triggers, views
inside your statement).
-
- RETURN
- 0 No
- 1 Yes
*/
static bool
-has_two_write_locked_tables_with_auto_increment(TABLE_LIST *tables)
+has_write_table_with_auto_increment(TABLE_LIST *tables)
{
- char *first_table_name= NULL, *first_db;
- LINT_INIT(first_db);
-
for (TABLE_LIST *table= tables; table; table= table->next_global)
{
/* we must do preliminary checks as table->table may be NULL */
if (!table->placeholder() &&
table->table->found_next_number_field &&
(table->lock_type >= TL_WRITE_ALLOW_WRITE))
- {
- if (first_table_name == NULL)
- {
- first_table_name= table->table_name;
- first_db= table->db;
- DBUG_ASSERT(first_db);
- }
- else if (strcmp(first_db, table->db) ||
- strcmp(first_table_name, table->table_name))
- return 1;
- }
+ return 1;
}
+
return 0;
}
=== modified file 'sql/sql_binlog.cc'
--- a/sql/sql_binlog.cc 2009-05-06 12:03:24 +0000
+++ b/sql/sql_binlog.cc 2009-11-16 20:49:51 +0000
@@ -56,17 +56,20 @@ void mysql_client_binlog_statement(THD*
Format_description_event.
*/
my_bool have_fd_event= TRUE;
- if (!thd->rli_fake)
+ int err;
+ Relay_log_info *rli;
+ rli= thd->rli_fake;
+ if (!rli)
{
- thd->rli_fake= new Relay_log_info;
+ rli= thd->rli_fake= new Relay_log_info;
#ifdef HAVE_valgrind
- thd->rli_fake->is_fake= TRUE;
+ rli->is_fake= TRUE;
#endif
have_fd_event= FALSE;
}
- if (thd->rli_fake && !thd->rli_fake->relay_log.description_event_for_exec)
+ if (rli && !rli->relay_log.description_event_for_exec)
{
- thd->rli_fake->relay_log.description_event_for_exec=
+ rli->relay_log.description_event_for_exec=
new Format_description_log_event(4);
have_fd_event= FALSE;
}
@@ -78,16 +81,16 @@ void mysql_client_binlog_statement(THD*
/*
Out of memory check
*/
- if (!(thd->rli_fake &&
- thd->rli_fake->relay_log.description_event_for_exec &&
+ if (!(rli &&
+ rli->relay_log.description_event_for_exec &&
buf))
{
my_error(ER_OUTOFMEMORY, MYF(0), 1); /* needed 1 bytes */
goto end;
}
- thd->rli_fake->sql_thd= thd;
- thd->rli_fake->no_storage= TRUE;
+ rli->sql_thd= thd;
+ rli->no_storage= TRUE;
for (char const *strptr= thd->lex->comment.str ;
strptr < thd->lex->comment.str + thd->lex->comment.length ; )
@@ -170,8 +173,7 @@ void mysql_client_binlog_statement(THD*
}
ev= Log_event::read_log_event(bufptr, event_len, &error,
- thd->rli_fake->relay_log.
- description_event_for_exec);
+ rli->relay_log.description_event_for_exec);
DBUG_PRINT("info",("binlog base64 err=%s", error));
if (!ev)
@@ -209,18 +211,10 @@ void mysql_client_binlog_statement(THD*
reporting.
*/
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- if (apply_event_and_update_pos(ev, thd, thd->rli_fake, FALSE))
- {
- delete ev;
- /*
- TODO: Maybe a better error message since the BINLOG statement
- now contains several events.
- */
- my_error(ER_UNKNOWN_ERROR, MYF(0), "Error executing BINLOG statement");
- goto end;
- }
+ err= ev->apply_event(rli);
+#else
+ err= 0;
#endif
-
/*
Format_description_log_event should not be deleted because it
will be used to read info about the relay log's format; it
@@ -228,8 +222,17 @@ void mysql_client_binlog_statement(THD*
i.e. when this thread terminates.
*/
if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
- delete ev;
+ delete ev;
ev= 0;
+ if (err)
+ {
+ /*
+ TODO: Maybe a better error message since the BINLOG statement
+ now contains several events.
+ */
+ my_error(ER_UNKNOWN_ERROR, MYF(0), "Error executing BINLOG statement");
+ goto end;
+ }
}
}
@@ -238,7 +241,7 @@ void mysql_client_binlog_statement(THD*
my_ok(thd);
end:
- thd->rli_fake->clear_tables_to_lock();
+ rli->clear_tables_to_lock();
my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
DBUG_VOID_RETURN;
}
=== modified file 'sql/sql_cache.cc'
--- a/sql/sql_cache.cc 2009-10-26 11:35:42 +0000
+++ b/sql/sql_cache.cc 2009-11-16 20:49:51 +0000
@@ -1119,8 +1119,8 @@ void Query_cache::store_query(THD *thd,
DBUG_VOID_RETURN;
uint8 tables_type= 0;
- if ((local_tables= is_cacheable(thd, thd->query_length,
- thd->query, thd->lex, tables_used,
+ if ((local_tables= is_cacheable(thd, thd->query_length(),
+ thd->query(), thd->lex, tables_used,
&tables_type)))
{
NET *net= &thd->net;
@@ -1210,7 +1210,8 @@ def_week_frmt: %lu, in_trans: %d, autoco
/* Key is query + database + flag */
if (thd->db_length)
{
- memcpy(thd->query+thd->query_length+1, thd->db, thd->db_length);
+ memcpy(thd->query() + thd->query_length() + 1, thd->db,
+ thd->db_length);
DBUG_PRINT("qcache", ("database: %s length: %u",
thd->db, (unsigned) thd->db_length));
}
@@ -1218,24 +1219,24 @@ def_week_frmt: %lu, in_trans: %d, autoco
{
DBUG_PRINT("qcache", ("No active database"));
}
- tot_length= thd->query_length + thd->db_length + 1 +
+ tot_length= thd->query_length() + thd->db_length + 1 +
QUERY_CACHE_FLAGS_SIZE;
/*
We should only copy structure (don't use it location directly)
because of alignment issue
*/
- memcpy((void *)(thd->query + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
+ memcpy((void*) (thd->query() + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
&flags, QUERY_CACHE_FLAGS_SIZE);
/* Check if another thread is processing the same query? */
Query_cache_block *competitor = (Query_cache_block *)
- hash_search(&queries, (uchar*) thd->query, tot_length);
+ hash_search(&queries, (uchar*) thd->query(), tot_length);
DBUG_PRINT("qcache", ("competitor 0x%lx", (ulong) competitor));
if (competitor == 0)
{
/* Query is not in cache and no one is working with it; Store it */
Query_cache_block *query_block;
- query_block= write_block_data(tot_length, (uchar*) thd->query,
+ query_block= write_block_data(tot_length, (uchar*) thd->query(),
ALIGN_SIZE(sizeof(Query_cache_query)),
Query_cache_block::QUERY, local_tables);
if (query_block != 0)
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2009-09-15 10:46:35 +0000
+++ b/sql/sql_class.cc 2009-11-16 20:49:51 +0000
@@ -42,6 +42,7 @@
#include "sp_rcontext.h"
#include "sp_cache.h"
+#include "debug_sync.h"
/*
The following is used to initialise Table_ident with a internal
@@ -378,14 +379,14 @@ char *thd_security_context(THD *thd, cha
str.append(proc_info);
}
- if (thd->query)
+ if (thd->query())
{
if (max_query_len < 1)
- len= thd->query_length;
+ len= thd->query_length();
else
- len= min(thd->query_length, max_query_len);
+ len= min(thd->query_length(), max_query_len);
str.append('\n');
- str.append(thd->query, len);
+ str.append(thd->query(), len);
}
if (str.c_ptr_safe() == buffer)
return buffer;
@@ -402,6 +403,31 @@ char *thd_security_context(THD *thd, cha
return buffer;
}
+
+/**
+ Implementation of Drop_table_error_handler::handle_error().
+ The reason in having this implementation is to silence technical low-level
+ warnings during DROP TABLE operation. Currently we don't want to expose
+ the following warnings during DROP TABLE:
+ - Some of table files are missed or invalid (the table is going to be
+ deleted anyway, so why bother that something was missed);
+ - A trigger associated with the table does not have DEFINER (One of the
+ MySQL specifics now is that triggers are loaded for the table being
+ dropped. So, we may have a warning that trigger does not have DEFINER
+ attribute during DROP TABLE operation).
+
+ @return TRUE if the condition is handled.
+*/
+bool Drop_table_error_handler::handle_error(uint sql_errno,
+ const char *message,
+ MYSQL_ERROR::enum_warning_level level,
+ THD *thd)
+{
+ return ((sql_errno == EE_DELETE && my_errno == ENOENT) ||
+ sql_errno == ER_TRG_NO_DEFINER);
+}
+
+
/**
Clear this diagnostics area.
@@ -564,6 +590,9 @@ THD::THD()
derived_tables_processing(FALSE),
spcont(NULL),
m_parser_state(NULL)
+#if defined(ENABLED_DEBUG_SYNC)
+ , debug_sync_control(0)
+#endif /* defined(ENABLED_DEBUG_SYNC) */
{
ulong tmp;
@@ -702,17 +731,13 @@ void THD::push_internal_handler(Internal
bool THD::handle_error(uint sql_errno, const char *message,
MYSQL_ERROR::enum_warning_level level)
{
- if (!m_internal_handler)
- return FALSE;
-
for (Internal_error_handler *error_handler= m_internal_handler;
error_handler;
error_handler= m_internal_handler->m_prev_internal_handler)
{
if (error_handler->handle_error(sql_errno, message, level, this))
- return TRUE;
+ return TRUE;
}
-
return FALSE;
}
@@ -818,6 +843,11 @@ void THD::init(void)
reset_current_stmt_binlog_row_based();
bzero((char *) &status_var, sizeof(status_var));
sql_log_bin_toplevel= options & OPTION_BIN_LOG;
+
+#if defined(ENABLED_DEBUG_SYNC)
+ /* Initialize the Debug Sync Facility. See debug_sync.cc. */
+ debug_sync_init_thread(this);
+#endif /* defined(ENABLED_DEBUG_SYNC) */
}
@@ -898,6 +928,12 @@ void THD::cleanup(void)
close_thread_tables(this);
}
wt_thd_destroy(&transaction.wt);
+
+#if defined(ENABLED_DEBUG_SYNC)
+ /* End the Debug Sync Facility. See debug_sync.cc. */
+ debug_sync_end_thread(this);
+#endif /* defined(ENABLED_DEBUG_SYNC) */
+
mysql_ha_cleanup(this);
delete_dynamic(&user_var_events);
hash_free(&user_vars);
@@ -2449,12 +2485,12 @@ Statement::Statement(LEX *lex_arg, MEM_R
id(id_arg),
mark_used_columns(MARK_COLUMNS_READ),
lex(lex_arg),
- query(0),
- query_length(0),
cursor(0),
db(NULL),
db_length(0)
{
+ query_string.length= 0;
+ query_string.str= NULL;
name.str= NULL;
}
@@ -2470,8 +2506,7 @@ void Statement::set_statement(Statement
id= stmt->id;
mark_used_columns= stmt->mark_used_columns;
lex= stmt->lex;
- query= stmt->query;
- query_length= stmt->query_length;
+ query_string= stmt->query_string;
cursor= stmt->cursor;
}
@@ -2495,6 +2530,15 @@ void Statement::restore_backup_statement
}
+/** Assign a new value to thd->query. */
+
+void Statement::set_query_inner(char *query_arg, uint32 query_length_arg)
+{
+ query_string.str= query_arg;
+ query_string.length= query_length_arg;
+}
+
+
void THD::end_statement()
{
/* Cleanup SQL processing state to reuse this statement in next query. */
@@ -2730,9 +2774,11 @@ bool select_dumpvar::send_data(List<Item
else
{
Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item);
- suv->fix_fields(thd, 0);
+ if (suv->fix_fields(thd, 0))
+ DBUG_RETURN (1);
suv->save_item_result(item);
- suv->update();
+ if (suv->update())
+ DBUG_RETURN (1);
}
}
DBUG_RETURN(thd->is_error());
@@ -3008,9 +3054,24 @@ extern "C" struct charset_info_st *thd_c
return(thd->charset());
}
+/**
+ OBSOLETE : there's no way to ensure the string is null terminated.
+ Use thd_query_string instead()
+*/
extern "C" char **thd_query(MYSQL_THD thd)
{
- return(&thd->query);
+ return(&thd->query_string.str);
+}
+
+/**
+ Get the current query string for the thread.
+
+ @param The MySQL internal thread pointer
+ @return query string and length. May be non-null-terminated.
+*/
+extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd)
+{
+ return(&thd->query_string);
}
extern "C" int thd_slave_thread(const MYSQL_THD thd)
@@ -3035,6 +3096,11 @@ extern "C" void thd_mark_transaction_to_
{
mark_transaction_to_rollback(thd, all);
}
+
+extern "C" bool thd_binlog_filter_ok(const MYSQL_THD thd)
+{
+ return binlog_filter->db_ok(thd->db);
+}
#endif // INNODB_COMPATIBILITY_HOOKS */
/****************************************************************************
@@ -3191,8 +3257,7 @@ void THD::set_statement(Statement *stmt)
void THD::set_query(char *query_arg, uint32 query_length_arg)
{
pthread_mutex_lock(&LOCK_thd_data);
- query= query_arg;
- query_length= query_length_arg;
+ set_query_inner(query_arg, query_length_arg);
pthread_mutex_unlock(&LOCK_thd_data);
}
@@ -3210,6 +3275,16 @@ void mark_transaction_to_rollback(THD *t
{
thd->is_fatal_sub_stmt_error= TRUE;
thd->transaction_rollback_request= all;
+ /*
+ Aborted transactions can not be IGNOREd.
+ Switch off the IGNORE flag for the current
+ SELECT_LEX. This should allow my_error()
+ to report the error and abort the execution
+ flow, even in presence
+ of IGNORE clause.
+ */
+ if (thd->lex->current_select)
+ thd->lex->current_select->no_error= FALSE;
}
}
/***************************************************************************
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2009-09-15 10:46:35 +0000
+++ b/sql/sql_class.h 2009-11-16 20:49:51 +0000
@@ -95,6 +95,8 @@ extern char internal_table_name[2];
extern char empty_c_string[1];
extern MYSQL_PLUGIN_IMPORT const char **errmesg;
+extern bool volatile shutdown_in_progress;
+
#define TC_LOG_PAGE_SIZE 8192
#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
@@ -652,10 +654,13 @@ public:
This printing is needed at least in SHOW PROCESSLIST and SHOW
ENGINE INNODB STATUS.
*/
- char *query;
- uint32 query_length; // current query length
+ LEX_STRING query_string;
Server_side_cursor *cursor;
+ inline char *query() { return query_string.str; }
+ inline uint32 query_length() { return query_string.length; }
+ void set_query_inner(char *query_arg, uint32 query_length_arg);
+
/**
Name of the current (default) database.
@@ -1103,6 +1108,31 @@ public:
/**
+ This class is an internal error handler implementation for
+ DROP TABLE statements. The thing is that there may be warnings during
+ execution of these statements, which should not be exposed to the user.
+ This class is intended to silence such warnings.
+*/
+
+class Drop_table_error_handler : public Internal_error_handler
+{
+public:
+ Drop_table_error_handler(Internal_error_handler *err_handler)
+ :m_err_handler(err_handler)
+ { }
+
+public:
+ bool handle_error(uint sql_errno,
+ const char *message,
+ MYSQL_ERROR::enum_warning_level level,
+ THD *thd);
+
+private:
+ Internal_error_handler *m_err_handler;
+};
+
+
+/**
Stores status of the currently executed statement.
Cleared at the beginning of the statement, and then
can hold either OK, ERROR, or EOF status.
@@ -1888,6 +1918,11 @@ public:
partition_info *work_part_info;
#endif
+#if defined(ENABLED_DEBUG_SYNC)
+ /* Debug Sync facility. See debug_sync.cc. */
+ struct st_debug_sync_control *debug_sync_control;
+#endif /* defined(ENABLED_DEBUG_SYNC) */
+
THD();
~THD();
@@ -2124,7 +2159,11 @@ public:
{
int err= killed_errno();
if (err)
+ {
+ if ((err == KILL_CONNECTION) && !shutdown_in_progress)
+ err = KILL_QUERY;
my_message(err, ER(err), MYF(0));
+ }
}
/* return TRUE if we will abort query if we make a warning now */
inline bool really_abort_on_warning()
@@ -2641,7 +2680,32 @@ public:
ENGINE_COLUMNDEF *recinfo, *start_recinfo;
KEY *keyinfo;
ha_rows end_write_records;
- uint field_count,sum_func_count,func_count;
+ /**
+ Number of normal fields in the query, including those referred to
+ from aggregate functions. Hence, "SELECT `field1`,
+ SUM(`field2`) from t1" sets this counter to 2.
+
+ @see count_field_types
+ */
+ uint field_count;
+ /**
+ Number of fields in the query that have functions. Includes both
+ aggregate functions (e.g., SUM) and non-aggregates (e.g., RAND).
+ Also counts functions referred to from aggregate functions, i.e.,
+ "SELECT SUM(RAND())" sets this counter to 2.
+
+ @see count_field_types
+ */
+ uint func_count;
+ /**
+ Number of fields in the query that have aggregate functions. Note
+ that the optimizer may choose to optimize away these fields by
+ replacing them with constants, in which case sum_func_count will
+ need to be updated.
+
+ @see opt_sum_query, count_field_types
+ */
+ uint sum_func_count;
uint hidden_field_count;
uint group_parts,group_length,group_null_parts;
uint quick_group;
@@ -2906,7 +2970,8 @@ public:
bool send_data(List<Item> &items);
bool initialize_tables (JOIN *join);
void send_error(uint errcode,const char *err);
- int do_deletes();
+ int do_deletes();
+ int do_table_deletes(TABLE *table, bool ignore);
bool send_eof();
virtual void abort();
};
=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_db.cc 2009-11-16 20:49:51 +0000
@@ -703,7 +703,7 @@ not_silent:
char *query;
uint query_length;
- if (!thd->query) // Only in replication
+ if (!thd->query()) // Only in replication
{
query= tmp_query;
query_length= (uint) (strxmov(tmp_query,"create database `",
@@ -711,8 +711,8 @@ not_silent:
}
else
{
- query= thd->query;
- query_length= thd->query_length;
+ query= thd->query();
+ query_length= thd->query_length();
}
ha_binlog_log_query(thd, 0, LOGCOM_CREATE_DB,
@@ -805,13 +805,13 @@ bool mysql_alter_db(THD *thd, const char
}
ha_binlog_log_query(thd, 0, LOGCOM_ALTER_DB,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
db, "");
if (mysql_bin_log.is_open())
{
int errcode= query_error_code(thd, TRUE);
- Query_log_event qinfo(thd, thd->query, thd->query_length, 0,
+ Query_log_event qinfo(thd, thd->query(), thd->query_length(), 0,
/* suppress_use */ TRUE, errcode);
/*
@@ -907,6 +907,9 @@ bool mysql_rm_db(THD *thd,char *db,bool
remove_db_from_cache(db);
pthread_mutex_unlock(&LOCK_open);
+ Drop_table_error_handler err_handler(thd->get_internal_handler());
+ thd->push_internal_handler(&err_handler);
+
error= -1;
/*
We temporarily disable the binary log while dropping the objects
@@ -939,12 +942,13 @@ bool mysql_rm_db(THD *thd,char *db,bool
error = 0;
reenable_binlog(thd);
}
+ thd->pop_internal_handler();
}
if (!silent && deleted>=0)
{
const char *query;
ulong query_length;
- if (!thd->query)
+ if (!thd->query())
{
/* The client used the old obsolete mysql_drop_db() call */
query= path;
@@ -953,8 +957,8 @@ bool mysql_rm_db(THD *thd,char *db,bool
}
else
{
- query =thd->query;
- query_length= thd->query_length;
+ query= thd->query();
+ query_length= thd->query_length();
}
if (mysql_bin_log.is_open())
{
@@ -1444,7 +1448,7 @@ static inline bool
cmp_db_names(const char *db1_name,
const char *db2_name)
{
- return ((!db1_name && !db2_name) || /* db1 is NULL and db2 is NULL */
+ return ((!db1_name && !db2_name) ||
(db1_name && db2_name &&
my_strcasecmp(system_charset_info, db1_name, db2_name) == 0));
}
@@ -1956,7 +1960,7 @@ bool mysql_upgrade_db(THD *thd, LEX_STRI
if (mysql_bin_log.is_open())
{
int errcode= query_error_code(thd, TRUE);
- Query_log_event qinfo(thd, thd->query, thd->query_length,
+ Query_log_event qinfo(thd, thd->query(), thd->query_length(),
0, TRUE, errcode);
thd->clear_error();
mysql_bin_log.write(&qinfo);
=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_delete.cc 2009-11-16 20:49:51 +0000
@@ -413,7 +413,7 @@ cleanup:
therefore be treated as a DDL.
*/
int log_result= thd->binlog_query(query_type,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
is_trans, FALSE, errcode);
if (log_result)
@@ -850,7 +850,7 @@ void multi_delete::abort()
{
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
thd->binlog_query(THD::ROW_QUERY_TYPE,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
transactional_tables, FALSE, errcode);
}
thd->transaction.all.modified_non_trans_table= true;
@@ -860,22 +860,19 @@ void multi_delete::abort()
-/*
+/**
Do delete from other tables.
- Returns values:
- 0 ok
- 1 error
+
+ @retval 0 ok
+ @retval 1 error
+
+ @todo Is there any reason not use the normal nested-loops join? If not, and
+ there is no documentation supporting it, this method and callee should be
+ removed and there should be hooks within normal execution.
*/
int multi_delete::do_deletes()
{
- int local_error= 0, counter= 0, tmp_error;
- bool will_batch;
- /*
- If the IGNORE option is used all non fatal errors will be translated
- to warnings and we should not break the row-by-row iteration
- */
- bool ignore= thd->lex->current_select->no_error;
DBUG_ENTER("do_deletes");
DBUG_ASSERT(do_delete);
@@ -886,79 +883,108 @@ int multi_delete::do_deletes()
table_being_deleted= (delete_while_scanning ? delete_tables->next_local :
delete_tables);
- for (; table_being_deleted;
+ for (uint counter= 0; table_being_deleted;
table_being_deleted= table_being_deleted->next_local, counter++)
{
- ha_rows last_deleted= deleted;
TABLE *table = table_being_deleted->table;
if (tempfiles[counter]->get(table))
+ DBUG_RETURN(1);
+
+ int local_error=
+ do_table_deletes(table, thd->lex->current_select->no_error);
+
+ if (thd->killed && !local_error)
+ DBUG_RETURN(1);
+
+ if (local_error == -1) // End of file
+ local_error = 0;
+
+ if (local_error)
+ DBUG_RETURN(local_error);
+ }
+ DBUG_RETURN(0);
+}
+
+
+/**
+ Implements the inner loop of nested-loops join within multi-DELETE
+ execution.
+
+ @param table The table from which to delete.
+
+ @param ignore If used, all non fatal errors will be translated
+ to warnings and we should not break the row-by-row iteration.
+
+ @return Status code
+
+ @retval 0 All ok.
+ @retval 1 Triggers or handler reported error.
+ @retval -1 End of file from handler.
+*/
+int multi_delete::do_table_deletes(TABLE *table, bool ignore)
+{
+ int local_error= 0;
+ READ_RECORD info;
+ ha_rows last_deleted= deleted;
+ DBUG_ENTER("do_deletes_for_table");
+ init_read_record(&info, thd, table, NULL, 0, 1, FALSE);
+ /*
+ Ignore any rows not found in reference tables as they may already have
+ been deleted by foreign key handling
+ */
+ info.ignore_not_found_rows= 1;
+ bool will_batch= !table->file->start_bulk_delete();
+ while (!(local_error= info.read_record(&info)) && !thd->killed)
+ {
+ if (table->triggers &&
+ table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
+ TRG_ACTION_BEFORE, FALSE))
{
- local_error=1;
+ local_error= 1;
break;
}
-
- READ_RECORD info;
- init_read_record(&info, thd, table, NULL, 0, 1, FALSE);
+
+ local_error= table->file->ha_delete_row(table->record[0]);
+ if (local_error && !ignore)
+ {
+ table->file->print_error(local_error, MYF(0));
+ break;
+ }
+
/*
- Ignore any rows not found in reference tables as they may already have
- been deleted by foreign key handling
+ Increase the reported number of deleted rows only if no error occurred
+ during ha_delete_row.
+ Also, don't execute the AFTER trigger if the row operation failed.
*/
- info.ignore_not_found_rows= 1;
- will_batch= !table->file->start_bulk_delete();
- while (!(local_error=info.read_record(&info)) && !thd->killed)
+ if (!local_error)
{
+ deleted++;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
- TRG_ACTION_BEFORE, FALSE))
+ TRG_ACTION_AFTER, FALSE))
{
local_error= 1;
break;
}
-
- local_error= table->file->ha_delete_row(table->record[0]);
- if (local_error && !ignore)
- {
- table->file->print_error(local_error,MYF(0));
- break;
- }
-
- /*
- Increase the reported number of deleted rows only if no error occurred
- during ha_delete_row.
- Also, don't execute the AFTER trigger if the row operation failed.
- */
- if (!local_error)
- {
- deleted++;
- if (table->triggers &&
- table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
- TRG_ACTION_AFTER, FALSE))
- {
- local_error= 1;
- break;
- }
- }
}
- if (will_batch && (tmp_error= table->file->end_bulk_delete()))
+ }
+ if (will_batch)
+ {
+ int tmp_error= table->file->end_bulk_delete();
+ if (tmp_error && !local_error)
{
- if (!local_error)
- {
- local_error= tmp_error;
- table->file->print_error(local_error,MYF(0));
- }
+ local_error= tmp_error;
+ table->file->print_error(local_error, MYF(0));
}
- if (last_deleted != deleted && !table->file->has_transactions())
- thd->transaction.stmt.modified_non_trans_table= TRUE;
- end_read_record(&info);
- if (thd->killed && !local_error)
- local_error= 1;
- if (local_error == -1) // End of file
- local_error = 0;
}
+ if (last_deleted != deleted && !table->file->has_transactions())
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
+
+ end_read_record(&info);
+
DBUG_RETURN(local_error);
}
-
/*
Send ok to the client
@@ -998,7 +1024,7 @@ bool multi_delete::send_eof()
else
errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
transactional_tables, FALSE, errcode) &&
!normal_tables)
{
@@ -1144,7 +1170,7 @@ end:
TRUNCATE must always be statement-based binlogged (not row-based) so
we don't test current_stmt_binlog_row_based.
*/
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
my_ok(thd); // This should return record count
}
VOID(pthread_mutex_lock(&LOCK_open));
=== modified file 'sql/sql_handler.cc'
--- a/sql/sql_handler.cc 2009-07-15 23:23:57 +0000
+++ b/sql/sql_handler.cc 2009-09-17 15:25:52 +0000
@@ -422,16 +422,13 @@ bool mysql_ha_read(THD *thd, TABLE_LIST
String buffer(buff, sizeof(buff), system_charset_info);
int error, keyno= -1;
uint num_rows;
- uchar *key;
- uint key_len;
+ uchar *UNINIT_VAR(key);
+ uint UNINIT_VAR(key_len);
bool need_reopen;
DBUG_ENTER("mysql_ha_read");
DBUG_PRINT("enter",("'%s'.'%s' as '%s'",
tables->db, tables->table_name, tables->alias));
- LINT_INIT(key);
- LINT_INIT(key_len);
-
thd->lex->select_lex.context.resolve_in_table_list_only(tables);
list.push_front(new Item_field(&thd->lex->select_lex.context,
NULL, NULL, "*"));
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2009-11-07 10:34:19 +0000
+++ b/sql/sql_insert.cc 2009-11-16 20:49:51 +0000
@@ -589,7 +589,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
Name_resolution_context *context;
Name_resolution_context_state ctx_state;
#ifndef EMBEDDED_LIBRARY
- char *query= thd->query;
+ char *query= thd->query();
/*
log_on is about delayed inserts only.
By default, both logs are enabled (this won't cause problems if the server
@@ -826,7 +826,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
#ifndef EMBEDDED_LIBRARY
if (lock_type == TL_WRITE_DELAYED)
{
- LEX_STRING const st_query = { query, thd->query_length };
+ LEX_STRING const st_query = { query, thd->query_length() };
error=write_delayed(thd, table, duplic, st_query, ignore, log_on);
query=0;
}
@@ -919,7 +919,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
*/
DBUG_ASSERT(thd->killed != THD::KILL_BAD_DATA || error > 0);
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
transactional_table, FALSE,
errcode))
{
@@ -1791,7 +1791,7 @@ public:
pthread_cond_destroy(&cond);
pthread_cond_destroy(&cond_client);
thd.unlink(); // Must be unlinked under lock
- x_free(thd.query);
+ x_free(thd.query());
thd.security_ctx->user= thd.security_ctx->host=0;
thread_count--;
delayed_insert_threads--;
@@ -1937,7 +1937,7 @@ bool delayed_get_table(THD *thd, TABLE_L
pthread_mutex_unlock(&LOCK_thread_count);
di->thd.set_db(table_list->db, (uint) strlen(table_list->db));
di->thd.set_query(my_strdup(table_list->table_name, MYF(MY_WME)), 0);
- if (di->thd.db == NULL || di->thd.query == NULL)
+ if (di->thd.db == NULL || di->thd.query() == NULL)
{
/* The error is reported */
delete di;
@@ -1946,7 +1946,7 @@ bool delayed_get_table(THD *thd, TABLE_L
}
di->table_list= *table_list; // Needed to open table
/* Replace volatile strings with local copies */
- di->table_list.alias= di->table_list.table_name= di->thd.query;
+ di->table_list.alias= di->table_list.table_name= di->thd.query();
di->table_list.db= di->thd.db;
di->lock();
pthread_mutex_lock(&di->mutex);
@@ -2302,44 +2302,9 @@ void kill_delayed_threads(void)
}
-/*
- * Create a new delayed insert thread
-*/
-
-pthread_handler_t handle_delayed_insert(void *arg)
+static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di)
{
- Delayed_insert *di=(Delayed_insert*) arg;
- THD *thd= &di->thd;
-
- pthread_detach_this_thread();
- /* Add thread to THD list so that's it's visible in 'show processlist' */
- pthread_mutex_lock(&LOCK_thread_count);
- thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
- thd->set_current_time();
- threads.append(thd);
- thd->killed=abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED;
- pthread_mutex_unlock(&LOCK_thread_count);
-
- /*
- Wait until the client runs into pthread_cond_wait(),
- where we free it after the table is opened and di linked in the list.
- If we did not wait here, the client might detect the opened table
- before it is linked to the list. It would release LOCK_delayed_create
- and allow another thread to create another handler for the same table,
- since it does not find one in the list.
- */
- pthread_mutex_lock(&di->mutex);
-#if !defined( __WIN__) /* Win32 calls this in pthread_create */
- if (my_thread_init())
- {
- /* Can't use my_error since store_globals has not yet been called */
- thd->main_da.set_error_status(thd, ER_OUT_OF_RESOURCES,
- ER(ER_OUT_OF_RESOURCES));
- goto end;
- }
-#endif
-
- DBUG_ENTER("handle_delayed_insert");
+ DBUG_ENTER("handle_delayed_insert_impl");
thd->thread_stack= (char*) &thd;
if (init_thr_lock() || thd->store_globals())
{
@@ -2528,6 +2493,49 @@ err:
*/
ha_autocommit_or_rollback(thd, 1);
+ DBUG_VOID_RETURN;
+}
+
+
+/*
+ * Create a new delayed insert thread
+*/
+
+pthread_handler_t handle_delayed_insert(void *arg)
+{
+ Delayed_insert *di=(Delayed_insert*) arg;
+ THD *thd= &di->thd;
+
+ pthread_detach_this_thread();
+ /* Add thread to THD list so that's it's visible in 'show processlist' */
+ pthread_mutex_lock(&LOCK_thread_count);
+ thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
+ thd->set_current_time();
+ threads.append(thd);
+ thd->killed=abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED;
+ pthread_mutex_unlock(&LOCK_thread_count);
+
+ /*
+ Wait until the client runs into pthread_cond_wait(),
+ where we free it after the table is opened and di linked in the list.
+ If we did not wait here, the client might detect the opened table
+ before it is linked to the list. It would release LOCK_delayed_create
+ and allow another thread to create another handler for the same table,
+ since it does not find one in the list.
+ */
+ pthread_mutex_lock(&di->mutex);
+#if !defined( __WIN__) /* Win32 calls this in pthread_create */
+ if (my_thread_init())
+ {
+ /* Can't use my_error since store_globals has not yet been called */
+ thd->main_da.set_error_status(thd, ER_OUT_OF_RESOURCES,
+ ER(ER_OUT_OF_RESOURCES));
+ goto end;
+ }
+#endif
+
+ handle_delayed_insert_impl(thd, di);
+
#ifndef __WIN__
end:
#endif
@@ -2552,7 +2560,8 @@ end:
my_thread_end();
pthread_exit(0);
- DBUG_RETURN(0);
+
+ return 0;
}
@@ -3269,7 +3278,7 @@ bool select_insert::send_eof()
else
errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
thd->binlog_query(THD::ROW_QUERY_TYPE,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
trans_table, FALSE, errcode);
}
table->file->ha_release_auto_increment();
@@ -3339,7 +3348,8 @@ void select_insert::abort() {
if (mysql_bin_log.is_open())
{
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
- thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length,
+ thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(),
+ thd->query_length(),
transactional_table, FALSE, errcode);
}
if (!thd->current_stmt_binlog_row_based && !can_rollback_data())
@@ -3633,7 +3643,7 @@ select_create::prepare(List<Item> &value
DBUG_EXECUTE_IF("sleep_create_select_before_check_if_exists", my_sleep(6000000););
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
- create_table->table->db_stat)
+ (create_table->table && create_table->table->db_stat))
{
/* Table already exists and was open at open_and_lock_tables() stage. */
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h 2009-09-15 10:46:35 +0000
+++ b/sql/sql_lex.h 2009-11-16 20:49:51 +0000
@@ -1735,13 +1735,6 @@ typedef struct st_lex : public Query_tab
const char *stmt_definition_end;
- /*
- Pointers to part of LOAD DATA statement that should be rewritten
- during replication ("LOCAL 'filename' REPLACE INTO" part).
- */
- const char *fname_start;
- const char *fname_end;
-
/**
During name resolution search only in the table list given by
Name_resolution_context::first_name_resolution_table and
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2009-09-07 20:50:10 +0000
+++ b/sql/sql_load.cc 2009-11-16 20:49:51 +0000
@@ -83,10 +83,13 @@ static int read_sep_field(THD *thd, COPY
String &enclosed, ulong skip_lines,
bool ignore_check_option_errors);
#ifndef EMBEDDED_LIBRARY
-static bool write_execute_load_query_log_event(THD *thd,
- bool duplicates, bool ignore,
- bool transactional_table,
- int errcode);
+static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
+ const char* db_arg, /* table's database */
+ const char* table_name_arg,
+ enum enum_duplicates duplicates,
+ bool ignore,
+ bool transactional_table,
+ int errocode);
#endif /* EMBEDDED_LIBRARY */
/*
@@ -497,8 +500,11 @@ int mysql_load(THD *thd,sql_exchange *ex
int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
if (thd->transaction.stmt.modified_non_trans_table)
- write_execute_load_query_log_event(thd, handle_duplicates,
- ignore, transactional_table,
+ write_execute_load_query_log_event(thd, ex,
+ table_list->db,
+ table_list->table_name,
+ handle_duplicates, ignore,
+ transactional_table,
errcode);
else
{
@@ -542,8 +548,11 @@ int mysql_load(THD *thd,sql_exchange *ex
if (lf_info.wrote_create_file)
{
int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
- write_execute_load_query_log_event(thd, handle_duplicates, ignore,
- transactional_table, errcode);
+ write_execute_load_query_log_event(thd, ex,
+ table_list->db, table_list->table_name,
+ handle_duplicates, ignore,
+ transactional_table,
+ errcode);
}
}
}
@@ -564,15 +573,113 @@ err:
#ifndef EMBEDDED_LIBRARY
/* Not a very useful function; just to avoid duplication of code */
-static bool write_execute_load_query_log_event(THD *thd,
- bool duplicates, bool ignore,
- bool transactional_table,
+static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
+ const char* db_arg, /* table's database */
+ const char* table_name_arg,
+ enum enum_duplicates duplicates,
+ bool ignore,
+ bool transactional_table,
int errcode)
{
+ char *load_data_query,
+ *end,
+ *fname_start,
+ *fname_end,
+ *p= NULL;
+ size_t pl= 0;
+ List<Item> fv;
+ Item *item, *val;
+ String pfield, pfields;
+ int n;
+ const char *tbl= table_name_arg;
+ const char *tdb= (thd->db != NULL ? thd->db : db_arg);
+ String string_buf;
+
+ if (!thd->db || strcmp(db_arg, thd->db))
+ {
+ /*
+ If used database differs from table's database,
+ prefix table name with database name so that it
+ becomes a FQ name.
+ */
+ string_buf.set_charset(system_charset_info);
+ string_buf.append(db_arg);
+ string_buf.append("`");
+ string_buf.append(".");
+ string_buf.append("`");
+ string_buf.append(table_name_arg);
+ tbl= string_buf.c_ptr_safe();
+ }
+
+ Load_log_event lle(thd, ex, tdb, tbl, fv, duplicates,
+ ignore, transactional_table);
+
+ /*
+ force in a LOCAL if there was one in the original.
+ */
+ if (thd->lex->local_file)
+ lle.set_fname_outside_temp_buf(ex->file_name, strlen(ex->file_name));
+
+ /*
+ prepare fields-list and SET if needed; print_query won't do that for us.
+ */
+ if (!thd->lex->field_list.is_empty())
+ {
+ List_iterator<Item> li(thd->lex->field_list);
+
+ pfields.append(" (");
+ n= 0;
+
+ while ((item= li++))
+ {
+ if (n++)
+ pfields.append(", ");
+ if (item->name)
+ pfields.append(item->name);
+ else
+ item->print(&pfields, QT_ORDINARY);
+ }
+ pfields.append(")");
+ }
+
+ if (!thd->lex->update_list.is_empty())
+ {
+ List_iterator<Item> lu(thd->lex->update_list);
+ List_iterator<Item> lv(thd->lex->value_list);
+
+ pfields.append(" SET ");
+ n= 0;
+
+ while ((item= lu++))
+ {
+ val= lv++;
+ if (n++)
+ pfields.append(", ");
+ pfields.append(item->name);
+ pfields.append("=");
+ val->print(&pfields, QT_ORDINARY);
+ }
+ }
+
+ p= pfields.c_ptr_safe();
+ pl= strlen(p);
+
+ if (!(load_data_query= (char *)thd->alloc(lle.get_query_buffer_length() + 1 + pl)))
+ return TRUE;
+
+ lle.print_query(FALSE, (const char *) ex->cs?ex->cs->csname:NULL,
+ load_data_query, &end,
+ (char **)&fname_start, (char **)&fname_end);
+
+ strcpy(end, p);
+ end += pl;
+
+ thd->set_query_inner(load_data_query, end - load_data_query);
+
Execute_load_query_log_event
- e(thd, thd->query, thd->query_length,
- (uint) ((char*)thd->lex->fname_start - (char*)thd->query),
- (uint) ((char*)thd->lex->fname_end - (char*)thd->query),
+ e(thd, thd->query(), thd->query_length(),
+ (uint) ((char*) fname_start - (char*) thd->query() - 1),
+ (uint) ((char*) fname_end - (char*) thd->query()),
(duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
(ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
transactional_table, FALSE, errcode);
=== modified file 'sql/sql_locale.cc'
--- a/sql/sql_locale.cc 2008-12-23 14:21:01 +0000
+++ b/sql/sql_locale.cc 2009-10-19 08:41:52 +0000
@@ -1309,9 +1309,9 @@ static const char *my_locale_month_names
static const char *my_locale_ab_month_names_ro_RO[13] =
{"ian","feb","mar","apr","mai","iun","iul","aug","sep","oct","nov","dec", NullS };
static const char *my_locale_day_names_ro_RO[8] =
- {"Luni","Marţi","Miercuri","Joi","Vineri","SîmbĂtĂ","DuminicĂ", NullS };
+ {"Luni","Marţi","Miercuri","Joi","Vineri","Sâmbătă","Duminică", NullS };
static const char *my_locale_ab_day_names_ro_RO[8] =
- {"Lu","Ma","Mi","Jo","Vi","Sî","Du", NullS };
+ {"Lu","Ma","Mi","Jo","Vi","Sâ","Du", NullS };
static TYPELIB my_locale_typelib_month_names_ro_RO =
{ array_elements(my_locale_month_names_ro_RO)-1, "", my_locale_month_names_ro_RO, NULL };
static TYPELIB my_locale_typelib_ab_month_names_ro_RO =
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2009-11-06 17:22:32 +0000
+++ b/sql/sql_parse.cc 2009-11-16 20:49:51 +0000
@@ -126,6 +126,14 @@ static bool xa_trans_rolled_back(XID_STA
*/
static bool xa_trans_rollback(THD *thd)
{
+ /*
+ Resource Manager error is meaningless at this point, as we perform
+ explicit rollback request by user. We must reset rm_error before
+ calling ha_rollback(), so thd->transaction.xid structure gets reset
+ by ha_rollback()/THD::transaction::cleanup().
+ */
+ thd->transaction.xid_state.rm_error= 0;
+
bool status= test(ha_rollback(thd));
thd->options&= ~(ulong) OPTION_BEGIN;
@@ -133,7 +141,6 @@ static bool xa_trans_rollback(THD *thd)
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
xid_cache_delete(&thd->transaction.xid_state);
thd->transaction.xid_state.xa_state= XA_NOTR;
- thd->transaction.xid_state.rm_error= 0;
return status;
}
@@ -415,29 +422,12 @@ void execute_init_command(THD *thd, sys_
}
-/**
- Execute commands from bootstrap_file.
-
- Used when creating the initial grant tables.
-*/
-
-pthread_handler_t handle_bootstrap(void *arg)
+static void handle_bootstrap_impl(THD *thd)
{
- THD *thd=(THD*) arg;
FILE *file=bootstrap_file;
char *buff;
const char* found_semicolon= NULL;
- /* The following must be called before DBUG_ENTER */
- thd->thread_stack= (char*) &thd;
- if (my_thread_init() || thd->store_globals())
- {
-#ifndef EMBEDDED_LIBRARY
- close_connection(thd, ER_OUT_OF_RESOURCES, 1);
-#endif
- thd->fatal_error();
- goto end;
- }
DBUG_ENTER("handle_bootstrap");
#ifndef EMBEDDED_LIBRARY
@@ -505,10 +495,10 @@ pthread_handler_t handle_bootstrap(void
thd->db_length + 1 +
QUERY_CACHE_FLAGS_SIZE);
thd->set_query(query, length);
- DBUG_PRINT("query",("%-.4096s",thd->query));
+ DBUG_PRINT("query",("%-.4096s", thd->query()));
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.start_new_query();
- thd->profiling.set_query_source(thd->query, length);
+ thd->profiling.set_query_source(thd->query(), length);
#endif
/*
@@ -517,7 +507,7 @@ pthread_handler_t handle_bootstrap(void
*/
thd->query_id=next_query_id();
thd->set_time();
- mysql_parse(thd, thd->query, length, & found_semicolon);
+ mysql_parse(thd, thd->query(), length, & found_semicolon);
close_thread_tables(thd); // Free tables
bootstrap_error= thd->is_error();
@@ -536,6 +526,33 @@ pthread_handler_t handle_bootstrap(void
#endif
}
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Execute commands from bootstrap_file.
+
+ Used when creating the initial grant tables.
+*/
+
+pthread_handler_t handle_bootstrap(void *arg)
+{
+ THD *thd=(THD*) arg;
+
+ /* The following must be called before DBUG_ENTER */
+ thd->thread_stack= (char*) &thd;
+ if (my_thread_init() || thd->store_globals())
+ {
+#ifndef EMBEDDED_LIBRARY
+ close_connection(thd, ER_OUT_OF_RESOURCES, 1);
+#endif
+ thd->fatal_error();
+ goto end;
+ }
+
+ handle_bootstrap_impl(thd);
+
end:
net_end(&thd->net);
thd->cleanup();
@@ -550,7 +567,8 @@ end:
my_thread_end();
pthread_exit(0);
#endif
- DBUG_RETURN(0);
+
+ return 0;
}
@@ -1211,20 +1229,20 @@ bool dispatch_command(enum enum_server_c
{
if (alloc_query(thd, packet, packet_length))
break; // fatal error is set
- char *packet_end= thd->query + thd->query_length;
+ char *packet_end= thd->query() + thd->query_length();
/* 'b' stands for 'buffer' parameter', special for 'my_snprintf' */
const char* end_of_stmt= NULL;
- general_log_write(thd, command, thd->query, thd->query_length);
- DBUG_PRINT("query",("%-.4096s",thd->query));
+ general_log_write(thd, command, thd->query(), thd->query_length());
+ DBUG_PRINT("query",("%-.4096s",thd->query()));
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
- thd->profiling.set_query_source(thd->query, thd->query_length);
+ thd->profiling.set_query_source(thd->query(), thd->query_length());
#endif
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
- mysql_parse(thd, thd->query, thd->query_length, &end_of_stmt);
+ mysql_parse(thd, thd->query(), thd->query_length(), &end_of_stmt);
while (!thd->killed && (end_of_stmt != NULL) && ! thd->is_error())
{
@@ -1436,7 +1454,28 @@ bool dispatch_command(enum enum_server_c
if (check_global_access(thd,RELOAD_ACL))
break;
general_log_print(thd, command, NullS);
- if (!reload_acl_and_cache(thd, options, (TABLE_LIST*) 0, ¬_used))
+#ifndef DBUG_OFF
+ bool debug_simulate= FALSE;
+ DBUG_EXECUTE_IF("simulate_detached_thread_refresh", debug_simulate= TRUE;);
+ if (debug_simulate)
+ {
+ /*
+ Simulate a reload without a attached thread session.
+ Provides a environment similar to that of when the
+ server receives a SIGHUP signal and reloads caches
+ and flushes tables.
+ */
+ bool res;
+ my_pthread_setspecific_ptr(THR_THD, NULL);
+ res= reload_acl_and_cache(NULL, options | REFRESH_FAST,
+ NULL, ¬_used);
+ my_pthread_setspecific_ptr(THR_THD, thd);
+ if (!res)
+ my_ok(thd);
+ break;
+ }
+#endif
+ if (!reload_acl_and_cache(thd, options, NULL, ¬_used))
my_ok(thd);
break;
}
@@ -1672,7 +1711,8 @@ void log_slow_statement(THD *thd)
{
thd_proc_info(thd, "logging slow query");
thd->status_var.long_query_count++;
- slow_log_print(thd, thd->query, thd->query_length, end_utime_of_query);
+ slow_log_print(thd, thd->query(), thd->query_length(),
+ end_utime_of_query);
}
}
DBUG_VOID_RETURN;
@@ -2990,7 +3030,7 @@ end_with_restore_list:
/*
Presumably, REPAIR and binlog writing doesn't require synchronization
*/
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
select_lex->table_list.first= (uchar*) first_table;
lex->query_tables=all_tables;
@@ -3024,7 +3064,7 @@ end_with_restore_list:
/*
Presumably, ANALYZE and binlog writing doesn't require synchronization
*/
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
select_lex->table_list.first= (uchar*) first_table;
lex->query_tables=all_tables;
@@ -3048,7 +3088,7 @@ end_with_restore_list:
/*
Presumably, OPTIMIZE and binlog writing doesn't require synchronization
*/
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
select_lex->table_list.first= (uchar*) first_table;
lex->query_tables=all_tables;
@@ -4000,7 +4040,7 @@ end_with_restore_list:
*/
if (!lex->no_write_to_binlog && write_to_binlog)
{
- write_bin_log(thd, FALSE, thd->query, thd->query_length);
+ write_bin_log(thd, FALSE, thd->query(), thd->query_length());
}
my_ok(thd);
}
@@ -4577,7 +4617,7 @@ create_sp_error:
case SP_KEY_NOT_FOUND:
if (lex->drop_if_exists)
{
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST),
SP_COM_STRING(lex), lex->spname->m_name.str);
@@ -5107,8 +5147,6 @@ bool check_single_table_access(THD *thd,
/* Show only 1 table for check_grant */
if (!(all_tables->belong_to_view &&
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
- !(all_tables->view &&
- all_tables->effective_algorithm == VIEW_ALGORITHM_TMPTABLE) &&
check_grant(thd, privilege, all_tables, 0, 1, no_errors))
goto deny;
@@ -5970,9 +6008,10 @@ void mysql_parse(THD *thd, const char *i
PROCESSLIST.
Note that we don't need LOCK_thread_count to modify query_length.
*/
- if (*found_semicolon &&
- (thd->query_length= (ulong)(*found_semicolon - thd->query)))
- thd->query_length--;
+ if (*found_semicolon && (ulong) (*found_semicolon - thd->query()))
+ thd->set_query_inner(thd->query(),
+ (uint32) (*found_semicolon -
+ thd->query() - 1));
/* Actually execute the query */
if (*found_semicolon)
{
@@ -6278,6 +6317,7 @@ TABLE_LIST *st_select_lex::add_table_to_
ptr->table_name_length=table->table.length;
ptr->lock_type= lock_type;
ptr->updating= test(table_options & TL_OPTION_UPDATING);
+ /* TODO: remove TL_OPTION_FORCE_INDEX as it looks like it's not used */
ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX);
ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES);
ptr->derived= table->sel;
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_partition.cc 2009-11-16 20:49:51 +0000
@@ -4077,7 +4077,7 @@ static int fast_end_partition(THD *thd,
if ((!is_empty) && (!written_bin_log) &&
(!thd->lex->no_write_to_binlog))
- write_bin_log(thd, FALSE, thd->query, thd->query_length);
+ write_bin_log(thd, FALSE, thd->query(), thd->query_length());
my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO),
(ulong) (copied + deleted),
@@ -6235,7 +6235,7 @@ uint fast_alter_partition_table(THD *thd
ERROR_INJECT_CRASH("crash_drop_partition_5") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
- thd->query, thd->query_length), FALSE)) ||
+ thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_drop_partition_6") ||
((frm_install= TRUE), FALSE) ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
@@ -6302,7 +6302,7 @@ uint fast_alter_partition_table(THD *thd
ERROR_INJECT_CRASH("crash_add_partition_5") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
- thd->query, thd->query_length), FALSE)) ||
+ thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_add_partition_6") ||
write_log_rename_frm(lpt) ||
(not_completed= FALSE) ||
@@ -6392,7 +6392,7 @@ uint fast_alter_partition_table(THD *thd
ERROR_INJECT_CRASH("crash_change_partition_6") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
- thd->query, thd->query_length), FALSE)) ||
+ thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_change_partition_7") ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
ERROR_INJECT_CRASH("crash_change_partition_8") ||
@@ -7209,4 +7209,3 @@ void create_subpartition_name(char *out,
"#SP#", transl_subpart_name, "#REN#", NullS);
}
#endif
-
=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc 2009-10-29 00:04:56 +0000
+++ b/sql/sql_plugin.cc 2009-11-16 20:49:51 +0000
@@ -1536,7 +1536,7 @@ error:
void plugin_shutdown(void)
{
- uint i, count= plugin_array.elements, free_slots= 0;
+ uint i, count= plugin_array.elements;
struct st_plugin_int **plugins, *plugin;
struct st_plugin_dl **dl;
DBUG_ENTER("plugin_shutdown");
@@ -1557,18 +1557,13 @@ void plugin_shutdown(void)
while (reap_needed && (count= plugin_array.elements))
{
reap_plugins();
- for (i= free_slots= 0; i < count; i++)
+ for (i= 0; i < count; i++)
{
plugin= *dynamic_element(&plugin_array, i, struct st_plugin_int **);
- switch (plugin->state) {
- case PLUGIN_IS_READY:
+ if (plugin->state == PLUGIN_IS_READY)
+ {
plugin->state= PLUGIN_IS_DELETED;
reap_needed= true;
- break;
- case PLUGIN_IS_FREED:
- case PLUGIN_IS_UNINITIALIZED:
- free_slots++;
- break;
}
}
if (!reap_needed)
@@ -1581,9 +1576,6 @@ void plugin_shutdown(void)
}
}
- if (count > free_slots && global_system_variables.log_warnings > 1)
- sql_print_warning("Forcing shutdown of %d plugins", count - free_slots);
-
plugins= (struct st_plugin_int **) my_alloca(sizeof(void*) * (count+1));
/*
@@ -1605,8 +1597,8 @@ void plugin_shutdown(void)
if (!(plugins[i]->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_FREED |
PLUGIN_IS_DISABLED)))
{
- sql_print_information("Plugin '%s' will be forced to shutdown",
- plugins[i]->name.str);
+ sql_print_warning("Plugin '%s' will be forced to shutdown",
+ plugins[i]->name.str);
/*
We are forcing deinit on plugins so we don't want to do a ref_count
check until we have processed all the plugins.
@@ -2090,7 +2082,7 @@ static int check_func_set(THD *thd, stru
const char *strvalue= "NULL", *str;
TYPELIB *typelib;
ulonglong result;
- uint error_len;
+ uint error_len= 0; // init as only set on error
bool not_used;
int length;
@@ -2689,7 +2681,9 @@ uchar* sys_var_pluginvar::value_ptr(THD
{
if (!(value & mask))
continue;
- str.append(typelib->type_names[i], typelib->type_lengths[i]);
+ str.append(typelib->type_names[i], typelib->type_lengths
+ ? typelib->type_lengths[i]
+ : strlen(typelib->type_names[i]));
str.append(',');
}
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_prepare.cc 2009-11-16 20:49:51 +0000
@@ -752,7 +752,7 @@ static bool insert_params_with_log(Prepa
const String *res;
DBUG_ENTER("insert_params_with_log");
- if (query->copy(stmt->query, stmt->query_length, default_charset_info))
+ if (query->copy(stmt->query(), stmt->query_length(), default_charset_info))
DBUG_RETURN(1);
for (Item_param **it= begin; it < end; ++it)
@@ -914,7 +914,7 @@ static bool emb_insert_params_with_log(P
DBUG_ENTER("emb_insert_params_with_log");
- if (query->copy(stmt->query, stmt->query_length, default_charset_info))
+ if (query->copy(stmt->query(), stmt->query_length(), default_charset_info))
DBUG_RETURN(1);
for (; it < end; ++it, ++client_param)
@@ -1065,7 +1065,7 @@ static bool insert_params_from_vars_with
DBUG_ENTER("insert_params_from_vars");
- if (query->copy(stmt->query, stmt->query_length, default_charset_info))
+ if (query->copy(stmt->query(), stmt->query_length(), default_charset_info))
DBUG_RETURN(1);
for (Item_param **it= begin; it < end; ++it)
@@ -2346,6 +2346,9 @@ void reinit_stmt_before_use(THD *thd, LE
/* Fix ORDER list */
for (order= (ORDER *)sl->order_list.first; order; order= order->next)
order->item= &order->item_ptr;
+
+ /* clear the no_error flag for INSERT/UPDATE IGNORE */
+ sl->no_error= FALSE;
}
{
SELECT_LEX_UNIT *unit= sl->master_unit();
@@ -2461,9 +2464,9 @@ void mysqld_stmt_execute(THD *thd, char
}
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
- thd->profiling.set_query_source(stmt->query, stmt->query_length);
+ thd->profiling.set_query_source(stmt->query(), stmt->query_length());
#endif
- DBUG_PRINT("exec_query", ("%s", stmt->query));
+ DBUG_PRINT("exec_query", ("%s", stmt->query()));
DBUG_PRINT("info",("stmt: 0x%lx", (long) stmt));
sp_cache_flush_obsolete(&thd->sp_proc_cache);
@@ -3032,7 +3035,7 @@ bool Prepared_statement::prepare(const c
old_stmt_arena= thd->stmt_arena;
thd->stmt_arena= this;
- Parser_state parser_state(thd, thd->query, thd->query_length);
+ Parser_state parser_state(thd, thd->query(), thd->query_length());
parser_state.m_lip.stmt_prepare_mode= TRUE;
lex_start(thd);
@@ -3121,7 +3124,7 @@ bool Prepared_statement::prepare(const c
the general log.
*/
if (thd->spcont == NULL)
- general_log_write(thd, COM_STMT_PREPARE, query, query_length);
+ general_log_write(thd, COM_STMT_PREPARE, query(), query_length());
}
DBUG_RETURN(error);
}
@@ -3312,7 +3315,7 @@ Prepared_statement::reprepare()
return TRUE;
error= ((name.str && copy.set_name(&name)) ||
- copy.prepare(query, query_length) ||
+ copy.prepare(query(), query_length()) ||
validate_metadata(©));
if (cur_db_changed)
@@ -3550,8 +3553,7 @@ bool Prepared_statement::execute(String
to point at it even after we restore from backup. This is ok, as
expanded query was allocated in thd->mem_root.
*/
- stmt_backup.query= thd->query;
- stmt_backup.query_length= thd->query_length;
+ stmt_backup.set_query_inner(thd->query(), thd->query_length());
/*
At first execution of prepared statement we may perform logical
@@ -3576,8 +3578,8 @@ bool Prepared_statement::execute(String
Note that multi-statements cannot exist here (they are not supported in
prepared statements).
*/
- if (query_cache_send_result_to_client(thd, thd->query,
- thd->query_length) <= 0)
+ if (query_cache_send_result_to_client(thd, thd->query(),
+ thd->query_length()) <= 0)
{
error= mysql_execute_command(thd);
}
@@ -3622,7 +3624,7 @@ bool Prepared_statement::execute(String
the general log.
*/
if (error == 0 && thd->spcont == NULL)
- general_log_write(thd, COM_STMT_EXECUTE, thd->query, thd->query_length);
+ general_log_write(thd, COM_STMT_EXECUTE, thd->query(), thd->query_length());
error:
flags&= ~ (uint) IS_IN_USE;
=== modified file 'sql/sql_rename.cc'
--- a/sql/sql_rename.cc 2009-06-19 08:24:43 +0000
+++ b/sql/sql_rename.cc 2009-10-16 10:29:42 +0000
@@ -177,7 +177,7 @@ bool mysql_rename_tables(THD *thd, TABLE
/* Lets hope this doesn't fail as the result will be messy */
if (!silent && !error)
{
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
my_ok(thd);
}
=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc 2009-09-07 20:50:10 +0000
+++ b/sql/sql_repl.cc 2009-11-16 20:49:51 +0000
@@ -623,7 +623,7 @@ impossible position";
*/
{
log.error=0;
- bool read_packet = 0, fatal_error = 0;
+ bool read_packet = 0;
#ifndef DBUG_OFF
if (max_binlog_dump_events && !left_events--)
@@ -645,7 +645,7 @@ impossible position";
*/
pthread_mutex_lock(log_lock);
- switch (Log_event::read_log_event(&log, packet, (pthread_mutex_t*)0)) {
+ switch (error= Log_event::read_log_event(&log, packet, (pthread_mutex_t*) 0)) {
case 0:
/* we read successfully, so we'll need to send it to the slave */
pthread_mutex_unlock(log_lock);
@@ -671,8 +671,8 @@ impossible position";
default:
pthread_mutex_unlock(log_lock);
- fatal_error = 1;
- break;
+ test_for_non_eof_log_read_errors(error, &errmsg);
+ goto err;
}
if (read_packet)
@@ -701,12 +701,6 @@ impossible position";
*/
}
- if (fatal_error)
- {
- errmsg = "error reading log entry";
- my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
- goto err;
- }
log.error=0;
}
}
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-11-06 17:22:32 +0000
+++ b/sql/sql_select.cc 2009-11-16 20:49:51 +0000
@@ -159,6 +159,7 @@ static int join_read_const_table(JOIN_TA
static int join_read_system(JOIN_TAB *tab);
static int join_read_const(JOIN_TAB *tab);
static int join_read_key(JOIN_TAB *tab);
+static void join_read_key_unlock_row(st_join_table *tab);
static int join_read_always_key(JOIN_TAB *tab);
static int join_read_last_key(JOIN_TAB *tab);
static int join_no_more_records(READ_RECORD *info);
@@ -643,6 +644,18 @@ JOIN::prepare(Item ***rref_pointer_array
MYF(0)); /* purecov: inspected */
goto err; /* purecov: inspected */
}
+ if (thd->lex->derived_tables)
+ {
+ my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE",
+ thd->lex->derived_tables & DERIVED_VIEW ?
+ "view" : "subquery");
+ goto err;
+ }
+ if (thd->lex->sql_command != SQLCOM_SELECT)
+ {
+ my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "non-SELECT");
+ goto err;
+ }
}
if (!procedure && result && result->prepare(fields_list, unit_arg))
@@ -654,8 +667,11 @@ JOIN::prepare(Item ***rref_pointer_array
this->group= group_list != 0;
unit= unit_arg;
+ if (tmp_table_param.sum_func_count && !group_list)
+ implicit_grouping= TRUE;
+
#ifdef RESTRICTED_GROUP
- if (sum_func_count && !group_list && (func_count || field_count))
+ if (implicit_grouping)
{
my_message(ER_WRONG_SUM_SELECT,ER(ER_WRONG_SUM_SELECT),MYF(0));
goto err;
@@ -891,15 +907,23 @@ JOIN::optimize()
}
#endif
- /* Optimize count(*), min() and max() */
- if (tables_list && tmp_table_param.sum_func_count && ! group_list)
+ /*
+ Try to optimize count(*), min() and max() to const fields if
+ there is implicit grouping (aggregate functions but no
+ group_list). In this case, the result set shall only contain one
+ row.
+ */
+ if (tables_list && implicit_grouping)
{
int res;
/*
opt_sum_query() returns HA_ERR_KEY_NOT_FOUND if no rows match
to the WHERE conditions,
- or 1 if all items were resolved,
+ or 1 if all items were resolved (optimized away),
or 0, or an error number HA_ERR_...
+
+ If all items were resolved by opt_sum_query, there is no need to
+ open any tables.
*/
if ((res=opt_sum_query(select_lex->leaf_tables, all_fields, conds)))
{
@@ -968,6 +992,12 @@ JOIN::optimize()
DBUG_RETURN(1);
}
+ if (select_lex->olap == ROLLUP_TYPE && rollup_process_const_fields())
+ {
+ DBUG_PRINT("error", ("Error: rollup_process_fields() failed"));
+ DBUG_RETURN(1);
+ }
+
/* Remove distinct if only const tables */
select_distinct= select_distinct && (const_tables != tables);
thd_proc_info(thd, "preparing");
@@ -1098,7 +1128,7 @@ JOIN::optimize()
join_tab[const_tables].select->quick->get_type() !=
QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX))
{
- if (group_list &&
+ if (group_list && rollup.state == ROLLUP::STATE_NONE &&
list_contains_unique_index(join_tab[const_tables].table,
find_field_in_order_list,
(void *) group_list))
@@ -1142,7 +1172,8 @@ JOIN::optimize()
if (! hidden_group_fields && rollup.state == ROLLUP::STATE_NONE)
select_distinct=0;
}
- else if (select_distinct && tables - const_tables == 1)
+ else if (select_distinct && tables - const_tables == 1 &&
+ rollup.state == ROLLUP::STATE_NONE)
{
/*
We are only using one table. In this case we change DISTINCT to a
@@ -1241,13 +1272,22 @@ JOIN::optimize()
(!group_list && tmp_table_param.sum_func_count))
order=0;
- // Can't use sort on head table if using row cache
+ // Can't use sort on head table if using join buffering
if (full_join)
{
- if (group_list)
- simple_group=0;
- if (order)
- simple_order=0;
+ TABLE *stable= (sort_by_table == (TABLE *) 1 ?
+ join_tab[const_tables].table : sort_by_table);
+ /*
+ FORCE INDEX FOR ORDER BY can be used to prevent join buffering when
+ sorting on the first table.
+ */
+ if (!stable || !stable->force_index_order)
+ {
+ if (group_list)
+ simple_group= 0;
+ if (order)
+ simple_order= 0;
+ }
}
/*
@@ -1533,12 +1573,8 @@ JOIN::optimize()
}
}
- /*
- If this join belongs to an uncacheable subquery save
- the original join
- */
- if (select_lex->uncacheable && !is_top_level_join() &&
- init_save_join_tab())
+ /* If this join belongs to an uncacheable query save the original join */
+ if (select_lex->uncacheable && init_save_join_tab())
DBUG_RETURN(-1); /* purecov: inspected */
}
@@ -2039,7 +2075,8 @@ JOIN::exec()
count_field_types(select_lex, &curr_join->tmp_table_param,
*curr_all_fields, 0);
- if (curr_join->group || curr_join->tmp_table_param.sum_func_count ||
+ if (curr_join->group || curr_join->implicit_grouping ||
+ curr_join->tmp_table_param.sum_func_count ||
(procedure && (procedure->flags & PROC_GROUP)))
{
if (make_group_fields(this, curr_join))
@@ -2274,7 +2311,7 @@ JOIN::destroy()
tab->cleanup();
}
tmp_join->tmp_join= 0;
- tmp_table_param.copy_field=0;
+ tmp_table_param.copy_field= 0;
DBUG_RETURN(tmp_join->destroy());
}
cond_equal= 0;
@@ -3379,12 +3416,12 @@ add_key_equal_fields(KEY_FIELD **key_fie
@retval FALSE it's something else
*/
-inline static bool
+static bool
is_local_field (Item *field)
{
- field= field->real_item();
- return field->type() == Item::FIELD_ITEM &&
- !((Item_field *)field)->depended_from;
+ return field->real_item()->type() == Item::FIELD_ITEM
+ && !(field->used_tables() & OUTER_REF_TABLE_BIT)
+ && !((Item_field *)field->real_item())->depended_from;
}
@@ -3629,7 +3666,7 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array
{
if (!(form->keys_in_use_for_query.is_set(key)))
continue;
- if (form->key_info[key].flags & HA_FULLTEXT)
+ if (form->key_info[key].flags & (HA_FULLTEXT | HA_SPATIAL))
continue; // ToDo: ft-keys in non-ft queries. SerG
uint key_parts= (uint) form->key_info[key].key_parts;
@@ -5677,7 +5714,9 @@ static bool create_ref_for_key(JOIN *joi
}
j->ref.key_buff2=j->ref.key_buff+ALIGN_SIZE(length);
j->ref.key_err=1;
+ j->ref.has_record= FALSE;
j->ref.null_rejecting= 0;
+ j->ref.use_count= 0;
keyuse=org_keyuse;
store_key **ref_key= j->ref.key_copy;
@@ -6511,6 +6550,20 @@ make_join_select(JOIN *join,SQL_SELECT *
DBUG_RETURN(0);
}
+
+/**
+ The default implementation of unlock-row method of READ_RECORD,
+ used in all access methods.
+*/
+
+void rr_unlock_row(st_join_table *tab)
+{
+ READ_RECORD *info= &tab->read_record;
+ info->file->unlock_row();
+}
+
+
+
static void
make_join_readinfo(JOIN *join, ulonglong options)
{
@@ -6526,6 +6579,7 @@ make_join_readinfo(JOIN *join, ulonglong
TABLE *table=tab->table;
tab->read_record.table= table;
tab->read_record.file=table->file;
+ tab->read_record.unlock_row= rr_unlock_row;
tab->next_select=sub_select; /* normal select */
/*
@@ -6571,6 +6625,7 @@ make_join_readinfo(JOIN *join, ulonglong
delete tab->quick;
tab->quick=0;
tab->read_first_record= join_read_key;
+ tab->read_record.unlock_row= join_read_key_unlock_row;
tab->read_record.read_record= join_no_more_records;
if (table->covering_keys.is_set(tab->ref.key) &&
!table->no_keyread)
@@ -9046,7 +9101,10 @@ static void restore_prev_nj_state(JOIN_T
join->cur_embedding_map&= ~last_emb->nested_join->nj_map;
else if (last_emb->nested_join->n_tables-1 ==
last_emb->nested_join->counter)
+ {
join->cur_embedding_map|= last_emb->nested_join->nj_map;
+ break;
+ }
else
break;
last_emb= last_emb->embedding;
@@ -9493,8 +9551,47 @@ static Field *create_tmp_field_from_item
new_field->set_derivation(item->collation.derivation);
break;
case DECIMAL_RESULT:
- new_field= Field_new_decimal::new_decimal_field(item);
+ {
+ uint8 dec= item->decimals;
+ uint8 intg= ((Item_decimal *) item)->decimal_precision() - dec;
+ uint32 len= item->max_length;
+
+ /*
+ Trying to put too many digits overall in a DECIMAL(prec,dec)
+ will always throw a warning. We must limit dec to
+ DECIMAL_MAX_SCALE however to prevent an assert() later.
+ */
+
+ if (dec > 0)
+ {
+ signed int overflow;
+
+ dec= min(dec, DECIMAL_MAX_SCALE);
+
+ /*
+ If the value still overflows the field with the corrected dec,
+ we'll throw out decimals rather than integers. This is still
+ bad and of course throws a truncation warning.
+ +1: for decimal point
+ */
+
+ const int required_length=
+ my_decimal_precision_to_length(intg + dec, dec,
+ item->unsigned_flag);
+
+ overflow= required_length - len;
+
+ if (overflow > 0)
+ dec= max(0, dec - overflow); // too long, discard fract
+ else
+ /* Corrected value fits. */
+ len= required_length;
+ }
+
+ new_field= new Field_new_decimal(len, maybe_null, item->name,
+ dec, item->unsigned_flag);
break;
+ }
case ROW_RESULT:
default:
// This case should never be choosen
@@ -10303,6 +10400,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARA
for (; cur_group ; cur_group= cur_group->next, key_part_info++)
{
Field *field=(*cur_group->item)->get_tmp_table_field();
+ DBUG_ASSERT(field->table == table);
bool maybe_null=(*cur_group->item)->maybe_null;
key_part_info->null_bit=0;
key_part_info->field= field;
@@ -11062,6 +11160,12 @@ Next_select_func setup_end_select_func(J
}
else
{
+ /*
+ Choose method for presenting result to user. Use end_send_group
+ if the query requires grouping (has a GROUP BY clause and/or one or
+ more aggregate functions). Use end_send if the query should not
+ be grouped.
+ */
if ((join->sort_and_group ||
(join->procedure && join->procedure->flags & PROC_GROUP)) &&
!tmp_tbl->precomputed_group_by)
@@ -11430,6 +11534,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
bool not_used_in_distinct=join_tab->not_used_in_distinct;
ha_rows found_records=join->found_records;
COND *select_cond= join_tab->select_cond;
+ bool select_cond_result= TRUE;
if (error > 0 || (join->thd->is_error())) // Fatal error
return NESTED_LOOP_ERROR;
@@ -11441,7 +11546,17 @@ evaluate_join_record(JOIN *join, JOIN_TA
return NESTED_LOOP_KILLED; /* purecov: inspected */
}
DBUG_PRINT("info", ("select cond 0x%lx", (ulong)select_cond));
- if (!select_cond || select_cond->val_int())
+
+ if (select_cond)
+ {
+ select_cond_result= test(select_cond->val_int());
+
+ /* check for errors evaluating the condition */
+ if (join->thd->is_error())
+ return NESTED_LOOP_ERROR;
+ }
+
+ if (!select_cond || select_cond_result)
{
/*
There is no select condition or the attached pushed down
@@ -11525,7 +11640,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
return NESTED_LOOP_NO_MORE_ROWS;
}
else
- join_tab->read_record.file->unlock_row();
+ join_tab->read_record.unlock_row(join_tab);
}
else
{
@@ -11535,7 +11650,7 @@ evaluate_join_record(JOIN *join, JOIN_TA
*/
join->examined_rows++;
join->thd->row_count++;
- join_tab->read_record.file->unlock_row();
+ join_tab->read_record.unlock_row(join_tab);
}
return NESTED_LOOP_OK;
}
@@ -11915,18 +12030,55 @@ join_read_key(JOIN_TAB *tab)
table->status=STATUS_NOT_FOUND;
return -1;
}
+ /*
+ Moving away from the current record. Unlock the row
+ in the handler if it did not match the partial WHERE.
+ */
+ if (tab->ref.has_record && tab->ref.use_count == 0)
+ {
+ tab->read_record.file->unlock_row();
+ tab->ref.has_record= FALSE;
+ }
error=table->file->index_read_map(table->record[0],
tab->ref.key_buff,
make_prev_keypart_map(tab->ref.key_parts),
HA_READ_KEY_EXACT);
if (error && error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
return report_error(table, error);
+
+ if (! error)
+ {
+ tab->ref.has_record= TRUE;
+ tab->ref.use_count= 1;
+ }
+ }
+ else if (table->status == 0)
+ {
+ DBUG_ASSERT(tab->ref.has_record);
+ tab->ref.use_count++;
}
table->null_row=0;
return table->status ? -1 : 0;
}
+/**
+ Since join_read_key may buffer a record, do not unlock
+ it if it was not used in this invocation of join_read_key().
+ Only count locks, thus remembering if the record was left unused,
+ and unlock already when pruning the current value of
+ TABLE_REF buffer.
+ @sa join_read_key()
+*/
+
+static void
+join_read_key_unlock_row(st_join_table *tab)
+{
+ DBUG_ASSERT(tab->ref.use_count);
+ if (tab->ref.use_count)
+ tab->ref.use_count--;
+}
+
/*
ref access method implementation: "read_first" function
@@ -13994,7 +14146,10 @@ static int remove_dup_with_compare(THD *
if (error)
{
if (error == HA_ERR_RECORD_DELETED)
- continue;
+ {
+ error= file->rnd_next(record);
+ continue;
+ }
if (error == HA_ERR_END_OF_FILE)
break;
goto err;
@@ -15923,32 +16078,7 @@ bool JOIN::rollup_init()
{
item->maybe_null= 1;
found_in_group= 1;
- if (item->const_item())
- {
- /*
- For ROLLUP queries each constant item referenced in GROUP BY list
- is wrapped up into an Item_func object yielding the same value
- as the constant item. The objects of the wrapper class are never
- considered as constant items and besides they inherit all
- properties of the Item_result_field class.
- This wrapping allows us to ensure writing constant items
- into temporary tables whenever the result of the ROLLUP
- operation has to be written into a temporary table, e.g. when
- ROLLUP is used together with DISTINCT in the SELECT list.
- Usually when creating temporary tables for a intermidiate
- result we do not include fields for constant expressions.
- */
- Item* new_item= new Item_func_rollup_const(item);
- if (!new_item)
- return 1;
- new_item->fix_fields(thd, (Item **) 0);
- thd->change_item_tree(it.ref(), new_item);
- for (ORDER *tmp= group_tmp; tmp; tmp= tmp->next)
- {
- if (*tmp->item == item)
- thd->change_item_tree(tmp->item, new_item);
- }
- }
+ break;
}
}
if (item->type() == Item::FUNC_ITEM && !found_in_group)
@@ -15967,6 +16097,59 @@ bool JOIN::rollup_init()
}
return 0;
}
+
+/**
+ Wrap all constant Items in GROUP BY list.
+
+ For ROLLUP queries each constant item referenced in GROUP BY list
+ is wrapped up into an Item_func object yielding the same value
+ as the constant item. The objects of the wrapper class are never
+ considered as constant items and besides they inherit all
+ properties of the Item_result_field class.
+ This wrapping allows us to ensure writing constant items
+ into temporary tables whenever the result of the ROLLUP
+ operation has to be written into a temporary table, e.g. when
+ ROLLUP is used together with DISTINCT in the SELECT list.
+ Usually when creating temporary tables for a intermidiate
+ result we do not include fields for constant expressions.
+
+ @retval
+ 0 if ok
+ @retval
+ 1 on error
+*/
+
+bool JOIN::rollup_process_const_fields()
+{
+ ORDER *group_tmp;
+ Item *item;
+ List_iterator<Item> it(all_fields);
+
+ for (group_tmp= group_list; group_tmp; group_tmp= group_tmp->next)
+ {
+ if (!(*group_tmp->item)->const_item())
+ continue;
+ while ((item= it++))
+ {
+ if (*group_tmp->item == item)
+ {
+ Item* new_item= new Item_func_rollup_const(item);
+ if (!new_item)
+ return 1;
+ new_item->fix_fields(thd, (Item **) 0);
+ thd->change_item_tree(it.ref(), new_item);
+ for (ORDER *tmp= group_tmp; tmp; tmp= tmp->next)
+ {
+ if (*tmp->item == item)
+ thd->change_item_tree(tmp->item, new_item);
+ }
+ break;
+ }
+ }
+ it.rewind();
+ }
+ return 0;
+}
/**
=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h 2009-09-15 10:46:35 +0000
+++ b/sql/sql_select.h 2009-11-16 20:49:51 +0000
@@ -58,6 +58,8 @@ class store_key;
typedef struct st_table_ref
{
bool key_err;
+ /** True if something was read into buffer in join_read_key. */
+ bool has_record;
uint key_parts; ///< num of ...
uint key_length; ///< length of key_buff
int key; ///< key no
@@ -85,6 +87,11 @@ typedef struct st_table_ref
table_map depend_map; ///< Table depends on these tables.
/* null byte position in the key_buf. Used for REF_OR_NULL optimization */
uchar *null_ref_key;
+ /*
+ The number of times the record associated with this key was used
+ in the join.
+ */
+ ha_rows use_count;
} TABLE_REF;
@@ -278,7 +285,14 @@ public:
TABLE **table,**all_tables,*sort_by_table;
uint tables,const_tables;
uint send_group_parts;
- bool sort_and_group,first_record,full_join,group, no_field_update;
+ /**
+ Indicates that grouping will be performed on the result set during
+ query execution. This field belongs to query execution.
+
+ @see make_group_fields, alloc_group_fields, JOIN::exec
+ */
+ bool sort_and_group;
+ bool first_record,full_join,group, no_field_update;
bool do_send_rows;
/**
TRUE when we want to resume nested loop iterations when
@@ -365,6 +379,8 @@ public:
simple_xxxxx is set if ORDER/GROUP BY doesn't include any references
to other tables than the first non-constant table in the JOIN.
It's also set if ORDER/GROUP BY is empty.
+ Used for deciding for or against using a temporary table to compute
+ GROUP/ORDER BY.
*/
bool simple_order, simple_group;
/**
@@ -435,6 +451,7 @@ public:
const_tables= 0;
eliminated_tables= 0;
join_list= 0;
+ implicit_grouping= FALSE;
sort_and_group= 0;
first_record= 0;
do_send_rows= 1;
@@ -511,6 +528,7 @@ public:
}
bool rollup_init();
+ bool rollup_process_const_fields();
bool rollup_make_fields(List<Item> &all_fields, List<Item> &fields,
Item_sum ***func);
int rollup_send_data(uint idx);
@@ -544,6 +562,11 @@ public:
return (table_map(1) << tables) - 1;
}
private:
+ /**
+ TRUE if the query contains an aggregate function but has no GROUP
+ BY clause.
+ */
+ bool implicit_grouping;
bool make_simple_join(JOIN *join, TABLE *tmp_table);
};
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2009-11-02 09:30:21 +0000
+++ b/sql/sql_show.cc 2009-11-16 20:49:51 +0000
@@ -583,6 +583,126 @@ find_files(THD *thd, List<LEX_STRING> *f
}
+/**
+ An Internal_error_handler that suppresses errors regarding views'
+ underlying tables that occur during privilege checking within SHOW CREATE
+ VIEW commands. This happens in the cases when
+
+ - A view's underlying table (e.g. referenced in its SELECT list) does not
+ exist. There should not be an error as no attempt was made to access it
+ per se.
+
+ - Access is denied for some table, column, function or stored procedure
+ such as mentioned above. This error gets raised automatically, since we
+ can't untangle its access checking from that of the view itself.
+ */
+class Show_create_error_handler : public Internal_error_handler {
+
+ TABLE_LIST *m_top_view;
+ bool m_handling;
+ Security_context *m_sctx;
+
+ char m_view_access_denied_message[MYSQL_ERRMSG_SIZE];
+ char *m_view_access_denied_message_ptr;
+
+public:
+
+ /**
+ Creates a new Show_create_error_handler for the particular security
+ context and view.
+
+ @thd Thread context, used for security context information if needed.
+ @top_view The view. We do not verify at this point that top_view is in
+ fact a view since, alas, these things do not stay constant.
+ */
+ explicit Show_create_error_handler(THD *thd, TABLE_LIST *top_view) :
+ m_top_view(top_view), m_handling(FALSE),
+ m_view_access_denied_message_ptr(NULL)
+ {
+
+ m_sctx = test(m_top_view->security_ctx) ?
+ m_top_view->security_ctx : thd->security_ctx;
+ }
+
+ /**
+ Lazy instantiation of 'view access denied' message. The purpose of the
+ Show_create_error_handler is to hide details of underlying tables for
+ which we have no privileges behind ER_VIEW_INVALID messages. But this
+ obviously does not apply if we lack privileges on the view itself.
+ Unfortunately the information about for which table privilege checking
+ failed is not available at this point. The only way for us to check is by
+ reconstructing the actual error message and see if it's the same.
+ */
+ char* get_view_access_denied_message()
+ {
+ if (!m_view_access_denied_message_ptr)
+ {
+ m_view_access_denied_message_ptr= m_view_access_denied_message;
+ my_snprintf(m_view_access_denied_message, MYSQL_ERRMSG_SIZE,
+ ER(ER_TABLEACCESS_DENIED_ERROR), "SHOW VIEW",
+ m_sctx->priv_user,
+ m_sctx->host_or_ip, m_top_view->get_table_name());
+ }
+ return m_view_access_denied_message_ptr;
+ }
+
+ bool handle_error(uint sql_errno, const char *message,
+ MYSQL_ERROR::enum_warning_level level, THD *thd) {
+ /*
+ The handler does not handle the errors raised by itself.
+ At this point we know if top_view is really a view.
+ */
+ if (m_handling || !m_top_view->view)
+ return FALSE;
+
+ m_handling= TRUE;
+
+ bool is_handled;
+
+ switch (sql_errno)
+ {
+ case ER_TABLEACCESS_DENIED_ERROR:
+ if (!strcmp(get_view_access_denied_message(), message))
+ {
+ /* Access to top view is not granted, don't interfere. */
+ is_handled= FALSE;
+ break;
+ }
+ case ER_COLUMNACCESS_DENIED_ERROR:
+ case ER_VIEW_NO_EXPLAIN: /* Error was anonymized, ignore all the same. */
+ case ER_PROCACCESS_DENIED_ERROR:
+ is_handled= TRUE;
+ break;
+
+ case ER_NO_SUCH_TABLE:
+ /* Established behavior: warn if underlying tables are missing. */
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_VIEW_INVALID,
+ ER(ER_VIEW_INVALID),
+ m_top_view->get_db_name(),
+ m_top_view->get_table_name());
+ is_handled= TRUE;
+ break;
+
+ case ER_SP_DOES_NOT_EXIST:
+ /* Established behavior: warn if underlying functions are missing. */
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_VIEW_INVALID,
+ ER(ER_VIEW_INVALID),
+ m_top_view->get_db_name(),
+ m_top_view->get_table_name());
+ is_handled= TRUE;
+ break;
+ default:
+ is_handled= FALSE;
+ }
+
+ m_handling= FALSE;
+ return is_handled;
+ }
+};
+
+
bool
mysqld_show_create(THD *thd, TABLE_LIST *table_list)
{
@@ -596,26 +716,13 @@ mysqld_show_create(THD *thd, TABLE_LIST
/* We want to preserve the tree for views. */
thd->lex->view_prepare_mode= TRUE;
- /* Only one table for now, but VIEW can involve several tables */
- if (open_normal_and_derived_tables(thd, table_list, 0))
{
- if (!table_list->view ||
- (thd->is_error() && thd->main_da.sql_errno() != ER_VIEW_INVALID))
+ Show_create_error_handler view_error_suppressor(thd, table_list);
+ thd->push_internal_handler(&view_error_suppressor);
+ bool error= open_normal_and_derived_tables(thd, table_list, 0);
+ thd->pop_internal_handler();
+ if (error && thd->main_da.is_error())
DBUG_RETURN(TRUE);
-
- /*
- Clear all messages with 'error' level status and
- issue a warning with 'warning' level status in
- case of invalid view and last error is ER_VIEW_INVALID
- */
- mysql_reset_errors(thd, true);
- thd->clear_error();
-
- push_warning_printf(thd,MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_VIEW_INVALID,
- ER(ER_VIEW_INVALID),
- table_list->view_db.str,
- table_list->view_name.str);
}
/* TODO: add environment variables show when it become possible */
@@ -1771,15 +1878,10 @@ void mysqld_list_processes(THD *thd,cons
thd_info->query=0;
/* Lock THD mutex that protects its data when looking at it. */
pthread_mutex_lock(&tmp->LOCK_thd_data);
- if (tmp->query)
+ if (tmp->query())
{
- /*
- query_length is always set to 0 when we set query = NULL; see
- the comment in sql_class.h why this prevents crashes in possible
- races with query_length
- */
- uint length= min(max_query_length, tmp->query_length);
- thd_info->query=(char*) thd->strmake(tmp->query,length);
+ uint length= min(max_query_length, tmp->query_length());
+ thd_info->query= (char*) thd->strmake(tmp->query(),length);
}
pthread_mutex_unlock(&tmp->LOCK_thd_data);
thread_infos.append(thd_info);
@@ -1892,7 +1994,7 @@ int fill_schema_processlist(THD* thd, TA
tmp->mysys_var->current_cond ?
"Waiting on cond" : NullS);
#else
- val= (char *) "Writing to net";
+ val= (char *) (tmp->proc_info ? tmp->proc_info : NullS);
#endif
if (val)
{
@@ -1904,11 +2006,11 @@ int fill_schema_processlist(THD* thd, TA
pthread_mutex_unlock(&mysys_var->mutex);
/* INFO */
- if (tmp->query)
+ if (tmp->query())
{
- table->field[7]->store(tmp->query,
+ table->field[7]->store(tmp->query(),
min(PROCESS_LIST_INFO_WIDTH,
- tmp->query_length), cs);
+ tmp->query_length()), cs);
table->field[7]->set_notnull();
}
@@ -3549,7 +3651,9 @@ static int get_schema_tables_record(THD
TABLE_SHARE *share= show_table->s;
handler *file= show_table->file;
handlerton *tmp_db_type= share->db_type();
+#ifdef WITH_PARTITION_STORAGE_ENGINE
bool is_partitioned= FALSE;
+#endif
if (share->tmp_table == SYSTEM_TMP_TABLE)
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
else if (share->tmp_table)
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_table.cc 2009-11-16 20:49:51 +0000
@@ -70,15 +70,21 @@ static void wait_for_kill_signal(THD *th
/**
@brief Helper function for explain_filename
+ @param thd Thread handle
+ @param to_p Explained name in system_charset_info
+ @param end_p End of the to_p buffer
+ @param name Name to be converted
+ @param name_len Length of the name, in bytes
*/
-static char* add_identifier(char *to_p, const char * end_p,
- const char* name, uint name_len, bool add_quotes)
+static char* add_identifier(THD* thd, char *to_p, const char * end_p,
+ const char* name, uint name_len)
{
uint res;
uint errors;
const char *conv_name;
char tmp_name[FN_REFLEN];
char conv_string[FN_REFLEN];
+ int quote;
DBUG_ENTER("add_identifier");
if (!name[name_len])
@@ -102,19 +108,21 @@ static char* add_identifier(char *to_p,
conv_name= conv_string;
}
- if (add_quotes && (end_p - to_p > 2))
+ quote = thd ? get_quote_char_for_identifier(thd, conv_name, res - 1) : '"';
+
+ if (quote != EOF && (end_p - to_p > 2))
{
- *(to_p++)= '`';
+ *(to_p++)= (char) quote;
while (*conv_name && (end_p - to_p - 1) > 0)
{
uint length= my_mbcharlen(system_charset_info, *conv_name);
if (!length)
length= 1;
- if (length == 1 && *conv_name == '`')
+ if (length == 1 && *conv_name == (char) quote)
{
if ((end_p - to_p) < 3)
break;
- *(to_p++)= '`';
+ *(to_p++)= (char) quote;
*(to_p++)= *(conv_name++);
}
else if (((long) length) < (end_p - to_p))
@@ -125,7 +133,11 @@ static char* add_identifier(char *to_p,
else
break; /* string already filled */
}
- to_p= strnmov(to_p, "`", end_p - to_p);
+ if (end_p > to_p) {
+ *(to_p++)= (char) quote;
+ if (end_p > to_p)
+ *to_p= 0; /* terminate by NUL, but do not include it in the count */
+ }
}
else
to_p= strnmov(to_p, conv_name, end_p - to_p);
@@ -145,6 +157,7 @@ static char* add_identifier(char *to_p,
diagnostic, error etc. when it would be useful to know what a particular
file [and directory] means. Such as SHOW ENGINE STATUS, error messages etc.
+ @param thd Thread handle
@param from Path name in my_charset_filename
Null terminated in my_charset_filename, normalized
to use '/' as directory separation character.
@@ -161,13 +174,12 @@ static char* add_identifier(char *to_p,
[,[ Temporary| Renamed] Partition `p`
[, Subpartition `sp`]] *|
(| is really a /, and it is all in one line)
- EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING ->
- same as above but no quotes are added.
@retval Length of returned string
*/
-uint explain_filename(const char *from,
+uint explain_filename(THD* thd,
+ const char *from,
char *to,
uint to_length,
enum_explain_filename_mode explain_mode)
@@ -281,14 +293,12 @@ uint explain_filename(const char *from,
{
to_p= strnmov(to_p, ER(ER_DATABASE_NAME), end_p - to_p);
*(to_p++)= ' ';
- to_p= add_identifier(to_p, end_p, db_name, db_name_len, 1);
+ to_p= add_identifier(thd, to_p, end_p, db_name, db_name_len);
to_p= strnmov(to_p, ", ", end_p - to_p);
}
else
{
- to_p= add_identifier(to_p, end_p, db_name, db_name_len,
- (explain_mode !=
- EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
+ to_p= add_identifier(thd, to_p, end_p, db_name, db_name_len);
to_p= strnmov(to_p, ".", end_p - to_p);
}
}
@@ -296,16 +306,13 @@ uint explain_filename(const char *from,
{
to_p= strnmov(to_p, ER(ER_TABLE_NAME), end_p - to_p);
*(to_p++)= ' ';
- to_p= add_identifier(to_p, end_p, table_name, table_name_len, 1);
+ to_p= add_identifier(thd, to_p, end_p, table_name, table_name_len);
}
else
- to_p= add_identifier(to_p, end_p, table_name, table_name_len,
- (explain_mode !=
- EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
+ to_p= add_identifier(thd, to_p, end_p, table_name, table_name_len);
if (part_name)
{
- if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT ||
- explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)
+ if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT)
to_p= strnmov(to_p, " /* ", end_p - to_p);
else if (explain_mode == EXPLAIN_PARTITIONS_VERBOSE)
to_p= strnmov(to_p, " ", end_p - to_p);
@@ -321,20 +328,15 @@ uint explain_filename(const char *from,
}
to_p= strnmov(to_p, ER(ER_PARTITION_NAME), end_p - to_p);
*(to_p++)= ' ';
- to_p= add_identifier(to_p, end_p, part_name, part_name_len,
- (explain_mode !=
- EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
+ to_p= add_identifier(thd, to_p, end_p, part_name, part_name_len);
if (subpart_name)
{
to_p= strnmov(to_p, ", ", end_p - to_p);
to_p= strnmov(to_p, ER(ER_SUBPARTITION_NAME), end_p - to_p);
*(to_p++)= ' ';
- to_p= add_identifier(to_p, end_p, subpart_name, subpart_name_len,
- (explain_mode !=
- EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
+ to_p= add_identifier(thd, to_p, end_p, subpart_name, subpart_name_len);
}
- if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT ||
- explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)
+ if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT)
to_p= strnmov(to_p, " */", end_p - to_p);
}
DBUG_PRINT("exit", ("to '%s'", to));
@@ -1772,6 +1774,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST
my_bool drop_temporary)
{
bool error= FALSE, need_start_waiters= FALSE;
+ Drop_table_error_handler err_handler(thd->get_internal_handler());
DBUG_ENTER("mysql_rm_table");
/* mark for close and remove all cached entries */
@@ -1792,7 +1795,10 @@ bool mysql_rm_table(THD *thd,TABLE_LIST
LOCK_open during wait_if_global_read_lock(), other threads could not
close their tables. This would make a pretty deadlock.
*/
+ thd->push_internal_handler(&err_handler);
error= mysql_rm_table_part2(thd, tables, if_exists, drop_temporary, 0, 0);
+ thd->pop_internal_handler();
+
if (need_start_waiters)
start_waiting_global_read_lock(thd);
@@ -1894,9 +1900,6 @@ int mysql_rm_table_part2(THD *thd, TABLE
DBUG_RETURN(1);
}
- /* Don't give warnings for not found errors, as we already generate notes */
- thd->no_warnings_for_error= 1;
-
for (table= tables; table; table= table->next_local)
{
char *db=table->db;
@@ -1948,7 +1951,7 @@ int mysql_rm_table_part2(THD *thd, TABLE
being built. The string always end in a comma and the comma
will be chopped off before being written to the binary log.
*/
- if (thd->current_stmt_binlog_row_based && !dont_log_query)
+ if (!drop_temporary && thd->current_stmt_binlog_row_based && !dont_log_query)
{
non_temp_tables_count++;
/*
@@ -2086,7 +2089,7 @@ int mysql_rm_table_part2(THD *thd, TABLE
tables). In this case, we can write the original query into
the binary log.
*/
- write_bin_log(thd, !error, thd->query, thd->query_length);
+ write_bin_log(thd, !error, thd->query(), thd->query_length());
}
else if (thd->current_stmt_binlog_row_based &&
tmp_table_deleted)
@@ -2145,7 +2148,6 @@ int mysql_rm_table_part2(THD *thd, TABLE
err_with_placeholders:
unlock_table_names(thd, tables, (TABLE_LIST*) 0);
pthread_mutex_unlock(&LOCK_open);
- thd->no_warnings_for_error= 0;
DBUG_RETURN(error);
}
@@ -3552,7 +3554,7 @@ static inline void write_create_table_bi
(!thd->current_stmt_binlog_row_based ||
(thd->current_stmt_binlog_row_based &&
!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
@@ -5226,6 +5228,7 @@ bool mysql_create_like_table(THD* thd, T
char tmp_path[FN_REFLEN];
#endif
char ts_name[FN_LEN + 1];
+ myf flags= MY_DONT_OVERWRITE_FILE;
DBUG_ENTER("mysql_create_like_table");
@@ -5282,8 +5285,12 @@ bool mysql_create_like_table(THD* thd, T
DBUG_EXECUTE_IF("sleep_create_like_before_copy", my_sleep(6000000););
+ if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ flags|= MY_SYNC;
+
/*
Create a new table by copying from source table
+ and sync the new table if the flag MY_SYNC is set
Altough exclusive name-lock on target table protects us from concurrent
DML and DDL operations on it we still want to wrap .FRM creation and call
@@ -5304,7 +5311,7 @@ bool mysql_create_like_table(THD* thd, T
goto err;
}
}
- else if (my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE)))
+ else if (my_copy(src_path, dst_path, flags))
{
if (my_errno == ENOENT)
my_error(ER_BAD_DB_ERROR,MYF(0),db);
@@ -5429,14 +5436,14 @@ binlog:
write_bin_log(thd, TRUE, query.ptr(), query.length());
}
else // Case 1
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
/*
Case 3 and 4 does nothing under RBR
*/
}
else
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
res= FALSE;
@@ -5524,7 +5531,7 @@ mysql_discard_or_import_tablespace(THD *
error=1;
if (error)
goto err;
- write_bin_log(thd, FALSE, thd->query, thd->query_length);
+ write_bin_log(thd, FALSE, thd->query(), thd->query_length());
err:
ha_autocommit_or_rollback(thd, error);
@@ -6550,7 +6557,7 @@ bool mysql_alter_table(THD *thd,char *ne
if (mysql_bin_log.is_open())
{
thd->clear_error();
- Query_log_event qinfo(thd, thd->query, thd->query_length,
+ Query_log_event qinfo(thd, thd->query(), thd->query_length(),
0, FALSE, 0);
mysql_bin_log.write(&qinfo);
}
@@ -6677,10 +6684,21 @@ view_err:
goto err;
}
+ /*
+ If this is an ALTER TABLE and no explicit row type specified reuse
+ the table's row type.
+ Note: this is the same as if the row type was specified explicitly and
+ we must thus set HA_CREATE_USED_ROW_FORMAT!
+ */
if (create_info->row_type == ROW_TYPE_NOT_USED)
{
+ /* ALTER TABLE without explicit row type */
create_info->row_type= table->s->row_type;
- create_info->used_fields |= HA_CREATE_USED_ROW_FORMAT;
+ /*
+ We have to mark the row type as used, as otherwise the engine may
+ change the row format in update_create_info().
+ */
+ create_info->used_fields|= HA_CREATE_USED_ROW_FORMAT;
}
DBUG_PRINT("info", ("old type: %s new type: %s",
@@ -6794,7 +6812,7 @@ view_err:
if (!error)
{
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
my_ok(thd);
}
else if (error > 0)
@@ -7210,14 +7228,18 @@ view_err:
/* Add the indexes. */
if ((error= table->file->add_index(table, key_info, index_add_count)))
{
- /*
- Exchange the key_info for the error message. If we exchange
- key number by key name in the message later, we need correct info.
- */
- KEY *save_key_info= table->key_info;
- table->key_info= key_info;
- table->file->print_error(error, MYF(0));
- table->key_info= save_key_info;
+ /* Only report error if handler has not already reported an error */
+ if (!thd->main_da.is_error())
+ {
+ /*
+ Exchange the key_info for the error message. If we exchange
+ key number by key name in the message later, we need correct info.
+ */
+ KEY *save_key_info= table->key_info;
+ table->key_info= key_info;
+ table->file->print_error(error, MYF(0));
+ table->key_info= save_key_info;
+ }
goto err1;
}
}
@@ -7283,7 +7305,7 @@ view_err:
goto err1;
/* We don't replicate alter table statement on temporary tables */
if (!thd->current_stmt_binlog_row_based)
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
goto end_temporary;
}
@@ -7440,13 +7462,13 @@ view_err:
DBUG_EXECUTE_IF("sleep_alter_before_main_binlog", my_sleep(6000000););
ha_binlog_log_query(thd, create_info->db_type, LOGCOM_ALTER_TABLE,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
db, table_name);
DBUG_ASSERT(!(mysql_bin_log.is_open() &&
thd->current_stmt_binlog_row_based &&
(create_info->options & HA_LEX_CREATE_TMP_TABLE)));
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
if (ha_check_storage_engine_flag(old_db_type, HTON_FLUSH_AFTER_RENAME))
{
@@ -7912,10 +7934,11 @@ bool mysql_checksum_table(THD *thd, TABL
for (uint i= 0; i < t->s->fields; i++ )
{
Field *f= t->field[i];
+ enum_field_types field_type= f->type();
+
if (! thd->variables.old_mode &&
f->is_real_null(0))
continue;
- enum_field_types field_type= f->type();
/*
BLOB and VARCHAR have pointers in their field, we must convert
to string; GEOMETRY is implemented on top of BLOB.
=== modified file 'sql/sql_tablespace.cc'
--- a/sql/sql_tablespace.cc 2008-02-11 18:55:04 +0000
+++ b/sql/sql_tablespace.cc 2009-11-16 20:49:51 +0000
@@ -67,6 +67,6 @@ int mysql_alter_tablespace(THD *thd, st_
hton_name(hton)->str,
"TABLESPACE or LOGFILE GROUP");
}
- write_bin_log(thd, FALSE, thd->query, thd->query_length);
+ write_bin_log(thd, FALSE, thd->query(), thd->query_length());
DBUG_RETURN(FALSE);
}
=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc 2009-09-07 20:50:10 +0000
+++ b/sql/sql_trigger.cc 2009-11-16 20:49:51 +0000
@@ -409,7 +409,7 @@ bool mysql_create_or_drop_trigger(THD *t
*/
result= FALSE;
/* Still, we need to log the query ... */
- stmt_query.append(thd->query, thd->query_length);
+ stmt_query.append(thd->query(), thd->query_length());
goto end;
}
}
@@ -918,7 +918,7 @@ bool Table_triggers_list::drop_trigger(T
List_iterator<LEX_STRING> it_connection_cl_name(connection_cl_names);
List_iterator<LEX_STRING> it_db_cl_name(db_cl_names);
- stmt_query->append(thd->query, thd->query_length);
+ stmt_query->append(thd->query(), thd->query_length());
while ((name= it_name++))
{
=== modified file 'sql/sql_udf.cc'
--- a/sql/sql_udf.cc 2009-05-15 12:57:51 +0000
+++ b/sql/sql_udf.cc 2009-10-16 10:29:42 +0000
@@ -506,7 +506,7 @@ int mysql_create_function(THD *thd,udf_f
rw_unlock(&THR_LOCK_udf);
/* Binlog the create function. */
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
DBUG_RETURN(0);
@@ -581,7 +581,7 @@ int mysql_drop_function(THD *thd,const L
rw_unlock(&THR_LOCK_udf);
/* Binlog the drop function. */
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
DBUG_RETURN(0);
err:
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_update.cc 2009-11-16 20:49:51 +0000
@@ -810,7 +810,7 @@ int mysql_update(THD *thd,
errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
transactional_table, FALSE, errcode))
{
error=1; // Rollback update
@@ -1696,6 +1696,11 @@ bool multi_update::send_data(List<Item>
TRG_EVENT_UPDATE))
DBUG_RETURN(1);
+ /*
+ Reset the table->auto_increment_field_not_null as it is valid for
+ only one row.
+ */
+ table->auto_increment_field_not_null= FALSE;
found++;
if (!can_compare_record || compare_record(table))
{
@@ -1860,7 +1865,7 @@ void multi_update::abort()
*/
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
thd->binlog_query(THD::ROW_QUERY_TYPE,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
transactional_tables, FALSE, errcode);
}
thd->transaction.all.modified_non_trans_table= TRUE;
@@ -2093,7 +2098,7 @@ bool multi_update::send_eof()
else
errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
- thd->query, thd->query_length,
+ thd->query(), thd->query_length(),
transactional_tables, FALSE, errcode))
{
local_error= 1; // Rollback update
=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_view.cc 2009-11-16 20:49:51 +0000
@@ -1652,7 +1652,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIS
/* if something goes wrong, bin-log with possible error code,
otherwise bin-log with error code cleared.
*/
- write_bin_log(thd, !something_wrong, thd->query, thd->query_length);
+ write_bin_log(thd, !something_wrong, thd->query(), thd->query_length());
}
VOID(pthread_mutex_unlock(&LOCK_open));
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2009-10-15 21:38:29 +0000
+++ b/sql/sql_yacc.yy 2009-11-16 20:49:51 +0000
@@ -7937,7 +7937,13 @@ udf_expr:
$2->is_autogenerated_name= FALSE;
$2->set_name($4.str, $4.length, system_charset_info);
}
- else
+ /*
+ A field has to have its proper name in order for name
+ resolution to work, something we are only guaranteed if we
+ parse it out. If we hijack the input stream with
+ remember_name we may get quoted or escaped names.
+ */
+ else if ($2->type() != Item::FIELD_ITEM)
$2->set_name($1, (uint) ($3 - $1), YYTHD->charset());
$$= $2;
}
@@ -9097,8 +9103,7 @@ procedure_clause:
MYSQL_YYABORT;
}
- if (&lex->select_lex != lex->current_select ||
- lex->select_lex.get_table_list()->derived)
+ if (&lex->select_lex != lex->current_select)
{
my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "subquery");
MYSQL_YYABORT;
@@ -10440,14 +10445,12 @@ load:
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD DATA");
MYSQL_YYABORT;
}
- lex->fname_start= lip->get_ptr();
}
load_data
{}
@@ -10479,14 +10482,10 @@ load_data:
if (!(lex->exchange= new sql_exchange($4.str, 0)))
MYSQL_YYABORT;
}
- opt_duplicate INTO
- {
- Lex->fname_end= YYLIP->get_ptr();
- }
- TABLE_SYM table_ident
+ opt_duplicate INTO TABLE_SYM table_ident
{
LEX *lex=Lex;
- if (!Select->add_table_to_list(YYTHD, $10, NULL, TL_OPTION_UPDATING,
+ if (!Select->add_table_to_list(YYTHD, $9, NULL, TL_OPTION_UPDATING,
lex->lock_option))
MYSQL_YYABORT;
lex->field_list.empty();
@@ -10494,7 +10493,7 @@ load_data:
lex->value_list.empty();
}
opt_load_data_charset
- { Lex->exchange->cs= $12; }
+ { Lex->exchange->cs= $11; }
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
opt_load_data_set_spec
{}
@@ -10745,7 +10744,7 @@ param_marker:
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
MYSQL_YYABORT;
}
- item= new (thd->mem_root) Item_param((uint) (lip->get_tok_start() - thd->query));
+ item= new (thd->mem_root) Item_param((uint) (lip->get_tok_start() - thd->query()));
if (!($$= item) || lex->param_list.push_back(item))
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
=== modified file 'sql/structs.h'
--- a/sql/structs.h 2009-06-26 19:57:42 +0000
+++ b/sql/structs.h 2009-11-03 17:45:52 +0000
@@ -115,16 +115,22 @@ typedef struct st_reginfo { /* Extra in
} REGINFO;
-struct st_read_record; /* For referense later */
class SQL_SELECT;
class THD;
class handler;
+struct st_join_table;
-typedef struct st_read_record { /* Parameter to read_record */
+void rr_unlock_row(st_join_table *tab);
+
+struct READ_RECORD { /* Parameter to read_record */
+ typedef int (*Read_func)(READ_RECORD*);
+ typedef void (*Unlock_row_func)(st_join_table *);
struct st_table *table; /* Head-form */
handler *file;
struct st_table **forms; /* head and ref forms */
- int (*read_record)(struct st_read_record *);
+
+ Read_func read_record;
+ Unlock_row_func unlock_row;
THD *thd;
SQL_SELECT *select;
uint cache_records;
@@ -136,7 +142,7 @@ typedef struct st_read_record { /* Par
uchar *cache,*cache_pos,*cache_end,*read_positions;
IO_CACHE *io_cache;
bool print_error, ignore_not_found_rows;
-} READ_RECORD;
+};
/*
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2009-10-15 21:38:29 +0000
+++ b/sql/table.cc 2009-11-16 20:49:51 +0000
@@ -3338,7 +3338,12 @@ bool TABLE_LIST::prep_check_option(THD *
/**
- Hide errors which show view underlying table information
+ Hide errors which show view underlying table information.
+ There are currently two mechanisms at work that handle errors for views,
+ this one and a more general mechanism based on an Internal_error_handler,
+ see Show_create_error_handler. The latter handles errors encountered during
+ execution of SHOW CREATE VIEW, while the machanism using this method is
+ handles SELECT from views. The two methods should not clash.
@param[in,out] thd thread handler
@@ -3347,6 +3352,8 @@ bool TABLE_LIST::prep_check_option(THD *
void TABLE_LIST::hide_view_error(THD *thd)
{
+ if (thd->get_internal_handler())
+ return;
/* Hide "Unknown column" or "Unknown function" error */
DBUG_ASSERT(thd->is_error());
@@ -4630,7 +4637,8 @@ Item_subselect *TABLE_LIST::containing_s
(TABLE_LIST::index_hints). Using the information in this tagged list
this function sets the members st_table::keys_in_use_for_query,
st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by,
- st_table::force_index and st_table::covering_keys.
+ st_table::force_index, st_table::force_index_order,
+ st_table::force_index_group and st_table::covering_keys.
Current implementation of the runtime does not allow mixing FORCE INDEX
and USE INDEX, so this is checked here. Then the FORCE INDEX list
@@ -4758,14 +4766,28 @@ bool TABLE_LIST::process_index_hints(TAB
}
/* process FORCE INDEX as USE INDEX with a flag */
+ if (!index_order[INDEX_HINT_FORCE].is_clear_all())
+ {
+ tbl->force_index_order= TRUE;
+ index_order[INDEX_HINT_USE].merge(index_order[INDEX_HINT_FORCE]);
+ }
+
+ if (!index_group[INDEX_HINT_FORCE].is_clear_all())
+ {
+ tbl->force_index_group= TRUE;
+ index_group[INDEX_HINT_USE].merge(index_group[INDEX_HINT_FORCE]);
+ }
+
+ /*
+ TODO: get rid of tbl->force_index (on if any FORCE INDEX is specified) and
+ create tbl->force_index_join instead.
+ Then use the correct force_index_XX instead of the global one.
+ */
if (!index_join[INDEX_HINT_FORCE].is_clear_all() ||
- !index_order[INDEX_HINT_FORCE].is_clear_all() ||
- !index_group[INDEX_HINT_FORCE].is_clear_all())
+ tbl->force_index_group || tbl->force_index_order)
{
tbl->force_index= TRUE;
index_join[INDEX_HINT_USE].merge(index_join[INDEX_HINT_FORCE]);
- index_order[INDEX_HINT_USE].merge(index_order[INDEX_HINT_FORCE]);
- index_group[INDEX_HINT_USE].merge(index_group[INDEX_HINT_FORCE]);
}
/* apply USE INDEX */
=== modified file 'sql/table.h'
--- a/sql/table.h 2009-10-15 21:38:29 +0000
+++ b/sql/table.h 2009-11-16 20:49:51 +0000
@@ -754,6 +754,18 @@ struct st_table {
bytes, it would take up 4.
*/
my_bool force_index;
+
+ /**
+ Flag set when the statement contains FORCE INDEX FOR ORDER BY
+ See TABLE_LIST::process_index_hints().
+ */
+ my_bool force_index_order;
+
+ /**
+ Flag set when the statement contains FORCE INDEX FOR GROUP BY
+ See TABLE_LIST::process_index_hints().
+ */
+ my_bool force_index_group;
my_bool distinct,const_table,no_rows;
/**
=== modified file 'sql/time.cc'
--- a/sql/time.cc 2009-09-07 20:50:10 +0000
+++ b/sql/time.cc 2009-11-16 20:49:51 +0000
@@ -965,20 +965,22 @@ calc_time_diff(MYSQL_TIME *l_time1, MYSQ
0 - a == b
1 - a > b
- NOTES
- TIME.second_part is not considered during comparison
*/
-int
-my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b)
+int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b)
{
- my_ulonglong a_t= TIME_to_ulonglong_datetime(a);
- my_ulonglong b_t= TIME_to_ulonglong_datetime(b);
+ ulonglong a_t= TIME_to_ulonglong_datetime(a);
+ ulonglong b_t= TIME_to_ulonglong_datetime(b);
+ if (a_t < b_t)
+ return -1;
if (a_t > b_t)
return 1;
- else if (a_t < b_t)
+
+ if (a->second_part < b->second_part)
return -1;
+ if (a->second_part > b->second_part)
+ return 1;
return 0;
}
=== modified file 'sql/udf_example.c'
--- a/sql/udf_example.c 2009-10-26 11:38:17 +0000
+++ b/sql/udf_example.c 2009-11-16 20:49:51 +0000
@@ -139,12 +139,12 @@ typedef long long longlong;
#include <mysql.h>
#include <ctype.h>
+#ifdef HAVE_DLOPEN
+
#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
static pthread_mutex_t LOCK_hostname;
#endif
-#ifdef HAVE_DLOPEN
-
/* These must be right or mysqld will not find the symbol! */
my_bool metaphon_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
=== modified file 'sql/unireg.cc'
--- a/sql/unireg.cc 2009-09-07 20:50:10 +0000
+++ b/sql/unireg.cc 2009-11-16 20:49:51 +0000
@@ -411,10 +411,10 @@ int rea_create_table(THD *thd, const cha
DBUG_ASSERT(*fn_rext(frm_name));
if (thd->variables.keep_files_on_create)
create_info->options|= HA_CREATE_KEEP_FILES;
- if (file->ha_create_handler_files(path, NULL, CHF_CREATE_FLAG, create_info))
- goto err_handler;
- if (!create_info->frm_only && ha_create_table(thd, path, db, table_name,
- create_info,0))
+ if (!create_info->frm_only &&
+ (file->ha_create_handler_files(path, NULL, CHF_CREATE_FLAG,
+ create_info) ||
+ ha_create_table(thd, path, db, table_name, create_info, 0)))
goto err_handler;
DBUG_RETURN(0);
=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc 2009-09-07 20:50:10 +0000
+++ b/storage/archive/ha_archive.cc 2009-11-16 20:49:51 +0000
@@ -522,8 +522,8 @@ int ha_archive::open(const char *name, i
{
DBUG_RETURN(0);
}
- else
- DBUG_RETURN(rc);
+
+ DBUG_RETURN(rc);
}
@@ -993,6 +993,7 @@ int ha_archive::rnd_init(bool scan)
/* We rewind the file so that we can read from the beginning if scan */
if (scan)
{
+ scan_rows= stats.records;
DBUG_PRINT("info", ("archive will retrieve %llu rows",
(unsigned long long) scan_rows));
@@ -1461,7 +1462,6 @@ int ha_archive::info(uint flag)
stats.records= share->rows_recorded;
pthread_mutex_unlock(&share->mutex);
- scan_rows= stats.records;
stats.deleted= 0;
DBUG_PRINT("ha_archive", ("Stats rows is %d\n", (int)stats.records));
@@ -1472,11 +1472,12 @@ int ha_archive::info(uint flag)
VOID(my_stat(share->data_file_name, &file_stat, MYF(MY_WME)));
- stats.mean_rec_length= table->s->reclength + buffer.alloced_length();
stats.data_file_length= file_stat.st_size;
stats.create_time= (ulong) file_stat.st_ctime;
stats.update_time= (ulong) file_stat.st_mtime;
- stats.max_data_file_length= share->rows_recorded * stats.mean_rec_length;
+ stats.mean_rec_length= stats.records ?
+ stats.data_file_length / stats.records : table->s->reclength;
+ stats.max_data_file_length= MAX_FILE_SIZE;
}
stats.delete_length= 0;
stats.index_file_length=0;
@@ -1574,10 +1575,8 @@ int ha_archive::check(THD* thd, HA_CHECK
share->crashed= FALSE;
DBUG_RETURN(HA_ADMIN_CORRUPT);
}
- else
- {
- DBUG_RETURN(HA_ADMIN_OK);
- }
+
+ DBUG_RETURN(HA_ADMIN_OK);
}
/*
=== modified file 'storage/blackhole/ha_blackhole.cc'
--- a/storage/blackhole/ha_blackhole.cc 2008-11-10 20:21:49 +0000
+++ b/storage/blackhole/ha_blackhole.cc 2009-10-16 10:29:42 +0000
@@ -105,7 +105,7 @@ int ha_blackhole::update_row(const uchar
{
DBUG_ENTER("ha_blackhole::update_row");
THD *thd= ha_thd();
- if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query == NULL)
+ if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
DBUG_RETURN(0);
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
@@ -114,7 +114,7 @@ int ha_blackhole::delete_row(const uchar
{
DBUG_ENTER("ha_blackhole::delete_row");
THD *thd= ha_thd();
- if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query == NULL)
+ if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
DBUG_RETURN(0);
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
@@ -130,7 +130,7 @@ int ha_blackhole::rnd_next(uchar *buf)
{
DBUG_ENTER("ha_blackhole::rnd_next");
THD *thd= ha_thd();
- if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query == NULL)
+ if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
DBUG_RETURN(0);
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
@@ -212,7 +212,7 @@ int ha_blackhole::index_read_map(uchar *
{
DBUG_ENTER("ha_blackhole::index_read");
THD *thd= ha_thd();
- if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query == NULL)
+ if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
DBUG_RETURN(0);
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
@@ -224,7 +224,7 @@ int ha_blackhole::index_read_idx_map(uch
{
DBUG_ENTER("ha_blackhole::index_read_idx");
THD *thd= ha_thd();
- if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query == NULL)
+ if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
DBUG_RETURN(0);
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
@@ -235,7 +235,7 @@ int ha_blackhole::index_read_last_map(uc
{
DBUG_ENTER("ha_blackhole::index_read_last");
THD *thd= ha_thd();
- if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query == NULL)
+ if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
DBUG_RETURN(0);
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
=== modified file 'storage/csv/ha_tina.cc'
--- a/storage/csv/ha_tina.cc 2009-04-25 10:05:32 +0000
+++ b/storage/csv/ha_tina.cc 2009-11-16 20:49:51 +0000
@@ -1606,8 +1606,8 @@ int ha_tina::check(THD* thd, HA_CHECK_OP
share->crashed= TRUE;
DBUG_RETURN(HA_ADMIN_CORRUPT);
}
- else
- DBUG_RETURN(HA_ADMIN_OK);
+
+ DBUG_RETURN(HA_ADMIN_OK);
}
=== modified file 'storage/federatedx/Makefile.am'
--- a/storage/federatedx/Makefile.am 2009-11-01 15:09:55 +0000
+++ b/storage/federatedx/Makefile.am 2009-11-16 20:49:51 +0000
@@ -22,7 +22,6 @@ pkgplugin_LTLIBRARIES = @plugin_federate
ha_federatedx_la_LDFLAGS = -module -rpath $(pkgplugindir)
ha_federatedx_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_federatedx_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
-ha_federatedx_la_SOURCES = ha_federatedx.cc
EXTRA_LIBRARIES = libfederatedx.a
=== modified file 'storage/federatedx/ha_federatedx.cc'
--- a/storage/federatedx/ha_federatedx.cc 2009-11-03 11:08:09 +0000
+++ b/storage/federatedx/ha_federatedx.cc 2009-11-16 20:49:51 +0000
@@ -390,8 +390,8 @@ int federatedx_db_init(void *p)
DBUG_ENTER("federatedx_db_init");
handlerton *federatedx_hton= (handlerton *)p;
federatedx_hton->state= SHOW_OPTION_YES;
- /* This is no longer needed for plugin storage engines */
- federatedx_hton->db_type= DB_TYPE_DEFAULT;
+ /* Needed to work with old .frm files */
+ federatedx_hton->db_type= DB_TYPE_FEDERATED_DB;
federatedx_hton->savepoint_offset= sizeof(ulong);
federatedx_hton->close_connection= ha_federatedx::disconnect;
federatedx_hton->savepoint_set= ha_federatedx::savepoint_set;
@@ -1785,14 +1785,22 @@ int ha_federatedx::close(void)
if (stored_result)
retval= free_result();
- /* Disconnect from mysql */
- if ((txn= get_txn(thd, true)))
+ /* Disconnect from mysql. thd may be null during refresh */
+ txn= thd ? get_txn(thd, true) : new federatedx_txn();
+
+ if (txn)
+ {
txn->release(&io);
+
+ DBUG_ASSERT(io == NULL);
- DBUG_ASSERT(io == NULL);
+ if ((error= free_share(txn, share)))
+ retval= error;
+
+ if (!thd)
+ delete txn;
- if ((error= free_share(txn, share)))
- retval= error;
+ }
DBUG_RETURN(retval);
}
=== modified file 'storage/heap/hp_write.c'
--- a/storage/heap/hp_write.c 2009-04-25 10:05:32 +0000
+++ b/storage/heap/hp_write.c 2009-11-16 20:49:51 +0000
@@ -196,13 +196,10 @@ int hp_write_key(HP_INFO *info, HP_KEYDE
HP_SHARE *share = info->s;
int flag;
ulong halfbuff,hashnr,first_index;
- uchar *ptr_to_rec,*ptr_to_rec2;
- HASH_INFO *empty,*gpos,*gpos2,*pos;
+ uchar *UNINIT_VAR(ptr_to_rec),*UNINIT_VAR(ptr_to_rec2);
+ HASH_INFO *empty,*UNINIT_VAR(gpos),*UNINIT_VAR(gpos2),*pos;
DBUG_ENTER("hp_write_key");
- LINT_INIT(gpos); LINT_INIT(gpos2);
- LINT_INIT(ptr_to_rec); LINT_INIT(ptr_to_rec2);
-
flag=0;
if (!(empty= hp_find_free_hash(share,&keyinfo->block,share->records)))
DBUG_RETURN(-1); /* No more memory */
=== modified file 'storage/innobase/dict/dict0dict.c'
--- a/storage/innobase/dict/dict0dict.c 2009-05-19 08:31:29 +0000
+++ b/storage/innobase/dict/dict0dict.c 2009-10-05 11:17:48 +0000
@@ -1268,7 +1268,7 @@ dict_col_name_is_reserved(
ulint i;
for (i = 0; i < UT_ARR_SIZE(reserved_names); i++) {
- if (strcmp(name, reserved_names[i]) == 0) {
+ if (innobase_strcasecmp(name, reserved_names[i]) == 0) {
return(TRUE);
}
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc 2009-09-07 20:50:10 +0000
+++ b/storage/innobase/handler/ha_innodb.cc 2009-11-16 20:49:51 +0000
@@ -41,7 +41,7 @@ have disabled the InnoDB inlining in thi
#include <mysql/plugin.h>
#ifndef MYSQL_SERVER
-/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t
+/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t
is defined the same in both builds: the MySQL server and the InnoDB plugin. */
extern pthread_mutex_t LOCK_thread_count;
#endif /* MYSQL_SERVER */
@@ -54,6 +54,7 @@ static ulong commit_threads = 0;
static pthread_mutex_t commit_threads_m;
static pthread_cond_t commit_cond;
static pthread_mutex_t commit_cond_m;
+static pthread_mutex_t analyze_mutex;
static bool innodb_inited = 0;
/*
@@ -155,17 +156,36 @@ static void free_share(INNOBASE_SHARE *s
static int innobase_close_connection(handlerton *hton, THD* thd);
static int innobase_commit(handlerton *hton, THD* thd, bool all);
static int innobase_rollback(handlerton *hton, THD* thd, bool all);
-static int innobase_rollback_to_savepoint(handlerton *hton, THD* thd,
+static int innobase_rollback_to_savepoint(handlerton *hton, THD* thd,
void *savepoint);
static int innobase_savepoint(handlerton *hton, THD* thd, void *savepoint);
-static int innobase_release_savepoint(handlerton *hton, THD* thd,
+static int innobase_release_savepoint(handlerton *hton, THD* thd,
void *savepoint);
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
+/***********************************************************************
+This function checks each index name for a table against reserved
+system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
+this function pushes an error message to the client, and returns true. */
+static
+bool
+innobase_index_name_is_reserved(
+/*============================*/
+ /* out: true if index name matches a
+ reserved name */
+ const trx_t* trx, /* in: InnoDB transaction handle */
+ const TABLE* form, /* in: information on table
+ columns and indexes */
+ const char* norm_name); /* in: table name */
+
static const char innobase_hton_name[]= "InnoDB";
+/* "GEN_CLUST_INDEX" is the name reserved for Innodb default
+system primary index. */
+static const char innobase_index_reserve_name[]= "GEN_CLUST_INDEX";
+
/** @brief Initialize the default value of innodb_commit_concurrency.
Once InnoDB is running, the innodb_commit_concurrency must not change
@@ -818,7 +838,22 @@ innobase_get_cset_width(
*mbminlen = cs->mbminlen;
*mbmaxlen = cs->mbmaxlen;
} else {
- ut_a(cset == 0);
+ if (current_thd
+ && (thd_sql_command(current_thd) == SQLCOM_DROP_TABLE)) {
+
+ /* Fix bug#46256: allow tables to be dropped if the
+ collation is not found, but issue a warning. */
+ if ((global_system_variables.log_warnings)
+ && (cset != 0)){
+
+ sql_print_warning(
+ "Unknown collation #%lu.", cset);
+ }
+ } else {
+
+ ut_a(cset == 0);
+ }
+
*mbminlen = *mbmaxlen = 0;
}
}
@@ -1908,6 +1943,7 @@ innobase_init(
pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&analyze_mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&commit_cond, NULL);
innodb_inited= 1;
@@ -1947,6 +1983,7 @@ innobase_end(handlerton *hton, ha_panic_
pthread_mutex_destroy(&prepare_commit_mutex);
pthread_mutex_destroy(&commit_threads_m);
pthread_mutex_destroy(&commit_cond_m);
+ pthread_mutex_destroy(&analyze_mutex);
pthread_cond_destroy(&commit_cond);
}
@@ -2191,6 +2228,8 @@ innobase_rollback(
innobase_release_stat_resources(trx);
+ trx->n_autoinc_rows = 0; /* Reset the number AUTO-INC rows required */
+
/* If we had reserved the auto-inc lock for some table (if
we come here to roll back the latest SQL statement) we
release it now before a possibly lengthy rollback */
@@ -2525,12 +2564,28 @@ ha_innobase::innobase_initialize_autoinc
dict_table_autoinc_initialize(innodb_table, auto_inc);
- } else {
+ } else if (error == DB_RECORD_NOT_FOUND) {
ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: Error: (%lu) Couldn't read "
- "the MAX(%s) autoinc value from the "
- "index (%s).\n", error, col_name, index->name);
- }
+ fprintf(stderr, " InnoDB: MySQL and InnoDB data "
+ "dictionaries are out of sync.\n"
+ "InnoDB: Unable to find the AUTOINC column %s in the "
+ "InnoDB table %s.\n"
+ "InnoDB: We set the next AUTOINC column value to the "
+ "maximum possible value,\n"
+ "InnoDB: in effect disabling the AUTOINC next value "
+ "generation.\n"
+ "InnoDB: You can either set the next AUTOINC value "
+ "explicitly using ALTER TABLE\n"
+ "InnoDB: or fix the data dictionary by recreating "
+ "the table.\n",
+ col_name, index->table->name);
+
+ auto_inc = 0xFFFFFFFFFFFFFFFFULL;
+
+ dict_table_autoinc_initialize(innodb_table, auto_inc);
+
+ error = DB_SUCCESS;
+ } /* else other errors are still fatal */
return(ulong(error));
}
@@ -2741,7 +2796,6 @@ retry:
if (dict_table_autoinc_read(prebuilt->table) == 0) {
error = innobase_initialize_autoinc();
- /* Should always succeed! */
ut_a(error == DB_SUCCESS);
}
@@ -3201,7 +3255,10 @@ ha_innobase::store_key_val_for_row(
} else if (mysql_type == MYSQL_TYPE_TINY_BLOB
|| mysql_type == MYSQL_TYPE_MEDIUM_BLOB
|| mysql_type == MYSQL_TYPE_BLOB
- || mysql_type == MYSQL_TYPE_LONG_BLOB) {
+ || mysql_type == MYSQL_TYPE_LONG_BLOB
+ /* MYSQL_TYPE_GEOMETRY data is treated
+ as BLOB data in innodb. */
+ || mysql_type == MYSQL_TYPE_GEOMETRY) {
CHARSET_INFO* cs;
ulint key_len;
@@ -5142,6 +5199,28 @@ create_table_def(
}
}
+ /* First check whether the column to be added has a
+ system reserved name. */
+ if (dict_col_name_is_reserved(field->field_name)){
+ push_warning_printf(
+ (THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_CREATE_TABLE,
+ "Error creating table '%s' with "
+ "column name '%s'. '%s' is a "
+ "reserved name. Please try to "
+ "re-create the table with a "
+ "different column name.",
+ table->name, (char*) field->field_name,
+ (char*) field->field_name);
+
+ dict_mem_table_free(table);
+ trx_commit_for_mysql(trx);
+
+ error = DB_ERROR;
+ goto error_ret;
+ }
+
dict_mem_table_add_col(table, table->heap,
(char*) field->field_name,
col_type,
@@ -5157,6 +5236,7 @@ create_table_def(
innodb_check_for_record_too_big_error(flags & DICT_TF_COMPACT, error);
+error_ret:
error = convert_error_code_to_mysql(error, NULL);
DBUG_RETURN(error);
@@ -5194,6 +5274,9 @@ create_index(
n_fields = key->key_parts;
+ /* Assert that "GEN_CLUST_INDEX" cannot be used as non-primary index */
+ ut_a(innobase_strcasecmp(key->name, innobase_index_reserve_name) != 0);
+
ind_type = 0;
if (key_num == form->s->primary_key) {
@@ -5306,8 +5389,8 @@ create_clustered_index_when_no_primary(
/* We pass 0 as the space id, and determine at a lower level the space
id where to store the table */
-
- index = dict_mem_index_create(table_name, "GEN_CLUST_INDEX",
+ index = dict_mem_index_create(table_name,
+ innobase_index_reserve_name,
0, DICT_CLUSTERED, 0);
error = row_create_index_for_mysql(index, trx, NULL);
@@ -5368,13 +5451,15 @@ ha_innobase::create(
1. <database_name>/<table_name>: for normal table creation
2. full path: for temp table creation, or sym link
- When srv_file_per_table is on, check for full path pattern, i.e.
+ When srv_file_per_table is on and mysqld_embedded is off,
+ check for full path pattern, i.e.
X:\dir\..., X is a driver letter, or
\\dir1\dir2\..., UNC path
returns error if it is in full path format, but not creating a temp.
table. Currently InnoDB does not support symbolic link on Windows. */
if (srv_file_per_table
+ && !mysqld_embedded
&& (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
if ((name[1] == ':')
@@ -5439,14 +5524,6 @@ ha_innobase::create(
flags |= DICT_TF_COMPACT;
}
- error = create_table_def(trx, form, norm_name,
- create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL,
- flags);
-
- if (error) {
- goto cleanup;
- }
-
/* Look for a primary key */
primary_key_no= (form->s->primary_key != MAX_KEY ?
@@ -5458,6 +5535,22 @@ ha_innobase::create(
DBUG_ASSERT(primary_key_no == -1 || primary_key_no == 0);
+ /* Check for name conflicts (with reserved name) for
+ any user indices to be created. */
+ if (innobase_index_name_is_reserved(trx, form, norm_name)) {
+ error = -1;
+ goto cleanup;
+ }
+
+ error = create_table_def(trx, form, norm_name,
+ create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL,
+ flags);
+
+ if (error) {
+ goto cleanup;
+ }
+
+
/* Create the keys */
if (form->s->keys == 0 || primary_key_no == -1) {
@@ -5522,18 +5615,22 @@ ha_innobase::create(
setup at this stage and so we use thd. */
/* We need to copy the AUTOINC value from the old table if
- this is an ALTER TABLE. */
+ this is an ALTER TABLE or CREATE INDEX because CREATE INDEX
+ does a table copy too. */
if (((create_info->used_fields & HA_CREATE_USED_AUTO)
- || thd_sql_command(thd) == SQLCOM_ALTER_TABLE)
- && create_info->auto_increment_value != 0) {
-
- /* Query was ALTER TABLE...AUTO_INCREMENT = x; or
- CREATE TABLE ...AUTO_INCREMENT = x; Find out a table
- definition from the dictionary and get the current value
- of the auto increment field. Set a new value to the
- auto increment field if the value is greater than the
- maximum value in the column. */
+ || thd_sql_command(thd) == SQLCOM_ALTER_TABLE
+ || thd_sql_command(thd) == SQLCOM_CREATE_INDEX)
+ && create_info->auto_increment_value > 0) {
+
+ /* Query was one of :
+ CREATE TABLE ...AUTO_INCREMENT = x; or
+ ALTER TABLE...AUTO_INCREMENT = x; or
+ CREATE INDEX x on t(...);
+ Find out a table definition from the dictionary and get
+ the current value of the auto increment field. Set a new
+ value to the auto increment field if the value is greater
+ than the maximum value in the column. */
auto_inc_value = create_info->auto_increment_value;
@@ -6355,9 +6452,15 @@ ha_innobase::analyze(
THD* thd, /* in: connection thread handle */
HA_CHECK_OPT* check_opt) /* in: currently ignored */
{
+ /* Serialize ANALYZE TABLE inside InnoDB, see
+ Bug#38996 Race condition in ANALYZE TABLE */
+ pthread_mutex_lock(&analyze_mutex);
+
/* Simply call ::info() with all the flags */
info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
+ pthread_mutex_unlock(&analyze_mutex);
+
return(0);
}
@@ -6954,8 +7057,9 @@ ha_innobase::external_lock(
{
ulong const binlog_format= thd_binlog_format(thd);
ulong const tx_isolation = thd_tx_isolation(current_thd);
- if (tx_isolation <= ISO_READ_COMMITTED &&
- binlog_format == BINLOG_FORMAT_STMT)
+ if (tx_isolation <= ISO_READ_COMMITTED
+ && binlog_format == BINLOG_FORMAT_STMT
+ && thd_binlog_filter_ok(thd))
{
char buf[256];
my_snprintf(buf, sizeof(buf),
@@ -7792,6 +7896,7 @@ ha_innobase::get_auto_increment(
AUTOINC counter after attempting to insert the row. */
if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) {
ulonglong need;
+ ulonglong current;
ulonglong next_value;
ulonglong col_max_value;
@@ -7800,11 +7905,12 @@ ha_innobase::get_auto_increment(
col_max_value = innobase_get_int_col_max_value(
table->next_number_field);
+ current = *first_value > col_max_value ? autoinc : *first_value;
need = *nb_reserved_values * increment;
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
- *first_value, need, offset, col_max_value);
+ current, need, offset, col_max_value);
prebuilt->autoinc_last_value = next_value;
@@ -8404,6 +8510,46 @@ static int show_innodb_vars(THD *thd, SH
return 0;
}
+/***********************************************************************
+This function checks each index name for a table against reserved
+system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
+this function pushes an error message to the client, and returns true. */
+static
+bool
+innobase_index_name_is_reserved(
+/*============================*/
+ /* out: true if an index name
+ matches the reserved name */
+ const trx_t* trx, /* in: InnoDB transaction handle */
+ const TABLE* form, /* in: information on table
+ columns and indexes */
+ const char* norm_name) /* in: table name */
+{
+ KEY* key;
+ uint key_num; /* index number */
+
+ for (key_num = 0; key_num < form->s->keys; key_num++) {
+ key = form->key_info + key_num;
+
+ if (innobase_strcasecmp(key->name,
+ innobase_index_reserve_name) == 0) {
+ /* Push warning to mysql */
+ push_warning_printf((THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_CREATE_TABLE,
+ "Cannot Create Index with name "
+ "'%s'. The name is reserved "
+ "for the system default primary "
+ "index.",
+ innobase_index_reserve_name);
+
+ return(true);
+ }
+ }
+
+ return(false);
+}
+
static SHOW_VAR innodb_status_variables_export[]= {
{"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
=== modified file 'storage/innobase/handler/ha_innodb.h'
--- a/storage/innobase/handler/ha_innodb.h 2009-04-24 11:28:46 +0000
+++ b/storage/innobase/handler/ha_innodb.h 2009-09-24 14:52:52 +0000
@@ -252,4 +252,11 @@ int thd_binlog_format(const MYSQL_THD th
@param all TRUE <=> rollback main transaction.
*/
void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
+
+/**
+ Check if binary logging is filtered for thread's current db.
+ @param thd Thread handle
+ @retval 1 the query is not filtered, 0 otherwise.
+*/
+bool thd_binlog_filter_ok(const MYSQL_THD thd);
}
=== modified file 'storage/innobase/os/os0proc.c'
--- a/storage/innobase/os/os0proc.c 2006-09-05 01:52:15 +0000
+++ b/storage/innobase/os/os0proc.c 2009-11-02 15:00:26 +0000
@@ -591,6 +591,7 @@ os_mem_alloc_large(
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to"
" attach shared memory segment, errno %d\n",
errno);
+ ptr = NULL;
}
/* Remove the shared memory segment so that it will be
=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c 2009-07-10 23:12:13 +0000
+++ b/storage/innobase/row/row0mysql.c 2009-11-02 14:59:19 +0000
@@ -1788,7 +1788,6 @@ row_create_table_for_mysql(
const char* table_name;
ulint table_name_len;
ulint err;
- ulint i;
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
@@ -1827,18 +1826,6 @@ row_create_table_for_mysql(
return(DB_ERROR);
}
- /* Check that no reserved column names are used. */
- for (i = 0; i < dict_table_get_n_user_cols(table); i++) {
- if (dict_col_name_is_reserved(
- dict_table_get_col_name(table, i))) {
-
- dict_mem_table_free(table);
- trx_commit_for_mysql(trx);
-
- return(DB_ERROR);
- }
- }
-
trx_start_if_not_started(trx);
/* The table name is prefixed with the database name and a '/'.
@@ -2102,7 +2089,7 @@ Scans a table create SQL string and adds
the foreign key constraints declared in the string. This function
should be called after the indexes for a table have been created.
Each foreign key constraint must be accompanied with indexes in
-bot participating tables. The indexes are allowed to contain more
+both participating tables. The indexes are allowed to contain more
fields than mentioned in the constraint. Check also that foreign key
constraints which reference this table are ok. */
=== modified file 'storage/innodb_plugin/CMakeLists.txt'
--- a/storage/innodb_plugin/CMakeLists.txt 2009-09-07 20:50:10 +0000
+++ b/storage/innodb_plugin/CMakeLists.txt 2009-11-16 20:49:51 +0000
@@ -18,14 +18,20 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake")
+
+# Starting at 5.1.38, MySQL CMake files are simplified. But the plugin
+# CMakeLists.txt still needs to work with previous versions of MySQL.
+IF (MYSQL_VERSION_ID GREATER "50137")
+ INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake")
+ENDIF (MYSQL_VERSION_ID GREATER "50137")
+
IF (CMAKE_SIZEOF_VOID_P MATCHES 8)
SET(WIN64 TRUE)
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES 8)
# Include directories under innodb_plugin
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innodb_plugin/include
- ${CMAKE_SOURCE_DIR}/storage/innodfb_plugin/handler)
+ ${CMAKE_SOURCE_DIR}/storage/innodb_plugin/handler)
# Include directories under mysql
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
@@ -36,10 +42,10 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/
# Removing compiler optimizations for innodb/mem/* files on 64-bit Windows
# due to 64-bit compiler error, See MySQL Bug #19424, #36366, #34297
-IF(MSVC AND $(WIN64))
+IF (MSVC AND $(WIN64))
SET_SOURCE_FILES_PROPERTIES(mem/mem0mem.c mem/mem0pool.c
PROPERTIES COMPILE_FLAGS -Od)
-ENDIF(MSVC AND $(WIN64))
+ENDIF (MSVC AND $(WIN64))
SET(INNODB_PLUGIN_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
buf/buf0buddy.c buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c
@@ -74,7 +80,7 @@ SET(INNODB_PLUGIN_SOURCES btr/btr0btr.c
usr/usr0sess.c
ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c
ut/ut0list.c ut/ut0wqueue.c)
-ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DINNODB_RW_LOCKS_USE_ATOMICS -DIB_HAVE_PAUSE_INSTRUCTION)
+ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DIB_HAVE_PAUSE_INSTRUCTION)
#Disable storage engine, as we are using XtraDB
#MYSQL_STORAGE_ENGINE(INNODB_PLUGIN)
=== modified file 'storage/innodb_plugin/ChangeLog'
--- a/storage/innodb_plugin/ChangeLog 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/ChangeLog 2009-11-03 10:34:03 +0000
@@ -1,3 +1,229 @@
+2009-10-29 The InnoDB Team
+
+ * handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
+ mysql-test/innodb-autoinc.test:
+ Fix Bug#47125 auto_increment start value is ignored if an index is
+ created and engine=innodb
+
+2009-10-29 The InnoDB Team
+
+ * handler/ha_innodb.cc, mysql-test/innodb_bug47777.result,
+ mysql-test/innodb_bug47777.test:
+ Fix Bug#47777 innodb dies with spatial pk: Failing assertion: buf <=
+ original_buf + buf_len
+
+2009-10-29 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ Fix Bug#38996 Race condition in ANALYZE TABLE
+
+2009-10-29 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ Fix bug#42383: Can't create table 'test.bug39438'
+
+2009-10-29 The InnoDB Team
+
+ * os/os0proc.c:
+ Fix Bug#48237 Error handling in os_mem_alloc_large appears to
+ be incorrect
+
+2009-10-29 The InnoDB Team
+
+ * buf/buf0buf.c, buf/buf0lru.c, include/buf0buf.h, include/buf0buf.ic:
+ Fix corruption of the buf_pool->LRU_old list and improve debug
+ assertions.
+
+2009-10-28 The InnoDB Team
+
+ * srv/srv0start.c:
+ Fix Bug#41490 After enlargement of InnoDB page size, the error message
+ become inaccurate
+
+2009-10-26 The InnoDB Team
+
+ * row/row0ins.c:
+ When allocating a data tuple, zero out the system fields in order
+ to avoid Valgrind warnings about uninitialized fields in
+ dtuple_validate().
+
+2009-10-22 The InnoDB Team
+
+ * handler/ha_innodb.cc, mysql-test/innodb-zip.result,
+ mysql-test/innodb-zip.test, mysql-test/innodb_bug44369.result,
+ mysql-test/innodb_bug44369.test:
+ Fix Bug#47233 Innodb calls push_warning(MYSQL_ERROR::WARN_LEVEL_ERROR)
+
+2009-10-19 The InnoDB Team
+
+ * mysql-test/innodb_information_schema.test:
+ Fix Bug#47808 innodb_information_schema.test fails when run under
+ valgrind
+
+2009-10-15 The InnoDB Team
+
+ * include/page0page.ic:
+ Fix Bug#47058 Failure to compile innodb_plugin on solaris 10u7 + spro
+ cc/CC 5.10
+
+2009-10-05 The InnoDB Team
+
+ * buf/buf0buf.c:
+ Do not invalidate buffer pool while an LRU batch is active. Added code
+ to buf_pool_invalidate() to wait for the running batches to finish.
+
+2009-10-01 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ Fix Bug#47763 typo in error message: Failed to open table %s after %lu
+ attemtps.
+
+2009-10-01 The InnoDB Team
+
+ * fsp/fsp0fsp.c, row/row0merge.c:
+ Clean up after a crash during DROP INDEX. When InnoDB crashes
+ while dropping an index, ensure that the index will be completely
+ dropped during crash recovery. The MySQL .frm file may still
+ contain the dropped index, but there is little that we can do
+ about it.
+
+2009-09-28 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ When a secondary index exists in the MySQL .frm file but not in
+ the InnoDB data dictionary, return an error instead of letting an
+ assertion fail in index_read.
+
+2009-09-28 The InnoDB Team
+
+ * btr/btr0btr.c, buf/buf0buf.c, include/page0page.h,
+ include/page0zip.h, page/page0cur.c, page/page0page.c,
+ page/page0zip.c:
+ Do not write to PAGE_INDEX_ID when restoring an uncompressed page
+ after a compression failure. The field should only be written
+ when creating a B-tree page. This fix addresses a race condition
+ in a debug assertion.
+
+2009-09-28 The InnoDB Team
+
+ * fil/fil0fil.c:
+ Try to prevent the reuse of tablespace identifiers after InnoDB
+ has crashed during table creation. Also, refuse to start if files
+ with duplicate tablespace identifiers are encountered.
+
+2009-09-25 The InnoDB Team
+
+ * include/os0file.h, os/os0file.c:
+ Fix Bug#47055 unconditional exit(1) on ERROR_WORKING_SET_QUOTA
+ 1453 (0x5AD) for InnoDB backend
+
+2009-09-19 The InnoDB Team
+
+ * handler/ha_innodb.cc, mysql-test/innodb-consistent-master.opt,
+ mysql-test/innodb-consistent.result,
+ mysql-test/innodb-consistent.test:
+ Fix Bug#37232 Innodb might get too many read locks for DML with
+ repeatable-read
+
+2009-09-19 The InnoDB Team
+
+ * fsp/fsp0fsp.c:
+ Fix Bug#31183 Tablespace full problems not reported in error log,
+ error message unclear
+
+2009-09-17 The InnoDB Team
+
+ * mysql-test/innodb-zip.result, mysql-test/innodb-zip.test:
+ Make the test pass with zlib 1.2.3.3. Apparently, the definition
+ of compressBound() has changed between zlib versions, and the
+ maximum record size of a table with 1K compressed page size has
+ been reduced by one byte. This is an arbitrary test. In practical
+ applications, for good write performance, the compressed page size
+ should be chosen to be bigger than the absolute minimum.
+
+2009-09-16 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ Fix Bug#46256 drop table with unknown collation crashes innodb
+
+2009-09-16 The InnoDB Team
+
+ * dict/dict0dict.c, handler/ha_innodb.cc,
+ mysql-test/innodb_bug44369.result, mysql-test/innodb_bug44369.test,
+ row/row0mysql.c:
+ Fix Bug#44369 InnoDB: Does not uniformly disallow disallowed column
+ names
+
+2009-09-16 The InnoDB Team
+
+ * handler/ha_innodb.cc, include/db0err.h,
+ mysql-test/innodb_bug46000.result, mysql-test/innodb_bug46000.test:
+ Fix Bug#46000 using index called GEN_CLUST_INDEX crashes server
+
+2009-09-02 The InnoDB Team
+
+ * include/lock0lock.h, include/row0mysql.h, lock/lock0lock.c,
+ row/row0mysql.c:
+ Fix a regression introduced by the fix for MySQL bug#26316. We check
+ whether a transaction holds any AUTOINC locks before we acquire
+ the kernel mutex and release those locks.
+
+2009-08-27 The InnoDB Team
+
+ * dict/dict0dict.c, include/dict0dict.h,
+ mysql-test/innodb_bug44571.result, mysql-test/innodb_bug44571.test:
+ Fix Bug#44571 InnoDB Plugin crashes on ADD INDEX
+
+2009-08-27 The InnoDB Team
+
+ * row/row0merge.c:
+ Fix a bug in the merge sort that can corrupt indexes in fast index
+ creation. Add some consistency checks. Check that the number of
+ records remains constant in every merge sort pass.
+
+2009-08-27 The InnoDB Team
+
+ * buf/buf0buf.c, buf/buf0lru.c, buf/buf0rea.c, handler/ha_innodb.cc,
+ include/buf0buf.h, include/buf0buf.ic, include/buf0lru.h,
+ include/ut0ut.h, ut/ut0ut.c:
+ Make it possible to tune the buffer pool LRU eviction policy to be
+ more resistant against index scans. Introduce the settable global
+ variables innodb_old_blocks_pct and innodb_old_blocks_time for
+ controlling the buffer pool eviction policy. The parameter
+ innodb_old_blocks_pct (5..95) controls the desired amount of "old"
+ blocks in the LRU list. The default is 37, corresponding to the
+ old fixed ratio of 3/8. Each time a block is accessed, it will be
+ moved to the "new" blocks if its first access was at least
+ innodb_old_blocks_time milliseconds ago (default 0, meaning every
+ block). The idea is that in index scans, blocks will be accessed
+ a few times within innodb_old_blocks_time, and they will remain in
+ the "old" section of the LRU list. Thus, when innodb_old_blocks_time
+ is nonzero, blocks retrieved for one-time index scans will be more
+ likely candidates for eviction than blocks that are accessed in
+ random patterns.
+
+2009-08-26 The InnoDB Team
+
+ * handler/ha_innodb.cc, os/os0file.c:
+ Fix Bug#42885 buf_read_ahead_random, buf_read_ahead_linear counters,
+ thread wakeups
+
+2009-08-20 The InnoDB Team
+
+ * lock/lock0lock.c:
+ Fix Bug#46650 Innodb assertion autoinc_lock == lock in
+ lock_table_remove_low on INSERT SELECT
+
+2009-08-13 The InnoDB Team
+
+ * handler/handler0alter.cc:
+ Fix Bug#46657 InnoDB plugin: invalid read in index_merge_innodb test
+ (Valgrind)
+
+2009-08-11 The InnoDB Team
+
+ InnoDB Plugin 1.0.4 released
+
2009-07-20 The InnoDB Team
* buf/buf0rea.c, handler/ha_innodb.cc, include/srv0srv.h,
=== modified file 'storage/innodb_plugin/Makefile.am'
--- a/storage/innodb_plugin/Makefile.am 2009-07-31 09:54:25 +0000
+++ b/storage/innodb_plugin/Makefile.am 2009-10-09 14:02:18 +0000
@@ -31,7 +31,6 @@ DEFS= @DEFS@
noinst_HEADERS= \
handler/ha_innodb.h \
- handler/handler0vars.h \
handler/i_s.h \
include/btr0btr.h \
include/btr0btr.ic \
=== removed file 'storage/innodb_plugin/README'
--- a/storage/innodb_plugin/README 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/README 1970-01-01 00:00:00 +0000
@@ -1,29 +0,0 @@
-This is the source of the InnoDB Plugin 1.0.4 for MySQL 5.1
-===========================================================
-
-Instructions for compiling the plugin:
---------------------------------------
-
-1. Get the latest MySQL 5.1 sources from
- http://dev.mysql.com/downloads/mysql/5.1.html#source
-
-2. Replace the contents of the mysql-5.1.N/storage/innobase/ directory
- with the contents of this directory.
-
-3. Optional (only necessary if you are going to run tests from the
- mysql-test suite): cd into the innobase directory and run ./setup.sh
-
-4. Compile MySQL as usual.
-
-5. Enjoy!
-
-See the online documentation for more detailed instructions:
-http://www.innodb.com/doc/innodb_plugin-1.0/innodb-plugin-installation.html
-
-For more information about InnoDB visit
-http://www.innodb.com
-
-Please report any problems or issues with the plugin in the InnoDB Forums
-http://forums.innodb.com/ or in the MySQL Bugs database http://bugs.mysql.com
-
-Thank you for using the InnoDB plugin!
=== modified file 'storage/innodb_plugin/btr/btr0btr.c'
--- a/storage/innodb_plugin/btr/btr0btr.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/btr/btr0btr.c 2009-10-12 12:00:56 +0000
@@ -797,7 +797,7 @@ btr_create(
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
}
- /* Create a new index page on the the allocated segment page */
+ /* Create a new index page on the allocated segment page */
page_zip = buf_block_get_page_zip(block);
if (UNIV_LIKELY_NULL(page_zip)) {
@@ -1011,7 +1011,26 @@ btr_page_reorganize_low(
(!page_zip_compress(page_zip, page, index, NULL))) {
/* Restore the old page and exit. */
- buf_frame_copy(page, temp_page);
+
+#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
+ /* Check that the bytes that we skip are identical. */
+ ut_a(!memcmp(page, temp_page, PAGE_HEADER));
+ ut_a(!memcmp(PAGE_HEADER + PAGE_N_RECS + page,
+ PAGE_HEADER + PAGE_N_RECS + temp_page,
+ PAGE_DATA - (PAGE_HEADER + PAGE_N_RECS)));
+ ut_a(!memcmp(UNIV_PAGE_SIZE - FIL_PAGE_DATA_END + page,
+ UNIV_PAGE_SIZE - FIL_PAGE_DATA_END + temp_page,
+ FIL_PAGE_DATA_END));
+#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
+
+ memcpy(PAGE_HEADER + page, PAGE_HEADER + temp_page,
+ PAGE_N_RECS - PAGE_N_DIR_SLOTS);
+ memcpy(PAGE_DATA + page, PAGE_DATA + temp_page,
+ UNIV_PAGE_SIZE - PAGE_DATA - FIL_PAGE_DATA_END);
+
+#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
+ ut_a(!memcmp(page, temp_page, UNIV_PAGE_SIZE));
+#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
goto func_exit;
}
@@ -1902,7 +1921,7 @@ func_start:
n_uniq, &heap);
/* If the new record is less than the existing record
- the the split in the middle will copy the existing
+ the split in the middle will copy the existing
record to the new node. */
if (cmp_dtuple_rec(tuple, first_rec, offsets) < 0) {
split_rec = page_get_middle_rec(page);
=== modified file 'storage/innodb_plugin/btr/btr0sea.c'
--- a/storage/innodb_plugin/btr/btr0sea.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/btr/btr0sea.c 2009-10-08 11:28:37 +0000
@@ -957,7 +957,7 @@ btr_search_guess_on_hash(
/* Increment the page get statistics though we did not really
fix the page: for user info only */
- buf_pool->n_page_gets++;
+ buf_pool->stat.n_page_gets++;
return(TRUE);
=== modified file 'storage/innodb_plugin/buf/buf0buf.c'
--- a/storage/innodb_plugin/buf/buf0buf.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/buf/buf0buf.c 2009-11-03 10:26:07 +0000
@@ -837,16 +837,35 @@ buf_chunk_not_freed(
block = chunk->blocks;
for (i = chunk->size; i--; block++) {
- mutex_enter(&block->mutex);
-
- if (buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE
- && !buf_flush_ready_for_replace(&block->page)) {
+ ibool ready;
+ switch (buf_block_get_state(block)) {
+ case BUF_BLOCK_ZIP_FREE:
+ case BUF_BLOCK_ZIP_PAGE:
+ case BUF_BLOCK_ZIP_DIRTY:
+ /* The uncompressed buffer pool should never
+ contain compressed block descriptors. */
+ ut_error;
+ break;
+ case BUF_BLOCK_NOT_USED:
+ case BUF_BLOCK_READY_FOR_USE:
+ case BUF_BLOCK_MEMORY:
+ case BUF_BLOCK_REMOVE_HASH:
+ /* Skip blocks that are not being used for
+ file pages. */
+ break;
+ case BUF_BLOCK_FILE_PAGE:
+ mutex_enter(&block->mutex);
+ ready = buf_flush_ready_for_replace(&block->page);
mutex_exit(&block->mutex);
- return(block);
- }
- mutex_exit(&block->mutex);
+ if (!ready) {
+
+ return(block);
+ }
+
+ break;
+ }
}
return(NULL);
@@ -966,8 +985,6 @@ buf_pool_init(void)
buf_pool->no_flush[i] = os_event_create(NULL);
}
- buf_pool->ulint_clock = 1;
-
/* 3. Initialize LRU fields
--------------------------- */
/* All fields are initialized by mem_zalloc(). */
@@ -1146,10 +1163,15 @@ buf_relocate(
#ifdef UNIV_LRU_DEBUG
/* buf_pool->LRU_old must be the first item in the LRU list
whose "old" flag is set. */
+ ut_a(buf_pool->LRU_old->old);
ut_a(!UT_LIST_GET_PREV(LRU, buf_pool->LRU_old)
|| !UT_LIST_GET_PREV(LRU, buf_pool->LRU_old)->old);
ut_a(!UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old)
|| UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old)->old);
+ } else {
+ /* Check that the "old" flag is consistent in
+ the block and its neighbours. */
+ buf_page_set_old(dpage, buf_page_is_old(dpage));
#endif /* UNIV_LRU_DEBUG */
}
@@ -1471,33 +1493,8 @@ buf_pool_resize(void)
}
/********************************************************************//**
-Moves the block to the start of the LRU list if there is a danger
-that the block would drift out of the buffer pool. */
-UNIV_INLINE
-void
-buf_block_make_young(
-/*=================*/
- buf_page_t* bpage) /*!< in: block to make younger */
-{
- ut_ad(!buf_pool_mutex_own());
-
- /* Note that we read freed_page_clock's without holding any mutex:
- this is allowed since the result is used only in heuristics */
-
- if (buf_page_peek_if_too_old(bpage)) {
-
- buf_pool_mutex_enter();
- /* There has been freeing activity in the LRU list:
- best to move to the head of the LRU list */
-
- buf_LRU_make_block_young(bpage);
- buf_pool_mutex_exit();
- }
-}
-
-/********************************************************************//**
Moves a page to the start of the buffer pool LRU list. This high-level
-function can be used to prevent an important page from from slipping out of
+function can be used to prevent an important page from slipping out of
the buffer pool. */
UNIV_INTERN
void
@@ -1515,6 +1512,36 @@ buf_page_make_young(
}
/********************************************************************//**
+Sets the time of the first access of a page and moves a page to the
+start of the buffer pool LRU list if it is too old. This high-level
+function can be used to prevent an important page from slipping
+out of the buffer pool. */
+static
+void
+buf_page_set_accessed_make_young(
+/*=============================*/
+ buf_page_t* bpage, /*!< in/out: buffer block of a
+ file page */
+ unsigned access_time) /*!< in: bpage->access_time
+ read under mutex protection,
+ or 0 if unknown */
+{
+ ut_ad(!buf_pool_mutex_own());
+ ut_a(buf_page_in_file(bpage));
+
+ if (buf_page_peek_if_too_old(bpage)) {
+ buf_pool_mutex_enter();
+ buf_LRU_make_block_young(bpage);
+ buf_pool_mutex_exit();
+ } else if (!access_time) {
+ ulint time_ms = ut_time_ms();
+ buf_pool_mutex_enter();
+ buf_page_set_accessed(bpage, time_ms);
+ buf_pool_mutex_exit();
+ }
+}
+
+/********************************************************************//**
Resets the check_index_page_at_flush field of a page if found in the buffer
pool. */
UNIV_INTERN
@@ -1645,11 +1672,12 @@ buf_page_get_zip(
buf_page_t* bpage;
mutex_t* block_mutex;
ibool must_read;
+ unsigned access_time;
#ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside());
#endif
- buf_pool->n_page_gets++;
+ buf_pool->stat.n_page_gets++;
for (;;) {
buf_pool_mutex_enter();
@@ -1712,14 +1740,13 @@ err_exit:
got_block:
must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ;
+ access_time = buf_page_is_accessed(bpage);
buf_pool_mutex_exit();
- buf_page_set_accessed(bpage, TRUE);
-
mutex_exit(block_mutex);
- buf_block_make_young(bpage);
+ buf_page_set_accessed_make_young(bpage, access_time);
#ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(!bpage->file_page_was_freed);
@@ -1812,7 +1839,7 @@ buf_zip_decompress(
switch (fil_page_get_type(frame)) {
case FIL_PAGE_INDEX:
if (page_zip_decompress(&block->page.zip,
- block->frame)) {
+ block->frame, TRUE)) {
return(TRUE);
}
@@ -2000,7 +2027,7 @@ buf_page_get_gen(
mtr_t* mtr) /*!< in: mini-transaction */
{
buf_block_t* block;
- ibool accessed;
+ unsigned access_time;
ulint fix_type;
ibool must_read;
@@ -2016,7 +2043,7 @@ buf_page_get_gen(
#ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset, NULL));
#endif
- buf_pool->n_page_gets++;
+ buf_pool->stat.n_page_gets++;
loop:
block = guess;
buf_pool_mutex_enter();
@@ -2243,17 +2270,16 @@ wait_until_unfixed:
UNIV_MEM_ASSERT_RW(&block->page, sizeof block->page);
buf_block_buf_fix_inc(block, file, line);
- buf_pool_mutex_exit();
- /* Check if this is the first access to the page */
+ mutex_exit(&block->mutex);
- accessed = buf_page_is_accessed(&block->page);
+ /* Check if this is the first access to the page */
- buf_page_set_accessed(&block->page, TRUE);
+ access_time = buf_page_is_accessed(&block->page);
- mutex_exit(&block->mutex);
+ buf_pool_mutex_exit();
- buf_block_make_young(&block->page);
+ buf_page_set_accessed_make_young(&block->page, access_time);
#ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(!block->page.file_page_was_freed);
@@ -2306,7 +2332,7 @@ wait_until_unfixed:
mtr_memo_push(mtr, block, fix_type);
- if (!accessed) {
+ if (!access_time) {
/* In the case of a first access, try to apply linear
read-ahead */
@@ -2336,7 +2362,7 @@ buf_page_optimistic_get_func(
ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mini-transaction */
{
- ibool accessed;
+ unsigned access_time;
ibool success;
ulint fix_type;
@@ -2353,14 +2379,16 @@ buf_page_optimistic_get_func(
}
buf_block_buf_fix_inc(block, file, line);
- accessed = buf_page_is_accessed(&block->page);
- buf_page_set_accessed(&block->page, TRUE);
mutex_exit(&block->mutex);
- buf_block_make_young(&block->page);
+ /* Check if this is the first access to the page.
+ We do a dirty read on purpose, to avoid mutex contention.
+ This field is only used for heuristic purposes; it does not
+ affect correctness. */
- /* Check if this is the first access to the page */
+ access_time = buf_page_is_accessed(&block->page);
+ buf_page_set_accessed_make_young(&block->page, access_time);
ut_ad(!ibuf_inside()
|| ibuf_page(buf_block_get_space(block),
@@ -2412,7 +2440,7 @@ buf_page_optimistic_get_func(
#ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(block->page.file_page_was_freed == FALSE);
#endif
- if (UNIV_UNLIKELY(!accessed)) {
+ if (UNIV_UNLIKELY(!access_time)) {
/* In the case of a first access, try to apply linear
read-ahead */
@@ -2425,7 +2453,7 @@ buf_page_optimistic_get_func(
ut_a(ibuf_count_get(buf_block_get_space(block),
buf_block_get_page_no(block)) == 0);
#endif
- buf_pool->n_page_gets++;
+ buf_pool->stat.n_page_gets++;
return(TRUE);
}
@@ -2473,8 +2501,20 @@ buf_page_get_known_nowait(
mutex_exit(&block->mutex);
- if (mode == BUF_MAKE_YOUNG) {
- buf_block_make_young(&block->page);
+ if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) {
+ buf_pool_mutex_enter();
+ buf_LRU_make_block_young(&block->page);
+ buf_pool_mutex_exit();
+ } else if (!buf_page_is_accessed(&block->page)) {
+ /* Above, we do a dirty read on purpose, to avoid
+ mutex contention. The field buf_page_t::access_time
+ is only used for heuristic purposes. Writes to the
+ field must be protected by mutex, however. */
+ ulint time_ms = ut_time_ms();
+
+ buf_pool_mutex_enter();
+ buf_page_set_accessed(&block->page, time_ms);
+ buf_pool_mutex_exit();
}
ut_ad(!ibuf_inside() || (mode == BUF_KEEP_OLD));
@@ -2513,7 +2553,7 @@ buf_page_get_known_nowait(
|| (ibuf_count_get(buf_block_get_space(block),
buf_block_get_page_no(block)) == 0));
#endif
- buf_pool->n_page_gets++;
+ buf_pool->stat.n_page_gets++;
return(TRUE);
}
@@ -2589,7 +2629,7 @@ buf_page_try_get_func(
#endif /* UNIV_DEBUG_FILE_ACCESSES */
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
- buf_pool->n_page_gets++;
+ buf_pool->stat.n_page_gets++;
#ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(buf_block_get_space(block),
@@ -2608,10 +2648,10 @@ buf_page_init_low(
buf_page_t* bpage) /*!< in: block to init */
{
bpage->flush_type = BUF_FLUSH_LRU;
- bpage->accessed = FALSE;
bpage->io_fix = BUF_IO_NONE;
bpage->buf_fix_count = 0;
bpage->freed_page_clock = 0;
+ bpage->access_time = 0;
bpage->newest_modification = 0;
bpage->oldest_modification = 0;
HASH_INVALIDATE(bpage, hash);
@@ -2907,6 +2947,7 @@ buf_page_create(
buf_frame_t* frame;
buf_block_t* block;
buf_block_t* free_block = NULL;
+ ulint time_ms = ut_time_ms();
ut_ad(mtr);
ut_ad(space || !zip_size);
@@ -2953,7 +2994,7 @@ buf_page_create(
buf_LRU_add_block(&block->page, FALSE);
buf_block_buf_fix_inc(block, __FILE__, __LINE__);
- buf_pool->n_pages_created++;
+ buf_pool->stat.n_pages_created++;
if (zip_size) {
void* data;
@@ -2990,12 +3031,12 @@ buf_page_create(
rw_lock_x_unlock(&block->lock);
}
+ buf_page_set_accessed(&block->page, time_ms);
+
buf_pool_mutex_exit();
mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
- buf_page_set_accessed(&block->page, TRUE);
-
mutex_exit(&block->mutex);
/* Delete possible entries for the page from the insert buffer:
@@ -3201,7 +3242,7 @@ corrupt:
ut_ad(buf_pool->n_pend_reads > 0);
buf_pool->n_pend_reads--;
- buf_pool->n_pages_read++;
+ buf_pool->stat.n_pages_read++;
if (uncompressed) {
rw_lock_x_unlock_gen(&((buf_block_t*) bpage)->lock,
@@ -3221,7 +3262,7 @@ corrupt:
BUF_IO_WRITE);
}
- buf_pool->n_pages_written++;
+ buf_pool->stat.n_pages_written++;
break;
@@ -3251,7 +3292,32 @@ void
buf_pool_invalidate(void)
/*=====================*/
{
- ibool freed;
+ ibool freed;
+ enum buf_flush i;
+
+ buf_pool_mutex_enter();
+
+ for (i = BUF_FLUSH_LRU; i < BUF_FLUSH_N_TYPES; i++) {
+
+ /* As this function is called during startup and
+ during redo application phase during recovery, InnoDB
+ is single threaded (apart from IO helper threads) at
+ this stage. No new write batch can be in intialization
+ stage at this point. */
+ ut_ad(buf_pool->init_flush[i] == FALSE);
+
+ /* However, it is possible that a write batch that has
+ been posted earlier is still not complete. For buffer
+ pool invalidation to proceed we must ensure there is NO
+ write activity happening. */
+ if (buf_pool->n_flush[i] > 0) {
+ buf_pool_mutex_exit();
+ buf_flush_wait_batch_end(i);
+ buf_pool_mutex_enter();
+ }
+ }
+
+ buf_pool_mutex_exit();
ut_ad(buf_all_freed());
@@ -3266,6 +3332,14 @@ buf_pool_invalidate(void)
ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0);
ut_ad(UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0);
+ buf_pool->freed_page_clock = 0;
+ buf_pool->LRU_old = NULL;
+ buf_pool->LRU_old_len = 0;
+ buf_pool->LRU_flush_ended = 0;
+
+ memset(&buf_pool->stat, 0x00, sizeof(buf_pool->stat));
+ buf_refresh_io_stats();
+
buf_pool_mutex_exit();
}
@@ -3528,6 +3602,7 @@ buf_print(void)
"n pending decompressions %lu\n"
"n pending reads %lu\n"
"n pending flush LRU %lu list %lu single page %lu\n"
+ "pages made young %lu, not young %lu\n"
"pages read %lu, created %lu, written %lu\n",
(ulong) size,
(ulong) UT_LIST_GET_LEN(buf_pool->LRU),
@@ -3538,8 +3613,11 @@ buf_print(void)
(ulong) buf_pool->n_flush[BUF_FLUSH_LRU],
(ulong) buf_pool->n_flush[BUF_FLUSH_LIST],
(ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE],
- (ulong) buf_pool->n_pages_read, buf_pool->n_pages_created,
- (ulong) buf_pool->n_pages_written);
+ (ulong) buf_pool->stat.n_pages_made_young,
+ (ulong) buf_pool->stat.n_pages_not_made_young,
+ (ulong) buf_pool->stat.n_pages_read,
+ (ulong) buf_pool->stat.n_pages_created,
+ (ulong) buf_pool->stat.n_pages_written);
/* Count the number of blocks belonging to each index in the buffer */
@@ -3744,10 +3822,9 @@ buf_print_io(
{
time_t current_time;
double time_elapsed;
- ulint size;
+ ulint n_gets_diff;
ut_ad(buf_pool);
- size = buf_pool->curr_size;
buf_pool_mutex_enter();
@@ -3755,12 +3832,14 @@ buf_print_io(
"Buffer pool size %lu\n"
"Free buffers %lu\n"
"Database pages %lu\n"
+ "Old database pages %lu\n"
"Modified db pages %lu\n"
"Pending reads %lu\n"
"Pending writes: LRU %lu, flush list %lu, single page %lu\n",
- (ulong) size,
+ (ulong) buf_pool->curr_size,
(ulong) UT_LIST_GET_LEN(buf_pool->free),
(ulong) UT_LIST_GET_LEN(buf_pool->LRU),
+ (ulong) buf_pool->LRU_old_len,
(ulong) UT_LIST_GET_LEN(buf_pool->flush_list),
(ulong) buf_pool->n_pend_reads,
(ulong) buf_pool->n_flush[BUF_FLUSH_LRU]
@@ -3772,37 +3851,66 @@ buf_print_io(
current_time = time(NULL);
time_elapsed = 0.001 + difftime(current_time,
buf_pool->last_printout_time);
- buf_pool->last_printout_time = current_time;
fprintf(file,
+ "Pages made young %lu, not young %lu\n"
+ "%.2f youngs/s, %.2f non-youngs/s\n"
"Pages read %lu, created %lu, written %lu\n"
"%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
- (ulong) buf_pool->n_pages_read,
- (ulong) buf_pool->n_pages_created,
- (ulong) buf_pool->n_pages_written,
- (buf_pool->n_pages_read - buf_pool->n_pages_read_old)
+ (ulong) buf_pool->stat.n_pages_made_young,
+ (ulong) buf_pool->stat.n_pages_not_made_young,
+ (buf_pool->stat.n_pages_made_young
+ - buf_pool->old_stat.n_pages_made_young)
+ / time_elapsed,
+ (buf_pool->stat.n_pages_not_made_young
+ - buf_pool->old_stat.n_pages_not_made_young)
+ / time_elapsed,
+ (ulong) buf_pool->stat.n_pages_read,
+ (ulong) buf_pool->stat.n_pages_created,
+ (ulong) buf_pool->stat.n_pages_written,
+ (buf_pool->stat.n_pages_read
+ - buf_pool->old_stat.n_pages_read)
/ time_elapsed,
- (buf_pool->n_pages_created - buf_pool->n_pages_created_old)
+ (buf_pool->stat.n_pages_created
+ - buf_pool->old_stat.n_pages_created)
/ time_elapsed,
- (buf_pool->n_pages_written - buf_pool->n_pages_written_old)
+ (buf_pool->stat.n_pages_written
+ - buf_pool->old_stat.n_pages_written)
/ time_elapsed);
- if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) {
- fprintf(file, "Buffer pool hit rate %lu / 1000\n",
+ n_gets_diff = buf_pool->stat.n_page_gets - buf_pool->old_stat.n_page_gets;
+
+ if (n_gets_diff) {
+ fprintf(file,
+ "Buffer pool hit rate %lu / 1000,"
+ " young-making rate %lu / 1000 not %lu / 1000\n",
+ (ulong)
+ (1000 - ((1000 * (buf_pool->stat.n_pages_read
+ - buf_pool->old_stat.n_pages_read))
+ / (buf_pool->stat.n_page_gets
+ - buf_pool->old_stat.n_page_gets))),
+ (ulong)
+ (1000 * (buf_pool->stat.n_pages_made_young
+ - buf_pool->old_stat.n_pages_made_young)
+ / n_gets_diff),
(ulong)
- (1000 - ((1000 * (buf_pool->n_pages_read
- - buf_pool->n_pages_read_old))
- / (buf_pool->n_page_gets
- - buf_pool->n_page_gets_old))));
+ (1000 * (buf_pool->stat.n_pages_not_made_young
+ - buf_pool->old_stat.n_pages_not_made_young)
+ / n_gets_diff));
} else {
fputs("No buffer pool page gets since the last printout\n",
file);
}
- buf_pool->n_page_gets_old = buf_pool->n_page_gets;
- buf_pool->n_pages_read_old = buf_pool->n_pages_read;
- buf_pool->n_pages_created_old = buf_pool->n_pages_created;
- buf_pool->n_pages_written_old = buf_pool->n_pages_written;
+ /* Statistics about read ahead algorithm */
+ fprintf(file, "Pages read ahead %.2f/s,"
+ " evicted without access %.2f/s\n",
+ (buf_pool->stat.n_ra_pages_read
+ - buf_pool->old_stat.n_ra_pages_read)
+ / time_elapsed,
+ (buf_pool->stat.n_ra_pages_evicted
+ - buf_pool->old_stat.n_ra_pages_evicted)
+ / time_elapsed);
/* Print some values to help us with visualizing what is
happening with LRU eviction. */
@@ -3814,6 +3922,7 @@ buf_print_io(
buf_LRU_stat_sum.io, buf_LRU_stat_cur.io,
buf_LRU_stat_sum.unzip, buf_LRU_stat_cur.unzip);
+ buf_refresh_io_stats();
buf_pool_mutex_exit();
}
@@ -3825,10 +3934,7 @@ buf_refresh_io_stats(void)
/*======================*/
{
buf_pool->last_printout_time = time(NULL);
- buf_pool->n_page_gets_old = buf_pool->n_page_gets;
- buf_pool->n_pages_read_old = buf_pool->n_pages_read;
- buf_pool->n_pages_created_old = buf_pool->n_pages_created;
- buf_pool->n_pages_written_old = buf_pool->n_pages_written;
+ buf_pool->old_stat = buf_pool->stat;
}
/*********************************************************************//**
=== modified file 'storage/innodb_plugin/buf/buf0flu.c'
--- a/storage/innodb_plugin/buf/buf0flu.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/buf/buf0flu.c 2009-11-03 10:02:19 +0000
@@ -304,6 +304,28 @@ buf_flush_write_complete(
}
/********************************************************************//**
+Flush a batch of writes to the datafiles that have already been
+written by the OS. */
+static
+void
+buf_flush_sync_datafiles(void)
+/*==========================*/
+{
+ /* Wake possible simulated aio thread to actually post the
+ writes to the operating system */
+ os_aio_simulated_wake_handler_threads();
+
+ /* Wait that all async writes to tablespaces have been posted to
+ the OS */
+ os_aio_wait_until_no_pending_writes();
+
+ /* Now we flush the data to disk (for example, with fsync) */
+ fil_flush_file_spaces(FIL_TABLESPACE);
+
+ return;
+}
+
+/********************************************************************//**
Flushes possible buffered writes from the doublewrite memory buffer to disk,
and also wakes up the aio thread if simulated aio is used. It is very
important to call this function after a batch of writes has been posted,
@@ -320,8 +342,8 @@ buf_flush_buffered_writes(void)
ulint i;
if (!srv_use_doublewrite_buf || trx_doublewrite == NULL) {
- os_aio_simulated_wake_handler_threads();
-
+ /* Sync the writes to the disk. */
+ buf_flush_sync_datafiles();
return;
}
@@ -529,22 +551,10 @@ flush:
buf_LRU_stat_inc_io();
}
- /* Wake possible simulated aio thread to actually post the
- writes to the operating system */
-
- os_aio_simulated_wake_handler_threads();
-
- /* Wait that all async writes to tablespaces have been posted to
- the OS */
-
- os_aio_wait_until_no_pending_writes();
-
- /* Now we flush the data to disk (for example, with fsync) */
-
- fil_flush_file_spaces(FIL_TABLESPACE);
+ /* Sync the writes to the disk. */
+ buf_flush_sync_datafiles();
/* We can now reuse the doublewrite memory buffer: */
-
trx_doublewrite->first_free = 0;
mutex_exit(&(trx_doublewrite->mutex));
=== modified file 'storage/innodb_plugin/buf/buf0lru.c'
--- a/storage/innodb_plugin/buf/buf0lru.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/buf/buf0lru.c 2009-11-03 10:26:07 +0000
@@ -49,18 +49,22 @@ Created 11/5/1995 Heikki Tuuri
#include "log0recv.h"
#include "srv0srv.h"
-/** The number of blocks from the LRU_old pointer onward, including the block
-pointed to, must be 3/8 of the whole LRU list length, except that the
-tolerance defined below is allowed. Note that the tolerance must be small
-enough such that for even the BUF_LRU_OLD_MIN_LEN long LRU list, the
-LRU_old pointer is not allowed to point to either end of the LRU list. */
+/** The number of blocks from the LRU_old pointer onward, including
+the block pointed to, must be buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
+of the whole LRU list length, except that the tolerance defined below
+is allowed. Note that the tolerance must be small enough such that for
+even the BUF_LRU_OLD_MIN_LEN long LRU list, the LRU_old pointer is not
+allowed to point to either end of the LRU list. */
#define BUF_LRU_OLD_TOLERANCE 20
-/** The whole LRU list length is divided by this number to determine an
-initial segment in buf_LRU_get_recent_limit */
-
-#define BUF_LRU_INITIAL_RATIO 8
+/** The minimum amount of non-old blocks when the LRU_old list exists
+(that is, when there are more than BUF_LRU_OLD_MIN_LEN blocks).
+@see buf_LRU_old_adjust_len */
+#define BUF_LRU_NON_OLD_MIN_LEN 5
+#if BUF_LRU_NON_OLD_MIN_LEN >= BUF_LRU_OLD_MIN_LEN
+# error "BUF_LRU_NON_OLD_MIN_LEN >= BUF_LRU_OLD_MIN_LEN"
+#endif
/** When dropping the search hash index entries before deleting an ibd
file, we build a local array of pages belonging to that tablespace
@@ -107,6 +111,15 @@ UNIV_INTERN buf_LRU_stat_t buf_LRU_stat_
/* @} */
+/** @name Heuristics for detecting index scan @{ */
+/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
+"old" blocks. Protected by buf_pool_mutex. */
+UNIV_INTERN uint buf_LRU_old_ratio;
+/** Move blocks to "new" LRU list only if the first access was at
+least this many milliseconds ago. Not protected by any mutex or latch. */
+UNIV_INTERN uint buf_LRU_old_threshold_ms;
+/* @} */
+
/******************************************************************//**
Takes a block out of the LRU list and page hash table.
If the block is compressed-only (BUF_BLOCK_ZIP_PAGE),
@@ -428,42 +441,6 @@ next_page:
}
}
-/******************************************************************//**
-Gets the minimum LRU_position field for the blocks in an initial segment
-(determined by BUF_LRU_INITIAL_RATIO) of the LRU list. The limit is not
-guaranteed to be precise, because the ulint_clock may wrap around.
-@return the limit; zero if could not determine it */
-UNIV_INTERN
-ulint
-buf_LRU_get_recent_limit(void)
-/*==========================*/
-{
- const buf_page_t* bpage;
- ulint len;
- ulint limit;
-
- buf_pool_mutex_enter();
-
- len = UT_LIST_GET_LEN(buf_pool->LRU);
-
- if (len < BUF_LRU_OLD_MIN_LEN) {
- /* The LRU list is too short to do read-ahead */
-
- buf_pool_mutex_exit();
-
- return(0);
- }
-
- bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
-
- limit = buf_page_get_LRU_position(bpage);
- len /= BUF_LRU_INITIAL_RATIO;
-
- buf_pool_mutex_exit();
-
- return(limit > len ? (limit - len) : 0);
-}
-
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
UNIV_INTERN
@@ -594,6 +571,7 @@ buf_LRU_free_from_common_LRU_list(
bpage = UT_LIST_GET_PREV(LRU, bpage), distance--) {
enum buf_lru_free_block_status freed;
+ unsigned accessed;
mutex_t* block_mutex
= buf_page_get_mutex(bpage);
@@ -601,11 +579,18 @@ buf_LRU_free_from_common_LRU_list(
ut_ad(bpage->in_LRU_list);
mutex_enter(block_mutex);
+ accessed = buf_page_is_accessed(bpage);
freed = buf_LRU_free_block(bpage, TRUE, NULL);
mutex_exit(block_mutex);
switch (freed) {
case BUF_LRU_FREED:
+ /* Keep track of pages that are evicted without
+ ever being accessed. This gives us a measure of
+ the effectiveness of readahead */
+ if (!accessed) {
+ ++buf_pool->stat.n_ra_pages_evicted;
+ }
return(TRUE);
case BUF_LRU_NOT_FREED:
@@ -953,8 +938,10 @@ buf_LRU_old_adjust_len(void)
ut_a(buf_pool->LRU_old);
ut_ad(buf_pool_mutex_own());
-#if 3 * (BUF_LRU_OLD_MIN_LEN / 8) <= BUF_LRU_OLD_TOLERANCE + 5
-# error "3 * (BUF_LRU_OLD_MIN_LEN / 8) <= BUF_LRU_OLD_TOLERANCE + 5"
+ ut_ad(buf_LRU_old_ratio >= BUF_LRU_OLD_RATIO_MIN);
+ ut_ad(buf_LRU_old_ratio <= BUF_LRU_OLD_RATIO_MAX);
+#if BUF_LRU_OLD_RATIO_MIN * BUF_LRU_OLD_MIN_LEN <= BUF_LRU_OLD_RATIO_DIV * (BUF_LRU_OLD_TOLERANCE + 5)
+# error "BUF_LRU_OLD_RATIO_MIN * BUF_LRU_OLD_MIN_LEN <= BUF_LRU_OLD_RATIO_DIV * (BUF_LRU_OLD_TOLERANCE + 5)"
#endif
#ifdef UNIV_LRU_DEBUG
/* buf_pool->LRU_old must be the first item in the LRU list
@@ -966,34 +953,39 @@ buf_LRU_old_adjust_len(void)
|| UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old)->old);
#endif /* UNIV_LRU_DEBUG */
+ old_len = buf_pool->LRU_old_len;
+ new_len = ut_min(UT_LIST_GET_LEN(buf_pool->LRU)
+ * buf_LRU_old_ratio / BUF_LRU_OLD_RATIO_DIV,
+ UT_LIST_GET_LEN(buf_pool->LRU)
+ - (BUF_LRU_OLD_TOLERANCE
+ + BUF_LRU_NON_OLD_MIN_LEN));
+
for (;;) {
- old_len = buf_pool->LRU_old_len;
- new_len = 3 * (UT_LIST_GET_LEN(buf_pool->LRU) / 8);
+ buf_page_t* LRU_old = buf_pool->LRU_old;
- ut_ad(buf_pool->LRU_old->in_LRU_list);
- ut_a(buf_pool->LRU_old);
+ ut_a(LRU_old);
+ ut_ad(LRU_old->in_LRU_list);
#ifdef UNIV_LRU_DEBUG
- ut_a(buf_pool->LRU_old->old);
+ ut_a(LRU_old->old);
#endif /* UNIV_LRU_DEBUG */
/* Update the LRU_old pointer if necessary */
- if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
+ if (old_len + BUF_LRU_OLD_TOLERANCE < new_len) {
- buf_pool->LRU_old = UT_LIST_GET_PREV(
- LRU, buf_pool->LRU_old);
+ buf_pool->LRU_old = LRU_old = UT_LIST_GET_PREV(
+ LRU, LRU_old);
#ifdef UNIV_LRU_DEBUG
- ut_a(!buf_pool->LRU_old->old);
+ ut_a(!LRU_old->old);
#endif /* UNIV_LRU_DEBUG */
- buf_page_set_old(buf_pool->LRU_old, TRUE);
- buf_pool->LRU_old_len++;
+ old_len = ++buf_pool->LRU_old_len;
+ buf_page_set_old(LRU_old, TRUE);
} else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) {
- buf_page_set_old(buf_pool->LRU_old, FALSE);
- buf_pool->LRU_old = UT_LIST_GET_NEXT(
- LRU, buf_pool->LRU_old);
- buf_pool->LRU_old_len--;
+ buf_pool->LRU_old = UT_LIST_GET_NEXT(LRU, LRU_old);
+ old_len = --buf_pool->LRU_old_len;
+ buf_page_set_old(LRU_old, FALSE);
} else {
return;
}
@@ -1017,12 +1009,13 @@ buf_LRU_old_init(void)
the adjust function to move the LRU_old pointer to the right
position */
- bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
-
- while (bpage != NULL) {
+ for (bpage = UT_LIST_GET_LAST(buf_pool->LRU); bpage != NULL;
+ bpage = UT_LIST_GET_PREV(LRU, bpage)) {
ut_ad(bpage->in_LRU_list);
- buf_page_set_old(bpage, TRUE);
- bpage = UT_LIST_GET_NEXT(LRU, bpage);
+ ut_ad(buf_page_in_file(bpage));
+ /* This loop temporarily violates the
+ assertions of buf_page_set_old(). */
+ bpage->old = TRUE;
}
buf_pool->LRU_old = UT_LIST_GET_FIRST(buf_pool->LRU);
@@ -1075,16 +1068,19 @@ buf_LRU_remove_block(
if (UNIV_UNLIKELY(bpage == buf_pool->LRU_old)) {
- /* Below: the previous block is guaranteed to exist, because
- the LRU_old pointer is only allowed to differ by the
- tolerance value from strict 3/8 of the LRU list length. */
+ /* Below: the previous block is guaranteed to exist,
+ because the LRU_old pointer is only allowed to differ
+ by BUF_LRU_OLD_TOLERANCE from strict
+ buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV of the LRU
+ list length. */
+ buf_page_t* prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
- buf_pool->LRU_old = UT_LIST_GET_PREV(LRU, bpage);
- ut_a(buf_pool->LRU_old);
+ ut_a(prev_bpage);
#ifdef UNIV_LRU_DEBUG
- ut_a(!buf_pool->LRU_old->old);
+ ut_a(!prev_bpage->old);
#endif /* UNIV_LRU_DEBUG */
- buf_page_set_old(buf_pool->LRU_old, TRUE);
+ buf_pool->LRU_old = prev_bpage;
+ buf_page_set_old(prev_bpage, TRUE);
buf_pool->LRU_old_len++;
}
@@ -1095,10 +1091,19 @@ buf_LRU_remove_block(
buf_unzip_LRU_remove_block_if_needed(bpage);
- /* If the LRU list is so short that LRU_old not defined, return */
+ /* If the LRU list is so short that LRU_old is not defined,
+ clear the "old" flags and return */
if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN) {
+ for (bpage = UT_LIST_GET_FIRST(buf_pool->LRU); bpage != NULL;
+ bpage = UT_LIST_GET_NEXT(LRU, bpage)) {
+ /* This loop temporarily violates the
+ assertions of buf_page_set_old(). */
+ bpage->old = FALSE;
+ }
+
buf_pool->LRU_old = NULL;
+ buf_pool->LRU_old_len = 0;
return;
}
@@ -1149,39 +1154,24 @@ buf_LRU_add_block_to_end_low(
/*=========================*/
buf_page_t* bpage) /*!< in: control block */
{
- buf_page_t* last_bpage;
-
ut_ad(buf_pool);
ut_ad(bpage);
ut_ad(buf_pool_mutex_own());
ut_a(buf_page_in_file(bpage));
- last_bpage = UT_LIST_GET_LAST(buf_pool->LRU);
-
- if (last_bpage) {
- bpage->LRU_position = last_bpage->LRU_position;
- } else {
- bpage->LRU_position = buf_pool_clock_tic();
- }
-
ut_ad(!bpage->in_LRU_list);
UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage);
ut_d(bpage->in_LRU_list = TRUE);
- buf_page_set_old(bpage, TRUE);
-
- if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
-
- buf_pool->LRU_old_len++;
- }
-
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
ut_ad(buf_pool->LRU_old);
/* Adjust the length of the old block list if necessary */
+ buf_page_set_old(bpage, TRUE);
+ buf_pool->LRU_old_len++;
buf_LRU_old_adjust_len();
} else if (UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN) {
@@ -1190,6 +1180,8 @@ buf_LRU_add_block_to_end_low(
defined: init it */
buf_LRU_old_init();
+ } else {
+ buf_page_set_old(bpage, buf_pool->LRU_old != NULL);
}
/* If this is a zipped block with decompressed frame as well
@@ -1222,7 +1214,6 @@ buf_LRU_add_block_low(
UT_LIST_ADD_FIRST(LRU, buf_pool->LRU, bpage);
- bpage->LRU_position = buf_pool_clock_tic();
bpage->freed_page_clock = buf_pool->freed_page_clock;
} else {
#ifdef UNIV_LRU_DEBUG
@@ -1237,23 +1228,17 @@ buf_LRU_add_block_low(
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, buf_pool->LRU_old,
bpage);
buf_pool->LRU_old_len++;
-
- /* We copy the LRU position field of the previous block
- to the new block */
-
- bpage->LRU_position = (buf_pool->LRU_old)->LRU_position;
}
ut_d(bpage->in_LRU_list = TRUE);
- buf_page_set_old(bpage, old);
-
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
ut_ad(buf_pool->LRU_old);
/* Adjust the length of the old block list if necessary */
+ buf_page_set_old(bpage, old);
buf_LRU_old_adjust_len();
} else if (UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN) {
@@ -1262,6 +1247,8 @@ buf_LRU_add_block_low(
defined: init it */
buf_LRU_old_init();
+ } else {
+ buf_page_set_old(bpage, buf_pool->LRU_old != NULL);
}
/* If this is a zipped block with decompressed frame as well
@@ -1295,6 +1282,12 @@ buf_LRU_make_block_young(
/*=====================*/
buf_page_t* bpage) /*!< in: control block */
{
+ ut_ad(buf_pool_mutex_own());
+
+ if (bpage->old) {
+ buf_pool->stat.n_pages_made_young++;
+ }
+
buf_LRU_remove_block(bpage);
buf_LRU_add_block_low(bpage, FALSE);
}
@@ -1453,15 +1446,6 @@ alloc:
buf_pool->LRU_old = b;
}
-#ifdef UNIV_LRU_DEBUG
- ut_a(prev_b->old
- || !UT_LIST_GET_NEXT(LRU, b)
- || UT_LIST_GET_NEXT(LRU, b)->old);
- } else {
- ut_a(!prev_b->old
- || !UT_LIST_GET_NEXT(LRU, b)
- || !UT_LIST_GET_NEXT(LRU, b)->old);
-#endif /* UNIV_LRU_DEBUG */
}
lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
@@ -1477,6 +1461,11 @@ alloc:
defined: init it */
buf_LRU_old_init();
}
+#ifdef UNIV_LRU_DEBUG
+ /* Check that the "old" flag is consistent
+ in the block and its neighbours. */
+ buf_page_set_old(b, buf_page_is_old(b));
+#endif /* UNIV_LRU_DEBUG */
} else {
ut_d(b->in_LRU_list = FALSE);
buf_LRU_add_block_low(b, buf_page_is_old(b));
@@ -1847,6 +1836,50 @@ buf_LRU_block_free_hashed_page(
buf_LRU_block_free_non_file_page(block);
}
+/**********************************************************************//**
+Updates buf_LRU_old_ratio.
+@return updated old_pct */
+UNIV_INTERN
+uint
+buf_LRU_old_ratio_update(
+/*=====================*/
+ uint old_pct,/*!< in: Reserve this percentage of
+ the buffer pool for "old" blocks. */
+ ibool adjust) /*!< in: TRUE=adjust the LRU list;
+ FALSE=just assign buf_LRU_old_ratio
+ during the initialization of InnoDB */
+{
+ uint ratio;
+
+ ratio = old_pct * BUF_LRU_OLD_RATIO_DIV / 100;
+ if (ratio < BUF_LRU_OLD_RATIO_MIN) {
+ ratio = BUF_LRU_OLD_RATIO_MIN;
+ } else if (ratio > BUF_LRU_OLD_RATIO_MAX) {
+ ratio = BUF_LRU_OLD_RATIO_MAX;
+ }
+
+ if (adjust) {
+ buf_pool_mutex_enter();
+
+ if (ratio != buf_LRU_old_ratio) {
+ buf_LRU_old_ratio = ratio;
+
+ if (UT_LIST_GET_LEN(buf_pool->LRU)
+ >= BUF_LRU_OLD_MIN_LEN) {
+ buf_LRU_old_adjust_len();
+ }
+ }
+
+ buf_pool_mutex_exit();
+ } else {
+ buf_LRU_old_ratio = ratio;
+ }
+
+ /* the reverse of
+ ratio = old_pct * BUF_LRU_OLD_RATIO_DIV / 100 */
+ return((uint) (ratio * 100 / (double) BUF_LRU_OLD_RATIO_DIV + 0.5));
+}
+
/********************************************************************//**
Update the historical stats that we are collecting for LRU eviction
policy at the end of each interval. */
@@ -1896,7 +1929,6 @@ buf_LRU_validate(void)
buf_block_t* block;
ulint old_len;
ulint new_len;
- ulint LRU_pos;
ut_ad(buf_pool);
buf_pool_mutex_enter();
@@ -1905,7 +1937,11 @@ buf_LRU_validate(void)
ut_a(buf_pool->LRU_old);
old_len = buf_pool->LRU_old_len;
- new_len = 3 * (UT_LIST_GET_LEN(buf_pool->LRU) / 8);
+ new_len = ut_min(UT_LIST_GET_LEN(buf_pool->LRU)
+ * buf_LRU_old_ratio / BUF_LRU_OLD_RATIO_DIV,
+ UT_LIST_GET_LEN(buf_pool->LRU)
+ - (BUF_LRU_OLD_TOLERANCE
+ + BUF_LRU_NON_OLD_MIN_LEN));
ut_a(old_len >= new_len - BUF_LRU_OLD_TOLERANCE);
ut_a(old_len <= new_len + BUF_LRU_OLD_TOLERANCE);
}
@@ -1936,28 +1972,24 @@ buf_LRU_validate(void)
}
if (buf_page_is_old(bpage)) {
- old_len++;
- }
+ const buf_page_t* prev
+ = UT_LIST_GET_PREV(LRU, bpage);
+ const buf_page_t* next
+ = UT_LIST_GET_NEXT(LRU, bpage);
- if (buf_pool->LRU_old && (old_len == 1)) {
- ut_a(buf_pool->LRU_old == bpage);
- }
+ if (!old_len++) {
+ ut_a(buf_pool->LRU_old == bpage);
+ } else {
+ ut_a(!prev || buf_page_is_old(prev));
+ }
- LRU_pos = buf_page_get_LRU_position(bpage);
+ ut_a(!next || buf_page_is_old(next));
+ }
bpage = UT_LIST_GET_NEXT(LRU, bpage);
-
- if (bpage) {
- /* If the following assert fails, it may
- not be an error: just the buf_pool clock
- has wrapped around */
- ut_a(LRU_pos >= buf_page_get_LRU_position(bpage));
- }
}
- if (buf_pool->LRU_old) {
- ut_a(buf_pool->LRU_old_len == old_len);
- }
+ ut_a(buf_pool->LRU_old_len == old_len);
UT_LIST_VALIDATE(list, buf_page_t, buf_pool->free,
ut_ad(ut_list_node_313->in_free_list));
@@ -2000,9 +2032,6 @@ buf_LRU_print(void)
ut_ad(buf_pool);
buf_pool_mutex_enter();
- fprintf(stderr, "Pool ulint clock %lu\n",
- (ulong) buf_pool->ulint_clock);
-
bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
while (bpage != NULL) {
@@ -2033,18 +2062,16 @@ buf_LRU_print(void)
const byte* frame;
case BUF_BLOCK_FILE_PAGE:
frame = buf_block_get_frame((buf_block_t*) bpage);
- fprintf(stderr, "\nLRU pos %lu type %lu"
+ fprintf(stderr, "\ntype %lu"
" index id %lu\n",
- (ulong) buf_page_get_LRU_position(bpage),
(ulong) fil_page_get_type(frame),
(ulong) ut_dulint_get_low(
btr_page_get_index_id(frame)));
break;
case BUF_BLOCK_ZIP_PAGE:
frame = bpage->zip.data;
- fprintf(stderr, "\nLRU pos %lu type %lu size %lu"
+ fprintf(stderr, "\ntype %lu size %lu"
" index id %lu\n",
- (ulong) buf_page_get_LRU_position(bpage),
(ulong) fil_page_get_type(frame),
(ulong) buf_page_get_zip_size(bpage),
(ulong) ut_dulint_get_low(
@@ -2052,8 +2079,7 @@ buf_LRU_print(void)
break;
default:
- fprintf(stderr, "\nLRU pos %lu !state %lu!\n",
- (ulong) buf_page_get_LRU_position(bpage),
+ fprintf(stderr, "\n!state %lu!\n",
(ulong) buf_page_get_state(bpage));
break;
}
=== modified file 'storage/innodb_plugin/buf/buf0rea.c'
--- a/storage/innodb_plugin/buf/buf0rea.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/buf/buf0rea.c 2009-10-08 11:28:37 +0000
@@ -38,14 +38,6 @@ Created 11/5/1995 Heikki Tuuri
#include "srv0start.h"
#include "srv0srv.h"
-/** The size in blocks of the area where the random read-ahead algorithm counts
-the accessed pages when deciding whether to read-ahead */
-#define BUF_READ_AHEAD_RANDOM_AREA BUF_READ_AHEAD_AREA
-
-/** There must be at least this many pages in buf_pool in the area to start
-a random read-ahead */
-#define BUF_READ_AHEAD_RANDOM_THRESHOLD (1 + BUF_READ_AHEAD_RANDOM_AREA / 2)
-
/** The linear read-ahead area size */
#define BUF_READ_AHEAD_LINEAR_AREA BUF_READ_AHEAD_AREA
@@ -62,7 +54,8 @@ flag is cleared and the x-lock released
@return 1 if a read request was queued, 0 if the page already resided
in buf_pool, or if the page is in the doublewrite buffer blocks in
which case it is never read into the pool, or if the tablespace does
-not exist or is being dropped */
+not exist or is being dropped
+@return 1 if read request is issued. 0 if it is not */
static
ulint
buf_read_page_low(
@@ -165,174 +158,13 @@ buf_read_page_low(
}
/********************************************************************//**
-Applies a random read-ahead in buf_pool if there are at least a threshold
-value of accessed pages from the random read-ahead area. Does not read any
-page, not even the one at the position (space, offset), if the read-ahead
-mechanism is not activated. NOTE 1: the calling thread may own latches on
-pages: to avoid deadlocks this function must be written such that it cannot
-end up waiting for these latches! NOTE 2: the calling thread must want
-access to the page given: this rule is set to prevent unintended read-aheads
-performed by ibuf routines, a situation which could result in a deadlock if
-the OS does not support asynchronous i/o.
-@return number of page read requests issued; NOTE that if we read ibuf
-pages, it may happen that the page at the given page number does not
-get read even if we return a positive value! */
-static
-ulint
-buf_read_ahead_random(
-/*==================*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint offset) /*!< in: page number of a page which the current thread
- wants to access */
-{
- ib_int64_t tablespace_version;
- ulint recent_blocks = 0;
- ulint count;
- ulint LRU_recent_limit;
- ulint ibuf_mode;
- ulint low, high;
- ulint err;
- ulint i;
- ulint buf_read_ahead_random_area;
-
- /* We have currently disabled random readahead */
- return(0);
-
- if (srv_startup_is_before_trx_rollback_phase) {
- /* No read-ahead to avoid thread deadlocks */
- return(0);
- }
-
- if (ibuf_bitmap_page(zip_size, offset)
- || trx_sys_hdr_page(space, offset)) {
-
- /* If it is an ibuf bitmap page or trx sys hdr, we do
- no read-ahead, as that could break the ibuf page access
- order */
-
- return(0);
- }
-
- /* Remember the tablespace version before we ask te tablespace size
- below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
- do not try to read outside the bounds of the tablespace! */
-
- tablespace_version = fil_space_get_version(space);
-
- buf_read_ahead_random_area = BUF_READ_AHEAD_RANDOM_AREA;
-
- low = (offset / buf_read_ahead_random_area)
- * buf_read_ahead_random_area;
- high = (offset / buf_read_ahead_random_area + 1)
- * buf_read_ahead_random_area;
- if (high > fil_space_get_size(space)) {
-
- high = fil_space_get_size(space);
- }
-
- /* Get the minimum LRU_position field value for an initial segment
- of the LRU list, to determine which blocks have recently been added
- to the start of the list. */
-
- LRU_recent_limit = buf_LRU_get_recent_limit();
-
- buf_pool_mutex_enter();
-
- if (buf_pool->n_pend_reads
- > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
- buf_pool_mutex_exit();
-
- return(0);
- }
-
- /* Count how many blocks in the area have been recently accessed,
- that is, reside near the start of the LRU list. */
-
- for (i = low; i < high; i++) {
- const buf_page_t* bpage = buf_page_hash_get(space, i);
-
- if (bpage
- && buf_page_is_accessed(bpage)
- && (buf_page_get_LRU_position(bpage) > LRU_recent_limit)) {
-
- recent_blocks++;
-
- if (recent_blocks >= BUF_READ_AHEAD_RANDOM_THRESHOLD) {
-
- buf_pool_mutex_exit();
- goto read_ahead;
- }
- }
- }
-
- buf_pool_mutex_exit();
- /* Do nothing */
- return(0);
-
-read_ahead:
- /* Read all the suitable blocks within the area */
-
- if (ibuf_inside()) {
- ibuf_mode = BUF_READ_IBUF_PAGES_ONLY;
- } else {
- ibuf_mode = BUF_READ_ANY_PAGE;
- }
-
- count = 0;
-
- for (i = low; i < high; i++) {
- /* It is only sensible to do read-ahead in the non-sync aio
- mode: hence FALSE as the first parameter */
-
- if (!ibuf_bitmap_page(zip_size, i)) {
- count += buf_read_page_low(
- &err, FALSE,
- ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
- space, zip_size, FALSE,
- tablespace_version, i);
- if (err == DB_TABLESPACE_DELETED) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Warning: in random"
- " readahead trying to access\n"
- "InnoDB: tablespace %lu page %lu,\n"
- "InnoDB: but the tablespace does not"
- " exist or is just being dropped.\n",
- (ulong) space, (ulong) i);
- }
- }
- }
-
- /* In simulated aio we wake the aio handler threads only after
- queuing all aio requests, in native aio the following call does
- nothing: */
-
- os_aio_simulated_wake_handler_threads();
-
-#ifdef UNIV_DEBUG
- if (buf_debug_prints && (count > 0)) {
- fprintf(stderr,
- "Random read-ahead space %lu offset %lu pages %lu\n",
- (ulong) space, (ulong) offset,
- (ulong) count);
- }
-#endif /* UNIV_DEBUG */
-
- ++srv_read_ahead_rnd;
- return(count);
-}
-
-/********************************************************************//**
High-level function which reads a page asynchronously from a file to the
buffer buf_pool if it is not already there. Sets the io_fix flag and sets
an exclusive lock on the buffer frame. The flag is cleared and the x-lock
-released by the i/o-handler thread. Does a random read-ahead if it seems
-sensible.
-@return number of page read requests issued: this can be greater than
-1 if read-ahead occurred */
+released by the i/o-handler thread.
+@return TRUE if page has been read in, FALSE in case of failure */
UNIV_INTERN
-ulint
+ibool
buf_read_page(
/*==========*/
ulint space, /*!< in: space id */
@@ -341,20 +173,17 @@ buf_read_page(
{
ib_int64_t tablespace_version;
ulint count;
- ulint count2;
ulint err;
tablespace_version = fil_space_get_version(space);
- count = buf_read_ahead_random(space, zip_size, offset);
-
/* We do the i/o in the synchronous aio mode to save thread
switches: hence TRUE */
- count2 = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
- zip_size, FALSE,
- tablespace_version, offset);
- srv_buf_pool_reads+= count2;
+ count = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
+ zip_size, FALSE,
+ tablespace_version, offset);
+ srv_buf_pool_reads += count;
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -371,14 +200,14 @@ buf_read_page(
/* Increment number of I/O operations used for LRU policy. */
buf_LRU_stat_inc_io();
- return(count + count2);
+ return(count > 0);
}
/********************************************************************//**
Applies linear read-ahead if in the buf_pool the page is a border page of
a linear read-ahead area and all the pages in the area have been accessed.
Does not read any page if the read-ahead mechanism is not activated. Note
-that the the algorithm looks at the 'natural' adjacent successor and
+that the algorithm looks at the 'natural' adjacent successor and
predecessor of the page, which on the leaf level of a B-tree are the next
and previous page in the chain of leaves. To know these, the page specified
in (space, offset) must already be present in the buf_pool. Thus, the
@@ -498,9 +327,17 @@ buf_read_ahead_linear(
fail_count++;
} else if (pred_bpage) {
- int res = (ut_ulint_cmp(
- buf_page_get_LRU_position(bpage),
- buf_page_get_LRU_position(pred_bpage)));
+ /* Note that buf_page_is_accessed() returns
+ the time of the first access. If some blocks
+ of the extent existed in the buffer pool at
+ the time of a linear access pattern, the first
+ access times may be nonmonotonic, even though
+ the latest access times were linear. The
+ threshold (srv_read_ahead_factor) should help
+ a little against this. */
+ int res = ut_ulint_cmp(
+ buf_page_is_accessed(bpage),
+ buf_page_is_accessed(pred_bpage));
/* Accesses not in the right order */
if (res != 0 && res != asc_or_desc) {
fail_count++;
@@ -643,7 +480,7 @@ buf_read_ahead_linear(
LRU policy decision. */
buf_LRU_stat_inc_io();
- ++srv_read_ahead_seq;
+ buf_pool->stat.n_ra_pages_read += count;
return(count);
}
=== modified file 'storage/innodb_plugin/dict/dict0crea.c'
--- a/storage/innodb_plugin/dict/dict0crea.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/dict/dict0crea.c 2009-10-08 09:13:16 +0000
@@ -1379,7 +1379,7 @@ dict_create_add_foreign_field_to_diction
Add a single foreign key definition to the data dictionary tables in the
database. We also generate names to constraints that were not named by the
user. A generated constraint has a name of the format
-databasename/tablename_ibfk_<number>, where the numbers start from 1, and
+databasename/tablename_ibfk_NUMBER, where the numbers start from 1, and
are given locally for this table, that is, the number is not global, as in
the old format constraints < 4.0.18 it used to be.
@return error code or DB_SUCCESS */
=== modified file 'storage/innodb_plugin/dict/dict0dict.c'
--- a/storage/innodb_plugin/dict/dict0dict.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/dict/dict0dict.c 2009-10-09 12:52:18 +0000
@@ -82,9 +82,10 @@ static char dict_ibfk[] = "_ibfk_";
/*******************************************************************//**
Tries to find column names for the index and sets the col field of the
-index. */
+index.
+@return TRUE if the column names were found */
static
-void
+ibool
dict_index_find_cols(
/*=================*/
dict_table_t* table, /*!< in: table */
@@ -1169,7 +1170,7 @@ dict_col_name_is_reserved(
ulint i;
for (i = 0; i < UT_ARR_SIZE(reserved_names); i++) {
- if (strcmp(name, reserved_names[i]) == 0) {
+ if (innobase_strcasecmp(name, reserved_names[i]) == 0) {
return(TRUE);
}
@@ -1431,7 +1432,7 @@ add_field_size:
/**********************************************************************//**
Adds an index to the dictionary cache.
-@return DB_SUCCESS or DB_TOO_BIG_RECORD */
+@return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */
UNIV_INTERN
ulint
dict_index_add_to_cache(
@@ -1457,7 +1458,10 @@ dict_index_add_to_cache(
ut_a(!dict_index_is_clust(index)
|| UT_LIST_GET_LEN(table->indexes) == 0);
- dict_index_find_cols(table, index);
+ if (!dict_index_find_cols(table, index)) {
+
+ return(DB_CORRUPTION);
+ }
/* Build the cache internal representation of the index,
containing also the added system fields */
@@ -1665,9 +1669,10 @@ dict_index_remove_from_cache(
/*******************************************************************//**
Tries to find column names for the index and sets the col field of the
-index. */
+index.
+@return TRUE if the column names were found */
static
-void
+ibool
dict_index_find_cols(
/*=================*/
dict_table_t* table, /*!< in: table */
@@ -1692,17 +1697,21 @@ dict_index_find_cols(
}
}
+#ifdef UNIV_DEBUG
/* It is an error not to find a matching column. */
fputs("InnoDB: Error: no matching column for ", stderr);
ut_print_name(stderr, NULL, FALSE, field->name);
fputs(" in ", stderr);
dict_index_name_print(stderr, NULL, index);
fputs("!\n", stderr);
- ut_error;
+#endif /* UNIV_DEBUG */
+ return(FALSE);
found:
;
}
+
+ return(TRUE);
}
#endif /* !UNIV_HOTBACKUP */
=== modified file 'storage/innodb_plugin/fil/fil0fil.c'
--- a/storage/innodb_plugin/fil/fil0fil.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/fil/fil0fil.c 2009-11-03 10:24:21 +0000
@@ -594,6 +594,11 @@ fil_node_create(
UT_LIST_ADD_LAST(chain, space->chain, node);
+ if (id < SRV_LOG_SPACE_FIRST_ID && fil_system->max_assigned_id < id) {
+
+ fil_system->max_assigned_id = id;
+ }
+
mutex_exit(&fil_system->mutex);
}
@@ -613,12 +618,10 @@ fil_node_open_file(
ulint size_high;
ibool ret;
ibool success;
-#ifndef UNIV_HOTBACKUP
byte* buf2;
byte* page;
ulint space_id;
ulint flags;
-#endif /* !UNIV_HOTBACKUP */
ut_ad(mutex_own(&(system->mutex)));
ut_a(node->n_pending == 0);
@@ -654,9 +657,12 @@ fil_node_open_file(
size_bytes = (((ib_int64_t)size_high) << 32)
+ (ib_int64_t)size_low;
#ifdef UNIV_HOTBACKUP
- node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
- /* TODO: adjust to zip_size, like below? */
-#else
+ if (space->id == 0) {
+ node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
+ os_file_close(node->handle);
+ goto add_size;
+ }
+#endif /* UNIV_HOTBACKUP */
ut_a(space->purpose != FIL_LOG);
ut_a(space->id != 0);
@@ -735,7 +741,10 @@ fil_node_open_file(
(size_bytes
/ dict_table_flags_to_zip_size(flags));
}
-#endif
+
+#ifdef UNIV_HOTBACKUP
+add_size:
+#endif /* UNIV_HOTBACKUP */
space->size += node->size;
}
@@ -955,7 +964,7 @@ close_more:
" while the maximum\n"
"InnoDB: allowed value would be %lu.\n"
"InnoDB: You may need to raise the value of"
- " innodb_max_files_open in\n"
+ " innodb_open_files in\n"
"InnoDB: my.cnf.\n",
(ulong) fil_system->n_open,
(ulong) fil_system->max_n_open);
@@ -1535,7 +1544,7 @@ fil_open_log_and_system_tablespace_files
fprintf(stderr,
"InnoDB: Warning: you must"
" raise the value of"
- " innodb_max_open_files in\n"
+ " innodb_open_files in\n"
"InnoDB: my.cnf! Remember that"
" InnoDB keeps all log files"
" and all system\n"
@@ -2923,7 +2932,6 @@ fil_open_single_table_tablespace(
byte* page;
ulint space_id;
ulint space_flags;
- ibool ret = TRUE;
filepath = fil_make_ibd_name(name, FALSE);
@@ -3001,7 +3009,7 @@ fil_open_single_table_tablespace(
(ulong) space_id, (ulong) space_flags,
(ulong) id, (ulong) flags);
- ret = FALSE;
+ success = FALSE;
goto func_exit;
}
@@ -3021,7 +3029,7 @@ func_exit:
os_file_close(file);
mem_free(filepath);
- return(ret);
+ return(success);
}
#endif /* !UNIV_HOTBACKUP */
@@ -3237,7 +3245,7 @@ fil_load_single_table_tablespace(
fprintf(stderr,
"InnoDB: Renaming tablespace %s of id %lu,\n"
"InnoDB: to %s_ibbackup_old_vers_<timestamp>\n"
- "InnoDB: because its size %lld is too small"
+ "InnoDB: because its size %" PRId64 " is too small"
" (< 4 pages 16 kB each),\n"
"InnoDB: or the space id in the file header"
" is not sensible.\n"
@@ -3299,7 +3307,17 @@ fil_load_single_table_tablespace(
if (!success) {
- goto func_exit;
+ if (srv_force_recovery > 0) {
+ fprintf(stderr,
+ "InnoDB: innodb_force_recovery"
+ " was set to %lu. Continuing crash recovery\n"
+ "InnoDB: even though the tablespace creation"
+ " of this table failed.\n",
+ srv_force_recovery);
+ goto func_exit;
+ }
+
+ exit(1);
}
/* We do not use the size information we have about the file, because
=== modified file 'storage/innodb_plugin/fsp/fsp0fsp.c'
--- a/storage/innodb_plugin/fsp/fsp0fsp.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/fsp/fsp0fsp.c 2009-10-09 14:13:15 +0000
@@ -232,6 +232,9 @@ the extent are free and which contain ol
#define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE)
#ifndef UNIV_HOTBACKUP
+/* Flag to indicate if we have printed the tablespace full error. */
+static ibool fsp_tbs_full_error_printed = FALSE;
+
/**********************************************************************//**
Returns an extent to the free list of a space. */
static
@@ -1099,7 +1102,7 @@ fsp_header_inc_size(
/**********************************************************************//**
Gets the current free limit of the system tablespace. The free limit
-means the place of the first page which has never been put to the the
+means the place of the first page which has never been put to the
free list for allocation. The space above that address is initialized
to zero. Sets also the global variable log_fsp_current_free_limit.
@return free limit in megabytes */
@@ -1218,6 +1221,19 @@ fsp_try_extend_data_file(
if (space == 0 && !srv_auto_extend_last_data_file) {
+ /* We print the error message only once to avoid
+ spamming the error log. Note that we don't need
+ to reset the flag to FALSE as dealing with this
+ error requires server restart. */
+ if (fsp_tbs_full_error_printed == FALSE) {
+ fprintf(stderr,
+ "InnoDB: Error: Data file(s) ran"
+ " out of space.\n"
+ "Please add another data file or"
+ " use \'autoextend\' for the last"
+ " data file.\n");
+ fsp_tbs_full_error_printed = TRUE;
+ }
return(FALSE);
}
@@ -1832,6 +1848,8 @@ fsp_seg_inode_page_find_used(
if (!ut_dulint_is_zero(mach_read_from_8(inode + FSEG_ID))) {
/* This is used */
+ ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N)
+ == FSEG_MAGIC_N_VALUE);
return(i);
}
}
@@ -1863,6 +1881,9 @@ fsp_seg_inode_page_find_free(
return(i);
}
+
+ ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N)
+ == FSEG_MAGIC_N_VALUE);
}
return(ULINT_UNDEFINED);
@@ -1981,6 +2002,8 @@ fsp_alloc_seg_inode(
page + FSEG_INODE_PAGE_NODE, mtr);
}
+ ut_ad(ut_dulint_is_zero(mach_read_from_8(inode + FSEG_ID))
+ || mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
return(inode);
}
@@ -2018,7 +2041,7 @@ fsp_free_seg_inode(
}
mlog_write_dulint(inode + FSEG_ID, ut_dulint_zero, mtr);
- mlog_write_ulint(inode + FSEG_MAGIC_N, 0, MLOG_4BYTES, mtr);
+ mlog_write_ulint(inode + FSEG_MAGIC_N, 0xfa051ce3, MLOG_4BYTES, mtr);
if (ULINT_UNDEFINED
== fsp_seg_inode_page_find_used(page, zip_size, mtr)) {
@@ -2034,11 +2057,11 @@ fsp_free_seg_inode(
/**********************************************************************//**
Returns the file segment inode, page x-latched.
-@return segment inode, page x-latched */
+@return segment inode, page x-latched; NULL if the inode is free */
static
fseg_inode_t*
-fseg_inode_get(
-/*===========*/
+fseg_inode_try_get(
+/*===============*/
fseg_header_t* header, /*!< in: segment header */
ulint space, /*!< in: space id */
ulint zip_size,/*!< in: compressed page size in bytes
@@ -2054,12 +2077,38 @@ fseg_inode_get(
inode = fut_get_ptr(space, zip_size, inode_addr, RW_X_LATCH, mtr);
- ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
+ if (UNIV_UNLIKELY
+ (ut_dulint_is_zero(mach_read_from_8(inode + FSEG_ID)))) {
+
+ inode = NULL;
+ } else {
+ ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N)
+ == FSEG_MAGIC_N_VALUE);
+ }
return(inode);
}
/**********************************************************************//**
+Returns the file segment inode, page x-latched.
+@return segment inode, page x-latched */
+static
+fseg_inode_t*
+fseg_inode_get(
+/*===========*/
+ fseg_header_t* header, /*!< in: segment header */
+ ulint space, /*!< in: space id */
+ ulint zip_size,/*!< in: compressed page size in bytes
+ or 0 for uncompressed pages */
+ mtr_t* mtr) /*!< in: mtr handle */
+{
+ fseg_inode_t* inode
+ = fseg_inode_try_get(header, space, zip_size, mtr);
+ ut_a(inode);
+ return(inode);
+}
+
+/**********************************************************************//**
Gets the page number from the nth fragment page slot.
@return page number, FIL_NULL if not in use */
UNIV_INLINE
@@ -2073,6 +2122,7 @@ fseg_get_nth_frag_page_no(
ut_ad(inode && mtr);
ut_ad(n < FSEG_FRAG_ARR_N_SLOTS);
ut_ad(mtr_memo_contains_page(mtr, inode, MTR_MEMO_PAGE_X_FIX));
+ ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
return(mach_read_from_4(inode + FSEG_FRAG_ARR
+ n * FSEG_FRAG_SLOT_SIZE));
}
@@ -2091,6 +2141,7 @@ fseg_set_nth_frag_page_no(
ut_ad(inode && mtr);
ut_ad(n < FSEG_FRAG_ARR_N_SLOTS);
ut_ad(mtr_memo_contains_page(mtr, inode, MTR_MEMO_PAGE_X_FIX));
+ ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
mlog_write_ulint(inode + FSEG_FRAG_ARR + n * FSEG_FRAG_SLOT_SIZE,
page_no, MLOG_4BYTES, mtr);
@@ -2451,6 +2502,8 @@ fseg_fill_free_list(
xdes_set_state(descr, XDES_FSEG, mtr);
seg_id = mtr_read_dulint(inode + FSEG_ID, mtr);
+ ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N)
+ == FSEG_MAGIC_N_VALUE);
mlog_write_dulint(descr + XDES_ID, seg_id, mtr);
flst_add_last(inode + FSEG_FREE, descr + XDES_FLST_NODE, mtr);
@@ -2479,6 +2532,7 @@ fseg_alloc_free_extent(
fil_addr_t first;
ut_ad(!((page_offset(inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
+ ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
if (flst_get_len(inode + FSEG_FREE, mtr) > 0) {
/* Segment free list is not empty, allocate from it */
@@ -3136,6 +3190,8 @@ fseg_mark_page_used(
ut_ad(seg_inode && mtr);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
+ ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
+ == FSEG_MAGIC_N_VALUE);
descr = xdes_get_descriptor(space, zip_size, page, mtr);
@@ -3373,6 +3429,8 @@ fseg_free_extent(
ut_a(xdes_get_state(descr, mtr) == XDES_FSEG);
ut_a(0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID, mtr),
mtr_read_dulint(seg_inode + FSEG_ID, mtr)));
+ ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
+ == FSEG_MAGIC_N_VALUE);
first_page_in_extent = page - (page % FSP_EXTENT_SIZE);
@@ -3463,7 +3521,13 @@ fseg_free_step(
ut_a(descr);
ut_a(xdes_get_bit(descr, XDES_FREE_BIT,
header_page % FSP_EXTENT_SIZE, mtr) == FALSE);
- inode = fseg_inode_get(header, space, zip_size, mtr);
+ inode = fseg_inode_try_get(header, space, zip_size, mtr);
+
+ if (UNIV_UNLIKELY(inode == NULL)) {
+ fprintf(stderr, "double free of inode from %u:%u\n",
+ (unsigned) space, (unsigned) header_page);
+ return(TRUE);
+ }
descr = fseg_get_first_extent(inode, space, zip_size, mtr);
@@ -3587,6 +3651,7 @@ fseg_get_first_extent(
ut_ad(inode && mtr);
ut_ad(space == page_get_space_id(page_align(inode)));
+ ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
first = fil_addr_null;
@@ -3801,6 +3866,7 @@ fseg_print_low(
(ulong) reserved, (ulong) used, (ulong) n_full,
(ulong) n_frag, (ulong) n_free, (ulong) n_not_full,
(ulong) n_used);
+ ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
}
#ifdef UNIV_BTR_PRINT
=== modified file 'storage/innodb_plugin/handler/ha_innodb.cc'
--- a/storage/innodb_plugin/handler/ha_innodb.cc 2009-08-04 08:02:48 +0000
+++ b/storage/innodb_plugin/handler/ha_innodb.cc 2009-11-03 10:34:38 +0000
@@ -72,6 +72,7 @@ with this program; if not, write to the
/* Include necessary InnoDB headers */
extern "C" {
#include "univ.i"
+#include "buf0lru.h"
#include "btr0sea.h"
#include "os0file.h"
#include "os0thread.h"
@@ -106,7 +107,10 @@ extern "C" {
#include "i_s.h"
#ifndef MYSQL_SERVER
-/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t
+# ifndef MYSQL_PLUGIN_IMPORT
+# define MYSQL_PLUGIN_IMPORT /* nothing */
+# endif /* MYSQL_PLUGIN_IMPORT */
+/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t
is defined the same in both builds: the MySQL server and the InnoDB plugin. */
extern MYSQL_PLUGIN_IMPORT pthread_mutex_t LOCK_thread_count;
@@ -125,6 +129,7 @@ static ulong commit_threads = 0;
static pthread_mutex_t commit_threads_m;
static pthread_cond_t commit_cond;
static pthread_mutex_t commit_cond_m;
+static pthread_mutex_t analyze_mutex;
static bool innodb_inited = 0;
#define INSIDE_HA_INNOBASE_CC
@@ -152,6 +157,10 @@ static ulong innobase_write_io_threads;
static long long innobase_buffer_pool_size, innobase_log_file_size;
+/** Percentage of the buffer pool to reserve for 'old' blocks.
+Connected to buf_LRU_old_ratio. */
+static uint innobase_old_blocks_pct;
+
/* The default values for the following char* start-up parameters
are determined in innobase_init below: */
@@ -166,9 +175,7 @@ file formats in the configuration file,
of the supported file formats during runtime. */
static char* innobase_file_format_check = NULL;
-/* The following has a misleading name: starting from 4.0.5, this also
-affects Windows: */
-static char* innobase_unix_file_flush_method = NULL;
+static char* innobase_file_flush_method = NULL;
/* Below we have boolean-valued start-up parameters, and their default
values */
@@ -214,15 +221,19 @@ static void free_share(INNOBASE_SHARE *s
static int innobase_close_connection(handlerton *hton, THD* thd);
static int innobase_commit(handlerton *hton, THD* thd, bool all);
static int innobase_rollback(handlerton *hton, THD* thd, bool all);
-static int innobase_rollback_to_savepoint(handlerton *hton, THD* thd,
+static int innobase_rollback_to_savepoint(handlerton *hton, THD* thd,
void *savepoint);
static int innobase_savepoint(handlerton *hton, THD* thd, void *savepoint);
-static int innobase_release_savepoint(handlerton *hton, THD* thd,
+static int innobase_release_savepoint(handlerton *hton, THD* thd,
void *savepoint);
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
+/* "GEN_CLUST_INDEX" is the name reserved for Innodb default
+system primary index. */
+static const char innobase_index_reserve_name[]= "GEN_CLUST_INDEX";
+
/** @brief Initialize the default value of innodb_commit_concurrency.
Once InnoDB is running, the innodb_commit_concurrency must not change
@@ -492,10 +503,10 @@ static SHOW_VAR innodb_status_variables[
(char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG},
{"buffer_pool_pages_total",
(char*) &export_vars.innodb_buffer_pool_pages_total, SHOW_LONG},
- {"buffer_pool_read_ahead_rnd",
- (char*) &export_vars.innodb_buffer_pool_read_ahead_rnd, SHOW_LONG},
- {"buffer_pool_read_ahead_seq",
- (char*) &export_vars.innodb_buffer_pool_read_ahead_seq, SHOW_LONG},
+ {"buffer_pool_read_ahead",
+ (char*) &export_vars.innodb_buffer_pool_read_ahead, SHOW_LONG},
+ {"buffer_pool_read_ahead_evicted",
+ (char*) &export_vars.innodb_buffer_pool_read_ahead_evicted, SHOW_LONG},
{"buffer_pool_read_requests",
(char*) &export_vars.innodb_buffer_pool_read_requests, SHOW_LONG},
{"buffer_pool_reads",
@@ -865,17 +876,14 @@ convert_error_code_to_mysql(
return(ER_PRIMARY_CANT_HAVE_NULL);
case DB_TOO_MANY_CONCURRENT_TRXS:
- /* Once MySQL add the appropriate code to errmsg.txt then
- we can get rid of this #ifdef. NOTE: The code checked by
- the #ifdef is the suggested name for the error condition
- and the actual error code name could very well be different.
- This will require some monitoring, ie. the status
- of this request on our part.*/
-#ifdef ER_TOO_MANY_CONCURRENT_TRXS
- return(ER_TOO_MANY_CONCURRENT_TRXS);
-#else
+ /* New error code HA_ERR_TOO_MANY_CONCURRENT_TRXS is only
+ available in 5.1.38 and later, but the plugin should still
+ work with previous versions of MySQL. */
+#ifdef HA_ERR_TOO_MANY_CONCURRENT_TRXS
+ return(HA_ERR_TOO_MANY_CONCURRENT_TRXS);
+#else /* HA_ERR_TOO_MANY_CONCURRENT_TRXS */
return(HA_ERR_RECORD_FILE_FULL);
-#endif
+#endif /* HA_ERR_TOO_MANY_CONCURRENT_TRXS */
case DB_UNSUPPORTED:
return(HA_ERR_UNSUPPORTED);
}
@@ -949,7 +957,23 @@ innobase_get_cset_width(
*mbminlen = cs->mbminlen;
*mbmaxlen = cs->mbmaxlen;
} else {
- ut_a(cset == 0);
+ THD* thd = current_thd;
+
+ if (thd && thd_sql_command(thd) == SQLCOM_DROP_TABLE) {
+
+ /* Fix bug#46256: allow tables to be dropped if the
+ collation is not found, but issue a warning. */
+ if ((global_system_variables.log_warnings)
+ && (cset != 0)){
+
+ sql_print_warning(
+ "Unknown collation #%lu.", cset);
+ }
+ } else {
+
+ ut_a(cset == 0);
+ }
+
*mbminlen = *mbmaxlen = 0;
}
}
@@ -2151,7 +2175,7 @@ innobase_change_buffering_inited_ok:
/* --------------------------------------------------*/
- srv_file_flush_method_str = innobase_unix_file_flush_method;
+ srv_file_flush_method_str = innobase_file_flush_method;
srv_n_log_groups = (ulint) innobase_mirrored_log_groups;
srv_n_log_files = (ulint) innobase_log_files_in_group;
@@ -2206,6 +2230,9 @@ innobase_change_buffering_inited_ok:
ut_a(0 == strcmp(my_charset_latin1.name, "latin1_swedish_ci"));
srv_latin1_ordering = my_charset_latin1.sort_order;
+ innobase_old_blocks_pct = buf_LRU_old_ratio_update(
+ innobase_old_blocks_pct, FALSE);
+
innobase_commit_concurrency_init_default();
/* Since we in this module access directly the fields of a trx
@@ -2225,6 +2252,7 @@ innobase_change_buffering_inited_ok:
pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&analyze_mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&commit_cond, NULL);
innodb_inited= 1;
#ifdef MYSQL_DYNAMIC_PLUGIN
@@ -2279,6 +2307,7 @@ innobase_end(
pthread_mutex_destroy(&prepare_commit_mutex);
pthread_mutex_destroy(&commit_threads_m);
pthread_mutex_destroy(&commit_cond_m);
+ pthread_mutex_destroy(&analyze_mutex);
pthread_cond_destroy(&commit_cond);
}
@@ -2459,6 +2488,19 @@ retry:
}
}
+ /* The following calls to read the MySQL binary log
+ file name and the position return consistent results:
+ 1) Other InnoDB transactions cannot intervene between
+ these calls as we are holding prepare_commit_mutex.
+ 2) Binary logging of other engines is not relevant
+ to InnoDB as all InnoDB requires is that committing
+ InnoDB transactions appear in the same order in the
+ MySQL binary log as they appear in InnoDB logs.
+ 3) A MySQL log file rotation cannot happen because
+ MySQL protects against this by having a counter of
+ transactions in prepared state and it only allows
+ a rotation when the counter drops to zero. See
+ LOCK_prep_xids and COND_prep_xids in log.cc. */
trx->mysql_log_file_name = mysql_bin_log_file_name();
trx->mysql_log_offset = (ib_int64_t) mysql_bin_log_file_pos();
@@ -2544,6 +2586,8 @@ innobase_rollback(
innobase_release_stat_resources(trx);
+ trx->n_autoinc_rows = 0; /* Reset the number AUTO-INC rows required */
+
/* If we had reserved the auto-inc lock for some table (if
we come here to roll back the latest SQL statement) we
release it now before a possibly lengthy rollback */
@@ -3105,7 +3149,7 @@ retry:
if (is_part) {
sql_print_error("Failed to open table %s after "
- "%lu attemtps.\n", norm_name,
+ "%lu attempts.\n", norm_name,
retries);
}
@@ -3704,7 +3748,10 @@ ha_innobase::store_key_val_for_row(
} else if (mysql_type == MYSQL_TYPE_TINY_BLOB
|| mysql_type == MYSQL_TYPE_MEDIUM_BLOB
|| mysql_type == MYSQL_TYPE_BLOB
- || mysql_type == MYSQL_TYPE_LONG_BLOB) {
+ || mysql_type == MYSQL_TYPE_LONG_BLOB
+ /* MYSQL_TYPE_GEOMETRY data is treated
+ as BLOB data in innodb. */
+ || mysql_type == MYSQL_TYPE_GEOMETRY) {
CHARSET_INFO* cs;
ulint key_len;
@@ -5006,6 +5053,11 @@ ha_innobase::index_read(
index = prebuilt->index;
+ if (UNIV_UNLIKELY(index == NULL)) {
+ prebuilt->index_usable = FALSE;
+ DBUG_RETURN(HA_ERR_CRASHED);
+ }
+
/* Note that if the index for which the search template is built is not
necessarily prebuilt->index, but can also be the clustered index */
@@ -5165,6 +5217,7 @@ ha_innobase::change_active_index(
if (UNIV_UNLIKELY(!prebuilt->index)) {
sql_print_warning("InnoDB: change_active_index(%u) failed",
keynr);
+ prebuilt->index_usable = FALSE;
DBUG_RETURN(1);
}
@@ -5628,7 +5681,7 @@ create_table_def(
number fits in one byte in prtype */
push_warning_printf(
(THD*) trx->mysql_thd,
- MYSQL_ERROR::WARN_LEVEL_ERROR,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
ER_CANT_CREATE_TABLE,
"In InnoDB, charset-collation codes"
" must be below 256."
@@ -5657,6 +5710,28 @@ create_table_def(
}
}
+ /* First check whether the column to be added has a
+ system reserved name. */
+ if (dict_col_name_is_reserved(field->field_name)){
+ push_warning_printf(
+ (THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_CREATE_TABLE,
+ "Error creating table '%s' with "
+ "column name '%s'. '%s' is a "
+ "reserved name. Please try to "
+ "re-create the table with a "
+ "different column name.",
+ table->name, (char*) field->field_name,
+ (char*) field->field_name);
+
+ dict_mem_table_free(table);
+ trx_commit_for_mysql(trx);
+
+ error = DB_ERROR;
+ goto error_ret;
+ }
+
dict_mem_table_add_col(table, table->heap,
(char*) field->field_name,
col_type,
@@ -5670,6 +5745,7 @@ create_table_def(
error = row_create_table_for_mysql(table, trx);
+error_ret:
error = convert_error_code_to_mysql(error, flags, NULL);
DBUG_RETURN(error);
@@ -5708,6 +5784,9 @@ create_index(
n_fields = key->key_parts;
+ /* Assert that "GEN_CLUST_INDEX" cannot be used as non-primary index */
+ ut_a(innobase_strcasecmp(key->name, innobase_index_reserve_name) != 0);
+
ind_type = 0;
if (key_num == form->s->primary_key) {
@@ -5816,8 +5895,8 @@ create_clustered_index_when_no_primary(
/* We pass 0 as the space id, and determine at a lower level the space
id where to store the table */
-
- index = dict_mem_index_create(table_name, "GEN_CLUST_INDEX",
+ index = dict_mem_index_create(table_name,
+ innobase_index_reserve_name,
0, DICT_CLUSTERED, 0);
error = row_create_index_for_mysql(index, trx, NULL);
@@ -5870,7 +5949,7 @@ create_options_are_valid(
/* Valid value. */
break;
default:
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: invalid"
" KEY_BLOCK_SIZE = %lu."
@@ -5884,7 +5963,7 @@ create_options_are_valid(
/* If KEY_BLOCK_SIZE was specified, check for its
dependencies. */
if (kbs_specified && !srv_file_per_table) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: KEY_BLOCK_SIZE"
" requires innodb_file_per_table.");
@@ -5892,7 +5971,7 @@ create_options_are_valid(
}
if (kbs_specified && srv_file_format < DICT_TF_FORMAT_ZIP) {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: KEY_BLOCK_SIZE"
" requires innodb_file_format >"
@@ -5916,7 +5995,7 @@ create_options_are_valid(
if (!srv_file_per_table) {
push_warning_printf(
thd,
- MYSQL_ERROR::WARN_LEVEL_ERROR,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ROW_FORMAT=%s"
" requires innodb_file_per_table.",
@@ -5928,7 +6007,7 @@ create_options_are_valid(
if (srv_file_format < DICT_TF_FORMAT_ZIP) {
push_warning_printf(
thd,
- MYSQL_ERROR::WARN_LEVEL_ERROR,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ROW_FORMAT=%s"
" requires innodb_file_format >"
@@ -5945,7 +6024,7 @@ create_options_are_valid(
&& form->s->row_type == ROW_TYPE_DYNAMIC) {
push_warning_printf(
thd,
- MYSQL_ERROR::WARN_LEVEL_ERROR,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: cannot specify"
" ROW_FORMAT = DYNAMIC with"
@@ -5969,7 +6048,7 @@ create_options_are_valid(
if (kbs_specified) {
push_warning_printf(
thd,
- MYSQL_ERROR::WARN_LEVEL_ERROR,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: cannot specify"
" ROW_FORMAT = %s with"
@@ -5982,7 +6061,7 @@ create_options_are_valid(
default:
push_warning(thd,
- MYSQL_ERROR::WARN_LEVEL_ERROR,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: invalid ROW_FORMAT specifier.");
ret = FALSE;
@@ -6046,13 +6125,15 @@ ha_innobase::create(
1. <database_name>/<table_name>: for normal table creation
2. full path: for temp table creation, or sym link
- When srv_file_per_table is on, check for full path pattern, i.e.
+ When srv_file_per_table is on and mysqld_embedded is off,
+ check for full path pattern, i.e.
X:\dir\..., X is a driver letter, or
\\dir1\dir2\..., UNC path
returns error if it is in full path format, but not creating a temp.
table. Currently InnoDB does not support symbolic link on Windows. */
if (srv_file_per_table
+ && !mysqld_embedded
&& (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
if ((name[1] == ':')
@@ -6243,14 +6324,6 @@ ha_innobase::create(
flags = DICT_TF_COMPACT;
}
- error = create_table_def(trx, form, norm_name,
- create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL,
- flags);
-
- if (error) {
- goto cleanup;
- }
-
/* Look for a primary key */
primary_key_no= (form->s->primary_key != MAX_KEY ?
@@ -6262,6 +6335,23 @@ ha_innobase::create(
ut_a(primary_key_no == -1 || primary_key_no == 0);
+ /* Check for name conflicts (with reserved name) for
+ any user indices to be created. */
+ if (innobase_index_name_is_reserved(trx, form->key_info,
+ form->s->keys)) {
+ error = -1;
+ goto cleanup;
+ }
+
+ error = create_table_def(trx, form, norm_name,
+ create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL,
+ flags);
+
+ if (error) {
+ goto cleanup;
+ }
+
+
/* Create the keys */
if (form->s->keys == 0 || primary_key_no == -1) {
@@ -6335,18 +6425,22 @@ ha_innobase::create(
setup at this stage and so we use thd. */
/* We need to copy the AUTOINC value from the old table if
- this is an ALTER TABLE. */
+ this is an ALTER TABLE or CREATE INDEX because CREATE INDEX
+ does a table copy too. */
if (((create_info->used_fields & HA_CREATE_USED_AUTO)
- || thd_sql_command(thd) == SQLCOM_ALTER_TABLE)
- && create_info->auto_increment_value != 0) {
-
- /* Query was ALTER TABLE...AUTO_INCREMENT = x; or
- CREATE TABLE ...AUTO_INCREMENT = x; Find out a table
- definition from the dictionary and get the current value
- of the auto increment field. Set a new value to the
- auto increment field if the value is greater than the
- maximum value in the column. */
+ || thd_sql_command(thd) == SQLCOM_ALTER_TABLE
+ || thd_sql_command(thd) == SQLCOM_CREATE_INDEX)
+ && create_info->auto_increment_value > 0) {
+
+ /* Query was one of :
+ CREATE TABLE ...AUTO_INCREMENT = x; or
+ ALTER TABLE...AUTO_INCREMENT = x; or
+ CREATE INDEX x on t(...);
+ Find out a table definition from the dictionary and get
+ the current value of the auto increment field. Set a new
+ value to the auto increment field if the value is greater
+ than the maximum value in the column. */
auto_inc_value = create_info->auto_increment_value;
@@ -7200,9 +7294,15 @@ ha_innobase::analyze(
THD* thd, /*!< in: connection thread handle */
HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
{
+ /* Serialize ANALYZE TABLE inside InnoDB, see
+ Bug#38996 Race condition in ANALYZE TABLE */
+ pthread_mutex_lock(&analyze_mutex);
+
/* Simply call ::info() with all the flags */
info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
+ pthread_mutex_unlock(&analyze_mutex);
+
return(0);
}
@@ -7797,8 +7897,9 @@ ha_innobase::external_lock(
{
ulong const binlog_format= thd_binlog_format(thd);
ulong const tx_isolation = thd_tx_isolation(ha_thd());
- if (tx_isolation <= ISO_READ_COMMITTED &&
- binlog_format == BINLOG_FORMAT_STMT)
+ if (tx_isolation <= ISO_READ_COMMITTED
+ && binlog_format == BINLOG_FORMAT_STMT
+ && thd_binlog_filter_ok(thd))
{
char buf[256];
my_snprintf(buf, sizeof(buf),
@@ -8446,6 +8547,7 @@ ha_innobase::store_lock(
&& isolation_level != TRX_ISO_SERIALIZABLE
&& (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT)
&& (sql_command == SQLCOM_INSERT_SELECT
+ || sql_command == SQLCOM_REPLACE_SELECT
|| sql_command == SQLCOM_UPDATE
|| sql_command == SQLCOM_CREATE_TABLE)) {
@@ -8453,10 +8555,11 @@ ha_innobase::store_lock(
option set or this session is using READ COMMITTED
isolation level and isolation level of the transaction
is not set to serializable and MySQL is doing
- INSERT INTO...SELECT or UPDATE ... = (SELECT ...) or
- CREATE ... SELECT... without FOR UPDATE or
- IN SHARE MODE in select, then we use consistent
- read for select. */
+ INSERT INTO...SELECT or REPLACE INTO...SELECT
+ or UPDATE ... = (SELECT ...) or CREATE ...
+ SELECT... without FOR UPDATE or IN SHARE
+ MODE in select, then we use consistent read
+ for select. */
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = LOCK_NONE;
@@ -8676,6 +8779,7 @@ ha_innobase::get_auto_increment(
AUTOINC counter after attempting to insert the row. */
if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) {
ulonglong need;
+ ulonglong current;
ulonglong next_value;
ulonglong col_max_value;
@@ -8684,11 +8788,12 @@ ha_innobase::get_auto_increment(
col_max_value = innobase_get_int_col_max_value(
table->next_number_field);
+ current = *first_value > col_max_value ? autoinc : *first_value;
need = *nb_reserved_values * increment;
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
- *first_value, need, offset, col_max_value);
+ current, need, offset, col_max_value);
prebuilt->autoinc_last_value = next_value;
@@ -9612,6 +9717,25 @@ innodb_adaptive_hash_index_update(
}
}
+/****************************************************************//**
+Update the system variable innodb_old_blocks_pct using the "saved"
+value. This function is registered as a callback with MySQL. */
+static
+void
+innodb_old_blocks_pct_update(
+/*=========================*/
+ THD* thd, /*!< in: thread handle */
+ struct st_mysql_sys_var* var, /*!< in: pointer to
+ system variable */
+ void* var_ptr,/*!< out: where the
+ formal string goes */
+ const void* save) /*!< in: immediate result
+ from check function */
+{
+ innobase_old_blocks_pct = buf_LRU_old_ratio_update(
+ *static_cast<const uint*>(save), TRUE);
+}
+
/*************************************************************//**
Check if it is a valid value of innodb_change_buffering. This function is
registered as a callback with MySQL.
@@ -9685,6 +9809,49 @@ static int show_innodb_vars(THD *thd, SH
return 0;
}
+/***********************************************************************
+This function checks each index name for a table against reserved
+system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
+this function pushes an warning message to the client, and returns true. */
+extern "C" UNIV_INTERN
+bool
+innobase_index_name_is_reserved(
+/*============================*/
+ /* out: true if an index name
+ matches the reserved name */
+ const trx_t* trx, /* in: InnoDB transaction handle */
+ const KEY* key_info, /* in: Indexes to be created */
+ ulint num_of_keys) /* in: Number of indexes to
+ be created. */
+{
+ const KEY* key;
+ uint key_num; /* index number */
+
+ for (key_num = 0; key_num < num_of_keys; key_num++) {
+ key = &key_info[key_num];
+
+ if (innobase_strcasecmp(key->name,
+ innobase_index_reserve_name) == 0) {
+ /* Push warning to mysql */
+ push_warning_printf((THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WRONG_NAME_FOR_INDEX,
+ "Cannot Create Index with name "
+ "'%s'. The name is reserved "
+ "for the system default primary "
+ "index.",
+ innobase_index_reserve_name);
+
+ my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0),
+ innobase_index_reserve_name);
+
+ return(true);
+ }
+ }
+
+ return(false);
+}
+
static SHOW_VAR innodb_status_variables_export[]= {
{"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
@@ -9753,7 +9920,7 @@ static MYSQL_SYSVAR_ULONG(flush_log_at_t
" or 2 (write at commit, flush once per second).",
NULL, NULL, 1, 0, 2, 0);
-static MYSQL_SYSVAR_STR(flush_method, innobase_unix_file_flush_method,
+static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"With which method to flush data.", NULL, NULL, NULL);
@@ -9849,7 +10016,7 @@ static MYSQL_SYSVAR_ULONG(concurrency_ti
NULL, NULL, 500L, 1L, ~0L, 0);
static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads,
- PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR,
"Number of file I/O threads in InnoDB.",
NULL, NULL, 4, 4, 64, 0);
@@ -9888,6 +10055,18 @@ static MYSQL_SYSVAR_LONG(mirrored_log_gr
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.",
NULL, NULL, 1, 1, 10, 0);
+static MYSQL_SYSVAR_UINT(old_blocks_pct, innobase_old_blocks_pct,
+ PLUGIN_VAR_RQCMDARG,
+ "Percentage of the buffer pool to reserve for 'old' blocks.",
+ NULL, innodb_old_blocks_pct_update, 100 * 3 / 8, 5, 95, 0);
+
+static MYSQL_SYSVAR_UINT(old_blocks_time, buf_LRU_old_threshold_ms,
+ PLUGIN_VAR_RQCMDARG,
+ "Move blocks to the 'new' end of the buffer pool if the first access"
+ " was at least this many milliseconds ago."
+ " The timeout is disabled if 0 (the default).",
+ NULL, NULL, 0, 0, UINT_MAX32, 0);
+
static MYSQL_SYSVAR_LONG(open_files, innobase_open_files,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"How many files at the maximum InnoDB keeps open at the same time.",
@@ -9986,6 +10165,8 @@ static struct st_mysql_sys_var* innobase
MYSQL_SYSVAR(adaptive_flushing),
MYSQL_SYSVAR(max_purge_lag),
MYSQL_SYSVAR(mirrored_log_groups),
+ MYSQL_SYSVAR(old_blocks_pct),
+ MYSQL_SYSVAR(old_blocks_time),
MYSQL_SYSVAR(open_files),
MYSQL_SYSVAR(rollback_on_timeout),
MYSQL_SYSVAR(stats_on_metadata),
=== modified file 'storage/innodb_plugin/handler/ha_innodb.h'
--- a/storage/innodb_plugin/handler/ha_innodb.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/handler/ha_innodb.h 2009-11-03 10:07:51 +0000
@@ -257,6 +257,13 @@ int thd_binlog_format(const MYSQL_THD th
@param all TRUE <=> rollback main transaction.
*/
void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
+
+/**
+ Check if binary logging is filtered for thread's current db.
+ @param thd Thread handle
+ @retval 1 the query is not filtered, 0 otherwise.
+*/
+bool thd_binlog_filter_ok(const MYSQL_THD thd);
}
typedef struct trx_struct trx_t;
@@ -282,3 +289,21 @@ trx_t*
innobase_trx_allocate(
/*==================*/
MYSQL_THD thd); /*!< in: user thread handle */
+
+
+/*********************************************************************//**
+This function checks each index name for a table against reserved
+system default primary index name 'GEN_CLUST_INDEX'. If a name
+matches, this function pushes an warning message to the client,
+and returns true. */
+extern "C"
+bool
+innobase_index_name_is_reserved(
+/*============================*/
+ /* out: true if the index name
+ matches the reserved name */
+ const trx_t* trx, /* in: InnoDB transaction handle */
+ const KEY* key_info, /* in: Indexes to be created */
+ ulint num_of_keys); /* in: Number of indexes to
+ be created. */
+
=== modified file 'storage/innodb_plugin/handler/handler0alter.cc'
--- a/storage/innodb_plugin/handler/handler0alter.cc 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/handler/handler0alter.cc 2009-11-03 10:07:51 +0000
@@ -628,7 +628,7 @@ ha_innobase::add_index(
ulint num_created = 0;
ibool dict_locked = FALSE;
ulint new_primary;
- ulint error;
+ int error;
DBUG_ENTER("ha_innobase::add_index");
ut_a(table);
@@ -656,14 +656,18 @@ ha_innobase::add_index(
innodb_table = indexed_table
= dict_table_get(prebuilt->table->name, FALSE);
- /* Check that index keys are sensible */
-
- error = innobase_check_index_keys(key_info, num_of_keys);
+ /* Check if the index name is reserved. */
+ if (innobase_index_name_is_reserved(trx, key_info, num_of_keys)) {
+ error = -1;
+ } else {
+ /* Check that index keys are sensible */
+ error = innobase_check_index_keys(key_info, num_of_keys);
+ }
if (UNIV_UNLIKELY(error)) {
err_exit:
mem_heap_free(heap);
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
trx_free_for_mysql(trx);
trx_commit_for_mysql(prebuilt->trx);
DBUG_RETURN(error);
@@ -801,7 +805,7 @@ error_handling:
alter table t drop index b, add index (b);
The fix will have to parse the SQL and note that the index
- being added has the same name as the the one being dropped and
+ being added has the same name as the one being dropped and
ignore that in the dup index check.*/
//dict_table_check_for_dup_indexes(prebuilt->table);
#endif
@@ -863,6 +867,7 @@ error_handling:
indexed_table->n_mysql_handles_opened++;
error = row_merge_drop_table(trx, innodb_table);
+ innodb_table = indexed_table;
goto convert_error;
case DB_TOO_BIG_RECORD:
=== removed file 'storage/innodb_plugin/handler/handler0vars.h'
--- a/storage/innodb_plugin/handler/handler0vars.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/handler/handler0vars.h 1970-01-01 00:00:00 +0000
@@ -1,69 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2008, 2009, Innobase Oy. All Rights Reserved.
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/*******************************************************************//**
-@file handler/handler0vars.h
-This file contains accessor functions for dynamic plugin on Windows.
-***********************************************************************/
-
-#if defined __WIN__ && defined MYSQL_DYNAMIC_PLUGIN
-/*******************************************************************//**
-This is a list of externals that can not be resolved by delay loading.
-They have to be resolved indirectly via their addresses in the .map file.
-All of them are external variables. */
-extern CHARSET_INFO* wdl_my_charset_bin;
-extern CHARSET_INFO* wdl_my_charset_latin1;
-extern CHARSET_INFO* wdl_my_charset_filename;
-extern CHARSET_INFO** wdl_system_charset_info;
-extern CHARSET_INFO** wdl_default_charset_info;
-extern CHARSET_INFO** wdl_all_charsets;
-extern system_variables* wdl_global_system_variables;
-extern char* wdl_mysql_real_data_home;
-extern char** wdl_mysql_data_home;
-extern char** wdl_tx_isolation_names;
-extern char** wdl_binlog_format_names;
-extern char* wdl_reg_ext;
-extern pthread_mutex_t* wdl_LOCK_thread_count;
-extern key_map* wdl_key_map_full;
-extern MY_TMPDIR* wdl_mysql_tmpdir_list;
-extern bool* wdl_mysqld_embedded;
-extern uint* wdl_lower_case_table_names;
-extern ulong* wdl_specialflag;
-extern int* wdl_my_umask;
-
-#define my_charset_bin (*wdl_my_charset_bin)
-#define my_charset_latin1 (*wdl_my_charset_latin1)
-#define my_charset_filename (*wdl_my_charset_filename)
-#define system_charset_info (*wdl_system_charset_info)
-#define default_charset_info (*wdl_default_charset_info)
-#define all_charsets (wdl_all_charsets)
-#define global_system_variables (*wdl_global_system_variables)
-#define mysql_real_data_home (wdl_mysql_real_data_home)
-#define mysql_data_home (*wdl_mysql_data_home)
-#define tx_isolation_names (wdl_tx_isolation_names)
-#define binlog_format_names (wdl_binlog_format_names)
-#define reg_ext (wdl_reg_ext)
-#define LOCK_thread_count (*wdl_LOCK_thread_count)
-#define key_map_full (*wdl_key_map_full)
-#define mysql_tmpdir_list (*wdl_mysql_tmpdir_list)
-#define mysqld_embedded (*wdl_mysqld_embedded)
-#define lower_case_table_names (*wdl_lower_case_table_names)
-#define specialflag (*wdl_specialflag)
-#define my_umask (*wdl_my_umask)
-
-#endif
=== removed file 'storage/innodb_plugin/handler/win_delay_loader.cc'
--- a/storage/innodb_plugin/handler/win_delay_loader.cc 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/handler/win_delay_loader.cc 1970-01-01 00:00:00 +0000
@@ -1,1024 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2008, 2009, Innobase Oy. All Rights Reserved.
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
-
-*****************************************************************************/
-
-/*******************************************************************//**
-@file handler/win_delay_loader.cc
-This file contains functions that implement the delay loader on Windows.
-
-This is a customized version of delay loader with limited functionalities.
-It does not support:
-
-* (manual) unloading
-* multiple delay loaded DLLs
-* multiple loading of the same DLL
-
-This delay loader is used only by the InnoDB plugin. Other components (DLLs)
-can still use the default delay loader, provided by MSVC.
-
-Several acronyms used by Microsoft:
- * IAT: import address table
- * INT: import name table
- * RVA: Relative Virtual Address
-
-See http://msdn.microsoft.com/en-us/magazine/bb985992.aspx for details of
-PE format.
-***********************************************************************/
-#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN)
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# include <delayimp.h>
-# include <mysql_priv.h>
-
-extern "C" {
-# include "univ.i"
-# include "hash0hash.h"
-}
-
-/*******************************************************************//**
-This following contains a list of externals that can not be resolved by
-delay loading. They have to be resolved indirectly via their addresses
-in the .map file. All of them are external variables. */
-CHARSET_INFO* wdl_my_charset_bin;
-CHARSET_INFO* wdl_my_charset_latin1;
-CHARSET_INFO* wdl_my_charset_filename;
-CHARSET_INFO** wdl_system_charset_info;
-CHARSET_INFO** wdl_default_charset_info;
-CHARSET_INFO** wdl_all_charsets;
-system_variables* wdl_global_system_variables;
-char* wdl_mysql_real_data_home;
-char** wdl_mysql_data_home;
-char** wdl_tx_isolation_names;
-char** wdl_binlog_format_names;
-char* wdl_reg_ext;
-pthread_mutex_t* wdl_LOCK_thread_count;
-key_map* wdl_key_map_full;
-MY_TMPDIR* wdl_mysql_tmpdir_list;
-bool* wdl_mysqld_embedded;
-uint* wdl_lower_case_table_names;
-ulong* wdl_specialflag;
-int* wdl_my_umask;
-
-/*******************************************************************//**
-The preferred load-address defined in PE (portable executable format). */
-#if defined(_M_IA64)
-#pragma section(".base", long, read)
-extern "C"
-__declspec(allocate(".base"))
-const IMAGE_DOS_HEADER __ImageBase;
-#else
-extern "C"
-const IMAGE_DOS_HEADER __ImageBase;
-#endif
-
-/*******************************************************************//**
-A template function for converting a relative address (RVA) to an
-absolute address (VA). This is due to the pointers in the delay
-descriptor (ImgDelayDescr in delayimp.h) have been changed from
-VAs to RVAs to work on both 32- and 64-bit platforms.
-@return absolute virtual address */
-template <class X>
-X PFromRva(
-/*=======*/
- RVA rva) /*!< in: relative virtual address */
-{
- return X(PBYTE(&__ImageBase) + rva);
-}
-
-/*******************************************************************//**
-Convert to the old format for convenience. The structure as well as its
-element names follow the definition of ImgDelayDescr in delayimp.h. */
-struct InternalImgDelayDescr
-{
- DWORD grAttrs; /*!< attributes */
- LPCSTR szName; /*!< pointer to dll name */
- HMODULE* phmod; /*!< address of module handle */
- PImgThunkData pIAT; /*!< address of the IAT */
- PCImgThunkData pINT; /*!< address of the INT */
- PCImgThunkData pBoundIAT; /*!< address of the optional bound IAT */
- PCImgThunkData pUnloadIAT; /*!< address of optional copy of
- original IAT */
- DWORD dwTimeStamp; /*!< 0 if not bound,
- otherwise date/time stamp of DLL
- bound to (Old BIND) */
-};
-
-typedef struct map_hash_chain_struct map_hash_chain_t;
-
-struct map_hash_chain_struct {
- char* symbol; /*!< pointer to a symbol */
- ulint value; /*!< address of the symbol */
- map_hash_chain_t* next; /*!< pointer to the next cell
- in the same folder. */
- map_hash_chain_t* chain; /*!< a linear chain used for
- cleanup. */
-};
-
-static HMODULE my_hmod = 0;
-static struct hash_table_struct* m_htbl = NULL ;
-static map_hash_chain_t* chain_header = NULL;
-static ibool wdl_init = FALSE;
-const ulint MAP_HASH_CELLS_NUM = 10000;
-
-#ifndef DBUG_OFF
-/*******************************************************************//**
-In the dynamic plugin, it is required to call the following dbug functions
-in the server:
- _db_pargs_
- _db_doprnt_
- _db_enter_
- _db_return_
- _db_dump_
-
-The plugin will get those function pointers during the initialization. */
-typedef void (__cdecl* pfn_db_enter_)(
- const char* _func_,
- const char* _file_,
- uint _line_,
- const char** _sfunc_,
- const char** _sfile_,
- uint* _slevel_,
- char***);
-
-typedef void (__cdecl* pfn_db_return_)(
- uint _line_,
- const char** _sfunc_,
- const char** _sfile_,
- uint* _slevel_);
-
-typedef void (__cdecl* pfn_db_pargs_)(
- uint _line_,
- const char* keyword);
-
-typedef void (__cdecl* pfn_db_doprnt_)(
- const char* format,
- ...);
-
-typedef void (__cdecl* pfn_db_dump_)(
- uint _line_,
- const char* keyword,
- const unsigned char* memory,
- size_t length);
-
-static pfn_db_enter_ wdl_db_enter_;
-static pfn_db_return_ wdl_db_return_;
-static pfn_db_pargs_ wdl_db_pargs_;
-static pfn_db_doprnt_ wdl_db_doprnt_;
-static pfn_db_dump_ wdl_db_dump_;
-#endif /* !DBUG_OFF */
-
-/*************************************************************//**
-Creates a hash table with >= n array cells. The actual number of cells is
-chosen to be a prime number slightly bigger than n.
-
-This is the same function as hash_create in hash0hash.c, except the
-memory allocation. This function is invoked before the engine is
-initialized, and buffer pools are not ready yet.
-@return own: created hash table */
-static
-hash_table_t*
-wdl_hash_create(
-/*============*/
- ulint n) /*!< in: number of array cells */
-{
- hash_cell_t* array;
- ulint prime;
- hash_table_t* table;
-
- prime = ut_find_prime(n);
-
- table = (hash_table_t*) malloc(sizeof(hash_table_t));
- if (table == NULL) {
- return(NULL);
- }
-
- array = (hash_cell_t*) malloc(sizeof(hash_cell_t) * prime);
- if (array == NULL) {
- free(table);
- return(NULL);
- }
-
- table->array = array;
- table->n_cells = prime;
- table->n_mutexes = 0;
- table->mutexes = NULL;
- table->heaps = NULL;
- table->heap = NULL;
- table->magic_n = HASH_TABLE_MAGIC_N;
-
- /* Initialize the cell array */
- hash_table_clear(table);
-
- return(table);
-}
-
-/*************************************************************//**
-Frees a hash table. */
-static
-void
-wdl_hash_table_free(
-/*================*/
- hash_table_t* table) /*!< in, own: hash table */
-{
- ut_a(table != NULL);
- ut_a(table->mutexes == NULL);
-
- free(table->array);
- free(table);
-}
-
-/*******************************************************************//**
-Function for calculating the count of imports given the base of the IAT.
-@return number of imports */
-static
-ulint
-wdl_import_count(
-/*=============*/
- PCImgThunkData pitd_base) /*!< in: base of the IAT */
-{
- ulint ret = 0;
- PCImgThunkData pitd = pitd_base;
-
- while (pitd->u1.Function) {
- pitd++;
- ret++;
- }
-
- return(ret);
-}
-
-/*******************************************************************//**
-Read Mapfile to a hashtable for faster access
-@return TRUE if the mapfile is loaded successfully. */
-static
-ibool
-wdl_load_mapfile(
-/*=============*/
- const char* filename) /*!< in: name of the mapfile. */
-{
- FILE* fp;
- const size_t nSize = 256;
- char tmp_buf[nSize];
- char* func_name;
- char* func_addr;
- ulint load_addr = 0;
- ibool valid_load_addr = FALSE;
-#ifdef _WIN64
- const char* tmp_string = " Preferred load address is %16llx";
-#else
- const char* tmp_string = " Preferred load address is %08x";
-#endif
-
- fp = fopen(filename, "r");
- if (fp == NULL) {
-
- return(FALSE);
- }
-
- /* Check whether to create the hashtable */
- if (m_htbl == NULL) {
-
- m_htbl = wdl_hash_create(MAP_HASH_CELLS_NUM);
-
- if (m_htbl == NULL) {
-
- fclose(fp);
- return(FALSE);
- }
- }
-
- /* Search start of symbol list and get the preferred load address */
- while (fgets(tmp_buf, sizeof(tmp_buf), fp)) {
-
- if (sscanf(tmp_buf, tmp_string, &load_addr) == 1) {
-
- valid_load_addr = TRUE;
- }
-
- if (strstr(tmp_buf, "Rva+Base") != NULL) {
-
- break;
- }
- }
-
- if (valid_load_addr == FALSE) {
-
- /* No "Preferred load address", the map file is wrong. */
- fclose(fp);
- return(FALSE);
- }
-
- /* Read symbol list */
- while (fgets(tmp_buf, sizeof(tmp_buf), fp))
- {
- map_hash_chain_t* map_cell;
- ulint map_fold;
-
- if (*tmp_buf == 0) {
-
- continue;
- }
-
- func_name = strtok(tmp_buf, " ");
- func_name = strtok(NULL, " ");
- func_addr = strtok(NULL, " ");
-
- if (func_name && func_addr) {
-
- ut_snprintf(tmp_buf, nSize, "0x%s", func_addr);
- if (*func_name == '_') {
-
- func_name++;
- }
-
- map_cell = (map_hash_chain_t*)
- malloc(sizeof(map_hash_chain_t));
- if (map_cell == NULL) {
- return(FALSE);
- }
-
- /* Chain all cells together */
- map_cell->chain = chain_header;
- chain_header = map_cell;
-
- map_cell->symbol = strdup(func_name);
- map_cell->value = (ulint) _strtoui64(tmp_buf, NULL, 0)
- - load_addr;
- map_fold = ut_fold_string(map_cell->symbol);
-
- HASH_INSERT(map_hash_chain_t,
- next,
- m_htbl,
- map_fold,
- map_cell);
- }
- }
-
- fclose(fp);
-
- return(TRUE);
-}
-
-/*************************************************************//**
-Cleanup.during DLL unload */
-static
-void
-wdl_cleanup(void)
-/*=============*/
-{
- while (chain_header != NULL) {
- map_hash_chain_t* tmp;
-
- tmp = chain_header->chain;
- free(chain_header->symbol);
- free(chain_header);
- chain_header = tmp;
- }
-
- if (m_htbl != NULL) {
-
- wdl_hash_table_free(m_htbl);
- }
-}
-
-/*******************************************************************//**
-Load the mapfile mysqld.map.
-@return the module handle */
-static
-HMODULE
-wdl_get_mysqld_mapfile(void)
-/*========================*/
-{
- char file_name[MAX_PATH];
- char* ext;
- ulint err;
-
- if (my_hmod == 0) {
-
- size_t nSize = MAX_PATH - strlen(".map") -1;
-
- /* First find out the name of current executable */
- my_hmod = GetModuleHandle(NULL);
- if (my_hmod == 0) {
-
- return(my_hmod);
- }
-
- err = GetModuleFileName(my_hmod, file_name, nSize);
- if (err == 0) {
-
- my_hmod = 0;
- return(my_hmod);
- }
-
- ext = strrchr(file_name, '.');
- if (ext != NULL) {
-
- *ext = 0;
- strcat(file_name, ".map");
-
- err = wdl_load_mapfile(file_name);
- if (err == 0) {
-
- my_hmod = 0;
- }
- } else {
-
- my_hmod = 0;
- }
- }
-
- return(my_hmod);
-}
-
-/*******************************************************************//**
-Retrieves the address of an exported function. It follows the convention
-of GetProcAddress().
-@return address of exported function. */
-static
-FARPROC
-wdl_get_procaddr_from_map(
-/*======================*/
- HANDLE m_handle, /*!< in: module handle */
- const char* import_proc) /*!< in: procedure name */
-{
- map_hash_chain_t* hash_chain;
- ulint map_fold;
-
- map_fold = ut_fold_string(import_proc);
- HASH_SEARCH(
- next,
- m_htbl,
- map_fold,
- map_hash_chain_t*,
- hash_chain,
- ,
- (ut_strcmp(hash_chain->symbol, import_proc) == 0));
-
- if (hash_chain == NULL) {
-
-#ifdef _WIN64
- /* On Win64, the leading '_' may not be taken out. In this
- case, search again without the leading '_'. */
- if (*import_proc == '_') {
-
- import_proc++;
- }
-
- map_fold = ut_fold_string(import_proc);
- HASH_SEARCH(
- next,
- m_htbl,
- map_fold,
- map_hash_chain_t*,
- hash_chain,
- ,
- (ut_strcmp(hash_chain->symbol, import_proc) == 0));
-
- if (hash_chain == NULL) {
-#endif
- if (wdl_init == TRUE) {
-
- sql_print_error(
- "InnoDB: the procedure pointer of %s"
- " is not found.",
- import_proc);
- }
-
- return(0);
-#ifdef _WIN64
- }
-#endif
- }
-
- return((FARPROC) ((ulint) m_handle + hash_chain->value));
-}
-
-/*******************************************************************//**
-Retrieves the address of an exported variable.
-Note: It does not follow the Windows call convention FARPROC.
-@return address of exported variable. */
-static
-void*
-wdl_get_varaddr_from_map(
-/*=====================*/
- HANDLE m_handle, /*!< in: module handle */
- const char* import_variable) /*!< in: variable name */
-{
- map_hash_chain_t* hash_chain;
- ulint map_fold;
-
- map_fold = ut_fold_string(import_variable);
- HASH_SEARCH(
- next,
- m_htbl,
- map_fold,
- map_hash_chain_t*,
- hash_chain,
- ,
- (ut_strcmp(hash_chain->symbol, import_variable) == 0));
-
- if (hash_chain == NULL) {
-
-#ifdef _WIN64
- /* On Win64, the leading '_' may not be taken out. In this
- case, search again without the leading '_'. */
- if (*import_variable == '_') {
-
- import_variable++;
- }
-
- map_fold = ut_fold_string(import_variable);
- HASH_SEARCH(
- next,
- m_htbl,
- map_fold,
- map_hash_chain_t*,
- hash_chain,
- ,
- (ut_strcmp(hash_chain->symbol, import_variable) == 0));
-
- if (hash_chain == NULL) {
-#endif
- if (wdl_init == TRUE) {
-
- sql_print_error(
- "InnoDB: the variable address of %s"
- " is not found.",
- import_variable);
- }
-
- return(0);
-#ifdef _WIN64
- }
-#endif
- }
-
- return((void*) ((ulint) m_handle + hash_chain->value));
-}
-
-/*******************************************************************//**
-Bind all unresolved external variables from the MySQL executable.
-@return TRUE if successful */
-static
-bool
-wdl_get_external_variables(void)
-/*============================*/
-{
- HMODULE hmod = wdl_get_mysqld_mapfile();
-
- if (hmod == 0) {
-
- return(FALSE);
- }
-
-#define GET_SYM(sym, var, type) \
- var = (type*) wdl_get_varaddr_from_map(hmod, sym); \
- if (var == NULL) return(FALSE)
-#ifdef _WIN64
-#define GET_SYM2(sym1, sym2, var, type) \
- var = (type*) wdl_get_varaddr_from_map(hmod, sym1); \
- if (var == NULL) return(FALSE)
-#else
-#define GET_SYM2(sym1, sym2, var, type) \
- var = (type*) wdl_get_varaddr_from_map(hmod, sym2); \
- if (var == NULL) return(FALSE)
-#endif // (_WIN64)
-#define GET_C_SYM(sym, type) GET_SYM(#sym, wdl_##sym, type)
-#define GET_PROC_ADDR(sym) \
- wdl##sym = (pfn##sym) wdl_get_procaddr_from_map(hmod, #sym)
-
- GET_C_SYM(my_charset_bin, CHARSET_INFO);
- GET_C_SYM(my_charset_latin1, CHARSET_INFO);
- GET_C_SYM(my_charset_filename, CHARSET_INFO);
- GET_C_SYM(default_charset_info, CHARSET_INFO*);
- GET_C_SYM(all_charsets, CHARSET_INFO*);
- GET_C_SYM(my_umask, int);
-
- GET_SYM("?global_system_variables@@3Usystem_variables@@A",
- wdl_global_system_variables, struct system_variables);
- GET_SYM("?mysql_real_data_home@@3PADA",
- wdl_mysql_real_data_home, char);
- GET_SYM("?reg_ext@@3PADA", wdl_reg_ext, char);
- GET_SYM("?LOCK_thread_count@@3U_RTL_CRITICAL_SECTION@@A",
- wdl_LOCK_thread_count, pthread_mutex_t);
- GET_SYM("?key_map_full@@3V?$Bitmap@$0EA@@@A",
- wdl_key_map_full, key_map);
- GET_SYM("?mysql_tmpdir_list@@3Ust_my_tmpdir@@A",
- wdl_mysql_tmpdir_list, MY_TMPDIR);
- GET_SYM("?mysqld_embedded@@3_NA",
- wdl_mysqld_embedded, bool);
- GET_SYM("?lower_case_table_names@@3IA",
- wdl_lower_case_table_names, uint);
- GET_SYM("?specialflag@@3KA", wdl_specialflag, ulong);
-
- GET_SYM2("?system_charset_info@@3PEAUcharset_info_st@@EA",
- "?system_charset_info@@3PAUcharset_info_st@@A",
- wdl_system_charset_info, CHARSET_INFO*);
- GET_SYM2("?mysql_data_home@@3PEADEA",
- "?mysql_data_home@@3PADA",
- wdl_mysql_data_home, char*);
- GET_SYM2("?tx_isolation_names@@3PAPEBDA",
- "?tx_isolation_names@@3PAPBDA",
- wdl_tx_isolation_names, char*);
- GET_SYM2("?binlog_format_names@@3PAPEBDA",
- "?binlog_format_names@@3PAPBDA",
- wdl_binlog_format_names, char*);
-
-#ifndef DBUG_OFF
- GET_PROC_ADDR(_db_enter_);
- GET_PROC_ADDR(_db_return_);
- GET_PROC_ADDR(_db_pargs_);
- GET_PROC_ADDR(_db_doprnt_);
- GET_PROC_ADDR(_db_dump_);
-
- /* If any of the dbug functions is not available, just make them
- all invalid. This is the case when working with a non-debug
- version of the server. */
- if (wdl_db_enter_ == NULL || wdl_db_return_ == NULL
- || wdl_db_pargs_ == NULL || wdl_db_doprnt_ == NULL
- || wdl_db_dump_ == NULL) {
-
- wdl_db_enter_ = NULL;
- wdl_db_return_ = NULL;
- wdl_db_pargs_ = NULL;
- wdl_db_doprnt_ = NULL;
- wdl_db_dump_ = NULL;
- }
-#endif /* !DBUG_OFF */
-
- wdl_init = TRUE;
- return(TRUE);
-
-#undef GET_SYM
-#undef GET_SYM2
-#undef GET_C_SYM
-#undef GET_PROC_ADDR
-}
-
-/*******************************************************************//**
-The DLL Delayed Loading Helper Function for resolving externals.
-
-The function may fail due to one of the three reasons:
-
-* Invalid parameter, which happens if the attributes in pidd aren't
- specified correctly.
-* Failed to load the map file mysqld.map.
-* Failed to find an external name in the map file mysqld.map.
-
-Note: this function is called by run-time as well as __HrLoadAllImportsForDll.
-So, it has to follow Windows call convention.
-@return the address of the imported function */
-extern "C"
-FARPROC WINAPI
-__delayLoadHelper2(
-/*===============*/
- PCImgDelayDescr pidd, /*!< in: a const pointer to a
- ImgDelayDescr, see delayimp.h. */
- FARPROC* iat_entry) /*!< in/out: A pointer to the slot in
- the delay load import address table
- to be updated with the address of the
- imported function. */
-{
- ulint iIAT, iINT;
- HMODULE hmod;
- PCImgThunkData pitd;
- FARPROC fun = NULL;
-
- /* Set up data used for the hook procs */
- InternalImgDelayDescr idd = {
- pidd->grAttrs,
- PFromRva<LPCSTR>(pidd->rvaDLLName),
- PFromRva<HMODULE*>(pidd->rvaHmod),
- PFromRva<PImgThunkData>(pidd->rvaIAT),
- PFromRva<PCImgThunkData>(pidd->rvaINT),
- PFromRva<PCImgThunkData>(pidd->rvaBoundIAT),
- PFromRva<PCImgThunkData>(pidd->rvaUnloadIAT),
- pidd->dwTimeStamp
- };
-
- DelayLoadInfo dli = {
- sizeof(DelayLoadInfo),
- pidd,
- iat_entry,
- idd.szName,
- {0},
- 0,
- 0,
- 0
- };
-
- /* Check the Delay Load Attributes, log an error of invalid
- parameter, which happens if the attributes in pidd are not
- specified correctly. */
- if ((idd.grAttrs & dlattrRva) == 0) {
-
- sql_print_error("InnoDB: invalid parameter for delay loader.");
- return(0);
- }
-
- hmod = *idd.phmod;
-
- /* Calculate the index for the IAT entry in the import address table.
- The INT entries are ordered the same as the IAT entries so the
- calculation can be done on the IAT side. */
- iIAT = (PCImgThunkData) iat_entry - idd.pIAT;
- iINT = iIAT;
-
- pitd = &(idd.pINT[iINT]);
-
- dli.dlp.fImportByName = !IMAGE_SNAP_BY_ORDINAL(pitd->u1.Ordinal);
-
- if (dli.dlp.fImportByName) {
-
- dli.dlp.szProcName = (LPCSTR) (PFromRva<PIMAGE_IMPORT_BY_NAME>
- ((RVA) ((UINT_PTR) pitd->u1.AddressOfData))->Name);
- } else {
-
- dli.dlp.dwOrdinal = (ulint) IMAGE_ORDINAL(pitd->u1.Ordinal);
- }
-
- /* Now, load the mapfile, if it has not been done yet */
- if (hmod == 0) {
-
- hmod = wdl_get_mysqld_mapfile();
- }
-
- if (hmod == 0) {
- /* LoadLibrary failed. */
- PDelayLoadInfo rgpdli[1] = {&dli};
-
- dli.dwLastError = ::GetLastError();
-
- sql_print_error(
- "InnoDB: failed to load mysqld.map with error %d.",
- dli.dwLastError);
-
- return(0);
- }
-
- /* Store the library handle. */
- idd.phmod = &hmod;
-
- /* Go for the procedure now. */
- dli.hmodCur = hmod;
-
- if (pidd->rvaBoundIAT && pidd->dwTimeStamp) {
-
- /* Bound imports exist, check the timestamp from the target
- image */
- PIMAGE_NT_HEADERS pinh;
-
- pinh = (PIMAGE_NT_HEADERS) ((byte*) hmod
- + ((PIMAGE_DOS_HEADER) hmod)->e_lfanew);
-
- if (pinh->Signature == IMAGE_NT_SIGNATURE
- && pinh->FileHeader.TimeDateStamp == idd.dwTimeStamp
- && (DWORD) hmod == pinh->OptionalHeader.ImageBase) {
-
- /* We have a decent address in the bound IAT. */
- fun = (FARPROC) (UINT_PTR)
- idd.pBoundIAT[iIAT].u1.Function;
-
- if (fun) {
-
- *iat_entry = fun;
- return(fun);
- }
- }
- }
-
- fun = wdl_get_procaddr_from_map(hmod, dli.dlp.szProcName);
-
- if (fun == 0) {
-
- return(0);
- }
-
- *iat_entry = fun;
- return(fun);
-}
-
-/*******************************************************************//**
-Unload a DLL that was delay loaded. This function is called by run-time.
-@return TRUE is returned if the DLL is found and the IAT matches the
-original one. */
-extern "C"
-BOOL WINAPI
-__FUnloadDelayLoadedDLL2(
-/*=====================*/
- LPCSTR module_name) /*!< in: DLL name */
-{
- return(TRUE);
-}
-
-/**************************************************************//**
-Load all imports from a DLL that was specified with the /delayload linker
-option.
-Note: this function is called by run-time. So, it has to follow Windows call
-convention.
-@return S_OK if the DLL matches, otherwise ERROR_MOD_NOT_FOUND is returned. */
-extern "C"
-HRESULT WINAPI
-__HrLoadAllImportsForDll(
-/*=====================*/
- LPCSTR module_name) /*!< in: DLL name */
-{
- PIMAGE_NT_HEADERS img;
- PCImgDelayDescr pidd;
- IMAGE_DATA_DIRECTORY* image_data;
- LPCSTR current_module;
- HRESULT ret = ERROR_MOD_NOT_FOUND;
- HMODULE hmod = (HMODULE) &__ImageBase;
-
- img = (PIMAGE_NT_HEADERS) ((byte*) hmod
- + ((PIMAGE_DOS_HEADER) hmod)->e_lfanew);
- image_data =
- &img->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT];
-
- /* Scan the delay load IAT/INT for the DLL */
- if (image_data->Size) {
-
- pidd = PFromRva<PCImgDelayDescr>(image_data->VirtualAddress);
-
- /* Check all of the listed DLLs we want to load. */
- while (pidd->rvaDLLName) {
-
- current_module = PFromRva<LPCSTR>(pidd->rvaDLLName);
-
- if (stricmp(module_name, current_module) == 0) {
-
- /* Found it, break out with pidd and
- current_module set appropriately */
- break;
- }
-
- /* To the next delay import descriptor */
- pidd++;
- }
-
- if (pidd->rvaDLLName) {
-
- /* Found a matching DLL, now process it. */
- FARPROC* iat_entry;
- size_t count;
-
- iat_entry = PFromRva<FARPROC*>(pidd->rvaIAT);
- count = wdl_import_count((PCImgThunkData) iat_entry);
-
- /* now load all the imports from the DLL */
- while (count > 0) {
-
- /* No need to check the return value */
- __delayLoadHelper2(pidd, iat_entry);
- iat_entry++;
- count--;
- }
-
- ret = S_OK;
- }
- }
-
- return ret;
-}
-
-/**************************************************************//**
-The main function of a DLL
-@return TRUE if the call succeeds */
-BOOL
-WINAPI
-DllMain(
-/*====*/
- HINSTANCE hinstDLL, /*!< in: handle to the DLL module */
- DWORD fdwReason, /*!< Reason code that indicates why the
- DLL entry-point function is being
- called.*/
- LPVOID lpvReserved) /*!< in: additional parameter based on
- fdwReason */
-{
- BOOL success = TRUE;
-
- switch (fdwReason) {
-
- case DLL_PROCESS_ATTACH:
- success = wdl_get_external_variables();
- break;
-
- case DLL_PROCESS_DETACH:
- wdl_cleanup();
- break;
- }
-
- return(success);
-}
-
-#ifndef DBUG_OFF
-/**************************************************************//**
-Process entry point to user function. It makes the call to _db_enter_
-in mysqld.exe. The DBUG functions are defined in my_dbug.h. */
-extern "C" UNIV_INTERN
-void
-_db_enter_(
- const char* _func_, /*!< in: current function name */
- const char* _file_, /*!< in: current file name */
- uint _line_, /*!< in: current source line number */
- const char** _sfunc_, /*!< out: previous _func_ */
- const char** _sfile_, /*!< out: previous _file_ */
- uint* _slevel_, /*!< out: previous nesting level */
- char*** _sframep_) /*!< out: previous frame pointer */
-{
- if (wdl_db_enter_ != NULL) {
-
- wdl_db_enter_(_func_, _file_, _line_, _sfunc_, _sfile_,
- _slevel_, _sframep_);
- }
-}
-
-/**************************************************************//**
-Process exit from user function. It makes the call to _db_return_()
-in the server. */
-extern "C" UNIV_INTERN
-void
-_db_return_(
- uint _line_, /*!< in: current source line number */
- const char** _sfunc_, /*!< out: previous _func_ */
- const char** _sfile_, /*!< out: previous _file_ */
- uint* _slevel_) /*!< out: previous level */
-{
- if (wdl_db_return_ != NULL) {
-
- wdl_db_return_(_line_, _sfunc_, _sfile_, _slevel_);
- }
-}
-
-/**************************************************************//**
-Log arguments for subsequent use. It makes the call to _db_pargs_()
-in the server. */
-extern "C" UNIV_INTERN
-void
-_db_pargs_(
- uint _line_, /*!< in: current source line number */
- const char* keyword) /*!< in: keyword for current macro */
-{
- if (wdl_db_pargs_ != NULL) {
-
- wdl_db_pargs_(_line_, keyword);
- }
-}
-
-/**************************************************************//**
-Handle print of debug lines. It saves the text into a buffer first,
-then makes the call to _db_doprnt_() in the server. The text is
-truncated to the size of buffer. */
-extern "C" UNIV_INTERN
-void
-_db_doprnt_(
- const char* format, /*!< in: the format string */
- ...) /*!< in: list of arguments */
-{
- va_list argp;
- char buffer[512];
-
- if (wdl_db_doprnt_ != NULL) {
-
- va_start(argp, format);
- /* it is ok to ignore the trunction. */
- _vsnprintf(buffer, sizeof(buffer), format, argp);
- wdl_db_doprnt_(buffer);
- va_end(argp);
- }
-}
-
-/**************************************************************//**
-Dump a string in hex. It makes the call to _db_dump_() in the server. */
-extern "C" UNIV_INTERN
-void
-_db_dump_(
- uint _line_, /*!< in: current source line
- number */
- const char* keyword, /*!< in: keyword list */
- const unsigned char* memory, /*!< in: memory to dump */
- size_t length) /*!< in: bytes to dump */
-{
- if (wdl_db_dump_ != NULL) {
-
- wdl_db_dump_(_line_, keyword, memory, length);
- }
-}
-
-#endif /* !DBUG_OFF */
-#endif /* defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN) */
=== modified file 'storage/innodb_plugin/include/buf0buf.h'
--- a/storage/innodb_plugin/include/buf0buf.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/buf0buf.h 2009-11-03 10:26:07 +0000
@@ -346,7 +346,7 @@ buf_page_release(
mtr_t* mtr); /*!< in: mtr */
/********************************************************************//**
Moves a page to the start of the buffer pool LRU list. This high-level
-function can be used to prevent an important page from from slipping out of
+function can be used to prevent an important page from slipping out of
the buffer pool. */
UNIV_INTERN
void
@@ -707,15 +707,6 @@ buf_page_belongs_to_unzip_LRU(
/*==========================*/
const buf_page_t* bpage) /*!< in: pointer to control block */
__attribute__((pure));
-/*********************************************************************//**
-Determine the approximate LRU list position of a block.
-@return LRU list position */
-UNIV_INLINE
-ulint
-buf_page_get_LRU_position(
-/*======================*/
- const buf_page_t* bpage) /*!< in: control block */
- __attribute__((pure));
/*********************************************************************//**
Gets the mutex of a block.
@@ -816,14 +807,14 @@ buf_page_set_old(
buf_page_t* bpage, /*!< in/out: control block */
ibool old); /*!< in: old */
/*********************************************************************//**
-Determine if a block has been accessed in the buffer pool.
-@return TRUE if accessed */
+Determine the time of first access of a block in the buffer pool.
+@return ut_time_ms() at the time of first access, 0 if not accessed */
UNIV_INLINE
-ibool
+unsigned
buf_page_is_accessed(
/*=================*/
const buf_page_t* bpage) /*!< in: control block */
- __attribute__((pure));
+ __attribute__((nonnull, pure));
/*********************************************************************//**
Flag a block accessed. */
UNIV_INLINE
@@ -831,7 +822,8 @@ void
buf_page_set_accessed(
/*==================*/
buf_page_t* bpage, /*!< in/out: control block */
- ibool accessed); /*!< in: accessed */
+ ulint time_ms) /*!< in: ut_time_ms() */
+ __attribute__((nonnull));
/*********************************************************************//**
Gets the buf_block_t handle of a buffered file block if an uncompressed
page frame exists, or NULL.
@@ -1017,14 +1009,6 @@ buf_block_hash_get(
/*===============*/
ulint space, /*!< in: space id */
ulint offset);/*!< in: offset of the page within space */
-/*******************************************************************//**
-Increments the pool clock by one and returns its new value. Remember that
-in the 32 bit version the clock wraps around at 4 billion!
-@return new clock value */
-UNIV_INLINE
-ulint
-buf_pool_clock_tic(void);
-/*====================*/
/*********************************************************************//**
Gets the current length of the free list of buffer blocks.
@return length of the free list */
@@ -1064,16 +1048,10 @@ struct buf_page_struct{
flushed to disk, this tells the
flush_type.
@see enum buf_flush */
- unsigned accessed:1; /*!< TRUE if the page has been accessed
- while in the buffer pool: read-ahead
- may read in pages which have not been
- accessed yet; a thread is allowed to
- read this for heuristic purposes
- without holding any mutex or latch */
unsigned io_fix:2; /*!< type of pending I/O operation;
also protected by buf_pool_mutex
@see enum buf_io_fix */
- unsigned buf_fix_count:24;/*!< count of how manyfold this block
+ unsigned buf_fix_count:25;/*!< count of how manyfold this block
is currently bufferfixed */
/* @} */
#endif /* !UNIV_HOTBACKUP */
@@ -1103,7 +1081,16 @@ struct buf_page_struct{
- BUF_BLOCK_FILE_PAGE: flush_list
- BUF_BLOCK_ZIP_DIRTY: flush_list
- BUF_BLOCK_ZIP_PAGE: zip_clean
- - BUF_BLOCK_ZIP_FREE: zip_free[] */
+ - BUF_BLOCK_ZIP_FREE: zip_free[]
+
+ The contents of the list node
+ is undefined if !in_flush_list
+ && state == BUF_BLOCK_FILE_PAGE,
+ or if state is one of
+ BUF_BLOCK_MEMORY,
+ BUF_BLOCK_REMOVE_HASH or
+ BUF_BLOCK_READY_IN_USE. */
+
#ifdef UNIV_DEBUG
ibool in_flush_list; /*!< TRUE if in buf_pool->flush_list;
when buf_pool_mutex is free, the
@@ -1142,18 +1129,8 @@ struct buf_page_struct{
debugging */
#endif /* UNIV_DEBUG */
unsigned old:1; /*!< TRUE if the block is in the old
- blocks in the LRU list */
- unsigned LRU_position:31;/*!< value which monotonically
- decreases (or may stay
- constant if old==TRUE) toward
- the end of the LRU list, if
- buf_pool->ulint_clock has not
- wrapped around: NOTE that this
- value can only be used in
- heuristic algorithms, because
- of the possibility of a
- wrap-around! */
- unsigned freed_page_clock:32;/*!< the value of
+ blocks in buf_pool->LRU_old */
+ unsigned freed_page_clock:31;/*!< the value of
buf_pool->freed_page_clock
when this block was the last
time put to the head of the
@@ -1161,6 +1138,9 @@ struct buf_page_struct{
to read this for heuristic
purposes without holding any
mutex or latch */
+ unsigned access_time:32; /*!< time of first access, or
+ 0 if the block was never accessed
+ in the buffer pool */
/* @} */
# ifdef UNIV_DEBUG_FILE_ACCESSES
ibool file_page_was_freed;
@@ -1305,6 +1285,31 @@ Compute the hash fold value for blocks i
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
/* @} */
+/** @brief The buffer pool statistics structure. */
+struct buf_pool_stat_struct{
+ ulint n_page_gets; /*!< number of page gets performed;
+ also successful searches through
+ the adaptive hash index are
+ counted as page gets; this field
+ is NOT protected by the buffer
+ pool mutex */
+ ulint n_pages_read; /*!< number read operations */
+ ulint n_pages_written;/*!< number write operations */
+ ulint n_pages_created;/*!< number of pages created
+ in the pool with no read */
+ ulint n_ra_pages_read;/*!< number of pages read in
+ as part of read ahead */
+ ulint n_ra_pages_evicted;/*!< number of read ahead
+ pages that are evicted without
+ being accessed */
+ ulint n_pages_made_young; /*!< number of pages made young, in
+ calls to buf_LRU_make_block_young() */
+ ulint n_pages_not_made_young; /*!< number of pages not made
+ young because the first access
+ was not long enough ago, in
+ buf_page_peek_if_too_old() */
+};
+
/** @brief The buffer pool structure.
NOTE! The definition appears here only for other modules of this
@@ -1329,28 +1334,16 @@ struct buf_pool_struct{
ulint n_pend_reads; /*!< number of pending read operations */
ulint n_pend_unzip; /*!< number of pending decompressions */
- time_t last_printout_time; /*!< when buf_print was last time
+ time_t last_printout_time;
+ /*!< when buf_print_io was last time
called */
- ulint n_pages_read; /*!< number read operations */
- ulint n_pages_written;/*!< number write operations */
- ulint n_pages_created;/*!< number of pages created
- in the pool with no read */
- ulint n_page_gets; /*!< number of page gets performed;
- also successful searches through
- the adaptive hash index are
- counted as page gets; this field
- is NOT protected by the buffer
- pool mutex */
- ulint n_page_gets_old;/*!< n_page_gets when buf_print was
- last time called: used to calculate
- hit rate */
- ulint n_pages_read_old;/*!< n_pages_read when buf_print was
- last time called */
- ulint n_pages_written_old;/*!< number write operations */
- ulint n_pages_created_old;/*!< number of pages created in
- the pool with no read */
+ buf_pool_stat_t stat; /*!< current statistics */
+ buf_pool_stat_t old_stat; /*!< old statistics */
+
/* @} */
+
/** @name Page flushing algorithm fields */
+
/* @{ */
UT_LIST_BASE_NODE_T(buf_page_t) flush_list;
@@ -1366,10 +1359,6 @@ struct buf_pool_struct{
/*!< this is in the set state
when there is no flush batch
of the given type running */
- ulint ulint_clock; /*!< a sequence number used to count
- time. NOTE! This counter wraps
- around at 4 billion (if ulint ==
- 32 bits)! */
ulint freed_page_clock;/*!< a sequence number used
to count the number of buffer
blocks removed from the end of
@@ -1393,17 +1382,18 @@ struct buf_pool_struct{
block list */
UT_LIST_BASE_NODE_T(buf_page_t) LRU;
/*!< base node of the LRU list */
- buf_page_t* LRU_old; /*!< pointer to the about 3/8 oldest
- blocks in the LRU list; NULL if LRU
- length less than BUF_LRU_OLD_MIN_LEN;
+ buf_page_t* LRU_old; /*!< pointer to the about
+ buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
+ oldest blocks in the LRU list;
+ NULL if LRU length less than
+ BUF_LRU_OLD_MIN_LEN;
NOTE: when LRU_old != NULL, its length
should always equal LRU_old_len */
ulint LRU_old_len; /*!< length of the LRU list from
the block to which LRU_old points
onward, including that block;
see buf0lru.c for the restrictions
- on this value; not defined if
- LRU_old == NULL;
+ on this value; 0 if LRU_old == NULL;
NOTE: LRU_old_len must be adjusted
whenever LRU_old shrinks or grows! */
=== modified file 'storage/innodb_plugin/include/buf0buf.ic'
--- a/storage/innodb_plugin/include/buf0buf.ic 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/buf0buf.ic 2009-11-03 10:26:07 +0000
@@ -72,9 +72,30 @@ buf_page_peek_if_too_old(
/*=====================*/
const buf_page_t* bpage) /*!< in: block to make younger */
{
- return(buf_pool->freed_page_clock
- >= buf_page_get_freed_page_clock(bpage)
- + 1 + (buf_pool->curr_size / 4));
+ if (UNIV_UNLIKELY(buf_pool->freed_page_clock == 0)) {
+ /* If eviction has not started yet, do not update the
+ statistics or move blocks in the LRU list. This is
+ either the warm-up phase or an in-memory workload. */
+ return(FALSE);
+ } else if (buf_LRU_old_threshold_ms && bpage->old) {
+ unsigned access_time = buf_page_is_accessed(bpage);
+
+ if (access_time > 0
+ && (ut_time_ms() - access_time)
+ >= buf_LRU_old_threshold_ms) {
+ return(TRUE);
+ }
+
+ buf_pool->stat.n_pages_not_made_young++;
+ return(FALSE);
+ } else {
+ /* FIXME: bpage->freed_page_clock is 31 bits */
+ return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
+ > ((ulint) bpage->freed_page_clock
+ + (buf_pool->curr_size
+ * (BUF_LRU_OLD_RATIO_DIV - buf_LRU_old_ratio)
+ / (BUF_LRU_OLD_RATIO_DIV * 4))));
+ }
}
/*********************************************************************//**
@@ -118,22 +139,6 @@ buf_pool_get_oldest_modification(void)
return(lsn);
}
-
-/*******************************************************************//**
-Increments the buf_pool clock by one and returns its new value. Remember
-that in the 32 bit version the clock wraps around at 4 billion!
-@return new clock value */
-UNIV_INLINE
-ulint
-buf_pool_clock_tic(void)
-/*====================*/
-{
- ut_ad(buf_pool_mutex_own());
-
- buf_pool->ulint_clock++;
-
- return(buf_pool->ulint_clock);
-}
#endif /* !UNIV_HOTBACKUP */
/*********************************************************************//**
@@ -280,21 +285,6 @@ buf_page_belongs_to_unzip_LRU(
}
/*********************************************************************//**
-Determine the approximate LRU list position of a block.
-@return LRU list position */
-UNIV_INLINE
-ulint
-buf_page_get_LRU_position(
-/*======================*/
- const buf_page_t* bpage) /*!< in: control block */
-{
- ut_ad(buf_page_in_file(bpage));
- ut_ad(buf_pool_mutex_own());
-
- return(bpage->LRU_position);
-}
-
-/*********************************************************************//**
Gets the mutex of a block.
@return pointer to mutex protecting bpage */
UNIV_INLINE
@@ -476,10 +466,19 @@ buf_page_set_old(
ut_ad(bpage->in_LRU_list);
#ifdef UNIV_LRU_DEBUG
- if (UT_LIST_GET_PREV(LRU, bpage) && UT_LIST_GET_NEXT(LRU, bpage)
- && UT_LIST_GET_PREV(LRU, bpage)->old
- == UT_LIST_GET_NEXT(LRU, bpage)->old) {
- ut_a(UT_LIST_GET_PREV(LRU, bpage)->old == old);
+ ut_a((buf_pool->LRU_old_len == 0) == (buf_pool->LRU_old == NULL));
+ /* If a block is flagged "old", the LRU_old list must exist. */
+ ut_a(!old || buf_pool->LRU_old);
+
+ if (UT_LIST_GET_PREV(LRU, bpage) && UT_LIST_GET_NEXT(LRU, bpage)) {
+ const buf_page_t* prev = UT_LIST_GET_PREV(LRU, bpage);
+ const buf_page_t* next = UT_LIST_GET_NEXT(LRU, bpage);
+ if (prev->old == next->old) {
+ ut_a(prev->old == old);
+ } else {
+ ut_a(!prev->old);
+ ut_a(buf_pool->LRU_old == (old ? bpage : next));
+ }
}
#endif /* UNIV_LRU_DEBUG */
@@ -487,17 +486,17 @@ buf_page_set_old(
}
/*********************************************************************//**
-Determine if a block has been accessed in the buffer pool.
-@return TRUE if accessed */
+Determine the time of first access of a block in the buffer pool.
+@return ut_time_ms() at the time of first access, 0 if not accessed */
UNIV_INLINE
-ibool
+unsigned
buf_page_is_accessed(
/*=================*/
const buf_page_t* bpage) /*!< in: control block */
{
ut_ad(buf_page_in_file(bpage));
- return(bpage->accessed);
+ return(bpage->access_time);
}
/*********************************************************************//**
@@ -507,12 +506,15 @@ void
buf_page_set_accessed(
/*==================*/
buf_page_t* bpage, /*!< in/out: control block */
- ibool accessed) /*!< in: accessed */
+ ulint time_ms) /*!< in: ut_time_ms() */
{
ut_a(buf_page_in_file(bpage));
- ut_ad(mutex_own(buf_page_get_mutex(bpage)));
+ ut_ad(buf_pool_mutex_own());
- bpage->accessed = accessed;
+ if (!bpage->access_time) {
+ /* Make this the time of the first access. */
+ bpage->access_time = time_ms;
+ }
}
/*********************************************************************//**
=== modified file 'storage/innodb_plugin/include/buf0lru.h'
--- a/storage/innodb_plugin/include/buf0lru.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/buf0lru.h 2009-10-08 11:28:37 +0000
@@ -69,7 +69,7 @@ These are low-level functions
#########################################################################*/
/** Minimum LRU list length for which the LRU_old pointer is defined */
-#define BUF_LRU_OLD_MIN_LEN 80
+#define BUF_LRU_OLD_MIN_LEN 512 /* 8 megabytes of 16k pages */
/** Maximum LRU list search length in buf_flush_LRU_recommendation() */
#define BUF_LRU_FREE_SEARCH_LEN (5 + 2 * BUF_READ_AHEAD_AREA)
@@ -84,15 +84,6 @@ void
buf_LRU_invalidate_tablespace(
/*==========================*/
ulint id); /*!< in: space id */
-/******************************************************************//**
-Gets the minimum LRU_position field for the blocks in an initial segment
-(determined by BUF_LRU_INITIAL_RATIO) of the LRU list. The limit is not
-guaranteed to be precise, because the ulint_clock may wrap around.
-@return the limit; zero if could not determine it */
-UNIV_INTERN
-ulint
-buf_LRU_get_recent_limit(void);
-/*==========================*/
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
UNIV_INTERN
@@ -201,6 +192,18 @@ void
buf_LRU_make_block_old(
/*===================*/
buf_page_t* bpage); /*!< in: control block */
+/**********************************************************************//**
+Updates buf_LRU_old_ratio.
+@return updated old_pct */
+UNIV_INTERN
+uint
+buf_LRU_old_ratio_update(
+/*=====================*/
+ uint old_pct,/*!< in: Reserve this percentage of
+ the buffer pool for "old" blocks. */
+ ibool adjust);/*!< in: TRUE=adjust the LRU list;
+ FALSE=just assign buf_LRU_old_ratio
+ during the initialization of InnoDB */
/********************************************************************//**
Update the historical stats that we are collecting for LRU eviction
policy at the end of each interval. */
@@ -227,6 +230,35 @@ buf_LRU_print(void);
/*===============*/
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
+/** @name Heuristics for detecting index scan @{ */
+/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
+"old" blocks. Protected by buf_pool_mutex. */
+extern uint buf_LRU_old_ratio;
+/** The denominator of buf_LRU_old_ratio. */
+#define BUF_LRU_OLD_RATIO_DIV 1024
+/** Maximum value of buf_LRU_old_ratio.
+@see buf_LRU_old_adjust_len
+@see buf_LRU_old_ratio_update */
+#define BUF_LRU_OLD_RATIO_MAX BUF_LRU_OLD_RATIO_DIV
+/** Minimum value of buf_LRU_old_ratio.
+@see buf_LRU_old_adjust_len
+@see buf_LRU_old_ratio_update
+The minimum must exceed
+(BUF_LRU_OLD_TOLERANCE + 5) * BUF_LRU_OLD_RATIO_DIV / BUF_LRU_OLD_MIN_LEN. */
+#define BUF_LRU_OLD_RATIO_MIN 51
+
+#if BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX
+# error "BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX"
+#endif
+#if BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV
+# error "BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV"
+#endif
+
+/** Move blocks to "new" LRU list only if the first access was at
+least this many milliseconds ago. Not protected by any mutex or latch. */
+extern uint buf_LRU_old_threshold_ms;
+/* @} */
+
/** @brief Statistics for selecting the LRU list for eviction.
These statistics are not 'of' LRU but 'for' LRU. We keep count of I/O
=== modified file 'storage/innodb_plugin/include/buf0rea.h'
--- a/storage/innodb_plugin/include/buf0rea.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/buf0rea.h 2009-10-08 11:28:37 +0000
@@ -33,12 +33,10 @@ Created 11/5/1995 Heikki Tuuri
High-level function which reads a page asynchronously from a file to the
buffer buf_pool if it is not already there. Sets the io_fix flag and sets
an exclusive lock on the buffer frame. The flag is cleared and the x-lock
-released by the i/o-handler thread. Does a random read-ahead if it seems
-sensible.
-@return number of page read requests issued: this can be greater than
-1 if read-ahead occurred */
+released by the i/o-handler thread.
+@return TRUE if page has been read in, FALSE in case of failure */
UNIV_INTERN
-ulint
+ibool
buf_read_page(
/*==========*/
ulint space, /*!< in: space id */
@@ -48,7 +46,7 @@ buf_read_page(
Applies linear read-ahead if in the buf_pool the page is a border page of
a linear read-ahead area and all the pages in the area have been accessed.
Does not read any page if the read-ahead mechanism is not activated. Note
-that the the algorithm looks at the 'natural' adjacent successor and
+that the algorithm looks at the 'natural' adjacent successor and
predecessor of the page, which on the leaf level of a B-tree are the next
and previous page in the chain of leaves. To know these, the page specified
in (space, offset) must already be present in the buf_pool. Thus, the
=== modified file 'storage/innodb_plugin/include/buf0types.h'
--- a/storage/innodb_plugin/include/buf0types.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/buf0types.h 2009-10-08 11:28:37 +0000
@@ -34,6 +34,8 @@ typedef struct buf_block_struct buf_blo
typedef struct buf_chunk_struct buf_chunk_t;
/** Buffer pool comprising buf_chunk_t */
typedef struct buf_pool_struct buf_pool_t;
+/** Buffer pool statistics struct */
+typedef struct buf_pool_stat_struct buf_pool_stat_t;
/** A buffer frame. @see page_t */
typedef byte buf_frame_t;
=== modified file 'storage/innodb_plugin/include/dict0crea.h'
--- a/storage/innodb_plugin/include/dict0crea.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/dict0crea.h 2009-10-08 09:13:16 +0000
@@ -110,7 +110,7 @@ dict_create_or_check_foreign_constraint_
Adds foreign key definitions to data dictionary tables in the database. We
look at table->foreign_list, and also generate names to constraints that were
not named by the user. A generated constraint has a name of the format
-databasename/tablename_ibfk_<number>, where the numbers start from 1, and are
+databasename/tablename_ibfk_NUMBER, where the numbers start from 1, and are
given locally for this table, that is, the number is not global, as in the
old format constraints < 4.0.18 it used to be.
@return error code or DB_SUCCESS */
=== modified file 'storage/innodb_plugin/include/dict0dict.h'
--- a/storage/innodb_plugin/include/dict0dict.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/dict0dict.h 2009-10-08 11:28:37 +0000
@@ -712,7 +712,7 @@ dict_index_find_on_id_low(
dulint id); /*!< in: index id */
/**********************************************************************//**
Adds an index to the dictionary cache.
-@return DB_SUCCESS or error code */
+@return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */
UNIV_INTERN
ulint
dict_index_add_to_cache(
=== modified file 'storage/innodb_plugin/include/dict0mem.h'
--- a/storage/innodb_plugin/include/dict0mem.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/dict0mem.h 2009-10-08 10:00:49 +0000
@@ -317,7 +317,7 @@ struct dict_foreign_struct{
char* id; /*!< id of the constraint as a
null-terminated string */
unsigned n_fields:10; /*!< number of indexes' first fields
- for which the the foreign key
+ for which the foreign key
constraint is defined: we allow the
indexes to contain more fields than
mentioned in the constraint, as long
=== modified file 'storage/innodb_plugin/include/fsp0fsp.h'
--- a/storage/innodb_plugin/include/fsp0fsp.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/fsp0fsp.h 2009-10-08 10:00:49 +0000
@@ -42,7 +42,7 @@ fsp_init(void);
/*==========*/
/**********************************************************************//**
Gets the current free limit of the system tablespace. The free limit
-means the place of the first page which has never been put to the the
+means the place of the first page which has never been put to the
free list for allocation. The space above that address is initialized
to zero. Sets also the global variable log_fsp_current_free_limit.
@return free limit in megabytes */
=== modified file 'storage/innodb_plugin/include/lock0lock.h'
--- a/storage/innodb_plugin/include/lock0lock.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/lock0lock.h 2009-10-08 12:18:19 +0000
@@ -630,6 +630,14 @@ lock_number_of_rows_locked(
/*=======================*/
trx_t* trx); /*!< in: transaction */
/*******************************************************************//**
+Check if a transaction holds any autoinc locks.
+@return TRUE if the transaction holds any AUTOINC locks. */
+UNIV_INTERN
+ibool
+lock_trx_holds_autoinc_locks(
+/*=========================*/
+ const trx_t* trx); /*!< in: transaction */
+/*******************************************************************//**
Release all the transaction's autoinc locks. */
UNIV_INTERN
void
=== modified file 'storage/innodb_plugin/include/log0log.h'
--- a/storage/innodb_plugin/include/log0log.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/log0log.h 2009-10-08 12:18:19 +0000
@@ -118,10 +118,9 @@ UNIV_INLINE
ib_uint64_t
log_reserve_and_write_fast(
/*=======================*/
- byte* str, /*!< in: string */
+ const void* str, /*!< in: string */
ulint len, /*!< in: string length */
- ib_uint64_t* start_lsn,/*!< out: start lsn of the log record */
- ibool* success);/*!< out: TRUE if success */
+ ib_uint64_t* start_lsn);/*!< out: start lsn of the log record */
/***********************************************************************//**
Releases the log mutex. */
UNIV_INLINE
@@ -283,7 +282,7 @@ log_make_checkpoint_at(
later lsn, if IB_ULONGLONG_MAX, makes
a checkpoint at the latest lsn */
ibool write_always); /*!< in: the function normally checks if
- the the new checkpoint would have a
+ the new checkpoint would have a
greater lsn than the previous one: if
not, then no physical write is done;
by setting this parameter TRUE, a
=== modified file 'storage/innodb_plugin/include/log0log.ic'
--- a/storage/innodb_plugin/include/log0log.ic 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/log0log.ic 2009-10-09 12:52:18 +0000
@@ -27,6 +27,7 @@ Created 12/9/1995 Heikki Tuuri
#include "mach0data.h"
#include "mtr0mtr.h"
+#ifdef UNIV_LOG_DEBUG
/******************************************************//**
Checks by parsing that the catenated log segment for a single mtr is
consistent. */
@@ -34,11 +35,12 @@ UNIV_INTERN
ibool
log_check_log_recs(
/*===============*/
- byte* buf, /*!< in: pointer to the start of
+ const byte* buf, /*!< in: pointer to the start of
the log segment in the
log_sys->buf log buffer */
ulint len, /*!< in: segment length in bytes */
ib_uint64_t buf_start_lsn); /*!< in: buffer start lsn */
+#endif /* UNIV_LOG_DEBUG */
/************************************************************//**
Gets a log block flush bit.
@@ -305,55 +307,76 @@ UNIV_INLINE
ib_uint64_t
log_reserve_and_write_fast(
/*=======================*/
- byte* str, /*!< in: string */
+ const void* str, /*!< in: string */
ulint len, /*!< in: string length */
- ib_uint64_t* start_lsn,/*!< out: start lsn of the log record */
- ibool* success)/*!< out: TRUE if success */
+ ib_uint64_t* start_lsn)/*!< out: start lsn of the log record */
{
- log_t* log = log_sys;
ulint data_len;
- ib_uint64_t lsn;
-
- *success = TRUE;
-
- mutex_enter(&(log->mutex));
-
- data_len = len + log->buf_free % OS_FILE_LOG_BLOCK_SIZE;
+#ifdef UNIV_LOG_LSN_DEBUG
+ /* length of the LSN pseudo-record */
+ ulint lsn_len = 1
+ + mach_get_compressed_size(log_sys->lsn >> 32)
+ + mach_get_compressed_size(log_sys->lsn & 0xFFFFFFFFUL);
+#endif /* UNIV_LOG_LSN_DEBUG */
+
+ mutex_enter(&log_sys->mutex);
+
+ data_len = len
+#ifdef UNIV_LOG_LSN_DEBUG
+ + lsn_len
+#endif /* UNIV_LOG_LSN_DEBUG */
+ + log_sys->buf_free % OS_FILE_LOG_BLOCK_SIZE;
if (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) {
/* The string does not fit within the current log block
or the log block would become full */
- *success = FALSE;
-
- mutex_exit(&(log->mutex));
+ mutex_exit(&log_sys->mutex);
return(0);
}
- *start_lsn = log->lsn;
+ *start_lsn = log_sys->lsn;
+
+#ifdef UNIV_LOG_LSN_DEBUG
+ {
+ /* Write the LSN pseudo-record. */
+ byte* b = &log_sys->buf[log_sys->buf_free];
+ *b++ = MLOG_LSN | (MLOG_SINGLE_REC_FLAG & *(const byte*) str);
+ /* Write the LSN in two parts,
+ as a pseudo page number and space id. */
+ b += mach_write_compressed(b, log_sys->lsn >> 32);
+ b += mach_write_compressed(b, log_sys->lsn & 0xFFFFFFFFUL);
+ ut_a(b - lsn_len == &log_sys->buf[log_sys->buf_free]);
- ut_memcpy(log->buf + log->buf_free, str, len);
+ memcpy(b, str, len);
+ len += lsn_len;
+ }
+#else /* UNIV_LOG_LSN_DEBUG */
+ memcpy(log_sys->buf + log_sys->buf_free, str, len);
+#endif /* UNIV_LOG_LSN_DEBUG */
- log_block_set_data_len((byte*) ut_align_down(log->buf + log->buf_free,
+ log_block_set_data_len((byte*) ut_align_down(log_sys->buf
+ + log_sys->buf_free,
OS_FILE_LOG_BLOCK_SIZE),
data_len);
#ifdef UNIV_LOG_DEBUG
- log->old_buf_free = log->buf_free;
- log->old_lsn = log->lsn;
+ log_sys->old_buf_free = log_sys->buf_free;
+ log_sys->old_lsn = log_sys->lsn;
#endif
- log->buf_free += len;
+ log_sys->buf_free += len;
- ut_ad(log->buf_free <= log->buf_size);
+ ut_ad(log_sys->buf_free <= log_sys->buf_size);
- lsn = log->lsn += len;
+ log_sys->lsn += len;
#ifdef UNIV_LOG_DEBUG
- log_check_log_recs(log->buf + log->old_buf_free,
- log->buf_free - log->old_buf_free, log->old_lsn);
+ log_check_log_recs(log_sys->buf + log_sys->old_buf_free,
+ log_sys->buf_free - log_sys->old_buf_free,
+ log_sys->old_lsn);
#endif
- return(lsn);
+ return(log_sys->lsn);
}
/***********************************************************************//**
=== modified file 'storage/innodb_plugin/include/log0recv.h'
--- a/storage/innodb_plugin/include/log0recv.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/log0recv.h 2009-10-09 14:13:15 +0000
@@ -433,6 +433,11 @@ are allowed yet: the variable name is mi
extern ibool recv_no_ibuf_operations;
/** TRUE when recv_init_crash_recovery() has been called. */
extern ibool recv_needed_recovery;
+#ifdef UNIV_DEBUG
+/** TRUE if writing to the redo log (mtr_commit) is forbidden.
+Protected by log_sys->mutex. */
+extern ibool recv_no_log_write;
+#endif /* UNIV_DEBUG */
/** TRUE if buf_page_is_corrupted() should check if the log sequence
number (FIL_PAGE_LSN) is in the future. Initially FALSE, and set by
=== modified file 'storage/innodb_plugin/include/mtr0mtr.h'
--- a/storage/innodb_plugin/include/mtr0mtr.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/mtr0mtr.h 2009-10-09 12:52:18 +0000
@@ -106,6 +106,9 @@ For 1 - 8 bytes, the flag value must giv
#define MLOG_IBUF_BITMAP_INIT ((byte)27) /*!< initialize an
ibuf bitmap page */
/*#define MLOG_FULL_PAGE ((byte)28) full contents of a page */
+#ifdef UNIV_LOG_LSN_DEBUG
+# define MLOG_LSN ((byte)28) /* current LSN */
+#endif
#define MLOG_INIT_FILE_PAGE ((byte)29) /*!< this means that a
file page is taken
into use and the prior
@@ -118,7 +121,7 @@ For 1 - 8 bytes, the flag value must giv
#define MLOG_WRITE_STRING ((byte)30) /*!< write a string to
a page */
#define MLOG_MULTI_REC_END ((byte)31) /*!< if a single mtr writes
- log records for several pages,
+ several log records,
this log record ends the
sequence of these records */
#define MLOG_DUMMY_RECORD ((byte)32) /*!< dummy log record used to
=== modified file 'storage/innodb_plugin/include/os0file.h'
--- a/storage/innodb_plugin/include/os0file.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/os0file.h 2009-11-03 09:59:06 +0000
@@ -157,6 +157,7 @@ log. */
to become available again */
#define OS_FILE_SHARING_VIOLATION 76
#define OS_FILE_ERROR_NOT_SPECIFIED 77
+#define OS_FILE_INSUFFICIENT_RESOURCE 78
/* @} */
/** Types for aio operations @{ */
=== modified file 'storage/innodb_plugin/include/os0sync.h'
--- a/storage/innodb_plugin/include/os0sync.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/os0sync.h 2009-10-12 12:00:56 +0000
@@ -285,44 +285,74 @@ os_fast_mutex_free(
/**********************************************************//**
Atomic compare-and-swap and increment for InnoDB. */
-#ifdef HAVE_GCC_ATOMIC_BUILTINS
+#if defined(HAVE_IB_GCC_ATOMIC_BUILTINS)
+
+#define HAVE_ATOMIC_BUILTINS
+
/**********************************************************//**
Returns true if swapped, ptr is pointer to target, old_val is value to
compare to, new_val is the value to swap in. */
+
# define os_compare_and_swap(ptr, old_val, new_val) \
__sync_bool_compare_and_swap(ptr, old_val, new_val)
+
# define os_compare_and_swap_ulint(ptr, old_val, new_val) \
os_compare_and_swap(ptr, old_val, new_val)
+
# define os_compare_and_swap_lint(ptr, old_val, new_val) \
os_compare_and_swap(ptr, old_val, new_val)
-# define os_compare_and_swap_thread_id(ptr, old_val, new_val) \
+
+# ifdef HAVE_IB_ATOMIC_PTHREAD_T_GCC
+# define os_compare_and_swap_thread_id(ptr, old_val, new_val) \
os_compare_and_swap(ptr, old_val, new_val)
+# define INNODB_RW_LOCKS_USE_ATOMICS
+# define IB_ATOMICS_STARTUP_MSG \
+ "Mutexes and rw_locks use GCC atomic builtins"
+# else /* HAVE_IB_ATOMIC_PTHREAD_T_GCC */
+# define IB_ATOMICS_STARTUP_MSG \
+ "Mutexes use GCC atomic builtins, rw_locks do not"
+# endif /* HAVE_IB_ATOMIC_PTHREAD_T_GCC */
+
/**********************************************************//**
Returns the resulting value, ptr is pointer to target, amount is the
amount of increment. */
+
# define os_atomic_increment(ptr, amount) \
__sync_add_and_fetch(ptr, amount)
+
# define os_atomic_increment_lint(ptr, amount) \
os_atomic_increment(ptr, amount)
+
# define os_atomic_increment_ulint(ptr, amount) \
os_atomic_increment(ptr, amount)
+
/**********************************************************//**
Returns the old value of *ptr, atomically sets *ptr to new_val */
+
# define os_atomic_test_and_set_byte(ptr, new_val) \
__sync_lock_test_and_set(ptr, new_val)
+
+#elif defined(HAVE_IB_SOLARIS_ATOMICS)
+
+#define HAVE_ATOMIC_BUILTINS
+
/* If not compiling with GCC or GCC doesn't support the atomic
intrinsics and running on Solaris >= 10 use Solaris atomics */
-#elif defined(HAVE_SOLARIS_ATOMICS)
+
#include <atomic.h>
+
/**********************************************************//**
Returns true if swapped, ptr is pointer to target, old_val is value to
compare to, new_val is the value to swap in. */
+
# define os_compare_and_swap_ulint(ptr, old_val, new_val) \
(atomic_cas_ulong(ptr, old_val, new_val) == old_val)
+
# define os_compare_and_swap_lint(ptr, old_val, new_val) \
((lint)atomic_cas_ulong((ulong_t*) ptr, old_val, new_val) == old_val)
-# ifdef INNODB_RW_LOCKS_USE_ATOMICS
-# if SIZEOF_PTHREAD_T == 4
+
+# ifdef HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS
+# if SIZEOF_PTHREAD_T == 4
# define os_compare_and_swap_thread_id(ptr, old_val, new_val) \
((pthread_t)atomic_cas_32(ptr, old_val, new_val) == old_val)
# elif SIZEOF_PTHREAD_T == 8
@@ -331,21 +361,35 @@ compare to, new_val is the value to swap
# else
# error "SIZEOF_PTHREAD_T != 4 or 8"
# endif /* SIZEOF_PTHREAD_T CHECK */
-# endif /* INNODB_RW_LOCKS_USE_ATOMICS */
+# define INNODB_RW_LOCKS_USE_ATOMICS
+# define IB_ATOMICS_STARTUP_MSG \
+ "Mutexes and rw_locks use Solaris atomic functions"
+# else /* HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS */
+# define IB_ATOMICS_STARTUP_MSG \
+ "Mutexes use Solaris atomic functions, rw_locks do not"
+# endif /* HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS */
/**********************************************************//**
Returns the resulting value, ptr is pointer to target, amount is the
amount of increment. */
+
# define os_atomic_increment_lint(ptr, amount) \
atomic_add_long_nv((ulong_t*) ptr, amount)
+
# define os_atomic_increment_ulint(ptr, amount) \
atomic_add_long_nv(ptr, amount)
+
/**********************************************************//**
Returns the old value of *ptr, atomically sets *ptr to new_val */
+
# define os_atomic_test_and_set_byte(ptr, new_val) \
atomic_swap_uchar(ptr, new_val)
-/* On Windows, use Windows atomics / interlocked */
+
#elif defined(HAVE_WINDOWS_ATOMICS)
+
+#define HAVE_ATOMIC_BUILTINS
+
+/* On Windows, use Windows atomics / interlocked */
# ifdef _WIN64
# define win_cmp_and_xchg InterlockedCompareExchange64
# define win_xchg_and_add InterlockedExchangeAdd64
@@ -353,31 +397,46 @@ Returns the old value of *ptr, atomicall
# define win_cmp_and_xchg InterlockedCompareExchange
# define win_xchg_and_add InterlockedExchangeAdd
# endif
+
/**********************************************************//**
Returns true if swapped, ptr is pointer to target, old_val is value to
compare to, new_val is the value to swap in. */
+
# define os_compare_and_swap_ulint(ptr, old_val, new_val) \
(win_cmp_and_xchg(ptr, new_val, old_val) == old_val)
+
# define os_compare_and_swap_lint(ptr, old_val, new_val) \
(win_cmp_and_xchg(ptr, new_val, old_val) == old_val)
-# ifdef INNODB_RW_LOCKS_USE_ATOMICS
-# define os_compare_and_swap_thread_id(ptr, old_val, new_val) \
+
+/* windows thread objects can always be passed to windows atomic functions */
+# define os_compare_and_swap_thread_id(ptr, old_val, new_val) \
(InterlockedCompareExchange(ptr, new_val, old_val) == old_val)
-# endif /* INNODB_RW_LOCKS_USE_ATOMICS */
+# define INNODB_RW_LOCKS_USE_ATOMICS
+# define IB_ATOMICS_STARTUP_MSG \
+ "Mutexes and rw_locks use Windows interlocked functions"
+
/**********************************************************//**
Returns the resulting value, ptr is pointer to target, amount is the
amount of increment. */
+
# define os_atomic_increment_lint(ptr, amount) \
(win_xchg_and_add(ptr, amount) + amount)
+
# define os_atomic_increment_ulint(ptr, amount) \
((ulint) (win_xchg_and_add(ptr, amount) + amount))
+
/**********************************************************//**
Returns the old value of *ptr, atomically sets *ptr to new_val.
InterlockedExchange() operates on LONG, and the LONG will be
clobbered */
+
# define os_atomic_test_and_set_byte(ptr, new_val) \
((byte) InterlockedExchange(ptr, new_val))
-#endif /* HAVE_GCC_ATOMIC_BUILTINS */
+
+#else
+# define IB_ATOMICS_STARTUP_MSG \
+ "Mutexes and rw_locks use InnoDB's own implementation"
+#endif
#ifndef UNIV_NONINL
#include "os0sync.ic"
=== modified file 'storage/innodb_plugin/include/page0page.h'
--- a/storage/innodb_plugin/include/page0page.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/page0page.h 2009-10-09 14:13:15 +0000
@@ -76,8 +76,11 @@ typedef byte page_header_t;
header which are set in a page create */
/*----*/
#define PAGE_LEVEL 26 /* level of the node in an index tree; the
- leaf level is the level 0 */
-#define PAGE_INDEX_ID 28 /* index id where the page belongs */
+ leaf level is the level 0. This field should
+ not be written to after page creation. */
+#define PAGE_INDEX_ID 28 /* index id where the page belongs.
+ This field should not be written to after
+ page creation. */
#define PAGE_BTR_SEG_LEAF 36 /* file segment header for the leaf pages in
a B-tree: defined only on the root page of a
B-tree, but not in the root of an ibuf tree */
=== modified file 'storage/innodb_plugin/include/page0page.ic'
--- a/storage/innodb_plugin/include/page0page.ic 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/page0page.ic 2009-11-03 10:02:43 +0000
@@ -907,7 +907,7 @@ page_get_data_size(
/************************************************************//**
Allocates a block of memory from the free list of an index page. */
-UNIV_INTERN
+UNIV_INLINE
void
page_mem_alloc_free(
/*================*/
=== modified file 'storage/innodb_plugin/include/page0zip.h'
--- a/storage/innodb_plugin/include/page0zip.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/page0zip.h 2009-10-09 14:13:15 +0000
@@ -127,8 +127,12 @@ page_zip_decompress(
/*================*/
page_zip_des_t* page_zip,/*!< in: data, ssize;
out: m_start, m_end, m_nonempty, n_blobs */
- page_t* page) /*!< out: uncompressed page, may be trashed */
- __attribute__((nonnull));
+ page_t* page, /*!< out: uncompressed page, may be trashed */
+ ibool all) /*!< in: TRUE=decompress the whole page;
+ FALSE=verify but do not copy some
+ page header fields that should not change
+ after page creation */
+ __attribute__((nonnull(1,2)));
#ifdef UNIV_DEBUG
/**********************************************************************//**
@@ -385,8 +389,8 @@ IMPORTANT: if page_zip_reorganize() is i
non-clustered index, the caller must update the insert buffer free
bits in the same mini-transaction in such a way that the modification
will be redo-logged.
-@return TRUE on success, FALSE on failure; page and page_zip will be
-left intact on failure. */
+@return TRUE on success, FALSE on failure; page_zip will be left
+intact on failure, but page will be overwritten. */
UNIV_INTERN
ibool
page_zip_reorganize(
=== modified file 'storage/innodb_plugin/include/rem0cmp.h'
--- a/storage/innodb_plugin/include/rem0cmp.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/rem0cmp.h 2009-10-08 10:00:49 +0000
@@ -89,7 +89,7 @@ cmp_dfield_dfield(
/*************************************************************//**
This function is used to compare a data tuple to a physical record.
Only dtuple->n_fields_cmp first fields are taken into account for
-the the data tuple! If we denote by n = n_fields_cmp, then rec must
+the data tuple! If we denote by n = n_fields_cmp, then rec must
have either m >= n fields, or it must differ from dtuple in some of
the m fields rec has. If rec has an externally stored field we do not
compare it but return with value 0 if such a comparison should be
=== modified file 'storage/innodb_plugin/include/rem0rec.ic'
--- a/storage/innodb_plugin/include/rem0rec.ic 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/rem0rec.ic 2009-10-08 10:00:49 +0000
@@ -65,7 +65,7 @@ most significant bytes and bits are writ
- offset_of_this_record) mod 64Ki,
where mod is the modulo as a non-negative
number;
- we can calculate the the offset of the next
+ we can calculate the offset of the next
record with the formula:
relative_offset + offset_of_this_record
mod UNIV_PAGE_SIZE
=== modified file 'storage/innodb_plugin/include/row0ins.h'
--- a/storage/innodb_plugin/include/row0ins.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/row0ins.h 2009-10-09 14:13:15 +0000
@@ -45,7 +45,7 @@ row_ins_check_foreign_constraint(
/*=============================*/
ibool check_ref,/*!< in: TRUE If we want to check that
the referenced table is ok, FALSE if we
- want to to check the foreign key table */
+ want to check the foreign key table */
dict_foreign_t* foreign,/*!< in: foreign constraint; NOTE that the
tables mentioned in it must be in the
dictionary cache if they exist at all */
=== modified file 'storage/innodb_plugin/include/row0mysql.h'
--- a/storage/innodb_plugin/include/row0mysql.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/row0mysql.h 2009-11-03 10:22:15 +0000
@@ -177,7 +177,9 @@ row_update_prebuilt_trx(
in MySQL handle */
trx_t* trx); /*!< in: transaction handle */
/*********************************************************************//**
-Unlocks AUTO_INC type locks that were possibly reserved by a trx. */
+Unlocks AUTO_INC type locks that were possibly reserved by a trx. This
+function should be called at the the end of an SQL statement, by the
+connection thread that owns the transaction (trx->mysql_thd). */
UNIV_INTERN
void
row_unlock_table_autoinc_for_mysql(
@@ -754,8 +756,6 @@ struct row_prebuilt_struct {
store it here so that we can return
it to MySQL */
/*----------------------*/
- UT_LIST_NODE_T(row_prebuilt_t) prebuilts;
- /*!< list node of table->prebuilts */
ulint magic_n2; /*!< this should be the same as
magic_n */
};
=== modified file 'storage/innodb_plugin/include/srv0srv.h'
--- a/storage/innodb_plugin/include/srv0srv.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/srv0srv.h 2009-10-08 11:28:37 +0000
@@ -315,10 +315,6 @@ extern ulint srv_buf_pool_flushed;
/** Number of buffer pool reads that led to the
reading of a disk page */
extern ulint srv_buf_pool_reads;
-/** Number of sequential read-aheads */
-extern ulint srv_read_ahead_seq;
-/** Number of random read-aheads */
-extern ulint srv_read_ahead_rnd;
/** Status variables to be passed to MySQL */
typedef struct export_var_struct export_struc;
@@ -605,13 +601,13 @@ struct export_var_struct{
#ifdef UNIV_DEBUG
ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
#endif /* UNIV_DEBUG */
- ulint innodb_buffer_pool_read_requests; /*!< buf_pool->n_page_gets */
+ ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */
ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */
ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */
ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */
ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
- ulint innodb_buffer_pool_read_ahead_seq;/*!< srv_read_ahead_seq */
- ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
+ ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
+ ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */
@@ -623,9 +619,9 @@ struct export_var_struct{
ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */
ulint innodb_os_log_pending_fsyncs; /*!< fil_n_pending_log_flushes */
ulint innodb_page_size; /*!< UNIV_PAGE_SIZE */
- ulint innodb_pages_created; /*!< buf_pool->n_pages_created */
- ulint innodb_pages_read; /*!< buf_pool->n_pages_read */
- ulint innodb_pages_written; /*!< buf_pool->n_pages_written */
+ ulint innodb_pages_created; /*!< buf_pool->stat.n_pages_created */
+ ulint innodb_pages_read; /*!< buf_pool->stat.n_pages_read */
+ ulint innodb_pages_written; /*!< buf_pool->stat.n_pages_written */
ulint innodb_row_lock_waits; /*!< srv_n_lock_wait_count */
ulint innodb_row_lock_current_waits; /*!< srv_n_lock_wait_current_count */
ib_int64_t innodb_row_lock_time; /*!< srv_n_lock_wait_time
=== modified file 'storage/innodb_plugin/include/trx0rec.h'
--- a/storage/innodb_plugin/include/trx0rec.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/trx0rec.h 2009-10-08 10:00:49 +0000
@@ -44,8 +44,8 @@ UNIV_INLINE
trx_undo_rec_t*
trx_undo_rec_copy(
/*==============*/
- trx_undo_rec_t* undo_rec, /*!< in: undo log record */
- mem_heap_t* heap); /*!< in: heap where copied */
+ const trx_undo_rec_t* undo_rec, /*!< in: undo log record */
+ mem_heap_t* heap); /*!< in: heap where copied */
/**********************************************************************//**
Reads the undo log record type.
@return record type */
=== modified file 'storage/innodb_plugin/include/trx0rec.ic'
--- a/storage/innodb_plugin/include/trx0rec.ic 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/trx0rec.ic 2009-10-08 10:00:49 +0000
@@ -100,8 +100,8 @@ UNIV_INLINE
trx_undo_rec_t*
trx_undo_rec_copy(
/*==============*/
- trx_undo_rec_t* undo_rec, /*!< in: undo log record */
- mem_heap_t* heap) /*!< in: heap where copied */
+ const trx_undo_rec_t* undo_rec, /*!< in: undo log record */
+ mem_heap_t* heap) /*!< in: heap where copied */
{
ulint len;
=== modified file 'storage/innodb_plugin/include/trx0roll.h'
--- a/storage/innodb_plugin/include/trx0roll.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/trx0roll.h 2009-10-08 13:05:59 +0000
@@ -133,6 +133,17 @@ trx_rollback(
Rollback or clean up any incomplete transactions which were
encountered in crash recovery. If the transaction already was
committed, then we clean up a possible insert undo log. If the
+transaction was not yet committed, then we roll it back. */
+UNIV_INTERN
+void
+trx_rollback_or_clean_recovered(
+/*============================*/
+ ibool all); /*!< in: FALSE=roll back dictionary transactions;
+ TRUE=roll back all non-PREPARED transactions */
+/*******************************************************************//**
+Rollback or clean up any incomplete transactions which were
+encountered in crash recovery. If the transaction already was
+committed, then we clean up a possible insert undo log. If the
transaction was not yet committed, then we roll it back.
Note: this is done in a background thread.
@return a dummy parameter */
@@ -208,9 +219,9 @@ int
trx_general_rollback_for_mysql(
/*===========================*/
trx_t* trx, /*!< in: transaction handle */
- ibool partial,/*!< in: TRUE if partial rollback requested */
trx_savept_t* savept);/*!< in: pointer to savepoint undo number, if
- partial rollback requested */
+ partial rollback requested, or NULL for
+ complete rollback */
/*******************************************************************//**
Rolls back a transaction back to a named savepoint. Modifications after the
savepoint are undone but InnoDB does NOT release the corresponding locks
=== modified file 'storage/innodb_plugin/include/trx0sys.ic'
--- a/storage/innodb_plugin/include/trx0sys.ic 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/trx0sys.ic 2009-10-08 10:00:49 +0000
@@ -34,11 +34,11 @@ typedef byte trx_sysf_rseg_t;
/* Rollback segment specification slot offsets */
/*-------------------------------------------------------------*/
-#define TRX_SYS_RSEG_SPACE 0 /* space where the the segment
+#define TRX_SYS_RSEG_SPACE 0 /* space where the segment
header is placed; starting with
MySQL/InnoDB 5.1.7, this is
UNIV_UNDEFINED if the slot is unused */
-#define TRX_SYS_RSEG_PAGE_NO 4 /* page number where the the segment
+#define TRX_SYS_RSEG_PAGE_NO 4 /* page number where the segment
header is placed; this is FIL_NULL
if the slot is unused */
/*-------------------------------------------------------------*/
=== modified file 'storage/innodb_plugin/include/trx0trx.h'
--- a/storage/innodb_plugin/include/trx0trx.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/trx0trx.h 2009-10-08 13:05:59 +0000
@@ -179,7 +179,7 @@ trx_commit_off_kernel(
/****************************************************************//**
Cleans up a transaction at database startup. The cleanup is needed if
the transaction already got to the middle of a commit when the database
-crashed, andf we cannot roll it back. */
+crashed, and we cannot roll it back. */
UNIV_INTERN
void
trx_cleanup_at_db_startup(
@@ -360,7 +360,7 @@ enum trx_dict_op {
operation modes in crash recovery. */
TRX_DICT_OP_TABLE = 1,
/** The transaction is creating or dropping an index in an
- existing table. In crash recovery, the the data dictionary
+ existing table. In crash recovery, the data dictionary
must be locked, but the table must not be dropped. */
TRX_DICT_OP_INDEX = 2
};
=== modified file 'storage/innodb_plugin/include/univ.i'
--- a/storage/innodb_plugin/include/univ.i 2009-08-14 15:18:52 +0000
+++ b/storage/innodb_plugin/include/univ.i 2009-11-03 10:26:39 +0000
@@ -46,11 +46,11 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0
-#define INNODB_VERSION_BUGFIX 4
+#define INNODB_VERSION_BUGFIX 5
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
-calculated in in make_version_string() in sql/sql_show.cc like this:
+calculated in make_version_string() in sql/sql_show.cc like this:
"version >> 8" . "version & 0xff"
because the version is shown with only one dot, we skip the last
component, i.e. we show M.N.P as M.N */
@@ -78,17 +78,25 @@ the virtual method table (vtable) in GCC
# define ha_innobase ha_innodb
#endif /* MYSQL_DYNAMIC_PLUGIN */
+/* if any of the following macros is defined at this point this means
+that the code from the "right" plug.in was executed and we do not
+need to include ut0auxconf.h which would either define the same macros
+or will be empty */
+#if !defined(HAVE_IB_GCC_ATOMIC_BUILTINS) \
+ && !defined(HAVE_IB_ATOMIC_PTHREAD_T_GCC) \
+ && !defined(HAVE_IB_SOLARIS_ATOMICS) \
+ && !defined(HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS) \
+ && !defined(SIZEOF_PTHREAD_T) \
+ && !defined(HAVE_IB_PAUSE_INSTRUCTION)
+# include "ut0auxconf.h"
+#endif
+
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
# undef __WIN__
# define __WIN__
# include <windows.h>
-# if defined(HAVE_WINDOWS_ATOMICS)
-/* If atomics are defined we use them in InnoDB mutex implementation */
-# define HAVE_ATOMIC_BUILTINS
-# endif /* HAVE_WINDOWS_ATOMICS */
-
# ifdef _NT_
# define __NT__
# endif
@@ -111,45 +119,17 @@ if we are compiling on Windows. */
# include <sys/mman.h> /* mmap() for os0proc.c */
# endif
-# undef PACKAGE
-# undef VERSION
-
/* Include the header file generated by GNU autoconf */
# ifndef __WIN__
-#ifndef UNIV_HOTBACKUP
-# include "config.h"
-#endif /* UNIV_HOTBACKUP */
+# ifndef UNIV_HOTBACKUP
+# include "config.h"
+# endif /* UNIV_HOTBACKUP */
# endif
# ifdef HAVE_SCHED_H
# include <sched.h>
# endif
-# if defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_SOLARIS_ATOMICS) \
- || defined(HAVE_WINDOWS_ATOMICS)
-/* If atomics are defined we use them in InnoDB mutex implementation */
-# define HAVE_ATOMIC_BUILTINS
-# endif /* (HAVE_GCC_ATOMIC_BUILTINS) || (HAVE_SOLARIS_ATOMICS)
- || (HAVE_WINDOWS_ATOMICS) */
-
-/* For InnoDB rw_locks to work with atomics we need the thread_id
-to be no more than machine word wide. The following enables using
-atomics for InnoDB rw_locks where these conditions are met. */
-#ifdef HAVE_ATOMIC_BUILTINS
-/* if HAVE_ATOMIC_PTHREAD_T is defined at this point that means that
-the code from plug.in has defined it and we do not need to include
-ut0auxconf.h which would either define HAVE_ATOMIC_PTHREAD_T or will
-be empty */
-# ifndef HAVE_ATOMIC_PTHREAD_T
-# include "ut0auxconf.h"
-# endif /* HAVE_ATOMIC_PTHREAD_T */
-/* now HAVE_ATOMIC_PTHREAD_T is eventually defined either by plug.in or
-from Makefile.in->ut0auxconf.h */
-# ifdef HAVE_ATOMIC_PTHREAD_T
-# define INNODB_RW_LOCKS_USE_ATOMICS
-# endif /* HAVE_ATOMIC_PTHREAD_T */
-#endif /* HAVE_ATOMIC_BUILTINS */
-
/* We only try to do explicit inlining of functions with gcc and
Sun Studio */
@@ -196,12 +176,18 @@ command. Not tested on Windows. */
debugging without UNIV_DEBUG */
#define UNIV_DEBUG /* Enable ut_ad() assertions
and disable UNIV_INLINE */
+#define UNIV_DEBUG_LOCK_VALIDATE /* Enable
+ ut_ad(lock_rec_validate_page())
+ assertions. */
#define UNIV_DEBUG_FILE_ACCESSES /* Debug .ibd file access
(field file_page_was_freed
in buf_page_t) */
#define UNIV_LRU_DEBUG /* debug the buffer pool LRU */
#define UNIV_HASH_DEBUG /* debug HASH_ macros */
#define UNIV_LIST_DEBUG /* debug UT_LIST_ macros */
+#define UNIV_LOG_LSN_DEBUG /* write LSN to the redo log;
+this will break redo log file compatibility, but it may be useful when
+debugging redo log application problems. */
#define UNIV_MEM_DEBUG /* detect memory leaks etc */
#define UNIV_IBUF_DEBUG /* debug the insert buffer */
#define UNIV_IBUF_COUNT_DEBUG /* debug the insert buffer;
@@ -251,7 +237,7 @@ by one. */
/* Linkage specifier for non-static InnoDB symbols (variables and functions)
that are only referenced from within InnoDB, not from MySQL */
-#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(UNIV_HOTBACKUP)
+#if defined(__GNUC__) && (__GNUC__ >= 4) || defined(__INTEL_COMPILER)
# define UNIV_INTERN __attribute__((visibility ("hidden")))
#else
# define UNIV_INTERN
@@ -409,7 +395,8 @@ it is read. */
it is read or written. */
# define UNIV_PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 3)
/* Sun Studio includes sun_prefetch.h as of version 5.9 */
-#elif (defined(__SUNPRO_C) && __SUNPRO_C >= 0x590) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
+#elif (defined(__SUNPRO_C) && __SUNPRO_C >= 0x590) \
+ || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
# include <sun_prefetch.h>
#if __SUNPRO_C >= 0x550
# undef UNIV_INTERN
=== modified file 'storage/innodb_plugin/include/ut0auxconf.h'
--- a/storage/innodb_plugin/include/ut0auxconf.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/ut0auxconf.h 2009-10-09 12:19:13 +0000
@@ -1,14 +1,14 @@
/* Do not remove this file even though it is empty.
This file is included in univ.i and will cause compilation failure
if not present.
-A custom check has been added in the generated
+A custom checks have been added in the generated
storage/innobase/Makefile.in that is shipped with the InnoDB Plugin
-source archive. This check tries to compile a test program and if
-successful then adds "#define HAVE_ATOMIC_PTHREAD_T" to this file.
-This is a hack that has been developed in order to check for pthread_t
-atomicity without the need to regenerate the ./configure script that is
+source archive. These checks eventually define some macros and put
+them in this file.
+This is a hack that has been developed in order to deploy new compile
+time checks without the need to regenerate the ./configure script that is
distributed in the MySQL 5.1 official source archives.
If by any chance Makefile.in and ./configure are regenerated and thus
-the hack from Makefile.in wiped away then the "real" check from plug.in
+the hack from Makefile.in wiped away then the "real" checks from plug.in
will take over.
*/
=== modified file 'storage/innodb_plugin/include/ut0byte.h'
--- a/storage/innodb_plugin/include/ut0byte.h 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/ut0byte.h 2009-10-08 12:18:19 +0000
@@ -219,8 +219,8 @@ UNIV_INLINE
void*
ut_align(
/*=====*/
- void* ptr, /*!< in: pointer */
- ulint align_no); /*!< in: align by this number */
+ const void* ptr, /*!< in: pointer */
+ ulint align_no); /*!< in: align by this number */
/*********************************************************//**
The following function rounds down a pointer to the nearest
aligned address.
=== modified file 'storage/innodb_plugin/include/ut0byte.ic'
--- a/storage/innodb_plugin/include/ut0byte.ic 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/include/ut0byte.ic 2009-10-08 12:18:19 +0000
@@ -319,8 +319,8 @@ UNIV_INLINE
void*
ut_align(
/*=====*/
- void* ptr, /*!< in: pointer */
- ulint align_no) /*!< in: align by this number */
+ const void* ptr, /*!< in: pointer */
+ ulint align_no) /*!< in: align by this number */
{
ut_ad(align_no > 0);
ut_ad(((align_no - 1) & align_no) == 0);
=== modified file 'storage/innodb_plugin/include/ut0ut.h'
--- a/storage/innodb_plugin/include/ut0ut.h 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/include/ut0ut.h 2009-10-12 12:00:56 +0000
@@ -34,6 +34,11 @@ Created 1/20/1994 Heikki Tuuri
#define ut0ut_h
#include "univ.i"
+
+#ifndef UNIV_HOTBACKUP
+# include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
+#endif /* UNIV_HOTBACKUP */
+
#include <time.h>
#ifndef MYSQL_SERVER
#include <ctype.h>
@@ -47,7 +52,8 @@ Created 1/20/1994 Heikki Tuuri
/** Time stamp */
typedef time_t ib_time_t;
-#if defined(IB_HAVE_PAUSE_INSTRUCTION)
+#ifndef UNIV_HOTBACKUP
+#if defined(HAVE_IB_PAUSE_INSTRUCTION)
# ifdef WIN32
/* In the Win32 API, the x86 PAUSE instruction is executed by calling
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
@@ -84,6 +90,7 @@ do { \
os_thread_sleep(2000 /* 2 ms */); \
} \
} while (0)
+#endif /* !UNIV_HOTBACKUP */
/********************************************************//**
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
@@ -216,6 +223,7 @@ UNIV_INTERN
ib_time_t
ut_time(void);
/*=========*/
+#ifndef UNIV_HOTBACKUP
/**********************************************************//**
Returns system time.
Upon successful completion, the value 0 is returned; otherwise the
@@ -239,6 +247,16 @@ ullint
ut_time_us(
/*=======*/
ullint* tloc); /*!< out: us since epoch, if non-NULL */
+/**********************************************************//**
+Returns the number of milliseconds since some epoch. The
+value may wrap around. It should only be used for heuristic
+purposes.
+@return ms since epoch */
+UNIV_INTERN
+ulint
+ut_time_ms(void);
+/*============*/
+#endif /* !UNIV_HOTBACKUP */
/**********************************************************//**
Returns the difference of two times in seconds.
=== modified file 'storage/innodb_plugin/lock/lock0lock.c'
--- a/storage/innodb_plugin/lock/lock0lock.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/lock/lock0lock.c 2009-10-09 14:13:15 +0000
@@ -214,7 +214,7 @@ a waiting s-lock request on the next rec
by a read cursor moving in the ascending order in the index, we cannot
do the insert immediately, because when we finally commit our transaction,
the read cursor should see also the new inserted record. So we should
-move the read cursor backward from the the next record for it to pass over
+move the read cursor backward from the next record for it to pass over
the new inserted record. This move backward may be too cumbersome to
implement. If we in this situation just enqueue a second x-lock request
for our transaction on the next record, then the deadlock mechanism
@@ -360,10 +360,9 @@ ibool
lock_rec_validate_page(
/*===================*/
ulint space, /*!< in: space id */
+ ulint zip_size,/*!< in: compressed page size in bytes
+ or 0 for uncompressed pages */
ulint page_no);/*!< in: page number */
-
-/* Define the following in order to enable lock_rec_validate_page() checks. */
-# undef UNIV_DEBUG_LOCK_VALIDATE
#endif /* UNIV_DEBUG */
/* The lock system */
@@ -2622,6 +2621,7 @@ lock_move_reorganize_page(
#ifdef UNIV_DEBUG_LOCK_VALIDATE
ut_ad(lock_rec_validate_page(buf_block_get_space(block),
+ buf_block_get_zip_size(block),
buf_block_get_page_no(block)));
#endif
}
@@ -2711,8 +2711,10 @@ lock_move_rec_list_end(
#ifdef UNIV_DEBUG_LOCK_VALIDATE
ut_ad(lock_rec_validate_page(buf_block_get_space(block),
+ buf_block_get_zip_size(block),
buf_block_get_page_no(block)));
ut_ad(lock_rec_validate_page(buf_block_get_space(new_block),
+ buf_block_get_zip_size(block),
buf_block_get_page_no(new_block)));
#endif
}
@@ -2822,6 +2824,7 @@ lock_move_rec_list_start(
#ifdef UNIV_DEBUG_LOCK_VALIDATE
ut_ad(lock_rec_validate_page(buf_block_get_space(block),
+ buf_block_get_zip_size(block),
buf_block_get_page_no(block)));
#endif
}
@@ -3574,7 +3577,8 @@ lock_table_remove_low(
and lock_grant()). Therefore it can be empty and we
need to check for that. */
- if (!ib_vector_is_empty(trx->autoinc_locks)) {
+ if (!lock_get_wait(lock)
+ && !ib_vector_is_empty(trx->autoinc_locks)) {
lock_t* autoinc_lock;
autoinc_lock = ib_vector_pop(trx->autoinc_locks);
@@ -3647,8 +3651,10 @@ lock_table_enqueue_waiting(
if (lock_deadlock_occurs(lock, trx)) {
- lock_reset_lock_and_trx_wait(lock);
+ /* The order here is important, we don't want to
+ lose the state of the lock before calling remove. */
lock_table_remove_low(lock);
+ lock_reset_lock_and_trx_wait(lock);
return(DB_DEADLOCK);
}
@@ -4627,6 +4633,10 @@ lock_rec_queue_validate(
next function call: we have to release lock table mutex
to obey the latching order */
+ /* If this thread is holding the file space latch
+ (fil_space_t::latch), the following check WILL break
+ latching order and may cause a deadlock of threads. */
+
impl_trx = lock_sec_rec_some_has_impl_off_kernel(
rec, index, offsets);
@@ -4684,6 +4694,8 @@ ibool
lock_rec_validate_page(
/*===================*/
ulint space, /*!< in: space id */
+ ulint zip_size,/*!< in: compressed page size in bytes
+ or 0 for uncompressed pages */
ulint page_no)/*!< in: page number */
{
dict_index_t* index;
@@ -4694,7 +4706,6 @@ lock_rec_validate_page(
ulint nth_lock = 0;
ulint nth_bit = 0;
ulint i;
- ulint zip_size;
mtr_t mtr;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
@@ -4705,7 +4716,6 @@ lock_rec_validate_page(
mtr_start(&mtr);
- zip_size = fil_space_get_zip_size(space);
ut_ad(zip_size != ULINT_UNDEFINED);
block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, &mtr);
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
@@ -4750,6 +4760,11 @@ loop:
lock_mutex_exit_kernel();
+ /* If this thread is holding the file space
+ latch (fil_space_t::latch), the following
+ check WILL break the latching order and may
+ cause a deadlock of threads. */
+
lock_rec_queue_validate(block, rec, index, offsets);
lock_mutex_enter_kernel();
@@ -4840,7 +4855,9 @@ lock_validate(void)
lock_mutex_exit_kernel();
- lock_rec_validate_page(space, page_no);
+ lock_rec_validate_page(space,
+ fil_space_get_zip_size(space),
+ page_no);
lock_mutex_enter_kernel();
@@ -5364,6 +5381,20 @@ lock_release_autoinc_last_lock(
}
/*******************************************************************//**
+Check if a transaction holds any autoinc locks.
+@return TRUE if the transaction holds any AUTOINC locks. */
+UNIV_INTERN
+ibool
+lock_trx_holds_autoinc_locks(
+/*=========================*/
+ const trx_t* trx) /*!< in: transaction */
+{
+ ut_a(trx->autoinc_locks != NULL);
+
+ return(!ib_vector_is_empty(trx->autoinc_locks));
+}
+
+/*******************************************************************//**
Release all the transaction's autoinc locks. */
UNIV_INTERN
void
=== modified file 'storage/innodb_plugin/log/log0log.c'
--- a/storage/innodb_plugin/log/log0log.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/log/log0log.c 2009-10-09 14:13:15 +0000
@@ -241,6 +241,7 @@ log_reserve_and_open(
ut_a(len < log->buf_size / 2);
loop:
mutex_enter(&(log->mutex));
+ ut_ad(!recv_no_log_write);
/* Calculate an upper limit for the space the string may take in the
log buffer */
@@ -309,6 +310,7 @@ log_write_low(
ut_ad(mutex_own(&(log->mutex)));
part_loop:
+ ut_ad(!recv_no_log_write);
/* Calculate a part length */
data_len = (log->buf_free % OS_FILE_LOG_BLOCK_SIZE) + str_len;
@@ -377,6 +379,7 @@ log_close(void)
ib_uint64_t checkpoint_age;
ut_ad(mutex_own(&(log->mutex)));
+ ut_ad(!recv_no_log_write);
lsn = log->lsn;
@@ -668,8 +671,6 @@ log_calc_max_ages(void)
ulint archive_margin;
ulint smallest_archive_margin;
- ut_ad(!mutex_own(&(log_sys->mutex)));
-
mutex_enter(&(log_sys->mutex));
group = UT_LIST_GET_FIRST(log_sys->log_groups);
@@ -1117,6 +1118,7 @@ log_io_complete(
}
mutex_enter(&(log_sys->mutex));
+ ut_ad(!recv_no_log_write);
ut_a(group->n_pending_writes > 0);
ut_a(log_sys->n_pending_writes > 0);
@@ -1148,6 +1150,7 @@ log_group_file_header_flush(
ulint dest_offset;
ut_ad(mutex_own(&(log_sys->mutex)));
+ ut_ad(!recv_no_log_write);
ut_a(nth_file < group->n_files);
buf = *(group->file_header_bufs + nth_file);
@@ -1219,6 +1222,7 @@ log_group_write_buf(
ulint i;
ut_ad(mutex_own(&(log_sys->mutex)));
+ ut_ad(!recv_no_log_write);
ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a(((ulint) start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
@@ -1361,6 +1365,7 @@ loop:
#endif
mutex_enter(&(log_sys->mutex));
+ ut_ad(!recv_no_log_write);
if (flush_to_disk
&& log_sys->flushed_to_disk_lsn >= lsn) {
@@ -1974,6 +1979,7 @@ log_checkpoint(
mutex_enter(&(log_sys->mutex));
+ ut_ad(!recv_no_log_write);
oldest_lsn = log_buf_pool_get_oldest_modification();
mutex_exit(&(log_sys->mutex));
@@ -2047,7 +2053,7 @@ log_make_checkpoint_at(
later lsn, if IB_ULONGLONG_MAX, makes
a checkpoint at the latest lsn */
ibool write_always) /*!< in: the function normally checks if
- the the new checkpoint would have a
+ the new checkpoint would have a
greater lsn than the previous one: if
not, then no physical write is done;
by setting this parameter TRUE, a
@@ -2086,6 +2092,7 @@ loop:
do_checkpoint = FALSE;
mutex_enter(&(log->mutex));
+ ut_ad(!recv_no_log_write);
if (log->check_flush_or_checkpoint == FALSE) {
mutex_exit(&(log->mutex));
@@ -3035,6 +3042,7 @@ loop:
#endif /* UNIV_LOG_ARCHIVE */
mutex_enter(&(log_sys->mutex));
+ ut_ad(!recv_no_log_write);
if (log_sys->check_flush_or_checkpoint) {
@@ -3234,6 +3242,7 @@ loop:
ut_a(lsn == log_sys->lsn);
}
+#ifdef UNIV_LOG_DEBUG
/******************************************************//**
Checks by parsing that the catenated log segment for a single mtr is
consistent. */
@@ -3241,7 +3250,7 @@ UNIV_INTERN
ibool
log_check_log_recs(
/*===============*/
- byte* buf, /*!< in: pointer to the start of
+ const byte* buf, /*!< in: pointer to the start of
the log segment in the
log_sys->buf log buffer */
ulint len, /*!< in: segment length in bytes */
@@ -3249,8 +3258,8 @@ log_check_log_recs(
{
ib_uint64_t contiguous_lsn;
ib_uint64_t scanned_lsn;
- byte* start;
- byte* end;
+ const byte* start;
+ const byte* end;
byte* buf1;
byte* scan_buf;
@@ -3283,6 +3292,7 @@ log_check_log_recs(
return(TRUE);
}
+#endif /* UNIV_LOG_DEBUG */
/******************************************************//**
Peeks the current lsn.
=== modified file 'storage/innodb_plugin/log/log0recv.c'
--- a/storage/innodb_plugin/log/log0recv.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/log/log0recv.c 2009-10-09 14:13:15 +0000
@@ -78,6 +78,11 @@ UNIV_INTERN ibool recv_recovery_from_bac
#ifndef UNIV_HOTBACKUP
/** TRUE when recv_init_crash_recovery() has been called. */
UNIV_INTERN ibool recv_needed_recovery = FALSE;
+# ifdef UNIV_DEBUG
+/** TRUE if writing to the redo log (mtr_commit) is forbidden.
+Protected by log_sys->mutex. */
+UNIV_INTERN ibool recv_no_log_write = FALSE;
+# endif /* UNIV_DEBUG */
/** TRUE if buf_page_is_corrupted() should check if the log sequence
number (FIL_PAGE_LSN) is in the future. Initially FALSE, and set by
@@ -853,6 +858,11 @@ recv_parse_or_apply_log_rec_body(
}
switch (type) {
+#ifdef UNIV_LOG_LSN_DEBUG
+ case MLOG_LSN:
+ /* The LSN is checked in recv_parse_log_rec(). */
+ break;
+#endif /* UNIV_LOG_LSN_DEBUG */
case MLOG_1BYTE: case MLOG_2BYTES: case MLOG_4BYTES: case MLOG_8BYTES:
#ifdef UNIV_DEBUG
if (page && page_type == FIL_PAGE_TYPE_ALLOCATED
@@ -1269,7 +1279,7 @@ recv_add_to_hash_table(
sizeof(recv_data_t) + len);
*prev_field = recv_data;
- ut_memcpy(((byte*)recv_data) + sizeof(recv_data_t), body, len);
+ memcpy(recv_data + 1, body, len);
prev_field = &(recv_data->next);
@@ -1327,6 +1337,7 @@ recv_recover_page_func(
buf_block_t* block) /*!< in/out: buffer block */
{
page_t* page;
+ page_zip_des_t* page_zip;
recv_addr_t* recv_addr;
recv_t* recv;
byte* buf;
@@ -1376,6 +1387,7 @@ recv_recover_page_func(
mtr_set_log_mode(&mtr, MTR_LOG_NONE);
page = block->frame;
+ page_zip = buf_block_get_page_zip(block);
#ifndef UNIV_HOTBACKUP
if (just_read_in) {
@@ -1436,13 +1448,19 @@ recv_recover_page_func(
if (recv->type == MLOG_INIT_FILE_PAGE) {
page_lsn = page_newest_lsn;
- mach_write_ull(page + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM, 0);
- mach_write_ull(page + FIL_PAGE_LSN, 0);
+ memset(FIL_PAGE_LSN + page, 0, 8);
+ memset(UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM
+ + page, 0, 8);
+
+ if (page_zip) {
+ memset(FIL_PAGE_LSN + page_zip->data, 0, 8);
+ }
}
if (recv->start_lsn >= page_lsn) {
+ ib_uint64_t end_lsn;
+
if (!modification_to_page) {
modification_to_page = TRUE;
@@ -1464,11 +1482,17 @@ recv_recover_page_func(
recv_parse_or_apply_log_rec_body(recv->type, buf,
buf + recv->len,
block, &mtr);
- mach_write_ull(page + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM,
- recv->start_lsn + recv->len);
- mach_write_ull(page + FIL_PAGE_LSN,
- recv->start_lsn + recv->len);
+
+ end_lsn = recv->start_lsn + recv->len;
+ mach_write_ull(FIL_PAGE_LSN + page, end_lsn);
+ mach_write_ull(UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM
+ + page, end_lsn);
+
+ if (page_zip) {
+ mach_write_ull(FIL_PAGE_LSN
+ + page_zip->data, end_lsn);
+ }
}
if (recv->len > RECV_DATA_BLOCK_SIZE) {
@@ -1686,6 +1710,7 @@ loop:
/* Flush all the file pages to disk and invalidate them in
the buffer pool */
+ ut_d(recv_no_log_write = TRUE);
mutex_exit(&(recv_sys->mutex));
mutex_exit(&(log_sys->mutex));
@@ -1699,6 +1724,7 @@ loop:
mutex_enter(&(log_sys->mutex));
mutex_enter(&(recv_sys->mutex));
+ ut_d(recv_no_log_write = FALSE);
recv_no_ibuf_operations = FALSE;
}
@@ -1910,6 +1936,17 @@ recv_parse_log_rec(
return(0);
}
+#ifdef UNIV_LOG_LSN_DEBUG
+ if (*type == MLOG_LSN) {
+ ib_uint64_t lsn = (ib_uint64_t) *space << 32 | *page_no;
+# ifdef UNIV_LOG_DEBUG
+ ut_a(lsn == log_sys->old_lsn);
+# else /* UNIV_LOG_DEBUG */
+ ut_a(lsn == recv_sys->recovered_lsn);
+# endif /* UNIV_LOG_DEBUG */
+ }
+#endif /* UNIV_LOG_LSN_DEBUG */
+
/* Check that page_no is sensible */
if (UNIV_UNLIKELY(*page_no > 0x8FFFFFFFUL)) {
@@ -2167,6 +2204,12 @@ loop:
#endif
/* In normal mysqld crash recovery we do not try to
replay file operations */
+#ifdef UNIV_LOG_LSN_DEBUG
+ } else if (type == MLOG_LSN) {
+ /* Do not add these records to the hash table.
+ The page number and space id fields are misused
+ for something else. */
+#endif /* UNIV_LOG_LSN_DEBUG */
} else {
recv_add_to_hash_table(type, space, page_no, body,
ptr + len, old_lsn,
@@ -2198,11 +2241,11 @@ loop:
= recv_sys->recovered_offset + total_len;
recv_previous_parsed_rec_is_multi = 1;
- if ((!store_to_hash) && (type != MLOG_MULTI_REC_END)) {
#ifdef UNIV_LOG_DEBUG
+ if ((!store_to_hash) && (type != MLOG_MULTI_REC_END)) {
recv_check_incomplete_log_recs(ptr, len);
-#endif /* UNIV_LOG_DEBUG */
}
+#endif /* UNIV_LOG_DEBUG */
#ifdef UNIV_DEBUG
if (log_debug_writes) {
@@ -2266,7 +2309,11 @@ loop:
break;
}
- if (store_to_hash) {
+ if (store_to_hash
+#ifdef UNIV_LOG_LSN_DEBUG
+ && type != MLOG_LSN
+#endif /* UNIV_LOG_LSN_DEBUG */
+ ) {
recv_add_to_hash_table(type, space, page_no,
body, ptr + len,
old_lsn,
@@ -2415,8 +2462,7 @@ recv_scan_log_recs(
scanned_lsn = start_lsn;
more_data = FALSE;
- while (log_block < buf + len && !finished) {
-
+ do {
no = log_block_get_hdr_no(log_block);
/*
fprintf(stderr, "Log block header no %lu\n", no);
@@ -2546,10 +2592,11 @@ recv_scan_log_recs(
/* Log data for this group ends here */
finished = TRUE;
+ break;
} else {
log_block += OS_FILE_LOG_BLOCK_SIZE;
}
- }
+ } while (log_block < buf + len && !finished);
*group_scanned_lsn = scanned_lsn;
@@ -3104,6 +3151,11 @@ recv_recovery_from_checkpoint_finish(voi
#ifndef UNIV_LOG_DEBUG
recv_sys_free();
#endif
+ /* Roll back any recovered data dictionary transactions, so
+ that the data dictionary tables will be free of any locks.
+ The data dictionary latch should guarantee that there is at
+ most one data dictionary transaction active at a time. */
+ trx_rollback_or_clean_recovered(FALSE);
/* Drop partially created indexes. */
row_merge_drop_temp_indexes();
=== modified file 'storage/innodb_plugin/mem/mem0mem.c'
--- a/storage/innodb_plugin/mem/mem0mem.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/mem/mem0mem.c 2009-10-08 10:00:49 +0000
@@ -475,16 +475,18 @@ mem_heap_block_free(
len = block->len;
block->magic_n = MEM_FREED_BLOCK_MAGIC_N;
+#ifndef UNIV_HOTBACKUP
+ if (!srv_use_sys_malloc) {
#ifdef UNIV_MEM_DEBUG
- /* In the debug version we set the memory to a random combination
- of hex 0xDE and 0xAD. */
+ /* In the debug version we set the memory to a random
+ combination of hex 0xDE and 0xAD. */
- mem_erase_buf((byte*)block, len);
+ mem_erase_buf((byte*)block, len);
#else /* UNIV_MEM_DEBUG */
- UNIV_MEM_ASSERT_AND_FREE(block, len);
+ UNIV_MEM_ASSERT_AND_FREE(block, len);
#endif /* UNIV_MEM_DEBUG */
-#ifndef UNIV_HOTBACKUP
+ }
if (type == MEM_HEAP_DYNAMIC || len < UNIV_PAGE_SIZE / 2) {
ut_ad(!buf_block);
@@ -495,6 +497,14 @@ mem_heap_block_free(
buf_block_free(buf_block);
}
#else /* !UNIV_HOTBACKUP */
+#ifdef UNIV_MEM_DEBUG
+ /* In the debug version we set the memory to a random
+ combination of hex 0xDE and 0xAD. */
+
+ mem_erase_buf((byte*)block, len);
+#else /* UNIV_MEM_DEBUG */
+ UNIV_MEM_ASSERT_AND_FREE(block, len);
+#endif /* UNIV_MEM_DEBUG */
ut_free(block);
#endif /* !UNIV_HOTBACKUP */
}
=== modified file 'storage/innodb_plugin/mtr/mtr0mtr.c'
--- a/storage/innodb_plugin/mtr/mtr0mtr.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/mtr/mtr0mtr.c 2009-10-09 14:13:15 +0000
@@ -35,6 +35,7 @@ Created 11/26/1995 Heikki Tuuri
#include "log0log.h"
#ifndef UNIV_HOTBACKUP
+# include "log0recv.h"
/*****************************************************************//**
Releases the item in the slot given. */
UNIV_INLINE
@@ -115,7 +116,6 @@ mtr_log_reserve_and_write(
dyn_array_t* mlog;
dyn_block_t* block;
ulint data_size;
- ibool success;
byte* first_data;
ut_ad(mtr);
@@ -134,8 +134,8 @@ mtr_log_reserve_and_write(
if (mlog->heap == NULL) {
mtr->end_lsn = log_reserve_and_write_fast(
first_data, dyn_block_get_used(mlog),
- &(mtr->start_lsn), &success);
- if (success) {
+ &mtr->start_lsn);
+ if (mtr->end_lsn) {
return;
}
@@ -182,6 +182,8 @@ mtr_commit(
ut_d(mtr->state = MTR_COMMITTING);
#ifndef UNIV_HOTBACKUP
+ /* This is a dirty read, for debugging. */
+ ut_ad(!recv_no_log_write);
write_log = mtr->modifications && mtr->n_log_recs;
if (write_log) {
=== modified file 'storage/innodb_plugin/mysql-test/innodb-analyze.test'
--- a/storage/innodb_plugin/mysql-test/innodb-analyze.test 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb-analyze.test 2009-10-12 12:56:02 +0000
@@ -11,6 +11,7 @@
-- disable_result_log
-- enable_warnings
+let $sample_pages=`select @@innodb_stats_sample_pages`;
SET GLOBAL innodb_stats_sample_pages=0;
# check that the value has been adjusted to 1
@@ -61,3 +62,4 @@ SET GLOBAL innodb_stats_sample_pages=16;
ANALYZE TABLE innodb_analyze;
DROP TABLE innodb_analyze;
+EVAL SET GLOBAL innodb_stats_sample_pages=$sample_pages;
=== added file 'storage/innodb_plugin/mysql-test/innodb-consistent-master.opt'
--- a/storage/innodb_plugin/mysql-test/innodb-consistent-master.opt 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb-consistent-master.opt 2009-10-12 12:56:02 +0000
@@ -0,0 +1 @@
+--innodb_lock_wait_timeout=2
=== added file 'storage/innodb_plugin/mysql-test/innodb-consistent.result'
--- a/storage/innodb_plugin/mysql-test/innodb-consistent.result 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb-consistent.result 2009-10-12 12:56:02 +0000
@@ -0,0 +1,35 @@
+drop table if exists t1;
+set session transaction isolation level read committed;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+create table t2 like t1;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7);
+set autocommit=0;
+begin;
+replace into t1 select * from t2;
+set session transaction isolation level read committed;
+set autocommit=0;
+delete from t2 where a=5;
+commit;
+delete from t2;
+commit;
+commit;
+begin;
+insert into t1 select * from t2;
+set session transaction isolation level read committed;
+set autocommit=0;
+delete from t2 where a=5;
+commit;
+delete from t2;
+commit;
+commit;
+select * from t1;
+a
+1
+2
+3
+4
+5
+6
+7
+drop table t1;
+drop table t2;
=== added file 'storage/innodb_plugin/mysql-test/innodb-consistent.test'
--- a/storage/innodb_plugin/mysql-test/innodb-consistent.test 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb-consistent.test 2009-10-12 12:56:02 +0000
@@ -0,0 +1,58 @@
+-- source include/not_embedded.inc
+-- source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
+# a consistent read of the source table.
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+set session transaction isolation level read committed;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+create table t2 like t1;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7);
+set autocommit=0;
+
+# REPLACE INTO ... SELECT case
+begin;
+# this should not result in any locks on t2.
+replace into t1 select * from t2;
+
+connection b;
+set session transaction isolation level read committed;
+set autocommit=0;
+# should not cuase a lock wait.
+delete from t2 where a=5;
+commit;
+delete from t2;
+commit;
+connection a;
+commit;
+
+# INSERT INTO ... SELECT case
+begin;
+# this should not result in any locks on t2.
+insert into t1 select * from t2;
+
+connection b;
+set session transaction isolation level read committed;
+set autocommit=0;
+# should not cuase a lock wait.
+delete from t2 where a=5;
+commit;
+delete from t2;
+commit;
+connection a;
+commit;
+
+select * from t1;
+drop table t1;
+drop table t2;
+
+connection default;
+disconnect a;
+disconnect b;
=== modified file 'storage/innodb_plugin/mysql-test/innodb-zip.result'
--- a/storage/innodb_plugin/mysql-test/innodb-zip.result 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb-zip.result 2009-10-12 12:56:02 +0000
@@ -141,7 +141,7 @@ drop table t1;
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
+CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
=== modified file 'storage/innodb_plugin/mysql-test/innodb-zip.test'
--- a/storage/innodb_plugin/mysql-test/innodb-zip.test 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb-zip.test 2009-10-12 12:56:02 +0000
@@ -105,7 +105,7 @@ drop table t1;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
+CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
=== modified file 'storage/innodb_plugin/mysql-test/innodb_bug34300.test'
--- a/storage/innodb_plugin/mysql-test/innodb_bug34300.test 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_bug34300.test 2009-10-08 09:13:16 +0000
@@ -9,6 +9,7 @@
-- disable_result_log
# set packet size and reconnect
+let $max_packet=`select @@global.max_allowed_packet`;
SET @@global.max_allowed_packet=16777216;
--connect (newconn, localhost, root,,)
@@ -30,3 +31,4 @@ ALTER TABLE bug34300 ADD COLUMN (f10 INT
SELECT f4, f8 FROM bug34300;
DROP TABLE bug34300;
+EVAL SET @@global.max_allowed_packet=$max_packet;
=== modified file 'storage/innodb_plugin/mysql-test/innodb_bug36169.test'
--- a/storage/innodb_plugin/mysql-test/innodb_bug36169.test 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_bug36169.test 2009-10-12 12:56:02 +0000
@@ -5,6 +5,8 @@
-- source include/have_innodb.inc
+let $file_format=`select @@innodb_file_format`;
+let $file_per_table=`select @@innodb_file_per_table`;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=ON;
@@ -1153,3 +1155,5 @@ DROP TABLE IF EXISTS table4;
DROP TABLE IF EXISTS table5;
DROP TABLE IF EXISTS table6;
+EVAL SET GLOBAL innodb_file_format=$file_format;
+EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
=== modified file 'storage/innodb_plugin/mysql-test/innodb_bug36172.test'
--- a/storage/innodb_plugin/mysql-test/innodb_bug36172.test 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_bug36172.test 2009-10-12 12:56:02 +0000
@@ -14,6 +14,9 @@ SET storage_engine=InnoDB;
-- disable_query_log
-- disable_result_log
+let $file_format=`select @@innodb_file_format`;
+let $file_format_check=`select @@innodb_file_format_check`;
+let $file_per_table=`select @@innodb_file_per_table`;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=on;
@@ -24,3 +27,6 @@ CHECK TABLE table0 EXTENDED;
INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.9055146948, `col21` = 4293243420.5621204000, `col22` = '20511211123705', `col23` = 4289899778.6573381000, `col24` = 4293449279.0540481000, `col25` = 'emphysemic', `col26` = 'dentally', `col27` = '2347406', `col28` = 'eruct', `col30` = 1222, `col31` = 4294372994.9941406000, `col32` = 4291385574.1173744000, `col33` = 'borrowing\'s', `col34` = 'septics', `col35` = 'ratter\'s', `col36` = 'Kaye', `col37` = 'Florentia', `col38` = 'allium', `col39` = 'barkeep', `col40` = '19510407003441', `col41` = 4293559200.4215522000, `col42` = 22482, `col43` = 'decussate', `col44` = 'Brom\'s', `col45` = 'violated', `col46` = 4925506.4635456400, `col47` = 930549, `col48` = '51296066', `col49` = 'voluminously', `col50` = '29306676', `col51` = -88, `col52` = -2153690, `col53` = 4290250202.1464887000, `col54` = 'expropriation', `col55` = 'Aberdeen\'s', `col56` = 20343, `col58` = '19640415171532', `col59` = 'extern', `col60` = 'Ubana', `col61` = 4290487961.8539081000, `col62` = '2147', `col63` = -24271, `col64` = '20750801194548', `col65` = 'Cunaxa\'s', `col66` = 'pasticcio', `col67` = 2795817, `col68` = 'Indore\'s', `col70` = 6864127, `col71` = '1817832', `col72` = '20540506114211', `col73` = '20040101012300', `col74` = 'rationalized', `col75` = '45522', `col76` = 'indene', `col77` = -6964559, `col78` = 4247535.5266884370, `col79` = '20720416124357', `col80` = '2143', `col81` = 4292060102.4466386000, `col82` = 'striving', `col83` = 'boneblack\'s', `col84` = 'redolent', `col85` = 6489697.9009369183, `col86` = 4287473465.9731131000, `col87` = 7726015, `col88` = 'perplexed', `col89` = '17153791', `col90` = 5478587.1108127078, `col91` = 4287091404.7004304000, `col92` = 'Boulez\'s', `col93` = '2931278';
CHECK TABLE table0 EXTENDED;
DROP TABLE table0;
+EVAL SET GLOBAL innodb_file_format=$file_format;
+EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
+EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
=== added file 'storage/innodb_plugin/mysql-test/innodb_bug44369.result'
--- a/storage/innodb_plugin/mysql-test/innodb_bug44369.result 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_bug44369.result 2009-10-12 12:56:02 +0000
@@ -0,0 +1,14 @@
+create table bug44369 (DB_ROW_ID int) engine=innodb;
+ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
+create table bug44369 (db_row_id int) engine=innodb;
+ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
+show errors;
+Level Code Message
+Error 1005 Error creating table 'test/bug44369' with column name 'db_row_id'. 'db_row_id' is a reserved name. Please try to re-create the table with a different column name.
+Error 1005 Can't create table 'test.bug44369' (errno: -1)
+create table bug44369 (db_TRX_Id int) engine=innodb;
+ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
+show errors;
+Level Code Message
+Error 1005 Error creating table 'test/bug44369' with column name 'db_TRX_Id'. 'db_TRX_Id' is a reserved name. Please try to re-create the table with a different column name.
+Error 1005 Can't create table 'test.bug44369' (errno: -1)
=== added file 'storage/innodb_plugin/mysql-test/innodb_bug44369.test'
--- a/storage/innodb_plugin/mysql-test/innodb_bug44369.test 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_bug44369.test 2009-10-12 12:56:02 +0000
@@ -0,0 +1,21 @@
+# This is the test for bug 44369. We should
+# block table creation with columns match
+# some innodb internal reserved key words,
+# both case sensitively and insensitely.
+
+--source include/have_innodb.inc
+
+# This create table operation should fail.
+--error ER_CANT_CREATE_TABLE
+create table bug44369 (DB_ROW_ID int) engine=innodb;
+
+# This create should fail as well
+--error ER_CANT_CREATE_TABLE
+create table bug44369 (db_row_id int) engine=innodb;
+
+show errors;
+
+--error ER_CANT_CREATE_TABLE
+create table bug44369 (db_TRX_Id int) engine=innodb;
+
+show errors;
=== added file 'storage/innodb_plugin/mysql-test/innodb_bug44571.result'
--- a/storage/innodb_plugin/mysql-test/innodb_bug44571.result 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_bug44571.result 2009-10-12 12:56:02 +0000
@@ -0,0 +1,9 @@
+CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
+ALTER TABLE bug44571 CHANGE foo bar INT;
+ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
+ERROR 42000: Key column 'foo' doesn't exist in table
+ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
+ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
+CREATE INDEX bug44571b ON bug44571 (bar);
+ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
+DROP TABLE bug44571;
=== added file 'storage/innodb_plugin/mysql-test/innodb_bug44571.test'
--- a/storage/innodb_plugin/mysql-test/innodb_bug44571.test 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_bug44571.test 2009-10-12 12:56:02 +0000
@@ -0,0 +1,17 @@
+#
+# Bug#44571 InnoDB Plugin crashes on ADD INDEX
+# http://bugs.mysql.com/44571
+#
+-- source include/have_innodb.inc
+
+CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
+ALTER TABLE bug44571 CHANGE foo bar INT;
+-- error ER_KEY_COLUMN_DOES_NOT_EXITS
+ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
+# The following will fail, because the CHANGE foo bar was
+# not communicated to InnoDB.
+--error ER_NOT_KEYFILE
+ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
+--error ER_NOT_KEYFILE
+CREATE INDEX bug44571b ON bug44571 (bar);
+DROP TABLE bug44571;
=== added file 'storage/innodb_plugin/mysql-test/innodb_bug46000.result'
--- a/storage/innodb_plugin/mysql-test/innodb_bug46000.result 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_bug46000.result 2009-10-12 12:56:02 +0000
@@ -0,0 +1,17 @@
+create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
+ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
+create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
+ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
+show errors;
+Level Code Message
+Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
+Error 1005 Can't create table 'test.bug46000' (errno: -1)
+create table bug46000(id int) engine=innodb;
+create index GEN_CLUST_INDEX on bug46000(id);
+ERROR HY000: Can't create table '#sql-temporary' (errno: -1)
+show errors;
+Level Code Message
+Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
+Error 1005 Can't create table '#sql-temporary' (errno: -1)
+create index idx on bug46000(id);
+drop table bug46000;
=== added file 'storage/innodb_plugin/mysql-test/innodb_bug46000.test'
--- a/storage/innodb_plugin/mysql-test/innodb_bug46000.test 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_bug46000.test 2009-10-12 12:56:02 +0000
@@ -0,0 +1,34 @@
+# This is the test for bug 46000. We shall
+# block any index creation with the name of
+# "GEN_CLUST_INDEX", which is the reserved
+# name for innodb default primary index.
+
+--source include/have_innodb.inc
+
+# This 'create table' operation should fail because of
+# using the reserve name as its index name.
+--error ER_CANT_CREATE_TABLE
+create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
+
+# Mixed upper/lower case of the reserved key words
+--error ER_CANT_CREATE_TABLE
+create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
+
+show errors;
+
+create table bug46000(id int) engine=innodb;
+
+# This 'create index' operation should fail.
+--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+create index GEN_CLUST_INDEX on bug46000(id);
+
+--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
+show errors;
+
+# This 'create index' operation should succeed, no
+# temp table left from last failed create index
+# operation.
+create index idx on bug46000(id);
+
+drop table bug46000;
=== modified file 'storage/innodb_plugin/mysql-test/innodb_file_format.result'
--- a/storage/innodb_plugin/mysql-test/innodb_file_format.result 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_file_format.result 2009-10-12 12:56:02 +0000
@@ -42,3 +42,4 @@ ERROR HY000: Incorrect arguments to SET
select @@innodb_file_format_check;
@@innodb_file_format_check
Barracuda
+set global innodb_file_format_check=antelope;
=== modified file 'storage/innodb_plugin/mysql-test/innodb_file_format.test'
--- a/storage/innodb_plugin/mysql-test/innodb_file_format.test 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/mysql-test/innodb_file_format.test 2009-10-12 12:56:02 +0000
@@ -26,3 +26,4 @@ set global innodb_file_format=on;
--error ER_WRONG_ARGUMENTS
set global innodb_file_format=off;
select @@innodb_file_format_check;
+set global innodb_file_format_check=antelope;
=== modified file 'storage/innodb_plugin/os/os0file.c'
--- a/storage/innodb_plugin/os/os0file.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/os/os0file.c 2009-11-03 09:59:31 +0000
@@ -88,7 +88,9 @@ UNIV_INTERN ibool os_do_not_call_flush_a
/* We do not call os_file_flush in every os_file_write. */
#endif /* UNIV_DO_FLUSH */
-#ifndef UNIV_HOTBACKUP
+#ifdef UNIV_HOTBACKUP
+# define os_aio_use_native_aio FALSE
+#else /* UNIV_HOTBACKUP */
/* We use these mutexes to protect lseek + file i/o operation, if the
OS does not provide an atomic pread or pwrite, or similar */
#define OS_FILE_N_SEEK_MUTEXES 16
@@ -198,7 +200,7 @@ static ulint os_aio_n_segments = ULINT_U
/** If the following is TRUE, read i/o handler threads try to
wait until a batch of new read requests have been posted */
static ibool os_aio_recommend_sleep_for_read_threads = FALSE;
-#endif /* !UNIV_HOTBACKUP */
+#endif /* UNIV_HOTBACKUP */
UNIV_INTERN ulint os_n_file_reads = 0;
UNIV_INTERN ulint os_bytes_read_since_printout = 0;
@@ -315,6 +317,12 @@ os_file_get_last_error(
" software or another instance\n"
"InnoDB: of MySQL."
" Please close it to get rid of this error.\n");
+ } else if (err == ERROR_WORKING_SET_QUOTA
+ || err == ERROR_NO_SYSTEM_RESOURCES) {
+ fprintf(stderr,
+ "InnoDB: The error means that there are no"
+ " sufficient system resources or quota to"
+ " complete the operation.\n");
} else {
fprintf(stderr,
"InnoDB: Some operating system error numbers"
@@ -336,6 +344,9 @@ os_file_get_last_error(
} else if (err == ERROR_SHARING_VIOLATION
|| err == ERROR_LOCK_VIOLATION) {
return(OS_FILE_SHARING_VIOLATION);
+ } else if (err == ERROR_WORKING_SET_QUOTA
+ || err == ERROR_NO_SYSTEM_RESOURCES) {
+ return(OS_FILE_INSUFFICIENT_RESOURCE);
} else {
return(100 + err);
}
@@ -454,6 +465,10 @@ os_file_handle_error_cond_exit(
os_thread_sleep(10000000); /* 10 sec */
return(TRUE);
+ } else if (err == OS_FILE_INSUFFICIENT_RESOURCE) {
+
+ os_thread_sleep(100000); /* 100 ms */
+ return(TRUE);
} else {
if (name) {
fprintf(stderr, "InnoDB: File name %s\n", name);
@@ -817,6 +832,23 @@ next_file:
ret = stat(full_path, &statinfo);
if (ret) {
+
+ if (errno == ENOENT) {
+ /* readdir() returned a file that does not exist,
+ it must have been deleted in the meantime. Do what
+ would have happened if the file was deleted before
+ readdir() - ignore and go to the next entry.
+ If this is the last entry then info->name will still
+ contain the name of the deleted file when this
+ function returns, but this is not an issue since the
+ caller shouldn't be looking at info when end of
+ directory is returned. */
+
+ ut_free(full_path);
+
+ goto next_file;
+ }
+
os_file_handle_error_no_exit(full_path, "stat");
ut_free(full_path);
@@ -1245,6 +1277,7 @@ try_again:
}
#endif
#ifdef UNIV_NON_BUFFERED_IO
+# ifndef UNIV_HOTBACKUP
if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
/* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every
@@ -1253,10 +1286,14 @@ try_again:
== SRV_WIN_IO_UNBUFFERED) {
attributes = attributes | FILE_FLAG_NO_BUFFERING;
}
-#endif
+# else /* !UNIV_HOTBACKUP */
+ attributes = attributes | FILE_FLAG_NO_BUFFERING;
+# endif /* !UNIV_HOTBACKUP */
+#endif /* UNIV_NON_BUFFERED_IO */
} else if (purpose == OS_FILE_NORMAL) {
attributes = 0;
#ifdef UNIV_NON_BUFFERED_IO
+# ifndef UNIV_HOTBACKUP
if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
/* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every
@@ -1265,7 +1302,10 @@ try_again:
== SRV_WIN_IO_UNBUFFERED) {
attributes = attributes | FILE_FLAG_NO_BUFFERING;
}
-#endif
+# else /* !UNIV_HOTBACKUP */
+ attributes = attributes | FILE_FLAG_NO_BUFFERING;
+# endif /* !UNIV_HOTBACKUP */
+#endif /* UNIV_NON_BUFFERED_IO */
} else {
attributes = 0;
ut_error;
@@ -2022,7 +2062,9 @@ os_file_pread(
offset */
{
off_t offs;
+#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
ssize_t n_bytes;
+#endif /* HAVE_PREAD && !HAVE_BROKEN_PREAD */
ut_a((offset & 0xFFFFFFFFUL) == offset);
@@ -2061,16 +2103,20 @@ os_file_pread(
{
off_t ret_offset;
ssize_t ret;
+#ifndef UNIV_HOTBACKUP
ulint i;
+#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex);
+#ifndef UNIV_HOTBACKUP
/* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
ret_offset = lseek(file, offs, SEEK_SET);
@@ -2080,7 +2126,9 @@ os_file_pread(
ret = read(file, buf, (ssize_t)n);
}
+#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
@@ -2158,16 +2206,20 @@ os_file_pwrite(
#else
{
off_t ret_offset;
+# ifndef UNIV_HOTBACKUP
ulint i;
+# endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes++;
os_mutex_exit(os_file_count_mutex);
+# ifndef UNIV_HOTBACKUP
/* Protect the seek / write operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]);
+# endif /* UNIV_HOTBACKUP */
ret_offset = lseek(file, offs, SEEK_SET);
@@ -2193,7 +2245,9 @@ os_file_pwrite(
# endif /* UNIV_DO_FLUSH */
func_exit:
+# ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
+# endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes--;
@@ -2227,7 +2281,9 @@ os_file_read(
DWORD low;
DWORD high;
ibool retry;
+#ifndef UNIV_HOTBACKUP
ulint i;
+#endif /* !UNIV_HOTBACKUP */
ut_a((offset & 0xFFFFFFFFUL) == offset);
@@ -2246,16 +2302,20 @@ try_again:
os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex);
+#ifndef UNIV_HOTBACKUP
/* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
ret2 = SetFilePointer(file, low, &high, FILE_BEGIN);
if (ret2 == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
@@ -2266,7 +2326,9 @@ try_again:
ret = ReadFile(file, buf, (DWORD) n, &len, NULL);
+#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
@@ -2275,7 +2337,7 @@ try_again:
if (ret && len == n) {
return(TRUE);
}
-#else
+#else /* __WIN__ */
ibool retry;
ssize_t ret;
@@ -2294,7 +2356,7 @@ try_again:
"InnoDB: Was only able to read %ld.\n",
(ulong)n, (ulong)offset_high,
(ulong)offset, (long)ret);
-#endif
+#endif /* __WIN__ */
#ifdef __WIN__
error_handling:
#endif
@@ -2343,7 +2405,9 @@ os_file_read_no_error_handling(
DWORD low;
DWORD high;
ibool retry;
+#ifndef UNIV_HOTBACKUP
ulint i;
+#endif /* !UNIV_HOTBACKUP */
ut_a((offset & 0xFFFFFFFFUL) == offset);
@@ -2362,16 +2426,20 @@ try_again:
os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex);
+#ifndef UNIV_HOTBACKUP
/* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
ret2 = SetFilePointer(file, low, &high, FILE_BEGIN);
if (ret2 == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
@@ -2382,7 +2450,9 @@ try_again:
ret = ReadFile(file, buf, (DWORD) n, &len, NULL);
+#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
@@ -2391,7 +2461,7 @@ try_again:
if (ret && len == n) {
return(TRUE);
}
-#else
+#else /* __WIN__ */
ibool retry;
ssize_t ret;
@@ -2404,7 +2474,7 @@ try_again:
return(TRUE);
}
-#endif
+#endif /* __WIN__ */
#ifdef __WIN__
error_handling:
#endif
@@ -2463,9 +2533,11 @@ os_file_write(
DWORD ret2;
DWORD low;
DWORD high;
- ulint i;
ulint n_retries = 0;
ulint err;
+#ifndef UNIV_HOTBACKUP
+ ulint i;
+#endif /* !UNIV_HOTBACKUP */
ut_a((offset & 0xFFFFFFFF) == offset);
@@ -2482,16 +2554,20 @@ retry:
os_n_pending_writes++;
os_mutex_exit(os_file_count_mutex);
+#ifndef UNIV_HOTBACKUP
/* Protect the seek / write operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
ret2 = SetFilePointer(file, low, &high, FILE_BEGIN);
if (ret2 == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes--;
@@ -2525,7 +2601,9 @@ retry:
}
# endif /* UNIV_DO_FLUSH */
+#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
+#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes--;
@@ -3371,9 +3449,21 @@ void
os_aio_simulated_put_read_threads_to_sleep(void)
/*============================================*/
{
+
+/* The idea of putting background IO threads to sleep is only for
+Windows when using simulated AIO. Windows XP seems to schedule
+background threads too eagerly to allow for coalescing during
+readahead requests. */
+#ifdef __WIN__
os_aio_array_t* array;
ulint g;
+ if (os_aio_use_native_aio) {
+ /* We do not use simulated aio: do nothing */
+
+ return;
+ }
+
os_aio_recommend_sleep_for_read_threads = TRUE;
for (g = 0; g < os_aio_n_segments; g++) {
@@ -3384,6 +3474,7 @@ os_aio_simulated_put_read_threads_to_sle
os_event_reset(os_aio_segment_wait_events[g]);
}
}
+#endif /* __WIN__ */
}
/*******************************************************************//**
=== modified file 'storage/innodb_plugin/os/os0proc.c'
--- a/storage/innodb_plugin/os/os0proc.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/os/os0proc.c 2009-11-03 10:25:00 +0000
@@ -97,6 +97,7 @@ os_mem_alloc_large(
fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to"
" attach shared memory segment, errno %d\n",
errno);
+ ptr = NULL;
}
/* Remove the shared memory segment so that it will be
=== modified file 'storage/innodb_plugin/page/page0cur.c'
--- a/storage/innodb_plugin/page/page0cur.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/page/page0cur.c 2009-10-09 14:13:15 +0000
@@ -1195,7 +1195,7 @@ page_cur_insert_rec_zip_reorg(
}
/* Out of space: restore the page */
- if (!page_zip_decompress(page_zip, page)) {
+ if (!page_zip_decompress(page_zip, page, FALSE)) {
ut_error; /* Memory corrupted? */
}
ut_ad(page_validate(page, index));
=== modified file 'storage/innodb_plugin/page/page0page.c'
--- a/storage/innodb_plugin/page/page0page.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/page/page0page.c 2009-10-09 14:13:15 +0000
@@ -45,7 +45,7 @@ Created 2/2/1994 Heikki Tuuri
==============
The index page consists of a page header which contains the page's
-id and other information. On top of it are the the index records
+id and other information. On top of it are the index records
in a heap linked into a one way linear list according to alphabetic order.
Just below page end is an array of pointers which we call page directory,
@@ -679,7 +679,7 @@ page_copy_rec_list_end(
if (UNIV_UNLIKELY
(!page_zip_decompress(new_page_zip,
- new_page))) {
+ new_page, FALSE))) {
ut_error;
}
ut_ad(page_validate(new_page, index));
@@ -792,7 +792,7 @@ page_copy_rec_list_start(
if (UNIV_UNLIKELY
(!page_zip_decompress(new_page_zip,
- new_page))) {
+ new_page, FALSE))) {
ut_error;
}
ut_ad(page_validate(new_page, index));
=== modified file 'storage/innodb_plugin/page/page0zip.c'
--- a/storage/innodb_plugin/page/page0zip.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/page/page0zip.c 2009-10-09 14:13:15 +0000
@@ -47,8 +47,10 @@ Created June 2005 by Marko Makela
# define buf_LRU_stat_inc_unzip() ((void) 0)
#endif /* !UNIV_HOTBACKUP */
+#ifndef UNIV_HOTBACKUP
/** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */
UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1];
+#endif /* !UNIV_HOTBACKUP */
/* Please refer to ../include/page0zip.ic for a description of the
compressed page format. */
@@ -1144,7 +1146,9 @@ page_zip_compress(
ulint* offsets = NULL;
ulint n_blobs = 0;
byte* storage;/* storage of uncompressed columns */
+#ifndef UNIV_HOTBACKUP
ullint usec = ut_time_us(NULL);
+#endif /* !UNIV_HOTBACKUP */
#ifdef PAGE_ZIP_COMPRESS_DBG
FILE* logfile = NULL;
#endif
@@ -1208,7 +1212,9 @@ page_zip_compress(
}
}
#endif /* PAGE_ZIP_COMPRESS_DBG */
+#ifndef UNIV_HOTBACKUP
page_zip_stat[page_zip->ssize - 1].compressed++;
+#endif /* !UNIV_HOTBACKUP */
if (UNIV_UNLIKELY(n_dense * PAGE_ZIP_DIR_SLOT_SIZE
>= page_zip_get_size(page_zip))) {
@@ -1345,8 +1351,10 @@ err_exit:
fclose(logfile);
}
#endif /* PAGE_ZIP_COMPRESS_DBG */
+#ifndef UNIV_HOTBACKUP
page_zip_stat[page_zip->ssize - 1].compressed_usec
+= ut_time_us(NULL) - usec;
+#endif /* !UNIV_HOTBACKUP */
return(FALSE);
}
@@ -1404,12 +1412,14 @@ err_exit:
fclose(logfile);
}
#endif /* PAGE_ZIP_COMPRESS_DBG */
+#ifndef UNIV_HOTBACKUP
{
page_zip_stat_t* zip_stat
= &page_zip_stat[page_zip->ssize - 1];
zip_stat->compressed_ok++;
zip_stat->compressed_usec += ut_time_us(NULL) - usec;
}
+#endif /* !UNIV_HOTBACKUP */
return(TRUE);
}
@@ -2811,7 +2821,11 @@ page_zip_decompress(
/*================*/
page_zip_des_t* page_zip,/*!< in: data, ssize;
out: m_start, m_end, m_nonempty, n_blobs */
- page_t* page) /*!< out: uncompressed page, may be trashed */
+ page_t* page, /*!< out: uncompressed page, may be trashed */
+ ibool all) /*!< in: TRUE=decompress the whole page;
+ FALSE=verify but do not copy some
+ page header fields that should not change
+ after page creation */
{
z_stream d_stream;
dict_index_t* index = NULL;
@@ -2820,7 +2834,9 @@ page_zip_decompress(
ulint trx_id_col = ULINT_UNDEFINED;
mem_heap_t* heap;
ulint* offsets;
+#ifndef UNIV_HOTBACKUP
ullint usec = ut_time_us(NULL);
+#endif /* !UNIV_HOTBACKUP */
ut_ad(page_zip_simple_validate(page_zip));
UNIV_MEM_ASSERT_W(page, UNIV_PAGE_SIZE);
@@ -2839,13 +2855,36 @@ page_zip_decompress(
heap = mem_heap_create(n_dense * (3 * sizeof *recs) + UNIV_PAGE_SIZE);
recs = mem_heap_alloc(heap, n_dense * (2 * sizeof *recs));
+ if (all) {
+ /* Copy the page header. */
+ memcpy(page, page_zip->data, PAGE_DATA);
+ } else {
+ /* Check that the bytes that we skip are identical. */
+#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
+ ut_a(!memcmp(FIL_PAGE_TYPE + page,
+ FIL_PAGE_TYPE + page_zip->data,
+ PAGE_HEADER - FIL_PAGE_TYPE));
+ ut_a(!memcmp(PAGE_HEADER + PAGE_LEVEL + page,
+ PAGE_HEADER + PAGE_LEVEL + page_zip->data,
+ PAGE_DATA - (PAGE_HEADER + PAGE_LEVEL)));
+#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
+
+ /* Copy the mutable parts of the page header. */
+ memcpy(page, page_zip->data, FIL_PAGE_TYPE);
+ memcpy(PAGE_HEADER + page, PAGE_HEADER + page_zip->data,
+ PAGE_LEVEL - PAGE_N_DIR_SLOTS);
+
+#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
+ /* Check that the page headers match after copying. */
+ ut_a(!memcmp(page, page_zip->data, PAGE_DATA));
+#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
+ }
+
#ifdef UNIV_ZIP_DEBUG
- /* Clear the page. */
- memset(page, 0x55, UNIV_PAGE_SIZE);
+ /* Clear the uncompressed page, except the header. */
+ memset(PAGE_DATA + page, 0x55, UNIV_PAGE_SIZE - PAGE_DATA);
#endif /* UNIV_ZIP_DEBUG */
- UNIV_MEM_INVALID(page, UNIV_PAGE_SIZE);
- /* Copy the page header. */
- memcpy(page, page_zip->data, PAGE_DATA);
+ UNIV_MEM_INVALID(PAGE_DATA + page, UNIV_PAGE_SIZE - PAGE_DATA);
/* Copy the page directory. */
if (UNIV_UNLIKELY(!page_zip_dir_decode(page_zip, page, recs,
@@ -2976,12 +3015,14 @@ err_exit:
page_zip_fields_free(index);
mem_heap_free(heap);
+#ifndef UNIV_HOTBACKUP
{
page_zip_stat_t* zip_stat
= &page_zip_stat[page_zip->ssize - 1];
zip_stat->decompressed++;
zip_stat->decompressed_usec += ut_time_us(NULL) - usec;
}
+#endif /* !UNIV_HOTBACKUP */
/* Update the stat counter for LRU policy. */
buf_LRU_stat_inc_unzip();
@@ -3084,7 +3125,7 @@ page_zip_validate_low(
#endif /* UNIV_DEBUG_VALGRIND */
temp_page_zip = *page_zip;
- valid = page_zip_decompress(&temp_page_zip, temp_page);
+ valid = page_zip_decompress(&temp_page_zip, temp_page, TRUE);
if (!valid) {
fputs("page_zip_validate(): failed to decompress\n", stderr);
goto func_exit;
@@ -4362,8 +4403,8 @@ IMPORTANT: if page_zip_reorganize() is i
non-clustered index, the caller must update the insert buffer free
bits in the same mini-transaction in such a way that the modification
will be redo-logged.
-@return TRUE on success, FALSE on failure; page and page_zip will be
-left intact on failure. */
+@return TRUE on success, FALSE on failure; page_zip will be left
+intact on failure, but page will be overwritten. */
UNIV_INTERN
ibool
page_zip_reorganize(
@@ -4428,9 +4469,6 @@ page_zip_reorganize(
if (UNIV_UNLIKELY(!page_zip_compress(page_zip, page, index, mtr))) {
- /* Restore the old page and exit. */
- buf_frame_copy(page, temp_page);
-
#ifndef UNIV_HOTBACKUP
buf_block_free(temp_block);
#endif /* !UNIV_HOTBACKUP */
@@ -4591,7 +4629,8 @@ corrupt:
memcpy(page_zip->data + page_zip_get_size(page_zip)
- trailer_size, ptr + 8 + size, trailer_size);
- if (UNIV_UNLIKELY(!page_zip_decompress(page_zip, page))) {
+ if (UNIV_UNLIKELY(!page_zip_decompress(page_zip, page,
+ TRUE))) {
goto corrupt;
}
=== modified file 'storage/innodb_plugin/plug.in.disabled'
--- a/storage/innodb_plugin/plug.in.disabled 2009-09-30 07:25:12 +0000
+++ b/storage/innodb_plugin/plug.in.disabled 2009-11-16 20:49:51 +0000
@@ -37,33 +37,75 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
irix*|osf*|sysv5uw7*|openbsd*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
*solaris*|*SunOS*)
- # Begin Solaris atomic function checks
- AC_CHECK_FUNCS(atomic_cas_ulong atomic_cas_32 \
- atomic_cas_64 atomic_add_long,
- AC_DEFINE(
- [HAVE_SOLARIS_ATOMICS],
- [1],
- [Define to 1 if Solaris supports \
- atomic functions.]))
- ### End Solaris atomic function checks
-
CFLAGS="$CFLAGS -DUNIV_SOLARIS";;
esac
+
INNODB_DYNAMIC_CFLAGS="-DMYSQL_DYNAMIC_PLUGIN"
- case "$target_cpu---$target_os" in
- x86_64---*)
+
+ case "$target_cpu" in
+ x86_64)
# The AMD64 ABI forbids absolute addresses in shared libraries
;;
- *---solaris*|*---SunOS*)
- # Shared objects must be linked from PIC code on Solaris.
- ;;
- *86---)
+ *86)
# Use absolute addresses on IA-32
INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
;;
esac
AC_SUBST(INNODB_DYNAMIC_CFLAGS)
+
+ AC_MSG_CHECKING(whether GCC atomic builtins are available)
+ # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
+ AC_TRY_RUN(
+ [
+ int main()
+ {
+ long x;
+ long y;
+ long res;
+ char c;
+
+ x = 10;
+ y = 123;
+ res = __sync_bool_compare_and_swap(&x, x, y);
+ if (!res || x != y) {
+ return(1);
+ }
+
+ x = 10;
+ y = 123;
+ res = __sync_bool_compare_and_swap(&x, x + 1, y);
+ if (res || x != 10) {
+ return(1);
+ }
+
+ x = 10;
+ y = 123;
+ res = __sync_add_and_fetch(&x, y);
+ if (res != 123 + 10 || x != 123 + 10) {
+ return(1);
+ }
+
+ c = 10;
+ res = __sync_lock_test_and_set(&c, 123);
+ if (res != 10 || c != 123) {
+ return(1);
+ }
+
+ return(0);
+ }
+ ],
+ [
+ AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
+ [GCC atomic builtins are available])
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ ]
+ )
+
AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
+ # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
AC_TRY_RUN(
[
#include <pthread.h>
@@ -84,47 +126,73 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
}
],
[
- AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
+ AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
[pthread_t can be used by GCC atomic builtins])
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
]
- )
+ )
- # Try using solaris atomics on SunOS if GCC atomics are not available
- AC_CHECK_DECLS(
- [HAVE_ATOMIC_PTHREAD_T],
- [
- AC_MSG_NOTICE(no need to check pthread_t size)
- ],
- [
- AC_CHECK_DECLS(
- [HAVE_SOLARIS_ATOMICS],
- [
- AC_MSG_CHECKING(checking if pthread_t size is integral)
- AC_TRY_RUN(
- [
- #include <pthread.h>
- int main()
- {
- pthread_t x = 0;
- return(0);
- }
- ],
- [
- AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
+ AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
+ # either define HAVE_IB_SOLARIS_ATOMICS or not
+ AC_CHECK_FUNCS(atomic_add_long \
+ atomic_cas_32 \
+ atomic_cas_64 \
+ atomic_cas_ulong,
+
+ AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1],
+ [Define to 1 if Solaris libc atomic functions \
+ are available])
+ )
+
+ AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
+ # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not
+ AC_TRY_RUN(
+ [
+ #include <pthread.h>
+ #include <string.h>
+
+ int main(int argc, char** argv) {
+ pthread_t x1;
+ pthread_t x2;
+ pthread_t x3;
+
+ memset(&x1, 0x0, sizeof(x1));
+ memset(&x2, 0x0, sizeof(x2));
+ memset(&x3, 0x0, sizeof(x3));
+
+ if (sizeof(pthread_t) == 4) {
+
+ atomic_cas_32(&x1, x2, x3);
+
+ } else if (sizeof(pthread_t) == 8) {
+
+ atomic_cas_64(&x1, x2, x3);
+
+ } else {
+
+ return(1);
+ }
+
+ return(0);
+ }
+ ],
+ [
+ AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1],
[pthread_t can be used by solaris atomics])
- AC_MSG_RESULT(yes)
- # size of pthread_t is needed for typed solaris atomics
- AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>])
- ],
- [
- AC_MSG_RESULT(no)
- ])
- ])
- ])
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ ]
+ )
+
+ # this is needed to know which one of atomic_cas_32() or atomic_cas_64()
+ # to use in the source
+ AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>])
+
# Check for x86 PAUSE instruction
AC_MSG_CHECKING(for x86 PAUSE instruction)
# We have to actually try running the test program, because of a bug
@@ -141,7 +209,7 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
}
],
[
- AC_DEFINE([IB_HAVE_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist])
+ AC_DEFINE([HAVE_IB_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist])
AC_MSG_RESULT(yes)
],
[
=== modified file 'storage/innodb_plugin/rem/rem0cmp.c'
--- a/storage/innodb_plugin/rem/rem0cmp.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/rem/rem0cmp.c 2009-10-08 10:00:49 +0000
@@ -36,7 +36,7 @@ Created 7/1/1994 Heikki Tuuri
The records are put into alphabetical order in the following
way: let F be the first field where two records disagree.
-If there is a character in some position n where the the
+If there is a character in some position n where the
records disagree, the order is determined by comparison of
the characters at position n, possibly after
collating transformation. If there is no such character,
@@ -76,7 +76,7 @@ cmp_debug_dtuple_rec_with_match(
/*************************************************************//**
This function is used to compare two data fields for which the data type
is such that we must use MySQL code to compare them. The prototype here
-must be a copy of the the one in ha_innobase.cc!
+must be a copy of the one in ha_innobase.cc!
@return 1, 0, -1, if a is greater, equal, less than b, respectively */
extern
int
@@ -399,7 +399,7 @@ next_byte:
/*************************************************************//**
This function is used to compare a data tuple to a physical record.
Only dtuple->n_fields_cmp first fields are taken into account for
-the the data tuple! If we denote by n = n_fields_cmp, then rec must
+the data tuple! If we denote by n = n_fields_cmp, then rec must
have either m >= n fields, or it must differ from dtuple in some of
the m fields rec has. If rec has an externally stored field we do not
compare it but return with value 0 if such a comparison should be
=== added file 'storage/innodb_plugin/revert_gen.sh'
--- a/storage/innodb_plugin/revert_gen.sh 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/revert_gen.sh 2009-10-12 12:56:02 +0000
@@ -0,0 +1,8 @@
+#!/bin/bash
+#
+# revert changes to all generated files. this is useful in some situations
+# when merging changes between branches.
+
+set -eu
+
+svn revert include/pars0grm.h pars/pars0grm.h pars/lexyy.c pars/pars0grm.c
=== modified file 'storage/innodb_plugin/row/row0ins.c'
--- a/storage/innodb_plugin/row/row0ins.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/row/row0ins.c 2009-11-03 10:23:02 +0000
@@ -141,7 +141,7 @@ row_ins_alloc_sys_fields(
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
- ptr = mem_heap_alloc(heap, DATA_ROW_ID_LEN);
+ ptr = mem_heap_zalloc(heap, DATA_ROW_ID_LEN);
dfield_set_data(dfield, ptr, DATA_ROW_ID_LEN);
@@ -152,7 +152,7 @@ row_ins_alloc_sys_fields(
col = dict_table_get_sys_col(table, DATA_TRX_ID);
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
- ptr = mem_heap_alloc(heap, DATA_TRX_ID_LEN);
+ ptr = mem_heap_zalloc(heap, DATA_TRX_ID_LEN);
dfield_set_data(dfield, ptr, DATA_TRX_ID_LEN);
@@ -163,7 +163,7 @@ row_ins_alloc_sys_fields(
col = dict_table_get_sys_col(table, DATA_ROLL_PTR);
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
- ptr = mem_heap_alloc(heap, DATA_ROLL_PTR_LEN);
+ ptr = mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN);
dfield_set_data(dfield, ptr, DATA_ROLL_PTR_LEN);
}
@@ -1191,7 +1191,7 @@ row_ins_check_foreign_constraint(
/*=============================*/
ibool check_ref,/*!< in: TRUE if we want to check that
the referenced table is ok, FALSE if we
- want to to check the foreign key table */
+ want to check the foreign key table */
dict_foreign_t* foreign,/*!< in: foreign constraint; NOTE that the
tables mentioned in it must be in the
dictionary cache if they exist at all */
=== modified file 'storage/innodb_plugin/row/row0merge.c'
--- a/storage/innodb_plugin/row/row0merge.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/row/row0merge.c 2009-10-09 14:13:15 +0000
@@ -60,9 +60,19 @@ Completed by Sunny Bains and Marko Makel
#ifdef UNIV_DEBUG
/** Set these in order ot enable debug printout. */
/* @{ */
+/** Log the outcome of each row_merge_cmp() call, comparing records. */
static ibool row_merge_print_cmp;
+/** Log each record read from temporary file. */
static ibool row_merge_print_read;
+/** Log each record write to temporary file. */
static ibool row_merge_print_write;
+/** Log each row_merge_blocks() call, merging two blocks of records to
+a bigger one. */
+static ibool row_merge_print_block;
+/** Log each block read from temporary file. */
+static ibool row_merge_print_block_read;
+/** Log each block read from temporary file. */
+static ibool row_merge_print_block_write;
/* @} */
#endif /* UNIV_DEBUG */
@@ -109,8 +119,9 @@ typedef struct row_merge_buf_struct row_
/** Information about temporary files used in merge sort */
struct merge_file_struct {
- int fd; /*!< file descriptor */
- ulint offset; /*!< file offset */
+ int fd; /*!< file descriptor */
+ ulint offset; /*!< file offset (end of file) */
+ ib_uint64_t n_rec; /*!< number of records in the file */
};
/** Information about temporary files used in merge sort */
@@ -682,6 +693,13 @@ row_merge_read(
ib_uint64_t ofs = ((ib_uint64_t) offset) * sizeof *buf;
ibool success;
+#ifdef UNIV_DEBUG
+ if (row_merge_print_block_read) {
+ fprintf(stderr, "row_merge_read fd=%d ofs=%lu\n",
+ fd, (ulong) offset);
+ }
+#endif /* UNIV_DEBUG */
+
success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
(ulint) (ofs & 0xFFFFFFFF),
(ulint) (ofs >> 32),
@@ -709,6 +727,13 @@ row_merge_write(
ib_uint64_t ofs = ((ib_uint64_t) offset)
* sizeof(row_merge_block_t);
+#ifdef UNIV_DEBUG
+ if (row_merge_print_block_write) {
+ fprintf(stderr, "row_merge_write fd=%d ofs=%lu\n",
+ fd, (ulong) offset);
+ }
+#endif /* UNIV_DEBUG */
+
return(UNIV_LIKELY(os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf,
(ulint) (ofs & 0xFFFFFFFF),
(ulint) (ofs >> 32),
@@ -718,7 +743,7 @@ row_merge_write(
/********************************************************************//**
Read a merge record.
@return pointer to next record, or NULL on I/O error or end of list */
-static
+static __attribute__((nonnull))
const byte*
row_merge_read_rec(
/*===============*/
@@ -1070,7 +1095,7 @@ row_merge_cmp(
Reads clustered index of the table and create temporary files
containing the index entries for the indexes to be built.
@return DB_SUCCESS or error */
-static
+static __attribute__((nonnull))
ulint
row_merge_read_clustered_index(
/*===========================*/
@@ -1233,6 +1258,7 @@ row_merge_read_clustered_index(
if (UNIV_LIKELY
(row && row_merge_buf_add(buf, row, ext))) {
+ file->n_rec++;
continue;
}
@@ -1274,14 +1300,19 @@ err_exit:
UNIV_MEM_INVALID(block[0], sizeof block[0]);
merge_buf[i] = row_merge_buf_empty(buf);
- /* Try writing the record again, now that
- the buffer has been written out and emptied. */
+ if (UNIV_LIKELY(row != NULL)) {
+ /* Try writing the record again, now
+ that the buffer has been written out
+ and emptied. */
+
+ if (UNIV_UNLIKELY
+ (!row_merge_buf_add(buf, row, ext))) {
+ /* An empty buffer should have enough
+ room for at least one record. */
+ ut_error;
+ }
- if (UNIV_UNLIKELY
- (row && !row_merge_buf_add(buf, row, ext))) {
- /* An empty buffer should have enough
- room for at least one record. */
- ut_error;
+ file->n_rec++;
}
}
@@ -1320,7 +1351,7 @@ func_exit:
b2 = row_merge_write_rec(&block[2], &buf[2], b2, \
of->fd, &of->offset, \
mrec##N, offsets##N); \
- if (UNIV_UNLIKELY(!b2)) { \
+ if (UNIV_UNLIKELY(!b2 || ++of->n_rec > file->n_rec)) { \
goto corrupt; \
} \
b##N = row_merge_read_rec(&block[N], &buf[N], \
@@ -1336,14 +1367,14 @@ func_exit:
} while (0)
/*************************************************************//**
-Merge two blocks of linked lists on disk and write a bigger block.
+Merge two blocks of records on disk and write a bigger block.
@return DB_SUCCESS or error code */
static
ulint
row_merge_blocks(
/*=============*/
const dict_index_t* index, /*!< in: index being created */
- merge_file_t* file, /*!< in/out: file containing
+ const merge_file_t* file, /*!< in: file containing
index entries */
row_merge_block_t* block, /*!< in/out: 3 buffers */
ulint* foffs0, /*!< in/out: offset of first
@@ -1366,6 +1397,17 @@ row_merge_blocks(
ulint* offsets0;/* offsets of mrec0 */
ulint* offsets1;/* offsets of mrec1 */
+#ifdef UNIV_DEBUG
+ if (row_merge_print_block) {
+ fprintf(stderr,
+ "row_merge_blocks fd=%d ofs=%lu + fd=%d ofs=%lu"
+ " = fd=%d ofs=%lu\n",
+ file->fd, (ulong) *foffs0,
+ file->fd, (ulong) *foffs1,
+ of->fd, (ulong) of->offset);
+ }
+#endif /* UNIV_DEBUG */
+
heap = row_merge_heap_create(index, &offsets0, &offsets1);
/* Write a record and read the next record. Split the output
@@ -1438,16 +1480,87 @@ done1:
}
/*************************************************************//**
+Copy a block of index entries.
+@return TRUE on success, FALSE on failure */
+static __attribute__((nonnull))
+ibool
+row_merge_blocks_copy(
+/*==================*/
+ const dict_index_t* index, /*!< in: index being created */
+ const merge_file_t* file, /*!< in: input file */
+ row_merge_block_t* block, /*!< in/out: 3 buffers */
+ ulint* foffs0, /*!< in/out: input file offset */
+ merge_file_t* of) /*!< in/out: output file */
+{
+ mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
+
+ mrec_buf_t buf[3]; /*!< buffer for handling
+ split mrec in block[] */
+ const byte* b0; /*!< pointer to block[0] */
+ byte* b2; /*!< pointer to block[2] */
+ const mrec_t* mrec0; /*!< merge rec, points to block[0] */
+ ulint* offsets0;/* offsets of mrec0 */
+ ulint* offsets1;/* dummy offsets */
+
+#ifdef UNIV_DEBUG
+ if (row_merge_print_block) {
+ fprintf(stderr,
+ "row_merge_blocks_copy fd=%d ofs=%lu"
+ " = fd=%d ofs=%lu\n",
+ file->fd, (ulong) foffs0,
+ of->fd, (ulong) of->offset);
+ }
+#endif /* UNIV_DEBUG */
+
+ heap = row_merge_heap_create(index, &offsets0, &offsets1);
+
+ /* Write a record and read the next record. Split the output
+ file in two halves, which can be merged on the following pass. */
+
+ if (!row_merge_read(file->fd, *foffs0, &block[0])) {
+corrupt:
+ mem_heap_free(heap);
+ return(FALSE);
+ }
+
+ b0 = block[0];
+ b2 = block[2];
+
+ b0 = row_merge_read_rec(&block[0], &buf[0], b0, index, file->fd,
+ foffs0, &mrec0, offsets0);
+ if (UNIV_UNLIKELY(!b0 && mrec0)) {
+
+ goto corrupt;
+ }
+
+ if (mrec0) {
+ /* append all mrec0 to output */
+ for (;;) {
+ ROW_MERGE_WRITE_GET_NEXT(0, goto done0);
+ }
+ }
+done0:
+
+ /* The file offset points to the beginning of the last page
+ that has been read. Update it to point to the next block. */
+ (*foffs0)++;
+
+ mem_heap_free(heap);
+ return(row_merge_write_eof(&block[2], b2, of->fd, &of->offset)
+ != NULL);
+}
+
+/*************************************************************//**
Merge disk files.
@return DB_SUCCESS or error code */
-static
+static __attribute__((nonnull))
ulint
row_merge(
/*======*/
const dict_index_t* index, /*!< in: index being created */
merge_file_t* file, /*!< in/out: file containing
index entries */
- ulint half, /*!< in: half the file */
+ ulint* half, /*!< in/out: half the file */
row_merge_block_t* block, /*!< in/out: 3 buffers */
int* tmpfd, /*!< in/out: temporary file handle */
TABLE* table) /*!< in/out: MySQL table, for
@@ -1458,43 +1571,75 @@ row_merge(
ulint foffs1; /*!< second input offset */
ulint error; /*!< error code */
merge_file_t of; /*!< output file */
+ const ulint ihalf = *half;
+ /*!< half the input file */
+ ulint ohalf; /*!< half the output file */
UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]);
- ut_ad(half > 0);
+ ut_ad(ihalf < file->offset);
of.fd = *tmpfd;
of.offset = 0;
+ of.n_rec = 0;
/* Merge blocks to the output file. */
+ ohalf = 0;
foffs0 = 0;
- foffs1 = half;
+ foffs1 = ihalf;
+
+ for (; foffs0 < ihalf && foffs1 < file->offset; foffs0++, foffs1++) {
+ ulint ahalf; /*!< arithmetic half the input file */
- for (; foffs0 < half && foffs1 < file->offset; foffs0++, foffs1++) {
error = row_merge_blocks(index, file, block,
&foffs0, &foffs1, &of, table);
if (error != DB_SUCCESS) {
return(error);
}
+
+ /* Record the offset of the output file when
+ approximately half the output has been generated. In
+ this way, the next invocation of row_merge() will
+ spend most of the time in this loop. The initial
+ estimate is ohalf==0. */
+ ahalf = file->offset / 2;
+ ut_ad(ohalf <= of.offset);
+
+ /* Improve the estimate until reaching half the input
+ file size, or we can not get any closer to it. All
+ comparands should be non-negative when !(ohalf < ahalf)
+ because ohalf <= of.offset. */
+ if (ohalf < ahalf || of.offset - ahalf < ohalf - ahalf) {
+ ohalf = of.offset;
+ }
}
- /* Copy the last block, if there is one. */
- while (foffs0 < half) {
- if (!row_merge_read(file->fd, foffs0++, block)
- || !row_merge_write(of.fd, of.offset++, block)) {
+ /* Copy the last blocks, if there are any. */
+
+ while (foffs0 < ihalf) {
+ if (!row_merge_blocks_copy(index, file, block, &foffs0, &of)) {
return(DB_CORRUPTION);
}
}
+
+ ut_ad(foffs0 == ihalf);
+
while (foffs1 < file->offset) {
- if (!row_merge_read(file->fd, foffs1++, block)
- || !row_merge_write(of.fd, of.offset++, block)) {
+ if (!row_merge_blocks_copy(index, file, block, &foffs1, &of)) {
return(DB_CORRUPTION);
}
}
+ ut_ad(foffs1 == file->offset);
+
+ if (UNIV_UNLIKELY(of.n_rec != file->n_rec)) {
+ return(DB_CORRUPTION);
+ }
+
/* Swap file descriptors for the next pass. */
*tmpfd = file->fd;
*file = of;
+ *half = ohalf;
UNIV_MEM_INVALID(block[0], 3 * sizeof block[0]);
@@ -1517,20 +1662,25 @@ row_merge_sort(
reporting erroneous key value
if applicable */
{
- ulint blksz; /*!< block size */
+ ulint half = file->offset / 2;
+
+ /* The file should always contain at least one byte (the end
+ of file marker). Thus, it must be at least one block. */
+ ut_ad(file->offset > 0);
- for (blksz = 1; blksz < file->offset; blksz *= 2) {
- ulint half;
+ do {
ulint error;
- ut_ad(ut_is_2pow(blksz));
- half = ut_2pow_round((file->offset + (blksz - 1)) / 2, blksz);
- error = row_merge(index, file, half, block, tmpfd, table);
+ error = row_merge(index, file, &half, block, tmpfd, table);
if (error != DB_SUCCESS) {
return(error);
}
- }
+
+ /* half > 0 should hold except when the file consists
+ of one block. No need to merge further then. */
+ ut_ad(half > 0 || file->offset == 1);
+ } while (half < file->offset && half > 0);
return(DB_SUCCESS);
}
@@ -1797,7 +1947,15 @@ row_merge_drop_index(
static const char str1[] =
"PROCEDURE DROP_INDEX_PROC () IS\n"
"BEGIN\n"
+ /* Rename the index, so that it will be dropped by
+ row_merge_drop_temp_indexes() at crash recovery
+ if the server crashes before this trx is committed. */
+ "UPDATE SYS_INDEXES SET NAME=CONCAT('"
+ TEMP_INDEX_PREFIX_STR "', NAME) WHERE ID = :indexid;\n"
+ "COMMIT WORK;\n"
+ /* Drop the field definitions of the index. */
"DELETE FROM SYS_FIELDS WHERE INDEX_ID = :indexid;\n"
+ /* Drop the index definition and the B-tree. */
"DELETE FROM SYS_INDEXES WHERE ID = :indexid\n"
" AND TABLE_ID = :tableid;\n"
"END;\n";
@@ -1909,6 +2067,7 @@ row_merge_file_create(
{
merge_file->fd = innobase_mysql_tmpfile();
merge_file->offset = 0;
+ merge_file->n_rec = 0;
}
/*********************************************************************//**
@@ -2129,7 +2288,7 @@ row_merge_rename_tables(
if (err != DB_SUCCESS) {
err_exit:
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
trx->error_state = DB_SUCCESS;
}
=== modified file 'storage/innodb_plugin/row/row0mysql.c'
--- a/storage/innodb_plugin/row/row0mysql.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/row/row0mysql.c 2009-11-03 10:32:33 +0000
@@ -510,7 +510,7 @@ handle_new_error:
switch (err) {
case DB_LOCK_WAIT_TIMEOUT:
if (row_rollback_on_timeout) {
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
break;
}
/* fall through */
@@ -526,7 +526,7 @@ handle_new_error:
/* Roll back the latest, possibly incomplete
insertion or update */
- trx_general_rollback_for_mysql(trx, TRUE, savept);
+ trx_general_rollback_for_mysql(trx, savept);
}
/* MySQL will roll back the latest SQL statement */
break;
@@ -548,7 +548,7 @@ handle_new_error:
/* Roll back the whole transaction; this resolution was added
to version 3.23.43 */
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
break;
case DB_MUST_GET_MORE_FILE_SPACE:
@@ -866,18 +866,22 @@ row_update_statistics_if_needed(
}
/*********************************************************************//**
-Unlocks AUTO_INC type locks that were possibly reserved by a trx. */
+Unlocks AUTO_INC type locks that were possibly reserved by a trx. This
+function should be called at the the end of an SQL statement, by the
+connection thread that owns the transaction (trx->mysql_thd). */
UNIV_INTERN
void
row_unlock_table_autoinc_for_mysql(
/*===============================*/
trx_t* trx) /*!< in/out: transaction */
{
- mutex_enter(&kernel_mutex);
+ if (lock_trx_holds_autoinc_locks(trx)) {
+ mutex_enter(&kernel_mutex);
- lock_release_autoinc_locks(trx);
+ lock_release_autoinc_locks(trx);
- mutex_exit(&kernel_mutex);
+ mutex_exit(&kernel_mutex);
+ }
}
/*********************************************************************//**
@@ -1767,7 +1771,6 @@ row_create_table_for_mysql(
const char* table_name;
ulint table_name_len;
ulint err;
- ulint i;
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
@@ -1802,15 +1805,6 @@ err_exit:
goto err_exit;
}
- /* Check that no reserved column names are used. */
- for (i = 0; i < dict_table_get_n_user_cols(table); i++) {
- if (dict_col_name_is_reserved(
- dict_table_get_col_name(table, i))) {
-
- goto err_exit;
- }
- }
-
trx_start_if_not_started(trx);
/* The table name is prefixed with the database name and a '/'.
@@ -1885,7 +1879,7 @@ err_exit:
if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
}
switch (err) {
@@ -2053,7 +2047,7 @@ error_handling:
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
row_drop_table_for_mysql(table_name, trx, FALSE);
@@ -2074,7 +2068,7 @@ Scans a table create SQL string and adds
the foreign key constraints declared in the string. This function
should be called after the indexes for a table have been created.
Each foreign key constraint must be accompanied with indexes in
-bot participating tables. The indexes are allowed to contain more
+both participating tables. The indexes are allowed to contain more
fields than mentioned in the constraint. Check also that foreign key
constraints which reference this table are ok.
@return error code or DB_SUCCESS */
@@ -2121,7 +2115,7 @@ row_table_add_foreign_constraints(
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
row_drop_table_for_mysql(name, trx, FALSE);
@@ -2488,7 +2482,7 @@ row_discard_tablespace_for_mysql(
if (err != DB_SUCCESS) {
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
trx->error_state = DB_SUCCESS;
} else {
dict_table_change_id_in_cache(table, new_id);
@@ -2497,7 +2491,7 @@ row_discard_tablespace_for_mysql(
if (!success) {
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
trx->error_state = DB_SUCCESS;
err = DB_ERROR;
@@ -2949,7 +2943,7 @@ next_rec:
if (err != DB_SUCCESS) {
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
trx->error_state = DB_SUCCESS;
ut_print_timestamp(stderr);
fputs(" InnoDB: Unable to assign a new identifier to table ",
@@ -3590,7 +3584,7 @@ row_delete_constraint(
if ((err == DB_SUCCESS) && !strchr(id, '/')) {
/* Old format < 4.0.18 constraints have constraint ids
- <number>_<number>. We only try deleting them if the
+ NUMBER_NUMBER. We only try deleting them if the
constraint name does not contain a '/' character, otherwise
deleting a new format constraint named 'foo/bar' from
database 'baz' would remove constraint 'bar' from database
@@ -3854,7 +3848,7 @@ end:
"InnoDB: succeed.\n", stderr);
}
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
trx->error_state = DB_SUCCESS;
} else {
/* The following call will also rename the .ibd data file if
@@ -3863,7 +3857,7 @@ end:
if (!dict_table_rename_in_cache(table, new_name,
!new_is_tmp)) {
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
trx->error_state = DB_SUCCESS;
goto funct_exit;
}
@@ -3903,7 +3897,7 @@ end:
ut_a(dict_table_rename_in_cache(table,
old_name, FALSE));
trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ trx_general_rollback_for_mysql(trx, NULL);
trx->error_state = DB_SUCCESS;
}
}
=== added file 'storage/innodb_plugin/scripts/export.sh'
--- a/storage/innodb_plugin/scripts/export.sh 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/scripts/export.sh 2009-10-12 12:56:02 +0000
@@ -0,0 +1,74 @@
+#!/bin/bash
+#
+# export current working directory in a format suitable for sending to MySQL
+# as a snapshot. also generates the actual snapshot and sends it to MySQL.
+
+set -eu
+
+die () {
+ echo $*
+ exit 1
+}
+
+if [ $# -ne 2 ] ; then
+ die "Usage: export.sh revision-number-of-last-snapshot current-revision-number"
+fi
+
+# If we are run from within the scripts/ directory then change directory to
+# one level up so that the relative paths work.
+DIR=`basename $PWD`
+
+if [ "${DIR}" = "scripts" ]; then
+ cd ..
+fi
+
+START_REV=$(($1 + 1))
+END_REV=$2
+
+set +u
+if test -z $EDITOR; then
+ die "\$EDITOR is not set"
+fi
+set -u
+
+rm -rf to-mysql
+mkdir to-mysql{,/storage,/patches,/mysql-test{,/t,/r,/include}}
+svn log -v -r "$START_REV:BASE" > to-mysql/log
+svn export -q . to-mysql/storage/innobase
+
+REV=$START_REV
+while [ $REV -le $END_REV ]
+do
+ PATCH=to-mysql/patches/r$REV.patch
+ svn log -v -r$REV > $PATCH
+ if [ $(wc -c < $PATCH) -gt 73 ]
+ then
+ svn diff -r$(($REV-1)):$REV >> $PATCH
+ else
+ rm $PATCH
+ fi
+ REV=$(($REV + 1))
+done
+
+cd to-mysql/storage/innobase
+
+mv mysql-test/*.test mysql-test/*.opt ../../mysql-test/t
+mv mysql-test/*.result ../../mysql-test/r
+mv mysql-test/*.inc ../../mysql-test/include
+rmdir mysql-test
+
+rm setup.sh export.sh revert_gen.sh compile-innodb-debug compile-innodb
+
+cd ../..
+$EDITOR log
+cd ..
+
+fname="innodb-5.1-ss$2.tar.gz"
+
+rm -f $fname
+tar czf $fname to-mysql
+scp $fname mysql:snapshots
+rm $fname
+rm -rf to-mysql
+
+echo "Sent $fname to MySQL"
=== modified file 'storage/innodb_plugin/srv/srv0srv.c'
--- a/storage/innodb_plugin/srv/srv0srv.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/srv/srv0srv.c 2009-10-09 12:19:13 +0000
@@ -102,6 +102,7 @@ Created 10/8/1995 Heikki Tuuri
#include "row0mysql.h"
#include "ha_prototypes.h"
#include "trx0i_s.h"
+#include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
/* This is set to TRUE if the MySQL user has set it in MySQL; currently
affects only FOREIGN KEY definition parsing */
@@ -292,12 +293,6 @@ UNIV_INTERN ulint srv_buf_pool_flushed =
reading of a disk page */
UNIV_INTERN ulint srv_buf_pool_reads = 0;
-/** Number of sequential read-aheads */
-UNIV_INTERN ulint srv_read_ahead_seq = 0;
-
-/** Number of random read-aheads */
-UNIV_INTERN ulint srv_read_ahead_rnd = 0;
-
/* structure to pass status variables to MySQL */
UNIV_INTERN export_struc export_vars;
@@ -464,8 +459,6 @@ static ulint srv_main_background_loops
static ulint srv_main_flush_loops = 0;
/* Log writes involving flush. */
static ulint srv_log_writes_and_flush = 0;
-/* Log writes not including flush. */
-static ulint srv_log_buffer_writes = 0;
/* This is only ever touched by the master thread. It records the
time when the last flush of log file has happened. The master
@@ -614,7 +607,7 @@ future, but at the moment we plan to imp
which could be called a global priority inheritance. If a thread
has to wait for a long time, say 300 milliseconds, for a resource,
we just guess that it may be waiting for a resource owned by a background
-thread, and boost the the priority of all runnable background threads
+thread, and boost the priority of all runnable background threads
to the normal level. The background threads then themselves adjust
their fixed priority back to background after releasing all resources
they had (or, at some fixed points in their program code).
@@ -714,9 +707,8 @@ srv_print_master_thread_info(
srv_main_1_second_loops, srv_main_sleeps,
srv_main_10_second_loops, srv_main_background_loops,
srv_main_flush_loops);
- fprintf(file, "srv_master_thread log flush and writes: %lu "
- " log writes only: %lu\n",
- srv_log_writes_and_flush, srv_log_buffer_writes);
+ fprintf(file, "srv_master_thread log flush and writes: %lu\n",
+ srv_log_writes_and_flush);
}
/*********************************************************************//**
@@ -1877,14 +1869,16 @@ srv_export_innodb_status(void)
export_vars.innodb_data_reads = os_n_file_reads;
export_vars.innodb_data_writes = os_n_file_writes;
export_vars.innodb_data_written = srv_data_written;
- export_vars.innodb_buffer_pool_read_requests = buf_pool->n_page_gets;
+ export_vars.innodb_buffer_pool_read_requests = buf_pool->stat.n_page_gets;
export_vars.innodb_buffer_pool_write_requests
= srv_buf_pool_write_requests;
export_vars.innodb_buffer_pool_wait_free = srv_buf_pool_wait_free;
export_vars.innodb_buffer_pool_pages_flushed = srv_buf_pool_flushed;
export_vars.innodb_buffer_pool_reads = srv_buf_pool_reads;
- export_vars.innodb_buffer_pool_read_ahead_rnd = srv_read_ahead_rnd;
- export_vars.innodb_buffer_pool_read_ahead_seq = srv_read_ahead_seq;
+ export_vars.innodb_buffer_pool_read_ahead
+ = buf_pool->stat.n_ra_pages_read;
+ export_vars.innodb_buffer_pool_read_ahead_evicted
+ = buf_pool->stat.n_ra_pages_evicted;
export_vars.innodb_buffer_pool_pages_data
= UT_LIST_GET_LEN(buf_pool->LRU);
export_vars.innodb_buffer_pool_pages_dirty
@@ -1915,9 +1909,9 @@ srv_export_innodb_status(void)
export_vars.innodb_log_writes = srv_log_writes;
export_vars.innodb_dblwr_pages_written = srv_dblwr_pages_written;
export_vars.innodb_dblwr_writes = srv_dblwr_writes;
- export_vars.innodb_pages_created = buf_pool->n_pages_created;
- export_vars.innodb_pages_read = buf_pool->n_pages_read;
- export_vars.innodb_pages_written = buf_pool->n_pages_written;
+ export_vars.innodb_pages_created = buf_pool->stat.n_pages_created;
+ export_vars.innodb_pages_read = buf_pool->stat.n_pages_read;
+ export_vars.innodb_pages_written = buf_pool->stat.n_pages_written;
export_vars.innodb_row_lock_waits = srv_n_lock_wait_count;
export_vars.innodb_row_lock_current_waits
= srv_n_lock_wait_current_count;
@@ -2284,12 +2278,6 @@ srv_sync_log_buffer_in_background(void)
log_buffer_sync_in_background(TRUE);
srv_last_log_flush_time = current_time;
srv_log_writes_and_flush++;
- } else {
- /* Actually we don't need to write logs here.
- We are just being extra safe here by forcing
- the log buffer to log file. */
- log_buffer_sync_in_background(FALSE);
- srv_log_buffer_writes++;
}
}
@@ -2340,8 +2328,8 @@ loop:
srv_main_thread_op_info = "reserving kernel mutex";
- n_ios_very_old = log_sys->n_log_ios + buf_pool->n_pages_read
- + buf_pool->n_pages_written;
+ n_ios_very_old = log_sys->n_log_ios + buf_pool->stat.n_pages_read
+ + buf_pool->stat.n_pages_written;
mutex_enter(&kernel_mutex);
/* Store the user activity counter at the start of this loop */
@@ -2361,8 +2349,8 @@ loop:
skip_sleep = FALSE;
for (i = 0; i < 10; i++) {
- n_ios_old = log_sys->n_log_ios + buf_pool->n_pages_read
- + buf_pool->n_pages_written;
+ n_ios_old = log_sys->n_log_ios + buf_pool->stat.n_pages_read
+ + buf_pool->stat.n_pages_written;
srv_main_thread_op_info = "sleeping";
srv_main_1_second_loops++;
@@ -2401,8 +2389,8 @@ loop:
n_pend_ios = buf_get_n_pending_ios()
+ log_sys->n_pending_writes;
- n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
- + buf_pool->n_pages_written;
+ n_ios = log_sys->n_log_ios + buf_pool->stat.n_pages_read
+ + buf_pool->stat.n_pages_written;
if (n_pend_ios < SRV_PEND_IO_THRESHOLD
&& (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) {
srv_main_thread_op_info = "doing insert buffer merge";
@@ -2418,6 +2406,8 @@ loop:
/* Try to keep the number of modified pages in the
buffer pool under the limit wished by the user */
+ srv_main_thread_op_info =
+ "flushing buffer pool pages";
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST,
PCT_IO(100),
IB_ULONGLONG_MAX);
@@ -2436,6 +2426,8 @@ loop:
ulint n_flush = buf_flush_get_desired_flush_rate();
if (n_flush) {
+ srv_main_thread_op_info =
+ "flushing buffer pool pages";
n_flush = ut_min(PCT_IO(100), n_flush);
n_pages_flushed =
buf_flush_batch(
@@ -2473,8 +2465,8 @@ loop:
are not required, and may be disabled. */
n_pend_ios = buf_get_n_pending_ios() + log_sys->n_pending_writes;
- n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
- + buf_pool->n_pages_written;
+ n_ios = log_sys->n_log_ios + buf_pool->stat.n_pages_read
+ + buf_pool->stat.n_pages_written;
srv_main_10_second_loops++;
if (n_pend_ios < SRV_PEND_IO_THRESHOLD
=== modified file 'storage/innodb_plugin/srv/srv0start.c'
--- a/storage/innodb_plugin/srv/srv0start.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/srv/srv0start.c 2009-11-03 10:23:22 +0000
@@ -103,6 +103,7 @@ Created 2/16/1996 Heikki Tuuri
# include "row0row.h"
# include "row0mysql.h"
# include "btr0pcur.h"
+# include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
/** Log sequence number immediately after startup */
UNIV_INTERN ib_uint64_t srv_start_lsn;
@@ -1096,6 +1097,10 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
#endif
+#ifdef UNIV_LOG_LSN_DEBUG
+ fprintf(stderr,
+ "InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n");
+#endif /* UNIV_LOG_LSN_DEBUG */
#ifdef UNIV_MEM_DEBUG
fprintf(stderr,
"InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
@@ -1106,34 +1111,7 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: The InnoDB memory heap is disabled\n");
}
-#ifdef HAVE_GCC_ATOMIC_BUILTINS
-# ifdef INNODB_RW_LOCKS_USE_ATOMICS
- fprintf(stderr,
- "InnoDB: Mutexes and rw_locks use GCC atomic builtins.\n");
-# else /* INNODB_RW_LOCKS_USE_ATOMICS */
- fprintf(stderr,
- "InnoDB: Mutexes use GCC atomic builtins, rw_locks do not.\n");
-# endif /* INNODB_RW_LOCKS_USE_ATOMICS */
-#elif defined(HAVE_SOLARIS_ATOMICS)
-# ifdef INNODB_RW_LOCKS_USE_ATOMICS
- fprintf(stderr,
- "InnoDB: Mutexes and rw_locks use Solaris atomic functions.\n");
-# else
- fprintf(stderr,
- "InnoDB: Mutexes use Solaris atomic functions.\n");
-# endif /* INNODB_RW_LOCKS_USE_ATOMICS */
-#elif HAVE_WINDOWS_ATOMICS
-# ifdef INNODB_RW_LOCKS_USE_ATOMICS
- fprintf(stderr,
- "InnoDB: Mutexes and rw_locks use Windows interlocked functions.\n");
-# else
- fprintf(stderr,
- "InnoDB: Mutexes use Windows interlocked functions.\n");
-# endif /* INNODB_RW_LOCKS_USE_ATOMICS */
-#else /* HAVE_GCC_ATOMIC_BUILTINS */
- fprintf(stderr,
- "InnoDB: Neither mutexes nor rw_locks use GCC atomic builtins.\n");
-#endif /* HAVE_GCC_ATOMIC_BUILTINS */
+ fprintf(stderr, "InnoDB: %s\n", IB_ATOMICS_STARTUP_MSG);
/* Since InnoDB does not currently clean up all its internal data
structures in MySQL Embedded Server Library server_end(), we
@@ -1398,7 +1376,7 @@ innobase_start_or_create_for_mysql(void)
sum_of_new_sizes += srv_data_file_sizes[i];
}
- if (sum_of_new_sizes < 640) {
+ if (sum_of_new_sizes < 10485760 / UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Error: tablespace size must be"
" at least 10 MB\n");
@@ -1829,7 +1807,7 @@ innobase_start_or_create_for_mysql(void)
/* Actually, we did not change the undo log format between
4.0 and 4.1.1, and we would not need to run purge to
completion. Note also that the purge algorithm in 4.1.1
- can process the the history list again even after a full
+ can process the history list again even after a full
purge, because our algorithm does not cut the end of the
history list in all cases so that it would become empty
after a full purge. That mean that we may purge 4.0 type
=== modified file 'storage/innodb_plugin/sync/sync0rw.c'
--- a/storage/innodb_plugin/sync/sync0rw.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/sync/sync0rw.c 2009-10-09 12:19:13 +0000
@@ -38,6 +38,7 @@ Created 9/11/1995 Heikki Tuuri
#include "os0thread.h"
#include "mem0mem.h"
#include "srv0srv.h"
+#include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
/*
IMPLEMENTATION OF THE RW_LOCK
=== modified file 'storage/innodb_plugin/sync/sync0sync.c'
--- a/storage/innodb_plugin/sync/sync0sync.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/sync/sync0sync.c 2009-10-12 12:00:56 +0000
@@ -39,6 +39,7 @@ Created 9/5/1995 Heikki Tuuri
#include "buf0buf.h"
#include "srv0srv.h"
#include "buf0types.h"
+#include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
/*
REASONS FOR IMPLEMENTING THE SPIN LOCK MUTEX
@@ -849,7 +850,8 @@ sync_thread_levels_g(
/*=================*/
sync_level_t* arr, /*!< in: pointer to level array for an OS
thread */
- ulint limit) /*!< in: level limit */
+ ulint limit, /*!< in: level limit */
+ ulint warn) /*!< in: TRUE=display a diagnostic message */
{
sync_level_t* slot;
rw_lock_t* lock;
@@ -863,6 +865,11 @@ sync_thread_levels_g(
if (slot->latch != NULL) {
if (slot->level <= limit) {
+ if (!warn) {
+
+ return(FALSE);
+ }
+
lock = slot->latch;
mutex = slot->latch;
@@ -1100,7 +1107,7 @@ sync_thread_add_level(
case SYNC_DICT_HEADER:
case SYNC_TRX_I_S_RWLOCK:
case SYNC_TRX_I_S_LAST_READ:
- if (!sync_thread_levels_g(array, level)) {
+ if (!sync_thread_levels_g(array, level, TRUE)) {
fprintf(stderr,
"InnoDB: sync_thread_levels_g(array, %lu)"
" does not hold!\n", level);
@@ -1111,36 +1118,44 @@ sync_thread_add_level(
/* Either the thread must own the buffer pool mutex
(buf_pool_mutex), or it is allowed to latch only ONE
buffer block (block->mutex or buf_pool_zip_mutex). */
- if (!sync_thread_levels_g(array, level)) {
- ut_a(sync_thread_levels_g(array, level - 1));
+ if (!sync_thread_levels_g(array, level, FALSE)) {
+ ut_a(sync_thread_levels_g(array, level - 1, TRUE));
ut_a(sync_thread_levels_contain(array, SYNC_BUF_POOL));
}
break;
case SYNC_REC_LOCK:
- ut_a((sync_thread_levels_contain(array, SYNC_KERNEL)
- && sync_thread_levels_g(array, SYNC_REC_LOCK - 1))
- || sync_thread_levels_g(array, SYNC_REC_LOCK));
+ if (sync_thread_levels_contain(array, SYNC_KERNEL)) {
+ ut_a(sync_thread_levels_g(array, SYNC_REC_LOCK - 1,
+ TRUE));
+ } else {
+ ut_a(sync_thread_levels_g(array, SYNC_REC_LOCK, TRUE));
+ }
break;
case SYNC_IBUF_BITMAP:
/* Either the thread must own the master mutex to all
the bitmap pages, or it is allowed to latch only ONE
bitmap page. */
- ut_a((sync_thread_levels_contain(array, SYNC_IBUF_BITMAP_MUTEX)
- && sync_thread_levels_g(array, SYNC_IBUF_BITMAP - 1))
- || sync_thread_levels_g(array, SYNC_IBUF_BITMAP));
+ if (sync_thread_levels_contain(array,
+ SYNC_IBUF_BITMAP_MUTEX)) {
+ ut_a(sync_thread_levels_g(array, SYNC_IBUF_BITMAP - 1,
+ TRUE));
+ } else {
+ ut_a(sync_thread_levels_g(array, SYNC_IBUF_BITMAP,
+ TRUE));
+ }
break;
case SYNC_FSP_PAGE:
ut_a(sync_thread_levels_contain(array, SYNC_FSP));
break;
case SYNC_FSP:
ut_a(sync_thread_levels_contain(array, SYNC_FSP)
- || sync_thread_levels_g(array, SYNC_FSP));
+ || sync_thread_levels_g(array, SYNC_FSP, TRUE));
break;
case SYNC_TRX_UNDO_PAGE:
ut_a(sync_thread_levels_contain(array, SYNC_TRX_UNDO)
|| sync_thread_levels_contain(array, SYNC_RSEG)
|| sync_thread_levels_contain(array, SYNC_PURGE_SYS)
- || sync_thread_levels_g(array, SYNC_TRX_UNDO_PAGE));
+ || sync_thread_levels_g(array, SYNC_TRX_UNDO_PAGE, TRUE));
break;
case SYNC_RSEG_HEADER:
ut_a(sync_thread_levels_contain(array, SYNC_RSEG));
@@ -1152,37 +1167,41 @@ sync_thread_add_level(
case SYNC_TREE_NODE:
ut_a(sync_thread_levels_contain(array, SYNC_INDEX_TREE)
|| sync_thread_levels_contain(array, SYNC_DICT_OPERATION)
- || sync_thread_levels_g(array, SYNC_TREE_NODE - 1));
+ || sync_thread_levels_g(array, SYNC_TREE_NODE - 1, TRUE));
break;
case SYNC_TREE_NODE_NEW:
ut_a(sync_thread_levels_contain(array, SYNC_FSP_PAGE)
|| sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
break;
case SYNC_INDEX_TREE:
- ut_a((sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
- && sync_thread_levels_contain(array, SYNC_FSP)
- && sync_thread_levels_g(array, SYNC_FSP_PAGE - 1))
- || sync_thread_levels_g(array, SYNC_TREE_NODE - 1));
+ if (sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
+ && sync_thread_levels_contain(array, SYNC_FSP)) {
+ ut_a(sync_thread_levels_g(array, SYNC_FSP_PAGE - 1,
+ TRUE));
+ } else {
+ ut_a(sync_thread_levels_g(array, SYNC_TREE_NODE - 1,
+ TRUE));
+ }
break;
case SYNC_IBUF_MUTEX:
- ut_a(sync_thread_levels_g(array, SYNC_FSP_PAGE - 1));
+ ut_a(sync_thread_levels_g(array, SYNC_FSP_PAGE - 1, TRUE));
break;
case SYNC_IBUF_PESS_INSERT_MUTEX:
- ut_a(sync_thread_levels_g(array, SYNC_FSP - 1)
- && !sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
+ ut_a(sync_thread_levels_g(array, SYNC_FSP - 1, TRUE));
+ ut_a(!sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
break;
case SYNC_IBUF_HEADER:
- ut_a(sync_thread_levels_g(array, SYNC_FSP - 1)
- && !sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
- && !sync_thread_levels_contain(
- array, SYNC_IBUF_PESS_INSERT_MUTEX));
+ ut_a(sync_thread_levels_g(array, SYNC_FSP - 1, TRUE));
+ ut_a(!sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
+ ut_a(!sync_thread_levels_contain(array,
+ SYNC_IBUF_PESS_INSERT_MUTEX));
break;
case SYNC_DICT:
#ifdef UNIV_DEBUG
ut_a(buf_debug_prints
- || sync_thread_levels_g(array, SYNC_DICT));
+ || sync_thread_levels_g(array, SYNC_DICT, TRUE));
#else /* UNIV_DEBUG */
- ut_a(sync_thread_levels_g(array, SYNC_DICT));
+ ut_a(sync_thread_levels_g(array, SYNC_DICT, TRUE));
#endif /* UNIV_DEBUG */
break;
default:
=== modified file 'storage/innodb_plugin/thr/thr0loc.c'
--- a/storage/innodb_plugin/thr/thr0loc.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/thr/thr0loc.c 2009-10-08 10:00:49 +0000
@@ -62,7 +62,7 @@ struct thr_local_struct{
os_thread_t handle; /*!< operating system handle to the thread */
ulint slot_no;/*!< the index of the slot in the thread table
for this thread */
- ibool in_ibuf;/*!< TRUE if the the thread is doing an ibuf
+ ibool in_ibuf;/*!< TRUE if the thread is doing an ibuf
operation */
hash_node_t hash; /*!< hash chain node */
ulint magic_n;/*!< magic number (THR_LOCAL_MAGIC_N) */
=== modified file 'storage/innodb_plugin/trx/trx0rec.c'
--- a/storage/innodb_plugin/trx/trx0rec.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/trx/trx0rec.c 2009-10-08 10:00:49 +0000
@@ -1333,7 +1333,7 @@ trx_undo_get_undo_rec_low(
ulint rseg_id;
ulint page_no;
ulint offset;
- page_t* undo_page;
+ const page_t* undo_page;
trx_rseg_t* rseg;
ibool is_insert;
mtr_t mtr;
@@ -1572,7 +1572,7 @@ trx_undo_prev_version_build(
/* We have to set the appropriate extern storage bits in the
old version of the record: the extern bits in rec for those
- fields that update does NOT update, as well as the the bits for
+ fields that update does NOT update, as well as the bits for
those fields that update updates to become externally stored
fields. Store the info: */
=== modified file 'storage/innodb_plugin/trx/trx0roll.c'
--- a/storage/innodb_plugin/trx/trx0roll.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/trx/trx0roll.c 2009-10-08 13:05:59 +0000
@@ -66,9 +66,9 @@ int
trx_general_rollback_for_mysql(
/*===========================*/
trx_t* trx, /*!< in: transaction handle */
- ibool partial,/*!< in: TRUE if partial rollback requested */
trx_savept_t* savept) /*!< in: pointer to savepoint undo number, if
- partial rollback requested */
+ partial rollback requested, or NULL for
+ complete rollback */
{
mem_heap_t* heap;
que_thr_t* thr;
@@ -85,9 +85,8 @@ trx_general_rollback_for_mysql(
roll_node = roll_node_create(heap);
- roll_node->partial = partial;
-
- if (partial) {
+ if (savept) {
+ roll_node->partial = TRUE;
roll_node->savept = *savept;
}
@@ -145,7 +144,7 @@ trx_rollback_for_mysql(
the transaction object does not have an InnoDB session object, and we
set a dummy session that we use for all MySQL transactions. */
- err = trx_general_rollback_for_mysql(trx, FALSE, NULL);
+ err = trx_general_rollback_for_mysql(trx, NULL);
trx->op_info = "";
@@ -170,8 +169,7 @@ trx_rollback_last_sql_stat_for_mysql(
trx->op_info = "rollback of SQL statement";
- err = trx_general_rollback_for_mysql(trx, TRUE,
- &(trx->last_sql_stat_start));
+ err = trx_general_rollback_for_mysql(trx, &trx->last_sql_stat_start);
/* The following call should not be needed, but we play safe: */
trx_mark_sql_stat_end(trx);
@@ -282,7 +280,7 @@ trx_rollback_to_savepoint_for_mysql(
trx->op_info = "rollback to a savepoint";
- err = trx_general_rollback_for_mysql(trx, TRUE, &(savep->savept));
+ err = trx_general_rollback_for_mysql(trx, &savep->savept);
/* Store the current undo_no of the transaction so that we know where
to roll back if we have to roll back the next SQL statement: */
@@ -534,28 +532,26 @@ trx_rollback_active(
Rollback or clean up any incomplete transactions which were
encountered in crash recovery. If the transaction already was
committed, then we clean up a possible insert undo log. If the
-transaction was not yet committed, then we roll it back.
-Note: this is done in a background thread.
-@return a dummy parameter */
+transaction was not yet committed, then we roll it back. */
UNIV_INTERN
-os_thread_ret_t
-trx_rollback_or_clean_all_recovered(
-/*================================*/
- void* arg __attribute__((unused)))
- /*!< in: a dummy parameter required by
- os_thread_create */
+void
+trx_rollback_or_clean_recovered(
+/*============================*/
+ ibool all) /*!< in: FALSE=roll back dictionary transactions;
+ TRUE=roll back all non-PREPARED transactions */
{
trx_t* trx;
mutex_enter(&kernel_mutex);
- if (UT_LIST_GET_FIRST(trx_sys->trx_list)) {
+ if (!UT_LIST_GET_FIRST(trx_sys->trx_list)) {
+ goto leave_function;
+ }
+ if (all) {
fprintf(stderr,
"InnoDB: Starting in background the rollback"
" of uncommitted transactions\n");
- } else {
- goto leave_function;
}
mutex_exit(&kernel_mutex);
@@ -584,18 +580,42 @@ loop:
goto loop;
case TRX_ACTIVE:
- mutex_exit(&kernel_mutex);
- trx_rollback_active(trx);
- goto loop;
+ if (all || trx_get_dict_operation(trx)
+ != TRX_DICT_OP_NONE) {
+ mutex_exit(&kernel_mutex);
+ trx_rollback_active(trx);
+ goto loop;
+ }
}
}
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Rollback of non-prepared transactions completed\n");
+ if (all) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Rollback of non-prepared"
+ " transactions completed\n");
+ }
leave_function:
mutex_exit(&kernel_mutex);
+}
+
+/*******************************************************************//**
+Rollback or clean up any incomplete transactions which were
+encountered in crash recovery. If the transaction already was
+committed, then we clean up a possible insert undo log. If the
+transaction was not yet committed, then we roll it back.
+Note: this is done in a background thread.
+@return a dummy parameter */
+UNIV_INTERN
+os_thread_ret_t
+trx_rollback_or_clean_all_recovered(
+/*================================*/
+ void* arg __attribute__((unused)))
+ /*!< in: a dummy parameter required by
+ os_thread_create */
+{
+ trx_rollback_or_clean_recovered(TRUE);
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
=== modified file 'storage/innodb_plugin/trx/trx0trx.c'
--- a/storage/innodb_plugin/trx/trx0trx.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/trx/trx0trx.c 2009-10-09 14:13:15 +0000
@@ -803,7 +803,7 @@ trx_commit_off_kernel(
in exactly the same order as commit lsn's, if the transactions
have different rollback segments. To get exactly the same
order we should hold the kernel mutex up to this point,
- adding to to the contention of the kernel mutex. However, if
+ adding to the contention of the kernel mutex. However, if
a transaction T2 is able to see modifications made by
a transaction T1, T2 will always get a bigger transaction
number and a bigger commit lsn than T1. */
@@ -950,7 +950,7 @@ trx_commit_off_kernel(
/****************************************************************//**
Cleans up a transaction at database startup. The cleanup is needed if
the transaction already got to the middle of a commit when the database
-crashed, andf we cannot roll it back. */
+crashed, and we cannot roll it back. */
UNIV_INTERN
void
trx_cleanup_at_db_startup(
=== modified file 'storage/innodb_plugin/ut/ut0auxconf_atomic_pthread_t_solaris.c'
--- a/storage/innodb_plugin/ut/ut0auxconf_atomic_pthread_t_solaris.c 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/ut/ut0auxconf_atomic_pthread_t_solaris.c 2009-10-08 13:05:59 +0000
@@ -17,18 +17,38 @@ Place, Suite 330, Boston, MA 02111-1307
*****************************************************************************/
/*****************************************************************************
-If this program compiles, then pthread_t objects can be used as arguments
-to Solaris libc atomic functions.
+If this program compiles and returns 0, then pthread_t objects can be used as
+arguments to Solaris libc atomic functions.
Created April 18, 2009 Vasil Dimov
*****************************************************************************/
#include <pthread.h>
+#include <string.h>
int
main(int argc, char** argv)
{
- pthread_t x = 0;
+ pthread_t x1;
+ pthread_t x2;
+ pthread_t x3;
+
+ memset(&x1, 0x0, sizeof(x1));
+ memset(&x2, 0x0, sizeof(x2));
+ memset(&x3, 0x0, sizeof(x3));
+
+ if (sizeof(pthread_t) == 4) {
+
+ atomic_cas_32(&x1, x2, x3);
+
+ } else if (sizeof(pthread_t) == 8) {
+
+ atomic_cas_64(&x1, x2, x3);
+
+ } else {
+
+ return(1);
+ }
return(0);
}
=== added file 'storage/innodb_plugin/ut/ut0auxconf_have_gcc_atomics.c'
--- a/storage/innodb_plugin/ut/ut0auxconf_have_gcc_atomics.c 1970-01-01 00:00:00 +0000
+++ b/storage/innodb_plugin/ut/ut0auxconf_have_gcc_atomics.c 2009-10-12 12:00:56 +0000
@@ -0,0 +1,61 @@
+/*****************************************************************************
+
+Copyright (c) 2009, Innobase Oy. All Rights Reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+
+*****************************************************************************/
+
+/*****************************************************************************
+If this program compiles and returns 0, then GCC atomic funcions are available.
+
+Created September 12, 2009 Vasil Dimov
+*****************************************************************************/
+
+int
+main(int argc, char** argv)
+{
+ long x;
+ long y;
+ long res;
+ char c;
+
+ x = 10;
+ y = 123;
+ res = __sync_bool_compare_and_swap(&x, x, y);
+ if (!res || x != y) {
+ return(1);
+ }
+
+ x = 10;
+ y = 123;
+ res = __sync_bool_compare_and_swap(&x, x + 1, y);
+ if (res || x != 10) {
+ return(1);
+ }
+
+ x = 10;
+ y = 123;
+ res = __sync_add_and_fetch(&x, y);
+ if (res != 123 + 10 || x != 123 + 10) {
+ return(1);
+ }
+
+ c = 10;
+ res = __sync_lock_test_and_set(&c, 123);
+ if (res != 10 || c != 123) {
+ return(1);
+ }
+
+ return(0);
+}
=== modified file 'storage/innodb_plugin/ut/ut0ut.c'
--- a/storage/innodb_plugin/ut/ut0ut.c 2009-07-30 12:42:56 +0000
+++ b/storage/innodb_plugin/ut/ut0ut.c 2009-10-08 12:52:21 +0000
@@ -132,6 +132,7 @@ ut_time(void)
return(time(NULL));
}
+#ifndef UNIV_HOTBACKUP
/**********************************************************//**
Returns system time.
Upon successful completion, the value 0 is returned; otherwise the
@@ -200,6 +201,24 @@ ut_time_us(
}
/**********************************************************//**
+Returns the number of milliseconds since some epoch. The
+value may wrap around. It should only be used for heuristic
+purposes.
+@return ms since epoch */
+UNIV_INTERN
+ulint
+ut_time_ms(void)
+/*============*/
+{
+ struct timeval tv;
+
+ ut_gettimeofday(&tv, NULL);
+
+ return((ulint) tv.tv_sec * 1000 + tv.tv_usec / 1000);
+}
+#endif /* !UNIV_HOTBACKUP */
+
+/**********************************************************//**
Returns the difference of two times in seconds.
@return time2 - time1 expressed in seconds */
UNIV_INTERN
=== removed directory 'storage/innodb_plugin/win-plugin'
=== removed file 'storage/innodb_plugin/win-plugin/README'
--- a/storage/innodb_plugin/win-plugin/README 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/win-plugin/README 1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
-This directory contains patches that need to be applied to the MySQL
-source tree in order to build the dynamic plugin on Windows --
-HA_INNODB.DLL. Please note the followings when adding the patches:
-
-* The patch must be applied from the mysql top-level source directory.
- patch -p0 < win-plugin.diff
-* The patch filenames end in ".diff".
-* All patches here are expected to apply cleanly to the latest MySQL 5.1
- tree when storage/innobase is replaced with this InnoDB branch.
-
-When applying the patch, the following files will be modified:
-
- * CMakeLists.txt
- * sql/CMakeLists.txt
- * win/configure.js
-
-Also, two new files will be added:
-
- * sql/mysqld.def
- * sql/mysqld_x64.def
-
-You can get "patch" utility for Windows from http://unxutils.sourceforge.net/
=== removed file 'storage/innodb_plugin/win-plugin/win-plugin.diff'
--- a/storage/innodb_plugin/win-plugin/win-plugin.diff 2009-05-27 09:45:59 +0000
+++ b/storage/innodb_plugin/win-plugin/win-plugin.diff 1970-01-01 00:00:00 +0000
@@ -1,279 +0,0 @@
-diff -Nur CMakeLists.txt.orig CMakeLists.txt
---- CMakeLists.txt.orig 2008-10-03 12:25:41 -05:00
-+++ CMakeLists.txt 2008-09-26 17:32:51 -05:00
-@@ -254,9 +254,9 @@
- IF(WITH_FEDERATED_STORAGE_ENGINE)
- ADD_SUBDIRECTORY(storage/federated)
- ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
--IF(WITH_INNOBASE_STORAGE_ENGINE)
-+IF(WITH_INNOBASE_STORAGE_ENGINE OR INNODB_DYNAMIC_PLUGIN)
- ADD_SUBDIRECTORY(storage/innobase)
--ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
-+ENDIF(WITH_INNOBASE_STORAGE_ENGINE OR INNODB_DYNAMIC_PLUGIN)
- ADD_SUBDIRECTORY(sql)
- ADD_SUBDIRECTORY(server-tools/instance-manager)
- ADD_SUBDIRECTORY(libmysql)
-
-diff -Nur sql/CMakeLists.txt.orig sql/CMakeLists.txt
---- sql/CMakeLists.txt.orig 2008-10-03 12:25:41 -05:00
-+++ sql/CMakeLists.txt 2008-09-24 03:58:19 -05:00
-@@ -98,6 +98,15 @@
- LINK_FLAGS "/PDB:${CMAKE_CFG_INTDIR}/mysqld${MYSQLD_EXE_SUFFIX}.pdb")
- ENDIF(cmake_version EQUAL 20406)
-
-+# Checks for 64-bit version
-+IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
-+SET_TARGET_PROPERTIES(mysqld PROPERTIES
-+ LINK_FLAGS "/def:\"${PROJECT_SOURCE_DIR}/sql/mysqld_x64.def\"")
-+ELSE(CMAKE_SIZEOF_VOID_P MATCHES 8)
-+SET_TARGET_PROPERTIES(mysqld PROPERTIES
-+ LINK_FLAGS "/def:\"${PROJECT_SOURCE_DIR}/sql/mysqld.def\"")
-+ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 8)
-+
- IF(EMBED_MANIFESTS)
- MYSQL_EMBED_MANIFEST("mysqld" "asInvoker")
- ENDIF(EMBED_MANIFESTS)
-
-diff -Nur sql/mysqld.def.orig sql/mysqld.def
---- sql/mysqld.def.orig 1969-12-31 18:00:00 -06:00
-+++ sql/mysqld.def 2009-04-09 02:20:32 -05:00
-@@ -0,0 +1,111 @@
-+EXPORTS
-+ ?use_hidden_primary_key@handler@@UAEXXZ
-+ ?get_dynamic_partition_info@handler@@UAEXPAUPARTITION_INFO@@I@Z
-+ ?read_first_row@handler@@UAEHPAEI@Z
-+ ?read_range_next@handler@@UAEHXZ
-+ ?read_range_first@handler@@UAEHPBUst_key_range@@0_N1@Z
-+ ?read_multi_range_first@handler@@UAEHPAPAUst_key_multi_range@@PAU2@I_NPAUst_handler_buffer@@@Z
-+ ?read_multi_range_next@handler@@UAEHPAPAUst_key_multi_range@@@Z
-+ ?index_read_idx_map@handler@@UAEHPAEIPBEKW4ha_rkey_function@@@Z
-+ ?print_error@handler@@UAEXHH@Z
-+ ?clone@handler@@UAEPAV1@PAUst_mem_root@@@Z
-+ ?get_auto_increment@handler@@UAEX_K00PA_K1@Z
-+ ?index_next_same@handler@@UAEHPAEPBEI@Z
-+ ?get_error_message@handler@@UAE_NHPAVString@@@Z
-+ ?ha_thd@handler@@IBEPAVTHD@@XZ
-+ ?update_auto_increment@handler@@QAEHXZ
-+ ?ha_statistic_increment@handler@@IBEXPQsystem_status_var@@K@Z
-+ ?trans_register_ha@@YAXPAVTHD@@_NPAUhandlerton@@@Z
-+ ?cmp@Field_blob@@QAEHPBEI0I@Z
-+ ?set_time@Field_timestamp@@QAEXXZ
-+ ?sql_print_error@@YAXPBDZZ
-+ ?sql_print_warning@@YAXPBDZZ
-+ ?check_global_access@@YA_NPAVTHD@@K@Z
-+ ?schema_table_store_record@@YA_NPAVTHD@@PAUst_table@@@Z
-+ ?get_quote_char_for_identifier@@YAHPAVTHD@@PBDI@Z
-+ ?copy@String@@QAE_NXZ
-+ ?copy@String@@QAE_NABV1@@Z
-+ ?copy@String@@QAE_NPBDIPAUcharset_info_st@@@Z
-+ ?copy_and_convert@@YAIPADIPAUcharset_info_st@@PBDI1PAI@Z
-+ ?filename_to_tablename@@YAIPBDPADI@Z
-+ ?strconvert@@YAIPAUcharset_info_st@@PBD0PADIPAI@Z
-+ ?calculate_key_len@@YAIPAUst_table@@IPBEK@Z
-+ ?sql_alloc@@YAPAXI@Z
-+ ?localtime_to_TIME@@YAXPAUst_mysql_time@@PAUtm@@@Z
-+ ?push_warning@@YAPAVMYSQL_ERROR@@PAVTHD@@W4enum_warning_level@1@IPBD@Z
-+ ?push_warning_printf@@YAXPAVTHD@@W4enum_warning_level@MYSQL_ERROR@@IPBDZZ
-+ ?drop_table@handler@@EAEXPBD@Z
-+ ?column_bitmaps_signal@handler@@UAEXXZ
-+ ?delete_table@handler@@MAEHPBD@Z
-+ ?rename_table@handler@@MAEHPBD0@Z
-+ ?key_map_empty@@3V?$Bitmap@$0EA@@@B
-+ ?THR_THD@@3PAVTHD@@A
-+ ?end_of_list@@3Ulist_node@@A
-+ ?mysql_tmpdir_list@@3Ust_my_tmpdir@@A
-+ mysql_query_cache_invalidate4
-+ thd_query
-+ thd_sql_command
-+ thd_get_thread_id
-+ thd_get_xid
-+ thd_slave_thread
-+ thd_non_transactional_update
-+ thd_mark_transaction_to_rollback
-+ thd_security_context
-+ thd_charset
-+ thd_test_options
-+ thd_ha_data
-+ thd_killed
-+ thd_tx_isolation
-+ thd_tablespace_op
-+ thd_sql_command
-+ thd_memdup
-+ thd_make_lex_string
-+ thd_in_lock_tables
-+ thd_binlog_format
-+ _my_hash_init
-+ my_hash_free
-+ my_tmpdir
-+ check_if_legal_filename
-+ my_filename
-+ my_sync_dir_by_file
-+ alloc_root
-+ thr_lock_data_init
-+ thr_lock_init
-+ thr_lock_delete
-+ my_multi_malloc
-+ get_charset
-+ unpack_filename
-+ my_hash_insert
-+ my_hash_search
-+ my_hash_delete
-+ mysql_bin_log_file_pos
-+ mysql_bin_log_file_name
-+ mysqld_embedded
-+ my_thread_name
-+ my_malloc
-+ my_no_flags_free
-+ _sanity
-+ _mymalloc
-+ _myfree
-+ _my_strdup
-+ _my_thread_var
-+ my_error
-+ pthread_cond_init
-+ pthread_cond_signal
-+ pthread_cond_wait
-+ pthread_cond_destroy
-+ localtime_r
-+ my_strdup
-+ deflate
-+ deflateEnd
-+ deflateReset
-+ deflateInit2_
-+ inflateEnd
-+ inflateInit_
-+ inflate
-+ compressBound
-+ inflateInit2_
-+ adler32
-+ longlong2str
-+ strend
-+ my_snprintf
-
-diff -Nur sql/mysqld_x64.def.orig sql/mysqld_x64.def
---- sql/mysqld_x64.def.orig 1969-12-31 18:00:00 -06:00
-+++ sql/mysqld_x64.def 2009-04-09 02:22:04 -05:00
-@@ -0,0 +1,111 @@
-+EXPORTS
-+ ?use_hidden_primary_key@handler@@UEAAXXZ
-+ ?get_dynamic_partition_info@handler@@UEAAXPEAUPARTITION_INFO@@I@Z
-+ ?read_first_row@handler@@UEAAHPEAEI@Z
-+ ?read_range_next@handler@@UEAAHXZ
-+ ?read_range_first@handler@@UEAAHPEBUst_key_range@@0_N1@Z
-+ ?read_multi_range_first@handler@@UEAAHPEAPEAUst_key_multi_range@@PEAU2@I_NPEAUst_handler_buffer@@@Z
-+ ?read_multi_range_next@handler@@UEAAHPEAPEAUst_key_multi_range@@@Z
-+ ?index_read_idx_map@handler@@UEAAHPEAEIPEBEKW4ha_rkey_function@@@Z
-+ ?print_error@handler@@UEAAXHH@Z
-+ ?clone@handler@@UEAAPEAV1@PEAUst_mem_root@@@Z
-+ ?get_auto_increment@handler@@UEAAX_K00PEA_K1@Z
-+ ?index_next_same@handler@@UEAAHPEAEPEBEI@Z
-+ ?get_error_message@handler@@UEAA_NHPEAVString@@@Z
-+ ?ha_thd@handler@@IEBAPEAVTHD@@XZ
-+ ?update_auto_increment@handler@@QEAAHXZ
-+ ?ha_statistic_increment@handler@@IEBAXPEQsystem_status_var@@K@Z
-+ ?trans_register_ha@@YAXPEAVTHD@@_NPEAUhandlerton@@@Z
-+ ?cmp@Field_blob@@QEAAHPEBEI0I@Z
-+ ?set_time@Field_timestamp@@QEAAXXZ
-+ ?sql_print_error@@YAXPEBDZZ
-+ ?sql_print_warning@@YAXPEBDZZ
-+ ?check_global_access@@YA_NPEAVTHD@@K@Z
-+ ?schema_table_store_record@@YA_NPEAVTHD@@PEAUst_table@@@Z
-+ ?get_quote_char_for_identifier@@YAHPEAVTHD@@PEBDI@Z
-+ ?copy@String@@QEAA_NXZ
-+ ?copy@String@@QEAA_NAEBV1@@Z
-+ ?copy@String@@QEAA_NPEBDIPEAUcharset_info_st@@@Z
-+ ?copy_and_convert@@YAIPEADIPEAUcharset_info_st@@PEBDI1PEAI@Z
-+ ?filename_to_tablename@@YAIPEBDPEADI@Z
-+ ?strconvert@@YAIPEAUcharset_info_st@@PEBD0PEADIPEAI@Z
-+ ?calculate_key_len@@YAIPEAUst_table@@IPEBEK@Z
-+ ?sql_alloc@@YAPEAX_K@Z
-+ ?localtime_to_TIME@@YAXPEAUst_mysql_time@@PEAUtm@@@Z
-+ ?push_warning@@YAPEAVMYSQL_ERROR@@PEAVTHD@@W4enum_warning_level@1@IPEBD@Z
-+ ?push_warning_printf@@YAXPEAVTHD@@W4enum_warning_level@MYSQL_ERROR@@IPEBDZZ
-+ ?drop_table@handler@@EEAAXPEBD@Z
-+ ?column_bitmaps_signal@handler@@UEAAXXZ
-+ ?delete_table@handler@@MEAAHPEBD@Z
-+ ?rename_table@handler@@MEAAHPEBD0@Z
-+ ?key_map_empty@@3V?$Bitmap@$0EA@@@B
-+ ?THR_THD@@3PEAVTHD@@EA
-+ ?end_of_list@@3Ulist_node@@A
-+ ?mysql_tmpdir_list@@3Ust_my_tmpdir@@A
-+ mysql_query_cache_invalidate4
-+ thd_query
-+ thd_sql_command
-+ thd_get_thread_id
-+ thd_get_xid
-+ thd_slave_thread
-+ thd_non_transactional_update
-+ thd_mark_transaction_to_rollback
-+ thd_security_context
-+ thd_charset
-+ thd_test_options
-+ thd_ha_data
-+ thd_killed
-+ thd_tx_isolation
-+ thd_tablespace_op
-+ thd_sql_command
-+ thd_memdup
-+ thd_make_lex_string
-+ thd_in_lock_tables
-+ thd_binlog_format
-+ _my_hash_init
-+ my_hash_free
-+ my_tmpdir
-+ check_if_legal_filename
-+ my_filename
-+ my_sync_dir_by_file
-+ alloc_root
-+ thr_lock_data_init
-+ thr_lock_init
-+ thr_lock_delete
-+ my_multi_malloc
-+ get_charset
-+ unpack_filename
-+ my_hash_insert
-+ my_hash_search
-+ my_hash_delete
-+ mysql_bin_log_file_pos
-+ mysql_bin_log_file_name
-+ mysqld_embedded
-+ my_thread_name
-+ my_malloc
-+ my_no_flags_free
-+ _sanity
-+ _mymalloc
-+ _myfree
-+ _my_strdup
-+ _my_thread_var
-+ my_error
-+ pthread_cond_init
-+ pthread_cond_signal
-+ pthread_cond_wait
-+ pthread_cond_destroy
-+ localtime_r
-+ my_strdup
-+ deflate
-+ deflateEnd
-+ deflateReset
-+ deflateInit2_
-+ inflateEnd
-+ inflateInit_
-+ inflate
-+ compressBound
-+ inflateInit2_
-+ adler32
-+ longlong2str
-+ strend
-+ my_snprintf
-
-diff -Nur win/configure.js.orig win/configure.js
---- win/configure.js.orig 2008-09-26 21:18:37 -05:00
-+++ win/configure.js 2008-10-01 11:21:27 -05:00
-@@ -50,6 +50,7 @@
- case "EMBED_MANIFESTS":
- case "EXTRA_DEBUG":
- case "WITH_EMBEDDED_SERVER":
-+ case "INNODB_DYNAMIC_PLUGIN":
- configfile.WriteLine("SET (" + args.Item(i) + " TRUE)");
- break;
- case "MYSQL_SERVER_SUFFIX":
=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc 2009-11-07 10:34:19 +0000
+++ b/storage/maria/ha_maria.cc 2009-11-16 20:49:51 +0000
@@ -1928,8 +1928,7 @@ end:
bool ha_maria::check_and_repair(THD *thd)
{
int error, crashed;
- char *old_query;
- uint old_query_length;
+ LEX_STRING old_query;
HA_CHECK_OPT check_opt;
DBUG_ENTER("ha_maria::check_and_repair");
@@ -1957,11 +1956,9 @@ bool ha_maria::check_and_repair(THD *thd
if (!file->state->del && (maria_recover_options & HA_RECOVER_QUICK))
check_opt.flags |= T_QUICK;
- old_query= thd->query;
- old_query_length= thd->query_length;
+ old_query= thd->query_string;
pthread_mutex_lock(&LOCK_thread_count);
- thd->query= table->s->table_name.str;
- thd->query_length= table->s->table_name.length;
+ thd->query_string= table->s->table_name;
pthread_mutex_unlock(&LOCK_thread_count);
if (!(crashed= maria_is_crashed(file)))
@@ -1981,8 +1978,7 @@ bool ha_maria::check_and_repair(THD *thd
error= 1;
}
pthread_mutex_lock(&LOCK_thread_count);
- thd->query= old_query;
- thd->query_length= old_query_length;
+ thd->query_string= old_query;
pthread_mutex_unlock(&LOCK_thread_count);
DBUG_RETURN(error);
}
@@ -2292,7 +2288,7 @@ int ha_maria::delete_all_rows()
{
THD *thd= current_thd;
(void) translog_log_debug_info(file->trn, LOGREC_DEBUG_INFO_QUERY,
- (uchar*) thd->query, thd->query_length);
+ (uchar*) thd->query(), thd->query_length());
if (file->s->now_transactional &&
((table->in_use->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ||
table->in_use->locked_tables))
@@ -2311,7 +2307,7 @@ int ha_maria::delete_table(const char *n
{
THD *thd= current_thd;
(void) translog_log_debug_info(0, LOGREC_DEBUG_INFO_QUERY,
- (uchar*) thd->query, thd->query_length);
+ (uchar*) thd->query(), thd->query_length());
return maria_delete_table(name);
}
@@ -2392,7 +2388,8 @@ int ha_maria::external_lock(THD *thd, in
trnman_set_flags(trn, trnman_get_flags(trn) | TRN_STATE_INFO_LOGGED |
TRN_STATE_TABLES_CAN_CHANGE);
(void) translog_log_debug_info(trn, LOGREC_DEBUG_INFO_QUERY,
- (uchar*) thd->query, thd->query_length);
+ (uchar*) thd->query(),
+ thd->query_length());
}
#endif
}
@@ -2488,7 +2485,8 @@ int ha_maria::start_stmt(THD *thd, thr_l
{
trnman_set_flags(trn, trnman_get_flags(trn) | TRN_STATE_INFO_LOGGED);
(void) translog_log_debug_info(trn, LOGREC_DEBUG_INFO_QUERY,
- (uchar*) thd->query, thd->query_length);
+ (uchar*) thd->query(),
+ thd->query_length());
}
#endif
}
@@ -2769,7 +2767,7 @@ int ha_maria::create(const char *name, r
create_flags|= HA_CREATE_PAGE_CHECKSUM;
(void) translog_log_debug_info(0, LOGREC_DEBUG_INFO_QUERY,
- (uchar*) thd->query, thd->query_length);
+ (uchar*) thd->query(), thd->query_length());
/* TODO: Check that the following fn_format is really needed */
error=
@@ -2789,7 +2787,7 @@ int ha_maria::rename_table(const char *f
{
THD *thd= current_thd;
(void) translog_log_debug_info(0, LOGREC_DEBUG_INFO_QUERY,
- (uchar*) thd->query, thd->query_length);
+ (uchar*) thd->query(), thd->query_length());
return maria_rename(from, to);
}
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2009-10-06 14:53:46 +0000
+++ b/storage/myisam/ha_myisam.cc 2009-11-16 20:49:51 +0000
@@ -115,6 +115,10 @@ static void mi_check_print_msg(HA_CHECK
Also we likely need to lock mutex here (in both cases with protocol and
push_warning).
*/
+#ifdef THREAD
+ if (param->need_print_msg_lock)
+ pthread_mutex_lock(¶m->print_msg_mutex);
+#endif
protocol->prepare_for_resend();
protocol->store(name, length, system_charset_info);
protocol->store(param->op_name, system_charset_info);
@@ -123,6 +127,10 @@ static void mi_check_print_msg(HA_CHECK
if (protocol->write())
sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
msgbuf);
+#ifdef THREAD
+ if (param->need_print_msg_lock)
+ pthread_mutex_unlock(¶m->print_msg_mutex);
+#endif
return;
}
@@ -1112,22 +1120,6 @@ int ha_myisam::repair(THD *thd, HA_CHECK
ha_rows rows= file->state->records;
DBUG_ENTER("ha_myisam::repair");
- /*
- Normally this method is entered with a properly opened table. If the
- repair fails, it can be repeated with more elaborate options. Under
- special circumstances it can happen that a repair fails so that it
- closed the data file and cannot re-open it. In this case file->dfile
- is set to -1. We must not try another repair without an open data
- file. (Bug #25289)
- */
- if (file->dfile == -1)
- {
- sql_print_information("Retrying repair of: '%s' failed. "
- "Please try REPAIR EXTENDED or myisamchk",
- table->s->path.str);
- DBUG_RETURN(HA_ADMIN_FAILED);
- }
-
param.db_name= table->s->db.str;
param.table_name= table->alias;
param.tmpfile_createflag = O_RDWR | O_TRUNC;
@@ -1636,8 +1628,8 @@ bool ha_myisam::check_and_repair(THD *th
check_opt.flags|=T_QUICK;
sql_print_warning("Checking table: '%s'",table->s->path.str);
- old_query= thd->query;
- old_query_length= thd->query_length;
+ old_query= thd->query();
+ old_query_length= thd->query_length();
thd->set_query(table->s->table_name.str,
(uint) table->s->table_name.length);
=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/mi_check.c 2009-11-16 20:49:51 +0000
@@ -89,10 +89,10 @@ static void set_data_file_type(MI_SORT_I
void myisamchk_init(HA_CHECK *param)
{
bzero((uchar*) param,sizeof(*param));
+ /* Set all params that are not 0 */
param->opt_follow_links=1;
param->keys_in_use= ~(ulonglong) 0;
param->search_after_block=HA_OFFSET_ERROR;
- param->auto_increment_value= 0;
param->use_buffers=USE_BUFFER_INIT;
param->read_buffer_length=READ_BUFFER_INIT;
param->write_buffer_length=READ_BUFFER_INIT;
@@ -100,7 +100,6 @@ void myisamchk_init(HA_CHECK *param)
param->sort_key_blocks=BUFFERS_WHEN_SORTING;
param->tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL;
param->myf_rw=MYF(MY_NABP | MY_WME | MY_WAIT_IF_FULL);
- param->start_check_pos=0;
param->max_record_length= LONGLONG_MAX;
param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE;
param->stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
@@ -1546,6 +1545,8 @@ int mi_repair(HA_CHECK *param, register
if (info->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
param->testflag|=T_CALC_CHECKSUM;
+ DBUG_ASSERT(param->use_buffers < SIZE_T_MAX);
+
if (!param->using_global_keycache)
VOID(init_key_cache(dflt_key_cache, param->key_cache_block_size,
(size_t) param->use_buffers, 0, 0));
@@ -2560,8 +2561,9 @@ err:
VOID(my_close(new_file,MYF(0)));
VOID(my_raid_delete(param->temp_filename,share->base.raid_chunks,
MYF(MY_WME)));
- if (info->dfile == new_file)
- info->dfile= -1;
+ if (info->dfile == new_file) /* Retry with key cache */
+ if (unlikely(mi_open_datafile(info, share, name, -1)))
+ param->retry_repair= 0; /* Safety */
}
mi_mark_crashed_on_repair(info);
}
@@ -2701,6 +2703,8 @@ int mi_repair_parallel(HA_CHECK *param,
/* Initialize pthread structures before goto err. */
pthread_mutex_init(&sort_info.mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&sort_info.cond, 0);
+ pthread_mutex_init(¶m->print_msg_mutex, MY_MUTEX_INIT_FAST);
+ param->need_print_msg_lock= 1;
if (!(sort_info.key_block=
alloc_key_blocks(param, (uint) param->sort_key_blocks,
@@ -3094,8 +3098,9 @@ err:
VOID(my_close(new_file,MYF(0)));
VOID(my_raid_delete(param->temp_filename,share->base.raid_chunks,
MYF(MY_WME)));
- if (info->dfile == new_file)
- info->dfile= -1;
+ if (info->dfile == new_file) /* Retry with key cache */
+ if (unlikely(mi_open_datafile(info, share, name, -1)))
+ param->retry_repair= 0; /* Safety */
}
mi_mark_crashed_on_repair(info);
}
@@ -3105,6 +3110,8 @@ err:
pthread_cond_destroy (&sort_info.cond);
pthread_mutex_destroy(&sort_info.mutex);
+ pthread_mutex_destroy(¶m->print_msg_mutex);
+ param->need_print_msg_lock= 0;
my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
=== modified file 'storage/myisam/mi_search.c'
--- a/storage/myisam/mi_search.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/mi_search.c 2009-11-16 20:49:51 +0000
@@ -302,7 +302,8 @@ int _mi_prefix_search(MI_INFO *info, reg
uchar *end, *kseg, *vseg;
uchar *sort_order=keyinfo->seg->charset->sort_order;
uchar tt_buff[HA_MAX_KEY_BUFF+2], *t_buff=tt_buff+2;
- uchar *saved_from, *saved_to, *saved_vseg;
+ uchar *UNINIT_VAR(saved_from), *UNINIT_VAR(saved_to);
+ uchar *UNINIT_VAR(saved_vseg);
uint saved_length=0, saved_prefix_len=0;
uint length_pack;
DBUG_ENTER("_mi_prefix_search");
@@ -310,9 +311,6 @@ int _mi_prefix_search(MI_INFO *info, reg
LINT_INIT(length);
LINT_INIT(prefix_len);
LINT_INIT(seg_len_pack);
- LINT_INIT(saved_from);
- LINT_INIT(saved_to);
- LINT_INIT(saved_vseg);
t_buff[0]=0; /* Avoid bugs */
end= page+mi_getint(page);
=== modified file 'storage/myisam/mi_write.c'
--- a/storage/myisam/mi_write.c 2009-09-07 20:50:10 +0000
+++ b/storage/myisam/mi_write.c 2009-11-16 20:49:51 +0000
@@ -702,11 +702,11 @@ uchar *_mi_find_half_pos(uint nod_flag,
} /* _mi_find_half_pos */
- /*
- Split buffer at last key
- Returns pointer to the start of the key before the last key
- key will contain the last key
- */
+/*
+ Split buffer at last key
+ Returns pointer to the start of the key before the last key
+ key will contain the last key
+*/
static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page,
uchar *key, uint *return_key_length,
@@ -717,6 +717,8 @@ static uchar *_mi_find_last_pos(MI_KEYDE
uchar key_buff[HA_MAX_KEY_BUFF];
DBUG_ENTER("_mi_find_last_pos");
+ LINT_INIT(last_length);
+
key_ref_length=2;
length=mi_getint(page)-key_ref_length;
page+=key_ref_length;
@@ -732,8 +734,6 @@ static uchar *_mi_find_last_pos(MI_KEYDE
DBUG_RETURN(end);
}
- LINT_INIT(prevpos);
- LINT_INIT(last_length);
end=page+length-key_ref_length;
*key='\0';
length=0;
=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c 2009-09-19 21:21:29 +0000
+++ b/storage/myisam/myisamchk.c 2009-11-16 20:49:51 +0000
@@ -302,17 +302,17 @@ static struct my_option my_long_options[
(uchar**) &check_param.read_buffer_length,
(uchar**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
- (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
(uchar**) &check_param.write_buffer_length,
(uchar**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
- (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
(uchar**) &check_param.sort_buffer_length,
(uchar**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
- (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
(uchar**) &check_param.sort_key_blocks,
(uchar**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
@@ -837,7 +837,7 @@ static int myisamchk(HA_CHECK *param, ch
mi_check_print_error(param,"'%s' is marked as crashed after last repair",filename);
break;
case HA_ERR_OLD_FILE:
- mi_check_print_error(param,"'%s' is a old type of MyISAM-table", filename);
+ mi_check_print_error(param,"'%s' is an old type of MyISAM-table", filename);
break;
case HA_ERR_END_OF_FILE:
mi_check_print_error(param,"Couldn't read complete header from '%s'", filename);
=== modified file 'storage/myisam/sort.c'
--- a/storage/myisam/sort.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/sort.c 2009-11-16 20:49:51 +0000
@@ -466,8 +466,12 @@ ok:
Detach from the share if the writer is involved. Avoid others to
be blocked. This includes a flush of the write buffer. This will
also indicate EOF to the readers.
+ That means that a writer always gets here first and readers -
+ only when they see EOF. But if a reader finishes prematurely
+ because of an error it may reach this earlier - don't allow it
+ to detach the writer thread.
*/
- if (sort_param->sort_info->info->rec_cache.share)
+ if (sort_param->master && sort_param->sort_info->info->rec_cache.share)
remove_io_thread(&sort_param->sort_info->info->rec_cache);
/* Readers detach from the share if any. Avoid others to be blocked. */
@@ -788,7 +792,12 @@ static int NEAR_F merge_many_buff(MI_SOR
cleanup:
close_cached_file(to_file); /* This holds old result */
if (to_file == t_file)
+ {
+ DBUG_ASSERT(t_file2.type == WRITE_CACHE);
*t_file=t_file2; /* Copy result file */
+ t_file->current_pos= &t_file->write_pos;
+ t_file->current_end= &t_file->write_end;
+ }
DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */
} /* merge_many_buff */
=== modified file 'storage/myisammrg/myrg_open.c'
--- a/storage/myisammrg/myrg_open.c 2009-08-28 16:21:54 +0000
+++ b/storage/myisammrg/myrg_open.c 2009-09-23 13:21:29 +0000
@@ -392,7 +392,7 @@ int myrg_attach_children(MYRG_INFO *m_in
int save_errno;
uint idx;
uint child_nr;
- uint key_parts;
+ uint UNINIT_VAR(key_parts);
uint min_keys;
my_bool bad_children= FALSE;
DBUG_ENTER("myrg_attach_children");
@@ -409,7 +409,6 @@ int myrg_attach_children(MYRG_INFO *m_in
rc= 1;
errpos= 0;
file_offset= 0;
- LINT_INIT(key_parts);
min_keys= 0;
child_nr= 0;
while ((myisam= (*callback)(callback_param)))
=== modified file 'storage/mysql_storage_engine.cmake'
--- a/storage/mysql_storage_engine.cmake 2009-06-10 08:59:49 +0000
+++ b/storage/mysql_storage_engine.cmake 2009-10-08 12:54:11 +0000
@@ -7,6 +7,8 @@
# Remarks:
# ${engine}_SOURCES variable containing source files to produce the library must set before
# calling this macro
+# ${engine}_LIBS variable containing extra libraries to link with may be set
+
MACRO(MYSQL_STORAGE_ENGINE engine)
IF(NOT SOURCE_SUBLIBS)
@@ -22,6 +24,9 @@ IF(NOT SOURCE_SUBLIBS)
#Create static library. The name of the library is <storage_engine>.lib
ADD_LIBRARY(${libname} ${${engine}_SOURCES})
ADD_DEPENDENCIES(${libname} GenError)
+ IF(${engine}_LIBS)
+ TARGET_LINK_LIBRARIES(${libname} ${${engine}_LIBS})
+ ENDIF(${engine}_LIBS)
MESSAGE("build ${engine} as static library")
ELSEIF(${ENGINE_BUILD_TYPE} STREQUAL "DYNAMIC")
ADD_DEFINITIONS(-DMYSQL_DYNAMIC_PLUGIN)
@@ -30,6 +35,9 @@ IF(NOT SOURCE_SUBLIBS)
SET(dyn_libname ha_${libname})
ADD_LIBRARY(${dyn_libname} SHARED ${${engine}_SOURCES})
TARGET_LINK_LIBRARIES (${dyn_libname} mysqld)
+ IF(${engine}_LIBS)
+ TARGET_LINK_LIBRARIES(${dyn_libname} ${${engine}_LIBS})
+ ENDIF(${engine}_LIBS)
MESSAGE("build ${engine} as DLL")
ENDIF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
ENDIF(NOT SOURCE_SUBLIBS)
=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2008-02-06 10:28:43 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2009-11-02 20:37:21 +0000
@@ -14831,7 +14831,7 @@ void Dblqh::srLogLimits(Signal* signal)
while(true) {
ndbrequire(tmbyte < clogFileSize);
if (logPartPtr.p->logExecState == LogPartRecord::LES_SEARCH_STOP) {
- if (logFilePtr.p->logMaxGciCompleted[tmbyte] < logPartPtr.p->logLastGci) {
+ if (logFilePtr.p->logMaxGciCompleted[tmbyte] <= logPartPtr.p->logLastGci) {
jam();
/* --------------------------------------------------------------------
* WE ARE STEPPING BACKWARDS FROM MBYTE TO MBYTE. THIS IS THE FIRST
=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.cpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2008-01-11 08:31:55 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2009-09-10 07:40:57 +0000
@@ -274,7 +274,7 @@ Suma::execSTTOR(Signal* signal) {
jam();
send_start_me_req(signal);
- return;
+ DBUG_VOID_RETURN;
}
}
@@ -322,7 +322,7 @@ Suma::execSTTOR(Signal* signal) {
if (ERROR_INSERTED(13030))
{
ndbout_c("Dont start handover");
- return;
+ DBUG_VOID_RETURN;
}
}//if
@@ -332,7 +332,7 @@ Suma::execSTTOR(Signal* signal) {
* Allow API's to connect
*/
sendSTTORRY(signal);
- return;
+ DBUG_VOID_RETURN;
}
if(startphase == 101)
@@ -345,7 +345,7 @@ Suma::execSTTOR(Signal* signal) {
*/
c_startup.m_wait_handover= true;
check_start_handover(signal);
- return;
+ DBUG_VOID_RETURN;
}
}
sendSTTORRY(signal);
@@ -575,19 +575,19 @@ void Suma::execAPI_FAILREQ(Signal* signa
jam();
sendSignalWithDelay(reference(), GSN_API_FAILREQ, signal,
200, signal->getLength());
- return;
+ DBUG_VOID_RETURN;
}
if (c_failedApiNodes.get(failedApiNode))
{
jam();
- return;
+ DBUG_VOID_RETURN;
}
if (!c_subscriber_nodes.get(failedApiNode))
{
jam();
- return;
+ DBUG_VOID_RETURN;
}
c_failedApiNodes.set(failedApiNode);
@@ -2453,7 +2453,7 @@ Suma::execSUB_START_REQ(Signal* signal){
jam();
c_subscriberPool.release(subbPtr);
sendSubStartRef(signal, SubStartRef::PartiallyConnected);
- return;
+ DBUG_VOID_RETURN;
}
DBUG_PRINT("info",("c_subscriberPool size: %d free: %d",
@@ -4289,7 +4289,7 @@ Suma::Restart::runSUMA_START_ME_REQ(Sign
ref->errorCode = SumaStartMeRef::Busy;
suma.sendSignal(sumaRef, GSN_SUMA_START_ME_REF, signal,
SumaStartMeRef::SignalLength, JBB);
- return;
+ DBUG_VOID_RETURN;
}
nodeId = refToNode(sumaRef);
=== modified file 'storage/pbxt/src/discover_xt.cc'
--- a/storage/pbxt/src/discover_xt.cc 2009-09-03 13:20:22 +0000
+++ b/storage/pbxt/src/discover_xt.cc 2009-11-16 20:49:51 +0000
@@ -1256,7 +1256,7 @@ static bool mysql_create_table_no_lock(T
(!thd->current_stmt_binlog_row_based ||
(thd->current_stmt_binlog_row_based &&
!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
- write_bin_log(thd, TRUE, thd->query, thd->query_length);
+ write_bin_log(thd, TRUE, thd->query(), thd->query_length());
error= FALSE;
unlock_and_end:
pthread_mutex_unlock(&LOCK_open);
=== modified file 'storage/xtradb/dict/dict0dict.c'
--- a/storage/xtradb/dict/dict0dict.c 2009-09-08 16:04:58 +0000
+++ b/storage/xtradb/dict/dict0dict.c 2009-11-16 20:49:51 +0000
@@ -1238,7 +1238,7 @@ dict_col_name_is_reserved(
ulint i;
for (i = 0; i < UT_ARR_SIZE(reserved_names); i++) {
- if (strcmp(name, reserved_names[i]) == 0) {
+ if (innobase_strcasecmp(name, reserved_names[i]) == 0) {
return(TRUE);
}
=== modified file 'storage/xtradb/handler/ha_innodb.cc'
--- a/storage/xtradb/handler/ha_innodb.cc 2009-09-09 21:06:57 +0000
+++ b/storage/xtradb/handler/ha_innodb.cc 2009-11-16 20:49:51 +0000
@@ -111,6 +111,7 @@ static ulong commit_threads = 0;
static pthread_mutex_t commit_threads_m;
static pthread_cond_t commit_cond;
static pthread_mutex_t commit_cond_m;
+static pthread_mutex_t analyze_mutex;
static bool innodb_inited = 0;
#define INSIDE_HA_INNOBASE_CC
@@ -234,6 +235,9 @@ static int innobase_release_savepoint(ha
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
+/* "GEN_CLUST_INDEX" is the name reserved for Innodb default
+system primary index. */
+static const char innobase_index_reserve_name[]= "GEN_CLUST_INDEX";
/****************************************************************
Validate the file format name and return its corresponding id. */
@@ -2393,6 +2397,7 @@ skip_overwrite:
pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&analyze_mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&commit_cond, NULL);
innodb_inited= 1;
#ifdef MYSQL_DYNAMIC_PLUGIN
@@ -2444,6 +2449,7 @@ innobase_end(handlerton *hton, ha_panic_
pthread_mutex_destroy(&prepare_commit_mutex);
pthread_mutex_destroy(&commit_threads_m);
pthread_mutex_destroy(&commit_cond_m);
+ pthread_mutex_destroy(&analyze_mutex);
pthread_cond_destroy(&commit_cond);
}
@@ -3837,7 +3843,11 @@ ha_innobase::store_key_val_for_row(
} else if (mysql_type == MYSQL_TYPE_TINY_BLOB
|| mysql_type == MYSQL_TYPE_MEDIUM_BLOB
|| mysql_type == MYSQL_TYPE_BLOB
- || mysql_type == MYSQL_TYPE_LONG_BLOB) {
+ || mysql_type == MYSQL_TYPE_LONG_BLOB
+ /* MYSQL_TYPE_GEOMETRY data is treated
+ as BLOB data in innodb. */
+ || mysql_type == MYSQL_TYPE_GEOMETRY) {
+
CHARSET_INFO* cs;
ulint key_len;
@@ -5818,6 +5828,28 @@ create_table_def(
}
}
+ /* First check whether the column to be added has a
+ system reserved name. */
+ if (dict_col_name_is_reserved(field->field_name)){
+ push_warning_printf(
+ (THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_CREATE_TABLE,
+ "Error creating table '%s' with "
+ "column name '%s'. '%s' is a "
+ "reserved name. Please try to "
+ "re-create the table with a "
+ "different column name.",
+ table->name, (char*) field->field_name,
+ (char*) field->field_name);
+
+ dict_mem_table_free(table);
+ trx_commit_for_mysql(trx);
+
+ error = DB_ERROR;
+ goto error_ret;
+ }
+
dict_mem_table_add_col(table, table->heap,
(char*) field->field_name,
col_type,
@@ -5831,6 +5863,7 @@ create_table_def(
error = row_create_table_for_mysql(table, trx);
+error_ret:
error = convert_error_code_to_mysql(error, flags, NULL);
DBUG_RETURN(error);
@@ -5869,6 +5902,9 @@ create_index(
n_fields = key->key_parts;
+ /* Assert that "GEN_CLUST_INDEX" cannot be used as non-primary index */
+ ut_a(innobase_strcasecmp(key->name, innobase_index_reserve_name) != 0);
+
ind_type = 0;
if (key_num == form->s->primary_key) {
@@ -5978,7 +6014,8 @@ create_clustered_index_when_no_primary(
/* We pass 0 as the space id, and determine at a lower level the space
id where to store the table */
- index = dict_mem_index_create(table_name, "GEN_CLUST_INDEX",
+ index = dict_mem_index_create(table_name,
+ innobase_index_reserve_name,
0, DICT_CLUSTERED, 0);
error = row_create_index_for_mysql(index, trx, NULL);
@@ -6404,14 +6441,6 @@ ha_innobase::create(
flags = DICT_TF_COMPACT;
}
- error = create_table_def(trx, form, norm_name,
- create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL,
- flags);
-
- if (error) {
- goto cleanup;
- }
-
/* Look for a primary key */
primary_key_no= (form->s->primary_key != MAX_KEY ?
@@ -6421,7 +6450,23 @@ ha_innobase::create(
/* Our function row_get_mysql_key_number_for_index assumes
the primary key is always number 0, if it exists */
- DBUG_ASSERT(primary_key_no == -1 || primary_key_no == 0);
+ ut_a(primary_key_no == -1 || primary_key_no == 0);
+
+ /* Check for name conflicts (with reserved name) for
+ any user indices to be created. */
+ if (innobase_index_name_is_reserved(trx, form->key_info,
+ form->s->keys)) {
+ error = -1;
+ goto cleanup;
+ }
+
+ error = create_table_def(trx, form, norm_name,
+ create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL,
+ flags);
+
+ if (error) {
+ goto cleanup;
+ }
/* Create the keys */
@@ -6496,18 +6541,22 @@ ha_innobase::create(
setup at this stage and so we use thd. */
/* We need to copy the AUTOINC value from the old table if
- this is an ALTER TABLE. */
+ this is an ALTER TABLE or CREATE INDEX because CREATE INDEX
+ does a table copy too. */
if (((create_info->used_fields & HA_CREATE_USED_AUTO)
- || thd_sql_command(thd) == SQLCOM_ALTER_TABLE)
- && create_info->auto_increment_value != 0) {
-
- /* Query was ALTER TABLE...AUTO_INCREMENT = x; or
- CREATE TABLE ...AUTO_INCREMENT = x; Find out a table
- definition from the dictionary and get the current value
- of the auto increment field. Set a new value to the
- auto increment field if the value is greater than the
- maximum value in the column. */
+ || thd_sql_command(thd) == SQLCOM_ALTER_TABLE
+ || thd_sql_command(thd) == SQLCOM_CREATE_INDEX)
+ && create_info->auto_increment_value > 0) {
+
+ /* Query was one of :
+ CREATE TABLE ...AUTO_INCREMENT = x; or
+ ALTER TABLE...AUTO_INCREMENT = x; or
+ CREATE INDEX x on t(...);
+ Find out a table definition from the dictionary and get
+ the current value of the auto increment field. Set a new
+ value to the auto increment field if the value is greater
+ than the maximum value in the column. */
auto_inc_value = create_info->auto_increment_value;
@@ -7367,9 +7416,15 @@ ha_innobase::analyze(
THD* thd, /* in: connection thread handle */
HA_CHECK_OPT* check_opt) /* in: currently ignored */
{
+ /* Serialize ANALYZE TABLE inside InnoDB, see
+ Bug#38996 Race condition in ANALYZE TABLE */
+ pthread_mutex_lock(&analyze_mutex);
+
/* Simply call ::info() with all the flags */
info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
+ pthread_mutex_unlock(&analyze_mutex);
+
return(0);
}
@@ -7965,8 +8020,9 @@ ha_innobase::external_lock(
{
ulong const binlog_format= thd_binlog_format(thd);
ulong const tx_isolation = thd_tx_isolation(ha_thd());
- if (tx_isolation <= ISO_READ_COMMITTED &&
- binlog_format == BINLOG_FORMAT_STMT)
+ if (tx_isolation <= ISO_READ_COMMITTED
+ && binlog_format == BINLOG_FORMAT_STMT
+ && thd_binlog_filter_ok(thd))
{
char buf[256];
my_snprintf(buf, sizeof(buf),
@@ -8843,6 +8899,7 @@ ha_innobase::get_auto_increment(
AUTOINC counter after attempting to insert the row. */
if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) {
ulonglong need;
+ ulonglong current;
ulonglong next_value;
ulonglong col_max_value;
@@ -8851,11 +8908,13 @@ ha_innobase::get_auto_increment(
col_max_value = innobase_get_int_col_max_value(
table->next_number_field);
+ current = *first_value > col_max_value ? autoinc : *first_value;
+
need = *nb_reserved_values * increment;
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
- *first_value, need, offset, col_max_value);
+ current, need, offset, col_max_value);
prebuilt->autoinc_last_value = next_value;
@@ -9851,6 +9910,49 @@ static int show_innodb_vars(THD *thd, SH
return 0;
}
+/***********************************************************************
+This function checks each index name for a table against reserved
+system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
+this function pushes an warning message to the client, and returns true. */
+extern "C" UNIV_INTERN
+bool
+innobase_index_name_is_reserved(
+/*============================*/
+ /* out: true if an index name
+ matches the reserved name */
+ const trx_t* trx, /* in: InnoDB transaction handle */
+ const KEY* key_info, /* in: Indexes to be created */
+ ulint num_of_keys) /* in: Number of indexes to
+ be created. */
+{
+ const KEY* key;
+ uint key_num; /* index number */
+
+ for (key_num = 0; key_num < num_of_keys; key_num++) {
+ key = &key_info[key_num];
+
+ if (innobase_strcasecmp(key->name,
+ innobase_index_reserve_name) == 0) {
+ /* Push warning to mysql */
+ push_warning_printf((THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WRONG_NAME_FOR_INDEX,
+ "Cannot Create Index with name "
+ "'%s'. The name is reserved "
+ "for the system default primary "
+ "index.",
+ innobase_index_reserve_name);
+
+ my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0),
+ innobase_index_reserve_name);
+
+ return(true);
+ }
+ }
+
+ return(false);
+}
+
static SHOW_VAR innodb_status_variables_export[]= {
{"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
=== modified file 'storage/xtradb/handler/ha_innodb.h'
--- a/storage/xtradb/handler/ha_innodb.h 2009-03-26 06:11:11 +0000
+++ b/storage/xtradb/handler/ha_innodb.h 2009-11-16 20:49:51 +0000
@@ -257,6 +257,13 @@ int thd_binlog_format(const MYSQL_THD th
@param all TRUE <=> rollback main transaction.
*/
void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
+
+/**
+ Check if binary logging is filtered for thread's current db.
+ @param thd Thread handle
+ @retval 1 the query is not filtered, 0 otherwise.
+*/
+bool thd_binlog_filter_ok(const MYSQL_THD thd);
}
typedef struct trx_struct trx_t;
@@ -281,3 +288,19 @@ innobase_trx_allocate(
/*==================*/
/* out: InnoDB transaction handle */
MYSQL_THD thd); /* in: user thread handle */
+/*********************************************************************//**
+This function checks each index name for a table against reserved
+system default primary index name 'GEN_CLUST_INDEX'. If a name
+matches, this function pushes an warning message to the client,
+and returns true. */
+extern "C"
+bool
+innobase_index_name_is_reserved(
+/*============================*/
+ /* out: true if the index name
+ matches the reserved name */
+ const trx_t* trx, /* in: InnoDB transaction handle */
+ const KEY* key_info, /* in: Indexes to be created */
+ ulint num_of_keys); /* in: Number of indexes to
+ be created. */
+
=== modified file 'storage/xtradb/handler/handler0alter.cc'
--- a/storage/xtradb/handler/handler0alter.cc 2009-03-26 06:11:11 +0000
+++ b/storage/xtradb/handler/handler0alter.cc 2009-11-16 20:49:51 +0000
@@ -655,9 +655,13 @@ ha_innobase::add_index(
innodb_table = indexed_table
= dict_table_get(prebuilt->table->name, FALSE);
- /* Check that index keys are sensible */
-
- error = innobase_check_index_keys(key_info, num_of_keys);
+ /* Check if the index name is reserved. */
+ if (innobase_index_name_is_reserved(trx, key_info, num_of_keys)) {
+ error = ER_WRONG_NAME_FOR_INDEX;
+ } else {
+ /* Check that index keys are sensible */
+ error = innobase_check_index_keys(key_info, num_of_keys);
+ }
if (UNIV_UNLIKELY(error)) {
err_exit:
=== modified file 'strings/ctype-simple.c'
--- a/strings/ctype-simple.c 2009-02-13 16:41:47 +0000
+++ b/strings/ctype-simple.c 2009-10-12 07:43:15 +0000
@@ -185,8 +185,8 @@ int my_strnncollsp_simple(CHARSET_INFO *
}
for (end= a + a_length-length; a < end ; a++)
{
- if (map[*a] != ' ')
- return (map[*a] < ' ') ? -swap : swap;
+ if (map[*a] != map[' '])
+ return (map[*a] < map[' ']) ? -swap : swap;
}
}
return res;
=== modified file 'strings/ctype-uca.c'
--- a/strings/ctype-uca.c 2009-09-07 20:50:10 +0000
+++ b/strings/ctype-uca.c 2009-11-16 20:49:51 +0000
@@ -7858,6 +7858,9 @@ static my_bool create_tailoring(CHARSET_
return 1;
}
+ if (!cs->caseinfo)
+ cs->caseinfo= my_unicase_default;
+
if (!(newweights= (uint16**) (*alloc)(256*sizeof(uint16*))))
return 1;
bzero(newweights, 256*sizeof(uint16*));
=== modified file 'support-files/binary-configure.sh'
--- a/support-files/binary-configure.sh 2003-03-21 16:53:55 +0000
+++ b/support-files/binary-configure.sh 2009-09-28 14:14:33 +0000
@@ -1,4 +1,28 @@
#!/bin/sh
+
+SCRIPT_NAME="`basename $0`"
+
+usage()
+{
+ echo "Usage: ${SCRIPT_NAME} [--help|-h]"
+ echo ""
+ echo "This script creates the MySQL system tables and starts the server."
+}
+
+for arg do
+ case "$arg" in
+ --help|-h)
+ usage
+ exit 0
+ ;;
+ *)
+ echo "${SCRIPT_NAME}: unknown option $arg"
+ usage
+ exit 2
+ ;;
+ esac
+done
+
if test ! -x ./scripts/mysql_install_db
then
echo "I didn't find the script './scripts/mysql_install_db'."
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c 2009-11-06 17:22:32 +0000
+++ b/tests/mysql_client_test.c 2009-11-16 20:49:51 +0000
@@ -49,6 +49,9 @@ static char *opt_user= 0;
static char *opt_password= 0;
static char *opt_host= 0;
static char *opt_unix_socket= 0;
+#ifdef HAVE_SMEM
+static char *shared_memory_base_name= 0;
+#endif
static unsigned int opt_port;
static my_bool tty_password= 0, opt_silent= 0;
@@ -233,6 +236,26 @@ static void print_st_error(MYSQL_STMT *s
}
}
+/*
+ Enhanced version of mysql_client_init(), which may also set shared memory
+ base on Windows.
+*/
+static MYSQL *mysql_client_init(MYSQL* con)
+{
+ MYSQL* res = mysql_init(con);
+#ifdef HAVE_SMEM
+ if (res && shared_memory_base_name)
+ mysql_options(res, MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name);
+#endif
+ return res;
+}
+
+/*
+ Disable direct calls of mysql_init, as it disregards shared memory base.
+*/
+#define mysql_init(A) Please use mysql_client_init instead of mysql_init
+
+
/* Check if the connection has InnoDB tables */
static my_bool check_have_innodb(MYSQL *conn)
@@ -296,10 +319,10 @@ static MYSQL* client_connect(ulong flag,
fprintf(stdout, "\n Establishing a connection to '%s' ...",
opt_host ? opt_host : "");
- if (!(mysql= mysql_init(NULL)))
+ if (!(mysql= mysql_client_init(NULL)))
{
opt_silent= 0;
- myerror("mysql_init() failed");
+ myerror("mysql_client_init() failed");
exit(1);
}
/* enable local infile, in non-binary builds often disabled by default */
@@ -1165,9 +1188,9 @@ static my_bool thread_query(const char *
error= 0;
if (!opt_silent)
fprintf(stdout, "\n in thread_query(%s)", query);
- if (!(l_mysql= mysql_init(NULL)))
+ if (!(l_mysql= mysql_client_init(NULL)))
{
- myerror("mysql_init() failed");
+ myerror("mysql_client_init() failed");
return 1;
}
if (!(mysql_real_connect(l_mysql, opt_host, opt_user,
@@ -2517,9 +2540,9 @@ static void test_ps_query_cache()
case TEST_QCACHE_ON_WITH_OTHER_CONN:
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
- if (!(lmysql= mysql_init(NULL)))
+ if (!(lmysql= mysql_client_init(NULL)))
{
- printf("mysql_init() failed");
+ printf("mysql_client_init() failed");
DIE_UNLESS(0);
}
if (!(mysql_real_connect(lmysql, opt_host, opt_user,
@@ -4965,9 +4988,9 @@ static void test_stmt_close()
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
- if (!(lmysql= mysql_init(NULL)))
+ if (!(lmysql= mysql_client_init(NULL)))
{
- myerror("mysql_init() failed");
+ myerror("mysql_client_init() failed");
exit(1);
}
if (!(mysql_real_connect(lmysql, opt_host, opt_user,
@@ -5856,9 +5879,9 @@ DROP TABLE IF EXISTS test_multi_tab";
rc= mysql_more_results(mysql);
DIE_UNLESS(rc == 0);
- if (!(mysql_local= mysql_init(NULL)))
+ if (!(mysql_local= mysql_client_init(NULL)))
{
- fprintf(stdout, "\n mysql_init() failed");
+ fprintf(stdout, "\n mysql_client_init() failed");
exit(1);
}
@@ -5981,9 +6004,9 @@ static void test_prepare_multi_statement
char query[MAX_TEST_QUERY_LENGTH];
myheader("test_prepare_multi_statements");
- if (!(mysql_local= mysql_init(NULL)))
+ if (!(mysql_local= mysql_client_init(NULL)))
{
- fprintf(stderr, "\n mysql_init() failed");
+ fprintf(stderr, "\n mysql_client_init() failed");
exit(1);
}
@@ -7464,9 +7487,9 @@ static void test_prepare_grant()
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
- if (!(lmysql= mysql_init(NULL)))
+ if (!(lmysql= mysql_client_init(NULL)))
{
- myerror("mysql_init() failed");
+ myerror("mysql_client_init() failed");
exit(1);
}
if (!(mysql_real_connect(lmysql, opt_host, "test_grant",
@@ -7921,9 +7944,9 @@ static void test_drop_temp()
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
- if (!(lmysql= mysql_init(NULL)))
+ if (!(lmysql= mysql_client_init(NULL)))
{
- myerror("mysql_init() failed");
+ myerror("mysql_client_init() failed");
exit(1);
}
@@ -13165,7 +13188,7 @@ static void test_bug15518()
int rc;
myheader("test_bug15518");
- mysql1= mysql_init(NULL);
+ mysql1= mysql_client_init(NULL);
if (!mysql_real_connect(mysql1, opt_host, opt_user, opt_password,
opt_db ? opt_db : "test", opt_port, opt_unix_socket,
@@ -13321,9 +13344,9 @@ static void test_bug8378()
if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ...");
- if (!(lmysql= mysql_init(NULL)))
+ if (!(lmysql= mysql_client_init(NULL)))
{
- myerror("mysql_init() failed");
+ myerror("mysql_client_init() failed");
exit(1);
}
if (mysql_options(lmysql, MYSQL_SET_CHARSET_NAME, "gbk"))
@@ -13862,7 +13885,7 @@ static void test_bug9992()
if (!opt_silent)
printf("Establishing a connection with option CLIENT_MULTI_STATEMENTS..\n");
- mysql1= mysql_init(NULL);
+ mysql1= mysql_client_init(NULL);
if (!mysql_real_connect(mysql1, opt_host, opt_user, opt_password,
opt_db ? opt_db : "test", opt_port, opt_unix_socket,
@@ -14451,9 +14474,9 @@ static void test_bug12001()
myheader("test_bug12001");
- if (!(mysql_local= mysql_init(NULL)))
+ if (!(mysql_local= mysql_client_init(NULL)))
{
- fprintf(stdout, "\n mysql_init() failed");
+ fprintf(stdout, "\n mysql_client_init() failed");
exit(1);
}
@@ -15178,9 +15201,9 @@ static void test_opt_reconnect()
myheader("test_opt_reconnect");
- if (!(lmysql= mysql_init(NULL)))
+ if (!(lmysql= mysql_client_init(NULL)))
{
- myerror("mysql_init() failed");
+ myerror("mysql_client_init() failed");
exit(1);
}
@@ -15215,9 +15238,9 @@ static void test_opt_reconnect()
mysql_close(lmysql);
- if (!(lmysql= mysql_init(NULL)))
+ if (!(lmysql= mysql_client_init(NULL)))
{
- myerror("mysql_init() failed");
+ myerror("mysql_client_init() failed");
DIE_UNLESS(0);
}
@@ -15252,7 +15275,7 @@ static void test_bug12744()
int rc;
myheader("test_bug12744");
- lmysql= mysql_init(NULL);
+ lmysql= mysql_client_init(NULL);
DIE_UNLESS(lmysql);
if (!mysql_real_connect(lmysql, opt_host, opt_user, opt_password,
@@ -15825,7 +15848,7 @@ static void test_bug15752()
rc= mysql_query(mysql, "create procedure p1() select 1");
myquery(rc);
- mysql_init(&mysql_local);
+ mysql_client_init(&mysql_local);
if (! mysql_real_connect(&mysql_local, opt_host, opt_user,
opt_password, current_db, opt_port,
opt_unix_socket,
@@ -16712,7 +16735,7 @@ static void test_bug29692()
{
MYSQL* conn;
- if (!(conn= mysql_init(NULL)))
+ if (!(conn= mysql_client_init(NULL)))
{
myerror("test_bug29692 init failed");
exit(1);
@@ -16847,7 +16870,7 @@ static void test_bug30472()
/* Create a new connection. */
- DIE_UNLESS(mysql_init(&con));
+ DIE_UNLESS(mysql_client_init(&con));
DIE_UNLESS(mysql_real_connect(&con,
opt_host,
@@ -17021,7 +17044,7 @@ static void test_bug20023()
/* Create a new connection. */
- DIE_UNLESS(mysql_init(&con));
+ DIE_UNLESS(mysql_client_init(&con));
DIE_UNLESS(mysql_real_connect(&con,
opt_host,
@@ -17158,7 +17181,7 @@ static void bug31418_impl()
/* Create a new connection. */
- DIE_UNLESS(mysql_init(&con));
+ DIE_UNLESS(mysql_client_init(&con));
DIE_UNLESS(mysql_real_connect(&con,
opt_host,
@@ -18008,7 +18031,7 @@ static void test_bug44495()
"END;");
myquery(rc);
- DIE_UNLESS(mysql_init(&con));
+ DIE_UNLESS(mysql_client_init(&con));
DIE_UNLESS(mysql_real_connect(&con, opt_host, opt_user, opt_password,
current_db, opt_port, opt_unix_socket,
@@ -18071,6 +18094,11 @@ static struct my_option client_test_long
0, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
0},
+#ifdef HAVE_SMEM
+ {"shared-memory-base-name", 'm', "Base name of shared memory.",
+ (uchar**) &shared_memory_base_name, (uchar**)&shared_memory_base_name, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{"socket", 'S', "Socket file to use for connection",
(uchar **) &opt_unix_socket, (uchar **) &opt_unix_socket, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
=== modified file 'unittest/mysys/Makefile.am'
--- a/unittest/mysys/Makefile.am 2008-08-29 18:51:02 +0000
+++ b/unittest/mysys/Makefile.am 2009-11-16 20:49:51 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (C) 2009 Sun Microsystems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,6 +26,14 @@ LDADD = $(top_builddir)/unittest/mytap
$(top_builddir)/strings/libmystrings.a
EXTRA_DIST = CMakeLists.txt
+noinst_PROGRAMS = bitmap-t base64-t
+
+if NEED_THREAD
+# my_atomic-t is used to check thread functions, so it is safe to
+# ignore the file in non-threaded builds.
+# In fact, it will not compile without thread support.
+noinst_PROGRAMS += my_atomic-t
+endif
# Don't update the files from bitkeeper
%::SCCS/s.%
=== modified file 'vio/vio.c'
--- a/vio/vio.c 2007-05-10 09:59:39 +0000
+++ b/vio/vio.c 2009-11-02 22:19:58 +0000
@@ -43,7 +43,7 @@ static void vio_init(Vio* vio, enum enum
if ((flags & VIO_BUFFERED_READ) &&
!(vio->read_buffer= (char*)my_malloc(VIO_READ_BUFFER_SIZE, MYF(MY_WME))))
flags&= ~VIO_BUFFERED_READ;
-#ifdef __WIN__
+#ifdef _WIN32
if (type == VIO_TYPE_NAMEDPIPE)
{
vio->viodelete =vio_delete;
@@ -59,9 +59,16 @@ static void vio_init(Vio* vio, enum enum
vio->in_addr =vio_in_addr;
vio->vioblocking =vio_blocking;
vio->is_blocking =vio_is_blocking;
- vio->timeout =vio_ignore_timeout;
+
+ vio->timeout=vio_win32_timeout;
+ /* Set default timeout */
+ vio->read_timeout_millis = INFINITE;
+ vio->write_timeout_millis = INFINITE;
+
+ memset(&(vio->pipe_overlapped), 0, sizeof(OVERLAPPED));
+ vio->pipe_overlapped.hEvent= CreateEvent(NULL, TRUE, FALSE, NULL);
+ DBUG_VOID_RETURN;
}
- else /* default is VIO_TYPE_TCPIP */
#endif
#ifdef HAVE_SMEM
if (type == VIO_TYPE_SHARED_MEMORY)
@@ -79,9 +86,14 @@ static void vio_init(Vio* vio, enum enum
vio->in_addr =vio_in_addr;
vio->vioblocking =vio_blocking;
vio->is_blocking =vio_is_blocking;
- vio->timeout =vio_ignore_timeout;
+
+ /* Currently, shared memory is on Windows only, hence the below is ok*/
+ vio->timeout= vio_win32_timeout;
+ /* Set default timeout */
+ vio->read_timeout_millis= INFINITE;
+ vio->write_timeout_millis= INFINITE;
+ DBUG_VOID_RETURN;
}
- else
#endif
#ifdef HAVE_OPENSSL
if (type == VIO_TYPE_SSL)
@@ -100,8 +112,8 @@ static void vio_init(Vio* vio, enum enum
vio->vioblocking =vio_ssl_blocking;
vio->is_blocking =vio_is_blocking;
vio->timeout =vio_timeout;
+ DBUG_VOID_RETURN;
}
- else /* default is VIO_TYPE_TCPIP */
#endif /* HAVE_OPENSSL */
{
vio->viodelete =vio_delete;
@@ -193,7 +205,7 @@ Vio *vio_new_win32pipe(HANDLE hPipe)
}
#ifdef HAVE_SMEM
-Vio *vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, HANDLE handle_map,
+Vio *vio_new_win32shared_memory(HANDLE handle_file_map, HANDLE handle_map,
HANDLE event_server_wrote, HANDLE event_server_read,
HANDLE event_client_wrote, HANDLE event_client_read,
HANDLE event_conn_closed)
@@ -212,7 +224,6 @@ Vio *vio_new_win32shared_memory(NET *net
vio->event_conn_closed= event_conn_closed;
vio->shared_memory_remain= 0;
vio->shared_memory_pos= handle_map;
- vio->net= net;
strmov(vio->desc, "shared memory");
}
DBUG_RETURN(vio);
=== modified file 'vio/vio_priv.h'
--- a/vio/vio_priv.h 2007-06-05 15:51:30 +0000
+++ b/vio/vio_priv.h 2009-11-02 22:19:58 +0000
@@ -22,7 +22,10 @@
#include <m_string.h>
#include <violite.h>
-void vio_ignore_timeout(Vio *vio, uint which, uint timeout);
+#ifdef _WIN32
+void vio_win32_timeout(Vio *vio, uint which, uint timeout);
+#endif
+
void vio_timeout(Vio *vio,uint which, uint timeout);
#ifdef HAVE_OPENSSL
=== modified file 'vio/viosocket.c'
--- a/vio/viosocket.c 2009-09-25 06:42:43 +0000
+++ b/vio/viosocket.c 2009-11-16 20:49:51 +0000
@@ -261,19 +261,13 @@ int vio_close(Vio * vio)
{
int r=0;
DBUG_ENTER("vio_close");
-#ifdef __WIN__
- if (vio->type == VIO_TYPE_NAMEDPIPE)
- {
-#if defined(__NT__) && defined(MYSQL_SERVER)
- CancelIo(vio->hPipe);
- DisconnectNamedPipe(vio->hPipe);
-#endif
- r=CloseHandle(vio->hPipe);
- }
- else
-#endif /* __WIN__ */
+
if (vio->type != VIO_CLOSED)
{
+ DBUG_ASSERT(vio->type == VIO_TYPE_TCPIP ||
+ vio->type == VIO_TYPE_SOCKET ||
+ vio->type == VIO_TYPE_SSL);
+
DBUG_ASSERT(vio->sd >= 0);
if (shutdown(vio->sd, SHUT_RDWR))
r= -1;
@@ -430,44 +424,97 @@ void vio_timeout(Vio *vio, uint which, u
#ifdef __WIN__
-size_t vio_read_pipe(Vio * vio, uchar* buf, size_t size)
+
+/*
+ Finish pending IO on pipe. Honor wait timeout
+*/
+static int pipe_complete_io(Vio* vio, char* buf, size_t size, DWORD timeout_millis)
{
DWORD length;
+ DWORD ret;
+
+ DBUG_ENTER("pipe_complete_io");
+
+ ret= WaitForSingleObject(vio->pipe_overlapped.hEvent, timeout_millis);
+ /*
+ WaitForSingleObjects will normally return WAIT_OBJECT_O (success, IO completed)
+ or WAIT_TIMEOUT.
+ */
+ if(ret != WAIT_OBJECT_0)
+ {
+ CancelIo(vio->hPipe);
+ DBUG_PRINT("error",("WaitForSingleObject() returned %d", ret));
+ DBUG_RETURN(-1);
+ }
+
+ if (!GetOverlappedResult(vio->hPipe,&(vio->pipe_overlapped),&length, FALSE))
+ {
+ DBUG_PRINT("error",("GetOverlappedResult() returned last error %d",
+ GetLastError()));
+ DBUG_RETURN(-1);
+ }
+
+ DBUG_RETURN(length);
+}
+
+
+size_t vio_read_pipe(Vio * vio, uchar *buf, size_t size)
+{
+ DWORD bytes_read;
DBUG_ENTER("vio_read_pipe");
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
(uint) size));
- if (!ReadFile(vio->hPipe, buf, size, &length, NULL))
- DBUG_RETURN(-1);
+ if (!ReadFile(vio->hPipe, buf, (DWORD)size, &bytes_read,
+ &(vio->pipe_overlapped)))
+ {
+ if (GetLastError() != ERROR_IO_PENDING)
+ {
+ DBUG_PRINT("error",("ReadFile() returned last error %d",
+ GetLastError()));
+ DBUG_RETURN((size_t)-1);
+ }
+ bytes_read= pipe_complete_io(vio, buf, size,vio->read_timeout_millis);
+ }
- DBUG_PRINT("exit", ("%d", length));
- DBUG_RETURN((size_t) length);
+ DBUG_PRINT("exit", ("%d", bytes_read));
+ DBUG_RETURN(bytes_read);
}
size_t vio_write_pipe(Vio * vio, const uchar* buf, size_t size)
{
- DWORD length;
+ DWORD bytes_written;
DBUG_ENTER("vio_write_pipe");
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
(uint) size));
- if (!WriteFile(vio->hPipe, (char*) buf, size, &length, NULL))
- DBUG_RETURN(-1);
+ if (!WriteFile(vio->hPipe, buf, (DWORD)size, &bytes_written,
+ &(vio->pipe_overlapped)))
+ {
+ if (GetLastError() != ERROR_IO_PENDING)
+ {
+ DBUG_PRINT("vio_error",("WriteFile() returned last error %d",
+ GetLastError()));
+ DBUG_RETURN((size_t)-1);
+ }
+ bytes_written = pipe_complete_io(vio, (char *)buf, size,
+ vio->write_timeout_millis);
+ }
- DBUG_PRINT("exit", ("%d", length));
- DBUG_RETURN((size_t) length);
+ DBUG_PRINT("exit", ("%d", bytes_written));
+ DBUG_RETURN(bytes_written);
}
+
int vio_close_pipe(Vio * vio)
{
int r;
DBUG_ENTER("vio_close_pipe");
-#if defined(__NT__) && defined(MYSQL_SERVER)
- CancelIo(vio->hPipe);
+
+ CloseHandle(vio->pipe_overlapped.hEvent);
DisconnectNamedPipe(vio->hPipe);
-#endif
- r=CloseHandle(vio->hPipe);
+ r= CloseHandle(vio->hPipe);
if (r)
{
DBUG_PRINT("vio_error", ("close() failed, error: %d",GetLastError()));
@@ -479,10 +526,23 @@ int vio_close_pipe(Vio * vio)
}
-void vio_ignore_timeout(Vio *vio __attribute__((unused)),
- uint which __attribute__((unused)),
- uint timeout __attribute__((unused)))
+void vio_win32_timeout(Vio *vio, uint which , uint timeout_sec)
{
+ DWORD timeout_millis;
+ /*
+ Windows is measuring timeouts in milliseconds. Check for possible int
+ overflow.
+ */
+ if (timeout_sec > UINT_MAX/1000)
+ timeout_millis= INFINITE;
+ else
+ timeout_millis= timeout_sec * 1000;
+
+ /* which == 1 means "write", which == 0 means "read".*/
+ if(which)
+ vio->write_timeout_millis= timeout_millis;
+ else
+ vio->read_timeout_millis= timeout_millis;
}
@@ -517,7 +577,7 @@ size_t vio_read_shared_memory(Vio * vio,
WAIT_ABANDONED_0 and WAIT_TIMEOUT - fail. We can't read anything
*/
if (WaitForMultipleObjects(array_elements(events), events, FALSE,
- vio->net->read_timeout*1000) != WAIT_OBJECT_0)
+ vio->read_timeout_millis) != WAIT_OBJECT_0)
{
DBUG_RETURN(-1);
};
@@ -574,7 +634,7 @@ size_t vio_write_shared_memory(Vio * vio
while (remain != 0)
{
if (WaitForMultipleObjects(array_elements(events), events, FALSE,
- vio->net->write_timeout*1000) != WAIT_OBJECT_0)
+ vio->write_timeout_millis) != WAIT_OBJECT_0)
{
DBUG_RETURN((size_t) -1);
}
=== modified file 'vio/viosslfactories.c'
--- a/vio/viosslfactories.c 2009-07-23 11:53:28 +0000
+++ b/vio/viosslfactories.c 2009-10-27 13:20:34 +0000
@@ -144,55 +144,6 @@ vio_set_cert_stuff(SSL_CTX *ctx, const c
}
-static int
-vio_verify_callback(int ok, X509_STORE_CTX *ctx)
-{
- char buf[256];
- X509 *err_cert;
-
- DBUG_ENTER("vio_verify_callback");
- DBUG_PRINT("enter", ("ok: %d ctx: 0x%lx", ok, (long) ctx));
-
- err_cert= X509_STORE_CTX_get_current_cert(ctx);
- X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof(buf));
- DBUG_PRINT("info", ("cert: %s", buf));
- if (!ok)
- {
- int err, depth;
- err= X509_STORE_CTX_get_error(ctx);
- depth= X509_STORE_CTX_get_error_depth(ctx);
-
- DBUG_PRINT("error",("verify error: %d '%s'",err,
- X509_verify_cert_error_string(err)));
- /*
- Approve cert if depth is greater then "verify_depth", currently
- verify_depth is always 0 and there is no way to increase it.
- */
- if (verify_depth >= depth)
- ok= 1;
- }
- switch (ctx->error)
- {
- case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
- X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf, 256);
- DBUG_PRINT("info",("issuer= %s\n", buf));
- break;
- case X509_V_ERR_CERT_NOT_YET_VALID:
- case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
- DBUG_PRINT("error", ("notBefore"));
- /*ASN1_TIME_print_fp(stderr,X509_get_notBefore(ctx->current_cert));*/
- break;
- case X509_V_ERR_CERT_HAS_EXPIRED:
- case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
- DBUG_PRINT("error", ("notAfter error"));
- /*ASN1_TIME_print_fp(stderr,X509_get_notAfter(ctx->current_cert));*/
- break;
- }
- DBUG_PRINT("exit", ("%d", ok));
- DBUG_RETURN(ok);
-}
-
-
#ifdef __NETWARE__
/* NetWare SSL cleanup */
@@ -354,11 +305,7 @@ new_VioSSLConnectorFd(const char *key_fi
/* Init the VioSSLFd as a "connector" ie. the client side */
- /*
- The verify_callback function is used to control the behaviour
- when the SSL_VERIFY_PEER flag is set.
- */
- SSL_CTX_set_verify(ssl_fd->ssl_context, verify, vio_verify_callback);
+ SSL_CTX_set_verify(ssl_fd->ssl_context, verify, NULL);
return ssl_fd;
}
@@ -382,11 +329,7 @@ new_VioSSLAcceptorFd(const char *key_fil
/* Set max number of cached sessions, returns the previous size */
SSL_CTX_sess_set_cache_size(ssl_fd->ssl_context, 128);
- /*
- The verify_callback function is used to control the behaviour
- when the SSL_VERIFY_PEER flag is set.
- */
- SSL_CTX_set_verify(ssl_fd->ssl_context, verify, vio_verify_callback);
+ SSL_CTX_set_verify(ssl_fd->ssl_context, verify, NULL);
/*
Set session_id - an identifier for this server session
1
0
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2765: Safety change to ensure read/black trees (used with heap tables) works on 64 bit setups where ulo...
by noreply@launchpad.net 16 Nov '09
by noreply@launchpad.net 16 Nov '09
16 Nov '09
------------------------------------------------------------
revno: 2765
committer: Michael Widenius <monty(a)mysql.com>
branch nick: maria-5.1
timestamp: Mon 2009-11-16 17:34:08 +0200
message:
Safety change to ensure read/black trees (used with heap tables) works on 64 bit setups where ulong <> size_t
Don't retry test cases by default
Fixed bug where we could (under unlikely error conditions) access not initialized variable
modified:
include/my_tree.h
mysql-test/mysql-test-run.pl
mysys/tree.c
sql/sql_delete.cc
--
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] Updated (by Knielsen): User-defined variables set that call UDFs (64)
by worklog-noreply@askmonty.org 15 Nov '09
by worklog-noreply@askmonty.org 15 Nov '09
15 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: User-defined variables set that call UDFs
CREATION DATE..: Sun, 15 Nov 2009, 19:22
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Monty
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 64 (http://askmonty.org/worklog/?tid=64)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Knielsen - Sun, 15 Nov 2009, 20:37)=-=-
High Level Description modified.
--- /tmp/wklog.64.old.21525 2009-11-15 18:37:23.000000000 +0000
+++ /tmp/wklog.64.new.21525 2009-11-15 18:37:23.000000000 +0000
@@ -9,4 +9,11 @@
But this would require a change to how variables are handled, and suggested I
create this worklog item.
+Comment by Sergei Golubchik:
+
+"This wouldn't require a change to how variables are handled, what it
+*would* require is WL#2974 (turning UDF into plugins).
+
+All plugins natively can add new server variables and execute any
+arbitrary code when they're assigned to."
DESCRIPTION:
I was talking to Monty about how with the memcached Functions for MySQL, I call:
mysql> do memc_servers_set('127.0.0.1:11211');
Instead, he suggests that it would be preferable to do:
set @@memc_servers = '127.0.0.1:11211';
But this would require a change to how variables are handled, and suggested I
create this worklog item.
Comment by Sergei Golubchik:
"This wouldn't require a change to how variables are handled, what it
*would* require is WL#2974 (turning UDF into plugins).
All plugins natively can add new server variables and execute any
arbitrary code when they're assigned to."
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Knielsen): User-defined variables set that call UDFs (64)
by worklog-noreply@askmonty.org 15 Nov '09
by worklog-noreply@askmonty.org 15 Nov '09
15 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: User-defined variables set that call UDFs
CREATION DATE..: Sun, 15 Nov 2009, 19:22
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Monty
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 64 (http://askmonty.org/worklog/?tid=64)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Knielsen - Sun, 15 Nov 2009, 20:37)=-=-
High Level Description modified.
--- /tmp/wklog.64.old.21525 2009-11-15 18:37:23.000000000 +0000
+++ /tmp/wklog.64.new.21525 2009-11-15 18:37:23.000000000 +0000
@@ -9,4 +9,11 @@
But this would require a change to how variables are handled, and suggested I
create this worklog item.
+Comment by Sergei Golubchik:
+
+"This wouldn't require a change to how variables are handled, what it
+*would* require is WL#2974 (turning UDF into plugins).
+
+All plugins natively can add new server variables and execute any
+arbitrary code when they're assigned to."
DESCRIPTION:
I was talking to Monty about how with the memcached Functions for MySQL, I call:
mysql> do memc_servers_set('127.0.0.1:11211');
Instead, he suggests that it would be preferable to do:
set @@memc_servers = '127.0.0.1:11211';
But this would require a change to how variables are handled, and suggested I
create this worklog item.
Comment by Sergei Golubchik:
"This wouldn't require a change to how variables are handled, what it
*would* require is WL#2974 (turning UDF into plugins).
All plugins natively can add new server variables and execute any
arbitrary code when they're assigned to."
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] New (by CaptTofu): User-defined variables set that call UDFs (64)
by worklog-noreply@askmonty.org 15 Nov '09
by worklog-noreply@askmonty.org 15 Nov '09
15 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: User-defined variables set that call UDFs
CREATION DATE..: Sun, 15 Nov 2009, 19:22
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Monty
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 64 (http://askmonty.org/worklog/?tid=64)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
DESCRIPTION:
I was talking to Monty about how with the memcached Functions for MySQL, I call:
mysql> do memc_servers_set('127.0.0.1:11211');
Instead, he suggests that it would be preferable to do:
set @@memc_servers = '127.0.0.1:11211';
But this would require a change to how variables are handled, and suggested I
create this worklog item.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
2
1
[Maria-developers] New (by CaptTofu): User-defined variables set that call UDFs (64)
by worklog-noreply@askmonty.org 15 Nov '09
by worklog-noreply@askmonty.org 15 Nov '09
15 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: User-defined variables set that call UDFs
CREATION DATE..: Sun, 15 Nov 2009, 19:22
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Monty
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 64 (http://askmonty.org/worklog/?tid=64)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
DESCRIPTION:
I was talking to Monty about how with the memcached Functions for MySQL, I call:
mysql> do memc_servers_set('127.0.0.1:11211');
Instead, he suggests that it would be preferable to do:
set @@memc_servers = '127.0.0.1:11211';
But this would require a change to how variables are handled, and suggested I
create this worklog item.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] [Branch ~maria-captains/maria/5.1] Rev 2764: Merge MariaDB 5.1.39 release, including XtraDB 8 merge, into MariaDB 5.1 trunk.
by noreply@launchpad.net 14 Nov '09
by noreply@launchpad.net 14 Nov '09
14 Nov '09
Merge authors:
Aleksandr Kuzminsky (akuzminsky)
Kristian Nielsen (knielsen)
------------------------------------------------------------
revno: 2764 [merge]
committer: knielsen(a)knielsen-hq.org
branch nick: mariadb-5.1
timestamp: Sat 2009-11-14 13:45:36 +0100
message:
Merge MariaDB 5.1.39 release, including XtraDB 8 merge, into MariaDB 5.1 trunk.
removed:
mysql-test/suite/innodb/r/innodb_file_format.result
mysql-test/suite/innodb/t/innodb_file_format.test
storage/xtradb/ut/ut0auxconf.c
added:
mysql-test/r/innodb_file_format.result
mysql-test/t/innodb_file_format.test
storage/xtradb/COPYING.Percona
storage/xtradb/COPYING.Sun_Microsystems
storage/xtradb/Doxyfile
storage/xtradb/include/fsp0types.h
storage/xtradb/ut/ut0auxconf_atomic_pthread_t_gcc.c
storage/xtradb/ut/ut0auxconf_atomic_pthread_t_solaris.c
storage/xtradb/ut/ut0auxconf_have_solaris_atomics.c
storage/xtradb/ut/ut0auxconf_pause.c
storage/xtradb/ut/ut0auxconf_sizeof_pthread_t.c
renamed:
mysql-test/suite/innodb/r/innodb_bug44032.result => mysql-test/r/innodb_bug44032.result
mysql-test/suite/innodb/t/innodb_bug44032.test => mysql-test/t/innodb_bug44032.test
modified:
configure.in
mysql-test/include/index_merge2.inc
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_myisam.result
mysql-test/r/innodb-autoinc.result
mysql-test/r/innodb-index.result
mysql-test/r/innodb.result
mysql-test/r/innodb_bug36169.result
mysql-test/t/innodb-autoinc.test
mysql-test/t/innodb-index.test
mysql-test/t/innodb.test
mysql-test/t/innodb_bug36169.test
mysql-test/t/innodb_bug36172.test
storage/federatedx/Makefile.am
storage/federatedx/ha_federatedx.cc
storage/xtradb/CMakeLists.txt
storage/xtradb/ChangeLog
storage/xtradb/Makefile.am
storage/xtradb/btr/btr0btr.c
storage/xtradb/btr/btr0cur.c
storage/xtradb/btr/btr0pcur.c
storage/xtradb/btr/btr0sea.c
storage/xtradb/buf/buf0buddy.c
storage/xtradb/buf/buf0buf.c
storage/xtradb/buf/buf0flu.c
storage/xtradb/buf/buf0lru.c
storage/xtradb/buf/buf0rea.c
storage/xtradb/data/data0data.c
storage/xtradb/data/data0type.c
storage/xtradb/dict/dict0boot.c
storage/xtradb/dict/dict0crea.c
storage/xtradb/dict/dict0dict.c
storage/xtradb/dict/dict0load.c
storage/xtradb/dict/dict0mem.c
storage/xtradb/dyn/dyn0dyn.c
storage/xtradb/eval/eval0eval.c
storage/xtradb/eval/eval0proc.c
storage/xtradb/fil/fil0fil.c
storage/xtradb/fsp/fsp0fsp.c
storage/xtradb/fut/fut0fut.c
storage/xtradb/fut/fut0lst.c
storage/xtradb/ha/ha0ha.c
storage/xtradb/ha/ha0storage.c
storage/xtradb/ha/hash0hash.c
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.h
storage/xtradb/handler/handler0alter.cc
storage/xtradb/handler/handler0vars.h
storage/xtradb/handler/i_s.cc
storage/xtradb/handler/i_s.h
storage/xtradb/handler/innodb_patch_info.h
storage/xtradb/handler/mysql_addons.cc
storage/xtradb/handler/win_delay_loader.cc
storage/xtradb/ibuf/ibuf0ibuf.c
storage/xtradb/include/btr0btr.h
storage/xtradb/include/btr0btr.ic
storage/xtradb/include/btr0cur.h
storage/xtradb/include/btr0cur.ic
storage/xtradb/include/btr0pcur.h
storage/xtradb/include/btr0pcur.ic
storage/xtradb/include/btr0sea.h
storage/xtradb/include/btr0sea.ic
storage/xtradb/include/btr0types.h
storage/xtradb/include/buf0buddy.h
storage/xtradb/include/buf0buddy.ic
storage/xtradb/include/buf0buf.h
storage/xtradb/include/buf0buf.ic
storage/xtradb/include/buf0flu.h
storage/xtradb/include/buf0flu.ic
storage/xtradb/include/buf0lru.h
storage/xtradb/include/buf0lru.ic
storage/xtradb/include/buf0rea.h
storage/xtradb/include/buf0types.h
storage/xtradb/include/data0data.h
storage/xtradb/include/data0data.ic
storage/xtradb/include/data0type.h
storage/xtradb/include/data0type.ic
storage/xtradb/include/data0types.h
storage/xtradb/include/db0err.h
storage/xtradb/include/dict0boot.h
storage/xtradb/include/dict0boot.ic
storage/xtradb/include/dict0crea.h
storage/xtradb/include/dict0crea.ic
storage/xtradb/include/dict0dict.h
storage/xtradb/include/dict0dict.ic
storage/xtradb/include/dict0load.h
storage/xtradb/include/dict0load.ic
storage/xtradb/include/dict0mem.h
storage/xtradb/include/dict0mem.ic
storage/xtradb/include/dict0types.h
storage/xtradb/include/dyn0dyn.h
storage/xtradb/include/dyn0dyn.ic
storage/xtradb/include/eval0eval.h
storage/xtradb/include/eval0eval.ic
storage/xtradb/include/eval0proc.h
storage/xtradb/include/eval0proc.ic
storage/xtradb/include/fil0fil.h
storage/xtradb/include/fsp0fsp.h
storage/xtradb/include/fsp0fsp.ic
storage/xtradb/include/fut0fut.h
storage/xtradb/include/fut0fut.ic
storage/xtradb/include/fut0lst.h
storage/xtradb/include/fut0lst.ic
storage/xtradb/include/ha0ha.h
storage/xtradb/include/ha0ha.ic
storage/xtradb/include/ha0storage.h
storage/xtradb/include/ha0storage.ic
storage/xtradb/include/ha_prototypes.h
storage/xtradb/include/handler0alter.h
storage/xtradb/include/hash0hash.h
storage/xtradb/include/hash0hash.ic
storage/xtradb/include/ibuf0ibuf.h
storage/xtradb/include/ibuf0ibuf.ic
storage/xtradb/include/ibuf0types.h
storage/xtradb/include/lock0iter.h
storage/xtradb/include/lock0lock.h
storage/xtradb/include/lock0lock.ic
storage/xtradb/include/lock0priv.h
storage/xtradb/include/lock0priv.ic
storage/xtradb/include/lock0types.h
storage/xtradb/include/log0log.h
storage/xtradb/include/log0log.ic
storage/xtradb/include/log0recv.h
storage/xtradb/include/log0recv.ic
storage/xtradb/include/mach0data.h
storage/xtradb/include/mach0data.ic
storage/xtradb/include/mem0dbg.h
storage/xtradb/include/mem0dbg.ic
storage/xtradb/include/mem0mem.h
storage/xtradb/include/mem0mem.ic
storage/xtradb/include/mem0pool.h
storage/xtradb/include/mem0pool.ic
storage/xtradb/include/mtr0log.h
storage/xtradb/include/mtr0log.ic
storage/xtradb/include/mtr0mtr.h
storage/xtradb/include/mtr0mtr.ic
storage/xtradb/include/mtr0types.h
storage/xtradb/include/mysql_addons.h
storage/xtradb/include/os0file.h
storage/xtradb/include/os0proc.h
storage/xtradb/include/os0proc.ic
storage/xtradb/include/os0sync.h
storage/xtradb/include/os0sync.ic
storage/xtradb/include/os0thread.h
storage/xtradb/include/os0thread.ic
storage/xtradb/include/page0cur.h
storage/xtradb/include/page0cur.ic
storage/xtradb/include/page0page.h
storage/xtradb/include/page0page.ic
storage/xtradb/include/page0types.h
storage/xtradb/include/page0zip.h
storage/xtradb/include/page0zip.ic
storage/xtradb/include/pars0opt.h
storage/xtradb/include/pars0opt.ic
storage/xtradb/include/pars0pars.h
storage/xtradb/include/pars0pars.ic
storage/xtradb/include/pars0sym.h
storage/xtradb/include/pars0sym.ic
storage/xtradb/include/pars0types.h
storage/xtradb/include/que0que.h
storage/xtradb/include/que0que.ic
storage/xtradb/include/que0types.h
storage/xtradb/include/read0read.h
storage/xtradb/include/read0read.ic
storage/xtradb/include/read0types.h
storage/xtradb/include/rem0cmp.h
storage/xtradb/include/rem0cmp.ic
storage/xtradb/include/rem0rec.h
storage/xtradb/include/rem0rec.ic
storage/xtradb/include/rem0types.h
storage/xtradb/include/row0ext.h
storage/xtradb/include/row0ext.ic
storage/xtradb/include/row0ins.h
storage/xtradb/include/row0ins.ic
storage/xtradb/include/row0merge.h
storage/xtradb/include/row0mysql.h
storage/xtradb/include/row0mysql.ic
storage/xtradb/include/row0purge.h
storage/xtradb/include/row0purge.ic
storage/xtradb/include/row0row.h
storage/xtradb/include/row0row.ic
storage/xtradb/include/row0sel.h
storage/xtradb/include/row0sel.ic
storage/xtradb/include/row0types.h
storage/xtradb/include/row0uins.h
storage/xtradb/include/row0uins.ic
storage/xtradb/include/row0umod.h
storage/xtradb/include/row0umod.ic
storage/xtradb/include/row0undo.h
storage/xtradb/include/row0undo.ic
storage/xtradb/include/row0upd.h
storage/xtradb/include/row0upd.ic
storage/xtradb/include/row0vers.h
storage/xtradb/include/row0vers.ic
storage/xtradb/include/srv0que.h
storage/xtradb/include/srv0srv.h
storage/xtradb/include/srv0srv.ic
storage/xtradb/include/srv0start.h
storage/xtradb/include/sync0arr.h
storage/xtradb/include/sync0arr.ic
storage/xtradb/include/sync0rw.h
storage/xtradb/include/sync0rw.ic
storage/xtradb/include/sync0sync.h
storage/xtradb/include/sync0sync.ic
storage/xtradb/include/sync0types.h
storage/xtradb/include/thr0loc.h
storage/xtradb/include/thr0loc.ic
storage/xtradb/include/trx0i_s.h
storage/xtradb/include/trx0purge.h
storage/xtradb/include/trx0purge.ic
storage/xtradb/include/trx0rec.h
storage/xtradb/include/trx0rec.ic
storage/xtradb/include/trx0roll.h
storage/xtradb/include/trx0roll.ic
storage/xtradb/include/trx0rseg.h
storage/xtradb/include/trx0rseg.ic
storage/xtradb/include/trx0sys.h
storage/xtradb/include/trx0sys.ic
storage/xtradb/include/trx0trx.h
storage/xtradb/include/trx0trx.ic
storage/xtradb/include/trx0types.h
storage/xtradb/include/trx0undo.h
storage/xtradb/include/trx0undo.ic
storage/xtradb/include/trx0xa.h
storage/xtradb/include/univ.i
storage/xtradb/include/usr0sess.h
storage/xtradb/include/usr0sess.ic
storage/xtradb/include/usr0types.h
storage/xtradb/include/ut0auxconf.h
storage/xtradb/include/ut0byte.h
storage/xtradb/include/ut0byte.ic
storage/xtradb/include/ut0dbg.h
storage/xtradb/include/ut0list.h
storage/xtradb/include/ut0list.ic
storage/xtradb/include/ut0lst.h
storage/xtradb/include/ut0mem.h
storage/xtradb/include/ut0mem.ic
storage/xtradb/include/ut0rnd.h
storage/xtradb/include/ut0rnd.ic
storage/xtradb/include/ut0sort.h
storage/xtradb/include/ut0ut.h
storage/xtradb/include/ut0ut.ic
storage/xtradb/include/ut0vec.h
storage/xtradb/include/ut0vec.ic
storage/xtradb/include/ut0wqueue.h
storage/xtradb/lock/lock0iter.c
storage/xtradb/lock/lock0lock.c
storage/xtradb/log/log0log.c
storage/xtradb/log/log0recv.c
storage/xtradb/mach/mach0data.c
storage/xtradb/mem/mem0dbg.c
storage/xtradb/mem/mem0mem.c
storage/xtradb/mem/mem0pool.c
storage/xtradb/mtr/mtr0log.c
storage/xtradb/mtr/mtr0mtr.c
storage/xtradb/os/os0file.c
storage/xtradb/os/os0proc.c
storage/xtradb/os/os0sync.c
storage/xtradb/os/os0thread.c
storage/xtradb/page/page0cur.c
storage/xtradb/page/page0page.c
storage/xtradb/page/page0zip.c
storage/xtradb/pars/lexyy.c
storage/xtradb/pars/pars0lex.l
storage/xtradb/pars/pars0opt.c
storage/xtradb/pars/pars0pars.c
storage/xtradb/pars/pars0sym.c
storage/xtradb/plug.in
storage/xtradb/que/que0que.c
storage/xtradb/read/read0read.c
storage/xtradb/rem/rem0cmp.c
storage/xtradb/rem/rem0rec.c
storage/xtradb/row/row0ext.c
storage/xtradb/row/row0ins.c
storage/xtradb/row/row0merge.c
storage/xtradb/row/row0mysql.c
storage/xtradb/row/row0purge.c
storage/xtradb/row/row0row.c
storage/xtradb/row/row0sel.c
storage/xtradb/row/row0uins.c
storage/xtradb/row/row0umod.c
storage/xtradb/row/row0undo.c
storage/xtradb/row/row0upd.c
storage/xtradb/row/row0vers.c
storage/xtradb/srv/srv0que.c
storage/xtradb/srv/srv0srv.c
storage/xtradb/srv/srv0start.c
storage/xtradb/sync/sync0arr.c
storage/xtradb/sync/sync0rw.c
storage/xtradb/sync/sync0sync.c
storage/xtradb/thr/thr0loc.c
storage/xtradb/trx/trx0i_s.c
storage/xtradb/trx/trx0purge.c
storage/xtradb/trx/trx0rec.c
storage/xtradb/trx/trx0roll.c
storage/xtradb/trx/trx0rseg.c
storage/xtradb/trx/trx0sys.c
storage/xtradb/trx/trx0trx.c
storage/xtradb/trx/trx0undo.c
storage/xtradb/usr/usr0sess.c
storage/xtradb/ut/ut0byte.c
storage/xtradb/ut/ut0dbg.c
storage/xtradb/ut/ut0list.c
storage/xtradb/ut/ut0mem.c
storage/xtradb/ut/ut0rnd.c
storage/xtradb/ut/ut0ut.c
storage/xtradb/ut/ut0vec.c
storage/xtradb/ut/ut0wqueue.c
storage/xtradb/win-plugin/README
storage/xtradb/win-plugin/win-plugin.diff
The size of the diff (120074 lines) is larger than your specified limit of 5000 lines
--
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
I pushed the final fixes, including the merge of XtraDB, into the release
branch:
lp:~maria-captains/maria/5.1-release
I tagged the latest revision with the tag
tag:mariadb-5.1.39-beta
Daniel, for the release notes please mark that this release is based on MySQL
5.1.39 and XtraDB 8 (which has InnoDB plugin 1.0.4 as base).
Arjen, we are now go for final release build. Hopefully we can be ready for
release Tuesday, which according to my information would allow Monty to
announce the release at OpenSQL Camp. You can use
tarbake51/sh tag:mariadb-5.1.39-beta lp:~maria-captains/maria/5.1-release
to be 100% sure to grab the right revision for the release (or whatever
variant fits your build infrastructure best).
There is still the mysql_client_test failure on Ubuntu 9.10 Karmic. We need to
fix this for the next MariaDB 5.1.41 release.
There are also other failures seen in Buildbot, including
- A number of sporadic test failures that occur only occasionally.
- Windows test failures.
- Solaris build failure and Mac test failures.
- Test failures on non-max builds.
For these reasons I think it is correct to still call this release only a
Beta. We should fix these issues for 5.1.41, and if no serious new issues are
reported on 5.1.39 I think we can plan for 5.1.41 to be a release candidate.
- Kristian.
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2768)
by knielsen@knielsen-hq.org 14 Nov '09
by knielsen@knielsen-hq.org 14 Nov '09
14 Nov '09
#At lp:maria
2768 knielsen(a)knielsen-hq.org 2009-11-14
XtraDB 8 after-merge fix: Fix windows build.
modified:
storage/xtradb/CMakeLists.txt
=== modified file 'storage/xtradb/CMakeLists.txt'
--- a/storage/xtradb/CMakeLists.txt 2009-11-13 21:26:08 +0000
+++ b/storage/xtradb/CMakeLists.txt 2009-11-14 09:53:18 +0000
@@ -44,7 +44,7 @@ IF(MSVC AND $(WIN64))
PROPERTIES COMPILE_FLAGS -Od)
ENDIF(MSVC AND $(WIN64))
-SET(INNODB_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
+SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
buf/buf0buddy.c buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c
data/data0data.c data/data0type.c
dict/dict0boot.c dict/dict0crea.c dict/dict0dict.c dict/dict0load.c dict/dict0mem.c
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2767)
by knielsen@knielsen-hq.org 14 Nov '09
by knielsen@knielsen-hq.org 14 Nov '09
14 Nov '09
#At lp:maria
2767 knielsen(a)knielsen-hq.org 2009-11-14
XtraDB 8 after-merge fixes: fix forgotten manual merge of patch file.
modified:
mysql-test/include/index_merge2.inc
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_myisam.result
=== modified file 'mysql-test/include/index_merge2.inc'
--- a/mysql-test/include/index_merge2.inc 2006-09-14 19:44:17 +0000
+++ b/mysql-test/include/index_merge2.inc 2009-11-14 01:15:03 +0000
@@ -122,12 +122,14 @@ insert into t1 (key1a, key1b, key2a, key
analyze table t1;
select count(*) from t1;
+--replace_column 9 REF
explain select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
+--replace_column 9 REF
explain select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
=== modified file 'mysql-test/r/index_merge_innodb.result'
--- a/mysql-test/r/index_merge_innodb.result 2009-06-09 13:19:13 +0000
+++ b/mysql-test/r/index_merge_innodb.result 2009-11-14 01:15:03 +0000
@@ -111,7 +111,7 @@ count(*)
explain select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 3 Using intersect(i1,i2); Using where; Using index
+1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL REF Using intersect(i1,i2); Using where; Using index
select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
count(*)
@@ -119,7 +119,7 @@ count(*)
explain select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 3 Using intersect(i1,i3); Using where; Using index
+1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL REF Using intersect(i1,i3); Using where; Using index
select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
count(*)
=== modified file 'mysql-test/r/index_merge_myisam.result'
--- a/mysql-test/r/index_merge_myisam.result 2009-06-15 14:36:51 +0000
+++ b/mysql-test/r/index_merge_myisam.result 2009-11-14 01:15:03 +0000
@@ -945,7 +945,7 @@ count(*)
explain select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 2 Using intersect(i1,i2); Using where; Using index
+1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL REF Using intersect(i1,i2); Using where; Using index
select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
count(*)
@@ -953,7 +953,7 @@ count(*)
explain select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 2 Using intersect(i1,i3); Using where; Using index
+1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL REF Using intersect(i1,i3); Using where; Using index
select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
count(*)
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2766)
by knielsen@knielsen-hq.org 13 Nov '09
by knielsen@knielsen-hq.org 13 Nov '09
13 Nov '09
#At lp:maria
2766 knielsen(a)knielsen-hq.org 2009-11-13
XtraDB 8 after-merge fix: Add missing header to `make dist`.
modified:
storage/xtradb/Makefile.am
=== modified file 'storage/xtradb/Makefile.am'
--- a/storage/xtradb/Makefile.am 2009-11-13 21:26:08 +0000
+++ b/storage/xtradb/Makefile.am 2009-11-13 22:53:04 +0000
@@ -78,6 +78,7 @@ noinst_HEADERS= \
include/fil0fil.h \
include/fsp0fsp.h \
include/fsp0fsp.ic \
+ include/fsp0types.h \
include/fut0fut.h \
include/fut0fut.ic \
include/fut0lst.h \
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2765)
by knielsen@knielsen-hq.org 13 Nov '09
by knielsen@knielsen-hq.org 13 Nov '09
13 Nov '09
#At lp:maria
2765 knielsen(a)knielsen-hq.org 2009-11-13 [merge]
Merge XtraDB 8.
modified:
storage/federatedx/Makefile.am
storage/federatedx/ha_federatedx.cc
=== modified file 'storage/federatedx/Makefile.am'
--- a/storage/federatedx/Makefile.am 2009-11-01 15:09:55 +0000
+++ b/storage/federatedx/Makefile.am 2009-11-10 13:55:48 +0000
@@ -22,7 +22,6 @@ pkgplugin_LTLIBRARIES = @plugin_federate
ha_federatedx_la_LDFLAGS = -module -rpath $(pkgplugindir)
ha_federatedx_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_federatedx_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
-ha_federatedx_la_SOURCES = ha_federatedx.cc
EXTRA_LIBRARIES = libfederatedx.a
=== modified file 'storage/federatedx/ha_federatedx.cc'
--- a/storage/federatedx/ha_federatedx.cc 2009-11-03 11:08:09 +0000
+++ b/storage/federatedx/ha_federatedx.cc 2009-11-10 08:35:39 +0000
@@ -390,8 +390,8 @@ int federatedx_db_init(void *p)
DBUG_ENTER("federatedx_db_init");
handlerton *federatedx_hton= (handlerton *)p;
federatedx_hton->state= SHOW_OPTION_YES;
- /* This is no longer needed for plugin storage engines */
- federatedx_hton->db_type= DB_TYPE_DEFAULT;
+ /* Needed to work with old .frm files */
+ federatedx_hton->db_type= DB_TYPE_FEDERATED_DB;
federatedx_hton->savepoint_offset= sizeof(ulong);
federatedx_hton->close_connection= ha_federatedx::disconnect;
federatedx_hton->savepoint_set= ha_federatedx::savepoint_set;
1
0
[Maria-developers] Progress (by Sanja): Avoid flushing keycache to disk in case of DROPping table (53)
by worklog-noreply@askmonty.org 13 Nov '09
by worklog-noreply@askmonty.org 13 Nov '09
13 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Avoid flushing keycache to disk in case of DROPping table
CREATION DATE..: Thu, 27 Aug 2009, 11:12
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 53 (http://askmonty.org/worklog/?tid=53)
VERSION........: Server-5.0
STATUS.........: Complete
PRIORITY.......: 60
WORKED HOURS...: 21
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 24
PROGRESS NOTES:
-=-=(Sanja - Fri, 13 Nov 2009, 10:55)=-=-
Ported to maria 5.1 _ maria and partitioning support added and tested
Worked 2 hours and estimate 0 hours remain (original estimate increased by 2 hours).
-=-=(Sanja - Fri, 13 Nov 2009, 00:24)=-=-
Ported to mysql 5.1 and tested
Worked 5 hours and estimate 0 hours remain (original estimate increased by 5 hours).
-=-=(Sanja - Tue, 06 Oct 2009, 12:30)=-=-
Status updated.
--- /tmp/wklog.53.old.27223 2009-10-06 12:30:38.000000000 +0300
+++ /tmp/wklog.53.new.27223 2009-10-06 12:30:38.000000000 +0300
@@ -1 +1 @@
-Assigned
+Complete
-=-=(Sanja - Tue, 06 Oct 2009, 12:30)=-=-
After review fixes and tests.
Worked 1 hour and estimate 0 hours remain (original estimate decreased by 10 hours).
-=-=(Sanja - Thu, 03 Sep 2009, 19:43)=-=-
New patch and its testing
Worked 8 hours and estimate 11 hours remain (original estimate unchanged).
-=-=(Sanja - Tue, 01 Sep 2009, 15:20)=-=-
moving to 5.0 part1
Worked 2 hours and estimate 19 hours remain (original estimate unchanged).
-=-=(Sanja - Tue, 01 Sep 2009, 15:19)=-=-
first patch
Worked 3 hours and estimate 21 hours remain (original estimate unchanged).
-=-=(Sanja - Thu, 27 Aug 2009, 11:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.53.old.23490 2009-08-27 11:15:24.000000000 +0300
+++ /tmp/wklog.53.new.23490 2009-08-27 11:15:24.000000000 +0300
@@ -1 +1,3 @@
-
+To make special handler call 'prepare to drop' which mark table as changed (in
+case of server crash just before removing table it force table to be repaired)
+then flush keycache without writing on disk.
DESCRIPTION:
When DROP TABLE executed keycache flushed to disk before removing table which is
wasting of resources. So better to have table removed from keycache without
writing changes on disk.
HIGH-LEVEL SPECIFICATION:
To make special handler call 'prepare to drop' which mark table as changed (in
case of server crash just before removing table it force table to be repaired)
then flush keycache without writing on disk.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Sanja): Avoid flushing keycache to disk in case of DROPping table (53)
by worklog-noreply@askmonty.org 13 Nov '09
by worklog-noreply@askmonty.org 13 Nov '09
13 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Avoid flushing keycache to disk in case of DROPping table
CREATION DATE..: Thu, 27 Aug 2009, 11:12
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 53 (http://askmonty.org/worklog/?tid=53)
VERSION........: Server-5.0
STATUS.........: Complete
PRIORITY.......: 60
WORKED HOURS...: 21
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 24
PROGRESS NOTES:
-=-=(Sanja - Fri, 13 Nov 2009, 10:55)=-=-
Ported to maria 5.1 _ maria and partitioning support added and tested
Worked 2 hours and estimate 0 hours remain (original estimate increased by 2 hours).
-=-=(Sanja - Fri, 13 Nov 2009, 00:24)=-=-
Ported to mysql 5.1 and tested
Worked 5 hours and estimate 0 hours remain (original estimate increased by 5 hours).
-=-=(Sanja - Tue, 06 Oct 2009, 12:30)=-=-
Status updated.
--- /tmp/wklog.53.old.27223 2009-10-06 12:30:38.000000000 +0300
+++ /tmp/wklog.53.new.27223 2009-10-06 12:30:38.000000000 +0300
@@ -1 +1 @@
-Assigned
+Complete
-=-=(Sanja - Tue, 06 Oct 2009, 12:30)=-=-
After review fixes and tests.
Worked 1 hour and estimate 0 hours remain (original estimate decreased by 10 hours).
-=-=(Sanja - Thu, 03 Sep 2009, 19:43)=-=-
New patch and its testing
Worked 8 hours and estimate 11 hours remain (original estimate unchanged).
-=-=(Sanja - Tue, 01 Sep 2009, 15:20)=-=-
moving to 5.0 part1
Worked 2 hours and estimate 19 hours remain (original estimate unchanged).
-=-=(Sanja - Tue, 01 Sep 2009, 15:19)=-=-
first patch
Worked 3 hours and estimate 21 hours remain (original estimate unchanged).
-=-=(Sanja - Thu, 27 Aug 2009, 11:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.53.old.23490 2009-08-27 11:15:24.000000000 +0300
+++ /tmp/wklog.53.new.23490 2009-08-27 11:15:24.000000000 +0300
@@ -1 +1,3 @@
-
+To make special handler call 'prepare to drop' which mark table as changed (in
+case of server crash just before removing table it force table to be repaired)
+then flush keycache without writing on disk.
DESCRIPTION:
When DROP TABLE executed keycache flushed to disk before removing table which is
wasting of resources. So better to have table removed from keycache without
writing changes on disk.
HIGH-LEVEL SPECIFICATION:
To make special handler call 'prepare to drop' which mark table as changed (in
case of server crash just before removing table it force table to be repaired)
then flush keycache without writing on disk.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Sanja): Avoid flushing keycache to disk in case of DROPping table (53)
by worklog-noreply@askmonty.org 12 Nov '09
by worklog-noreply@askmonty.org 12 Nov '09
12 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Avoid flushing keycache to disk in case of DROPping table
CREATION DATE..: Thu, 27 Aug 2009, 11:12
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 53 (http://askmonty.org/worklog/?tid=53)
VERSION........: Server-5.0
STATUS.........: Complete
PRIORITY.......: 60
WORKED HOURS...: 19
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 24
PROGRESS NOTES:
-=-=(Sanja - Fri, 13 Nov 2009, 00:24)=-=-
Ported to mysql 5.1 and tested
Worked 5 hours and estimate 0 hours remain (original estimate increased by 5 hours).
-=-=(Sanja - Tue, 06 Oct 2009, 12:30)=-=-
Status updated.
--- /tmp/wklog.53.old.27223 2009-10-06 12:30:38.000000000 +0300
+++ /tmp/wklog.53.new.27223 2009-10-06 12:30:38.000000000 +0300
@@ -1 +1 @@
-Assigned
+Complete
-=-=(Sanja - Tue, 06 Oct 2009, 12:30)=-=-
After review fixes and tests.
Worked 1 hour and estimate 0 hours remain (original estimate decreased by 10 hours).
-=-=(Sanja - Thu, 03 Sep 2009, 19:43)=-=-
New patch and its testing
Worked 8 hours and estimate 11 hours remain (original estimate unchanged).
-=-=(Sanja - Tue, 01 Sep 2009, 15:20)=-=-
moving to 5.0 part1
Worked 2 hours and estimate 19 hours remain (original estimate unchanged).
-=-=(Sanja - Tue, 01 Sep 2009, 15:19)=-=-
first patch
Worked 3 hours and estimate 21 hours remain (original estimate unchanged).
-=-=(Sanja - Thu, 27 Aug 2009, 11:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.53.old.23490 2009-08-27 11:15:24.000000000 +0300
+++ /tmp/wklog.53.new.23490 2009-08-27 11:15:24.000000000 +0300
@@ -1 +1,3 @@
-
+To make special handler call 'prepare to drop' which mark table as changed (in
+case of server crash just before removing table it force table to be repaired)
+then flush keycache without writing on disk.
DESCRIPTION:
When DROP TABLE executed keycache flushed to disk before removing table which is
wasting of resources. So better to have table removed from keycache without
writing changes on disk.
HIGH-LEVEL SPECIFICATION:
To make special handler call 'prepare to drop' which mark table as changed (in
case of server crash just before removing table it force table to be repaired)
then flush keycache without writing on disk.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Progress (by Sanja): Avoid flushing keycache to disk in case of DROPping table (53)
by worklog-noreply@askmonty.org 12 Nov '09
by worklog-noreply@askmonty.org 12 Nov '09
12 Nov '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Avoid flushing keycache to disk in case of DROPping table
CREATION DATE..: Thu, 27 Aug 2009, 11:12
SUPERVISOR.....: Monty
IMPLEMENTOR....: Sanja
COPIES TO......:
CATEGORY.......: Server-Sprint
TASK ID........: 53 (http://askmonty.org/worklog/?tid=53)
VERSION........: Server-5.0
STATUS.........: Complete
PRIORITY.......: 60
WORKED HOURS...: 19
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 24
PROGRESS NOTES:
-=-=(Sanja - Fri, 13 Nov 2009, 00:24)=-=-
Ported to mysql 5.1 and tested
Worked 5 hours and estimate 0 hours remain (original estimate increased by 5 hours).
-=-=(Sanja - Tue, 06 Oct 2009, 12:30)=-=-
Status updated.
--- /tmp/wklog.53.old.27223 2009-10-06 12:30:38.000000000 +0300
+++ /tmp/wklog.53.new.27223 2009-10-06 12:30:38.000000000 +0300
@@ -1 +1 @@
-Assigned
+Complete
-=-=(Sanja - Tue, 06 Oct 2009, 12:30)=-=-
After review fixes and tests.
Worked 1 hour and estimate 0 hours remain (original estimate decreased by 10 hours).
-=-=(Sanja - Thu, 03 Sep 2009, 19:43)=-=-
New patch and its testing
Worked 8 hours and estimate 11 hours remain (original estimate unchanged).
-=-=(Sanja - Tue, 01 Sep 2009, 15:20)=-=-
moving to 5.0 part1
Worked 2 hours and estimate 19 hours remain (original estimate unchanged).
-=-=(Sanja - Tue, 01 Sep 2009, 15:19)=-=-
first patch
Worked 3 hours and estimate 21 hours remain (original estimate unchanged).
-=-=(Sanja - Thu, 27 Aug 2009, 11:15)=-=-
High-Level Specification modified.
--- /tmp/wklog.53.old.23490 2009-08-27 11:15:24.000000000 +0300
+++ /tmp/wklog.53.new.23490 2009-08-27 11:15:24.000000000 +0300
@@ -1 +1,3 @@
-
+To make special handler call 'prepare to drop' which mark table as changed (in
+case of server crash just before removing table it force table to be repaired)
+then flush keycache without writing on disk.
DESCRIPTION:
When DROP TABLE executed keycache flushed to disk before removing table which is
wasting of resources. So better to have table removed from keycache without
writing changes on disk.
HIGH-LEVEL SPECIFICATION:
To make special handler call 'prepare to drop' which mark table as changed (in
case of server crash just before removing table it force table to be repaired)
then flush keycache without writing on disk.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0