summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jcole@mugatu.spaceapes.com>2002-06-08 23:08:15 -0500
committerunknown <jcole@mugatu.spaceapes.com>2002-06-08 23:08:15 -0500
commit85f7e9194cc85b5555d221c26172f0a23bdb6958 (patch)
tree4f97750a074820c1e97398170591d02abd159ed9
parentc9fa5645f426345a9898bbd7d9e824ac78b6015e (diff)
parentc7f989cc20622cc1c4f57ee54bb6fee8f9733518 (diff)
downloadmariadb-git-85f7e9194cc85b5555d221c26172f0a23bdb6958.tar.gz
Merge jcole@work.mysql.com:/home/bk/mysql-4.0
into mugatu.spaceapes.com:/home/jcole/bk/mysql-4.0 configure.in: Auto merged
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--Docs/Flags/new-zealand.eps98
-rw-r--r--Docs/Flags/new-zealand.gifbin0 -> 661 bytes
-rw-r--r--Docs/Flags/new-zealand.pdfbin0 -> 1331 bytes
-rw-r--r--Docs/Flags/new-zealand.txt0
-rw-r--r--Docs/ManualStyleGuidelines.wiki7
-rw-r--r--Docs/manual.texi92
-rw-r--r--Docs/mirrors.texi18
-rw-r--r--client/mysql.cc274
-rw-r--r--client/mysqladmin.c11
-rw-r--r--client/mysqlbinlog.cc9
-rw-r--r--client/mysqlcheck.c8
-rw-r--r--client/mysqldump.c10
-rw-r--r--client/mysqlimport.c9
-rw-r--r--client/mysqlmanager-pwgen.c12
-rw-r--r--client/mysqlmanagerc.c10
-rw-r--r--client/mysqlshow.c8
-rw-r--r--client/mysqltest.c33
-rw-r--r--client/thread_test.c6
-rw-r--r--configure.in11
-rw-r--r--extra/my_print_defaults.c9
-rw-r--r--extra/mysql_install.c9
-rw-r--r--extra/perror.c9
-rw-r--r--extra/resolve_stack_dump.c9
-rw-r--r--extra/resolveip.c16
-rw-r--r--include/my_getopt.h1
-rw-r--r--include/my_net.h32
-rw-r--r--include/my_pthread.h2
-rw-r--r--include/my_sys.h135
-rw-r--r--include/mysys_err.h16
-rw-r--r--innobase/srv/srv0srv.c14
-rw-r--r--isam/isamchk.c8
-rw-r--r--isam/pack_isam.c9
-rw-r--r--libmysql/libmysql.c5
-rw-r--r--libmysqld/lib_vio.c21
-rw-r--r--myisam/ft_dump.c6
-rw-r--r--myisam/ft_eval.c7
-rw-r--r--myisam/ft_test1.c6
-rw-r--r--myisam/mi_test1.c9
-rw-r--r--myisam/myisamchk.c8
-rw-r--r--myisam/myisampack.c9
-rw-r--r--mysql-test/mysql-test-run.sh20
-rw-r--r--mysql-test/r/alter_table.result8
-rw-r--r--mysql-test/r/func_math.result6
-rw-r--r--mysql-test/r/group_by.result23
-rw-r--r--mysql-test/r/multi_update.result4
-rw-r--r--mysql-test/r/rpl_empty_master_crash.result12
-rw-r--r--mysql-test/r/type_enum.result14
-rw-r--r--mysql-test/r/type_set.result14
-rw-r--r--mysql-test/t/alter_table.test10
-rw-r--r--mysql-test/t/func_math.test2
-rw-r--r--mysql-test/t/group_by.test17
-rw-r--r--mysql-test/t/multi_update.test18
-rw-r--r--mysql-test/t/rpl_empty_master_crash.test7
-rw-r--r--mysql-test/t/type_decimal.test2
-rw-r--r--mysql-test/t/type_enum.test11
-rw-r--r--mysql-test/t/type_set.test10
-rw-r--r--mysys/Makefile.am5
-rw-r--r--mysys/mf_iocache.c2
-rw-r--r--mysys/mf_strip.c (renamed from mysys/mf_stripp.c)6
-rw-r--r--mysys/my_gethostbyname.c9
-rw-r--r--mysys/my_getopt.c138
-rw-r--r--mysys/my_pthread.c1
-rw-r--r--mysys/raid2.c31
-rw-r--r--sql/field.cc3
-rw-r--r--sql/gen_lex_hash.cc9
-rw-r--r--sql/ha_innodb.cc1
-rw-r--r--sql/handler.cc6
-rw-r--r--sql/hostname.cc5
-rw-r--r--sql/item_cmpfunc.cc11
-rw-r--r--sql/item_cmpfunc.h12
-rw-r--r--sql/item_func.cc7
-rw-r--r--sql/log.cc77
-rw-r--r--sql/log_event.cc247
-rw-r--r--sql/mysqld.cc22
-rw-r--r--sql/repl_failsafe.cc33
-rw-r--r--sql/slave.cc679
-rw-r--r--sql/slave.h137
-rw-r--r--sql/sql_analyse.cc27
-rw-r--r--sql/sql_cache.cc53
-rw-r--r--sql/sql_class.cc6
-rw-r--r--sql/sql_class.h67
-rw-r--r--sql/sql_db.cc2
-rw-r--r--sql/sql_delete.cc6
-rw-r--r--sql/sql_insert.cc4
-rw-r--r--sql/sql_parse.cc52
-rw-r--r--sql/sql_repl.cc20
-rw-r--r--sql/sql_repl.h2
-rw-r--r--sql/sql_select.cc11
-rw-r--r--sql/sql_show.cc4
-rw-r--r--sql/sql_table.cc28
-rw-r--r--sql/sql_yacc.yy7
-rw-r--r--sql/table.h2
-rw-r--r--sql/unireg.h4
-rw-r--r--support-files/my-huge.cnf.sh19
-rwxr-xr-xtests/truncate.pl125
-rw-r--r--tools/mysqlmanager.c11
-rw-r--r--vio/test-sslserver.c10
98 files changed, 1809 insertions, 1227 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 73dfa70efb8..dd8d1549564 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -64,3 +64,4 @@ venu@work.mysql.com
worm@altair.is.lan
zak@balfor.local
zak@linux.local
+tfr@indrek.tfr.cafe.ee
diff --git a/Docs/Flags/new-zealand.eps b/Docs/Flags/new-zealand.eps
new file mode 100644
index 00000000000..9177154f8f7
--- /dev/null
+++ b/Docs/Flags/new-zealand.eps
@@ -0,0 +1,98 @@
+%!PS-Adobe-2.0 EPSF-2.0
+%%Creator: pnmtops
+%%Title: new-zealand.ps
+%%Pages: 1
+%%BoundingBox: 290 385 321 407
+%%EndComments
+/readstring {
+ currentfile exch readhexstring pop
+} bind def
+/rpicstr 32 string def
+/gpicstr 32 string def
+/bpicstr 32 string def
+%%EndProlog
+%%Page: 1 1
+gsave
+290.64 385.44 translate
+30.72 21.12 scale
+32 22 8
+[ 32 0 0 -22 0 22 ]
+{ rpicstr readstring }
+{ gpicstr readstring }
+{ bpicstr readstring }
+true 3
+colorimage
+000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000
+00000000000000ce770d08080874c6770808080c77ce0808080808080808
+0808080808080800003e58050000004d005000000005583e000000000000
+000000000000000000000042b4b6b5b5b5aa00abb5b5b5b6b442b5b5b5b5
+b5b5b5b5b5b5b5b5b5b5b50000aed2b433080874c677080833b4d2ae0808
+0808080808080808080808080800008a3d5e2b00004d005000002b5e3d8a
+0000000000000000000000000000000000bb3d81bfb5b5aa00abb5b5bf81
+3dbbb5b5b5b5b5b5b5b5b5b5b5b5b5b5b500000967d3ce770d74c6770c77
+ced36709080808080808083e230808080808080000015f733e58054d0050
+05583e735f0100000000000000341c0000000000000000b5cb7d42b4b6aa
+00abb6b4427dcbb5b5b5b5b5b5b5b5bfbcb5b5b5b5b5b50000080825aed2
+b49bc69db3d2ae25080808080808080a65a49a5a0808080808000000001e
+893d5e7400765d3d8a1e000000000000000253444c4d00000000000000b5
+b5bdbb3d81b300b4813dbbbdb5b5b5b5b5b5b5b6bf7285c3b5b5b5b5b500
+00d3d3d3d3d6d5d3c6d3d5d6d3d3d3d30808080808081ccfc01308080808
+0800004d4d4d4d4f4d4200424d4f4d4d4d4d00000000000015484a0b0000
+00000000004f4f4f4f4f4d4200424d4f4f4f4f4fb5b5b5b5b5b5ba4e5fb8
+b5b5b5b5b50000d6d6d6d6d6d6d3c6d3d6d6d6d6d6d60808080808082c59
+6b1808080808080000505050505050420042505050505050000000000000
+25475a1000000000000000505050505050420042505050505050b5b5b5b5
+b5b5bfbdc2b9b5b5b5b5b50000080825aed2b49bc69db4d2ae2508080808
+08080908080808080832080808000000001e8a3d5e7400775e3d8a1e0000
+00000000010000000000002c0000000000b5b5bdbb3d81b300b4813dbbbd
+b5b5b5b5b5b5b5b5b5b5b5b5b5c1b5b5b500000967d3ce770d74c6770c77
+ced36709080808086408080808183eb14528080000015f733e58054d0050
+05583e735f010000000058000000001138714021000000b5cb7d42b4b6aa
+00abb6b4427dcbb5b5b5b5b5c6b5b5b5b5b9c49bc6beb50000aed2b43308
+0874c677080833b4d2ae08083188c8821e08080a7ec8a6190800008a3d5e
+2b00004d005000002b5e3d8a00002b534b591700000252074912000000bb
+3d81bfb5b5aa00abb5b5bf813dbbb5b5c09f58abbbb5b5b6a70776bab500
+00ce770d08080874c6770808080c77ce08080882cd5f0808080861798a08
+0800003e58050000004d005000000005583e0000004b2649000000005249
+660000000042b4b6b5b5b5aa00abb5b5b5b6b442b5b5b59a26b9b5b5b5b5
+c2a1b3b5b50000080808080808080808080808080808080808622d540808
+080810081008080000000000000000000000000000000000000000552548
+0000000008000800000000b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5c4
+bec2b5b5b5b5b7b5b7b5b500000808080808080808080808080808080808
+080808080808080808080808080000000000000000000000000000000000
+0000000000000000000000000000000000b5b5b5b5b5b5b5b5b5b5b5b5b5
+b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b500000808080808080808080808
+080808080808080808080808080808080808080000000000000000000000
+0000000000000000000000000000000000000000000000b5b5b5b5b5b5b5
+b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b500000808080808
+080808080808080808080808080808080808080808080808080000000000
+0000000000000000000000000000000000000000000000000000000000b5
+b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b500
+00080808080808080808080808080808080808080808081c080808080808
+080000000000000000000000000000000000000000000000001400000000
+0000000000b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5bab5b5
+b5b5b5b5b500000808080808080808080808080808080808080808080886
+200808080808080000000000000000000000000000000000000000000000
+005f190000000000000000b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5
+b5b5b5adbcb5b5b5b5b5b500000808080808080808080808080808080808
+0808081196cdc94808080808080000000000000000000000000000000000
+00000000000a7728674100000000000000b5b5b5b5b5b5b5b5b5b5b5b5b5
+b5b5b5b5b5b5b5b8bc2978c5b5b5b5b5b500000808080808080808080808
+080808080808080808083dada00808080808080000000000000000000000
+0000000000000000000000003555670000000000000000b5b5b5b5b5b5b5
+b5b5b5b5b5b5b5b5b5b5b5b5b5b5c17e9fb5b5b5b5b5b500000808080808
+08080808080808080808080808080808240a250908080808080000000000
+0000000000000000000000000000000000001d021e0100000000000000b5
+b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5bdb5bdb5b5b5b5b5b500
+000808080808080808080808080808080808080808080808080808080808
+080000000000000000000000000000000000000000000000000000000000
+0000000000b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5
+b5b5b5b5b500000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000
+grestore
+showpage
+%%Trailer
diff --git a/Docs/Flags/new-zealand.gif b/Docs/Flags/new-zealand.gif
new file mode 100644
index 00000000000..5d74f71ecc0
--- /dev/null
+++ b/Docs/Flags/new-zealand.gif
Binary files differ
diff --git a/Docs/Flags/new-zealand.pdf b/Docs/Flags/new-zealand.pdf
new file mode 100644
index 00000000000..040f8bdb7b0
--- /dev/null
+++ b/Docs/Flags/new-zealand.pdf
Binary files differ
diff --git a/Docs/Flags/new-zealand.txt b/Docs/Flags/new-zealand.txt
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Docs/Flags/new-zealand.txt
diff --git a/Docs/ManualStyleGuidelines.wiki b/Docs/ManualStyleGuidelines.wiki
index 3329370411c..9d2a869ba1a 100644
--- a/Docs/ManualStyleGuidelines.wiki
+++ b/Docs/ManualStyleGuidelines.wiki
@@ -1,12 +1,13 @@
-OriginalAuthor: PaulDuBois
+OriginalAuthor: Paul DuBois
!!! ManualStyleGuidelines
-''Version 1.0''
+''Version 1.1''
!! Revision History
* 2002-05-17 ArjenLentz - Version 1.0, Posted to Wiki
+* 2002-06-03 ArjenLentz - Version 1.1, updates.
!! MySQL Manual Style Guidelines
@@ -277,3 +278,5 @@ Logical NOT/OR/AND are operators, not functions, so they take operands, not argu
It's NetWare, not Netware (as per Novell's trademark guidelines).
+It's deprecated, not depricated.
+
diff --git a/Docs/manual.texi b/Docs/manual.texi
index e34415f437b..179e4d79924 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -14135,8 +14135,9 @@ though.
@item --core-file
Write a core file if @code{mysqld} dies. For some systems you must also
-specify @code{--core-file-size} to @code{safe_mysqld}. @xref{safe_mysqld, ,
-@code{safe_mysqld}}. Note that on some system like Solaris, you will
+specify @code{--core-file-size} to @code{safe_mysqld}.
+@xref{safe_mysqld, ,@code{safe_mysqld}}.
+Note that on some systems, like Solaris, you will
not get a core file if you are also using the @code{--user} option.
@item -h, --datadir=path
@@ -14340,7 +14341,8 @@ privilege.
@item --skip-stack-trace
Don't write stack traces. This option is useful when you are running
-@code{mysqld} under a debugger. @xref{Debugging server}.
+@code{mysqld} under a debugger. On some systems you also have to use
+this option to get a core file. @xref{Debugging server}.
@item --skip-thread-priority
Disable using thread priorities for faster response time.
@@ -19981,7 +19983,7 @@ is automatically enlarged, up to @code{max_allowed_packet} bytes.)
@item @code{net_read_timeout}
Number of seconds to wait for more data from a connection before aborting
the read. Note that when we don't expect data from a connection, the timeout
-is defined by @code{write_timeout}. See also @code{slave_read_timeout}.
+is defined by @code{write_timeout}. See also @code{slave_net_timeout}.
@item @code{net_retry_count}
If a read on a communication port is interrupted, retry this many times
@@ -20060,7 +20062,7 @@ the @strong{process} privilege. This can improve security if you're
concerned about people being able to see what databases other users
have. See also @code{safe_show_database}.
-@item @code{slave_read_timeout}
+@item @code{slave_net_timeout}
Number of seconds to wait for more data from a master/slave connection
before aborting the read.
@@ -21192,17 +21194,17 @@ Usually, @code{myisampack} packs the datafile 40%-70%.
MySQL uses memory mapping (@code{mmap()}) on compressed tables and
falls back to normal read/write file usage if @code{mmap()} doesn't work.
-There are currently two limitations with @code{myisampack}:
+Please note the following:
@itemize @bullet
@item
-After packing, the table is read-only.
+After packing, the table is read-only. This is generally intended
+(such as when accessing packed tables on a CD). Also allowing writes
+to a packed table is on our TODO list but with low priority.
@item
-@code{myisampack} can also pack @code{BLOB} or @code{TEXT} columns. The
-older @code{pack_isam} could not do this.
+@code{myisampack} can also pack @code{BLOB} or @code{TEXT} columns.
+The older @code{pack_isam} (for @code{ISAM} tables) can not do this.
@end itemize
-Fixing these limitations is on our TODO list but with low priority.
-
@code{myisampack} is invoked like this:
@example
@@ -22660,9 +22662,12 @@ Overrides option --databases (-B).
@item -T, --tab=path-to-some-directory
Creates a @code{table_name.sql} file, that contains the SQL CREATE commands,
and a @code{table_name.txt} file, that contains the data, for each give table.
-@strong{Note}: This only works if @code{mysqldump} is run on the same
-machine as the @code{mysqld} daemon. The format of the @file{.txt} file
-is made according to the @code{--fields-xxx} and @code{--lines--xxx} options.
+The format of the @file{.txt} file is made according to the
+@code{--fields-xxx} and @code{--lines--xxx} options.
+@strong{Note}: This option only works if @code{mysqldump} is run on the same
+machine as the @code{mysqld} daemon, and the user/group that @code{mysqld}
+is running as (normally user @code{mysql}, group @code{mysql}) needs to have
+permission to create/write a file at the location you specify.
@item -u user_name, --user=user_name
The MySQL user name to use when connecting to the server. The
default value is your Unix login name.
@@ -24057,7 +24062,7 @@ Example:
Tells the slave server not to start the slave on the startup. The user
can start it later with @code{SLAVE START}.
-@item @code{slave_read_timeout=#} @tab
+@item @code{slave_net_timeout=#} @tab
Number of seconds to wait for more data from the master before aborting
the read.
@end multitable
@@ -29907,6 +29912,9 @@ have any of the values shown here. The index of each value is also shown:
An enumeration can have a maximum of 65535 elements.
+Starting from 3.23.51 trailing spaces are automatically deleted from
+@code{ENUM} values when the table is created.
+
Lettercase is irrelevant when you assign values to an @code{ENUM} column.
However, values retrieved from the column later have lettercase matching the
values that were used to specify the allowable values at table creation time.
@@ -29923,6 +29931,8 @@ If you store a number into an @code{ENUM}, the number is treated as an
index, and the value stored is the enumeration member with that index.
(However, this will not work with @code{LOAD DATA}, which treats all
input as strings.)
+It's not advisable to store numbers in an @code{ENUM} string because
+it will make things confusing.
@code{ENUM} values are sorted according to the order in which the enumeration
members were listed in the column specification. (In other words,
@@ -29961,6 +29971,9 @@ any of these values:
A @code{SET} can have a maximum of 64 different members.
+Starting from 3.23.51 trailing spaces are automatically deleted from
+@code{SET} values when the table is created.
+
MySQL stores @code{SET} values numerically, with the low-order bit
of the stored value corresponding to the first set member. If you retrieve a
@code{SET} value in a numeric context, the value retrieved has bits set
@@ -31369,6 +31382,17 @@ mysql> SELECT 'David!' LIKE 'David_';
-> 1
mysql> SELECT 'David!' LIKE '%D%v%';
-> 1
+mysql> select TRUNCATE(-1,999,1);
+ -> -1.9
+@end example
+
+Starting from MySQL 3.23.51 all numbers are rounded towards zero.
+
+If @code{D} is negative, then the whole part of the number is zeroed out:
+
+@example
+mysql> select truncate(122,-2);
+ -> 100
@end example
To test for literal instances of a wildcard character, precede the character
@@ -47065,6 +47089,11 @@ the following things:
@itemize @bullet
@item
+Cleaned up @code{NULL} handling for default values in @code{DESCRIBE
+table_name}.
+@item
+Fixed @code{truncate()} to round up negative values to the nearest integer.
+@item
Take down the @code{mysqld} daemon with @code{mysqladmin shutdown}, run
@code{myisamchk --silent --force */*.MYI} on all tables, and restart the
@code{mysqld} daemon. This will ensure that you are running from a clean
@@ -49314,6 +49343,18 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@item
+Fixed query cache align data bug.
+@item
+Fixed mutex bug in replication when reading from master fails.
+@item
+Added missing mutex in @code{TRUNCATE TABLE}; This fixes some core
+dump/hangup problems when using @code{TRUNCATE TABLE}.
+@item
+Fixed bug in multi-table @code{DELETE} when optimiser uses only indices.
+@item
+Fixed that @code{ALTER TABLE table_name RENAME new_table_name} is as fast
+as @code{RENAME TABLE}.
+@item
Fixed bug in @code{GROUP BY} with two or more fields, where at least one
field can contain @code{NULL} values.
@item
@@ -49444,8 +49485,6 @@ specified with the @code{--sql-mode} option for @code{mysqld}. It disables
unsigned arithmetic rules when it comes to subtraction. (This will make
MySQL 4.0 behave more closely to 3.23 with @code{UNSIGNED} columns).
@item
-Added @code{WITH MAX_QUERIES_PER_HOUR=#} to @code{GRANT} command.
-@item
The result returned for all bit functions (@code{|}, @code{<<}, ...) is now of
type @code{unsigned integer}.
@item
@@ -49745,6 +49784,7 @@ users use this code as the rest of the code and because of this we are
not yet 100% confident in this code.
@menu
+* News-3.23.52:: Changes in release 3.23.52
* News-3.23.51:: Changes in release 3.23.51
* News-3.23.50:: Changes in release 3.23.50 (21 Apr 2002)
* News-3.23.49:: Changes in release 3.23.49
@@ -49800,11 +49840,25 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0 (Sep 1999: Alpha)
@end menu
-@node News-3.23.51, News-3.23.50, News-3.23.x, News-3.23.x
+@node News-3.23.52, News-3.23.51, News-3.23.x, News-3.23.x
+@appendixsubsec Changes in release 3.23.52
+@itemize @bullet
+@item
+Fixed possible problem in replication when doing @code{DROP DATABASE} on a
+database with InnoDB tables.
+@item
+Fixed that @code{mysql_info()} returns 0 for 'Duplicates' when using
+@code{INSERT DELAYED IGNORE}.
+@end itemize
+
+@node News-3.23.51, News-3.23.50, News-3.23.52, News-3.23.x
@appendixsubsec Changes in release 3.23.51
@itemize @bullet
@item
+Remove end space from @code{enum} values. (This fixed a problem with
+@code{SHOW CREATE TABLE}).
+@item
Fixed bug in @code{CONCAT_WS()} that cut the result.
@item
Changed name of variables @code{Com_show_master_stat} to
@@ -55860,7 +55914,7 @@ The trace file is made with the @strong{DBUG} package by Fred Fish.
@cindex gdb, using
-On most system you can also start @code{mysqld} from @code{gdb} to get
+On most systems you can also start @code{mysqld} from @code{gdb} to get
more information if @code{mysqld} crashes.
With some older @code{gdb} versions on Linux you must use @code{run
diff --git a/Docs/mirrors.texi b/Docs/mirrors.texi
index 4f570b03da9..1082f7d9f09 100644
--- a/Docs/mirrors.texi
+++ b/Docs/mirrors.texi
@@ -72,10 +72,6 @@ FTP (@uref{ftp://mir1.ovh.net/ftp.mysql.com/})
WWW (@uref{http://www.mysql.netsample.com/})
@item
-@image{Flags/france} France [Omegatomic] @@
-WWW (@uref{http://mysql.omegatomic.com/})
-
-@item
@image{Flags/france} France [Universite Paris 10] @@
WWW (@uref{http://ftp.u-paris10.fr/mysql.com})
FTP (@uref{ftp://ftp.u-paris10.fr/mysql.com})
@@ -184,16 +180,16 @@ WWW (@uref{http://darkstar.ist.utl.pt/mysql/})
FTP (@uref{ftp://darkstar.ist.utl.pt/pub/mysql/})
@item
-@image{Flags/portugal} Portugal [Netc] @@
-WWW (@uref{http://ftp.netc.pt/pub/mysql/})
-FTP (@uref{ftp://ftp.netc.pt/pub/mysql/})
-
-@item
@image{Flags/portugal} Portugal [Netvisão] @@
WWW (@uref{http://mysql.netvisao.pt/})
FTP (@uref{ftp://mirrors2.netvisao.pt/pub/mysql/})
@item
+@image{Flags/portugal} Portugal [VIZZAVI] @@
+WWW (@uref{http://ftp.vizzavi.pt/pub/mysql/})
+FTP (@uref{ftp://ftp.vizzavi.pt/pub/mysql/})
+
+@item
@image{Flags/romania} Romania [roedu.net/Bucharest] @@
FTP (@uref{ftp://ftp.roedu.net/pub/mirrors/ftp.mysql.com/})
@@ -270,10 +266,6 @@ FTP (@uref{ftp://mysql.unam.mx/pub/mysql/})
WWW (@uref{http://mysql.adgrafix.com/})
@item
-@image{Flags/usa} USA [Fast Mirror / Englewood, CO] @@
-WWW (@uref{http://mysql.fastmirror.com/})
-
-@item
@image{Flags/usa} USA [Hurricane Electric / San Jose, CA] @@
WWW (@uref{http://mysql.he.net/})
diff --git a/client/mysql.cc b/client/mysql.cc
index 105711bd6a0..656f8afcad5 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>
-const char *VER= "12.7";
+const char *VER= "12.10";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@@ -440,7 +440,7 @@ static struct my_option my_long_options[] =
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
(gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-auto-rehash", 'A',
- "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options depricated; use --disable-auto-rehash instead.",
+ "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"batch", 'B',
"Print results with a tab as separator, each row on new line. Doesn't use history file.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -468,7 +468,7 @@ static struct my_option my_long_options[] =
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"no-named-commands", 'g',
- "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option depricated; use --disable-named-commands instead.",
+ "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"named-commands", 'G',
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
@@ -489,25 +489,25 @@ static struct my_option my_long_options[] =
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
(gptr*) &line_numbers, (gptr*) &line_numbers, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is depricated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
+ {"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef __WIN__
{"no-pager", OPT_NOPAGER,
- "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option depricated; use --disable-pager instead.",
+ "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option depricated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
+ {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered,
(gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
(gptr*) &column_names, (gptr*) &column_names, 0, GET_BOOL,
- NO_ARG, 0, 0, 0, 0, 0, 0},
+ NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-column-names", 'N',
- "Don't write column names in results. WARNING: -N is depricated, use long version of this options instead.",
+ "Don't write column names in results. WARNING: -N is deprecated, use long version of this options instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
- "Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
+ "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"one-database", 'o',
"Only update the default database. This is useful for skipping updates to other database in the update log.",
@@ -604,115 +604,115 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch(optid) {
- case OPT_CHARSETS_DIR:
- strmov(mysql_charsets_dir, argument);
- charsets_dir = mysql_charsets_dir;
- break;
- case OPT_LOCAL_INFILE:
- using_opt_local_infile=1;
- opt_local_infile= test(!argument || atoi(argument)>0);
- break;
- case OPT_TEE:
- if (argument == disabled_my_option)
- {
- if (opt_outfile)
- end_tee();
- opt_outfile= 0;
- }
- else
- if (!opt_outfile)
- {
- strmov(outfile, argument);
- opt_outfile= 1;
- init_tee();
- }
- break;
- case OPT_NOTEE:
- printf("WARNING: option depricated; use --disable-tee instead.\n");
+ case OPT_CHARSETS_DIR:
+ strmov(mysql_charsets_dir, argument);
+ charsets_dir = mysql_charsets_dir;
+ break;
+ case OPT_LOCAL_INFILE:
+ using_opt_local_infile=1;
+ opt_local_infile= test(!argument || atoi(argument)>0);
+ break;
+ case OPT_TEE:
+ if (argument == disabled_my_option)
+ {
if (opt_outfile)
end_tee();
- opt_outfile= 0;
- break;
- case OPT_PAGER:
- opt_nopager= 0;
- if (argument)
- strmov(pager, argument);
- else
- strmov(pager, default_pager);
- strmov(default_pager, pager);
- break;
- case OPT_NOPAGER:
- printf("WARNING: option depricated; use --disable-pager instead.\n");
- opt_nopager= 1;
- break;
- case 'A':
- rehash= 0;
- break;
- case 'e':
- status.batch= 1;
- status.add_to_history= 0;
- batch_readline_end(status.line_buff); // If multiple -e
- if (!(status.line_buff= batch_readline_command(argument)))
- return 1;
- ignore_errors= 0;
- break;
- case 'o':
- if (argument == disabled_my_option)
- one_database= 0;
- else
- one_database= skip_updates= 1;
- break;
- case 'p':
- if (argument == disabled_my_option)
- argument= (char*) ""; // Don't require password
- if (argument)
- {
- char *start= argument;
- my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
- opt_password= my_strdup(argument, MYF(MY_FAE));
- while (*argument) *argument++= 'x'; // Destroy argument
- if (*start)
- start[1]=0 ;
- }
- else
- tty_password= 1;
- break;
- case '#':
- DBUG_PUSH(argument ? argument : default_dbug_option);
- info_flag= 1;
- break;
- case 's':
- if (argument == disabled_my_option)
- opt_silent= 0;
- else
- opt_silent++;
- break;
- case 'v':
- if (argument == disabled_my_option)
- verbose= 0;
- else
- verbose++;
- break;
- case 'B':
- if (!status.batch)
+ }
+ else
+ if (!opt_outfile)
{
- status.batch= 1;
- status.add_to_history= 0;
- opt_silent++; // more silent
+ strmov(outfile, argument);
+ init_tee();
}
- break;
- case 'W':
+ break;
+ case OPT_NOTEE:
+ printf("WARNING: option deprecated; use --disable-tee instead.\n");
+ if (opt_outfile)
+ end_tee();
+ break;
+ case OPT_PAGER:
+ opt_nopager= 0;
+ if (argument)
+ strmov(pager, argument);
+ else
+ strmov(pager, default_pager);
+ strmov(default_pager, pager);
+ break;
+ case OPT_NOPAGER:
+ printf("WARNING: option deprecated; use --disable-pager instead.\n");
+ opt_nopager= 1;
+ break;
+ case 'A':
+ rehash= 0;
+ break;
+ case 'N':
+ column_names= 0;
+ break;
+ case 'e':
+ status.batch= 1;
+ status.add_to_history= 0;
+ batch_readline_end(status.line_buff); // If multiple -e
+ if (!(status.line_buff= batch_readline_command(argument)))
+ return 1;
+ ignore_errors= 0;
+ break;
+ case 'o':
+ if (argument == disabled_my_option)
+ one_database= 0;
+ else
+ one_database= skip_updates= 1;
+ break;
+ case 'p':
+ if (argument == disabled_my_option)
+ argument= (char*) ""; // Don't require password
+ if (argument)
+ {
+ char *start= argument;
+ my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ opt_password= my_strdup(argument, MYF(MY_FAE));
+ while (*argument) *argument++= 'x'; // Destroy argument
+ if (*start)
+ start[1]=0 ;
+ }
+ else
+ tty_password= 1;
+ break;
+ case '#':
+ DBUG_PUSH(argument ? argument : default_dbug_option);
+ info_flag= 1;
+ break;
+ case 's':
+ if (argument == disabled_my_option)
+ opt_silent= 0;
+ else
+ opt_silent++;
+ break;
+ case 'v':
+ if (argument == disabled_my_option)
+ verbose= 0;
+ else
+ verbose++;
+ break;
+ case 'B':
+ if (!status.batch)
+ {
+ status.batch= 1;
+ status.add_to_history= 0;
+ opt_silent++; // more silent
+ }
+ break;
+ case 'W':
#ifdef __WIN__
- opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
+ opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
#endif
- break;
- case 'V':
- usage(1);
- exit(0);
- case 'I':
- case '?':
- usage(0);
- exit(0);
+ break;
+ case 'V':
+ usage(1);
+ exit(0);
+ case 'I':
+ case '?':
+ usage(0);
+ exit(0);
#include "sslopt-case.h"
}
return 0;
@@ -739,11 +739,7 @@ static int get_options(int argc, char **argv)
strmov(default_pager, pager);
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (status.batch) /* disable pager and outfile in this case */
{
@@ -1514,17 +1510,22 @@ static void end_pager()
static void init_tee()
{
+ if (opt_outfile)
+ end_tee();
if (!(OUTFILE= my_fopen(outfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
{
- opt_outfile=0;
+ opt_outfile= 0;
init_pager();
return;
}
+ opt_outfile= 1;
+ tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
}
static void end_tee()
{
my_fclose(OUTFILE, MYF(0));
+ opt_outfile= 0;
return;
}
@@ -1599,18 +1600,19 @@ print_table_data(MYSQL_RES *result)
tee_puts(separator.c_ptr(), PAGER);
}
- while ((cur = mysql_fetch_row(result)))
+ while ((cur= mysql_fetch_row(result)))
{
(void) tee_fputs("|", PAGER);
- mysql_field_seek(result,0);
- for (uint off=0 ; off < mysql_num_fields(result); off++)
+ mysql_field_seek(result, 0);
+ for (uint off= 0; off < mysql_num_fields(result); off++)
{
- const char *str=cur[off] ? cur[off] : "NULL";
- field = mysql_fetch_field(result);
- uint length=field->max_length;
+ const char *str= cur[off] ? cur[off] : "NULL";
+ field= mysql_fetch_field(result);
+ uint length= field->max_length;
if (length > MAX_COLUMN_LENGTH)
{
- tee_fputs(str,PAGER); tee_fputs(" |",PAGER);
+ tee_fputs(str, PAGER);
+ tee_fputs(" |", PAGER);
}
else
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
@@ -1811,7 +1813,7 @@ print_tab_data(MYSQL_RES *result)
for (uint off=1 ; off < mysql_num_fields(result); off++)
{
(void) tee_fputs("\t", PAGER);
- safe_put_field(cur[off],lengths[off]);
+ safe_put_field(cur[off], lengths[off]);
}
(void) tee_fputs("\n", PAGER);
}
@@ -1830,8 +1832,8 @@ com_tee(String *buffer, char *line __attribute__((unused)))
{
if (!strlen(outfile))
{
- printf("No previous outfile available, you must give the filename!\n");
- opt_outfile=0;
+ printf("No previous outfile available, you must give a filename!\n");
+ opt_outfile= 0;
return 0;
}
}
@@ -1839,10 +1841,10 @@ com_tee(String *buffer, char *line __attribute__((unused)))
{
while (isspace(*param))
param++;
- end=strmake(file_name, param, sizeof(file_name)-1);
+ end= strmake(file_name, param, sizeof(file_name) - 1);
while (end > file_name && (isspace(end[-1]) || iscntrl(end[-1])))
end--;
- end[0]=0;
+ end[0]= 0;
strmov(outfile, file_name);
}
if (!strlen(outfile))
@@ -1850,12 +1852,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
printf("No outfile specified!\n");
return 0;
}
- if (!opt_outfile)
- {
- init_tee();
- opt_outfile=1;
- }
- tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
+ init_tee();
return 0;
}
@@ -1865,7 +1862,6 @@ com_notee(String *buffer __attribute__((unused)),
{
if (opt_outfile)
end_tee();
- opt_outfile=0;
tee_fprintf(stdout, "Outfile disabled.\n");
return 0;
}
@@ -2288,11 +2284,11 @@ com_status(String *buffer __attribute__((unused)),
}
#ifdef HAVE_OPENSSL
if (mysql.net.vio->ssl_ && SSL_get_cipher(mysql.net.vio->ssl_))
- tee_fprintf(stdout, "SSL cipher in use is %s\n",
+ tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
SSL_get_cipher(mysql.net.vio->ssl_));
else
#endif /* HAVE_OPENSSL */
- tee_puts("SSL is not in use\n", stdout);
+ tee_puts("SSL:\t\t\tNot in use", stdout);
}
else
{
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index 6fa8e8220f4..fd2a17eee31 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -23,7 +23,7 @@
#include <my_pthread.h> /* because of signal() */
#endif
-#define ADMIN_VERSION "8.34"
+#define ADMIN_VERSION "8.35"
#define MAX_MYSQL_VAR 64
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@@ -130,7 +130,7 @@ static struct my_option my_long_options[] =
(gptr*) &opt_relative, (gptr*) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"set-variable", 'O',
- "Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
+ "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Silently exit if one can't connect to server",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -247,11 +247,8 @@ int main(int argc,char *argv[])
free_defaults()
*/
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (argc == 0)
{
usage();
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index e420e3b6ad8..3020e105954 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -124,7 +124,7 @@ static void die(const char* fmt, ...)
static void print_version()
{
- printf("%s Ver 2.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+ printf("%s Ver 2.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
@@ -223,11 +223,8 @@ static int parse_args(int *argc, char*** argv)
result_file = stdout;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index f0d7e998aa9..78cd277f9be 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
-#define CHECK_VERSION "2.3"
+#define CHECK_VERSION "2.4"
#include "client_priv.h"
#include <m_ctype.h>
@@ -265,11 +265,7 @@ static int get_options(int *argc, char ***argv)
load_defaults("my", load_default_groups, argc, argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (!what_to_do)
{
diff --git a/client/mysqldump.c b/client/mysqldump.c
index e2b9ab3f6b5..8d9e44eba1b 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -35,7 +35,7 @@
** and adapted to mysqldump 05/11/01 by Jani Tolonen
*/
-#define DUMP_VERSION "9.05"
+#define DUMP_VERSION "9.06"
#include <my_global.h>
#include <my_sys.h>
@@ -180,7 +180,7 @@ static struct my_option my_long_options[] =
{"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
- "Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
+ "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"opt", OPT_OPTIMIZE,
"Same as --add-drop-table --add-locks --all --quick --extended-insert --lock-tables --disable-keys",
@@ -360,11 +360,7 @@ static int get_options(int *argc, char ***argv)
load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (opt_delayed)
opt_lock=0; /* Can't have lock with delayed */
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index bc7860a052d..1933ea41bcf 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -25,7 +25,7 @@
** * *
** *************************
*/
-#define IMPORT_VERSION "3.3"
+#define IMPORT_VERSION "3.4"
#include "client_priv.h"
#include "mysql_version.h"
@@ -204,11 +204,8 @@ static int get_options(int *argc, char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (enclosed && opt_enclosed)
{
fprintf(stderr, "You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n");
diff --git a/client/mysqlmanager-pwgen.c b/client/mysqlmanager-pwgen.c
index fef5cdf6661..40126e279b5 100644
--- a/client/mysqlmanager-pwgen.c
+++ b/client/mysqlmanager-pwgen.c
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#define MANAGER_PWGEN_VERSION "1.2"
+#define MANAGER_PWGEN_VERSION "1.4"
#include <my_global.h>
#include <m_ctype.h>
@@ -86,9 +86,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'V':
print_version();
exit(0);
- default:
- usage();
- exit(1);
}
return 0;
}
@@ -99,11 +96,8 @@ int parse_args(int argc, char** argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}
diff --git a/client/mysqlmanagerc.c b/client/mysqlmanagerc.c
index 82b70ed1b44..f200b993147 100644
--- a/client/mysqlmanagerc.c
+++ b/client/mysqlmanagerc.c
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#define MANAGER_CLIENT_VERSION "1.3"
+#define MANAGER_CLIENT_VERSION "1.4"
#include <my_global.h>
#include <mysql.h>
@@ -132,12 +132,10 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv;
+
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}
int main(int argc, char** argv)
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 74a41e69b1f..81b4d2ab4f7 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -16,7 +16,7 @@
/* Show databases, tables or columns */
-#define SHOW_VERSION "9.3"
+#define SHOW_VERSION "9.4"
#include <my_global.h>
#include "client_priv.h"
@@ -241,11 +241,7 @@ get_options(int *argc,char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (tty_password)
opt_password=get_tty_password(NullS);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index f2dd19424d1..8fad182193b 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -42,7 +42,7 @@
**********************************************************************/
-#define MTEST_VERSION "1.21"
+#define MTEST_VERSION "1.24"
#include <my_global.h>
#include <mysql_embed.h>
@@ -1446,12 +1446,14 @@ int do_connect(struct st_query* q)
die("Failed on mysql_init()");
if (opt_compress)
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
+ mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
+
if (con_sock && !free_con_sock && *con_sock && *con_sock != FN_LIBCHAR)
con_sock=fn_format(buff, con_sock, TMPDIR, "",0);
if (!con_db[0])
con_db=db;
/* Special database to allow one to connect without a database name */
- if (!strcmp(con_db,"*NO-ONE*"))
+ if (con_db && !strcmp(con_db,"*NO-ONE*"))
con_db=0;
if ((con_error = safe_connect(&next_con->mysql, con_host,
con_user, con_pass,
@@ -1957,11 +1959,7 @@ int parse_args(int argc, char **argv)
default_argv= argv;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (argc > 1)
{
@@ -2359,6 +2357,8 @@ int main(int argc, char** argv)
die("Failed in mysql_init()");
if (opt_compress)
mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
+ mysql_options(&cur_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
+
cur_con->name = my_strdup("default", MYF(MY_WME));
if (!cur_con->name)
die("Out of memory");
@@ -2410,9 +2410,11 @@ int main(int argc, char** argv)
case Q_QUERY:
case Q_REAP:
{
- int flags = QUERY_REAP; /* we read the result always regardless
- * of the mode for both full query and
- * read-result only ( reap) */
+ /*
+ We read the result always regardless of the mode for both full
+ query and read-result only (reap)
+ */
+ int flags = QUERY_REAP;
if (q->type != Q_REAP) /* for a full query, enable the send stage */
flags |= QUERY_SEND;
if (q_send_flag)
@@ -2439,12 +2441,13 @@ int main(int argc, char** argv)
/* fix up query pointer if this is * first iteration for this line */
if (q->query == q->query_buf)
q->query += q->first_word_len;
- error |= run_query(&cur_con->mysql, q, QUERY_SEND);
- /* run query can execute a query partially, depending on the flags
- * QUERY_SEND flag without QUERY_REAP tells it to just send the
- * query and read the result some time later when reap instruction
- * is given on this connection
+ /*
+ run_query() can execute a query partially, depending on the flags
+ QUERY_SEND flag without QUERY_REAP tells it to just send the
+ query and read the result some time later when reap instruction
+ is given on this connection.
*/
+ error |= run_query(&cur_con->mysql, q, QUERY_SEND);
break;
case Q_RESULT:
get_file_name(save_file,q);
diff --git a/client/thread_test.c b/client/thread_test.c
index 10183ca5150..2900ab712e2 100644
--- a/client/thread_test.c
+++ b/client/thread_test.c
@@ -173,11 +173,7 @@ static void get_options(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
free_defaults(argv);
if (tty_password)
diff --git a/configure.in b/configure.in
index b9018e6a8ad..970336af518 100644
--- a/configure.in
+++ b/configure.in
@@ -690,6 +690,9 @@ AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT))
+# For sem_xxx functions on Solaris 2.6
+AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4))
+
# For compress in zlib
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
@@ -1602,7 +1605,7 @@ then
fi
AC_TRY_COMPILE(
[#undef inline
-#if !defined(SCO) && !defined(__osf__)
+#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
#define _REENTRANT
#endif
#include <pthread.h>
@@ -1635,7 +1638,7 @@ then
fi
AC_TRY_COMPILE(
[#undef inline
-#if !defined(SCO) && !defined(__osf__)
+#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
#define _REENTRANT
#endif
#include <pthread.h>
@@ -1667,7 +1670,7 @@ then
fi
AC_TRY_COMPILE(
[#undef inline
-#if !defined(SCO) && !defined(__osf__)
+#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
#define _REENTRANT
#endif
#include <pthread.h>
@@ -1693,7 +1696,7 @@ then
# Check definition of pthread_getspecific
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
AC_TRY_COMPILE(
-[#if !defined(SCO) && !defined(__osf__)
+[#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
#define _REENTRANT
#endif
#define _POSIX_PTHREAD_SEMANTICS
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index 2c87ee11820..c0f8a54f432 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -55,7 +55,7 @@ static struct my_option my_long_options[] =
static void usage(my_bool version)
{
- printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.5 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
if (version)
return;
@@ -92,11 +92,8 @@ static int get_options(int *argc,char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (*argc < 1)
{
usage(0);
diff --git a/extra/mysql_install.c b/extra/mysql_install.c
index 0153ad3bf70..e2783f906b9 100644
--- a/extra/mysql_install.c
+++ b/extra/mysql_install.c
@@ -18,7 +18,7 @@
/* Install or upgrade MySQL server. By Sasha Pachev <sasha@mysql.com>
*/
-#define INSTALL_VERSION "1.1"
+#define INSTALL_VERSION "1.2"
#define DONT_USE_RAID
#include <my_global.h>
@@ -219,11 +219,8 @@ static int parse_args(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}
diff --git a/extra/perror.c b/extra/perror.c
index da62913b4a4..4d05adf29aa 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -16,7 +16,7 @@
/* Return error-text for system error messages and nisam messages */
-#define PERROR_VERSION "2.8"
+#define PERROR_VERSION "2.9"
#include <my_global.h>
#include <my_sys.h>
@@ -141,11 +141,8 @@ static int get_options(int *argc,char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (!*argc && !print_all_codes)
{
usage();
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c
index 23f22e276a6..8379da97795 100644
--- a/extra/resolve_stack_dump.c
+++ b/extra/resolve_stack_dump.c
@@ -30,7 +30,7 @@
#define INIT_SYM_TABLE 4096
#define INC_SYM_TABLE 4096
#define MAX_SYM_SIZE 128
-#define DUMP_VERSION "1.3"
+#define DUMP_VERSION "1.4"
#define HEX_INVALID (uchar)255
typedef ulong my_long_addr_t ; /* at some point, we need to fix configure
@@ -121,11 +121,8 @@ static int parse_args(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
/*
The following code is to make the command compatible with the old
version that required one to use the -n and -s options
diff --git a/extra/resolveip.c b/extra/resolveip.c
index 8c2c264ea2e..e380d920e9f 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -16,11 +16,10 @@
/* Resolves IP's to hostname and hostnames to IP's */
-#define RESOLVE_VERSION "2.1"
+#define RESOLVE_VERSION "2.2"
#include <my_global.h>
#include <m_ctype.h>
-#include <my_net.h>
#include <my_sys.h>
#include <m_string.h>
#include <sys/types.h>
@@ -30,13 +29,9 @@
#endif
#include <arpa/inet.h>
#include <netdb.h>
+#include <my_net.h>
#include <my_getopt.h>
-#ifdef SCO
-#undef h_errno
-#define h_errno errno
-#endif
-
#if !defined(_AIX) && !defined(HAVE_UNIXWARE7_THREADS) && !defined(HAVE_UNIXWARE7_POSIX) && !defined(h_errno)
extern int h_errno;
#endif
@@ -99,11 +94,8 @@ static int get_options(int *argc,char ***argv)
/* load_defaults("my",load_default_groups,argc,argv); */
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (*argc == 0)
{
usage();
diff --git a/include/my_getopt.h b/include/my_getopt.h
index ae12e921aa0..3b50fbe2ded 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -39,6 +39,7 @@ struct my_option
};
extern char *disabled_my_option;
+extern my_bool my_getopt_print_errors;
extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts,
diff --git a/include/my_net.h b/include/my_net.h
index 79ddc7d08f6..2f5743923cf 100644
--- a/include/my_net.h
+++ b/include/my_net.h
@@ -71,19 +71,22 @@ void my_inet_ntoa(struct in_addr in, char *buf);
Handling of gethostbyname_r()
*/
-#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
#if !defined(HPUX)
struct hostent;
#endif /* HPUX */
+#if !defined(HAVE_GETHOSTBYNAME_R)
+struct hostent *my_gethostbyname_r(const char *name,
+ struct hostent *result, char *buffer,
+ int buflen, int *h_errnop);
+void my_gethostbyname_r_free();
+#elif defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop);
#define my_gethostbyname_r_free()
-#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-#define GETHOSTBYNAME_BUFF_SIZE 2048
-#else
+#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX)
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
-#endif /* defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
+#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
@@ -91,17 +94,20 @@ struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop);
#define my_gethostbyname_r_free()
-#elif !defined(HAVE_GETHOSTBYNAME_R)
-#define GETHOSTBYNAME_BUFF_SIZE 2048
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-void my_gethostbyname_r_free();
#else
-#define GETHOSTBYNAME_BUFF_SIZE 2048
#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
#define my_gethostbyname_r_free()
-#endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
+#endif /* !defined(HAVE_GETHOSTBYNAME_R) */
+
+#ifndef GETHOSTBYNAME_BUFF_SIZE
+#define GETHOSTBYNAME_BUFF_SIZE 2048
+#endif
+
+/* On SCO you get a link error when refering to h_errno */
+#ifdef SCO
+#undef h_errno
+#define h_errno errno
+#endif
C_MODE_END
#endif
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 62088fc56cb..fda31b9d4f2 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -349,7 +349,7 @@ extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
#undef HAVE_GETHOSTBYADDR_R /* No definition */
#endif
-#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT)
+#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) && !defined(SAFE_MUTEX)
extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
struct timespec *abstime);
diff --git a/include/my_sys.h b/include/my_sys.h
index 3ff35763bce..7ad638bcca8 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -302,33 +302,41 @@ typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
typedef struct st_io_cache /* Used when cacheing files */
{
- /* pos_in_file is offset in file corresponding to the first byte of
- byte* buffer. end_of_file is the offset of end of file for READ_CACHE
- and WRITE_CACHE. For SEQ_READ_APPEND it the maximum of the actual
- end of file and the position represented by read_end.
+ /* Offset in file corresponding to the first byte of byte* buffer. */
+ my_off_t pos_in_file;
+ /*
+ The offset of end of file for READ_CACHE and WRITE_CACHE.
+ For SEQ_READ_APPEND it the maximum of the actual end of file and
+ the position represented by read_end.
*/
- my_off_t pos_in_file,end_of_file;
- /* read_pos points to current read position in the buffer
- read_end is the non-inclusive boundary in the buffer for the currently
- valid read area
- buffer is the read buffer
- not sure about request_pos except that it is used in async_io
+ my_off_t end_of_file;
+ /* Points to current read position in the buffer */
+ byte *read_pos;
+ /* the non-inclusive boundary in the buffer for the currently valid read */
+ byte *read_end;
+ byte *buffer; /* The read buffer */
+ /* Used in ASYNC_IO */
+ byte *request_pos;
+
+ /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */
+ byte *write_buffer;
+ /*
+ Only used in SEQ_READ_APPEND, and points to the current read position
+ in the write buffer. Note that reads in SEQ_READ_APPEND caches can
+ happen from both read buffer (byte* buffer) and write buffer
+ (byte* write_buffer).
*/
- byte *read_pos,*read_end,*buffer,*request_pos;
- /* write_buffer is used only in WRITE caches and in SEQ_READ_APPEND to
- buffer writes
- append_read_pos is only used in SEQ_READ_APPEND, and points to the
- current read position in the write buffer. Note that reads in
- SEQ_READ_APPEND caches can happen from both read buffer (byte* buffer),
- and write buffer (byte* write_buffer).
- write_pos points to current write position in the write buffer and
- write_end is the non-inclusive boundary of the valid write area
- */
- byte *write_buffer, *append_read_pos, *write_pos, *write_end;
- /* current_pos and current_end are convenience variables used by
- my_b_tell() and other routines that need to know the current offset
- current_pos points to &write_pos, and current_end to &write_end in a
- WRITE_CACHE, and &read_pos and &read_end respectively otherwise
+ byte *append_read_pos;
+ /* Points to current write position in the write buffer */
+ byte *write_pos;
+ /* The non-inclusive boundary of the valid write area */
+ byte *write_end;
+
+ /*
+ Current_pos and current_end are convenience variables used by
+ my_b_tell() and other routines that need to know the current offset
+ current_pos points to &write_pos, and current_end to &write_end in a
+ WRITE_CACHE, and &read_pos and &read_end respectively otherwise
*/
byte **current_pos, **current_end;
/* The lock is for append buffer used in SEQ_READ_APPEND cache */
@@ -336,70 +344,64 @@ typedef struct st_io_cache /* Used when cacheing files */
pthread_mutex_t append_buffer_lock;
/* need mutex copying from append buffer to read buffer */
#endif
- /* a caller will use my_b_read() macro to read from the cache
- if the data is already in cache, it will be simply copied with
- memcpy() and internal variables will be accordinging updated with
- no functions invoked. However, if the data is not fully in the cache,
- my_b_read() will call read_function to fetch the data. read_function
- must never be invoked directly
+ /*
+ A caller will use my_b_read() macro to read from the cache
+ if the data is already in cache, it will be simply copied with
+ memcpy() and internal variables will be accordinging updated with
+ no functions invoked. However, if the data is not fully in the cache,
+ my_b_read() will call read_function to fetch the data. read_function
+ must never be invoked directly.
*/
int (*read_function)(struct st_io_cache *,byte *,uint);
- /* same idea as in the case of read_function, except my_b_write() needs to
- be replaced with my_b_append() for a SEQ_READ_APPEND cache
+ /*
+ Same idea as in the case of read_function, except my_b_write() needs to
+ be replaced with my_b_append() for a SEQ_READ_APPEND cache
*/
int (*write_function)(struct st_io_cache *,const byte *,uint);
- /* specifies the type of the cache. Depending on the type of the cache
+ /*
+ Specifies the type of the cache. Depending on the type of the cache
certain operations might not be available and yield unpredicatable
results. Details to be documented later
*/
enum cache_type type;
- /* callbacks when the actual read I/O happens. These were added and
- are currently used for binary logging of LOAD DATA INFILE - when a
- block is read from the file, we create a block create/append event, and
- when IO_CACHE is closed, we create an end event. These functions could,
- of course be used for other things
+ /*
+ Callbacks when the actual read I/O happens. These were added and
+ are currently used for binary logging of LOAD DATA INFILE - when a
+ block is read from the file, we create a block create/append event, and
+ when IO_CACHE is closed, we create an end event. These functions could,
+ of course be used for other things
*/
IO_CACHE_CALLBACK pre_read;
IO_CACHE_CALLBACK post_read;
IO_CACHE_CALLBACK pre_close;
- void* arg; /* for use by pre/post_read */
+ void* arg; /* for use by pre/post_read */
char *file_name; /* if used with 'open_cached_file' */
char *dir,*prefix;
File file; /* file descriptor */
- /* seek_not_done is set by my_b_seek() to inform the upcoming read/write
- operation that a seek needs to be preformed prior to the actual I/O
- error is 0 if the cache operation was successful, -1 if there was a
- "hard" error, and the actual number of I/O-ed bytes if the read/write was
- partial
+ /*
+ seek_not_done is set by my_b_seek() to inform the upcoming read/write
+ operation that a seek needs to be preformed prior to the actual I/O
+ error is 0 if the cache operation was successful, -1 if there was a
+ "hard" error, and the actual number of I/O-ed bytes if the read/write was
+ partial.
*/
int seek_not_done,error;
- /* buffer_length is the size of memory allocated for buffer or write_buffer
- read_length is the same as buffer_length except when we use async io
- not sure why we need it
- */
- uint buffer_length,read_length;
+ /* buffer_length is memory size allocated for buffer or write_buffer */
+ uint buffer_length;
+ /* read_length is the same as buffer_length except when we use async io */
+ uint read_length;
myf myflags; /* Flags used to my_read/my_write */
- /*
+ /*
alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
- 0 if it was supplied by the user
+ 0 if it was supplied by the user.
Currently READ_NET is the only one that will use a buffer allocated
somewhere else
*/
my_bool alloced_buffer;
- /* init_count is incremented every time we call init_io_cache()
- It is not reset in end_io_cache(). This variable
- was introduced for slave relay logs - RELAY_LOG_INFO stores a pointer
- to IO_CACHE that could in some cases refer to the IO_CACHE of the
- currently active relay log. The IO_CACHE then could be closed,
- re-opened and start pointing to a different log file. In that case,
- we could not know reliably if this happened without init_count
- one must be careful with bzero() prior to the subsequent init_io_cache()
- call
- */
- int init_count;
#ifdef HAVE_AIOWAIT
- /* as inidicated by ifdef, this is for async I/O, we will have
- Sinisa comment this some time
+ /*
+ As inidicated by ifdef, this is for async I/O, which is not currently
+ used (because it's not reliable on all systems)
*/
uint inited;
my_off_t aio_read_pos;
@@ -428,7 +430,6 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
((info)->write_pos+=(Count)),0) : \
(*(info)->write_function)((info),(Buffer),(Count)))
-
#define my_b_get(info) \
((info)->read_pos != (info)->read_end ?\
((info)->read_pos++, (int) (uchar) (info)->read_pos[-1]) :\
@@ -591,7 +592,7 @@ extern int my_sortncmp(const char *s,uint s_len, const char *t,uint t_len);
extern WF_PACK *wf_comp(my_string 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_s stripp_sp(my_string str);
+extern size_s strip_sp(my_string str);
extern void get_date(my_string to,int timeflag,time_t use_time);
extern void soundex(my_string out_pntr, my_string in_pntr,pbool remove_garbage);
extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file,
diff --git a/include/mysys_err.h b/include/mysys_err.h
index b3d058aff3e..a86765c74fd 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -54,7 +54,23 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_CANT_SYMLINK 25
#define EE_REALPATH 26
+ /* exit codes for all MySQL programs */
+
+#define EXIT_UNSPECIFIED_ERROR 1
+#define EXIT_UNKNOWN_OPTION 2
+#define EXIT_AMBIGUOUS_OPTION 3
+#define EXIT_NO_ARGUMENT_ALLOWED 4
+#define EXIT_ARGUMENT_REQUIRED 5
+#define EXIT_VAR_PREFIX_NOT_UNIQUE 6
+#define EXIT_UNKNOWN_VARIABLE 7
+#define EXIT_OUT_OF_MEMORY 8
+#define EXIT_UNKNOWN_SUFFIX 9
+#define EXIT_NO_PTR_TO_VARIABLE 10
+#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
+
+
#ifdef __cplusplus
}
#endif
#endif
+
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index f366ce0d160..39f3566eac8 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -1631,6 +1631,7 @@ srv_init(void)
for (i = 0; i < OS_THREAD_MAX_N; i++) {
slot = srv_table_get_nth_slot(i);
slot->in_use = FALSE;
+ slot->type=0; /* Avoid purify errors */
slot->event = os_event_create(NULL);
ut_a(slot->event);
}
@@ -1899,7 +1900,6 @@ srv_conc_exit_innodb(
trx_t* trx) /* in: transaction object associated with the
thread */
{
- srv_conc_slot_t* slot = NULL;
if (srv_thread_concurrency >= 500) {
@@ -2514,11 +2514,11 @@ loop:
can drop tables lazily after there no longer are SELECT
queries to them. */
- srv_main_thread_op_info = "doing background drop tables";
+ srv_main_thread_op_info = (char*) "doing background drop tables";
row_drop_tables_for_mysql_in_background();
- srv_main_thread_op_info = "";
+ srv_main_thread_op_info = (char*) "";
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
@@ -2630,19 +2630,19 @@ background_loop:
/* In this loop we run background operations when the server
is quiet and we also come here about once in 10 seconds */
- srv_main_thread_op_info = "doing background drop tables";
+ srv_main_thread_op_info = (char*) "doing background drop tables";
n_tables_to_drop = row_drop_tables_for_mysql_in_background();
- srv_main_thread_op_info = "";
+ srv_main_thread_op_info = (char*) "";
- srv_main_thread_op_info = "flushing buffer pool pages";
+ srv_main_thread_op_info = (char*) "flushing buffer pool pages";
/* Flush a few oldest pages to make the checkpoint younger */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10, ut_dulint_max);
- srv_main_thread_op_info = "making checkpoint";
+ srv_main_thread_op_info = (char*) "making checkpoint";
/* Make a new checkpoint about once in 10 seconds */
diff --git a/isam/isamchk.c b/isam/isamchk.c
index 7c604973108..23bded29f79 100644
--- a/isam/isamchk.c
+++ b/isam/isamchk.c
@@ -335,7 +335,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 6.00 for %s at %s\n", my_progname, SYSTEM_TYPE,
+ printf("%s Ver 6.01 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -665,11 +665,7 @@ static void get_options(register int *argc, register char ***argv)
testflag|=T_WRITE_LOOP;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (*argc == 0)
{
diff --git a/isam/pack_isam.c b/isam/pack_isam.c
index d0a2111c34a..a08f710c89b 100644
--- a/isam/pack_isam.c
+++ b/isam/pack_isam.c
@@ -278,7 +278,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 5.9 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+ printf("%s Ver 5.10 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
static void usage(void)
@@ -353,11 +353,8 @@ static void get_options(int *argc, char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
my_progname= argv[0][0];
if (isatty(fileno(stdout)))
write_loop=1;
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 88e003bc2c7..73fc1feb472 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -217,8 +217,13 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen,
{
tv.tv_sec = (long) timeout;
tv.tv_usec = 0;
+#if defined(HPUX) && defined(THREAD)
+ if ((res = select(s+1, NULL, (int*) &sfds, NULL, &tv)) >= 0)
+ break;
+#else
if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0)
break;
+#endif
now_time=time(NULL);
timeout-= (uint) (now_time - start_time);
if (errno != EINTR || (int) timeout <= 0)
diff --git a/libmysqld/lib_vio.c b/libmysqld/lib_vio.c
index 9bf492ed5ea..5460c546faa 100644
--- a/libmysqld/lib_vio.c
+++ b/libmysqld/lib_vio.c
@@ -61,15 +61,16 @@ struct st_vio
Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
{
- Vio * vio = NULL;
- vio = (Vio *) my_malloc (sizeof(*vio),MYF(MY_WME|MY_ZEROFILL));
- if (vio)
+ DBUG_ENTER("vio_new");
+ Vio * vio;
+
+ if ((vio= (Vio *) my_malloc(sizeof(*vio),MYF(MY_WME|MY_ZEROFILL))))
{
init_alloc_root(&vio->root, 8192, 8192);
vio->root.min_malloc = sizeof(char *) + 4;
vio->last_packet = &vio->packets;
}
- return (vio);
+ DBUG_RETURN(vio);
}
@@ -84,19 +85,24 @@ Vio *vio_new_win32pipe(HANDLE hPipe)
void vio_delete(Vio * vio)
{
+ DBUG_ENTER("vio_delete");
if (vio)
{
- if (vio->type != VIO_CLOSED) vio_close(vio);
+ if (vio->type != VIO_CLOSED)
+ vio_close(vio);
free_root(&vio->root, MYF(0));
- my_free((gptr)vio, MYF(0));
+ my_free((gptr) vio, MYF(0));
}
+ DBUG_VOID_RETURN;
}
void vio_reset(Vio *vio)
{
+ DBUG_ENTER("vio_reset");
free_root(&vio->root, MYF(MY_KEEP_PREALLOC));
vio->packets = vio->where_in_packet = vio->end_of_packet = 0;
vio->last_packet = &vio->packets;
+ DBUG_VOID_RETURN;
}
int vio_errno(Vio *vio __attribute__((unused)))
@@ -124,6 +130,7 @@ int vio_read(Vio * vio, gptr buf, int size)
int vio_write(Vio * vio, const gptr buf, int size)
{
+ DBUG_ENTER("vio_write");
char *packet;
if (vio->reading)
{
@@ -141,7 +148,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
}
else
size= -1;
- return (size);
+ DBUG_RETURN(size);
}
int vio_blocking(Vio * vio, my_bool set_blocking_mode)
diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c
index 619e59efc3e..822603212a0 100644
--- a/myisam/ft_dump.c
+++ b/myisam/ft_dump.c
@@ -245,11 +245,7 @@ static void get_options(int argc, char *argv[])
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
} /* get options */
diff --git a/myisam/ft_eval.c b/myisam/ft_eval.c
index 1b40209563d..e196121d7af 100644
--- a/myisam/ft_eval.c
+++ b/myisam/ft_eval.c
@@ -179,11 +179,8 @@ static void get_options(int argc, char *argv[])
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if(!(d_file=argv[optind])) print_error(1,"No d_file");
if(!(df=fopen(d_file,"r")))
print_error(1,"fopen(%s)",d_file);
diff --git a/myisam/ft_test1.c b/myisam/ft_test1.c
index 728ea4cd047..6fa347f594a 100644
--- a/myisam/ft_test1.c
+++ b/myisam/ft_test1.c
@@ -284,11 +284,7 @@ static void get_options(int argc,char *argv[])
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
return;
} /* get options */
diff --git a/myisam/mi_test1.c b/myisam/mi_test1.c
index 84810cb25ea..d0ce3ea966e 100644
--- a/myisam/mi_test1.c
+++ b/myisam/mi_test1.c
@@ -623,7 +623,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
key_cacheing=1;
break;
case 'V':
- printf("test1 Ver 1.1 \n");
+ printf("test1 Ver 1.2 \n");
exit(0);
case '#':
DEBUGGER_ON;
@@ -644,11 +644,8 @@ static void get_options(int argc, char *argv[])
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return;
} /* get options */
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 0cd3e5f3139..379a985705d 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -292,7 +292,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 2.5 for %s at %s\n", my_progname, SYSTEM_TYPE,
+ printf("%s Ver 2.6 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -615,13 +615,15 @@ get_one_option(int optid,
static void get_options(register int *argc,register char ***argv)
{
+ int ho_error;
+
load_defaults("my", load_default_groups, argc, argv);
default_argv= *argv;
if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP;
- if (handle_options(argc, argv, my_long_options, get_one_option))
- exit(1);
+ if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
+ exit(ho_error);
/* If using repair, then update checksum if one uses --update-state */
if ((check_param.testflag & T_UPDATE_STATE) &&
diff --git a/myisam/myisampack.c b/myisam/myisampack.c
index 2cadeaae72a..0064b50348f 100644
--- a/myisam/myisampack.c
+++ b/myisam/myisampack.c
@@ -269,7 +269,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 1.20 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+ printf("%s Ver 1.21 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
static void usage(void)
@@ -347,11 +347,8 @@ static void get_options(int *argc,char ***argv)
write_loop=1;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (!*argc)
{
usage();
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 7ae89c96169..66bc7f5069b 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -675,9 +675,9 @@ manager_launch()
ident=$1
shift
if [ $USE_MANAGER = 0 ] ; then
- $@ >$CUR_MYERR 2>&1 &
- sleep 2 #hack
- return
+ $@ >$CUR_MYERR 2>&1 &
+ sleep 2 #hack
+ return
fi
$MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
--password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF
@@ -687,7 +687,7 @@ set_exec_stderr $ident $CUR_MYERR
set_exec_con $ident root localhost $CUR_MYSOCK
start_exec $ident $START_WAIT_TIMEOUT
EOF
- abort_if_failed "Could not execute manager command"
+ abort_if_failed "Could not execute manager command"
}
manager_term()
@@ -887,13 +887,23 @@ start_slave()
"gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD
elif [ x$DO_GDB = x1 ]
then
- $ECHO "set args $slave_args" > $GDB_SLAVE_INIT
if [ x$MANUAL_GDB = x1 ]
then
+ $ECHO "set args $slave_args" > $GDB_SLAVE_INIT
echo "To start gdb for the slave, type in another window:"
echo "cd $CWD ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
wait_for_slave=1500
else
+ ( $ECHO set args $slave_args;
+ if [ $USE_MANAGER = 0 ] ; then
+ cat <<EOF
+b mysql_parse
+commands 1
+disa 1
+end
+r
+EOF
+ fi ) > $GDB_SLAVE_INIT
manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
fi
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index f0c3e2d162a..1d6d69465da 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -114,3 +114,11 @@ i
3
4
drop table t1;
+create table t1 (i int unsigned not null auto_increment primary key);
+alter table t1 rename t2;
+alter table t2 rename t1, add c char(10) comment "no comment";
+show columns from t1;
+Field Type Null Key Default Extra
+i int(10) unsigned PRI NULL auto_increment
+c char(10) YES NULL
+drop table t1;
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index fce98a58682..f067d1f651e 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -4,9 +4,9 @@ floor(5.5) floor(-5.5)
select ceiling(5.5),ceiling(-5.5);
ceiling(5.5) ceiling(-5.5)
6 -5
-select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2);
-truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2)
-52.6 52.64 50 0
+select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
+truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)
+52.6 52.64 50 0 -52.6 -50
select round(5.5),round(-5.5);
round(5.5) round(-5.5)
6 -6
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index aaa03f2668a..d990760d39b 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -393,3 +393,26 @@ One Two sum(Four)
1 2 16
1 3 16
drop table if exists t1;
+drop table if exists t1,t2;
+create table t1 (id integer primary key not null auto_increment, gender char(1));
+insert into t1 values(NULL, 'M');
+insert into t1 values(NULL, 'F');
+insert into t1 values(NULL, 'F');
+insert into t1 values(NULL, 'F');
+insert into t1 values(NULL, 'M');
+create table t2 (user_id integer not null, timestamp datetime);
+insert into t2 values (1, sysdate());
+insert into t2 values (2, sysdate());
+insert into t2 values (1, sysdate());
+insert into t2 values (3, sysdate());
+insert into t2 values (4, sysdate());
+insert into t2 values (4, sysdate());
+select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender;
+gender dist_count percentage
+F 3 60.00
+M 1 20.00
+select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender order by percentage;
+gender dist_count percentage
+M 1 20.00
+F 3 60.00
+drop table t1,t2;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 85819d9571d..b31677069af 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -66,3 +66,7 @@ select count(*) from t3 where id3;
count(*)
0
drop table t1,t2,t3;
+create table t1(id1 int not null auto_increment primary key, t varchar(100));
+create table t2(id2 int not null, t varchar(100), index(id2));
+delete t1, t2 from t2,t1 where t1.id1 = t2.id2 and t1.id1 > 100;
+drop table t1,t2;
diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result
new file mode 100644
index 00000000000..6ae5d15031b
--- /dev/null
+++ b/mysql-test/r/rpl_empty_master_crash.result
@@ -0,0 +1,12 @@
+slave stop;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+use test;
+drop table if exists t1;
+show slave status;
+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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+ 0 0 0 0 No No 0 0 0 0
+load table t1 from master;
+Error in fetch_master_table
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index 355133532bf..ee3bd077798 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1622,3 +1622,17 @@ field
429002
429003
drop table t1;
+create table t1 (a enum (' ','a','b') not null);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('','a','b') NOT NULL default ''
+) TYPE=MyISAM
+drop table t1;
+create table t1 (a enum (' ','a','b ') not null default 'b ');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('','a','b') NOT NULL default 'b'
+) TYPE=MyISAM
+drop table t1;
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
new file mode 100644
index 00000000000..858bf5f3ba2
--- /dev/null
+++ b/mysql-test/r/type_set.result
@@ -0,0 +1,14 @@
+create table t1 (a set (' ','a','b') not null);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` set('','a','b') NOT NULL default ''
+) TYPE=MyISAM
+drop table t1;
+create table t1 (a set (' ','a','b ') not null default 'b ');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` set('','a','b') NOT NULL default 'b'
+) TYPE=MyISAM
+drop table t1;
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 22af6663e0a..2b329f3ec6e 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -105,3 +105,13 @@ insert into t1 values (null),(null),(null),(null);
alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
select * from t1;
drop table t1;
+
+#
+# Alter table and rename
+#
+
+create table t1 (i int unsigned not null auto_increment primary key);
+alter table t1 rename t2;
+alter table t2 rename t1, add c char(10) comment "no comment";
+show columns from t1;
+drop table t1;
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index ab7990eea79..5299897d0f0 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -4,7 +4,7 @@
select floor(5.5),floor(-5.5);
select ceiling(5.5),ceiling(-5.5);
-select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2);
+select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
select round(5.5),round(-5.5);
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
select abs(-10), sign(-5), sign(5), sign(0);
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 171b5510227..09a2bee0d0c 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -299,3 +299,20 @@ insert into t1 values (1,3,3,4);
insert into t1 values (1,3,4,4);
select One, Two, sum(Four) from t1 group by One,Two;
drop table if exists t1;
+drop table if exists t1,t2;
+create table t1 (id integer primary key not null auto_increment, gender char(1));
+insert into t1 values(NULL, 'M');
+insert into t1 values(NULL, 'F');
+insert into t1 values(NULL, 'F');
+insert into t1 values(NULL, 'F');
+insert into t1 values(NULL, 'M');
+create table t2 (user_id integer not null, timestamp datetime);
+insert into t2 values (1, sysdate());
+insert into t2 values (2, sysdate());
+insert into t2 values (1, sysdate());
+insert into t2 values (3, sysdate());
+insert into t2 values (4, sysdate());
+insert into t2 values (4, sysdate());
+select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender;
+select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender order by percentage;
+drop table t1,t2;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index c16189168d2..0c906e56230 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -62,3 +62,21 @@ select count(*) from t2 where id2;
select count(*) from t3 where id3;
drop table t1,t2,t3;
+create table t1(id1 int not null auto_increment primary key, t varchar(100));
+create table t2(id2 int not null, t varchar(100), index(id2));
+disable_query_log;
+let $1 = 1000;
+while ($1)
+ {
+ let $2 = 5;
+ eval insert into t1(t) values ('aaaaaaaaaaaaaaaaaaaa');
+ while ($2)
+ {
+ eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb');
+ dec $2;
+ }
+ dec $1;
+ }
+enable_query_log;
+delete t1, t2 from t2,t1 where t1.id1 = t2.id2 and t1.id1 > 100;
+drop table t1,t2;
diff --git a/mysql-test/t/rpl_empty_master_crash.test b/mysql-test/t/rpl_empty_master_crash.test
new file mode 100644
index 00000000000..158b59169ee
--- /dev/null
+++ b/mysql-test/t/rpl_empty_master_crash.test
@@ -0,0 +1,7 @@
+source include/master-slave.inc;
+connection master;
+use test;
+drop table if exists t1;
+show slave status;
+--error 1218
+load table t1 from master;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 376aa0c7052..21e06c0dbe9 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -183,7 +183,7 @@ drop table t1;
create table t1 (a decimal(10,2));
-# The -0.0 needs to be typed as not all platforms supports this
+# The -0.0 needs to be quoted as not all platforms supports this
insert into t1 values (0.0),("-0.0"),(+0.0),(01.0),(+01.0),(-01.0);
insert into t1 values (-.1),(+.1),(.1);
insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index 62d83388a67..8f399e4364e 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -10,3 +10,14 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES ('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001010'),('001010'),('001010'),('001010'),('001010'),('001018'),('001018'),('001018'),('001018'),('001018'),('001018'),('001020'),('001020'),('001020'),('001020'),('001020'),('001020'),('001020'),('001020'),('001021'),('001021'),('001021'),('001021'),('001021'),('001021'),('001027'),('001027'),('001028'),('001030'),('001030'),('001030'),('001030'),('001031'),('001031'),('001031'),('001031'),('001031'),('001100'),('001100'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002005'),('002005'),('002005'),('002005'),('002005'),('002005'),('002005'),('002005'),('002007'),('002007'),('002007'),('002007'),('002007'),('002007'),('002007'),('002008'),('002008'),('002008'),('002008'),('002008'),('002008'),('002008'),('002008'),('002009'),('002009'),('002009'),('002009'),('002009'),('002009'),('002009'),('002009'),('002012'),('002012'),('002012'),('002012'),('002012'),('002012'),('002012'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002014'),('002014'),('002014'),('002014'),('002014'),('002014'),('002014'),('002014'),('003002'),('003002'),('003002'),('003002'),('003002'),('003002'),('003003'),('003003'),('003003'),('003003'),('003003'),('003003'),('003004'),('003004'),('003004'),('003004'),('003004'),('003004'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003006'),('003006'),('003006'),('003006'),('003006'),('003006'),('003006'),('003006'),('003007'),('003007'),('003007'),('003007'),('003007'),('003008'),('003008'),('003008'),('003008'),('003008'),('003008'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003011'),('003011'),('003011'),('003011'),('003011'),('003011'),('003011'),('003011'),('003012'),('003012'),('003012'),('003012'),('003012'),('003012'),('003012'),('003012'),('003013'),('003013'),('003013'),('003013'),('003013'),('003013'),('003013'),('003013'),('003014'),('003014'),('003014'),('003014'),('003014'),('003014'),('003014'),('003014'),('003015'),('003015'),('003015'),('003015'),('003015'),('003015'),('003016'),('003016'),('003016'),('003016'),('003016'),('003016'),('003017'),('003017'),('003017'),('003017'),('003017'),('003018'),('003018'),('003018'),('003018'),('003018'),('003019'),('003019'),('004003'),('004005'),('004005'),('004005'),('004005'),('004005'),('004005'),('004006'),('004008'),('004010'),('004012'),('004012'),('004014'),('004014'),('004014'),('004014'),('004014'),('004016'),('004017'),('004017'),('004017'),('004017'),('004017'),('004017'),('004017'),('004017'),('004020'),('004020'),('004020'),('004020'),('004020'),('004020'),('004021'),('004021'),('004021'),('004021'),('004021'),('004021'),('004021'),('004022'),('004023'),('004023'),('004023'),('004023'),('004023'),('004023'),('004023'),('004025'),('004026'),('004026'),('004026'),('004026'),('004026'),('006004'),('006006'),('006010'),('006010'),('006010'),('006010'),('006010'),('006010'),('006010'),('006011'),('006011'),('006011'),('006011'),('006011'),('006011'),('006012'),('006012'),('006012'),('006012'),('006012'),('006012'),('006014'),('006014'),('006014'),('007001'),('007001'),('007002'),('007003'),('007005'),('007007'),('007008'),('007009'),('007011'),('007012'),('007013'),('007015'),('007016'),('007017'),('007018'),('007019'),('007019'),('007020'),('007021'),('007021'),('007022'),('007023'),('007023'),('007025'),('007025'),('007025'),('007027'),('007029'),('007031'),('007031'),('007032'),('007034'),('007034'),('007036'),('007036'),('007036'),('007037'),('007037'),('007038'),('007040'),('007040'),('007040'),('007043'),('009001'),('009001'),('009001'),('009001'),('009001'),('009001'),('009001'),('009002'),('009002'),('009002'),('009002'),('009002'),('009004'),('009004'),('009004'),('009004'),('009005'),('009005'),('009005'),('009005'),('009005'),('009005'),('009005'),('009005'),('009006'),('009006'),('009006'),('009006'),('009007'),('009007'),('009007'),('009007'),('009007'),('009007'),('009008'),('009010'),('009010'),('009010'),('009010'),('009010'),('009010'),('009011'),('009011'),('009011'),('009011'),('009011'),('009012'),('009013'),('009013'),('009013'),('010002'),('010002'),('010002'),('010002'),('010002'),('010002'),('010002'),('010002'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010005'),('010005'),('010005'),('010005'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010007'),('010007'),('010007'),('010007'),('010007'),('010007'),('010008'),('010008'),('010008'),('010008'),('010008'),('010008'),('010008'),('010009'),('010009'),('010009'),('010009'),('010009'),('010009'),('010010'),('010010'),('010010'),('010010'),('010010'),('010010'),('010010'),('010011'),('010011'),('010011'),('010011'),('010011'),('010011'),('010011'),('010011'),('010012'),('010012'),('010012'),('010012'),('010012'),('010012'),('010012'),('010013'),('010013'),('010013'),('010013'),('010013'),('010013'),('010015'),('010016'),('010016'),('010016'),('010016'),('010016'),('010016'),('010016'),('010016'),('010017'),('010017'),('010017'),('010017'),('010017'),('010017'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010019'),('010019'),('010019'),('010019'),('010019'),('010019'),('010020'),('010020'),('010020'),('010021'),('010021'),('010021'),('010021'),('010021'),('010021'),('010022'),('010022'),('010022'),('010022'),('010022'),('010022'),('010022'),('010022'),('010023'),('010023'),('010023'),('010023'),('010023'),('010023'),('010023'),('010023'),('010026'),('010027'),('010028'),('010028'),('011001'),('011001'),('011001'),('011001'),('011001'),('011001'),('011001'),('011002'),('011002'),('011002'),('011002'),('011002'),('011002'),('011002'),('011003'),('011003'),('011003'),('011003'),('011003'),('011003'),('011003'),('011003'),('011004'),('011004'),('011004'),('011004'),('011004'),('011004'),('011004'),('011006'),('011006'),('011006'),('011006'),('011006'),('011006'),('011006'),('011012'),('011012'),('011012'),('011013'),('011013'),('011013'),('011013'),('011013'),('011013'),('011014'),('011014'),('011014'),('011014'),('011015'),('011015'),('011015'),('011015'),('011015'),('011016'),('011016'),('011016'),('011016'),('011016'),('012017'),('012017'),('012027'),('012027'),('012032'),('012034'),('012036'),('012036'),('012037'),('012037'),('012038'),('012039'),('014001'),('014001'),('016016'),('016016'),('016016'),('016019'),('016020'),('016020'),('016020'),('016020'),('016020'),('016020'),('016020'),('016020'),('016021'),('016021'),('016021'),('016021'),('016021'),('016021'),('016021'),('016022'),('016022'),('016022'),('016023'),('016023'),('016023'),('016024'),('016024'),('016024'),('016024'),('016024'),('016024'),('016024'),('016026'),('016026'),('016026'),('016026'),('016026'),('016026'),('016028'),('016028'),('016028'),('016028'),('016028'),('016028'),('016028'),('016029'),('016029'),('016030'),('016031'),('016032'),('016032'),('016032'),('016032'),('016032'),('016032'),('016032'),('016033'),('016033'),('016033'),('016033'),('016033'),('016034'),('016034'),('016034'),('016034'),('016034'),('017002'),('017002'),('017002'),('017002'),('017002'),('018001'),('018001'),('018001'),('018001'),('018001'),('018001'),('018001'),('018001'),('019002'),('019002'),('019002'),('019002'),('019002'),('019002'),('019004'),('019004'),('019004'),('019004'),('019004'),('019004'),('020001'),('020001'),('020001'),('020001'),('020004'),('020006'),('020006'),('020006'),('020006'),('020006'),('020006'),('020008'),('020009'),('020009'),('020009'),('020009'),('020009'),('022001'),('022001'),('022001'),('022001'),('022002'),('022002'),('022002'),('022002'),('022003'),('022003'),('022003'),('022003'),('023001'),('023002'),('023002'),('023002'),('023002'),('023002'),('023002'),('023003'),('023003'),('023003'),('023003'),('023004'),('023004'),('023005'),('023005'),('023006'),('023006'),('023006'),('023006'),('023006'),('023006'),('023007'),('023007'),('023010'),('023010'),('023011'),('023011'),('023017'),('023019'),('023019'),('023019'),('023020'),('023020'),('023025'),('023025'),('023025'),('023026'),('023026'),('023026'),('023027'),('023027'),('023027'),('023028'),('023028'),('023029'),('023029'),('023030'),('023030'),('023032'),('023033'),('023033'),('023033'),('023033'),('023033'),('023033'),('023034'),('023035'),('023035'),('025001'),('025001'),('025001'),('025001'),('025001'),('025001'),('025001'),('025003'),('025003'),('025004'),('025004'),('025005'),('025005'),('025007'),('025007'),('025008'),('025008'),('025009'),('025010'),('025010'),('025010'),('025011'),('025011'),('025012'),('025012'),('025013'),('025013'),('025013'),('025014'),('025015'),('025016'),('025018'),('025018'),('025019'),('025019'),('025020'),('025020'),('025021'),('025022'),('025022'),('025023'),('025023'),('025024'),('025025'),('025025'),('025026'),('025026'),('025027'),('025027'),('025027'),('025028'),('025030'),('025031'),('025033'),('025034'),('025035'),('025037'),('025041'),('025042'),('025043'),('025046'),('025048'),('025048'),('025048'),('025049'),('025049'),('025049'),('025050'),('025050'),('025050'),('025051'),('025051'),('025052'),('025052'),('025052'),('025053'),('025053'),('025054'),('025054'),('025054'),('025054'),('025055'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025057'),('025057'),('025058'),('025058'),('025060'),('025060'),('025061'),('025062'),('025063'),('027001'),('027002'),('027011'),('036001'),('036001'),('036001'),('036001'),('036001'),('037003'),('037006'),('037007'),('037008'),('037008'),('038009'),('039001'),('039001'),('039001'),('039001'),('039001'),('039001'),('039002'),('039002'),('039002'),('039002'),('039002'),('039003'),('039003'),('039003'),('039003'),('039003'),('039003'),('039004'),('039004'),('039004'),('039004'),('039004'),('039005'),('039005'),('039005'),('039005'),('039005'),('039006'),('039006'),('039006'),('039006'),('046001'),('046001'),('046001'),('046001'),('046001'),('046001'),('046001'),('046001'),('046002'),('046002'),('046002'),('046002'),('046002'),('046002'),('046002'),('046002'),('046003'),('046003'),('046003'),('046003'),('046003'),('046003'),('046003'),('046005'),('046005'),('046005'),('046005'),('046005'),('046005'),('046005'),('046007'),('046007'),('046007'),('046007'),('046007'),('046007'),('046008'),('046008'),('046008'),('046008'),('046008'),('046009'),('046009'),('046009'),('046010'),('046012'),('046012'),('046012'),('046013'),('046014'),('046014'),('046014'),('047001'),('047001'),('047001'),('047001'),('047001'),('047001'),('047001'),('047001'),('047002'),('047002'),('047002'),('047002'),('047002'),('047002'),('047002'),('047002'),('048001'),('048001'),('048001'),('048001'),('048001'),('048001'),('048001'),('048001'),('051003'),('051003'),('051003'),('051003'),('051003'),('051004'),('051004'),('051004'),('051004'),('052001'),('052001'),('052001'),('052001'),('052001'),('052001'),('052001'),('052001'),('052002'),('052002'),('052005'),('052005'),('052005'),('052005'),('052005'),('052005'),('053016'),('053019'),('053019'),('053023'),('053023'),('053023'),('053023'),('053024'),('053024'),('053024'),('053026'),('053026'),('053026'),('053026'),('053028'),('053028'),('053029'),('053029'),('053029'),('053029'),('053033'),('053033'),('053033'),('053045'),('053046'),('053051'),('053051'),('053051'),('053054'),('053054'),('053054'),('053054'),('053057'),('053069'),('053069'),('053097'),('053107'),('053125'),('053125'),('053127'),('054001'),('054001'),('054001'),('054001'),('054001'),('054001'),('054001'),('054002'),('054002'),('054002'),('054002'),('054002'),('054002'),('054003'),('054003'),('054003'),('054003'),('054003'),('054003'),('054003'),('054004'),('054004'),('054004'),('054004'),('054004'),('054004'),('054004'),('054006'),('054006'),('054006'),('054007'),('054007'),('054007'),('054007'),('054007'),('054009'),('054009'),('054009'),('054009'),('054010'),('054010'),('054010'),('054010'),('054010'),('054010'),('054010'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056002'),('056002'),('056002'),('056002'),('056002'),('056002'),('056002'),('056002'),('056003'),('056003'),('056003'),('056003'),('056003'),('056003'),('056004'),('056004'),('056004'),('056004'),('056004'),('056004'),('056004'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056009'),('056009'),('056009'),('056011'),('056016'),('056016'),('056016'),('056016'),('056016'),('056016'),('056016'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056018'),('056018'),('056018'),('056018'),('056018'),('056018'),('056019'),('056019'),('056019'),('056019'),('056019'),('056019'),('056019'),('056019'),('056020'),('056020'),('056020'),('056020'),('056022'),('056022'),('056022'),('056022'),('056022'),('057003'),('057003'),('057004'),('058002'),('058002'),('058002'),('058002'),('058003'),('058003'),('058003'),('058003'),('058004'),('058004'),('058004'),('058005'),('058005'),('058005'),('060001'),('060001'),('060001'),('060001'),('060001'),('060004'),('060004'),('060004'),('060004'),('060004'),('060004'),('060005'),('060005'),('060005'),('060005'),('060005'),('060005'),('060007'),('060007'),('060007'),('060007'),('060007'),('060007'),('060007'),('061004'),('061004'),('061004'),('061004'),('061004'),('061004'),('061006'),('061006'),('061006'),('061006'),('061006'),('061006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069007'),('069007'),('069007'),('069007'),('069007'),('069007'),('069007'),('069007'),('069010'),('069010'),('069010'),('069010'),('069010'),('069010'),('069011'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069016'),('069016'),('069016'),('069016'),('069016'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069020'),('069020'),('069020'),('069020'),('069021'),('069023'),('071002'),('071002'),('071002'),('071002'),('071002'),('071003'),('071003'),('071003'),('071003'),('071003'),('071004'),('071004'),('071004'),('071004'),('071004'),('071005'),('071005'),('071005'),('071005'),('071005'),('071005'),('071006'),('071006'),('071006'),('071006'),('071008'),('071008'),('071008'),('071008'),('071008'),('071008'),('071011'),('071011'),('071011'),('071011'),('071011'),('071020'),('071020'),('071020'),('071020'),('071020'),('071021'),('071022'),('071022'),('071022'),('072001'),('072001'),('074001'),('074002'),('074002'),('074002'),('074002'),('074002'),('074002'),('074002'),('074002'),('074003'),('074003'),('074003'),('074003'),('074003'),('074003'),('074003'),('074003'),('074004'),('074004'),('074004'),('074004'),('074004'),('074004'),('074004'),('074004'),('074005'),('074005'),('074005'),('074005'),('074005'),('074005'),('074005'),('074005'),('074006'),('074006'),('074006'),('074006'),('074006'),('074006'),('074006'),('074006'),('074007'),('074007'),('074007'),('074007'),('074007'),('074007'),('074007'),('074007'),('074008'),('074008'),('074008'),('074008'),('074008'),('074008'),('074008'),('074008'),('074009'),('074009'),('074009'),('074009'),('074009'),('074009'),('074009'),('074009'),('074010'),('074010'),('074010'),('074010'),('074010'),('074010'),('074010'),('074010'),('074011'),('074011'),('074011'),('074011'),('074011'),('074011'),('074011'),('074011'),('074012'),('074012'),('074012'),('074012'),('074012'),('074012'),('074012'),('075001'),('075001'),('075001'),('075007'),('075007'),('075007'),('075007'),('076101'),('076101'),('076101'),('076101'),('076102'),('076102'),('076102'),('076103'),('076103'),('076103'),('076103'),('076103'),('077001'),('077001'),('077001'),('077002'),('077002'),('077002'),('077002'),('077002'),('077002'),('077002'),('077003'),('077003'),('077003'),('077003'),('077003'),('077003'),('077003'),('077004'),('077004'),('077004'),('077004'),('077004'),('077004'),('077006'),('077006'),('077008'),('077008'),('077008'),('077008'),('077008'),('077008'),('077008'),('077009'),('077009'),('077009'),('077009'),('077009'),('077009'),('077009'),('078005'),('078005'),('078005'),('079002'),('079002'),('079002'),('079002'),('079002'),('079002'),('079002'),('079003'),('079003'),('079004'),('079004'),('079005'),('079005'),('079005'),('079005'),('079005'),('079005'),('079006'),('079006'),('079006'),('079006'),('079007'),('079007'),('079007'),('079007'),('079007'),('081001'),('081001'),('081001'),('081001'),('081001'),('082011'),('082011'),('082011'),('082011'),('082011'),('082013'),('082013'),('082013'),('082013'),('082013'),('082013'),('082014'),('082014'),('082014'),('082014'),('082014'),('082014'),('082014'),('082015'),('082015'),('082015'),('082015'),('082015'),('082016'),('082016'),('082016'),('082016'),('082016'),('082016'),('082017'),('082017'),('082017'),('082017'),('082017'),('082017'),('082017'),('082021'),('082021'),('082022'),('082022'),('082022'),('082022'),('082022'),('082023'),('082023'),('082023'),('082023'),('082023'),('082024'),('082024'),('082024'),('082024'),('082024'),('082025'),('082025'),('082025'),('082025'),('082025'),('082026'),('082026'),('082026'),('082026'),('082026'),('082027'),('082027'),('082027'),('082027'),('082027'),('082028'),('082028'),('082028'),('082028'),('082029'),('082029'),('082029'),('082029'),('082029'),('082030'),('082030'),('082030'),('082030'),('082031'),('082031'),('082031'),('082031'),('082031'),('082032'),('082032'),('082032'),('082033'),('082033'),('082034'),('082034'),('082034'),('082034'),('082034'),('082034'),('082034'),('082035'),('082035'),('082035'),('082036'),('082036'),('082036'),('082036'),('082037'),('082037'),('082037'),('082038'),('082038'),('082038'),('082038'),('082039'),('082039'),('082039'),('082039'),('082040'),('082040'),('082040'),('082040'),('082040'),('082041'),('082041'),('082041'),('082041'),('082042'),('082042'),('082043'),('082043'),('082043'),('082043'),('082043'),('082044'),('082044'),('082044'),('082044'),('084001'),('084002'),('084002'),('084002'),('084002'),('084003'),('084003'),('084003'),('084003'),('084003'),('084003'),('084003'),('084003'),('084004'),('084004'),('084004'),('084004'),('084004'),('084005'),('084005'),('084005'),('084005'),('084005'),('084007'),('084007'),('084007'),('084007'),('084007'),('084007'),('084008'),('084008'),('084008'),('084008'),('084008'),('084008'),('084009'),('084009'),('084009'),('084009'),('084009'),('084009'),('084011'),('084013'),('084013'),('084013'),('084013'),('084013'),('084014'),('084014'),('084014'),('084016'),('084016'),('084016'),('084016'),('084016'),('084016'),('084016'),('084016'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084027'),('084027'),('084027'),('084027'),('084027'),('084027'),('084032'),('084032'),('084033'),('084033'),('084033'),('084035'),('084035'),('084035'),('084036'),('084036'),('084036'),('084036'),('084036'),('084036'),('084037'),('084037'),('084038'),('084038'),('084038'),('084038'),('084038'),('084038'),('084039'),('084039'),('084039'),('084039'),('084040'),('084040'),('084040'),('084040'),('084040'),('084041'),('084041'),('084041'),('084041'),('084042'),('084042'),('084043'),('084043'),('084043'),('084043'),('084044'),('084044'),('084044'),('084044'),('084044'),('084045'),('084046'),('084046'),('084046'),('084047'),('084048'),('084048'),('084049'),('084049'),('084050'),('084051'),('084051'),('085001'),('085001'),('085001'),('085001'),('085001'),('085001'),('085002'),('085002'),('085002'),('085002'),('085003'),('085003'),('085003'),('085003'),('085003'),('085003'),('085003'),('085004'),('085004'),('085004'),('085004'),('085004'),('085004'),('085004'),('085005'),('085005'),('085005'),('085005'),('085005'),('085005'),('085006'),('085006'),('085006'),('085006'),('085006'),('085006'),('085006'),('085006'),('085007'),('085007'),('085007'),('085007'),('085007'),('085007'),('085007'),('085009'),('085009'),('085009'),('085009'),('085009'),('085009'),('085011'),('085011'),('085011'),('085011'),('085011'),('085011'),('085011'),('085011'),('085012'),('085012'),('085012'),('085012'),('085012'),('085012'),('085012'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085015'),('085015'),('085015'),('085015'),('085015'),('085015'),('085015'),('085015'),('085016'),('085016'),('085016'),('085016'),('085016'),('085016'),('085016'),('085016'),('085017'),('085017'),('085017'),('085017'),('085017'),('085018'),('085018'),('085018'),('085018'),('085018'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085020'),('085020'),('085020'),('085020'),('085020'),('085020'),('085022'),('085022'),('085022'),('085022'),('085022'),('085022'),('085023'),('085023'),('085023'),('085023'),('085023'),('085028'),('085028'),('085028'),('085028'),('085028'),('085028'),('085028'),('085029'),('085029'),('085029'),('085029'),('085029'),('085029'),('085029'),('085030'),('085030'),('085030'),('085030'),('085030'),('085030'),('085030'),('085031'),('085031'),('085031'),('085031'),('085031'),('085031'),('085031'),('085033'),('085034'),('085034'),('085034'),('085034'),('085034'),('085034'),('085034'),('085035'),('085035'),('085035'),('085035'),('085035'),('085035'),('085036'),('085036'),('085036'),('085036'),('085036'),('085036'),('085037'),('085037'),('085037'),('085037'),('085037'),('085037'),('085038'),('085038'),('085038'),('085038'),('085038'),('085038'),('085038'),('085040'),('085040'),('085040'),('085040'),('085040'),('085040'),('085040'),('085040'),('085041'),('085041'),('085041'),('085041'),('085041'),('085041'),('085041'),('085041'),('085042'),('085042'),('085042'),('085042'),('085042'),('085042'),('085042'),('085043'),('085043'),('085043'),('085043'),('085043'),('085043'),('085044'),('085044'),('085044'),('085044'),('085044'),('085044'),('085044'),('085045'),('085045'),('085045'),('085045'),('085045'),('085046'),('085046'),('085046'),('085046'),('085046'),('085046'),('085046'),('085046'),('085047'),('085047'),('085047'),('085047'),('085047'),('085047'),('085047'),('085047'),('085048'),('085048'),('085048'),('085048'),('085048'),('085048'),('085048'),('085063'),('085063'),('085063'),('085063'),('085063'),('085064'),('085064'),('085064'),('085064'),('085064'),('085065'),('085065'),('085068'),('085068'),('085068'),('085068'),('085068'),('085068'),('085071'),('085071'),('085071'),('085071'),('085071'),('085071'),('085073'),('085073'),('085082'),('085082'),('085082'),('085082'),('085082'),('085086'),('085086'),('085086'),('085088'),('085088'),('085088'),('085088'),('085088'),('085088'),('085088'),('085089'),('085089'),('085090'),('085090'),('085090'),('085090'),('085090'),('085090'),('085090'),('085090'),('085091'),('085091'),('085091'),('085091'),('085091'),('085092'),('085092'),('085092'),('085093'),('085093'),('085095'),('085095'),('085095'),('085095'),('085095'),('085096'),('085096'),('085096'),('085096'),('085096'),('085096'),('085097'),('085097'),('085097'),('085097'),('085097'),('085098'),('085098'),('085098'),('085098'),('085098'),('085098'),('085098'),('085099'),('085099'),('085099'),('085099'),('085099'),('085099'),('085099'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085101'),('085101'),('085101'),('085101'),('085101'),('085101'),('085101'),('085101'),('085102'),('085102'),('085103'),('085103'),('085103'),('085104'),('085104'),('085104'),('085104'),('085104'),('085105'),('085105'),('085106'),('085106'),('085106'),('085106'),('085106'),('085106'),('085108'),('085108'),('085109'),('085109'),('085109'),('085109'),('085109'),('085109'),('085109'),('085109'),('085110'),('085110'),('085110'),('085110'),('085110'),('085111'),('085111'),('085111'),('085112'),('085112'),('085112'),('085112'),('085113'),('085113'),('085113'),('085113'),('085113'),('085115'),('085120'),('085121'),('085121'),('085121'),('085121'),('085122'),('085122'),('085122'),('085122'),('085122'),('085122'),('085122'),('085122'),('085123'),('085123'),('085123'),('085123'),('085123'),('085123'),('085123'),('085123'),('085125'),('085125'),('085125'),('085125'),('085125'),('085126'),('085126'),('085126'),('085126'),('085126'),('085127'),('085127'),('085127'),('085127'),('085127'),('085127'),('085127'),('085127'),('085128'),('085128'),('085128'),('085128'),('085128'),('085129'),('085129'),('085129'),('085129'),('085129'),('085130'),('085130'),('085130'),('085130'),('085130'),('085132'),('085132'),('085132'),('085132'),('085132'),('085132'),('085133'),('085133'),('085133'),('085133'),('085133'),('085134'),('085134'),('085134'),('085135'),('085135'),('085135'),('085136'),('085136'),('085136'),('085136'),('085137'),('085137'),('085137'),('085137'),('085137'),('085137'),('085137'),('086002'),('086002'),('086002'),('086002'),('086003'),('086003'),('086003'),('086003'),('086005'),('088001'),('088001'),('088001'),('088001'),('088001'),('088003'),('088003'),('088003'),('088003'),('088003'),('088003'),('088005'),('088005'),('088005'),('088005'),('088005'),('088006'),('088006'),('088006'),('088006'),('088006'),('088007'),('088007'),('088007'),('088008'),('088008'),('088008'),('088008'),('088009'),('088009'),('088009'),('088009'),('088009'),('089001'),('089001'),('089001'),('089001'),('089001'),('089001'),('089001'),('090001'),('090001'),('090001'),('090001'),('090001'),('090001'),('090001'),('090002'),('090002'),('090002'),('090002'),('090002'),('090002'),('090003'),('090003'),('090003'),('090003'),('090003'),('090003'),('090003'),('090004'),('090004'),('090004'),('090004'),('090004'),('090004'),('090004'),('090006'),('090006'),('090006'),('090006'),('090006'),('090006'),('090006'),('090008'),('090008'),('090008'),('090008'),('090008'),('090009'),('090009'),('090009'),('090009'),('090009'),('090010'),('090010'),('090013'),('090013'),('090013'),('090016'),('090016'),('090017'),('090018'),('090022'),('090027'),('091001'),('091001'),('091001'),('091001'),('091001'),('091001'),('091002'),('091002'),('091002'),('091002'),('091002'),('091002'),('091009'),('091009'),('091009'),('091009'),('091009'),('091011'),('091011'),('091011'),('091011'),('091011'),('091011'),('091011'),('091012'),('091012'),('091013'),('091013'),('091013'),('091013'),('091013'),('091013'),('091015'),('091015'),('091015'),('091015'),('091015'),('091015'),('091016'),('091016'),('091016'),('091016'),('091016'),('091017'),('091017'),('091018'),('091018'),('091018'),('091018'),('093003'),('093003'),('093003'),('093003'),('093003'),('093003'),('099001'),('099001'),('099001'),('099001'),('099001'),('099001'),('099001'),('100001'),('100001'),('100001'),('100001'),('106001'),('113005'),('113005'),('113005'),('113006'),('113006'),('113018'),('113019'),('113020'),('115001'),('115001'),('115001'),('115002'),('115002'),('115003'),('115004'),('115004'),('115004'),('115004'),('115005'),('115005'),('115005'),('115006'),('115006'),('115006'),('115007'),('115007'),('115007'),('115007'),('115007'),('115008'),('115008'),('115008'),('115009'),('115010'),('115010'),('115010'),('115010'),('115010'),('115011'),('115011'),('115011'),('115011'),('115012'),('115012'),('115013'),('115013'),('115013'),('115014'),('115014'),('115014'),('115014'),('115015'),('115015'),('115015'),('115016'),('115016'),('115016'),('115016'),('115017'),('115017'),('115017'),('115017'),('115017'),('115018'),('115018'),('115020'),('115020'),('115021'),('115021'),('115022'),('115022'),('115022'),('115023'),('115023'),('115023'),('115023'),('115023'),('115025'),('115025'),('115025'),('115026'),('115026'),('115027'),('115027'),('115027'),('115028'),('115028'),('115028'),('115028'),('115029'),('115029'),('115029'),('115030'),('115030'),('115030'),('115031'),('115031'),('115032'),('115032'),('115032'),('115033'),('115033'),('115033'),('115033'),('115034'),('115034'),('115034'),('115035'),('115035'),('115036'),('115036'),('115036'),('115036'),('115036'),('115039'),('115040'),('115040'),('115040'),('115041'),('115041'),('115041'),('115041'),('115041'),('115042'),('115042'),('115042'),('115042'),('115042'),('115043'),('115043'),('115043'),('115044'),('115044'),('115044'),('115044'),('115046'),('115046'),('115046'),('115047'),('115048'),('115050'),('115050'),('115050'),('115050'),('115050'),('115051'),('115051'),('115051'),('115052'),('115053'),('115053'),('115054'),('115054'),('115054'),('115055'),('115055'),('115055'),('115057'),('115059'),('115059'),('115059'),('115059'),('115060'),('115060'),('115060'),('115060'),('115060'),('115060'),('115061'),('115061'),('115061'),('115062'),('115062'),('115062'),('115062'),('115064'),('115064'),('115064'),('115065'),('115065'),('115065'),('115065'),('115066'),('115066'),('115066'),('115067'),('115067'),('115067'),('115068'),('115068'),('115068'),('115069'),('115069'),('115069'),('115069'),('115069'),('115070'),('115070'),('115070'),('115071'),('115071'),('115071'),('115072'),('115072'),('115072'),('115073'),('115073'),('115075'),('115075'),('115075'),('115076'),('115076'),('115076'),('115076'),('115076'),('115076'),('115081'),('115081'),('115081'),('115082'),('115082'),('115082'),('115085'),('115085'),('115085'),('115085'),('115085'),('115086'),('115086'),('115086'),('115087'),('115087'),('115088'),('115088'),('115088'),('115088'),('115088'),('115095'),('115095'),('115095'),('115096'),('115096'),('115097'),('115097'),('115098'),('115098'),('115099'),('115101'),('115102'),('115102'),('115102'),('115103'),('115103'),('115104'),('115104'),('115104'),('115104'),('115105'),('115105'),('115106'),('115106'),('115106'),('115106'),('115106'),('115108'),('115109'),('115111'),('115111'),('115111'),('115111'),('115112'),('115112'),('115112'),('115112'),('115112'),('115113'),('115113'),('115113'),('115114'),('115114'),('115114'),('115114'),('115114'),('115115'),('115115'),('115115'),('115115'),('115116'),('115117'),('115117'),('115117'),('115118'),('115118'),('115119'),('115119'),('115119'),('115119'),('115120'),('115121'),('115121'),('115122'),('115122'),('116001'),('116003'),('116003'),('116003'),('116003'),('116004'),('116004'),('116005'),('116005'),('116006'),('116006'),('116006'),('116007'),('116007'),('116008'),('116008'),('116009'),('116009'),('116009'),('116010'),('116010'),('116010'),('116010'),('116011'),('116011'),('116011'),('116011'),('116012'),('116012'),('123001'),('123001'),('123001'),('123001'),('123001'),('124065'),('126001'),('126001'),('126001'),('126001'),('126001'),('126001'),('126001'),('126001'),('126002'),('126002'),('126002'),('126002'),('126002'),('126002'),('126002'),('126002'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126007'),('126007'),('126007'),('126007'),('126007'),('126007'),('126007'),('126008'),('126008'),('126008'),('126008'),('126008'),('126008'),('126008'),('126008'),('126009'),('126009'),('126009'),('126009'),('126009'),('126009'),('126009'),('126009'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126011'),('126011'),('126011'),('126011'),('126011'),('126011'),('126011'),('126012'),('126012'),('126012'),('126012'),('130001'),('130001'),('130001'),('130001'),('132001'),('132001'),('132001'),('132001'),('132001'),('132002'),('132002'),('132002'),('132002'),('132002'),('132002'),('132002'),('133001'),('133001'),('133008'),('133009'),('133010'),('133011'),('133011'),('133011'),('133011'),('133011'),('133011'),('133012'),('133015'),('133015'),('133015'),('133015'),('133016'),('133018'),('133018'),('133018'),('133018'),('133018'),('133019'),('133021'),('133021'),('133022'),('133022'),('133023'),('133023'),('133024'),('133024'),('133024'),('133024'),('133024'),('133024'),('133025'),('133027'),('133027'),('133027'),('133027'),('133027'),('133028'),('133028'),('133028'),('133029'),('133029'),('133029'),('133029'),('133029'),('133029'),('133030'),('133030'),('133031'),('133031'),('133031'),('134001'),('134001'),('134001'),('135001'),('135001'),('135001'),('135001'),('135001'),('135002'),('135002'),('135002'),('135004'),('135010'),('135010'),('135010'),('135010'),('135010'),('135010'),('137010'),('137011'),('137012'),('137014'),('137015'),('137015'),('137016'),('137019'),('139001'),('140001'),('140001'),('140001'),('140001'),('140001'),('140001'),('141001'),('141001'),('141001'),('141001'),('141001'),('141002'),('141002'),('141002'),('141002'),('141002'),('141003'),('141003'),('141003'),('141003'),('141003'),('141003'),('141003'),('141003'),('141006'),('141006'),('141006'),('141006'),('141006'),('141006'),('141006'),('141006'),('141007'),('141007'),('141007'),('141007'),('141007'),('141009'),('141009'),('141009'),('141009'),('141009'),('141011'),('141011'),('141011'),('141011'),('141011'),('141011'),('141012'),('141014'),('141014'),('141014'),('141014'),('141014'),('141014'),('141014'),('141014'),('141015'),('141015'),('141015'),('141015'),('141015'),('141016'),('141016'),('141016'),('141016'),('141016'),('141016'),('141017'),('141017'),('141017'),('141017'),('141017'),('141017'),('141018'),('141018'),('141018'),('141018'),('141019'),('141019'),('141019'),('141019'),('141020'),('141020'),('141020'),('141020'),('141020'),('141020'),('141020'),('141021'),('141021'),('141021'),('141021'),('141021'),('141021'),('141022'),('141022'),('141022'),('141022'),('141022'),('141022'),('141023'),('141023'),('141023'),('141023'),('141023'),('141023'),('141023'),('141024'),('141025'),('141025'),('141025'),('141026'),('141026'),('141026'),('141026'),('141026'),('141026'),('141027'),('141027'),('141027'),('141027'),('141027'),('141028'),('141028'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145008'),('145008'),('145008'),('145008'),('145008'),('145008'),('145008'),('145008'),('145009'),('145009'),('145009'),('145009'),('145009'),('145009'),('145009'),('145011'),('145011'),('145011'),('145011'),('145011'),('145011'),('145011'),('145011'),('145012'),('145012'),('145012'),('145012'),('145012'),('145012'),('145012'),('145012'),('145013'),('145013'),('145013'),('145013'),('145013'),('145013'),('145013'),('150009'),('150013'),('150014'),('150015'),('150015'),('150015'),('150016'),('150016'),('150017'),('150017'),('150017'),('150017'),('150020'),('152001'),('152001'),('152001'),('152002'),('152003'),('152003'),('152003'),('152003'),('152004'),('152005'),('152006'),('152006'),('152006'),('152006'),('152007'),('154001'),('154002'),('154002'),('155001'),('155001'),('155002'),('155003'),('155004'),('155004'),('155006'),('159001'),('159003'),('160001'),('160001'),('160001'),('160001'),('160002'),('160002'),('161001'),('162002'),('162002'),('162003'),('162003'),('162003'),('162003'),('162003'),('162007'),('162012'),('162012'),('162012'),('163001'),('163001'),('163001'),('163011'),('163015'),('163016'),('163016'),('165001'),('165001'),('165001'),('165001'),('165002'),('165002'),('165002'),('165002'),('165003'),('165003'),('165003'),('165004'),('165004'),('165004'),('165005'),('165005'),('165005'),('165006'),('165006'),('165006'),('165006'),('165007'),('165007'),('165007'),('165007'),('165008'),('165008'),('165008'),('165008'),('165009'),('165009'),('165009'),('165009'),('165010'),('165010'),('165010'),('165011'),('165011'),('165012'),('165012'),('165012'),('165013'),('165013'),('165013'),('165014'),('165014'),('165014'),('165015'),('165015'),('165015'),('165015'),('165016'),('165016'),('165016'),('165017'),('165017'),('165017'),('165017'),('165018'),('165018'),('165018'),('165018'),('165019'),('165019'),('165019'),('165019'),('165020'),('165020'),('165020'),('165020'),('165021'),('165021'),('165021'),('165021'),('165022'),('165022'),('165022'),('165023'),('165024'),('165024'),('165024'),('165025'),('165025'),('165025'),('165026'),('165026'),('165026'),('165028'),('165029'),('165030'),('165030'),('165030'),('165031'),('165031'),('165033'),('165033'),('165034'),('165034'),('165034'),('165035'),('165035'),('165035'),('165036'),('165036'),('165036'),('168003'),('168003'),('168004'),('168005'),('168014'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169003'),('169003'),('169003'),('169003'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169008'),('169008'),('169008'),('169008'),('169008'),('169008'),('169008'),('169009'),('169009'),('169009'),('169009'),('169010'),('171006'),('171006'),('171007'),('171007'),('171008'),('171008'),('171008'),('171009'),('171009'),('171009'),('172001'),('176001'),('176001'),('176001'),('176001'),('176001'),('176001'),('176001'),('176002'),('176002'),('176002'),('176002'),('176002'),('176003'),('176003'),('176003'),('176003'),('176003'),('176003'),('177001'),('177001'),('177001'),('177001'),('177001'),('177001'),('179007'),('179007'),('179012'),('179012'),('179012'),('179012'),('179012'),('179012'),('179013'),('179013'),('179013'),('179013'),('179013'),('179013'),('179042'),('179044'),('179045'),('180001'),('180013'),('180014'),('180014'),('180015'),('180017'),('180018'),('180020'),('180020'),('180021'),('180021'),('180027'),('180030'),('180033'),('180035'),('180036'),('180037'),('180038'),('180041'),('180042'),('180045'),('180045'),('180047'),('180048'),('180049'),('180050'),('180054'),('180060'),('180066'),('180067'),('180068'),('180070'),('182001'),('184001'),('184002'),('184005'),('184005'),('184005'),('184005'),('184006'),('184006'),('184006'),('184006'),('184008'),('184008'),('184008'),('184008'),('184009'),('184009'),('184009'),('184009'),('184010'),('184010'),('184010'),('184010'),('184011'),('184011'),('184011'),('184011'),('185001'),('185001'),('185001'),('185001'),('185001'),('185001'),('185001'),('185003'),('185003'),('185003'),('185003'),('185003'),('185003'),('185003'),('187001'),('191002'),('191002'),('192002'),('194003'),('197001'),('197001'),('197001'),('197001'),('197001'),('197001'),('197001'),('197002'),('197002'),('197002'),('197002'),('197002'),('197002'),('197002'),('197003'),('197003'),('197003'),('197003'),('197003'),('197003'),('197003'),('197004'),('197004'),('197004'),('197004'),('197004'),('197004'),('197004'),('197005'),('197005'),('197005'),('197005'),('197005'),('197005'),('197006'),('197006'),('197006'),('197006'),('197006'),('198001'),('198001'),('198001'),('198001'),('198001'),('198001'),('198003'),('198003'),('198003'),('198004'),('198004'),('198004'),('198004'),('198004'),('198004'),('198005'),('198005'),('198005'),('198005'),('198005'),('198005'),('198005'),('198006'),('198006'),('198006'),('198006'),('198006'),('198006'),('198007'),('198007'),('198007'),('198007'),('198007'),('198007'),('198007'),('198008'),('198008'),('198008'),('198008'),('198008'),('198008'),('198009'),('198009'),('198009'),('198009'),('198009'),('198009'),('198009'),('198010'),('198010'),('198010'),('198010'),('198010'),('198010'),('198011'),('198012'),('198012'),('198012'),('198012'),('198015'),('198015'),('198016'),('198016'),('198016'),('198016'),('198016'),('198016'),('198017'),('198017'),('198017'),('198017'),('198017'),('198017'),('201001'),('201001'),('201001'),('201001'),('201001'),('201002'),('202001'),('202001'),('203001'),('203001'),('203001'),('203001'),('203001'),('203001'),('203001'),('203002'),('203002'),('203002'),('203002'),('203003'),('203003'),('203003'),('203003'),('203003'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203018'),('203018'),('203018'),('203018'),('203018'),('203019'),('203019'),('203019'),('203019'),('203019'),('204001'),('204002'),('205001'),('205001'),('205001'),('205001'),('205001'),('205001'),('205001'),('208001'),('208001'),('208002'),('208002'),('208002'),('208003'),('208003'),('208003'),('208004'),('208004'),('208004'),('208004'),('208004'),('208004'),('208004'),('208005'),('208005'),('208005'),('208005'),('208005'),('209001'),('209001'),('209001'),('209001'),('209001'),('209002'),('209002'),('209002'),('209002'),('209002'),('209003'),('209003'),('209003'),('209003'),('209003'),('210001'),('210001'),('210001'),('210001'),('210001'),('210004'),('210004'),('210004'),('210004'),('210004'),('210004'),('210009'),('210010'),('212001'),('212001'),('212002'),('212002'),('212002'),('212002'),('212003'),('212003'),('212003'),('212004'),('212004'),('212004'),('212005'),('212005'),('212005'),('212005'),('212005'),('212006'),('212006'),('212006'),('212007'),('212007'),('212008'),('212008'),('212008'),('212008'),('212009'),('212009'),('212009'),('212009'),('212010'),('212010'),('212010'),('212010'),('212011'),('212011'),('212012'),('212012'),('212013'),('212013'),('212013'),('218001'),('218004'),('218009'),('218011'),('218011'),('218015'),('218020'),('218021'),('218021'),('218022'),('218022'),('218022'),('218023'),('218024'),('218025'),('218026'),('218026'),('218027'),('218028'),('218029'),('218029'),('218029'),('218030'),('218031'),('221001'),('221001'),('221001'),('221001'),('221001'),('221001'),('221002'),('221002'),('221002'),('221002'),('221002'),('221002'),('221003'),('221003'),('221003'),('221003'),('221003'),('221003'),('221004'),('221004'),('221004'),('221004'),('221004'),('221004'),('221005'),('221005'),('221005'),('221005'),('221005'),('221006'),('221006'),('221006'),('221006'),('221006'),('221007'),('221007'),('221007'),('221007'),('221007'),('221007'),('221008'),('221008'),('221008'),('221008'),('221008'),('221008'),('221009'),('221009'),('221009'),('221009'),('221009'),('221009'),('221010'),('221010'),('221010'),('221010'),('221011'),('221011'),('221011'),('221011'),('221012'),('221012'),('221012'),('221012'),('221012'),('221012'),('221013'),('221013'),('221013'),('221013'),('221013'),('221013'),('223003'),('223003'),('224001'),('224001'),('224002'),('224002'),('224003'),('224007'),('224008'),('225001'),('225002'),('225002'),('225002'),('225003'),('225003'),('225003'),('225003'),('225004'),('225004'),('225004'),('225005'),('225005'),('225005'),('225005'),('225005'),('225005'),('225006'),('225006'),('225006'),('225007'),('225007'),('225007'),('225008'),('225008'),('225008'),('225008'),('225008'),('225009'),('225009'),('225009'),('225010'),('225010'),('225010'),('225011'),('225011'),('225011'),('225011'),('225011'),('225012'),('225012'),('225012'),('225012'),('225012'),('225012'),('225013'),('225013'),('226001'),('226002'),('226003'),('226003'),('226005'),('226005'),('226006'),('226007'),('226007'),('226007'),('226007'),('227011'),('227015'),('227015'),('227041'),('227045'),('227052'),('227056'),('227063'),('227064'),('227066'),('227067'),('227069'),('227071'),('227073'),('227085'),('227116'),('227119'),('227131'),('227133'),('227147'),('229005'),('229005'),('229005'),('233003'),('233004'),('235001'),('235001'),('235002'),('235003'),('235003'),('235003'),('235004'),('235005'),('235005'),('235005'),('235005'),('235005'),('235005'),('235005'),('236001'),('236001'),('236001'),('236001'),('236002'),('236003'),('236003'),('236003'),('236003'),('236003'),('236003'),('238002'),('238002'),('238002'),('238002'),('238002'),('238002'),('238003'),('238003'),('238003'),('238003'),('238003'),('238003'),('238004'),('238004'),('238004'),('238004'),('238004'),('238005'),('238005'),('238005'),('238007'),('238007'),('238007'),('238007'),('238007'),('238007'),('238007'),('238008'),('238008'),('238008'),('238008'),('238008'),('238008'),('238008'),('334005'),('334006'),('337001'),('337001'),('337001'),('337002'),('337002'),('337003'),('337003'),('337003'),('337004'),('343001'),('343001'),('344001'),('344002'),('344003'),('344004'),('344005'),('344005'),('345001'),('345001'),('348001'),('348004'),('348005'),('348005'),('349001'),('349001'),('349002'),('349002'),('349002'),('350001'),('353002'),('353002'),('353002'),('353003'),('355001'),('355002'),('355005'),('355006'),('355006'),('356001'),('358001'),('358001'),('358001'),('359001'),('359001'),('359002'),('359002'),('359002'),('359002'),('360001'),('360001'),('360002'),('360002'),('360003'),('360003'),('360004'),('360004'),('360005'),('360005'),('360005'),('366001'),('366002'),('366002'),('366003'),('366004'),('369001'),('369001'),('373001'),('373002'),('373002'),('373003'),('373003'),('373005'),('373007'),('373008'),('373009'),('373009'),('373010'),('373010'),('373010'),('373011'),('373011'),('373011'),('373011'),('373012'),('373012'),('373012'),('373013'),('373013'),('373014'),('373014'),('373015'),('373015'),('373015'),('373015'),('373017'),('373017'),('373017'),('373017'),('373018'),('373021'),('374002'),('374004'),('374006'),('374007'),('374008'),('374009'),('374010'),('374011'),('374012'),('374015'),('374016'),('382001'),('382002'),('382002'),('384001'),('386001'),('386001'),('386001'),('386001'),('386001'),('386001'),('386001'),('386002'),('386002'),('386002'),('386002'),('386002'),('386002'),('386002'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386004'),('386004'),('386004'),('386004'),('386004'),('386004'),('386004'),('386004'),('386005'),('386005'),('386005'),('386005'),('386005'),('386005'),('386005'),('386006'),('386006'),('386006'),('386006'),('386006'),('386006'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386008'),('386008'),('386008'),('386008'),('386008'),('386008'),('386008'),('386008'),('386009'),('386009'),('386009'),('386010'),('386010'),('386010'),('386010'),('386010'),('386010'),('386010'),('386010'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386013'),('386013'),('386013'),('386013'),('386013'),('386013'),('386013'),('386014'),('386014'),('386014'),('386014'),('389001'),('389002'),('389002'),('389003'),('389003'),('389003'),('389003'),('389004'),('389004'),('389004'),('389004'),('392001'),('393001'),('393002'),('393002'),('393003'),('393004'),('395001'),('395001'),('397001'),('397001'),('397001'),('397002'),('399001'),('399001'),('399001'),('399001'),('399001'),('399001'),('399001'),('399002'),('399002'),('399002'),('399002'),('399002'),('399002'),('399002'),('399003'),('400001'),('400001'),('400001'),('400001'),('400002'),('403002'),('504001'),('504001'),('504002'),('504002'),('504002'),('504004'),('504004'),('504005'),('504006'),('504007'),('504007'),('504007'),('504008'),('504008'),('504009'),('504009'),('504009'),('504009'),('504009'),('504010'),('504011'),('504011'),('504012'),('504012'),('504014'),('504014'),('504014'),('504014'),('504014'),('504014'),('504014'),('504014'),('504017'),('504017'),('504021'),('504021'),('504021'),('504021'),('504021'),('504021'),('504021'),('504022'),('504023'),('504023'),('504024'),('504024'),('504025'),('504025'),('506001'),('506001'),('506001'),('506001'),('506001'),('506001'),('506002'),('506002'),('506002'),('506002'),('506002'),('511001'),('511001'),('511001'),('511001'),('511001'),('511001'),('511001'),('511002'),('511002'),('511002'),('511002'),('511002'),('511002'),('511002'),('511003'),('511003'),('511003'),('511003'),('511003'),('511003'),('511004'),('511004'),('511004'),('511004'),('511004'),('511004'),('511004'),('511005'),('511005'),('511005'),('511005'),('511005'),('511005'),('511005'),('511006'),('511006'),('511006'),('511006'),('511006'),('511006'),('511006'),('511007'),('511007'),('511007'),('511007'),('511007'),('511008'),('511008'),('511008'),('511008'),('511008'),('511008'),('511009'),('511009'),('511009'),('511009'),('511009'),('511009'),('511010'),('511010'),('511010'),('511010'),('511010'),('511010'),('511011'),('511011'),('511011'),('511011'),('511011'),('511011'),('511012'),('511012'),('511012'),('511012'),('511012'),('511012'),('511012'),('511013'),('511013'),('511013'),('511013'),('511013'),('511013'),('511013'),('511014'),('511014'),('511014'),('511014'),('511014'),('511017'),('511018'),('511020'),('511021'),('511022'),('511024'),('511028'),('511029'),('511029'),('511029'),('511029'),('511029'),('511029'),('513001'),('513001'),('513001'),('513001'),('513001'),('513001'),('513001'),('513001'),('513002'),('513002'),('513002'),('513002'),('513002'),('513002'),('513003'),('513003'),('513003'),('513003'),('513003'),('513003'),('513003'),('513003'),('513004'),('513004'),('513004'),('515001'),('515001'),('515001'),('515001'),('515001'),('515002'),('515002'),('515003'),('515003'),('515007'),('515007'),('515008'),('515011'),('515011'),('515011'),('515011'),('515011'),('515011'),('515012'),('515012'),('515012'),('515012'),('515013'),('515013'),('515013'),('515013'),('515013'),('515014'),('515014'),('515014'),('515014'),('515014'),('515015'),('515015'),('515015'),('515015'),('515015'),('518001'),('518002'),('521001'),('521002'),('521002'),('521002'),('521003'),('521003'),('521003'),('521003'),('521004'),('521004'),('521004'),('521004'),('521005'),('521005'),('521005'),('521005'),('521006'),('521006'),('521006'),('521009'),('521010'),('521010'),('521010'),('521010'),('521011'),('521011'),('521011'),('521011'),('521012'),('521013'),('521013'),('521015'),('521016'),('521016'),('523001'),('523001'),('523001'),('523001'),('523001'),('523001'),('523001'),('523002'),('523002'),('523002'),('523002'),('523002'),('523002'),('523003'),('523003'),('523003'),('523003'),('523003'),('523003'),('523003'),('523004'),('523004'),('523004'),('523004'),('523004'),('523004'),('523005'),('523005'),('523005'),('523005'),('523005'),('523005'),('523005'),('523005'),('523006'),('523006'),('523006'),('523006'),('523006'),('523006'),('523006'),('523007'),('523007'),('523007'),('523007'),('523007'),('523007'),('523007'),('524001'),('700001'),('701001'),('701002'),('701003'),('702001'),('702002'),('702004'),('702005'),('704001'),('704004'),('705001'),('706001'),('706002'),('707001'),('707002'),('707003'),('708001'),('710001'),('710002'),('711001'),('711002'),('712001'),('714001'),('714002'),('715001'),('719001'),('719002'),('991002'),('991002'),('991002'),('991003'),('991003'),('991003'),('991003'),('991003'),('991003'),('991003'),('991004'),('991004'),('991004'),('991005'),('991005'),('991005'),('991006'),('991007'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996002'),('996002'),('996003'),('996003'),('996003'),('996003'),('996003'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998003'),('998003'),('998003'),('998003'),('998003'),('998003'),('998003'),('998003'),('998004'),('998004'),('998005'),('998005'),('998006'),('998007'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999002'),('999002'),('011017'),('011017'),('011017'),('011017'),('011017'),('011017'),('011017'),('011018'),('011018'),('011018'),('011018'),('034001'),('034001'),('034002'),('034002'),('071010'),('071010'),('071010'),('519001'),('126013'),('126013'),('126013'),('126013'),('126013'),('184012'),('184012'),('184012'),('404001'),('405002'),('405002'),('405001'),('405003'),('405006'),('240011'),('240011'),('240011'),('240011'),('240011'),('240011'),('240010'),('240010'),('240010'),('240009'),('240009'),('240009'),('240009'),('240008'),('240008'),('240008'),('240007'),('240007'),('240007'),('240007'),('240007'),('240007'),('240005'),('240005'),('240005'),('240005'),('240005'),('240004'),('240004'),('240004'),('240004'),('240004'),('240003'),('240003'),('240003'),('240003'),('240002'),('240002'),('240002'),('240002'),('240002'),('240002'),('240002'),('240001'),('240001'),('240001'),('240001'),('240001'),('240012'),('240012'),('240012'),('240012'),('240012'),('240013'),('240014'),('240015'),('240015'),('240015'),('240015'),('240015'),('240015'),('240015'),('240015'),('240016'),('240016'),('240016'),('240016'),('240016'),('240016'),('240017'),('240017'),('240017'),('357001'),('357001'),('235006'),('235006'),('235007'),('235007'),('235007'),('235007'),('235007'),('056023'),('056023'),('056023'),('056023'),('056023'),('046015'),('019005'),('019005'),('126014'),('126014'),('126014'),('126014'),('126014'),('126014'),('241003'),('241003'),('241003'),('241003'),('241003'),('241003'),('241002'),('241002'),('241002'),('241002'),('241002'),('241002'),('241001'),('241001'),('241001'),('241001'),('241001'),('240020'),('240020'),('240020'),('240020'),('240020'),('240020'),('240019'),('240019'),('240019'),('242001'),('242002'),('242004'),('242005'),('242006'),('089002'),('089002'),('089002'),('089002'),('089002'),('089002'),('406001'),('406002'),('406003'),('406004'),('406004'),('243001'),('243005'),('243006'),('243007'),('243008'),('408001'),('408001'),('408001'),('408001'),('408001'),('366005'),('366005'),('016035'),('016035'),('016035'),('016035'),('077010'),('996004'),('996004'),('996004'),('996004'),('996004'),('996004'),('996004'),('996004'),('025064'),('025064'),('025064'),('025064'),('011019'),('011019'),('011019'),('011019'),('011019'),('115123'),('115123'),('504026'),('039007'),('039009'),('039008'),('039008'),('039010'),('039010'),('039011'),('039012'),('180072'),('240021'),('240021'),('240021'),('240021'),('240021'),('240021'),('240021'),('240023'),('240023'),('240023'),('240023'),('405008'),('405008'),('525002'),('410002'),('410002'),('410004'),('410005'),('410005'),('410006'),('410007'),('410007'),('410008'),('410009'),('410010'),('410011'),('410011'),('410012'),('410012'),('410013'),('410013'),('410014'),('410014'),('410016'),('410016'),('344006'),('240031'),('240031'),('240031'),('240031'),('240030'),('240030'),('240030'),('240030'),('240029'),('240029'),('240029'),('240029'),('240028'),('240028'),('240028'),('240028'),('240027'),('240027'),('240026'),('240026'),('240026'),('240025'),('240025'),('240025'),('240025'),('240024'),('240024'),('240034'),('240034'),('240034'),('240033'),('240033'),('240033'),('240032'),('240032'),('240032'),('240032'),('411001'),('411002'),('203020'),('069025'),('069025'),('069025'),('069025'),('069025'),('069025'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244014'),('244014'),('244014'),('244014'),('244014'),('244014'),('244014'),('244014'),('244013'),('244013'),('244013'),('244013'),('244013'),('244013'),('244013'),('244013'),('244012'),('244012'),('244012'),('244012'),('244012'),('244012'),('244012'),('244012'),('244011'),('244011'),('244011'),('244011'),('244011'),('244011'),('244011'),('244011'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('240040'),('240037'),('405009'),('405009'),('405009'),('405010'),('405010'),('240043'),('240043'),('504028'),('504040'),('800001'),('410019'),('410019'),('410020'),('410020'),('410020'),('410021'),('410021'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244020'),('244020'),('244020'),('244020'),('244020'),('244020'),('244020'),('244020'),('413001'),('344007'),('082045'),('082045'),('082045'),('082045'),('082045'),('010031'),('010031'),('010031'),('010031'),('010032'),('010032'),('010032'),('010032'),('010033'),('010033'),('010033'),('010033'),('010033'),('010034'),('010034'),('010034'),('010034'),('010035'),('010035'),('010035'),('010035'),('504044'),('515016'),('515016'),('515016'),('515016'),('801002'),('801003'),('801004'),('801005'),('802001'),('801001'),('414001'),('141029'),('803001'),('803002'),('803004'),('803005'),('803006'),('803007'),('803008'),('803009'),('803013'),('803014'),('803015'),('803016'),('803017'),('410022'),('410023'),('410023'),('803019'),('415002'),('415001'),('244021'),('244021'),('244021'),('244021'),('244021'),('244021'),('244021'),('011020'),('011020'),('011020'),('011020'),('011023'),('011023'),('011023'),('011023'),('011022'),('011022'),('011022'),('011022'),('011022'),('011022'),('011021'),('011021'),('011021'),('011021'),('025065'),('025065'),('025065'),('025065'),('165037'),('165037'),('165038'),('165038'),('165038'),('165039'),('416001'),('416001'),('416001'),('416001'),('416001'),('416002'),('416003'),('417001'),('418001'),('504045'),('504045'),('504045'),('803022'),('240022'),('240022'),('240022'),('240022'),('420001'),('420001'),('420001'),('420001'),('804010'),('804005'),('804002'),('804018'),('804013'),('511019'),('511016'),('511015'),('511032'),('511031'),('511030'),('511027'),('511026'),('511025'),('511033'),('511023'),('133034'),('133034'),('133034'),('133033'),('169011'),('169011'),('169011'),('169011'),('169011'),('344008'),('244022'),('244022'),('244022'),('244022'),('244022'),('244022'),('244022'),('244026'),('244026'),('244026'),('244026'),('244026'),('244026'),('244025'),('244025'),('244025'),('244025'),('244025'),('244025'),('244025'),('244025'),('244030'),('244030'),('244030'),('244030'),('244030'),('244030'),('244030'),('244030'),('244023'),('244023'),('244023'),('244023'),('244023'),('244023'),('244024'),('244024'),('244024'),('244024'),('244024'),('244024'),('244024'),('244024'),('244027'),('244027'),('244027'),('244027'),('244027'),('244027'),('244027'),('244027'),('244028'),('244028'),('244028'),('244028'),('244028'),('244028'),('244028'),('244028'),('244029'),('244029'),('244029'),('244029'),('244029'),('244029'),('244029'),('244029'),('244031'),('244031'),('244031'),('244031'),('244031'),('244031'),('244031'),('244031'),('082046'),('082046'),('082046'),('082046'),('082047'),('082047'),('082048'),('082048'),('126015'),('126015'),('126016'),('126016'),('126016'),('126016'),('126016'),('416005'),('421001'),('421001'),('421002'),('016037'),('016037'),('016037'),('016037'),('016036'),('016036'),('016036'),('016036'),('115124'),('115124'),('115126'),('240049'),('240049'),('240048'),('240048'),('240047'),('240047'),('240046'),('240046'),('240045'),('240044'),('244032'),('244033'),('422002'),('422004'),('422004'),('422004'),('422005'),('422005'),('184013'),('184013'),('184013'),('805001'),('805002'),('805003'),('805004'),('805005'),('056024'),('056024'),('056024'),('423001'),('344010'),('235009'),('235009'),('235009'),('235009'),('212014'),('212014'),('056025'),('056025'),('056025'),('056026'),('056026'),('056026'),('056026'),('056026'),('056026'),('244034'),('244034'),('244034'),('244034'),('244034'),('244034'),('244035'),('244035'),('244035'),('244035'),('244035'),('244035'),('244035'),('244036'),('244036'),('244036'),('244036'),('244036'),('244036'),('244036'),('244037'),('244037'),('244037'),('244037'),('244037'),('244037'),('244037'),('244038'),('244038'),('244038'),('244038'),('244038'),('244038'),('244038'),('244039'),('244039'),('244039'),('244039'),('244039'),('244039'),('244039'),('203015'),('245002'),('245002'),('245001'),('245001'),('056029'),('056030'),('056032'),('424001'),('056034'),('056034'),('056034'),('056034'),('056033'),('056033'),('056033'),('805006'),('805007'),('805008'),('805009'),('805010'),('422008'),('422008'),('422007'),('422007'),('422006'),('422006'),('422010'),('422009'),('422009'),('422011'),('422011'),('209004'),('209004'),('150022'),('100002'),('056035'),('056035'),('056035'),('023036'),('023036'),('185005'),('246001'),('246001'),('247001'),('247001'),('247001'),('247001'),('247001'),('247001'),('247001'),('247002'),('247002'),('425001'),('416006'),('416006'),('165042'),('165041'),('165040'),('165043'),('010040'),('010039'),('010038'),('010036'),('248001'),('248002'),('248003'),('248004'),('248005'),('249001'),('249003'),('249004'),('249005'),('250007'),('250001'),('250002'),('250003'),('250004'),('250005'),('250006'),('250008'),('250009'),('250010'),('250011'),('250012'),('250013'),('251001'),('251002'),('806001'),('806002'),('235010'),('243009'),('249007'),('249008'),('249009'),('011024'),('011025'),('429001'),('429001'),('429002'),('429002'),('429003'),('429003');
select field from t1 group by field;
drop table t1;
+
+#
+# Test of enum with space
+#
+
+create table t1 (a enum (' ','a','b') not null);
+show create table t1;
+drop table t1;
+create table t1 (a enum (' ','a','b ') not null default 'b ');
+show create table t1;
+drop table t1;
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
new file mode 100644
index 00000000000..39bcbcbf75d
--- /dev/null
+++ b/mysql-test/t/type_set.test
@@ -0,0 +1,10 @@
+#
+# Test of SET with space
+#
+
+create table t1 (a set (' ','a','b') not null);
+show create table t1;
+drop table t1;
+create table t1 (a set (' ','a','b ') not null default 'b ');
+show create table t1;
+drop table t1;
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 9e458331619..31b0947af9f 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -35,7 +35,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.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_stripp.c \
+ mf_pack.c mf_unixpath.c mf_strip.c \
mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \
mf_qsort.c mf_qsort2.c mf_sort.c \
ptr_cmp.c mf_radix.c queues.c \
@@ -45,7 +45,8 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_chsize.c my_lread.c my_lwrite.c my_clock.c \
my_quick.c my_lockmem.c my_static.c \
my_getopt.c getvar.c my_mkdir.c \
- default.c my_compress.c checksum.c raid.cc my_net.c \
+ default.c my_compress.c checksum.c raid.cc \
+ my_net.c \
my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \
my_gethostbyname.c
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index a0247003a81..34873d107af 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -122,8 +122,6 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
info->pos_in_file= seek_offset;
info->pre_close = info->pre_read = info->post_read = 0;
info->arg = 0;
- info->init_count++; /* we assume the user had set it to 0 prior to
- first call */
info->alloced_buffer = 0;
info->buffer=0;
info->seek_not_done= test(file >= 0);
diff --git a/mysys/mf_stripp.c b/mysys/mf_strip.c
index d2fd171ec8c..ef2aab2c0a3 100644
--- a/mysys/mf_stripp.c
+++ b/mysys/mf_strip.c
@@ -19,11 +19,11 @@
#include "mysys_priv.h"
/*
- stripp_sp(my_string str)
+ strip_sp(my_string str)
Strips end-space from string and returns new length.
*/
-size_s stripp_sp(register my_string str)
+size_s strip_sp(register my_string str)
{
reg2 my_string found;
reg3 my_string start;
@@ -43,4 +43,4 @@ size_s stripp_sp(register my_string str)
}
*found= '\0'; /* Stripp at first space */
return (size_s) (found-start);
-} /* stripp_sp */
+} /* strip_sp */
diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c
index 76a0a780dd3..1380257f660 100644
--- a/mysys/my_gethostbyname.c
+++ b/mysys/my_gethostbyname.c
@@ -18,21 +18,18 @@
/* Thread safe version of gethostbyname_r() */
#include "mysys_priv.h"
+#ifdef THREAD
#include "my_pthread.h"
+#endif
#include <assert.h>
-#include <my_net.h>
#if !defined(MSDOS) && !defined(__WIN__)
#include <netdb.h>
#endif
+#include <my_net.h>
/* This file is not needed if my_gethostbyname_r is a macro */
#if !defined(my_gethostbyname_r)
-#ifndef THREAD
-#define pthread_mutex_lock(A)
-#define pthread_mutex_unlock(A)
-#endif
-
/*
Emulate SOLARIS style calls, not because it's better, but just to make the
usage of getbostbyname_r simpler.
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 80904fb46f6..12af811a0c8 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -20,6 +20,7 @@
#include <my_getopt.h>
#include <assert.h>
#include <my_sys.h>
+#include <mysys_err.h>
static int findopt (char *optpat, uint length,
const struct my_option **opt_res,
@@ -42,17 +43,11 @@ static const char *special_opt_prefix[]=
char *disabled_my_option= (char*) "0";
-/* Return error values from handle_options */
+/* This is a flag that can be set in client programs. 0 means that
+ my_getopt will not print error messages, but the client should do
+ it by itself */
-#define ERR_UNKNOWN_OPTION 1
-#define ERR_AMBIGUOUS_OPTION 2
-#define ERR_NO_ARGUMENT_ALLOWED 3
-#define ERR_ARGUMENT_REQUIRED 4
-#define ERR_VAR_PREFIX_NOT_UNIQUE 5
-#define ERR_UNKNOWN_VARIABLE 6
-#define ERR_OUT_OF_MEMORY 7
-#define ERR_UNKNOWN_SUFFIX 8
-#define ERR_NO_PTR_TO_VARIABLE 9
+my_bool my_getopt_print_errors= 1;
/*
@@ -73,7 +68,7 @@ int handle_options(int *argc, char ***argv,
{
uint opt_found, argvpos= 0, length, spec_len, i;
my_bool end_of_options= 0, must_be_var, set_maximum_value, special_used,
- option_is_loose;
+ option_is_loose, option_used= 0;
char *progname= *(*argv), **pos, *optend, *prev_found;
const struct my_option *optp;
int error;
@@ -89,6 +84,7 @@ int handle_options(int *argc, char ***argv,
if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */
{
char *argument= 0;
+ option_used= 1;
must_be_var= 0;
set_maximum_value= 0;
special_used= 0;
@@ -106,9 +102,10 @@ int handle_options(int *argc, char ***argv,
/* the argument must be in next argv */
if (!*++pos)
{
- fprintf(stderr, "%s: Option '-O' requires an argument\n",
- progname);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: Option '-O' requires an argument\n",
+ progname);
+ return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
(*argc)--;
@@ -128,10 +125,11 @@ int handle_options(int *argc, char ***argv,
cur_arg+= 14;
if (!*cur_arg)
{
- fprintf(stderr,
- "%s: Option '--set-variable' requires an argument\n",
- progname);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: Option '--set-variable' requires an argument\n",
+ progname);
+ return EXIT_ARGUMENT_REQUIRED;
}
}
else if (cur_arg[14]) /* garbage, or another option. break out */
@@ -141,10 +139,11 @@ int handle_options(int *argc, char ***argv,
/* the argument must be in next argv */
if (!*++pos)
{
- fprintf(stderr,
- "%s: Option '--set-variable' requires an argument\n",
- progname);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: Option '--set-variable' requires an argument\n",
+ progname);
+ return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
(*argc)--;
@@ -200,11 +199,12 @@ int handle_options(int *argc, char ***argv,
{
if (opt_found > 1)
{
- fprintf(stderr,
- "%s: ambiguous option '--%s-%s' (--%s-%s)\n",
- progname, special_opt_prefix[i], cur_arg,
- special_opt_prefix[i], prev_found);
- return ERR_AMBIGUOUS_OPTION;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: ambiguous option '--%s-%s' (--%s-%s)\n",
+ progname, special_opt_prefix[i], cur_arg,
+ special_opt_prefix[i], prev_found);
+ return EXIT_AMBIGUOUS_OPTION;
}
if (i < DISABLE_OPTION_COUNT)
optend= disabled_my_option;
@@ -224,19 +224,21 @@ int handle_options(int *argc, char ***argv,
{
if (must_be_var)
{
- fprintf(stderr,
- "%s: %s: unknown variable '%s'\n", progname,
- option_is_loose ? "WARNING" : "ERROR", cur_arg);
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: %s: unknown variable '%s'\n", progname,
+ option_is_loose ? "WARNING" : "ERROR", cur_arg);
if (!option_is_loose)
- return ERR_UNKNOWN_VARIABLE;
+ return EXIT_UNKNOWN_VARIABLE;
}
else
{
- fprintf(stderr,
- "%s: %s: unknown option '--%s'\n", progname,
- option_is_loose ? "WARNING" : "ERROR", cur_arg);
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: %s: unknown option '--%s'\n", progname,
+ option_is_loose ? "WARNING" : "ERROR", cur_arg);
if (!option_is_loose)
- return ERR_UNKNOWN_OPTION;
+ return EXIT_UNKNOWN_OPTION;
}
if (option_is_loose)
{
@@ -249,30 +251,34 @@ int handle_options(int *argc, char ***argv,
{
if (must_be_var)
{
- fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
- progname, cur_arg);
- return ERR_VAR_PREFIX_NOT_UNIQUE;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
+ progname, cur_arg);
+ return EXIT_VAR_PREFIX_NOT_UNIQUE;
}
else
{
- fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
- progname, cur_arg, prev_found, optp->name);
- return ERR_AMBIGUOUS_OPTION;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
+ progname, cur_arg, prev_found, optp->name);
+ return EXIT_AMBIGUOUS_OPTION;
}
}
if (must_be_var && (!optp->value || optp->var_type == GET_BOOL))
{
- fprintf(stderr, "%s: option '%s' cannot take an argument\n",
- progname, optp->name);
- return ERR_NO_ARGUMENT_ALLOWED;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: option '%s' cannot take an argument\n",
+ progname, optp->name);
+ return EXIT_NO_ARGUMENT_ALLOWED;
}
if (optp->arg_type == NO_ARG)
{
if (optend && !special_used)
{
- fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
- progname, optp->name);
- return ERR_NO_ARGUMENT_ALLOWED;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
+ progname, optp->name);
+ return EXIT_NO_ARGUMENT_ALLOWED;
}
if (optp->var_type == GET_BOOL)
{
@@ -306,9 +312,10 @@ int handle_options(int *argc, char ***argv,
/* Check if there are more arguments after this one */
if (!*++pos)
{
- fprintf(stderr, "%s: option '--%s' requires an argument\n",
- progname, optp->name);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: option '--%s' requires an argument\n",
+ progname, optp->name);
+ return EXIT_ARGUMENT_REQUIRED;
}
argument= *pos;
(*argc)--;
@@ -318,8 +325,9 @@ int handle_options(int *argc, char ***argv,
}
else /* must be short option */
{
- for (optend= cur_arg; *optend; optend++, opt_found= 0)
+ for (optend= cur_arg; *optend; optend++)
{
+ opt_found= 0;
for (optp= longopts; optp->id; optp++)
{
if (optp->id == (int) (uchar) *optend)
@@ -329,7 +337,6 @@ int handle_options(int *argc, char ***argv,
if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG)
{
*((my_bool*) optp->value)= (my_bool) 1;
- (*argc)--;
continue; // For GET_BOOL get_one_option() shouldn't be called
}
else if (optp->arg_type == REQUIRED_ARG ||
@@ -347,9 +354,11 @@ int handle_options(int *argc, char ***argv,
/* Check if there are more arguments after this one */
if (!*++pos)
{
- fprintf(stderr, "%s: option '-%c' requires an argument\n",
- progname, optp->id);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: option '-%c' requires an argument\n",
+ progname, optp->id);
+ return EXIT_ARGUMENT_REQUIRED;
}
argument= *pos;
(*argc)--;
@@ -369,9 +378,10 @@ int handle_options(int *argc, char ***argv,
}
if (!opt_found)
{
- fprintf(stderr,
- "%s: unknown option '-%c'\n", progname, *cur_arg);
- return ERR_UNKNOWN_OPTION;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: unknown option '-%c'\n", progname, *optend);
+ return EXIT_UNKNOWN_OPTION;
}
}
(*argc)--; /* option handled (short), decrease argument count */
@@ -391,6 +401,12 @@ int handle_options(int *argc, char ***argv,
else /* non-option found */
(*argv)[argvpos++]= cur_arg;
}
+ /* Destroy the first, already handled option, so that programs that look
+ for arguments in 'argv', without checking 'argc', know when to stop.
+ Items in argv, before the destroyed one, are all non-option -arguments
+ to the program, yet to be (possibly) handled. */
+ if (option_used)
+ (*argv)[argvpos]= 0;
return 0;
}
@@ -412,7 +428,7 @@ static int setval (const struct my_option *opts, char *argument,
opts->u_max_value : opts->value;
if (!result_pos)
- return ERR_NO_PTR_TO_VARIABLE;
+ return EXIT_NO_PTR_TO_VARIABLE;
switch (opts->var_type) {
case GET_INT:
@@ -437,13 +453,13 @@ static int setval (const struct my_option *opts, char *argument,
my_free((*(char**) result_pos),
MYF(MY_WME | MY_FAE));
if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME))))
- return ERR_OUT_OF_MEMORY;
+ return EXIT_OUT_OF_MEMORY;
break;
default: /* dummy default to avoid compiler warnings */
break;
}
if (err)
- return ERR_UNKNOWN_SUFFIX;
+ return EXIT_UNKNOWN_SUFFIX;
}
return 0;
}
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 747a07e71b2..e1345b96627 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -419,6 +419,7 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
****************************************************************************/
#if defined(HPUX) || defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT)
+#undef pthread_cond_timedwait
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime)
diff --git a/mysys/raid2.c b/mysys/raid2.c
new file mode 100644
index 00000000000..94b085b0074
--- /dev/null
+++ b/mysys/raid2.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 MySQL AB
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA */
+
+/*
+ RAID support for MySQL. For full comments, check raid.cc
+ This is in a separate file to not cause problems on OS that can't
+ put C++ files in archives.
+*/
+
+#include "mysys_priv.h"
+
+const char *raid_type_string[]={"none","striped"};
+
+const char *my_raid_type(int raid_type)
+{
+ return raid_type_string[raid_type];
+}
diff --git a/sql/field.cc b/sql/field.cc
index c6880a29cee..5466facb437 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4628,7 +4628,7 @@ bool Field_num::eq_def(Field *field)
*****************************************************************************/
/*
-** Make a field from the .frm file info
+ Make a field from the .frm file info
*/
uint32 calc_pack_length(enum_field_types type,uint32 length)
@@ -4657,6 +4657,7 @@ uint32 calc_pack_length(enum_field_types type,uint32 length)
case FIELD_TYPE_LONG_BLOB: return 4+portable_sizeof_char_ptr;
case FIELD_TYPE_SET:
case FIELD_TYPE_ENUM: abort(); return 0; // This shouldn't happen
+ default: return 0;
}
return 0; // This shouldn't happen
}
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index ba1d27f2bf6..a4f0791d105 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -356,7 +356,7 @@ void print_arrays()
static void usage(int version)
{
- printf("%s Ver 3.4 Distrib %s, for %s (%s)\n",
+ printf("%s Ver 3.5 Distrib %s, for %s (%s)\n",
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
if (version)
return;
@@ -394,11 +394,8 @@ static int get_options(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (argc >= 1)
{
usage(0);
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index c85d74ce432..48a4513cd2a 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -655,6 +655,7 @@ innobase_close_connection(
(thd->transaction.all.innobase_tid));
trx_free_for_mysql((trx_t*)
(thd->transaction.all.innobase_tid));
+ thd->transaction.all.innobase_tid = NULL;
}
return(0);
diff --git a/sql/handler.cc b/sql/handler.cc
index 7947ae5a9f0..25617d95075 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -316,7 +316,10 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
sql_print_error("Error: Got error during commit; Binlog is not up to date!");
thd->tx_isolation=thd->session_tx_isolation;
if (operation_done)
+ {
statistic_increment(ha_commit_count,&LOCK_status);
+ thd->transaction.cleanup();
+ }
}
#endif // using transactions
DBUG_RETURN(error);
@@ -361,7 +364,10 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
thd->transaction.trans_log.end_of_file= max_binlog_cache_size;
thd->tx_isolation=thd->session_tx_isolation;
if (operation_done)
+ {
statistic_increment(ha_rollback_count,&LOCK_status);
+ thd->transaction.cleanup();
+ }
}
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 5359f876522..a93af8b273e 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -57,8 +57,11 @@ void hostname_cache_refresh()
bool hostname_cache_init()
{
+ host_entry *tmp;
+ uint offset= (uint) ((char*) (&tmp->ip) - (char*) tmp);
(void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
- if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE,offsetof(host_entry,ip),
+
+ if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
sizeof(struct in_addr),NULL,
(void (*)(void*)) free)))
return 1;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index d95dbf8ef97..d2eb16ce5de 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1304,13 +1304,14 @@ bool Item_func_like::fix_fields(THD *thd,struct st_table_list *tlist)
{
pattern = first + 1;
pattern_len = len - 2;
- DBUG_PRINT("TurboBM", ("Initializing pattern: '%s'...", first));
- int* suff = (int*)thd->alloc(sizeof(int[pattern_len + 1]));
- bmGs = (int*)thd->alloc(sizeof(int[pattern_len + 1]));
- bmBc = (int*)thd->alloc(sizeof(int[alphabet_size]));
+ DBUG_PRINT("info", ("Initializing pattern: '%s'", first));
+ int *suff = (int*) thd->alloc(sizeof(int)*((pattern_len + 1)*2+
+ alphabet_size));
+ bmGs = suff + pattern_len + 1;
+ bmBc = bmGs + pattern_len + 1;
turboBM_compute_good_suffix_shifts(suff);
turboBM_compute_bad_character_shifts();
- DBUG_PRINT("turboBM",("done"));
+ DBUG_PRINT("info",("done"));
}
}
return 0;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index cd6e3d6e414..3f674198856 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -495,16 +495,10 @@ class Item_func_like :public Item_bool_func2
enum { alphabet_size = 256 };
public:
- Item_func_like::Item_func_like(Item *a,Item *b, char* escape_arg) :
- Item_bool_func2(a,b),
- escape(*escape_arg),
- canDoTurboBM(false),
- pattern(0),
- pattern_len(0),
- bmGs(0),
- bmBc(0)
+ Item_func_like(Item *a,Item *b, char* escape_arg)
+ :Item_bool_func2(a,b), escape(*escape_arg), canDoTurboBM(false),
+ pattern(0), pattern_len(0), bmGs(0), bmBc(0)
{}
-
longlong val_int();
enum Functype functype() const { return LIKE_FUNC; }
optimize_type select_optimize() const;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index cffa92919ba..4a8c301e894 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -627,7 +627,12 @@ double Item_func_round::val()
log_10[abs_dec] : pow(10.0,(double) abs_dec));
if (truncate)
- return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
+ {
+ if (value >= 0)
+ return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
+ else
+ return dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp;
+ }
return dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
}
diff --git a/sql/log.cc b/sql/log.cc
index f0012a94f5d..0f8c4a8c4a8 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -80,10 +80,10 @@ static int find_uniq_filename(char *name)
DBUG_RETURN(0);
}
-MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0),index_file(-1),
- name(0), log_type(LOG_CLOSED),write_error(0),
- inited(0), file_id(1),no_rotate(0),
- need_start_event(1),bytes_written(0)
+MYSQL_LOG::MYSQL_LOG()
+ :bytes_written(0), last_time(0), query_start(0), index_file(-1), name(0),
+ file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0), inited(0),
+ no_rotate(0), need_start_event(1)
{
/*
We don't want to intialize LOCK_Log here as the thread system may
@@ -173,8 +173,10 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
File file= -1;
bool do_magic;
int open_flags = O_CREAT | O_APPEND | O_BINARY;
+ DBUG_ENTER("MYSQL_LOG::open");
+
if (!inited && log_type_arg == LOG_BIN && *fn_ext(log_name))
- no_rotate = 1;
+ no_rotate = 1;
init(log_type_arg,io_cache_type_arg,no_auto_events_arg);
if (!(name=my_strdup(log_name,MYF(MY_WME))))
@@ -196,6 +198,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
do_magic = ((log_type == LOG_BIN) && !my_stat(log_file_name,
&tmp_stat, MYF(0)));
+ open_count++;
if ((file=my_open(log_file_name,open_flags,
MYF(MY_WME | ME_WAITTANG))) < 0 ||
init_io_cache(&log_file, file, IO_SIZE, io_cache_type,
@@ -237,10 +240,10 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
bool error;
if (do_magic)
{
- if (my_b_write(&log_file, (byte*) BINLOG_MAGIC, 4) ||
- open_index(O_APPEND | O_RDWR | O_CREAT))
+ if (my_b_write(&log_file, (byte*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE) ||
+ open_index(O_APPEND | O_RDWR | O_CREAT))
goto err;
- bytes_written += 4;
+ bytes_written += BIN_LOG_HEADER_SIZE;
}
if (need_start_event && !no_auto_events)
@@ -262,7 +265,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
goto err;
}
}
- return;
+ DBUG_VOID_RETURN;
err:
sql_print_error("Could not use %s for logging (error %d)", log_name,errno);
@@ -271,7 +274,7 @@ err:
end_io_cache(&log_file);
x_free(name); name=0;
log_type=LOG_CLOSED;
- return;
+ DBUG_VOID_RETURN;
}
int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
@@ -284,6 +287,7 @@ int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
}
// if log_name is "" we stop at the first entry
+
int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
bool need_mutex)
{
@@ -294,8 +298,10 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
uint log_name_len = (uint) strlen(log_name);
IO_CACHE io_cache;
- // mutex needed because we need to make sure the file pointer does not move
- // from under our feet
+ /*
+ Mutex needed because we need to make sure the file pointer does not move
+ from under our feet
+ */
if (need_mutex)
pthread_mutex_lock(&LOCK_index);
if (init_io_cache(&io_cache, index_file, IO_SIZE, READ_CACHE, (my_off_t) 0,
@@ -304,7 +310,7 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
error = LOG_INFO_SEEK;
goto err;
}
- for(;;)
+ for (;;)
{
uint length;
if (!(length=my_b_gets(&io_cache, fname, FN_REFLEN-1)))
@@ -336,9 +342,12 @@ err:
int MYSQL_LOG::find_next_log(LOG_INFO* linfo, bool need_lock)
{
- // mutex needed because we need to make sure the file pointer does not move
- // from under our feet
- if (index_file < 0) return LOG_INFO_INVALID;
+ /*
+ Mutex needed because we need to make sure the file pointer does not move
+ from under our feet
+ */
+ if (index_file < 0)
+ return LOG_INFO_INVALID;
int error = 0;
char* fname = linfo->log_file_name;
IO_CACHE io_cache;
@@ -382,7 +391,7 @@ int MYSQL_LOG::reset_logs(THD* thd)
goto err;
}
- for(;;)
+ for (;;)
{
my_delete(linfo.log_file_name, MYF(MY_WME));
if (find_next_log(&linfo))
@@ -490,7 +499,7 @@ err:
rli->linfo.log_file_name);
goto err2;
}
- rli->relay_log_pos = 4;
+ rli->relay_log_pos = BIN_LOG_HEADER_SIZE;
strnmov(rli->relay_log_name,rli->linfo.log_file_name,
sizeof(rli->relay_log_name));
flush_relay_log_info(rli);
@@ -550,7 +559,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
my_off_t init_purge_offset= my_b_tell(&io_cache);
if (!(fname_len=my_b_gets(&io_cache, fname, FN_REFLEN)))
{
- if(!io_cache.error)
+ if (!io_cache.error)
break;
error = LOG_INFO_IO;
goto err;
@@ -993,8 +1002,13 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
if (is_open())
{
+ /*
+ We come here when the queries to be logged could not fit into memory
+ and part of the queries are stored in a log file on disk.
+ */
+
uint length;
- //QQ: this looks like a bug - why READ_CACHE?
+ /* Read from the file used to cache the queries .*/
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
{
sql_print_error(ER(ER_ERROR_ON_WRITE), cache->file_name, errno);
@@ -1003,6 +1017,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
length=my_b_bytes_in_cache(cache);
do
{
+ /* Write data to the binary log file */
if (my_b_write(&log_file, cache->read_pos, length))
{
if (!write_error)
@@ -1168,19 +1183,23 @@ void MYSQL_LOG:: wait_for_update(THD* thd)
const char* old_msg = thd->enter_cond(&update_cond, &LOCK_log,
"Slave: waiting for binlog update");
pthread_cond_wait(&update_cond, &LOCK_log);
- // this is not a bug - we unlock the mutex for the caller, and expect him
- // to lock it and then not unlock it upon return. This is a rather odd
- // way of doing things, but this is the cleanest way I could think of to
- // solve the race deadlock caused by THD::awake() first acquiring mysys_var
- // mutex and then the current mutex, while wait_for_update being called with
- // the current mutex already aquired and THD::exit_cond() trying to acquire
- // mysys_var mutex. We do need the mutex to be acquired prior to the
- // invocation of wait_for_update in all cases, so mutex acquisition inside
- // wait_for_update() is not an option
+ /*
+ This is not a bug:
+ We unlock the mutex for the caller, and expect him to lock it and
+ then not unlock it upon return. This is a rather odd way of doing
+ things, but this is the cleanest way I could think of to solve the
+ race deadlock caused by THD::awake() first acquiring mysys_var
+ mutex and then the current mutex, while wait_for_update being
+ called with the current mutex already aquired and THD::exit_cond()
+ trying to acquire mysys_var mutex. We do need the mutex to be
+ acquired prior to the invocation of wait_for_update in all cases,
+ so mutex acquisition inside wait_for_update() is not an option.
+ */
pthread_mutex_unlock(&LOCK_log);
thd->exit_cond(old_msg);
}
+
void MYSQL_LOG::close(bool exiting)
{ // One can't set log_type here!
if (is_open())
diff --git a/sql/log_event.cc b/sql/log_event.cc
index fd04f8dbbaa..9315baa0de5 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -159,11 +159,11 @@ static void cleanup_load_tmpdir()
if (!(dirp=my_dir(slave_load_tmpdir,MYF(MY_WME))))
return;
- for (i=0;i<(uint)dirp->number_off_files;i++)
+ for (i=0 ; i < (uint)dirp->number_off_files; i++)
{
file=dirp->dir_entry+i;
- if (!memcmp(file->name,"SQL_LOAD-",9))
- my_delete(file->name,MYF(MY_WME));
+ if (is_prefix(file->name,"SQL_LOAD-"))
+ my_delete(file->name,MYF(0));
}
my_dirend(dirp);
@@ -246,7 +246,7 @@ void Load_log_event::pack_info(String* packet)
char buf[256];
String tmp(buf, sizeof(buf));
tmp.length(0);
- if(db && db_len)
+ if (db && db_len)
{
tmp.append("use ");
tmp.append(db, db_len);
@@ -256,9 +256,9 @@ void Load_log_event::pack_info(String* packet)
tmp.append("LOAD DATA INFILE '");
tmp.append(fname, fname_len);
tmp.append("' ", 2);
- if(sql_ex.opt_flags && REPLACE_FLAG )
+ if (sql_ex.opt_flags && REPLACE_FLAG )
tmp.append(" REPLACE ");
- else if(sql_ex.opt_flags && IGNORE_FLAG )
+ else if (sql_ex.opt_flags && IGNORE_FLAG )
tmp.append(" IGNORE ");
tmp.append("INTO TABLE ");
@@ -305,7 +305,7 @@ void Load_log_event::pack_info(String* packet)
tmp.append(" (");
for(i = 0; i < num_fields; i++)
{
- if(i)
+ if (i)
tmp.append(" ,");
tmp.append( field);
@@ -326,7 +326,7 @@ void Rotate_log_event::pack_info(String* packet)
tmp.append(new_log_ident, ident_len);
tmp.append(";pos=");
tmp.append(llstr(pos,buf));
- if(flags & LOG_EVENT_FORCED_ROTATE_F)
+ if (flags & LOG_EVENT_FORCED_ROTATE_F)
tmp.append("; forced by master");
net_store_data(packet, tmp.ptr(), tmp.length());
}
@@ -436,7 +436,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
// if the read hits eof, we must report it as eof
// so the caller will know it can go into cond_wait to be woken up
// on the next update to the log
- if(!file->error) return LOG_READ_EOF;
+ if (!file->error) return LOG_READ_EOF;
return file->error > 0 ? LOG_READ_TRUNC: LOG_READ_IO;
}
data_len = uint4korr(buf + EVENT_LEN_OFFSET);
@@ -452,7 +452,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
{
if (packet->append(file, data_len))
{
- if(log_lock)
+ if (log_lock)
pthread_mutex_unlock(log_lock);
// here we should never hit eof in a non-error condtion
// eof means we are reading the event partially, which should
@@ -467,13 +467,13 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
#endif // MYSQL_CLIENT
#ifndef MYSQL_CLIENT
-#define UNLOCK_MUTEX if(log_lock) pthread_mutex_unlock(log_lock);
+#define UNLOCK_MUTEX if (log_lock) pthread_mutex_unlock(log_lock);
#else
#define UNLOCK_MUTEX
#endif
#ifndef MYSQL_CLIENT
-#define LOCK_MUTEX if(log_lock) pthread_mutex_lock(log_lock);
+#define LOCK_MUTEX if (log_lock) pthread_mutex_lock(log_lock);
#else
#define LOCK_MUTEX
#endif
@@ -672,7 +672,7 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db)
if (new_log_ident)
my_fwrite(file, (byte*) new_log_ident, (uint)ident_len,
MYF(MY_NABP | MY_WME));
- fprintf(file, "pos=%s\n", llstr(pos, buf));
+ fprintf(file, " pos: %s\n", llstr(pos, buf));
fflush(file);
}
@@ -701,11 +701,10 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
bool old_format):
Log_event(buf, old_format),new_log_ident(NULL),alloced(0)
{
- // the caller will ensure that event_len is what we have at
- // EVENT_LEN_OFFSET
+ // The caller will ensure that event_len is what we have at EVENT_LEN_OFFSET
int header_size = (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
uint ident_offset;
- if(event_len < header_size)
+ if (event_len < header_size)
return;
buf += header_size;
if (old_format)
@@ -753,8 +752,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
#endif
Query_log_event::Query_log_event(const char* buf, int event_len,
- bool old_format):
- Log_event(buf, old_format),data_buf(0), query(NULL), db(NULL)
+ bool old_format)
+ :Log_event(buf, old_format),data_buf(0), query(NULL), db(NULL)
{
ulong data_len;
if (old_format)
@@ -801,9 +800,9 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
bool same_db = 0;
- if(db && last_db)
+ if (db && last_db)
{
- if(!(same_db = !memcmp(last_db, db, db_len + 1)))
+ if (!(same_db = !memcmp(last_db, db, db_len + 1)))
memcpy(last_db, db, db_len + 1);
}
@@ -864,7 +863,7 @@ int Intvar_log_event::write_data(IO_CACHE* file)
void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
{
char llbuff[22];
- if(!short_form)
+ if (!short_form)
{
print_header(file);
fprintf(file, "\tIntvar\n");
@@ -961,11 +960,12 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
if (use_new_format)
{
empty_flags=0;
- /* the code below assumes that buf will not disappear from
- under our feet during the lifetime of the event. This assumption
- holds true in the slave thread if the log is in new format, but is not
- the case when we have old format because we will be reusing net buffer
- to read the actual file before we write out the Create_file event
+ /*
+ The code below assumes that buf will not disappear from
+ under our feet during the lifetime of the event. This assumption
+ holds true in the slave thread if the log is in new format, but is not
+ the case when we have old format because we will be reusing net buffer
+ to read the actual file before we write out the Create_file event.
*/
if (read_str(buf, buf_end, field_term, field_term_len) ||
read_str(buf, buf_end, enclosed, enclosed_len) ||
@@ -1003,77 +1003,75 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
#ifndef MYSQL_CLIENT
Load_log_event::Load_log_event(THD* thd, sql_exchange* ex,
const char* db_arg, const char* table_name_arg,
- List<Item>& fields_arg, enum enum_duplicates handle_dup):
- Log_event(thd),thread_id(thd->thread_id),
- num_fields(0),fields(0),field_lens(0),field_block_len(0),
- table_name(table_name_arg),
- db(db_arg),
- fname(ex->file_name)
- {
- time_t end_time;
- time(&end_time);
- exec_time = (ulong) (end_time - thd->start_time);
- db_len = (db) ? (uint32) strlen(db) : 0;
- table_name_len = (table_name) ? (uint32) strlen(table_name) : 0;
- fname_len = (fname) ? (uint) strlen(fname) : 0;
- sql_ex.field_term = (char*) ex->field_term->ptr();
- sql_ex.field_term_len = (uint8) ex->field_term->length();
- sql_ex.enclosed = (char*) ex->enclosed->ptr();
- sql_ex.enclosed_len = (uint8) ex->enclosed->length();
- sql_ex.line_term = (char*) ex->line_term->ptr();
- sql_ex.line_term_len = (uint8) ex->line_term->length();
- sql_ex.line_start = (char*) ex->line_start->ptr();
- sql_ex.line_start_len = (uint8) ex->line_start->length();
- sql_ex.escaped = (char*) ex->escaped->ptr();
- sql_ex.escaped_len = (uint8) ex->escaped->length();
- sql_ex.opt_flags = 0;
- sql_ex.cached_new_format = -1;
+ List<Item>& fields_arg, enum enum_duplicates handle_dup)
+ :Log_event(thd),thread_id(thd->thread_id), num_fields(0),fields(0),
+ field_lens(0),field_block_len(0), table_name(table_name_arg),
+ db(db_arg), fname(ex->file_name)
+{
+ time_t end_time;
+ time(&end_time);
+ exec_time = (ulong) (end_time - thd->start_time);
+ db_len = (db) ? (uint32) strlen(db) : 0;
+ table_name_len = (table_name) ? (uint32) strlen(table_name) : 0;
+ fname_len = (fname) ? (uint) strlen(fname) : 0;
+ sql_ex.field_term = (char*) ex->field_term->ptr();
+ sql_ex.field_term_len = (uint8) ex->field_term->length();
+ sql_ex.enclosed = (char*) ex->enclosed->ptr();
+ sql_ex.enclosed_len = (uint8) ex->enclosed->length();
+ sql_ex.line_term = (char*) ex->line_term->ptr();
+ sql_ex.line_term_len = (uint8) ex->line_term->length();
+ sql_ex.line_start = (char*) ex->line_start->ptr();
+ sql_ex.line_start_len = (uint8) ex->line_start->length();
+ sql_ex.escaped = (char*) ex->escaped->ptr();
+ sql_ex.escaped_len = (uint8) ex->escaped->length();
+ sql_ex.opt_flags = 0;
+ sql_ex.cached_new_format = -1;
- if(ex->dumpfile)
- sql_ex.opt_flags |= DUMPFILE_FLAG;
- if(ex->opt_enclosed)
- sql_ex.opt_flags |= OPT_ENCLOSED_FLAG;
+ if (ex->dumpfile)
+ sql_ex.opt_flags |= DUMPFILE_FLAG;
+ if (ex->opt_enclosed)
+ sql_ex.opt_flags |= OPT_ENCLOSED_FLAG;
- sql_ex.empty_flags = 0;
+ sql_ex.empty_flags = 0;
- switch(handle_dup)
- {
- case DUP_IGNORE: sql_ex.opt_flags |= IGNORE_FLAG; break;
- case DUP_REPLACE: sql_ex.opt_flags |= REPLACE_FLAG; break;
- case DUP_ERROR: break;
- }
+ switch(handle_dup)
+ {
+ case DUP_IGNORE: sql_ex.opt_flags |= IGNORE_FLAG; break;
+ case DUP_REPLACE: sql_ex.opt_flags |= REPLACE_FLAG; break;
+ case DUP_ERROR: break;
+ }
- if(!ex->field_term->length())
- sql_ex.empty_flags |= FIELD_TERM_EMPTY;
- if(!ex->enclosed->length())
- sql_ex.empty_flags |= ENCLOSED_EMPTY;
- if(!ex->line_term->length())
- sql_ex.empty_flags |= LINE_TERM_EMPTY;
- if(!ex->line_start->length())
- sql_ex.empty_flags |= LINE_START_EMPTY;
- if(!ex->escaped->length())
- sql_ex.empty_flags |= ESCAPED_EMPTY;
+ if (!ex->field_term->length())
+ sql_ex.empty_flags |= FIELD_TERM_EMPTY;
+ if (!ex->enclosed->length())
+ sql_ex.empty_flags |= ENCLOSED_EMPTY;
+ if (!ex->line_term->length())
+ sql_ex.empty_flags |= LINE_TERM_EMPTY;
+ if (!ex->line_start->length())
+ sql_ex.empty_flags |= LINE_START_EMPTY;
+ if (!ex->escaped->length())
+ sql_ex.empty_flags |= ESCAPED_EMPTY;
- skip_lines = ex->skip_lines;
-
- List_iterator<Item> li(fields_arg);
- field_lens_buf.length(0);
- fields_buf.length(0);
- Item* item;
- while((item = li++))
- {
- num_fields++;
- uchar len = (uchar) strlen(item->name);
- field_block_len += len + 1;
- fields_buf.append(item->name, len + 1);
- field_lens_buf.append((char*)&len, 1);
- }
+ skip_lines = ex->skip_lines;
- field_lens = (const uchar*)field_lens_buf.ptr();
- fields = fields_buf.ptr();
+ List_iterator<Item> li(fields_arg);
+ field_lens_buf.length(0);
+ fields_buf.length(0);
+ Item* item;
+ while ((item = li++))
+ {
+ num_fields++;
+ uchar len = (uchar) strlen(item->name);
+ field_block_len += len + 1;
+ fields_buf.append(item->name, len + 1);
+ field_lens_buf.append((char*)&len, 1);
}
+ field_lens = (const uchar*)field_lens_buf.ptr();
+ fields = fields_buf.ptr();
+}
+
#endif
// the caller must do buf[event_len] = 0 before he starts using the
@@ -1145,32 +1143,32 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
bool same_db = 0;
- if(db && last_db)
- {
- if(!(same_db = !memcmp(last_db, db, db_len + 1)))
- memcpy(last_db, db, db_len + 1);
- }
+ if (db && last_db)
+ {
+ if (!(same_db = !memcmp(last_db, db, db_len + 1)))
+ memcpy(last_db, db, db_len + 1);
+ }
- if(db && db[0] && !same_db)
+ if (db && db[0] && !same_db)
fprintf(file, "use %s;\n", db);
fprintf(file, "LOAD DATA INFILE '%-*s' ", fname_len, fname);
- if(sql_ex.opt_flags && REPLACE_FLAG )
+ if (sql_ex.opt_flags && REPLACE_FLAG )
fprintf(file," REPLACE ");
- else if(sql_ex.opt_flags && IGNORE_FLAG )
+ else if (sql_ex.opt_flags && IGNORE_FLAG )
fprintf(file," IGNORE ");
fprintf(file, "INTO TABLE %s ", table_name);
- if(sql_ex.field_term)
+ if (sql_ex.field_term)
{
fprintf(file, " FIELDS TERMINATED BY ");
pretty_print_str(file, sql_ex.field_term, sql_ex.field_term_len);
}
- if(sql_ex.enclosed)
+ if (sql_ex.enclosed)
{
- if(sql_ex.opt_flags && OPT_ENCLOSED_FLAG )
+ if (sql_ex.opt_flags && OPT_ENCLOSED_FLAG )
fprintf(file," OPTIONALLY ");
fprintf(file, " ENCLOSED BY ");
pretty_print_str(file, sql_ex.enclosed, sql_ex.enclosed_len);
@@ -1194,7 +1192,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
pretty_print_str(file, sql_ex.line_start, sql_ex.line_start_len);
}
- if((int)skip_lines > 0)
+ if ((int)skip_lines > 0)
fprintf(file, " IGNORE %ld LINES ", (long) skip_lines);
if (num_fields)
@@ -1204,7 +1202,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
fprintf( file, " (");
for(i = 0; i < num_fields; i++)
{
- if(i)
+ if (i)
fputc(',', file);
fprintf(file, field);
@@ -1282,7 +1280,7 @@ Slave_log_event::~Slave_log_event()
void Slave_log_event::print(FILE* file, bool short_form, char* last_db)
{
char llbuff[22];
- if(short_form)
+ if (short_form)
return;
print_header(file);
fputc('\n', file);
@@ -1314,7 +1312,7 @@ void Slave_log_event::init_from_mem_pool(int data_size)
master_host_len = strlen(master_host);
// safety
master_log = master_host + master_host_len + 1;
- if(master_log > mem_pool + data_size)
+ if (master_log > mem_pool + data_size)
{
master_host = 0;
return;
@@ -1326,9 +1324,9 @@ Slave_log_event::Slave_log_event(const char* buf, int event_len):
Log_event(buf,0),mem_pool(0),master_host(0)
{
event_len -= LOG_EVENT_HEADER_LEN;
- if(event_len < 0)
+ if (event_len < 0)
return;
- if(!(mem_pool = (char*)my_malloc(event_len + 1, MYF(MY_WME))))
+ if (!(mem_pool = (char*)my_malloc(event_len + 1, MYF(MY_WME))))
return;
memcpy(mem_pool, buf + LOG_EVENT_HEADER_LEN, event_len);
mem_pool[event_len] = 0;
@@ -1341,7 +1339,7 @@ Create_file_log_event::Create_file_log_event(THD* thd_arg, sql_exchange* ex,
List<Item>& fields_arg, enum enum_duplicates handle_dup,
char* block_arg, uint block_len_arg):
Load_log_event(thd_arg,ex,db_arg,table_name_arg,fields_arg,handle_dup),
- fake_base(0),block(block_arg),block_len(block_len_arg),
+ fake_base(0),block(block_arg),block_len(block_len_arg),
file_id(thd_arg->file_id = mysql_bin_log.next_file_id())
{
sql_ex.force_new_format();
@@ -1409,7 +1407,7 @@ void Create_file_log_event::print(FILE* file, bool short_form,
if (short_form)
return;
Load_log_event::print(file, 1, last_db);
- fprintf(file, " file_id=%d, block_len=%d\n", file_id, block_len);
+ fprintf(file, " file_id: %d block_len: %d\n", file_id, block_len);
}
#endif
@@ -1444,7 +1442,7 @@ Append_block_log_event::Append_block_log_event(THD* thd_arg, char* block_arg,
Append_block_log_event::Append_block_log_event(const char* buf, int len):
Log_event(buf, 0),block(0)
{
- if((uint)len < APPEND_BLOCK_EVENT_OVERHEAD)
+ if ((uint)len < APPEND_BLOCK_EVENT_OVERHEAD)
return;
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN + AB_FILE_ID_OFFSET);
block = (char*)buf + APPEND_BLOCK_EVENT_OVERHEAD;
@@ -1467,7 +1465,7 @@ void Append_block_log_event::print(FILE* file, bool short_form,
return;
print_header(file);
fputc('\n', file);
- fprintf(file, "#Append_block: file_id=%d, block_len=%d\n",
+ fprintf(file, "#Append_block: file_id: %d block_len: %d\n",
file_id, block_len);
}
#endif
@@ -1496,7 +1494,7 @@ Delete_file_log_event::Delete_file_log_event(THD* thd_arg):
Delete_file_log_event::Delete_file_log_event(const char* buf, int len):
Log_event(buf, 0),file_id(0)
{
- if((uint)len < DELETE_FILE_EVENT_OVERHEAD)
+ if ((uint)len < DELETE_FILE_EVENT_OVERHEAD)
return;
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN + AB_FILE_ID_OFFSET);
}
@@ -1543,7 +1541,7 @@ Execute_load_log_event::Execute_load_log_event(THD* thd_arg):
Execute_load_log_event::Execute_load_log_event(const char* buf,int len):
Log_event(buf, 0),file_id(0)
{
- if((uint)len < EXEC_LOAD_EVENT_OVERHEAD)
+ if ((uint)len < EXEC_LOAD_EVENT_OVERHEAD)
return;
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN + EL_FILE_ID_OFFSET);
}
@@ -1662,7 +1660,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
thd->query = 0;
thd->query_error = 0;
- if(db_ok(thd->db, replicate_do_db, replicate_ignore_db))
+ if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
thd->set_time((time_t)when);
thd->current_tablenr = 0;
@@ -1676,7 +1674,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
tables.name = tables.real_name = (char*)table_name;
tables.lock_type = TL_WRITE;
// the table will be opened in mysql_load
- if(table_rules_on && !tables_ok(thd, &tables))
+ if (table_rules_on && !tables_ok(thd, &tables))
{
// TODO: this is a bug - this needs to be moved to the I/O thread
if (net)
@@ -1712,14 +1710,14 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
// about the packet sequence
thd->net.pkt_nr = net->pkt_nr;
}
- if(mysql_load(thd, &ex, &tables, fields, handle_dup, net != 0,
+ if (mysql_load(thd, &ex, &tables, fields, handle_dup, net != 0,
TL_WRITE))
thd->query_error = 1;
- if(thd->cuted_fields)
+ if (thd->cuted_fields)
sql_print_error("Slave: load data infile at position %s in log \
'%s' produced %d warning(s)", llstr(rli->master_log_pos,llbuff), RPL_LOG_NAME,
thd->cuted_fields );
- if(net)
+ if (net)
net->pkt_nr = thd->net.pkt_nr;
}
}
@@ -1735,7 +1733,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
thd->net.vio = 0;
thd->db = 0;// prevent db from being freed
close_thread_tables(thd);
- if(thd->query_error)
+ if (thd->query_error)
{
int sql_error = thd->net.last_errno;
if (!sql_error)
@@ -1749,7 +1747,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
}
free_root(&thd->mem_root,0);
- if(thd->fatal_error)
+ if (thd->fatal_error)
{
sql_print_error("Slave: Fatal error running LOAD DATA INFILE ");
return 1;
@@ -1849,7 +1847,7 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
int Slave_log_event::exec_event(struct st_relay_log_info* rli)
{
- if(mysql_bin_log.is_open())
+ if (mysql_bin_log.is_open())
mysql_bin_log.write(this);
return Log_event::exec_event(rli);
}
@@ -1978,11 +1976,12 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
slave_print_error(rli,0, "File '%s' appears corrupted", fname);
goto err;
}
- // we want to disable binary logging in slave thread
- // because we need the file events to appear in the same order
- // as they do on the master relative to other events, so that we
- // can preserve ascending order of log sequence numbers - needed
- // to handle failover
+ /*
+ We want to disable binary logging in slave thread because we need the file
+ events to appear in the same order as they do on the master relative to
+ other events, so that we can preserve ascending order of log sequence
+ numbers - needed to handle failover .
+ */
save_options = thd->options;
thd->options &= ~ (ulong) (OPTION_BIN_LOG);
lev->thd = thd;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 2a118be100a..9111b090a99 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2407,7 +2407,7 @@ static void create_new_thread(THD *thd)
inline void kill_broken_server()
{
/* hack to get around signals ignored in syscalls for problem OS's */
- if (unix_sock == INVALID_SOCKET || ip_sock ==INVALID_SOCKET)
+ if (unix_sock == INVALID_SOCKET || (!opt_disable_networking && ip_sock ==INVALID_SOCKET))
{
select_thread_in_use = 0;
kill_server((void*)MYSQL_KILL_SIGNAL); /* never returns */
@@ -3053,7 +3053,6 @@ static struct my_option my_long_options[] =
*/
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory,
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifndef DBUG_OFF
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
"Undocumented: Meant for debugging and testing of replication",
(gptr*) &disconnect_slave_event_count,
@@ -3070,7 +3069,6 @@ static struct my_option my_long_options[] =
(gptr*) &opt_sporadic_binlog_dump_fail,
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
-#endif
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
"Simulate memory shortage when compiled with the --with-debug=full option",
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -3474,12 +3472,12 @@ static struct my_option my_long_options[] =
{"query_cache_limit", OPT_QUERY_CACHE_LIMIT,
"Don't cache results that are bigger than this.",
(gptr*) &query_cache_limit, (gptr*) &query_cache_limit, 0, GET_ULONG,
- REQUIRED_ARG, 1024*1024L, 0, ULONG_MAX, 0, 1, 0},
+ REQUIRED_ARG, 1024*1024L, 0, (longlong) ULONG_MAX, 0, 1, 0},
#endif /*HAVE_QUERY_CACHE*/
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
"The memory allocated to store results from old queries.",
(gptr*) &query_cache_size, (gptr*) &query_cache_size, 0, GET_ULONG,
- REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0},
+ REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1, 0},
#ifdef HAVE_QUERY_CACHE
{"query_cache_startup_type", OPT_QUERY_CACHE_STARTUP_TYPE,
"0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.",
@@ -3499,9 +3497,10 @@ static struct my_option my_long_options[] =
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
"Undocumented", (gptr*) &relay_log_space_limit,
(gptr*) &relay_log_space_limit, 0, GET_ULONG, REQUIRED_ARG, 0L, 0L,
- ULONG_MAX, 0, 1, 0},
+ (longlong) ULONG_MAX, 0, 1, 0},
{"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT,
- "Undocumented", (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
+ "Number of seconds to wait for more data from a master/slave connection before aborting the read.",
+ (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
@@ -4005,6 +4004,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(0);
case 'T':
test_flags= argument ? (uint) atoi(argument) : 0;
+ test_flags&= ~TEST_NO_THREADS;
opt_endinfo=1;
break;
case (int) OPT_BIG_TABLES:
@@ -4193,8 +4193,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
mysql_port=0;
break;
+#ifdef ONE_THREAD
case (int) OPT_ONE_THREAD:
test_flags |= TEST_NO_THREADS;
+#endif
break;
case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL;
@@ -4421,11 +4423,7 @@ static void get_options(int argc,char **argv)
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
fix_paths();
default_table_type_name=ha_table_typelib.type_names[default_table_type-1];
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 257418d1682..c7ca906ca13 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -608,6 +608,9 @@ int show_slave_hosts(THD* thd)
int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
{
+ if (!mi->host || !*mi->host) /* empty host */
+ return 1;
+
if (!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
mi->port, 0, 0))
{
@@ -667,8 +670,10 @@ int load_master_data(THD* thd)
int restart_thread_mask;
mc_mysql_init(&mysql);
- // we do not want anyone messing with the slave at all for the entire
- // duration of the data load;
+ /*
+ We do not want anyone messing with the slave at all for the entire
+ duration of the data load.
+ */
LOCK_ACTIVE_MI;
lock_slave_threads(active_mi);
init_thread_mask(&restart_thread_mask,active_mi,0 /*not inverse*/);
@@ -704,8 +709,10 @@ int load_master_data(THD* thd)
if (!(num_dbs = (uint) mc_mysql_num_rows(db_res)))
goto err;
- // in theory, the master could have no databases at all
- // and run with skip-grant
+ /*
+ In theory, the master could have no databases at all
+ and run with skip-grant
+ */
if (!(table_res = (MYSQL_RES**)thd->alloc(num_dbs * sizeof(MYSQL_RES*))))
{
@@ -713,10 +720,12 @@ int load_master_data(THD* thd)
goto err;
}
- // this is a temporary solution until we have online backup
- // capabilities - to be replaced once online backup is working
- // we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
- // can to minimize the lock time
+ /*
+ This is a temporary solution until we have online backup
+ capabilities - to be replaced once online backup is working
+ we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
+ can to minimize the lock time.
+ */
if (mc_mysql_query(&mysql, "FLUSH TABLES WITH READ LOCK", 0) ||
mc_mysql_query(&mysql, "SHOW MASTER STATUS",0) ||
!(master_status_res = mc_mysql_store_result(&mysql)))
@@ -726,8 +735,10 @@ int load_master_data(THD* thd)
goto err;
}
- // go through every table in every database, and if the replication
- // rules allow replicating it, get it
+ /*
+ Go through every table in every database, and if the replication
+ rules allow replicating it, get it
+ */
table_res_end = table_res + num_dbs;
@@ -816,7 +827,7 @@ int load_master_data(THD* thd)
}
}
thd->proc_info="purging old relay logs";
- if (purge_relay_logs(&active_mi->rli,0 /* not only reset, but also reinit*/,
+ if (purge_relay_logs(&active_mi->rli,0 /* not only reset, but also reinit */,
&errmsg))
{
send_error(&thd->net, 0, "Failed purging old relay logs");
diff --git a/sql/slave.cc b/sql/slave.cc
index b473d8ab1e3..66837436a09 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -42,18 +42,20 @@ bool do_table_inited = 0, ignore_table_inited = 0;
bool wild_do_table_inited = 0, wild_ignore_table_inited = 0;
bool table_rules_on = 0;
static TABLE* save_temporary_tables = 0;
-ulong relay_log_space_limit = 0; /* TODO: fix variables to access ulonglong
- values and make it ulonglong */
-// when slave thread exits, we need to remember the temporary tables so we
-// can re-use them on slave start
+/* TODO: fix variables to access ulonglong values and make it ulonglong */
+ulong relay_log_space_limit = 0;
+
+/*
+ When slave thread exits, we need to remember the temporary tables so we
+ can re-use them on slave start.
+
+ TODO: move the vars below under MASTER_INFO
+*/
-// TODO: move the vars below under MASTER_INFO
-#ifndef DBUG_OFF
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
static int events_till_disconnect = -1;
int events_till_abort = -1;
static int stuck_count = 0;
-#endif
typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE;
@@ -85,9 +87,10 @@ void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse)
bool set_io = mi->slave_running, set_sql = mi->rli.slave_running;
if (inverse)
{
- /* This makes me think of the Russian idiom "I am not I, and this is
- not my horse", which is used to deny reponsibility for
- one's actions.
+ /*
+ This makes me think of the Russian idiom "I am not I, and this is
+ not my horse", which is used to deny reponsibility for
+ one's actions.
*/
set_io = !set_io;
set_sql = !set_sql;
@@ -166,13 +169,16 @@ static byte* get_table_key(TABLE_RULE_ENT* e, uint* len,
}
// TODO: check proper initialization of master_log_name/master_log_pos
+
int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
ulonglong pos, bool need_data_lock,
const char** errmsg)
{
+ DBUG_ENTER("init_relay_log_pos");
+
*errmsg=0;
if (rli->log_pos_current)
- return 0;
+ DBUG_RETURN(0);
pthread_mutex_t *log_lock=rli->relay_log.get_log_lock();
pthread_mutex_lock(log_lock);
if (need_data_lock)
@@ -192,8 +198,10 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
else
rli->relay_log_pos = pos;
- // test to see if the previous run was with the skip of purging
- // if yes, we do not purge when we restart
+ /*
+ Test to see if the previous run was with the skip of purging
+ If yes, we do not purge when we restart
+ */
if (rli->relay_log.find_first_log(&rli->linfo,""))
{
*errmsg="Could not find first log during relay log initialization";
@@ -215,34 +223,31 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
if (rli->relay_log.is_active(rli->linfo.log_file_name))
{
if (my_b_tell((rli->cur_log=rli->relay_log.get_log_file())) == 0 &&
- check_binlog_magic(rli->cur_log,errmsg))
- {
+ check_binlog_magic(rli->cur_log,errmsg))
goto err;
- }
- rli->cur_log_init_count=rli->cur_log->init_count;
+ rli->cur_log_old_open_count=rli->relay_log.get_open_count();
}
else
{
if (rli->inited)
end_io_cache(&rli->cache_buf);
- if (rli->cur_log_fd>=0)
+ if (rli->cur_log_fd >= 0)
my_close(rli->cur_log_fd,MYF(MY_WME));
if ((rli->cur_log_fd=open_binlog(&rli->cache_buf,
rli->linfo.log_file_name,errmsg)) < 0)
- {
goto err;
- }
rli->cur_log = &rli->cache_buf;
}
- if (pos > 4)
- my_b_seek(rli->cur_log,(off_t)pos);
- rli->log_pos_current=1;
+ if (pos > BIN_LOG_HEADER_SIZE)
+ my_b_seek(rli->cur_log,(off_t)pos);
+ rli->log_pos_current=1;
+
err:
- pthread_cond_broadcast(&rli->data_cond);
- if (need_data_lock)
- pthread_mutex_unlock(&rli->data_lock);
- pthread_mutex_unlock(log_lock);
- return (*errmsg) ? 1 : 0;
+ pthread_cond_broadcast(&rli->data_cond);
+ if (need_data_lock)
+ pthread_mutex_unlock(&rli->data_lock);
+ pthread_mutex_unlock(log_lock);
+ DBUG_RETURN ((*errmsg) ? 1 : 0);
}
/* called from get_options() in mysqld.cc on start-up */
@@ -276,8 +281,9 @@ void init_slave_skip_errors(const char* arg)
}
}
+
/*
- We assume we have a run lock on rli and that the both slave thread
+ We assume we have a run lock on rli and that both slave thread
are not running
*/
@@ -286,9 +292,11 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, bool just_reset, const char** errmsg)
DBUG_ENTER("purge_relay_logs");
if (!rli->inited)
DBUG_RETURN(0); /* successfully do nothing */
+ int error=0;
+
DBUG_ASSERT(rli->slave_running == 0);
DBUG_ASSERT(rli->mi->slave_running == 0);
- int error=0;
+
rli->slave_skip_counter=0;
pthread_mutex_lock(&rli->data_lock);
rli->pending=0;
@@ -303,17 +311,19 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, bool just_reset, const char** errmsg)
}
strnmov(rli->relay_log_name,rli->linfo.log_file_name,
sizeof(rli->relay_log_name)-1);
- rli->log_space_total=4; //just first log with magic number and nothing else
- rli->relay_log_pos=4;
+ // Just first log with magic number and nothing else
+ rli->log_space_total= BIN_LOG_HEADER_SIZE;
+ rli->relay_log_pos= BIN_LOG_HEADER_SIZE;
rli->relay_log.reset_bytes_written();
rli->log_pos_current=0;
if (!just_reset)
- error = init_relay_log_pos(rli,0,0,0/*do not need data lock*/,errmsg);
+ error = init_relay_log_pos(rli,0,0,0 /* do not need data lock */,errmsg);
+
err:
#ifndef DBUG_OFF
char buf[22];
#endif
- DBUG_PRINT("info",("log_space_total=%s",llstr(rli->log_space_total,buf)));
+ DBUG_PRINT("info",("log_space_total: %s",llstr(rli->log_space_total,buf)));
pthread_mutex_unlock(&rli->data_lock);
DBUG_RETURN(error);
}
@@ -453,10 +463,12 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock,
"Waiting for slave thread to start");
pthread_cond_wait(start_cond,cond_lock);
thd->exit_cond(old_msg);
- // TODO: in a very rare case of init_slave_thread failing, it is
- // possible that we can get stuck here since slave_running will not
- // be set. We need to change slave_running to int and have -1 as
- // error code
+ /*
+ TODO: in a very rare case of init_slave_thread failing, it is
+ possible that we can get stuck here since slave_running will not
+ be set. We need to change slave_running to int and have -1 as
+ error code.
+ */
if (thd->killed)
{
pthread_mutex_unlock(cond_lock);
@@ -468,10 +480,14 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock,
pthread_mutex_unlock(start_lock);
return 0;
}
-/* SLAVE_FORCE_ALL is not implemented here on purpose since it does not make
- sense to do that for starting a slave - we always care if it actually
- started the threads that were not previously running
+
+
+/*
+ SLAVE_FORCE_ALL is not implemented here on purpose since it does not make
+ sense to do that for starting a slave - we always care if it actually
+ started the threads that were not previously running
*/
+
int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
MASTER_INFO* mi, const char* master_info_fname,
const char* slave_info_fname, int thread_mask)
@@ -569,9 +585,10 @@ int tables_ok(THD* thd, TABLE_LIST* tables)
return 0;
}
- // if no explicit rule found
- // and there was a do list, do not replicate. If there was
- // no do list, go ahead
+ /*
+ If no explicit rule found and there was a do list, do not replicate.
+ If there was no do list, go ahead
+ */
return !do_table_inited && !wild_do_table_inited;
}
@@ -579,12 +596,12 @@ int tables_ok(THD* thd, TABLE_LIST* tables)
int add_table_rule(HASH* h, const char* table_spec)
{
const char* dot = strchr(table_spec, '.');
- if(!dot) return 1;
+ if (!dot) return 1;
// len is always > 0 because we know the there exists a '.'
uint len = (uint)strlen(table_spec);
TABLE_RULE_ENT* e = (TABLE_RULE_ENT*)my_malloc(sizeof(TABLE_RULE_ENT)
+ len, MYF(MY_WME));
- if(!e) return 1;
+ if (!e) return 1;
e->db = (char*)e + sizeof(TABLE_RULE_ENT);
e->tbl_name = e->db + (dot - table_spec) + 1;
e->key_len = len;
@@ -596,11 +613,11 @@ int add_table_rule(HASH* h, const char* table_spec)
int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec)
{
const char* dot = strchr(table_spec, '.');
- if(!dot) return 1;
+ if (!dot) return 1;
uint len = (uint)strlen(table_spec);
TABLE_RULE_ENT* e = (TABLE_RULE_ENT*)my_malloc(sizeof(TABLE_RULE_ENT)
+ len, MYF(MY_WME));
- if(!e) return 1;
+ if (!e) return 1;
e->db = (char*)e + sizeof(TABLE_RULE_ENT);
e->tbl_name = e->db + (dot - table_spec) + 1;
e->key_len = len;
@@ -629,9 +646,11 @@ static int end_slave_on_walk(MASTER_INFO* mi, gptr /*unused*/)
void end_slave()
{
- // TODO: replace the line below with
- // list_walk(&master_list, (list_walk_action)end_slave_on_walk,0);
- // once multi-master code is ready
+ /*
+ TODO: replace the line below with
+ list_walk(&master_list, (list_walk_action)end_slave_on_walk,0);
+ once multi-master code is ready.
+ */
terminate_slave_threads(active_mi,SLAVE_FORCE_ALL);
end_master_info(active_mi);
if (do_table_inited)
@@ -673,65 +692,68 @@ void skip_load_data_infile(NET* net)
{
(void)my_net_write(net, "\xfb/dev/null", 10);
(void)net_flush(net);
- (void)my_net_read(net); // discard response
- send_ok(net); // the master expects it
+ (void)my_net_read(net); // discard response
+ send_ok(net); // the master expects it
}
char* rewrite_db(char* db)
{
- if(replicate_rewrite_db.is_empty() || !db) return db;
+ if (replicate_rewrite_db.is_empty() || !db)
+ return db;
I_List_iterator<i_string_pair> it(replicate_rewrite_db);
i_string_pair* tmp;
- while((tmp=it++))
- {
- if(!strcmp(tmp->key, db))
- return tmp->val;
- }
-
+ while ((tmp=it++))
+ {
+ if (!strcmp(tmp->key, db))
+ return tmp->val;
+ }
return db;
}
+
int db_ok(const char* db, I_List<i_string> &do_list,
I_List<i_string> &ignore_list )
{
if (do_list.is_empty() && ignore_list.is_empty())
return 1; // ok to replicate if the user puts no constraints
- // if the user has specified restrictions on which databases to replicate
- // and db was not selected, do not replicate
- if(!db)
+ /*
+ If the user has specified restrictions on which databases to replicate
+ and db was not selected, do not replicate.
+ */
+ if (!db)
return 0;
- if(!do_list.is_empty()) // if the do's are not empty
- {
- I_List_iterator<i_string> it(do_list);
- i_string* tmp;
+ if (!do_list.is_empty()) // if the do's are not empty
+ {
+ I_List_iterator<i_string> it(do_list);
+ i_string* tmp;
- while((tmp=it++))
- {
- if(!strcmp(tmp->ptr, db))
- return 1; // match
- }
- return 0;
+ while ((tmp=it++))
+ {
+ if (!strcmp(tmp->ptr, db))
+ return 1; // match
}
+ return 0;
+ }
else // there are some elements in the don't, otherwise we cannot get here
- {
- I_List_iterator<i_string> it(ignore_list);
- i_string* tmp;
+ {
+ I_List_iterator<i_string> it(ignore_list);
+ i_string* tmp;
- while((tmp=it++))
- {
- if(!strcmp(tmp->ptr, db))
- return 0; // match
- }
-
- return 1;
+ while ((tmp=it++))
+ {
+ if (!strcmp(tmp->ptr, db))
+ return 0; // match
}
+
+ return 1;
+ }
}
-static int init_strvar_from_file(char* var, int max_size, IO_CACHE* f,
- char* default_val)
+static int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
+ const char *default_val)
{
uint length;
if ((length=my_b_gets(f,var, max_size)))
@@ -741,10 +763,12 @@ static int init_strvar_from_file(char* var, int max_size, IO_CACHE* f,
*last_p = 0; // if we stopped on newline, kill it
else
{
- // if we truncated a line or stopped on last char, remove all chars
- // up to and including newline
+ /*
+ If we truncated a line or stopped on last char, remove all chars
+ up to and including newline.
+ */
int c;
- while( ((c=my_b_get(f)) != '\n' && c != my_b_EOF));
+ while (((c=my_b_get(f)) != '\n' && c != my_b_EOF));
}
return 0;
}
@@ -765,7 +789,7 @@ static int init_intvar_from_file(int* var, IO_CACHE* f, int default_val)
*var = atoi(buf);
return 0;
}
- else if(default_val)
+ else if (default_val)
{
*var = default_val;
return 0;
@@ -798,12 +822,12 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi)
goto err;
}
- switch (*version)
- {
+ switch (*version) {
case '3':
mi->old_format = 1;
break;
case '4':
+ case '5':
mi->old_format = 0;
break;
default:
@@ -897,9 +921,11 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
check_opt.init();
check_opt.flags|= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK;
thd->proc_info = "Rebuilding the index on master dump table";
- // we do not want repair() to spam us with messages
- // just send them to the error log, and report the failure in case of
- // problems
+ /*
+ We do not want repair() to spam us with messages
+ just send them to the error log, and report the failure in case of
+ problems.
+ */
save_vio = thd->net.vio;
thd->net.vio = 0;
error=file->repair(thd,&check_opt) != 0;
@@ -980,15 +1006,15 @@ void end_master_info(MASTER_INFO* mi)
int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
{
DBUG_ENTER("init_relay_log_info");
- if (rli->inited)
- DBUG_RETURN(0);
MY_STAT stat_area;
char fname[FN_REFLEN+128];
int info_fd;
const char* msg = 0;
int error = 0;
- fn_format(fname, info_fname,
- mysql_data_home, "", 4+32);
+
+ if (rli->inited)
+ DBUG_RETURN(0);
+ fn_format(fname, info_fname, mysql_data_home, "", 4+32);
pthread_mutex_lock(&rli->data_lock);
info_fd = rli->info_fd;
rli->pending = 0;
@@ -1003,8 +1029,9 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
if (!opt_relay_logname)
{
char tmp[FN_REFLEN];
- /* TODO: The following should be using fn_format(); We just need to
- first change fn_format() to cut the file name if it's too long.
+ /*
+ TODO: The following should be using fn_format(); We just need to
+ first change fn_format() to cut the file name if it's too long.
*/
strmake(tmp,glob_hostname,FN_REFLEN-5);
strmov(strcend(tmp,'.'),"-relay-bin");
@@ -1013,72 +1040,76 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
rli->relay_log.set_index_file_name(opt_relaylog_index_name);
open_log(&rli->relay_log, glob_hostname, opt_relay_logname, "-relay-bin",
LOG_BIN, 1 /* read_append cache */,
- 1 /* no auto events*/);
+ 1 /* no auto events */);
/* if file does not exist */
if (!my_stat(fname, &stat_area, MYF(0)))
{
- // if someone removed the file from underneath our feet, just close
- // the old descriptor and re-create the old file
+ /*
+ If someone removed the file from underneath our feet, just close
+ the old descriptor and re-create the old file
+ */
if (info_fd >= 0)
my_close(info_fd, MYF(MY_WME));
- if ((info_fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0
- || init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0,
- MYF(MY_WME)))
+ if ((info_fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0 ||
+ init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0,
+ MYF(MY_WME)))
{
- if(info_fd >= 0)
+ if (info_fd >= 0)
my_close(info_fd, MYF(0));
- rli->info_fd=-1;
+ rli->info_fd= -1;
pthread_mutex_unlock(&rli->data_lock);
DBUG_RETURN(1);
}
- if (init_relay_log_pos(rli,"",4,0/*no data mutex*/,&msg))
+ if (init_relay_log_pos(rli,"",BIN_LOG_HEADER_SIZE,0 /*no data mutex*/,
+ &msg))
goto err;
rli->master_log_pos = 0; // uninitialized
rli->info_fd = info_fd;
}
else // file exists
{
- if(info_fd >= 0)
+ if (info_fd >= 0)
reinit_io_cache(&rli->info_file, READ_CACHE, 0L,0,0);
- else if((info_fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0
- || init_io_cache(&rli->info_file, info_fd,
- IO_SIZE*2, READ_CACHE, 0L,
- 0, MYF(MY_WME)))
+ else if ((info_fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0 ||
+ init_io_cache(&rli->info_file, info_fd,
+ IO_SIZE*2, READ_CACHE, 0L, 0, MYF(MY_WME)))
{
if (info_fd >= 0)
my_close(info_fd, MYF(0));
- rli->info_fd=-1;
+ rli->info_fd= -1;
pthread_mutex_unlock(&rli->data_lock);
DBUG_RETURN(1);
}
rli->info_fd = info_fd;
if (init_strvar_from_file(rli->relay_log_name,
- sizeof(rli->relay_log_name), &rli->info_file,
- (char*)"") ||
+ sizeof(rli->relay_log_name), &rli->info_file,
+ "") ||
init_intvar_from_file((int*)&rli->relay_log_pos,
- &rli->info_file, 4) ||
+ &rli->info_file, BIN_LOG_HEADER_SIZE) ||
init_strvar_from_file(rli->master_log_name,
sizeof(rli->master_log_name), &rli->info_file,
- (char*)"") ||
+ "") ||
init_intvar_from_file((int*)&rli->master_log_pos,
&rli->info_file, 0))
{
msg="Error reading slave log configuration";
goto err;
}
- if (init_relay_log_pos(rli,0 /*log already inited*/,
- 0 /*pos already inited*/,
+ if (init_relay_log_pos(rli,0 /* log already inited */,
+ 0 /* pos already inited */,
0 /* no data lock*/,
&msg))
goto err;
}
- DBUG_ASSERT(rli->relay_log_pos >= 4);
+ DBUG_ASSERT(rli->relay_log_pos >= BIN_LOG_HEADER_SIZE);
DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->relay_log_pos);
rli->inited = 1;
- // now change the cache from READ to WRITE - must do this
- // before flush_relay_log_info
+ /*
+ Now change the cache from READ to WRITE - must do this
+ before flush_relay_log_info
+ */
reinit_io_cache(&rli->info_file, WRITE_CACHE,0L,0,1);
error=test(flush_relay_log_info(rli));
if (count_relay_log_space(rli))
@@ -1093,7 +1124,7 @@ err:
sql_print_error(msg);
end_io_cache(&rli->info_file);
my_close(info_fd, MYF(0));
- rli->info_fd=-1;
+ rli->info_fd= -1;
pthread_mutex_unlock(&rli->data_lock);
DBUG_RETURN(1);
}
@@ -1118,11 +1149,11 @@ static inline int add_relay_log(RELAY_LOG_INFO* rli,LOG_INFO* linfo)
static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli)
{
- bool slave_killed;
- LINT_INIT(slave_killed);
+ bool slave_killed=0;
MASTER_INFO* mi = rli->mi;
const char* save_proc_info;
THD* thd = mi->io_thd;
+
DBUG_ENTER("wait_for_relay_log_space");
pthread_mutex_lock(&rli->log_space_lock);
save_proc_info = thd->proc_info;
@@ -1137,6 +1168,7 @@ static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli)
DBUG_RETURN(slave_killed);
}
+
static int count_relay_log_space(RELAY_LOG_INFO* rli)
{
LOG_INFO linfo;
@@ -1147,31 +1179,32 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli)
sql_print_error("Could not find first log while counting relay log space");
DBUG_RETURN(1);
}
- if (add_relay_log(rli,&linfo))
- DBUG_RETURN(1);
- while (!rli->relay_log.find_next_log(&linfo))
+ do
{
if (add_relay_log(rli,&linfo))
DBUG_RETURN(1);
- }
+ } while (!rli->relay_log.find_next_log(&linfo));
DBUG_RETURN(0);
}
+
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
const char* slave_info_fname)
{
+ int fd,error;
+ MY_STAT stat_area;
+ char fname[FN_REFLEN+128];
+ const char *msg;
+ DBUG_ENTER("init_master_info");
+
if (mi->inited)
- return 0;
+ DBUG_RETURN(0);
if (init_relay_log_info(&mi->rli, slave_info_fname))
- return 1;
+ DBUG_RETURN(1);
mi->rli.mi = mi;
mi->mysql=0;
mi->file_id=1;
mi->ignore_stop_event=0;
- int fd,error;
- MY_STAT stat_area;
- char fname[FN_REFLEN+128];
- const char *msg;
fn_format(fname, master_info_fname, mysql_data_home, "", 4+32);
/*
@@ -1185,23 +1218,19 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
// we do not want any messages if the file does not exist
if (!my_stat(fname, &stat_area, MYF(0)))
{
- // if someone removed the file from underneath our feet, just close
- // the old descriptor and re-create the old file
+ /*
+ if someone removed the file from underneath our feet, just close
+ the old descriptor and re-create the old file
+ */
if (fd >= 0)
my_close(fd, MYF(MY_WME));
- if ((fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0
- || init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,0,
- MYF(MY_WME)))
- {
- if(fd >= 0)
- my_close(fd, MYF(0));
- mi->fd=-1;
- end_relay_log_info(&mi->rli);
- pthread_mutex_unlock(&mi->data_lock);
- return 1;
- }
+ if ((fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0 ||
+ init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,0,
+ MYF(MY_WME)))
+ goto err;
+
mi->master_log_name[0] = 0;
- mi->master_log_pos = 4; // skip magic number
+ mi->master_log_pos = BIN_LOG_HEADER_SIZE; // skip magic number
mi->fd = fd;
if (master_host)
@@ -1215,24 +1244,17 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
}
else // file exists
{
- if(fd >= 0)
+ if (fd >= 0)
reinit_io_cache(&mi->file, READ_CACHE, 0L,0,0);
- else if((fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0
- || init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,
- 0, MYF(MY_WME)))
- {
- if(fd >= 0)
- my_close(fd, MYF(0));
- mi->fd=-1;
- end_relay_log_info(&mi->rli);
- pthread_mutex_unlock(&mi->data_lock);
- return 1;
- }
+ else if ((fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0 ||
+ init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,
+ 0, MYF(MY_WME)))
+ goto err;
mi->fd = fd;
if (init_strvar_from_file(mi->master_log_name,
sizeof(mi->master_log_name), &mi->file,
- (char*)"") ||
+ "") ||
init_intvar_from_file((int*)&mi->master_log_pos, &mi->file, 4) ||
init_strvar_from_file(mi->host, sizeof(mi->host), &mi->file,
master_host) ||
@@ -1244,7 +1266,7 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
init_intvar_from_file((int*)&mi->connect_retry, &mi->file,
master_connect_retry))
{
- msg="Error reading master configuration";
+ sql_print_error("Error reading master configuration");
goto err;
}
}
@@ -1254,17 +1276,18 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
reinit_io_cache(&mi->file, WRITE_CACHE,0L,0,1);
error=test(flush_master_info(mi));
pthread_mutex_unlock(&mi->data_lock);
- return error;
+ DBUG_RETURN(error);
err:
- sql_print_error(msg);
- end_io_cache(&mi->file);
end_relay_log_info(&mi->rli);
- DBUG_ASSERT(fd>=0);
- my_close(fd, MYF(0));
- mi->fd=-1;
+ if (fd >= 0)
+ {
+ my_close(fd, MYF(0));
+ end_io_cache(&mi->file);
+ }
+ mi->fd= -1;
pthread_mutex_unlock(&mi->data_lock);
- return 1;
+ DBUG_RETURN(1);
}
int register_slave_on_master(MYSQL* mysql)
@@ -1284,7 +1307,7 @@ int register_slave_on_master(MYSQL* mysql)
else
packet.append((char)0);
- if(report_password)
+ if (report_password)
net_store_data(&packet, report_user);
else
packet.append((char)0);
@@ -1335,7 +1358,7 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
field_list.push_back(new Item_empty_string("Skip_counter", 12));
field_list.push_back(new Item_empty_string("Exec_master_log_pos", 12));
field_list.push_back(new Item_empty_string("Relay_log_space", 12));
- if(send_fields(thd, field_list, 1))
+ if (send_fields(thd, field_list, 1))
DBUG_RETURN(-1);
String* packet = &thd->packet;
@@ -1504,8 +1527,10 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
*/
thr_alarm(&alarmed, 2 * nap_time,&alarm_buff);
sleep(nap_time);
- // if we wake up before the alarm goes off, hit the button
- // so it will not wake up the wife and kids :-)
+ /*
+ If we wake up before the alarm goes off, hit the button
+ so it will not wake up the wife and kids :-)
+ */
if (thr_alarm_in_use(&alarmed))
thr_end_alarm(&alarmed);
@@ -1530,9 +1555,11 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi)
memcpy(buf + 10, logname,len);
if (mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 10, 1))
{
- // something went wrong, so we will just reconnect and retry later
- // in the future, we should do a better error analysis, but for
- // now we just fill up the error log :-)
+ /*
+ Something went wrong, so we will just reconnect and retry later
+ in the future, we should do a better error analysis, but for
+ now we just fill up the error log :-)
+ */
sql_print_error("Error on COM_BINLOG_DUMP: %s, will retry in %d secs",
mc_mysql_error(mysql), master_connect_retry);
return 1;
@@ -1547,7 +1574,7 @@ static int request_table_dump(MYSQL* mysql, const char* db, const char* table)
char * p = buf;
uint table_len = (uint) strlen(table);
uint db_len = (uint) strlen(db);
- if(table_len + db_len > sizeof(buf) - 2)
+ if (table_len + db_len > sizeof(buf) - 2)
{
sql_print_error("request_table_dump: Buffer overrun");
return 1;
@@ -1573,8 +1600,10 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi)
{
ulong len = packet_error;
- // my_real_read() will time us out
- // we check if we were told to die, and if not, try reading again
+ /*
+ my_real_read() will time us out
+ We check if we were told to die, and if not, try reading again
+ */
#ifndef DBUG_OFF
if (disconnect_slave_event_count && !(events_till_disconnect--))
return packet_error;
@@ -1645,12 +1674,14 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
type_code != STOP_EVENT ? ev->log_pos : LL(0),
1/* skip lock*/);
flush_relay_log_info(rli);
- if (rli->slave_skip_counter && /* protect against common user error of
- setting the counter to 1 instead of 2
- while recovering from an failed
- auto-increment insert */
- !((type_code == INTVAR_EVENT || type_code == STOP_EVENT) &&
- rli->slave_skip_counter == 1))
+
+ /*
+ Protect against common user error of setting the counter to 1
+ instead of 2 while recovering from an failed auto-increment insert
+ */
+ if (rli->slave_skip_counter &&
+ !((type_code == INTVAR_EVENT || type_code == STOP_EVENT) &&
+ rli->slave_skip_counter == 1))
--rli->slave_skip_counter;
pthread_mutex_unlock(&rli->data_lock);
delete ev;
@@ -1720,7 +1751,7 @@ slave_begin:
pthread_cond_broadcast(&mi->start_cond);
pthread_mutex_unlock(&mi->run_lock);
- DBUG_PRINT("info",("master info: log_file_name=%s, position=%s",
+ DBUG_PRINT("info",("master info: log_file_name='%s', position=%s",
mi->master_log_name, llstr(mi->master_log_pos,llbuff)));
if (!(mi->mysql = mysql = mc_mysql_init(NULL)))
@@ -1770,7 +1801,7 @@ connected:
if (request_dump(mysql, mi))
{
sql_print_error("Failed on request_dump()");
- if(io_slave_killed(thd,mi))
+ if (io_slave_killed(thd,mi))
{
sql_print_error("Slave I/O thread killed while requesting master \
dump");
@@ -1857,7 +1888,7 @@ reconnect done to recover from failed read");
goto err;
}
goto connected;
- } // if(event_len == packet_error)
+ } // if (event_len == packet_error)
thd->proc_info = "Queueing event from master";
if (queue_event(mi,(const char*)mysql->net.read_pos + 1,
@@ -1911,11 +1942,11 @@ err:
THD_CHECK_SENTRY(thd);
delete thd;
pthread_mutex_unlock(&LOCK_thread_count);
- my_thread_end(); // clean-up before broadcast
- pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done
+ my_thread_end(); // clean-up before broadcast
+ pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done
pthread_mutex_unlock(&mi->run_lock);
#ifndef DBUG_OFF
- if(abort_slave_event_count && !events_till_abort)
+ if (abort_slave_event_count && !events_till_abort)
goto slave_begin;
#endif
pthread_exit(0);
@@ -1972,22 +2003,22 @@ slave_begin:
rli->abort_slave = 0;
pthread_cond_broadcast(&rli->start_cond);
pthread_mutex_unlock(&rli->run_lock);
- rli->pending = 0; //this should always be set to 0 when the slave thread
- // is started
- if (init_relay_log_pos(rli,0,0,1/*need data lock*/,&errmsg))
+ // This should always be set to 0 when the slave thread is started
+ rli->pending = 0;
+ if (init_relay_log_pos(rli,0,0,1 /*need data lock*/, &errmsg))
{
sql_print_error("Error initializing relay log position: %s",
errmsg);
goto err;
}
- DBUG_ASSERT(rli->relay_log_pos >= 4);
+ DBUG_ASSERT(rli->relay_log_pos >= BIN_LOG_HEADER_SIZE);
DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->relay_log_pos);
- DBUG_PRINT("info",("master info: log_file_name=%s, position=%s",
+ DBUG_PRINT("info",("master info: log_file_name: %s, position: %s",
rli->master_log_name, llstr(rli->master_log_pos,llbuff)));
DBUG_ASSERT(rli->sql_thd == thd);
sql_print_error("Slave SQL thread initialized, starting replication in \
-log '%s' at position %s,relay log: name='%s',pos='%s'", RPL_LOG_NAME,
+log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
llstr(rli->master_log_pos,llbuff),rli->relay_log_name,
llstr(rli->relay_log_pos,llbuff1));
while (!sql_slave_killed(thd,rli))
@@ -2006,7 +2037,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
RPL_LOG_NAME, llstr(rli->master_log_pos, llbuff));
goto err;
}
- } // while(!sql_slave_killed(thd,rli)) - read/exec loop
+ } // while (!sql_slave_killed(thd,rli)) - read/exec loop
// error = 0;
err:
@@ -2055,16 +2086,17 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev)
bool cev_not_written;
THD* thd;
NET* net = &mi->mysql->net;
+ DBUG_ENTER("process_io_create_file");
if (unlikely(!cev->is_valid()))
- return 1;
+ DBUG_RETURN(1);
/*
TODO: fix to honor table rules, not only db rules
*/
if (!db_ok(cev->db, replicate_do_db, replicate_ignore_db))
{
skip_load_data_infile(net);
- return 0;
+ DBUG_RETURN(0);
}
DBUG_ASSERT(cev->inited_from_old);
thd = mi->io_thd;
@@ -2139,10 +2171,13 @@ relay log");
}
error=0;
err:
- return error;
+ DBUG_RETURN(error);
}
-// We assume we already locked mi->data_lock
+/*
+ We assume we already locked mi->data_lock
+*/
+
static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev)
{
if (unlikely(!rev->is_valid()))
@@ -2177,6 +2212,8 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
bool inc_pos = 1;
bool processed_stop_event = 0;
char* tmp_buf = 0;
+ DBUG_ENTER("queue_old_event");
+
/* if we get Load event, we need to pass a non-reusable buffer
to read_log_event, so we do a trick
*/
@@ -2185,7 +2222,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
if (unlikely(!(tmp_buf=(char*)my_malloc(event_len+1,MYF(MY_WME)))))
{
sql_print_error("Slave I/O: out of memory for Load event");
- return 1;
+ DBUG_RETURN(1);
}
memcpy(tmp_buf,buf,event_len);
tmp_buf[event_len]=0; // Create_file constructor wants null-term buffer
@@ -2198,8 +2235,8 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
sql_print_error("Read invalid event from master: '%s',\
master could be corrupt but a more likely cause of this is a bug",
errmsg);
- my_free((char*)tmp_buf, MYF(MY_ALLOW_ZERO_PTR));
- return 1;
+ my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR));
+ DBUG_RETURN(1);
}
pthread_mutex_lock(&mi->data_lock);
ev->log_pos = mi->master_log_pos;
@@ -2210,7 +2247,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
delete ev;
pthread_mutex_unlock(&mi->data_lock);
DBUG_ASSERT(!tmp_buf);
- return 1;
+ DBUG_RETURN(1);
}
mi->ignore_stop_event=1;
inc_pos = 0;
@@ -2226,7 +2263,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
pthread_mutex_unlock(&mi->data_lock);
DBUG_ASSERT(tmp_buf);
my_free((char*)tmp_buf, MYF(0));
- return error;
+ DBUG_RETURN(error);
}
default:
mi->ignore_stop_event=0;
@@ -2239,7 +2276,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
delete ev;
pthread_mutex_unlock(&mi->data_lock);
DBUG_ASSERT(!tmp_buf);
- return 1;
+ DBUG_RETURN(1);
}
mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total);
}
@@ -2250,7 +2287,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
mi->ignore_stop_event=1;
pthread_mutex_unlock(&mi->data_lock);
DBUG_ASSERT(!tmp_buf);
- return 0;
+ DBUG_RETURN(0);
}
/*
@@ -2263,8 +2300,10 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
int error=0;
bool inc_pos = 1;
bool processed_stop_event = 0;
+ DBUG_ENTER("queue_event");
+
if (mi->old_format)
- return queue_old_event(mi,buf,event_len);
+ DBUG_RETURN(queue_old_event(mi,buf,event_len));
pthread_mutex_lock(&mi->data_lock);
@@ -2280,7 +2319,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
{
Rotate_log_event rev(buf,event_len,0);
if (unlikely(process_io_rotate(mi,&rev)))
- return 1;
+ DBUG_RETURN(1);
inc_pos=0;
mi->ignore_stop_event=1;
break;
@@ -2300,7 +2339,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
if (unlikely(processed_stop_event))
mi->ignore_stop_event=1;
pthread_mutex_unlock(&mi->data_lock);
- return error;
+ DBUG_RETURN(error);
}
@@ -2427,18 +2466,27 @@ int flush_relay_log_info(RELAY_LOG_INFO* rli)
return 0;
}
-IO_CACHE* reopen_relay_log(RELAY_LOG_INFO* rli, const char** errmsg)
+
+/*
+ This function is called when we notice that the current "hot" log
+ got rotated under our feet.
+*/
+
+static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg)
{
DBUG_ASSERT(rli->cur_log != &rli->cache_buf);
- IO_CACHE* cur_log = rli->cur_log=&rli->cache_buf;
DBUG_ASSERT(rli->cur_log_fd == -1);
+ DBUG_ENTER("reopen_relay_log");
+
+ IO_CACHE *cur_log = rli->cur_log=&rli->cache_buf;
if ((rli->cur_log_fd=open_binlog(cur_log,rli->relay_log_name,
errmsg)) <0)
- return 0;
+ DBUG_RETURN(0);
my_b_seek(cur_log,rli->relay_log_pos);
- return cur_log;
+ DBUG_RETURN(cur_log);
}
+
Log_event* next_event(RELAY_LOG_INFO* rli)
{
Log_event* ev;
@@ -2447,6 +2495,7 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
const char* errmsg=0;
THD* thd = rli->sql_thd;
bool was_killed;
+ DBUG_ENTER("next_event");
DBUG_ASSERT(thd != 0);
/*
@@ -2458,16 +2507,18 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
*/
pthread_mutex_lock(&rli->data_lock);
- for (; !(was_killed=sql_slave_killed(thd,rli)) ;)
+ while (!(was_killed=sql_slave_killed(thd,rli)))
{
/*
We can have two kinds of log reading:
- hot_log - rli->cur_log points at the IO_CACHE of relay_log, which
- is actively being updated by the I/O thread. We need to be careful
- in this case and make sure that we are not looking at a stale log that
- has already been rotated. If it has been, we reopen the log
- the other case is much simpler - we just have a read only log that
- nobody else will be updating.
+ hot_log:
+ rli->cur_log points at the IO_CACHE of relay_log, which
+ is actively being updated by the I/O thread. We need to be careful
+ in this case and make sure that we are not looking at a stale log that
+ has already been rotated. If it has been, we reopen the log.
+
+ The other case is much simpler:
+ We just have a read only log that nobody else will be updating.
*/
bool hot_log;
if ((hot_log = (cur_log != &rli->cache_buf)))
@@ -2476,43 +2527,43 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
pthread_mutex_lock(log_lock);
/*
- Reading cur_log->init_count here is safe because the log will only
+ Reading xxx_file_id is safe because the log will only
be rotated when we hold relay_log.LOCK_log
*/
- if (cur_log->init_count != rli->cur_log_init_count)
+ if (rli->relay_log.get_open_count() != rli->cur_log_old_open_count)
{
- if (!(cur_log=reopen_relay_log(rli,&errmsg)))
- {
- pthread_mutex_unlock(log_lock);
+ // The master has switched to a new log file; Reopen the old log file
+ cur_log=reopen_relay_log(rli, &errmsg);
+ pthread_mutex_unlock(log_lock);
+ if (!cur_log) // No more log files
goto err;
- }
- pthread_mutex_unlock(log_lock);
- hot_log=0;
+ hot_log=0; // Using old binary log
}
}
- DBUG_ASSERT(my_b_tell(cur_log) >= 4);
+ DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE);
DBUG_ASSERT(my_b_tell(cur_log) == rli->relay_log_pos + rli->pending);
- /* relay log is always in new format - if the master is 3.23, the
- I/O thread will convert the format for us
+ /*
+ Relay log is always in new format - if the master is 3.23, the
+ I/O thread will convert the format for us
*/
- if ((ev=Log_event::read_log_event(cur_log,0,(bool)0/*new format*/)))
+ if ((ev=Log_event::read_log_event(cur_log,0,(bool)0 /* new format */)))
{
DBUG_ASSERT(thd==rli->sql_thd);
if (hot_log)
pthread_mutex_unlock(log_lock);
pthread_mutex_unlock(&rli->data_lock);
- return ev;
+ DBUG_RETURN(ev);
}
DBUG_ASSERT(thd==rli->sql_thd);
- if (opt_reckless_slave)
+ if (opt_reckless_slave) // For mysql-test
cur_log->error = 0;
- if ( cur_log->error < 0)
+ if (cur_log->error < 0)
{
errmsg = "slave SQL thread aborted because of I/O error";
+ if (hot_log)
+ pthread_mutex_unlock(log_lock);
goto err;
}
-
-
if (!cur_log->error) /* EOF */
{
/*
@@ -2522,7 +2573,7 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
*/
if (hot_log)
{
- DBUG_ASSERT(cur_log->init_count == rli->cur_log_init_count);
+ DBUG_ASSERT(rli->relay_log.get_open_count() == rli->cur_log_old_open_count);
/*
We can, and should release data_lock while we are waiting for
update. If we do not, show slave status will block
@@ -2530,7 +2581,7 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
pthread_mutex_unlock(&rli->data_lock);
/*
- IMPORTANT: note that wait_for_update will unlock LOCK_log, but
+ IMPORTANT: note that wait_for_update will unlock lock_log, but
expects the caller to lock it
*/
rli->relay_log.wait_for_update(rli->sql_thd);
@@ -2539,102 +2590,108 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
pthread_mutex_lock(&rli->data_lock);
continue;
}
+ /*
+ If the log was not hot, we need to move to the next log in
+ sequence. The next log could be hot or cold, we deal with both
+ cases separately after doing some common initialization
+ */
+ end_io_cache(cur_log);
+ DBUG_ASSERT(rli->cur_log_fd >= 0);
+ my_close(rli->cur_log_fd, MYF(MY_WME));
+ rli->cur_log_fd = -1;
+
+ /*
+ TODO: make skip_log_purge a start-up option. At this point this
+ is not critical priority
+ */
+ if (!rli->skip_log_purge)
+ {
+ // purge_first_log will properly set up relay log coordinates in rli
+ if (rli->relay_log.purge_first_log(rli))
+ {
+ errmsg = "Error purging processed log";
+ goto err;
+ }
+ }
else
{
/*
- If the log was not hot, we need to move to the next log in
- sequence. The next log could be hot or cold, we deal with both
- cases separately after doing some common initialization
+ TODO: verify that no lock is ok here. At this point, if we
+ get this wrong, this is actually no big deal - the only time
+ this code will ever be executed is if we are recovering from
+ a bug when a full reload of the slave is not feasible or
+ desirable.
*/
- end_io_cache(cur_log);
- DBUG_ASSERT(rli->cur_log_fd >= 0);
- my_close(rli->cur_log_fd, MYF(MY_WME));
- rli->cur_log_fd = -1;
-
- // TODO: make skip_log_purge a start-up option. At this point this
- // is not critical priority
- if (!rli->skip_log_purge)
+ if (rli->relay_log.find_next_log(&rli->linfo,0/*no lock*/))
{
- // purge_first_log will properly set up relay log coordinates in rli
- if (rli->relay_log.purge_first_log(rli))
- {
- errmsg = "Error purging processed log";
- goto err;
- }
- }
- else
- {
- // TODO: verify that no lock is ok here. At this point, if we
- // get this wrong, this is actually no big deal - the only time
- // this code will ever be executed is if we are recovering from
- // a bug when a full reload of the slave is not feasible or
- // desirable.
- if (rli->relay_log.find_next_log(&rli->linfo,0/*no lock*/))
- {
- errmsg = "error switching to the next log";
- goto err;
- }
- rli->relay_log_pos = 4;
- rli->pending=0;
- strnmov(rli->relay_log_name,rli->linfo.log_file_name,
- sizeof(rli->relay_log_name));
- flush_relay_log_info(rli);
+ errmsg = "error switching to the next log";
+ goto err;
}
+ rli->relay_log_pos = BIN_LOG_HEADER_SIZE;
+ rli->pending=0;
+ strnmov(rli->relay_log_name,rli->linfo.log_file_name,
+ sizeof(rli->relay_log_name));
+ flush_relay_log_info(rli);
+ }
- // next log is hot
- if (rli->relay_log.is_active(rli->linfo.log_file_name))
- {
+ // next log is hot
+ if (rli->relay_log.is_active(rli->linfo.log_file_name))
+ {
#ifdef EXTRA_DEBUG
- sql_print_error("next log '%s' is currently active",
- rli->linfo.log_file_name);
+ sql_print_error("next log '%s' is currently active",
+ rli->linfo.log_file_name);
#endif
- rli->cur_log = cur_log = rli->relay_log.get_log_file();
- rli->cur_log_init_count = cur_log->init_count;
- DBUG_ASSERT(rli->cur_log_fd == -1);
+ rli->cur_log= cur_log= rli->relay_log.get_log_file();
+ rli->cur_log_old_open_count= rli->relay_log.get_open_count();
+ DBUG_ASSERT(rli->cur_log_fd == -1);
- /*
- Read pointer has to be at the start since we are the only
- reader
- */
- if (check_binlog_magic(cur_log,&errmsg))
- goto err;
- continue;
- }
/*
- if we get here, the log was not hot, so we will have to
- open it ourselves
+ Read pointer has to be at the start since we are the only
+ reader
*/
-#ifdef EXTRA_DEBUG
- sql_print_error("next log '%s' is not active",
- rli->linfo.log_file_name);
-#endif
- // open_binlog() will check the magic header
- if ((rli->cur_log_fd=open_binlog(cur_log,rli->linfo.log_file_name,
- &errmsg)) <0)
+ if (check_binlog_magic(cur_log,&errmsg))
goto err;
+ continue;
}
+ /*
+ if we get here, the log was not hot, so we will have to
+ open it ourselves
+ */
+#ifdef EXTRA_DEBUG
+ sql_print_error("next log '%s' is not active",
+ rli->linfo.log_file_name);
+#endif
+ // open_binlog() will check the magic header
+ if ((rli->cur_log_fd=open_binlog(cur_log,rli->linfo.log_file_name,
+ &errmsg)) <0)
+ goto err;
}
- else // read failed with a non-EOF error
+ else
{
- // TODO: come up with something better to handle this error
+ /*
+ Read failed with a non-EOF error.
+ TODO: come up with something better to handle this error
+ */
+ if (hot_log)
+ pthread_mutex_unlock(log_lock);
sql_print_error("Slave SQL thread: I/O error reading \
-event(errno=%d,cur_log->error=%d)",
+event(errno: %d cur_log->error: %d)",
my_errno,cur_log->error);
// set read position to the beginning of the event
my_b_seek(cur_log,rli->relay_log_pos+rli->pending);
/* otherwise, we have had a partial read */
- /* TODO; see if there is a way to do this without this goto */
errmsg = "Aborting slave SQL thread because of partial event read";
+ /* TODO; see if there is a way to do this without this goto */
goto err;
}
-
}
if (!errmsg && was_killed)
errmsg = "slave SQL thread was killed";
+
err:
pthread_mutex_unlock(&rli->data_lock);
sql_print_error("Error reading relay log event: %s", errmsg);
- return 0;
+ DBUG_RETURN(0);
}
diff --git a/sql/slave.h b/sql/slave.h
index 34df17f2851..d6992a8b839 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -84,18 +84,9 @@ typedef struct st_relay_log_info
volatile my_off_t master_log_pos;
/*
- current offset in the relay log.
- pending - in some cases we do not increment offset immediately after
- processing an event, because the following event needs to be processed
- atomically together with this one ( so far, there is only one type of
- such event - Intvar_event that sets auto_increment value). However, once
- both events have been processed, we need to increment by the cumulative
- offset. pending stored the extra offset to be added to the position.
+ Protected with internal locks.
+ Must get data_lock when resetting the logs.
*/
- ulonglong relay_log_pos, pending;
-
- // protected with internal locks
- // must get data_lock when resetting the logs
MYSQL_LOG relay_log;
LOG_INFO linfo;
IO_CACHE cache_buf,*cur_log;
@@ -125,9 +116,6 @@ typedef struct st_relay_log_info
*/
pthread_cond_t start_cond, stop_cond, data_cond;
- // if not set, the value of other members of the structure are undefined
- bool inited;
-
// parent master info structure
struct st_master_info *mi;
@@ -135,9 +123,19 @@ typedef struct st_relay_log_info
Needed to deal properly with cur_log getting closed and re-opened with
a different log under our feet
*/
- int cur_log_init_count;
+ uint32 cur_log_old_open_count;
- volatile bool abort_slave, slave_running;
+ /*
+ current offset in the relay log.
+ pending - in some cases we do not increment offset immediately after
+ processing an event, because the following event needs to be processed
+ atomically together with this one ( so far, there is only one type of
+ such event - Intvar_event that sets auto_increment value). However, once
+ both events have been processed, we need to increment by the cumulative
+ offset. pending stored the extra offset to be added to the position.
+ */
+ ulonglong relay_log_pos, pending;
+ ulonglong log_space_limit,log_space_total;
/*
Needed for problems when slave stops and we want to restart it
@@ -145,45 +143,47 @@ typedef struct st_relay_log_info
errors, and have been manually applied by DBA already.
*/
volatile uint32 slave_skip_counter;
+ pthread_mutex_t log_space_lock;
+ pthread_cond_t log_space_cond;
+ THD * sql_thd;
+ int last_slave_errno;
#ifndef DBUG_OFF
int events_till_abort;
#endif
- int last_slave_errno;
char last_slave_error[MAX_SLAVE_ERRMSG];
- THD* sql_thd;
+
+ // if not set, the value of other members of the structure are undefined
+ bool inited;
+ volatile bool abort_slave, slave_running;
bool log_pos_current;
bool abort_pos_wait;
bool skip_log_purge;
- ulonglong log_space_limit,log_space_total;
- pthread_mutex_t log_space_lock;
- pthread_cond_t log_space_cond;
- st_relay_log_info():info_fd(-1),cur_log_fd(-1),inited(0),
- cur_log_init_count(0),
- abort_slave(0),slave_running(0),
- log_pos_current(0),abort_pos_wait(0),
- skip_log_purge(0)
- {
- relay_log_name[0] = master_log_name[0] = 0;
- bzero(&info_file,sizeof(info_file));
- pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
- pthread_cond_init(&data_cond, NULL);
- pthread_cond_init(&start_cond, NULL);
- pthread_cond_init(&stop_cond, NULL);
- pthread_cond_init(&log_space_cond, NULL);
- }
+ st_relay_log_info()
+ :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0),
+ inited(0), abort_slave(0), slave_running(0), log_pos_current(0),
+ abort_pos_wait(0), skip_log_purge(0)
+ {
+ relay_log_name[0] = master_log_name[0] = 0;
+ bzero(&info_file,sizeof(info_file));
+ pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
+ pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
+ pthread_cond_init(&data_cond, NULL);
+ pthread_cond_init(&start_cond, NULL);
+ pthread_cond_init(&stop_cond, NULL);
+ pthread_cond_init(&log_space_cond, NULL);
+ }
~st_relay_log_info()
- {
- pthread_mutex_destroy(&run_lock);
- pthread_mutex_destroy(&data_lock);
- pthread_mutex_destroy(&log_space_lock);
- pthread_cond_destroy(&data_cond);
- pthread_cond_destroy(&start_cond);
- pthread_cond_destroy(&stop_cond);
- pthread_cond_destroy(&log_space_cond);
- }
+ {
+ pthread_mutex_destroy(&run_lock);
+ pthread_mutex_destroy(&data_lock);
+ pthread_mutex_destroy(&log_space_lock);
+ pthread_cond_destroy(&data_cond);
+ pthread_cond_destroy(&start_cond);
+ pthread_cond_destroy(&stop_cond);
+ pthread_cond_destroy(&log_space_cond);
+ }
inline void inc_pending(ulonglong val)
{
pending += val;
@@ -215,40 +215,33 @@ typedef struct st_relay_log_info
int wait_for_pos(THD* thd, String* log_name, ulonglong log_pos);
} RELAY_LOG_INFO;
-/*
- repopen_relay_log() is called when we notice that the current "hot" log
- got rotated under our feet
-*/
-
-IO_CACHE* reopen_relay_log(RELAY_LOG_INFO* rli, const char** errmsg);
Log_event* next_event(RELAY_LOG_INFO* rli);
-
/*
st_master_info contains information about how to connect to a master,
- current master log name, and current log offset, as well as misc
- control variables
+ current master log name, and current log offset, as well as misc
+ control variables
- st_master_info is initialized once from the master.info file if such
- exists. Otherwise, data members corresponding to master.info fields are
- initialized with defaults specified by master-* options. The initialization
- is done through init_master_info() call.
+ st_master_info is initialized once from the master.info file if such
+ exists. Otherwise, data members corresponding to master.info fields
+ are initialized with defaults specified by master-* options. The
+ initialization is done through init_master_info() call.
- The format of master.info file:
+ The format of master.info file:
- log_name
- log_pos
- master_host
- master_user
- master_pass
- master_port
- master_connect_retry
+ log_name
+ log_pos
+ master_host
+ master_user
+ master_pass
+ master_port
+ master_connect_retry
- To write out the contents of master.info file to disk ( needed every
- time we read and queue data from the master ), a call to
- flush_master_info() is required.
+ To write out the contents of master.info file to disk ( needed every
+ time we read and queue data from the master ), a call to
+ flush_master_info() is required.
- To clean up, call end_master_info()
+ To clean up, call end_master_info()
*/
@@ -415,9 +408,7 @@ extern bool do_table_inited, ignore_table_inited,
wild_do_table_inited, wild_ignore_table_inited;
extern bool table_rules_on;
-#ifndef DBUG_OFF
extern int disconnect_slave_event_count, abort_slave_event_count ;
-#endif
// the master variables are defaults read from my.cnf or command line
extern uint master_port, master_connect_retry, report_port;
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index df8a8f1fdde..bbe82653190 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -90,21 +90,21 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val() < 0)
{
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
- return 0;
+ DBUG_RETURN(0);
}
pc->max_tree_elements = (uint) (*param->item)->val_int();
param = param->next;
if (param->next) // no third parameter possible
{
net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name);
- return 0;
+ DBUG_RETURN(0);
}
// second parameter
if ((*param->item)->type() != Item::INT_ITEM ||
(*param->item)->val() < 0)
{
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
- return 0;
+ DBUG_RETURN(0);
}
pc->max_treemem = (uint) (*param->item)->val_int();
}
@@ -112,7 +112,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
(*param->item)->val() < 0)
{
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
- return 0;
+ DBUG_RETURN(0);
}
// if only one parameter was given, it will be the value of max_tree_elements
else
@@ -148,21 +148,26 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
if (item->result_type() == STRING_RESULT)
*f_info++ = new field_str(item, pc);
}
- return pc;
-} // proc_analyse_init
+ DBUG_RETURN(pc);
+}
-// return 1 if number, else return 0
-// store info about found number in info
-// NOTE:It is expected, that elements of 'info' are all zero!
+/*
+ Return 1 if number, else return 0
+ store info about found number in info
+ NOTE:It is expected, that elements of 'info' are all zero!
+*/
+
bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
{
const char *begin, *end = str + str_len;
DBUG_ENTER("test_if_number");
- // MySQL removes any endspaces of a string, so we must take care only of
- // spaces in front of a string
+ /*
+ MySQL removes any endspaces of a string, so we must take care only of
+ spaces in front of a string
+ */
for (; str != end && isspace(*str); str++) ;
if (str == end)
return 0;
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 87ca7003b7b..ec6f4cf2736 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -704,17 +704,17 @@ Query_cache::Query_cache(ulong query_cache_limit,
query_cache_limit(query_cache_limit),
queries_in_cache(0), hits(0), inserts(0), refused(0),
total_blocks(0),
- min_allocation_unit(min_allocation_unit),
- min_result_data_size(min_result_data_size),
- def_query_hash_size(def_query_hash_size),
- def_table_hash_size(def_table_hash_size),
+ min_allocation_unit(ALIGN_SIZE(min_allocation_unit)),
+ min_result_data_size(ALIGN_SIZE(min_result_data_size)),
+ def_query_hash_size(ALIGN_SIZE(def_query_hash_size)),
+ def_table_hash_size(ALIGN_SIZE(def_table_hash_size)),
initialized(0)
{
ulong min_needed=(ALIGN_SIZE(sizeof(Query_cache_block)) +
ALIGN_SIZE(sizeof(Query_cache_block_table)) +
ALIGN_SIZE(sizeof(Query_cache_query)) + 3);
set_if_bigger(min_allocation_unit,min_needed);
- this->min_allocation_unit = min_allocation_unit;
+ this->min_allocation_unit = ALIGN_SIZE(min_allocation_unit);
set_if_bigger(this->min_result_data_size,min_allocation_unit);
}
@@ -1073,7 +1073,8 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used)
{
invalidate_table((byte*) tables_used->key, tables_used->key_length);
DBUG_PRINT("qcache", (" db %s, table %s", tables_used->key,
- tables_used->table_name));
+ tables_used->key+
+ strlen(tables_used->key)+1));
}
}
STRUCT_UNLOCK(&structure_guard_mutex);
@@ -1218,6 +1219,7 @@ ulong Query_cache::init_cache()
uint mem_bin_count, num, step;
ulong mem_bin_size, prev_size, inc;
ulong additional_data_size, max_mem_bin_size, approx_additional_data_size;
+ int align;
DBUG_ENTER("Query_cache::init_cache");
if (!initialized)
@@ -1228,7 +1230,13 @@ ulong Query_cache::init_cache()
if (query_cache_size < approx_additional_data_size)
goto err;
- query_cache_size -= approx_additional_data_size;
+ query_cache_size-= approx_additional_data_size;
+ align= query_cache_size % ALIGN_SIZE(1);
+ if (align)
+ {
+ query_cache_size-= align;
+ approx_additional_data_size+= align;
+ }
/*
Count memory bins number.
@@ -1542,10 +1550,12 @@ Query_cache::write_block_data(ulong data_len, gptr data,
ALIGN_SIZE(ntab*sizeof(Query_cache_block_table)) +
header_len);
ulong len = data_len + all_headers_len;
+ ulong align_len= ALIGN_SIZE(len);
DBUG_ENTER("Query_cache::write_block_data");
DBUG_PRINT("qcache", ("data: %ld, header: %ld, all header: %ld",
data_len, header_len, all_headers_len));
- Query_cache_block *block = allocate_block(max(len, min_allocation_unit),
+ Query_cache_block *block = allocate_block(max(align_len,
+ min_allocation_unit),
1, 0, under_guard);
if (block != 0)
{
@@ -1740,7 +1750,8 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
{
ulong all_headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
ALIGN_SIZE(sizeof(Query_cache_result)));
- ulong len = data_len + all_headers_len;
+ ulong len= data_len + all_headers_len;
+ ulong align_len= ALIGN_SIZE(len);
DBUG_ENTER("Query_cache::allocate_data_chain");
DBUG_PRINT("qcache", ("data_len %lu, all_headers_len %lu",
data_len, all_headers_len));
@@ -1748,7 +1759,7 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
ulong min_size = (first_block ?
get_min_first_result_data_size():
get_min_append_result_data_size());
- *result_block = allocate_block(max(min_size,len),
+ *result_block = allocate_block(max(min_size, align_len),
min_result_data_size == 0,
all_headers_len + min_result_data_size,
1);
@@ -1984,7 +1995,7 @@ Query_cache_block *
Query_cache::allocate_block(ulong len, my_bool not_less, ulong min,
my_bool under_guard)
{
- DBUG_ENTER("Query_cache::allocate_n_lock_block");
+ DBUG_ENTER("Query_cache::allocate_block");
DBUG_PRINT("qcache", ("len %lu, not less %d, min %lu, uder_guard %d",
len, not_less,min,under_guard));
@@ -2669,14 +2680,17 @@ my_bool Query_cache::move_by_type(byte **border,
*border += len;
*before = new_block;
/* If result writing complete && we have free space in block */
- ulong free_space = new_block->length - new_block->used;
+ ulong free_space= new_block->length - new_block->used;
+ free_space-= free_space % ALIGN_SIZE(1);
if (query->result()->type == Query_cache_block::RESULT &&
new_block->length > new_block->used &&
*gap + free_space > min_allocation_unit &&
new_block->length - free_space > min_allocation_unit)
{
- *border -= free_space;
- *gap += free_space;
+ *border-= free_space;
+ *gap+= free_space;
+ DBUG_PRINT("qcache",
+ ("rest of result free space added to gap (%lu)", *gap));
new_block->length -= free_space;
}
BLOCK_UNLOCK_WR(query_block);
@@ -2737,7 +2751,7 @@ my_bool Query_cache::join_results(ulong join_limit)
header->length() > join_limit)
{
Query_cache_block *new_result_block =
- get_free_block(header->length() +
+ get_free_block(ALIGN_SIZE(header->length()) +
ALIGN_SIZE(sizeof(Query_cache_block)) +
ALIGN_SIZE(sizeof(Query_cache_result)), 1, 0);
if (new_result_block != 0)
@@ -3046,6 +3060,15 @@ my_bool Query_cache::check_integrity(bool not_locked)
{
DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
(ulong) block, (uint) block->type));
+ // Check allignment
+ if ((((ulonglong)block) % (ulonglong)ALIGN_SIZE(1)) !=
+ (((ulonglong)first_block) % (ulonglong)ALIGN_SIZE(1)))
+ {
+ DBUG_PRINT("error",
+ ("block 0x%lx do not aligned by %d", (ulong) block,
+ ALIGN_SIZE(1)));
+ result = 1;
+ }
// Check memory allocation
if (block->pnext == first_block) // Is it last block?
{
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index c332181b410..84de7e6ad4a 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -345,11 +345,7 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(TABLE *table)
ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST)));
new_table->next = 0;
new_table->key_length = table->key_length;
- uint32 db_len = ((new_table->table_name =
- ::strmake(new_table->key, table->table_cache_key,
- table->key_length) + 1) - new_table->key);
- ::memcpy(new_table->key + db_len, table->table_cache_key + db_len,
- table->key_length - db_len);
+ ::memcpy(new_table->key, table->table_cache_key, table->key_length);
return new_table;
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index fe6a7e2ed69..da0b2090c97 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -60,48 +60,49 @@ class Log_event;
class MYSQL_LOG {
private:
pthread_mutex_t LOCK_log, LOCK_index;
+ pthread_cond_t update_cond;
+ ulonglong bytes_written;
time_t last_time,query_start;
IO_CACHE log_file;
File index_file;
char *name;
- volatile enum_log_type log_type;
char time_buff[20],db[NAME_LEN+1];
char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN];
- bool write_error,inited;
- uint file_id; // current file sequence number for load data infile
- // binary logging
- bool no_rotate; // for binlog - if log name can never change
- // we should not try to rotate it or write any rotation events
- // the user should use FLUSH MASTER instead of FLUSH LOGS for
- // purging
+ // current file sequence number for load data infile binary logging
+ uint file_id;
+ uint open_count; // For replication
+ /*
+ For binlog - if log name can never change we should not try to rotate it
+ or write any rotation events. The user should use FLUSH MASTER instead
+ of FLUSH LOGS for purging.
+ */
+ volatile enum_log_type log_type;
enum cache_type io_cache_type;
+ bool write_error,inited;
+ bool no_rotate;
bool need_start_event;
- pthread_cond_t update_cond;
bool no_auto_events; // for relay binlog
- ulonglong bytes_written;
friend class Log_event;
public:
MYSQL_LOG();
~MYSQL_LOG();
- pthread_mutex_t* get_log_lock() { return &LOCK_log; }
void reset_bytes_written()
- {
- bytes_written = 0;
- }
+ {
+ bytes_written = 0;
+ }
void harvest_bytes_written(ulonglong* counter)
- {
+ {
#ifndef DBUG_OFF
- char buf1[22],buf2[22];
+ char buf1[22],buf2[22];
#endif
- DBUG_ENTER("harvest_bytes_written");
- (*counter)+=bytes_written;
- DBUG_PRINT("info",("counter=%s,bytes_written=%s", llstr(*counter,buf1),
- llstr(bytes_written,buf2)));
- bytes_written=0;
- DBUG_VOID_RETURN;
- }
- IO_CACHE* get_log_file() { return &log_file; }
+ DBUG_ENTER("harvest_bytes_written");
+ (*counter)+=bytes_written;
+ DBUG_PRINT("info",("counter: %s bytes_written: %s", llstr(*counter,buf1),
+ llstr(bytes_written,buf2)));
+ bytes_written=0;
+ DBUG_VOID_RETURN;
+ }
void signal_update() { pthread_cond_broadcast(&update_cond);}
void wait_for_update(THD* thd);
void set_need_start_event() { need_start_event = 1; }
@@ -135,8 +136,8 @@ public:
int purge_logs(THD* thd, const char* to_log);
int purge_first_log(struct st_relay_log_info* rli);
int reset_logs(THD* thd);
- void close(bool exiting = 0); // if we are exiting, we also want to close the
- // index file
+ // if we are exiting, we also want to close the index file
+ void close(bool exiting = 0);
// iterating through the log index file
int find_first_log(LOG_INFO* linfo, const char* log_name,
@@ -146,11 +147,15 @@ public:
uint next_file_id();
inline bool is_open() { return log_type != LOG_CLOSED; }
- char* get_index_fname() { return index_file_name;}
- char* get_log_fname() { return log_file_name; }
- void lock_index() { pthread_mutex_lock(&LOCK_index);}
- void unlock_index() { pthread_mutex_unlock(&LOCK_index);}
- File get_index_file() { return index_file;}
+ inline char* get_index_fname() { return index_file_name;}
+ inline char* get_log_fname() { return log_file_name; }
+ inline pthread_mutex_t* get_log_lock() { return &LOCK_log; }
+ inline IO_CACHE* get_log_file() { return &log_file; }
+
+ inline void lock_index() { pthread_mutex_lock(&LOCK_index);}
+ inline void unlock_index() { pthread_mutex_unlock(&LOCK_index);}
+ inline File get_index_file() { return index_file;}
+ inline uint32 get_open_count() { return open_count; }
};
/* character conversion tables */
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 07e7c5e6680..c37dc1c4f6e 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -332,7 +332,7 @@ bool mysql_change_db(THD *thd,const char *name)
uint db_access;
DBUG_ENTER("mysql_change_db");
- if (!dbname || !(db_length=stripp_sp(dbname)))
+ if (!dbname || !(db_length=strip_sp(dbname)))
{
x_free(dbname); /* purecov: inspected */
send_error(&thd->net,ER_NO_DB_ERROR); /* purecov: inspected */
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index c8ed74c9bca..fd8ef4fb123 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -573,9 +573,15 @@ end:
}
send_ok(&thd->net); // This should return record count
}
+ VOID(pthread_mutex_lock(&LOCK_open));
unlock_table_name(thd, table_list);
+ VOID(pthread_mutex_unlock(&LOCK_open));
}
else if (error)
+ {
+ VOID(pthread_mutex_lock(&LOCK_open));
unlock_table_name(thd, table_list);
+ VOID(pthread_mutex_unlock(&LOCK_open));
+ }
DBUG_RETURN(error ? -1 : 0);
}
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 1e00bb3f8c2..8db2c13b51d 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -332,7 +332,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
{
char buff[160];
if (duplic == DUP_IGNORE)
- sprintf(buff,ER(ER_INSERT_INFO),info.records,info.records-info.copied,
+ sprintf(buff,ER(ER_INSERT_INFO),info.records,
+ (lock_type == TL_WRITE_DELAYED) ? 0 :
+ info.records-info.copied,
thd->cuted_fields);
else
sprintf(buff,ER(ER_INSERT_INFO),info.records,info.deleted,
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index fee60fe225e..9e84330ad25 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -160,7 +160,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
uc->connections = 1;
uc->questions=uc->updates=uc->conn_per_hour=0;
uc->user_resources=*mqh;
- if (mqh->connections > max_user_connections)
+ if (max_user_connections && mqh->connections > max_user_connections)
uc->user_resources.connections = max_user_connections;
uc->intime=thd->thr_create_time;
if (hash_insert(&hash_user_connections, (byte*) uc))
@@ -298,7 +298,7 @@ static int check_for_max_user_connections(USER_CONN *uc)
goto end;
}
uc->connections++;
-if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections)
+ if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections)
{
net_printf(&current_thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_connections",
(long) uc->user_resources.connections);
@@ -317,12 +317,7 @@ static void decrease_user_connections(USER_CONN *uc)
*/
DBUG_ENTER("decrease_user_connections");
- if (mqh_used)
- {
- if (uc->conn_per_hour)
- uc->conn_per_hour--;
- }
- else if (!--uc->connections)
+ if (!mqh_used && uc->connections && !--uc->connections)
{
/* Last connection for user; Delete it */
(void) pthread_mutex_lock(&LOCK_user_conn);
@@ -594,7 +589,7 @@ pthread_handler_decl(handle_one_connection,arg)
#if !defined( __WIN__) && !defined(OS2) // Win32 calls this in pthread_create
// The following calls needs to be done before we call DBUG_ macros
- if (my_thread_init())
+ if (!(test_flags & TEST_NO_THREADS) & my_thread_init())
{
close_connection(&thd->net,ER_OUT_OF_RESOURCES);
statistic_increment(aborted_connects,&LOCK_thread_count);
@@ -1047,7 +1042,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thread_safe_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_thread_count);
char *db=thd->strdup(packet);
// null test to handle EOM
- if (!db || !stripp_sp(db) || check_db_name(db))
+ if (!db || !strip_sp(db) || check_db_name(db))
{
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
break;
@@ -1063,7 +1058,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thread_safe_increment(com_stat[SQLCOM_DROP_DB],&LOCK_thread_count);
char *db=thd->strdup(packet);
// null test to handle EOM
- if (!db || !stripp_sp(db) || check_db_name(db))
+ if (!db || !strip_sp(db) || check_db_name(db))
{
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
break;
@@ -1797,6 +1792,7 @@ mysql_execute_command(void)
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
if ((res=open_and_lock_tables(thd,tables)))
break;
+ thd->select_limit=HA_POS_ERROR;
if (!setup_fields(thd,tables,select_lex->item_list,1,0,0) &&
!setup_fields(thd,tables,lex->value_list,0,0,0) && ! thd->fatal_error &&
(result=new multi_update(thd,tables,select_lex->item_list,lex->duplicates,
@@ -1964,13 +1960,9 @@ mysql_execute_command(void)
}
auxi->lock_type=walk->lock_type=TL_WRITE;
auxi->table= (TABLE *) walk; // Remember corresponding table
+ (void)add_item_to_list(new Item_field(auxi->db,auxi->real_name,"*"));
}
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
- if (add_item_to_list(new Item_null()))
- {
- res= -1;
- break;
- }
thd->proc_info="init";
if ((res=open_and_lock_tables(thd,tables)))
break;
@@ -2241,7 +2233,7 @@ mysql_execute_command(void)
break;
case SQLCOM_CREATE_DB:
{
- if (!stripp_sp(lex->name) || check_db_name(lex->name))
+ if (!strip_sp(lex->name) || check_db_name(lex->name))
{
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
break;
@@ -2253,7 +2245,7 @@ mysql_execute_command(void)
}
case SQLCOM_DROP_DB:
{
- if (!stripp_sp(lex->name) || check_db_name(lex->name))
+ if (!strip_sp(lex->name) || check_db_name(lex->name))
{
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
break;
@@ -2440,7 +2432,6 @@ mysql_execute_command(void)
}
else
res= -1;
- thd->transaction.cleanup();
break;
}
case SQLCOM_ROLLBACK:
@@ -2455,7 +2446,6 @@ mysql_execute_command(void)
else
res= -1;
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
- thd->transaction.cleanup();
break;
default: /* Impossible */
send_ok(&thd->net);
@@ -2574,8 +2564,17 @@ check_table_access(THD *thd,uint want_access,TABLE_LIST *tables,
}
}
else if (check_access(thd,want_access,tables->db,&tables->grant.privilege,
+ 0, no_errors | grant_option))
+ {
+ if (grant_option)
+ {
+ if ( check_access(thd,want_access & (uint) ~TABLE_ACLS,tables->db,&tables->grant.privilege,
0, no_errors))
- return TRUE; // Access denied
+ return TRUE;
+ }
+ else
+ return TRUE;
+ }
}
if (grant_option)
return check_grant(thd,want_access & ~EXTRA_ACL,org_tables,
@@ -2746,7 +2745,7 @@ void mysql_init_multi_delete(LEX *lex)
{
lex->sql_command = SQLCOM_DELETE_MULTI;
mysql_init_select(lex);
- lex->select->select_limit=HA_POS_ERROR;
+ lex->select->select_limit=lex->thd->select_limit=HA_POS_ERROR;
lex->auxilliary_table_list=lex->select_lex.table_list;
lex->select->table_list.elements=0;
lex->select->table_list.first=0;
@@ -2890,6 +2889,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
case FIELD_TYPE_STRING:
case FIELD_TYPE_VAR_STRING:
case FIELD_TYPE_NULL:
+ case FIELD_TYPE_GEOMETRY:
break;
case FIELD_TYPE_DECIMAL:
if (!length)
@@ -2991,7 +2991,9 @@ bool add_field_to_list(char *field_name, enum_field_types type,
new_field->interval=interval;
new_field->length=0;
for (const char **pos=interval->type_names; *pos ; pos++)
- new_field->length+=(uint) strlen(*pos)+1;
+ {
+ new_field->length+=(uint) strip_sp((char*) *pos)+1;
+ }
new_field->length--;
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
if (default_value)
@@ -3012,10 +3014,10 @@ bool add_field_to_list(char *field_name, enum_field_types type,
{
new_field->interval=interval;
new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe
- new_field->length=(uint) strlen(interval->type_names[0]);
+ new_field->length=(uint) strip_sp((char*) interval->type_names[0]);
for (const char **pos=interval->type_names+1; *pos ; pos++)
{
- uint length=(uint) strlen(*pos);
+ uint length=(uint) strip_sp((char*) *pos);
set_if_bigger(new_field->length,length);
}
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 398ff443ad4..415007b38fa 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -27,11 +27,9 @@
extern const char* any_db;
-#ifndef DBUG_OFF
int max_binlog_dump_events = 0; // unlimited
bool opt_sporadic_binlog_dump_fail = 0;
static int binlog_dump_count = 0;
-#endif
int check_binlog_magic(IO_CACHE* log, const char** errmsg)
{
@@ -156,6 +154,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
const char **errmsg)
{
File file;
+ DBUG_ENTER("open_binlog");
if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0 ||
init_io_cache(log, file, IO_SIZE*2, READ_CACHE, 0, 0,
@@ -166,7 +165,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
}
if (check_binlog_magic(log,errmsg))
goto err;
- return file;
+ DBUG_RETURN(file);
err:
if (file >= 0)
@@ -174,7 +173,7 @@ err:
my_close(file,MYF(0));
end_io_cache(log);
}
- return -1;
+ DBUG_RETURN(-1);
}
@@ -630,7 +629,8 @@ int reset_slave(MASTER_INFO* mi)
char fname[FN_REFLEN];
int restart_thread_mask = 0,error=0;
const char* errmsg=0;
-
+ DBUG_ENTER("reset_slave");
+
lock_slave_threads(mi);
init_thread_mask(&restart_thread_mask,mi,0 /* not inverse */);
if ((error=terminate_slave_threads(mi,restart_thread_mask,1 /*skip lock*/))
@@ -651,14 +651,14 @@ int reset_slave(MASTER_INFO* mi)
goto err;
}
if (restart_thread_mask)
- error=start_slave_threads(0 /* mutex not needed*/,
- 1 /* wait for start*/,
- mi,master_info_file,relay_log_info_file,
- restart_thread_mask);
+ error=start_slave_threads(0 /* mutex not needed */,
+ 1 /* wait for start*/,
+ mi,master_info_file,relay_log_info_file,
+ restart_thread_mask);
// TODO: fix error messages so they get to the client
err:
unlock_slave_threads(mi);
- return error;
+ DBUG_RETURN(error);
}
void kill_zombie_dump_threads(uint32 slave_server_id)
diff --git a/sql/sql_repl.h b/sql/sql_repl.h
index 360fd50a1e3..b15c72a0bde 100644
--- a/sql/sql_repl.h
+++ b/sql/sql_repl.h
@@ -21,10 +21,8 @@ extern uint32 server_id;
extern bool server_id_supplied;
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
-#ifndef DBUG_OFF
extern int max_binlog_dump_events;
extern bool opt_sporadic_binlog_dump_fail;
-#endif
#define KICK_SLAVE(thd) thd->awake(0 /* do not prepare to die*/);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6e819150692..3feb0fdddc3 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -135,7 +135,7 @@ static TABLE *get_sort_by_table(ORDER *a,ORDER *b,TABLE_LIST *tables);
static void calc_group_buffer(JOIN *join,ORDER *group);
static bool alloc_group_fields(JOIN *join,ORDER *group);
static bool make_sum_func_list(JOIN *join,List<Item> &fields);
-static bool change_to_use_tmp_fields(List<Item> &func);
+static bool change_to_use_tmp_fields(List<Item> &func, bool change=false);
static bool change_refs_to_tmp_fields(THD *thd, List<Item> &func);
static void init_tmptable_sum_functions(Item_sum **func);
static void update_tmptable_sum_func(Item_sum **func,TABLE *tmp_table);
@@ -788,7 +788,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
tmp_table=tmp_table2;
join.join_tab[0].table=0; // Table is freed
- if (change_to_use_tmp_fields(all_fields)) // No sum funcs anymore
+ if (change_to_use_tmp_fields(all_fields,true)) // No sum funcs anymore
goto err;
join.tmp_table_param.field_count+=join.tmp_table_param.sum_func_count;
join.tmp_table_param.sum_func_count=0;
@@ -6764,7 +6764,7 @@ make_sum_func_list(JOIN *join,List<Item> &fields)
*/
static bool
-change_to_use_tmp_fields(List<Item> &items)
+change_to_use_tmp_fields(List<Item> &items, bool change)
{
List_iterator<Item> it(items);
Item *item_field,*item;
@@ -6776,6 +6776,11 @@ change_to_use_tmp_fields(List<Item> &items)
continue;
if (item->type() == Item::FIELD_ITEM)
{
+ if (change)
+ {
+ ((Item_field*) item)->result_field->null_ptr=0;
+ item->maybe_null=0;
+ }
((Item_field*) item)->field=
((Item_field*) item)->result_field;
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 9fb1e88aeea..e0ce0f0f793 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -432,6 +432,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
TABLE *table;
handler *file;
char tmp[MAX_FIELD_WIDTH];
+ Item *item;
CONVERT *convert=thd->convert_set;
DBUG_ENTER("mysqld_show_fields");
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
@@ -451,7 +452,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
field_list.push_back(new Item_empty_string("Type",40));
field_list.push_back(new Item_empty_string("Null",1));
field_list.push_back(new Item_empty_string("Key",3));
- field_list.push_back(new Item_empty_string("Default",NAME_LEN));
+ field_list.push_back(item=new Item_empty_string("Default",NAME_LEN));
+ item->maybe_null=1;
field_list.push_back(new Item_empty_string("Extra",20));
if (verbose)
field_list.push_back(new Item_empty_string("Privileges",80));
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 64a55380b69..fe66b14d697 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1235,7 +1235,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd->proc_info="init";
table_name=table_list->real_name;
db=table_list->db;
- if (!new_db)
+ if (!new_db || !strcmp(new_db,db))
new_db=db;
used_fields=create_info->used_fields;
@@ -1289,10 +1289,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* In some simple cases we need not to recreate the table */
thd->proc_info="setup";
- if (simple_alter)
+ if (simple_alter && !table->tmp_table)
{
error=0;
- if (new_name != table_name)
+ if (new_name != table_name || new_db != db)
{
thd->proc_info="rename";
VOID(pthread_mutex_lock(&LOCK_open));
@@ -1315,15 +1315,15 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
if (!error)
{
- switch (keys_onoff)
- {
- case LEAVE_AS_IS: break;
- case ENABLE:
- error=table->file->activate_all_index(thd);
- break;
- case DISABLE:
- table->file->deactivate_non_unique_index(HA_POS_ERROR);
- break;
+ switch (keys_onoff) {
+ case LEAVE_AS_IS:
+ break;
+ case ENABLE:
+ error=table->file->activate_all_index(thd);
+ break;
+ case DISABLE:
+ table->file->deactivate_non_unique_index(HA_POS_ERROR);
+ break;
}
}
if (!error)
@@ -1720,7 +1720,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd->proc_info="rename result table";
sprintf(old_name,"%s2-%lx-%lx", tmp_file_prefix, current_pid,
thd->thread_id);
- if (new_name != table_name)
+ if (new_name != table_name || new_db != db)
{
if (!access(new_name_buff,F_OK))
{
@@ -1738,7 +1738,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
/*
Win32 and InnoDB can't drop a table that is in use, so we must
- close all the original table at before doing the rename
+ close the original table at before doing the rename
*/
table_name=thd->strdup(table_name); // must be saved
if (close_cached_table(thd,table))
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index ba07aab2859..2dd25a57478 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1069,7 +1069,8 @@ attribute:
| AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
| PRIMARY_SYM KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
- | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; };
+ | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
+ | COMMENT_SYM text_literal {};
opt_binary:
/* empty */ {}
@@ -1203,8 +1204,7 @@ alter_list_item:
lex->length,lex->dec,lex->type,
lex->default_value, $3.str,
lex->interval))
- YYABORT;
- lex->simple_alter=0;
+ YYABORT;
}
opt_place
| DROP opt_column field_ident opt_restrict
@@ -1245,7 +1245,6 @@ alter_list_item:
LEX *lex=Lex;
lex->select->db=$3->db.str;
lex->name= $3->table.str;
- lex->simple_alter=0;
}
| create_table_options { Lex->simple_alter=0; }
| order_clause { Lex->simple_alter=0; };
diff --git a/sql/table.h b/sql/table.h
index 209333c24b7..78f80045b21 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -154,7 +154,7 @@ typedef struct st_table_list {
typedef struct st_changed_table_list {
struct st_changed_table_list *next;
- char *key, *table_name;
+ char *key;
uint32 key_length;
} CHANGED_TABLE_LIST;
diff --git a/sql/unireg.h b/sql/unireg.h
index 5a61f4a6c12..e8fdd5dd5dd 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -129,6 +129,10 @@ bfill((A)->null_flags,(A)->null_bytes,255);\
*/
#define MIN_TURBOBM_PATTERN_LEN 3
+/* Defines for binary logging */
+
+#define BIN_LOG_HEADER_SIZE 4
+
/* Include prototypes for unireg */
#include "mysqld_error.h"
diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh
index ce9b5b18586..88d83afb986 100644
--- a/support-files/my-huge.cnf.sh
+++ b/support-files/my-huge.cnf.sh
@@ -35,8 +35,23 @@ set-variable = thread_cache=8
# Try number of CPU's*2 for thread_concurrency
set-variable = thread_concurrency=8
set-variable = myisam_sort_buffer_size=64M
-log-bin
-server-id = 1
+
+# Replication Master Server (default)
+log-bin # required for replication
+server-id = 1 # required unique id between 1 and 2^32 - 1
+ # defaults to 1 if master-host is not set
+ # but will not function as a master if omitted
+
+# Replication Slave Server (comment out master section to use this)
+#master-host = # MUST BE SET
+#master-user = # MUST BE SET
+#master-password = # MUST BE SET
+#master-port = # optional--defaults to 3306
+#log-bin # not required for slaves, but recommended
+#server-id = 2 # required unique id between 2 and 2^32 - 1
+ # (and different from the master)
+ # defaults to 2 if master-host is set
+ # but will not function as a slave if omitted
# Point the following paths to different dedicated disks
#tmpdir = /tmp/
diff --git a/tests/truncate.pl b/tests/truncate.pl
new file mode 100755
index 00000000000..57b50cf96b6
--- /dev/null
+++ b/tests/truncate.pl
@@ -0,0 +1,125 @@
+#!/usr/bin/perl -w
+#
+# This is a test with uses many processes to test a MySQL server.
+#
+
+$opt_loop_count=10000; # Change this to make test harder/easier
+
+##################### Standard benchmark inits ##############################
+
+use DBI;
+use Getopt::Long;
+use Benchmark;
+
+package main;
+
+$opt_skip_create=$opt_skip_in=$opt_verbose=$opt_fast_insert=
+$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=0;
+$opt_threads=2;
+$opt_host=$opt_user=$opt_password=""; $opt_db="test";
+
+GetOptions("host=s","db=s","user=s","password=s","loop-count=i","skip-create","skip-in","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","threads=i") || die "Aborted";
+$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$opt_force=undef; # Ignore warnings from these
+
+print "Testing truncate from $opt_threads multiple connections $opt_loop_count times\n";
+
+@testtables = ( ["bench_f31", "type=heap"]);
+
+####
+#### Start timeing and start test
+####
+
+$start_time=new Benchmark;
+$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+if (!$opt_skip_create)
+{
+ my $table_def;
+ foreach $table_def (@testtables)
+ {
+ my ($table,$extra)= ($table_def->[0], $table_def->[1]);
+ print "Creating table $table in database $opt_db\n";
+ $dbh->do("drop table if exists $table");
+ $dbh->do("create table $table".
+ " (id int(6) not null,".
+ " info varchar(32)," .
+ " marker timestamp," .
+ " flag int not null," .
+ " primary key(id)) $extra")
+
+ or die $DBI::errstr;
+ }
+}
+
+$dbh->disconnect; $dbh=0; # Close handler
+$|= 1; # Autoflush
+
+####
+#### Start the tests
+####
+
+for ($i=0 ; $i < $opt_threads ; $i ++)
+{
+ test_truncate() if (($pid=fork()) == 0); $work{$pid}="truncate";
+}
+
+print "Started $opt_threads threads\n";
+
+$errors=0;
+$running_insert_threads=$opt_threads;
+while (($pid=wait()) != -1)
+{
+ $ret=$?/256;
+ print "thread '" . $work{$pid} . "' finished with exit code $ret\n";
+ --$running_insert_threads;
+ $errors++ if ($ret != 0);
+}
+
+#
+# Cleanup
+#
+
+if (!$opt_skip_delete && !$errors)
+{
+ my $table_def;
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ foreach $table_def (@testtables)
+ {
+ $dbh->do("drop table " . $table_def->[0]);
+ }
+ $dbh->disconnect; $dbh=0; # Close handler
+}
+
+print ($errors ? "Test failed\n" :"Test ok\n");
+$end_time=new Benchmark;
+print "Total time: " .
+ timestr(timediff($end_time, $start_time),"noc") . "\n";
+
+exit(0);
+
+
+#
+# Insert records in the table
+#
+
+sub test_truncate
+{
+ my ($dbh,$i,$j,$count,$table_def,$table);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ for ($count=0; $count < $opt_loop_count ; $count++)
+ {
+ my ($table)= ($testtables[0]->[0]);
+ $dbh->do("truncate table $table") || die "Got error on truncate: $DBI::errstr\n";
+ }
+ $dbh->disconnect; $dbh=0;
+ print "Test_truncate: Run $count times\n";
+ exit(0);
+}
diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c
index c8abb996794..82bc149ab34 100644
--- a/tools/mysqlmanager.c
+++ b/tools/mysqlmanager.c
@@ -41,8 +41,8 @@
#include <sys/wait.h>
#endif
-#define MANAGER_VERSION "1.1"
-#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.0"
+#define MANAGER_VERSION "1.2"
+#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.2"
#define LOG_ERR 1
#define LOG_WARN 2
@@ -1332,11 +1332,8 @@ static int parse_args(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}
diff --git a/vio/test-sslserver.c b/vio/test-sslserver.c
index a9e28ac7a58..f0116a2817d 100644
--- a/vio/test-sslserver.c
+++ b/vio/test-sslserver.c
@@ -36,12 +36,14 @@ const char *VER="0.2";
const char *default_dbug_option="d:t:O,-";
#endif
+#if 0
static void
fatal_error( const char* r)
{
perror(r);
exit(0);
}
+#endif
typedef struct {
int sd;
@@ -70,13 +72,13 @@ do_ssl_stuff( TH_ARGS* args)
static void*
client_thread( void* arg)
{
- my_thread_init();
- do_ssl_stuff((TH_ARGS*)arg);
+ my_thread_init();
+ do_ssl_stuff((TH_ARGS*)arg);
+ return 0;
}
int
-main( int argc __attribute__((unused)),
- char** argv)
+main(int argc __attribute__((unused)), char** argv)
{
char server_key[] = "../SSL/server-key.pem",
server_cert[] = "../SSL/server-cert.pem";