summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <peter@mysql.com>2002-09-14 22:45:09 +0400
committerunknown <peter@mysql.com>2002-09-14 22:45:09 +0400
commit2808e52d8d361d5c5d4381c52cf967a2a55ff694 (patch)
treed189390a715f5ed1669ee310b54d09e360fa67fd
parent7e173bf3d35b6782c0d43ad8ac706c31ef557e7b (diff)
parent4240a7f13da55a1051e5685d56188e26032c1781 (diff)
downloadmariadb-git-2808e52d8d361d5c5d4381c52cf967a2a55ff694.tar.gz
Merge mysql.com:/home/pz/mysql/mysql-4.0-root
into mysql.com:/home/pz/mysql/mysql-4.0 BitKeeper/deleted/.del-rpl_flush_log_loop-master.opt: Delete: mysql-test/t/rpl_flush_log_loop-master.opt BitKeeper/deleted/.del-rpl_flush_log_loop-slave.opt: Delete: mysql-test/t/rpl_flush_log_loop-slave.opt BitKeeper/deleted/.del-rpl_flush_log_loop.test: Delete: mysql-test/t/rpl_flush_log_loop.test
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--Docs/manual.texi179
-rw-r--r--client/mysqlbinlog.cc40
-rw-r--r--client/mysqltest.c102
-rw-r--r--configure.in10
-rw-r--r--include/my_sys.h19
-rw-r--r--innobase/btr/btr0cur.c2
-rw-r--r--libmysql/libmysql.c44
-rw-r--r--myisam/mi_create.c3
-rw-r--r--mysql-test/mysql-test-run.sh9
-rw-r--r--mysql-test/r/distinct.result15
-rw-r--r--mysql-test/r/grant.result3
-rw-r--r--mysql-test/r/innodb.result2
-rw-r--r--mysql-test/r/myisam.result6
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result17
-rw-r--r--mysql-test/r/rpl_log.result47
-rw-r--r--mysql-test/r/rpl_magic.result37
-rw-r--r--mysql-test/r/rpl_redirect.result43
-rw-r--r--mysql-test/r/rpl_rotate_logs.result6
-rw-r--r--mysql-test/r/variables.result2
-rw-r--r--mysql-test/t/distinct.test24
-rw-r--r--mysql-test/t/grant.test1
-rw-r--r--mysql-test/t/myisam.test10
-rw-r--r--mysql-test/t/rpl_flush_log_loop-master.opt2
-rw-r--r--mysql-test/t/rpl_flush_log_loop-slave.opt2
-rw-r--r--mysql-test/t/rpl_flush_log_loop.test2
-rw-r--r--mysql-test/t/rpl_log.test40
-rw-r--r--mysql-test/t/rpl_mystery22.test2
-rw-r--r--mysql-test/t/rpl_redirect.test (renamed from mysql-test/t/rpl_magic.test)13
-rw-r--r--mysql-test/t/rpl_rotate_logs.test7
-rw-r--r--mysys/my_malloc.c12
-rw-r--r--mysys/safemalloc.c14
-rw-r--r--mysys/thr_alarm.c4
-rw-r--r--sql/ha_innodb.cc33
-rw-r--r--sql/ha_innodb.h5
-rw-r--r--sql/item_func.cc12
-rw-r--r--sql/log.cc9
-rw-r--r--sql/log_event.cc75
-rw-r--r--sql/log_event.h7
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/opt_range.cc8
-rw-r--r--sql/repl_failsafe.cc20
-rw-r--r--sql/slave.cc123
-rw-r--r--sql/slave.h1
-rw-r--r--sql/sql_acl.cc16
-rw-r--r--sql/sql_parse.cc5
-rw-r--r--sql/sql_repl.cc13
-rw-r--r--sql/sql_select.cc6
-rw-r--r--sql/sql_table.cc2
-rw-r--r--sql/sql_udf.cc14
51 files changed, 615 insertions, 458 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 6318a413179..c61cab617ba 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -80,3 +80,4 @@ worm@altair.is.lan
zak@balfor.local
zak@linux.local
zgreant@mysql.com
+vva@genie.(none)
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 2b1104806b7..807a4fc666c 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -1793,7 +1793,7 @@ and @code{row-level locking}.
@item
Our German, Austrian, and Swiss users will note that we have a new character
-set, @code{latin_de}, which corrects the @emph{German sorting order},
+set, @code{latin1_de}, which corrects the @emph{German sorting order},
placing German umlauts in the same order as German telephone books.
@item
@@ -3409,9 +3409,6 @@ database if you are not using the @code{-A} option or if you are using
@code{rehash}. This is especially notable when you have a big table
cache.
-@item
-The current replication protocol cannot deal with @code{LOAD DATA INFILE}
-and line terminator characters of more than 1 character.
@end itemize
The following problems are known and will be fixed in due time:
@@ -3423,6 +3420,10 @@ When using @code{SET CHARACTER SET}, one can't use translated
characters in database, table, and column names.
@item
+One can't use @code{_} or @code{%} with @code{ESCAPE} in @code{LIKE
+... ESCAPE}.
+
+@item
If you have a @code{DECIMAL} column with a number stored in different
formats (+01.00, 1.00, 01.00), @code{GROUP BY} may regard each value
as a different value.
@@ -14933,7 +14934,7 @@ system. This section describes how it works.
Anyone using MySQL on a computer connected to the Internet
should read this section to avoid the most common security mistakes.
-In discussing security, we emphasize the necessity of fully protecting the
+In discussing security, we emphasise the necessity of fully protecting the
entire server host (not simply the MySQL server) against all types
of applicable attacks: eavesdropping, altering, playback, and denial of
service. We do not cover all aspects of availability and fault tolerance
@@ -19647,7 +19648,7 @@ is high, it is a good indication that your queries and tables are properly index
@item @code{Handler_read_next} @tab Number of requests to read next row in key order. This
will be incremented if you are querying an index column with a range constraint. This also
will be incremented if you are doing an index scan.
-@item @code{Handler_read_prev} @tab Number of requests to read previous row in key order. This is mainly used to optimize @code{ORDER BY ... DESC}.
+@item @code{Handler_read_prev} @tab Number of requests to read previous row in key order. This is mainly used to optimise @code{ORDER BY ... DESC}.
@item @code{Handler_read_rnd} @tab Number of requests to read a row based on a fixed position.
This will be high if you are doing a lot of queries that require sorting of the result.
@item @code{Handler_read_rnd_next} @tab Number of requests to read the next row in the datafile.
@@ -20614,7 +20615,7 @@ but normally this is never needed.
@subsubsection German character set
To get German sorting order, you should start @code{mysqld} with
-@code{--default-character-set=latin_de}. This will give you the following
+@code{--default-character-set=latin1_de}. This will give you the following
characteristics.
When sorting and comparing string's the following mapping is done on the
@@ -20720,7 +20721,7 @@ When defining the character set, every word must be a number in hexadecimal
format
@item
The @code{ctype} array takes up the first 257 words. The
-@code{to_lower}, @code{to_upper} and @code{sort_order} arrays take up
+@code{to_lower[]}, @code{to_upper[]} and @code{sort_order[]} arrays take up
256 words each after that.
@end itemize
@@ -20881,9 +20882,10 @@ multi-byte characters, you need to use the multi-byte character
functions.
Right now the best documentation on this is the character sets that are
-already implemented. Look at the euc_kr, gb2312, gbk, sjis and ujis
-character sets for examples. These are implemented in the
-@code{ctype-'charset'.c} files in the @file{strings} directory.
+already implemented. Look at the @code{euc_kr}, @code{gb2312},
+@code{gbk}, @code{sjis}, and @code{ujis} character sets for
+examples. These are implemented in the @file{ctype-'charset'.c} files
+in the @file{strings} directory.
You must specify the @code{mbmaxlen_MYSET=N} value in the special
comment at the top of the source file. @code{N} should be set to the
@@ -20921,7 +20923,7 @@ In this case you should either get a new @code{Index} file or add
by hand the name of any missing character sets.
@end itemize
-For MyISAM tables, you can check the character set name and number for a
+For @code{MyISAM} tables, you can check the character set name and number for a
table with @code{myisamchk -dvv table_name}.
@@ -23672,7 +23674,7 @@ For more details, please see @ref{Replication FAQ}.
If you want to become a real MySQL replication guru, we suggest that you
begin by studying, pondering, and trying all commands
-mentioned in @ref{Replication SQL}. You should also familiarize yourself
+mentioned in @ref{Replication SQL}. You should also familiarise yourself
with replication startup options in @file{my.cnf} in
@ref{Replication Options}.
@@ -23960,7 +23962,7 @@ the slave. The other bug is that if the ignored table gets partially
updated, the slave thread will not notice that the table actually should
have been ignored and will suspend the replication process. While the
above bugs are conceptually very simple to fix, we have not yet found a way
-to do this without a sigficant code change that would compromize the stability
+to do this without a significant code change that would compromise the stability
status of 3.23 branch. There exists a workaround for both if in the rare case
it happens to affect your application -- use @code{slave-skip-errors}.
@end itemize
@@ -25473,7 +25475,7 @@ this join type is good.
Only rows that are in a given range will be retrieved, using an index to
select the rows. The @code{key} column indicates which index is used.
The @code{key_len} contains the longest key part that was used.
-The @code{ref} column will be NULL for this type.
+The @code{ref} column will be @code{NULL} for this type.
@item index
This is the same as @code{ALL}, except that only the index tree is
@@ -25764,8 +25766,9 @@ Constant condition removal (needed because of constant folding):
Constant expressions used by indexes are evaluated only once.
@item
@code{COUNT(*)} on a single table without a @code{WHERE} is retrieved
-directly from the table information for MyISAM and HEAP tables. This is
-also done for any @code{NOT NULL} expression when used with only one table.
+directly from the table information for @code{MyISAM} and @code{HEAP} tables.
+This is also done for any @code{NOT NULL} expression when used with only one
+table.
@item
Early detection of invalid constant expressions. MySQL quickly
detects that some @code{SELECT} statements are impossible and returns no rows.
@@ -25876,9 +25879,9 @@ the scanning of the not used tables as soon as it has found the first match.
SELECT DISTINCT t1.a FROM t1,t2 where t1.a=t2.a;
@end example
-In the case, assuming t1 is used before t2 (check with @code{EXPLAIN}), then
-MySQL will stop reading from t2 (for that particular row in t1)
-when the first row in t2 is found.
+In the case, assuming @code{t1} is used before @code{t2} (check with
+@code{EXPLAIN}), then MySQL will stop reading from @code{t2} (for that
+particular row in @code{t1}) when the first row in @code{t2} is found.
@node LEFT JOIN optimisation, ORDER BY optimisation, DISTINCT optimisation, Query Speed
@@ -25996,7 +25999,7 @@ do the @code{ORDER BY}:
@item
You are joining many tables and the columns you are doing an @code{ORDER
-BY} on are not all from the first not-const table that is used to
+BY} on are not all from the first not-@code{const} table that is used to
retrieve rows (This is the first table in the @code{EXPLAIN} output which
doesn't use a @code{const} row fetch method).
@@ -26021,7 +26024,7 @@ algorithm:
@itemize @bullet
@item
Read all rows according to key or by table scanning.
-Rows that doesn't match the WHERE clause are skipped.
+Rows that don't match the @code{WHERE} clause are skipped.
@item
Store the sort-key in a buffer (of size @code{sort_buffer}).
@item
@@ -26196,11 +26199,11 @@ flush-tables}.
Note that @code{LOAD DATA INFILE} also does the above optimisation if
you insert into an empty table; the main difference with the above
-procedure is that you can let myisamchk allocate much more temporary
+procedure is that you can let @code{myisamchk} allocate much more temporary
memory for the index creation that you may want MySQL to allocate for
every index recreation.
-Since @strong{MySQL 4.0} you can also use
+Since MySQL 4.0 you can also use
@code{ALTER TABLE tbl_name DISABLE KEYS} instead of
@code{myisamchk --keys-used=0 -rq /path/to/db/tbl_name} and
@code{ALTER TABLE tbl_name ENABLE KEYS} instead of
@@ -26303,8 +26306,8 @@ Always check that all your queries really use the indexes you have created
in the tables. In MySQL you can do this with the @code{EXPLAIN}
command. @xref{EXPLAIN, Explain, Explain, manual}.
@item
-Try to avoid complex @code{SELECT} queries on MyISAM tables that are updated a
-lot. This is to avoid problems with table locking.
+Try to avoid complex @code{SELECT} queries on @code{MyISAM} tables that are
+updated a lot. This is to avoid problems with table locking.
@item
The new @code{MyISAM} tables can insert rows in a table without deleted
rows at the same time another table is reading from it. If this is important
@@ -26312,7 +26315,7 @@ for you, you should consider methods where you don't have to delete rows
or run @code{OPTIMIZE TABLE} after you have deleted a lot of rows.
@item
Use @code{ALTER TABLE ... ORDER BY expr1,expr2...} if you mostly
-retrieve rows in expr1,expr2... order. By using this option after big
+retrieve rows in @code{expr1,expr2...} order. By using this option after big
changes to the table, you may be able to get higher performance.
@item
In some cases it may make sense to introduce a column that is 'hashed'
@@ -26342,7 +26345,8 @@ introduce a new table and update the counter in real time. An update of
type @code{UPDATE table set count=count+1 where index_column=constant}
is very fast!
-This is really important when you use databases like MySQL that
+This is really important when you use MySQL table types like MyISAM and
+ISAM that
only have table locking (multiple readers / single writers). This will
also give better performance with most databases, as the row locking
manager in this case will have less to do.
@@ -26580,7 +26584,7 @@ As updates on tables normally are considered to be more important than
than statements that retrieve information from a table. This should
ensure that updates are not 'starved' because one issues a lot of heavy
queries against a specific table. (You can change this by using
-LOW_PRIORITY with the statement that does the update or
+@code{LOW_PRIORITY} with the statement that does the update or
@code{HIGH_PRIORITY} with the @code{SELECT} statement.)
Starting from MySQL Version 3.23.7 one can use the
@@ -26625,7 +26629,7 @@ You can give a specific @code{INSERT}, @code{UPDATE}, or @code{DELETE}
statement lower priority with the @code{LOW_PRIORITY} attribute.
@item
-Start @code{mysqld} with a low value for @strong{max_write_lock_count} to give
+Start @code{mysqld} with a low value for @code{max_write_lock_count} to give
@code{READ} locks after a certain number of @code{WRITE} locks.
@item
@@ -26750,7 +26754,7 @@ having it on all columns by default.
If you don't have any variable-length columns (@code{VARCHAR},
@code{TEXT}, or @code{BLOB} columns), a fixed-size record format is
used. This is faster but unfortunately may waste some space.
-@xref{MyISAM table formats}.
+@xref{MyISAM table formats, , @code{MyISAM} table formats}.
@item
The primary index of a table should be as short as possible. This makes
@@ -27079,9 +27083,9 @@ MySQL is multi-threaded, so it may have many queries on the same table
simultaneously. To minimise the problem with two threads having
different states on the same file, the table is opened independently by
each concurrent thread. This takes some memory but will normaly increase
-performance. Wth ISAM and MyISAM tables this also requires one extra file
-descriptor for the datafile. With these table types the index file
-descriptor is shared between all threads.
+performance. Wth @code{ISAM} and @code{MyISAM} tables this also requires
+one extra file descriptor for the datafile. With these table types the index
+file descriptor is shared between all threads.
You can read more about this topic in the next section. @xref{Table cache}.
@@ -27114,7 +27118,7 @@ Make sure that your operating system can handle the number of open file
descriptors implied by the @code{table_cache} setting. If
@code{table_cache} is set too high, MySQL may run out of file
descriptors and refuse connections, fail to perform queries, and be very
-unreliable. You also have to take into account that the MyISAM table
+unreliable. You also have to take into account that the @code{MyISAM} table
handler needs two file descriptors for each unique open table. You can
in increase the number of file descriptors available for MySQL with
the @code{--open-files-limit=#} startup option. @xref{Not enough file
@@ -27139,7 +27143,7 @@ a thread is no longer using a table.
When someone executes @code{mysqladmin refresh} or
@code{mysqladmin flush-tables}.
@item
-When someone executes 'FLUSH TABLES'
+When someone executes a @code{FLUSH TABLES} statement.
@end itemize
When the table cache fills up, the server uses the following procedure
@@ -27172,9 +27176,9 @@ statement, a dedicated table object is allocated for the thread.
This table object is not shared by other threads an will not be closed
until the thread calls @code{HANDLER table_name CLOSE} or the thread dies.
@xref{HANDLER, , @code{HANDLER}}. When this happens, the table is put
-back in the table_cache (if it isn't full).
+back in the table cache (if it isn't full).
-You can check if your table cache is too small by checking the mysqld
+You can check if your table cache is too small by checking the @code{mysqld}
variable @code{Opened_tables}. If this is quite big, even if you
haven't done a lot of @code{FLUSH TABLES}, you should increase your table
cache. @xref{SHOW STATUS, , @code{SHOW STATUS}}.
@@ -27491,7 +27495,7 @@ threads on a single processor. With more load/CPUs the difference should
get bigger.
@item
-Running with @code{--log-bin} makes @strong{[MySQL} 1% slower.
+Running with @code{--log-bin} makes MySQL 1% slower.
@item
Compiling on Linux-x86 using gcc without frame pointers
@@ -27535,8 +27539,8 @@ a query is running, a copy of the current query string is also allocated.
All threads share the same base memory.
@item
-Only the compressed ISAM / MyISAM tables are memory mapped. This is
-because the 32-bit memory space of 4GB is not large enough for most
+Only the compressed @code{ISAM} / @code{MyISAM} tables are memory mapped. This
+is because the 32-bit memory space of 4GB is not large enough for most
big tables. When systems with a 64-bit address space become more
common we may add general support for memory mapping.
@@ -27551,20 +27555,20 @@ random-read buffer is allocated to avoid disk seeks.
@item
All joins are done in one pass, and most joins can be done without even
-using a temporary table. Most temporary tables are memory-based (HEAP)
+using a temporary table. Most temporary tables are memory-based (@code{HEAP})
tables. Temporary tables with a big record length (calculated as the
sum of all column lengths) or that contain @code{BLOB} columns are
stored on disk.
-One problem in MySQL versions before Version 3.23.2 is that if a HEAP table
-exceeds the size of @code{tmp_table_size}, you get the error @code{The
+One problem in MySQL versions before Version 3.23.2 is that if a @code{HEAP}
+table exceeds the size of @code{tmp_table_size}, you get the error @code{The
table tbl_name is full}. In newer versions this is handled by
-automatically changing the in-memory (HEAP) table to a disk-based
-(MyISAM) table as necessary. To work around this problem, you can
+automatically changing the in-memory (@code{HEAP}) table to a disk-based
+(@code{MyISAM}) table as necessary. To work around this problem, you can
increase the temporary table size by setting the @code{tmp_table_size}
option to @code{mysqld}, or by setting the SQL option
@code{BIG_TABLES} in the client program. @xref{SET OPTION, ,
-@code{SET}}. In MySQL Version 3.20, the maximum size of the
+@code{SET} Syntax}. In MySQL Version 3.20, the maximum size of the
temporary table was @code{record_buffer*16}, so if you are using this
version, you have to increase the value of @code{record_buffer}. You can
also start @code{mysqld} with the @code{--big-tables} option to always
@@ -27767,9 +27771,11 @@ you would write:
@example
mysql> SET PASSWORD FOR bob@@"%.loc.gov" = PASSWORD("newpass");
+@end example
-or
+Which is equivalent to:
+@example
mysql> UPDATE mysql.user SET password=PASSWORD("newpass")
-> WHERE user="bob' AND host="%.loc.gov";
@end example
@@ -27953,8 +27959,8 @@ inode and by this will avoid some disk seeks.
@item
On Linux, you can get much more performance (up to 100% under load is
-not uncommon) by using hdparm to configure your disk's interface! The
-following should be quite good hdparm options for MySQL (and
+not uncommon) by using @code{hdparm} to configure your disk's interface! The
+following should be quite good @code{hdparm} options for MySQL (and
probably many other applications):
@example
@@ -27968,15 +27974,15 @@ man page for more information! If @code{hdparm} is not used wisely,
filesystem corruption may result. Backup everything before experimenting!
@item
-On many operating systems you can mount the disks with the 'async' flag to
-set the filesystem to be updated asynchronously. If your computer is
-reasonable stable, this should give you more performance without sacrificing
+On many operating systems you can mount the disks with the @code{-o async}
+option to set the filesystem to be updated asynchronously. If your computer is
+reasonably stable, this should give you more performance without sacrificing
too much reliability. (This flag is on by default on Linux.)
@item
If you don't need to know when a file was last accessed (which is not
really useful on a database server), you can mount your filesystems
-with the @code{noatime} flag.
+with the @code{-o noatime} option.
@end itemize
@menu
@@ -33529,7 +33535,7 @@ The given @code{key_string} will be used to crypt @code{string_to_encrypt}.
The return string will be a binary string where the first character
will be @code{CHAR(128 | key_number)}.
-The 128 is added to make it easier to recognize an encrypted key.
+The 128 is added to make it easier to recognise an encrypted key.
If you use a string key, @code{key_number} will be 127.
On error, this function returns @code{NULL}.
@@ -33603,7 +33609,7 @@ non-magic value (that is, a value that is not @code{NULL} and not @code{0}).
If you insert many rows at the same time with an insert statement,
@code{LAST_INSERT_ID()} returns the value for the first inserted row.
-The reason for this is so that you it makes it possible to easily reproduce
+The reason for this is to make it possible to easily reproduce
the same @code{INSERT} statement against some other server.
@cindex sequence emulation
@@ -37679,7 +37685,7 @@ You can combine many statements and accept these all in one go with
the @code{COMMIT} command.
@item
You can execute @code{ROLLBACK} to ignore your changes (if you are not
-running in auto commit mode).
+running in auto-commit mode).
@item
If an update fails, all your changes will be restored. (With NTST tables all
changes that have taken place are permanent)
@@ -38258,7 +38264,7 @@ kind of benefits.)
@item
Do more efficient searches. If you know exactly what you are looking
after, you can search in just one of the split tables for some queries
-and use @code{MERGE} table for others. You can even have many
+and use a @code{MERGE} table for others. You can even have many
different @code{MERGE} tables active, with possible overlapping files.
@item
More efficient repairs. It's easier to repair the individual files that
@@ -38293,7 +38299,7 @@ You can only use identical @code{MyISAM} tables for a @code{MERGE} table.
@code{REPLACE} doesn't work.
@item
@code{MERGE} tables uses more file descriptors. If you are using a
-@code{MERGE} that maps over 10 tables and 10 users are using this, you
+@code{MERGE} table that maps over 10 tables and 10 users are using this, you
are using 10*10 + 10 file descriptors. (10 datafiles for 10 users
and 10 shared index files.)
@item
@@ -38449,8 +38455,8 @@ recovery}.
@end itemize
Most of the things true for @code{MyISAM} tables are also true for @code{ISAM}
-tables. @xref{MyISAM}. The major differences compared to @code{MyISAM}
-tables are:
+tables. @xref{MyISAM, , @code{MyISAM} tables}. The major differences compared
+to @code{MyISAM} tables are:
@itemize @bullet
@item @code{ISAM} tables are not binary portable across OS/Platforms.
@@ -38526,7 +38532,7 @@ are 100% dynamic (on inserting). No overflow areas and no extra key
space are needed. Deleted rows are put in a linked list and are
reused when you insert new data into the table.
@item
-You need enough extra memory for all HEAP tables that you want to use at
+You need enough extra memory for all @code{HEAP} tables that you want to use at
the same time.
@item
To free memory, you should execute @code{DELETE FROM heap_table},
@@ -39455,7 +39461,7 @@ the relevant files. If the formats are different and your tables
contain floating-point data, you have to use @file{mysqldump}
and @file{mysqlimport} to move those tables.
-A performance tip is to switch off the auto commit when you import
+A performance tip is to switch off auto-commit mode when you import
data into your database, assuming your tablespace has enough space for
the big rollback segment the big import transaction will generate.
Do the commit only after importing a whole table or a segment of
@@ -39476,7 +39482,7 @@ without InnoDB running out of memory.
In InnoDB all user activity happens inside transactions. If the
auto-commit mode is used in MySQL, then each SQL statement
-will form a single transaction. If the auto commit mode is
+will form a single transaction. If the auto-commit mode is
switched off, then we can think that a user always has a transaction
open. If he issues
the SQL @code{COMMIT} or @code{ROLLBACK} statement, that
@@ -39798,7 +39804,7 @@ Use less locking: if you can afford a @code{SELECT} to return
data from an old snapshot, do not add the clause
@code{FOR UPDATE} or @code{LOCK IN SHARE MODE} to it.
@item
-If nothing helps, serialize your transactions with table level
+If nothing helps, serialise your transactions with table level
locks: @code{LOCK TABLES t1 WRITE, t2 READ, ... ;
[do something with tables t1 and t2 here]; UNLOCK TABLES.}
Table level locks make you transactions to queue nicely,
@@ -40783,8 +40789,8 @@ In this case you have to rebuild MySQL without @code{BDB} table support.
Note: The following list is not complete; we will update it as we
receive more information about this.
-Currently we know that @code{BDB} tables work with the following operating
-system.
+Currently we know that the @code{BDB} handler works with the following
+operating systems:
@itemize @bullet
@item
@@ -40815,7 +40821,7 @@ Here follows the restrictions you have when using @code{BDB} tables:
@item
@code{BDB} tables store in the @file{.db} file the path to the file as it was
created.
-This was done to be able to detect locks in a multi-user
+(This was done to be able to detect locks in a multi-user
environment that supports symlinks).
The effect of this is that @code{BDB} tables are not movable between directories!
@@ -40844,9 +40850,9 @@ file format. In this case you have to delete all @code{BDB} logs
from your database directory (the files with names that have the format
@code{log.XXXXXXXXXX}) and restart @code{mysqld}. We would also
recommend you to do a @code{mysqldump --opt} of your old @code{BDB}
-tables, delete the old table and restore the dump.
+tables, delete the old tables, and restore the dump.
@item
-If you are running in not @code{auto_commit} mode and delete a table you
+If you are not running in auto-commit mode and delete a table you
are using by another thread you may get the following error messages in
the MySQL error file:
@@ -40857,7 +40863,7 @@ the MySQL error file:
@end example
This is not fatal but we don't recommend that you delete tables if you are
-not in @code{auto_commit} mode, until this problem is fixed (the fix is
+not in auto-commit mode, until this problem is fixed (the fix is
not trivial).
@end itemize
@@ -41657,10 +41663,10 @@ through the @code{InConnectionString} argument in the
@item @strong{Parameter} @tab @strong{Default value} @tab @strong{Comment}
@item user @tab ODBC (on Windows) @tab The username used to connect to MySQL.
@item server @tab localhost @tab The hostname of the MySQL server.
-@item database @tab @tab The default database
+@item database @tab @tab The default database.
@item option @tab 0 @tab A integer by which you can specify how @code{MyODBC} should work. See below.
@item port @tab 3306 @tab The TCP/IP port to use if @code{server} is not @code{localhost}.
-@item stmt @tab @tab A statement that will be executed when connection to @code{MySQL}.
+@item stmt @tab @tab A statement that will be executed when connecting to @code{MySQL}.
@item password @tab @tab The password for the @code{server} @code{user} combination.
@item socket @tab @tab The socket or Windows pipe to connect to.
@end multitable
@@ -44388,14 +44394,14 @@ if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
@end example
By using @code{mysql_options()} the MySQL library will read the
-@code{[client]} and @code{your_prog_name} sections in the @file{my.cnf}
+@code{[client]} and @code{[your_prog_name]} sections in the @file{my.cnf}
file which will ensure that your program will work, even if someone has
set up MySQL in some non-standard way.
Note that upon connection, @code{mysql_real_connect()} sets the @code{reconnect}
-flag (part of the MYSQL structure) to a value of @code{1}. This flag indicates,
-in the event that a query cannot be performed because of a lost connection, to
-try reconnecting to the server before giving up.
+flag (part of the @code{MYSQL} structure) to a value of @code{1}. This
+flag indicates, in the event that a query cannot be performed because
+of a lost connection, to try reconnecting to the server before giving up.
@node mysql_real_escape_string, mysql_real_query, mysql_real_connect, C API functions
@@ -50391,6 +50397,23 @@ each individual 4.0.x release.
@itemize @bullet
@item
+@code{SELECT @@@@[global|session].var_name} didn't report
+@code{global | session} in the result column name.
+@item
+Fixed problem in replication that @code{FLUSH LOGS} in a circular
+replication setup created an infinite number of binary log files.
+Now a @code{rotate-binary-log} command in the binary log will not cause slaves
+to rotate logs.
+@item
+Removed @code{STOP EVENT} from binary log when doing @code{FLUSH LOGS}.
+@item
+Disable the use of @code{SHOW NEW MASTER FOR SLAVE} as this needs to be
+completely changed in 4.1.
+@item
+Fixed a bug with constant expression (e.g. field of a one-row table, or field
+from a table, referenced by a @code{UNIQUE} key) appeared in @code{ORDER BY}
+part of @code{SELECT DISTINCT}.
+@item
@code{--log-binary=a.b.c} now properly strips of @code{.b.c}.
@item
@code{FLUSH LOGS} removed numerical extension for all future update logs.
@@ -50954,7 +50977,7 @@ Secure connections (with SSL).
Unsigned @code{BIGINT} constants now work. @code{MIN()} and @code{MAX()}
now handle signed and unsigned @code{BIGINT} numbers correctly.
@item
-New character set @code{latin_de} which provides correct German sorting.
+New character set @code{latin1_de} which provides correct German sorting.
@item
@code{STRCMP()} now uses the current character set when doing comparisons,
which means that the default comparison behaviour now is case-insensitive.
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 4109fbd76d4..0b7add434c9 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2001 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
#include "log_event.h"
#define BIN_LOG_HEADER_SIZE 4
-#define PROBE_HEADER_LEN (BIN_LOG_HEADER_SIZE+EVENT_LEN_OFFSET+4)
+#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
@@ -40,7 +40,7 @@ static FILE *result_file;
static const char* default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace";
#endif
-void sql_print_error(const char *format,...);
+void sql_print_error(const char *format, ...);
static bool one_database = 0;
static const char* database;
@@ -138,7 +138,7 @@ This software comes with NO WARRANTY: This is free software,\n\
and you are welcome to modify and redistribute it under the GPL license\n");
printf("\
-Dumps a MySQL binary log in a format usable for viewing or for pipeing to\n\
+Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
the mysql command line client\n\n");
printf("Usage: %s [options] log-files\n", my_progname);
my_print_help(my_long_options);
@@ -378,31 +378,40 @@ static void dump_remote_log_entries(const char* logname)
static int check_header(IO_CACHE* file)
{
+ byte header[BIN_LOG_HEADER_SIZE];
byte buf[PROBE_HEADER_LEN];
int old_format=0;
my_off_t pos = my_b_tell(file);
my_b_seek(file, (my_off_t)0);
- if (my_b_read(file, buf, sizeof(buf)))
- die("Failed reading header");
- if (buf[EVENT_TYPE_OFFSET+4] == START_EVENT)
+ if (my_b_read(file, header, sizeof(header)))
+ die("Failed reading header; Probably an empty file");
+ if (memcmp(header, BINLOG_MAGIC, sizeof(header)))
+ die("File is not a binary log file");
+ if (!my_b_read(file, buf, sizeof(buf)))
{
- uint event_len;
- event_len = uint4korr(buf + EVENT_LEN_OFFSET + 4);
- old_format = (event_len < LOG_EVENT_HEADER_LEN + START_HEADER_LEN);
+ if (buf[4] == START_EVENT)
+ {
+ uint event_len;
+ event_len = uint4korr(buf + 4);
+ old_format = (event_len < LOG_EVENT_HEADER_LEN + START_HEADER_LEN);
+ }
}
my_b_seek(file, pos);
return old_format;
}
+
static void dump_local_log_entries(const char* logname)
{
File fd = -1;
IO_CACHE cache,*file= &cache;
ulonglong rec_count = 0;
- char last_db[FN_REFLEN+1] = "";
+ char last_db[FN_REFLEN+1], tmp_buff[BIN_LOG_HEADER_SIZE];
bool old_format = 0;
+ last_db[0]=0;
+
if (logname && logname[0] != '-')
{
if ((fd = my_open(logname, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0)
@@ -435,14 +444,7 @@ static void dump_local_log_entries(const char* logname)
}
if (!position)
- {
- char magic[BIN_LOG_HEADER_SIZE];
- if (my_b_read(file, (byte*) magic, sizeof(magic)))
- die("I/O error reading binlog magic number");
- if (memcmp(magic, BINLOG_MAGIC, 4))
- die("Bad magic number; The file is probably not a MySQL binary log");
- }
-
+ my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE); // Skip header
for (;;)
{
char llbuff[21];
diff --git a/client/mysqltest.c b/client/mysqltest.c
index d9e964997cc..533713b4f43 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -87,11 +87,8 @@
#define CON_RETRY_SLEEP 2
#define MAX_CON_TRIES 5
-#ifndef OS2
#define SLAVE_POLL_INTERVAL 300000 /* 0.3 of a sec */
-#else
-#defile SLAVE_POLL_INTERVAL 0.3
-#endif
+
enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT};
@@ -423,6 +420,7 @@ static void free_used_memory()
my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
delete_dynamic(&q_lines);
dynstr_free(&ds_res);
+ free_replace();
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(default_argv);
mysql_server_end();
@@ -687,13 +685,23 @@ int open_file(const char* name)
return 0;
}
+static void my_sleep(ulong m_seconds)
+{
+#ifndef OS2
+ struct timeval t;
+ t.tv_sec= m_seconds / 1000000L;
+ t.tv_usec= m_seconds % 1000000L;
+ select(0,0,0,0,&t); /* sleep */
+#else
+ DosSleep(m_seconds/1000+1);
+#endif
+}
+
+
/* ugly long name, but we are following the convention */
int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
{
MYSQL* mysql = &cur_con->mysql;
-#ifndef OS2
- struct timeval t;
-#endif
for (;;)
{
MYSQL_RES* res;
@@ -714,15 +722,8 @@ int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
mysql_free_result(res);
if (done)
break;
-#ifndef OS2
- t.tv_sec=0;
- t.tv_usec=SLAVE_POLL_INTERVAL;
- select(0,0,0,0,&t); /* sleep */
-#else
- DosSleep(OS2_SLAVE_POLL_INTERVAL);
-#endif
+ my_sleep(SLAVE_POLL_INTERVAL);
}
-
return 0;
}
@@ -1000,10 +1001,18 @@ int do_sync_with_master2(const char* p)
die("line %u: empty result in %s", start_lineno, query_buf);
if (!row[0])
die("Error on slave while syncing with master");
- mysql_free_result(res); last_result=0;
+ mysql_free_result(res);
+ last_result=0;
if (rpl_parse)
mysql_enable_rpl_parse(mysql);
+#ifndef TO_BE_REMOVED
+ /*
+ We need this because wait_for_pos() only waits for the relay log,
+ which doesn't guarantee that the slave has executed the statement.
+ */
+ my_sleep(2*1000000L);
+#endif
return 0;
}
@@ -1082,53 +1091,15 @@ int do_disable_rpl_parse(struct st_query* q __attribute__((unused)))
int do_sleep(struct st_query* q, my_bool real_sleep)
{
char* p=q->first_argument;
- struct timeval t;
- int dec_mul = 1000000;
- while (*p && isspace(*p)) p++;
+ while (*p && isspace(*p))
+ p++;
if (!*p)
die("Missing argument in sleep\n");
- t.tv_usec = 0;
-
-#ifdef OS2
-
if (opt_sleep && !real_sleep)
- DosSleep( opt_sleep * 1000);
+ my_sleep(opt_sleep * 1000000L);
else
- DosSleep( atof( p) * 1000);
-
+ my_sleep((ulong) (atof(p) * 1000000L));
return 0;
-
-#else
- if (opt_sleep && !real_sleep)
- t.tv_sec = opt_sleep;
- else
- {
- t.tv_sec = atoi(p);
- while (*p && *p != '.' && !isspace(*p))
- p++;
- if (*p == '.')
- {
- int c;
- char *p_end;
- p++;
- p_end = p + 6;
-
- for (;p <= p_end; ++p)
- {
- c = (int) (*p - '0');
- if (c < 10 && (int) c >= 0)
- {
- t.tv_usec = t.tv_usec * 10 + c;
- dec_mul /= 10;
- }
- else
- break;
- }
- }
- }
- t.tv_usec *= dec_mul;
- return select(0,0,0,0, &t);
-#endif
}
static void get_file_name(char *filename, struct st_query* q)
@@ -1261,8 +1232,7 @@ static void get_replace(struct st_query *q)
POINTER_ARRAY to_array,from_array;
DBUG_ENTER("get_replace");
- if (glob_replace)
- free_replace();
+ free_replace();
bzero((char*) &to_array,sizeof(to_array));
bzero((char*) &from_array,sizeof(from_array));
@@ -1298,9 +1268,12 @@ static void get_replace(struct st_query *q)
void free_replace()
{
DBUG_ENTER("free_replace");
- my_free((char*) glob_replace,MYF(0));
- glob_replace=0;
- free_replace_buffer();
+ if (glob_replace)
+ {
+ my_free((char*) glob_replace,MYF(0));
+ glob_replace=0;
+ free_replace_buffer();
+ }
DBUG_VOID_RETURN;
}
@@ -2077,7 +2050,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
char* query;
int query_len;
DBUG_ENTER("run_query");
-
+
if (q->type != Q_EVAL)
{
query = q->query;
@@ -2090,6 +2063,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
query = eval_query.str;
query_len = eval_query.length;
}
+ DBUG_PRINT("enter", ("query: '%-.60s'", query));
if (q->record_file[0])
{
diff --git a/configure.in b/configure.in
index 3d7d44c33df..93c7f883c4e 100644
--- a/configure.in
+++ b/configure.in
@@ -922,7 +922,7 @@ case $SYSTEM_TYPE in
fi
fi
;;
- *darwin*)
+ *darwin5*)
if test "$ac_cv_prog_gcc" = "yes"
then
CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
@@ -931,6 +931,14 @@ case $SYSTEM_TYPE in
with_named_curses=""
fi
;;
+ *darwin6*)
+ if test "$ac_cv_prog_gcc" = "yes"
+ then
+ CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
+ CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ"
+ MAX_C_OPTIMIZE="-O"
+ fi
+ ;;
*freebsd*)
echo "Adding fix for interrupted reads"
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
diff --git a/include/my_sys.h b/include/my_sys.h
index 163fb72a910..e1054d825c6 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -126,13 +126,14 @@ extern int NEAR my_errno; /* Last error in mysys */
/* defines when allocating data */
#ifdef SAFEMALLOC
-#define my_malloc(SZ,FLAG) _mymalloc( SZ, __FILE__, __LINE__, FLAG )
-#define my_malloc_ci(SZ,FLAG) _mymalloc( SZ, sFile, uLine, FLAG )
-#define my_realloc(PTR,SZ,FLAG) _myrealloc( PTR, SZ, __FILE__, __LINE__, FLAG )
+#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG )
+#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG )
+#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG )
#define my_checkmalloc() _sanity( __FILE__, __LINE__ )
-#define my_free(PTR,FLAG) _myfree( PTR, __FILE__, __LINE__,FLAG)
-#define my_memdup(A,B,C) _my_memdup(A,B,__FILE__,__LINE__,C)
-#define my_strdup(A,C) _my_strdup(A,__FILE__,__LINE__,C)
+#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG)
+#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
+#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
+#define my_strdup_with_length(A,B,C) _my_strdup_with_length((A),(B),__FILE__,__LINE__,C)
#define QUICK_SAFEMALLOC sf_malloc_quick=1
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
@@ -153,6 +154,8 @@ extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags);
extern void my_no_flags_free(gptr ptr);
extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
extern my_string my_strdup(const char *from,myf MyFlags);
+extern my_string my_strdup_with_length(const char *from,uint length,
+ myf MyFlags);
#define my_free(PTR,FG) my_no_flags_free(PTR)
#define CALLER_INFO_PROTO /* nothing */
#define CALLER_INFO /* nothing */
@@ -550,6 +553,10 @@ extern gptr _my_memdup(const byte *from,uint length,
const char *sFile, uint uLine,myf MyFlag);
extern my_string _my_strdup(const char *from, const char *sFile, uint uLine,
myf MyFlag);
+extern my_string _my_strdup_with_length(const char *from, uint length,
+ const char *sFile, uint uLine,
+ myf MyFlag);
+
#ifndef TERMINATE
extern void TERMINATE(FILE *file);
#endif
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
index bab5c78b712..25a7060883c 100644
--- a/innobase/btr/btr0cur.c
+++ b/innobase/btr/btr0cur.c
@@ -808,7 +808,7 @@ btr_cur_optimistic_insert(
if (!dtuple_check_typed_no_assert(entry)) {
fprintf(stderr,
-"InnoDB: Error in a tuple to insert into table %lu index %s\n",
+"InnoDB: Error in a tuple to insert into table %s index %s\n",
index->table_name, index->name);
}
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 0c91ec11671..6f2ba791eef 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1049,21 +1049,21 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned long length)
{
+ DBUG_ENTER("mysql_master_query");
if (mysql_master_send_query(mysql, q, length))
- return 1;
- return mysql_read_query_result(mysql);
+ DBUG_RETURN(1);
+ DBUG_RETURN(mysql_read_query_result(mysql));
}
int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned long length)
{
- MYSQL*master = mysql->master;
- if (!length)
- length = strlen(q);
+ MYSQL *master = mysql->master;
+ DBUG_ENTER("mysql_master_send_query");
if (!master->net.vio && !mysql_real_connect(master,0,0,0,0,0,0,0))
- return 1;
+ DBUG_RETURN(1);
mysql->last_used_con = master;
- return simple_command(master, COM_QUERY, q, length, 1);
+ DBUG_RETURN(simple_command(master, COM_QUERY, q, length, 1));
}
@@ -1071,30 +1071,31 @@ int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned long length)
{
+ DBUG_ENTER("mysql_slave_query");
if (mysql_slave_send_query(mysql, q, length))
- return 1;
- return mysql_read_query_result(mysql);
+ DBUG_RETURN(1);
+ DBUG_RETURN(mysql_read_query_result(mysql));
}
int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length)
{
MYSQL* last_used_slave, *slave_to_use = 0;
+ DBUG_ENTER("mysql_slave_send_query");
if ((last_used_slave = mysql->last_used_slave))
slave_to_use = last_used_slave->next_slave;
else
slave_to_use = mysql->next_slave;
- /* next_slave is always safe to use - we have a circular list of slaves
- if there are no slaves, mysql->next_slave == mysql
+ /*
+ Next_slave is always safe to use - we have a circular list of slaves
+ if there are no slaves, mysql->next_slave == mysql
*/
mysql->last_used_con = mysql->last_used_slave = slave_to_use;
- if (!length)
- length = strlen(q);
if (!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0,
0,0,0,0))
- return 1;
- return simple_command(slave_to_use, COM_QUERY, q, length, 1);
+ DBUG_RETURN(1);
+ DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, q, length, 1));
}
@@ -1307,8 +1308,7 @@ err:
enum mysql_rpl_type
STDCALL mysql_rpl_query_type(const char* q, int len)
{
- const char* q_end;
- q_end = (len) ? q + len : strend(q);
+ const char *q_end= q + len;
for (; q < q_end; ++q)
{
char c;
@@ -2203,20 +2203,24 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
int STDCALL
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
{
+ DBUG_ENTER("mysql_send_query");
+ DBUG_PRINT("enter",("rpl_parse: %d rpl_pivot: %d",
+ mysql->options.rpl_parse, mysql->rpl_pivot));
+
if (mysql->options.rpl_parse && mysql->rpl_pivot)
{
switch (mysql_rpl_query_type(query, length)) {
case MYSQL_RPL_MASTER:
- return mysql_master_send_query(mysql, query, length);
+ DBUG_RETURN(mysql_master_send_query(mysql, query, length));
case MYSQL_RPL_SLAVE:
- return mysql_slave_send_query(mysql, query, length);
+ DBUG_RETURN(mysql_slave_send_query(mysql, query, length));
case MYSQL_RPL_ADMIN:
break; /* fall through */
}
}
mysql->last_used_con = mysql;
- return simple_command(mysql, COM_QUERY, query, length, 1);
+ DBUG_RETURN(simple_command(mysql, COM_QUERY, query, length, 1));
}
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index 2202587702b..0996c110eea 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -370,7 +370,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
share.state.rec_per_key_part[key_segs-1]=1L;
length+=key_length;
keydef->block_length= MI_BLOCK_SIZE(length,pointer,MI_MAX_KEYPTR_SIZE);
- if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH)
+ if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
+ length > MI_MAX_KEY_LENGTH)
{
my_errno=HA_WRONG_CREATE_OPTION;
goto err;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 9a825ea125e..b51d5fff70b 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -742,6 +742,8 @@ start_master()
$RM -f $MASTER_MYDDIR/log.*
# Remove stale binary logs
$RM -f $MYSQL_TEST_DIR/var/log/master-bin.*
+ # Remove old master.info files
+ $RM -f $MYSQL_TEST_DIR/var/master-data/master.info
#run master initialization shell script if one exists
@@ -858,8 +860,9 @@ start_slave()
slave_pid=$SLAVE_MYPID
slave_sock="$SLAVE_MYSOCK"
fi
- # Remove stale binary logs
- $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-bin.*
+ # Remove stale binary logs and old master.info files
+ $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
+ $RM -f $MYSQL_TEST_DIR/$slave_datadir/master.info
#run slave initialization shell script if one exists
if [ -f "$slave_init_script" ] ;
@@ -1089,8 +1092,8 @@ run_testcase ()
start_master
fi
fi
- do_slave_restart=0
+ do_slave_restart=0
if [ -f $slave_opt_file ] ;
then
EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 0b98218f5d5..68fb8c39e6c 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -350,8 +350,7 @@ select distinct a from t1 where a >= '1' order by a desc;
a
1
drop table t1;
-CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered
-DATETIME);
+CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered DATETIME);
CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
INSERT INTO t1 (email, infoID, dateentered) VALUES
('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
@@ -380,11 +379,19 @@ test2@testdomain.com Z001
test2@testdomain.com R002
test3@testdomain.com Z001
drop table t1,t2;
-CREATE TABLE t1 ( privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
+CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
-CREATE TABLE t2 ( userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
+CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
privatemessageid folderid userid touserid fromuserid title message dateline showsignature iconid messageread readtime receipt deleteprompt multiplerecipients userid usergroupid username password email styleid parentemail coppauser homepage icq aim yahoo signature adminemail showemail invisible usertitle customtitle joindate cookieuser daysprune lastvisit lastactivity lastpost posts timezoneoffset emailnotification buddylist ignorelist pmfolders receivepm emailonpm pmpopup avatarid avatarrevision options birthday maxposts startofweek ipaddress referrerid nosessionhash autorefresh messagepopup inforum ratenum ratetotal allowrate
128 0 33 33 8 :D 996121863 1 0 2 996122850 2 0 0 33 6 Kevin 0 kevin@stileproject.com 1 0 http://www.stileproject.com 1 1 0 Administrator 0 996120694 1 -1 1030996168 1031027028 1030599436 36 -6 0 1 0 1 0 0 15 0000-00-00 -1 1 64.0.0.0 0 1 -1 0 0 4 19 1
DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (a int primary key, b int, c int);
+INSERT t1 VALUES (1,2,3);
+CREATE TABLE t2 (a int primary key, b int, c int);
+INSERT t2 VALUES (3,4,5);
+SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c;
+a b
+1 4
+DROP TABLE IF EXISTS t1,t2;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index c08f6094080..c77884adfb0 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -7,6 +7,9 @@ Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
grant delete on mysqltest.* to mysqltest_1@localhost;
+select * from mysql.user where user="mysqltest_1";
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 4224db7c072..78b0da2769e 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -987,7 +987,7 @@ create table t1 (id int unsigned not null auto_increment, code tinyint unsigned
BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT @@tx_isolation,@@global.tx_isolation;
-@@tx_isolation @@tx_isolation
+@@tx_isolation @@global.tx_isolation
SERIALIZABLE READ-COMMITTED
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
select id, code, name from t1 order by id;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 1d66c4cc03d..739a47b41f1 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -108,3 +108,9 @@ OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
+Specified key was too long. Max key length is 500
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
+ALTER TABLE t1 ADD INDEX t1 (a, b, c);
+Specified key was too long. Max key length is 500
+DROP TABLE t1;
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
new file mode 100644
index 00000000000..40b4ca72f01
--- /dev/null
+++ b/mysql-test/r/rpl_flush_log_loop.result
@@ -0,0 +1,17 @@
+slave stop;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+change master to master_host='127.0.0.1',master_user='root',
+master_password='',master_port=9306;
+slave start;
+slave stop;
+change master to master_host='127.0.0.1',master_user='root',
+master_password='',master_port=9307;
+slave start;
+flush logs;
+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
+127.0.0.1 root 9307 60 slave-bin.001 79 mashka-relay-bin.001 119 slave-bin.001 Yes Yes 0 0 79 119
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
index 8948460e1bd..7d1843f95fc 100644
--- a/mysql-test/r/rpl_log.result
+++ b/mysql-test/r/rpl_log.result
@@ -8,7 +8,6 @@ slave stop;
reset master;
reset slave;
reset master;
-drop table if exists t1;
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL);
drop table t1;
@@ -37,6 +36,9 @@ show binlog events from 79 limit 2,1;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
flush logs;
+slave start;
+flush logs;
+slave stop;
create table t1 (n int);
insert into t1 values (1);
drop table t1;
@@ -52,7 +54,6 @@ master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
master-bin.001 556 Exec_load 1 556 ;file_id=1
master-bin.001 579 Query 1 579 use test; drop table t1
master-bin.001 627 Rotate 1 627 master-bin.002;pos=4
-master-bin.001 668 Stop 1 668
show binlog events in 'master-bin.002';
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.002 4 Query 1 4 use test; create table t1 (n int)
@@ -68,32 +69,24 @@ Log_name
slave-bin.001
slave-bin.002
show binlog events in 'slave-bin.001' from 4;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+slave-bin.001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
+slave-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key)
+slave-bin.001 172 Intvar 1 200 INSERT_ID=1
+slave-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
+slave-bin.001 263 Query 1 263 use test; drop table t1
+slave-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null)
+slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
+slave-bin.001 565 Exec_load 1 556 ;file_id=1
+slave-bin.001 588 Query 1 579 use test; drop table t1
+slave-bin.001 636 Rotate 2 636 slave-bin.002;pos=4
show binlog events in 'slave-bin.002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
-slave-bin.002 4 Slave 2 627 host=127.0.0.1,port=MASTER_PORT,log=master-bin.002,pos=4
-slave-bin.002 57 Query 1 4 use test; create table t1 (n int)
-slave-bin.002 115 Query 1 62 use test; insert into t1 values (1)
-slave-bin.002 175 Query 1 122 use test; drop table t1
+slave-bin.002 4 Query 1 4 use test; create table t1 (n int)
+slave-bin.002 62 Query 1 62 use test; insert into t1 values (1)
+slave-bin.002 122 Query 1 122 use test; drop table 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
-127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 916 master-bin.002 Yes Yes 0 0 170 920
-show new master for slave with master_log_file='master-bin.001' and
-master_log_pos=4 and master_server_id=1;
-Log_name Log_pos
-slave-bin.001 132
-show new master for slave with master_log_file='master-bin.001' and
-master_log_pos=79 and master_server_id=1;
-Log_name Log_pos
-slave-bin.001 225
-show new master for slave with master_log_file='master-bin.001' and
-master_log_pos=311 and master_server_id=1;
-Log_name Log_pos
-slave-bin.001 439
-show new master for slave with master_log_file='master-bin.002' and
-master_log_pos=4 and master_server_id=1;
-Log_name Log_pos
-slave-bin.002 57
-show new master for slave with master_log_file='master-bin.002' and
-master_log_pos=122 and master_server_id=1;
-Log_name Log_pos
-slave-bin.002 223
+127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 957 master-bin.002 Yes Yes 0 0 170 961
+show binlog events in 'slave-bin.005' from 4;
+Error when executing command SHOW BINLOG EVENTS: Could not find target log
diff --git a/mysql-test/r/rpl_magic.result b/mysql-test/r/rpl_magic.result
deleted file mode 100644
index 743bef4a053..00000000000
--- a/mysql-test/r/rpl_magic.result
+++ /dev/null
@@ -1,37 +0,0 @@
-slave stop;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
-create table t1 ( n int);
-insert into t1 values (1),(2),(3),(4);
-insert into t1 values(5);
-select * from t1;
-n
-1
-2
-3
-4
-5
-select * from t1;
-n
-1
-2
-3
-4
-select * from t1;
-n
-1
-2
-3
-4
-select * from t1;
-n
-1
-2
-3
-4
-5
-drop table t1;
diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result
new file mode 100644
index 00000000000..6103a075684
--- /dev/null
+++ b/mysql-test/r/rpl_redirect.result
@@ -0,0 +1,43 @@
+slave stop;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+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
+SHOW SLAVE HOSTS;
+Server_id Host Port Rpl_recovery_rank Master_id
+2 127.0.0.1 SLAVE_PORT 2 1
+drop table if exists t1;
+create table t1 ( n int);
+insert into t1 values (1),(2),(3),(4);
+insert into t1 values(5);
+select * from t1;
+n
+1
+2
+3
+4
+5
+select * from t1;
+n
+1
+2
+3
+4
+select * from t1;
+n
+1
+2
+3
+4
+select * from t1;
+n
+1
+2
+3
+4
+5
+drop table t1;
+drop table t1;
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index d440e157ed4..6c1a0082703 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -2,12 +2,10 @@ slave start;
Could not initialize master info structure, check permisions on master.info
slave start;
Could not initialize master info structure, check permisions on master.info
-change master to master_host='127.0.0.1',master_port=MASTER_PORT,
-master_user='root';
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
Could not initialize master info
reset slave;
-change master to master_host='127.0.0.1',master_port=MASTER_PORT,
-master_user='root';
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master;
slave start;
drop table if exists t1, t2, t3, t4;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 516204028fe..f708ddd2ee7 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -65,7 +65,7 @@ Variable_name Value
max_join_size 4294967295
set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size;
-@@max_join_size @@max_join_size
+@@session.max_join_size @@global.max_join_size
1000 2000
select @@identity, length(@@version)>0;
@@identity length(@@version)>0
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 7c3dc8f84b8..aaffea3c5a5 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -223,8 +223,7 @@ drop table t1;
# Test when using a not previously used column in ORDER BY
#
-CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered
-DATETIME);
+CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered DATETIME);
CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
INSERT INTO t1 (email, infoID, dateentered) VALUES
@@ -242,9 +241,26 @@ SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
drop table t1,t2;
-CREATE TABLE t1 ( privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
+
+#
+# test with table.* in DISTINCT
+#
+
+CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
-CREATE TABLE t2 ( userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
+CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
DROP TABLE IF EXISTS t1,t2;
+
+#
+# test with const_item in ORDER BY
+#
+
+CREATE TABLE t1 (a int primary key, b int, c int);
+INSERT t1 VALUES (1,2,3);
+CREATE TABLE t2 (a int primary key, b int, c int);
+INSERT t2 VALUES (3,4,5);
+SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c;
+DROP TABLE IF EXISTS t1,t2;
+
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index be1b09a9b78..c75069f8c55 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -8,6 +8,7 @@ flush privileges;
grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
show grants for mysqltest_1@localhost;
grant delete on mysqltest.* to mysqltest_1@localhost;
+select * from mysql.user where user="mysqltest_1";
show grants for mysqltest_1@localhost;
revoke delete on mysqltest.* from mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index dec53e92036..cba7b522650 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -104,3 +104,13 @@ INSERT INTO t1 VALUES (1), (2), (3);
OPTIMIZE TABLE t1;
DROP TABLE t1;
+#
+# Test of creating table with too long key
+#
+
+--error 1071
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
+--error 1071
+ALTER TABLE t1 ADD INDEX t1 (a, b, c);
+DROP TABLE t1;
diff --git a/mysql-test/t/rpl_flush_log_loop-master.opt b/mysql-test/t/rpl_flush_log_loop-master.opt
index 98ca59ad510..eb35347af33 100644
--- a/mysql-test/t/rpl_flush_log_loop-master.opt
+++ b/mysql-test/t/rpl_flush_log_loop-master.opt
@@ -1 +1 @@
---server_id=1 --log-bin
+-O max_binlog_size=1M
diff --git a/mysql-test/t/rpl_flush_log_loop-slave.opt b/mysql-test/t/rpl_flush_log_loop-slave.opt
index 212e1510ac9..eb35347af33 100644
--- a/mysql-test/t/rpl_flush_log_loop-slave.opt
+++ b/mysql-test/t/rpl_flush_log_loop-slave.opt
@@ -1 +1 @@
---server_id=2 --log-bin
+-O max_binlog_size=1M
diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flush_log_loop.test
index 4ab5ee3c5b5..2b559180a42 100644
--- a/mysql-test/t/rpl_flush_log_loop.test
+++ b/mysql-test/t/rpl_flush_log_loop.test
@@ -15,5 +15,3 @@ slave start;
flush logs;
sleep 5;
show slave status;
-
-
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
index 3514d435737..85782e78142 100644
--- a/mysql-test/t/rpl_log.test
+++ b/mysql-test/t/rpl_log.test
@@ -9,7 +9,6 @@ let $VERSION=`select version()`;
connection master;
reset master;
-drop table if exists t1;
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL);
drop table t1;
@@ -22,6 +21,19 @@ show binlog events from 79 limit 1;
show binlog events from 79 limit 2;
show binlog events from 79 limit 2,1;
flush logs;
+
+# Sync slave and force it to start on another binary log
+
+save_master_pos;
+connection slave;
+slave start;
+sync_with_master;
+flush logs;
+slave stop;
+connection master;
+
+# Create some entries for second log
+
create table t1 (n int);
insert into t1 values (1);
drop table t1;
@@ -35,23 +47,19 @@ slave start;
sync_with_master;
show master logs;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
-# We can't compare binlog from slave as the result differ between
-# machines based on where the LOAD DATA file is stored.
-disable_result_log;
-
show binlog events in 'slave-bin.001' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
-enable_result_log;
show binlog events in 'slave-bin.002' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
-show new master for slave with master_log_file='master-bin.001' and
- master_log_pos=4 and master_server_id=1;
-show new master for slave with master_log_file='master-bin.001' and
- master_log_pos=79 and master_server_id=1;
-show new master for slave with master_log_file='master-bin.001' and
- master_log_pos=311 and master_server_id=1;
-show new master for slave with master_log_file='master-bin.002' and
- master_log_pos=4 and master_server_id=1;
-show new master for slave with master_log_file='master-bin.002' and
- master_log_pos=122 and master_server_id=1;
+
+# Need to recode the following
+
+#show new master for slave with master_log_file='master-bin.001' and master_log_pos=4 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.001' and master_log_pos=79 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.001' and master_log_pos=311 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.002' and master_log_pos=4 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.002' and master_log_pos=122 and master_server_id=1;
+
+--error 1220
+show binlog events in 'slave-bin.005' from 4;
diff --git a/mysql-test/t/rpl_mystery22.test b/mysql-test/t/rpl_mystery22.test
index 371c5ba21ed..5280cb360dd 100644
--- a/mysql-test/t/rpl_mystery22.test
+++ b/mysql-test/t/rpl_mystery22.test
@@ -13,7 +13,7 @@ insert into t1 values(NULL);
insert into t1 values(NULL);
save_master_pos;
connection slave;
-sleep 1; # there is no way around this sleep - we have to wait until
+sleep 3; # there is no way around this sleep - we have to wait until
# the slave tries to run the query, fails and aborts slave thread
delete from t1 where n = 2;
slave start;
diff --git a/mysql-test/t/rpl_magic.test b/mysql-test/t/rpl_redirect.test
index c93add93d9d..4082542f295 100644
--- a/mysql-test/t/rpl_magic.test
+++ b/mysql-test/t/rpl_redirect.test
@@ -1,3 +1,7 @@
+#
+# Test of automatic redirection of queries to master/slave.
+#
+
source include/master-slave.inc;
#first, make sure the slave has had enough time to register
@@ -7,6 +11,10 @@ sync_with_master;
#discover slaves
connection master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+SHOW SLAVE STATUS;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW SLAVE HOSTS;
rpl_probe;
#turn on master/slave query direction auto-magic
@@ -16,11 +24,12 @@ create table t1 ( n int);
insert into t1 values (1),(2),(3),(4);
disable_rpl_parse;
save_master_pos;
-enable_rpl_parse;
connection slave;
sync_with_master;
insert into t1 values(5);
connection master;
+enable_rpl_parse;
+# The first of the queries will be sent to the slave, the second to the master.
select * from t1;
select * from t1;
disable_rpl_parse;
@@ -28,3 +37,5 @@ select * from t1;
connection slave;
select * from t1;
drop table t1;
+connection master;
+drop table t1;
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index cea2f9008dc..f6fbb76e55e 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -20,12 +20,11 @@ system chmod 600 var/slave-data/master.info;
--error 1201
slave start;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
-!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
- master_user='root';
+# Will get error 13 on Unix systems becasue file is not readable
+!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
reset slave;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
-eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
- master_user='root';
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
connection master;
reset master;
connection slave;
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 1e7cdd3a3b5..fc2f22b079a 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -81,3 +81,15 @@ my_string my_strdup(const char *from, myf MyFlags)
memcpy((byte*) ptr, (byte*) from,(size_t) length);
return((my_string) ptr);
}
+
+
+gptr my_strdup_with_length(const byte *from, uint length, myf MyFlags)
+{
+ gptr ptr;
+ if ((ptr=my_malloc(length+1,MyFlags)) != 0)
+ {
+ memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ ptr[length]=0;
+ }
+ return(ptr);
+}
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 9615126f237..f7e77878e41 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -538,3 +538,17 @@ my_string _my_strdup(const char *from, const char *sFile, uint uLine,
memcpy((byte*) ptr, (byte*) from,(size_t) length);
return((my_string) ptr);
} /* _my_strdup */
+
+
+my_string _my_strdup_with_length(const char *from, uint length,
+ const char *sFile, uint uLine,
+ myf MyFlags)
+{
+ gptr ptr;
+ if ((ptr=_mymalloc(length+1,sFile,uLine,MyFlags)) != 0)
+ {
+ memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ ptr[length]=0;
+ }
+ return((my_string) ptr);
+}
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 11e6fa97ab6..d1343d4c2d3 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -655,6 +655,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
{
+ (*alrm)= &alarm->alarmed;
if (alarm_aborted)
{
alarm->alarmed.crono=0;
@@ -663,7 +664,6 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
if (!(alarm->alarmed.crono=SetTimer((HWND) NULL,0, sec*1000,
(TIMERPROC) NULL)))
return 1;
- (*alrm)= &alarm->alarmed;
return 0;
}
@@ -688,7 +688,7 @@ bool thr_got_alarm(thr_alarm_t *alrm_ptr)
void thr_end_alarm(thr_alarm_t *alrm_ptr)
{
thr_alarm_t alrm= *alrm_ptr;
- if (alrm->crono)
+ if (alrm && alrm->crono)
{
KillTimer(NULL, alrm->crono);
alrm->crono = 0;
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 7b8afe7b8fe..b794270d193 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -101,7 +101,7 @@ char* innobase_unix_file_flush_method = NULL;
/* Below we have boolean-valued start-up parameters, and their default
values */
-my_bool innobase_flush_log_at_trx_commit = FALSE;
+uint innobase_flush_log_at_trx_commit = 0;
my_bool innobase_log_archive = FALSE;
my_bool innobase_use_native_aio = FALSE;
my_bool innobase_fast_shutdown = TRUE;
@@ -2079,7 +2079,10 @@ ha_innobase::index_read(
start or end of index; this can
also contain an InnoDB row id, in
which case key_len is the InnoDB
- row id length */
+ row id length; the key value can
+ also be a prefix of a full key value,
+ and the last column can be a prefix
+ of a full column */
uint key_len,/* in: key value length */
enum ha_rkey_function find_flag)/* in: search flags from my_base.h */
{
@@ -2169,24 +2172,24 @@ ha_innobase::index_read(
DBUG_RETURN(error);
}
-
-/*
- The following functions works like index_read, but it find the last
- row with the current index prefix.
- This code is disabled until Heikki has verified that InnoDB support the
- HA_READ_PREFIX_LAST flag and removed the HA_NOT_READ_PREFIX_LAST
- flag from ha_innodb.h
-*/
+/***********************************************************************
+The following functions works like index_read, but it find the last
+row with the current key value or prefix. */
int
-ha_innobase::index_read_last(mysql_byte *buf,
- const mysql_byte *key_ptr,
- uint key_len)
+ha_innobase::index_read_last(
+/*=========================*/
+ /* out: 0, HA_ERR_KEY_NOT_FOUND, or an
+ error code */
+ mysql_byte* buf, /* out: fetched row */
+ const mysql_byte* key_ptr, /* in: key value, or a prefix of a full
+ key value */
+ uint key_len) /* in: length of the key val or prefix
+ in bytes */
{
- return index_read(buf, key_ptr, key_len, HA_READ_PREFIX_LAST);
+ return(index_read(buf, key_ptr, key_len, HA_READ_PREFIX_LAST));
}
-
/************************************************************************
Changes the active index of a handle. */
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 2addd957c8c..ed517954a37 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -96,7 +96,7 @@ class ha_innobase: public handler
ulong index_flags(uint idx) const
{
return (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER |
- HA_NOT_READ_PREFIX_LAST | HA_KEY_READ_ONLY);
+ HA_KEY_READ_ONLY);
}
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return MAX_KEY; }
@@ -170,6 +170,7 @@ class ha_innobase: public handler
extern bool innodb_skip;
extern uint innobase_init_flags, innobase_lock_type;
+extern uint innobase_flush_log_at_trx_commit;
extern ulong innobase_cache_size;
extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
extern long innobase_lock_scan_time;
@@ -182,7 +183,7 @@ extern char *innobase_data_home_dir, *innobase_data_file_path;
extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
extern char *innobase_unix_file_flush_method;
/* The following variables have to be my_bool for SHOW VARIABLES to work */
-extern my_bool innobase_flush_log_at_trx_commit, innobase_log_archive,
+extern my_bool innobase_log_archive,
innobase_use_native_aio, innobase_fast_shutdown;
extern TYPELIB innobase_lock_typelib;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 1bf94ae75d0..609e0042704 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2334,7 +2334,7 @@ Item *get_system_var(enum_var_type var_type, LEX_STRING name)
THD *thd=current_thd;
Item *item;
sys_var *var;
- char buff[MAX_SYS_VAR_LENGTH+3];
+ char buff[MAX_SYS_VAR_LENGTH+3+8], *pos;
if (!(var= find_sys_var(name.str)))
{
@@ -2346,8 +2346,14 @@ Item *get_system_var(enum_var_type var_type, LEX_STRING name)
thd->safe_to_cache_query=0;
buff[0]='@';
buff[1]='@';
- memcpy(buff+2, var->name, var->name_length+1);
- item->set_name(buff,var->name_length+2); // Will allocate name
+ pos=buff+2;
+ if (var_type == OPT_SESSION)
+ pos=strmov(pos,"session.");
+ else if (var_type == OPT_GLOBAL)
+ pos=strmov(pos,"global.");
+ memcpy(pos, var->name, var->name_length+1);
+ // set_name() will allocate the name
+ item->set_name(buff,(uint) (pos-buff)+var->name_length);
return item;
}
diff --git a/sql/log.cc b/sql/log.cc
index e42d9ffa2fa..ccd3954e172 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -389,12 +389,12 @@ err:
the NEXT log file name in the index file.
log_name Filename to find in the index file.
Is a null pointer if we want to read the first entry
- need_mutex Set this to 1 if the parent doesn't already have a
+ need_lock Set this to 1 if the parent doesn't already have a
lock on LOCK_index
NOTE
- On systems without the truncate function the file will end with one ore
- more empty lines
+ On systems without the truncate function the file will end with one or
+ more empty lines. These will be ignored when reading the file.
RETURN VALUES
0 ok
@@ -1388,6 +1388,7 @@ void MYSQL_LOG:: wait_for_update(THD* thd)
This can be set to 0 if we are going to do call open
at once after close, in which case we don't want to
close the index file.
+ We only write a 'stop' event to the log if exiting is set
*/
void MYSQL_LOG::close(bool exiting)
@@ -1396,7 +1397,7 @@ void MYSQL_LOG::close(bool exiting)
DBUG_PRINT("enter",("exiting: %d", (int) exiting));
if (is_open())
{
- if (log_type == LOG_BIN && !no_auto_events)
+ if (log_type == LOG_BIN && !no_auto_events && exiting)
{
Stop_log_event s;
s.set_log_pos(this);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 1f7a4013d80..ec5b7c4b5a5 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -690,7 +690,10 @@ 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", llstr(pos, buf));
+ if (flags & LOG_EVENT_FORCED_ROTATE_F)
+ fprintf(file," forced by master");
+ fputc('\n', file);
fflush(file);
}
@@ -730,20 +733,22 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
buf += header_size;
if (old_format)
{
- ident_len = (uchar)(event_len - OLD_HEADER_LEN);
+ ident_len = (uint)(event_len - OLD_HEADER_LEN);
pos = 4;
ident_offset = 0;
}
else
{
- ident_len = (uchar)(event_len - ROTATE_EVENT_OVERHEAD);
+ ident_len = (uint)(event_len - ROTATE_EVENT_OVERHEAD);
pos = uint8korr(buf + R_POS_OFFSET);
ident_offset = ROTATE_HEADER_LEN;
}
- if (!(new_log_ident = (char*) my_memdup((byte*) buf + ident_offset,
- (uint) ident_len, MYF(MY_WME))))
+ set_if_smaller(ident_len,FN_REFLEN-1);
+ if (!(new_log_ident= (char*) my_strdup_with_length((byte*) buf +
+ ident_offset,
+ (uint) ident_len,
+ MYF(MY_WME))))
return;
-
alloced = 1;
}
@@ -1614,7 +1619,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
int expected_error,actual_error = 0;
init_sql_alloc(&thd->mem_root, 8192,0);
thd->db = rewrite_db((char*)db);
- DBUG_ASSERT(q_len == strlen(query));
/*
InnoDB internally stores the master log position it has processed so far;
@@ -1643,6 +1647,8 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
if (ignored_error_code((expected_error = error_code)) ||
!check_expected_error(thd,rli,expected_error))
{
+ mysql_log.write(thd,COM_QUERY,"%s",thd->query);
+ DBUG_PRINT("query",("%s",thd->query));
mysql_parse(thd, thd->query, q_len);
if ((expected_error != (actual_error = thd->net.last_errno)) &&
expected_error &&
@@ -1861,71 +1867,34 @@ int Stop_log_event::exec_event(struct st_relay_log_info* rli)
Got a rotate log even from the master
IMPLEMENTATION
- - Rotate the log file if the name of the log file changed
- (In practice this should always be the case)
+ This is mainly used so that we can later figure out the logname and
+ position for the master.
- TODO
- - Investigate/Test if we can't ignore all rotate log events
- that we get from the master (and not even write it to the local
- binary log).
+ We can't rotate the slave as this will cause infinitive rotations
+ in a A -> B -> A setup.
RETURN VALUES
- 0 ok
- 1 Impossible new log file name (rotate log event is ignored)
-*/
+ 0 ok
+ */
int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
{
- bool rotate_binlog = 0, write_slave_event = 0;
char* log_name = rli->master_log_name;
DBUG_ENTER("Rotate_log_event::exec_event");
pthread_mutex_lock(&rli->data_lock);
- /*
- TODO: probably needs re-write
- rotate local binlog only if the name of remote has changed
- */
- if (!*log_name || (memcmp(log_name, new_log_ident, ident_len) ||
- log_name[ident_len] != 0))
- {
- write_slave_event = (!(flags & LOG_EVENT_FORCED_ROTATE_F) &&
- mysql_bin_log.is_open());
- rotate_binlog = (*log_name && write_slave_event);
- if (ident_len >= sizeof(rli->master_log_name))
- {
- // This should be impossible
- pthread_mutex_unlock(&rli->data_lock);
- DBUG_RETURN(1);
- }
- memcpy(log_name, new_log_ident, ident_len);
- log_name[ident_len] = 0;
- }
+ memcpy(log_name, new_log_ident, ident_len+1);
rli->master_log_pos = pos;
rli->relay_log_pos += get_event_len();
- if (rotate_binlog)
- {
- mysql_bin_log.new_file();
- rli->master_log_pos = BIN_LOG_HEADER_SIZE;
- }
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) rli->master_log_pos));
- pthread_cond_broadcast(&rli->data_cond);
pthread_mutex_unlock(&rli->data_lock);
+ pthread_cond_broadcast(&rli->data_cond);
flush_relay_log_info(rli);
-
- if (write_slave_event)
- {
- Slave_log_event s(thd, rli);
- if (s.master_host)
- {
- s.set_log_pos(&mysql_bin_log);
- s.server_id = ::server_id;
- mysql_bin_log.write(&s);
- }
- }
DBUG_RETURN(0);
}
+
int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
{
switch (type) {
diff --git a/sql/log_event.h b/sql/log_event.h
index b69643c366a..5f7aa4ad586 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -522,16 +522,15 @@ class Rotate_log_event: public Log_event
{
public:
const char* new_log_ident;
- uchar ident_len;
ulonglong pos;
+ uint ident_len;
bool alloced;
#ifndef MYSQL_CLIENT
Rotate_log_event(THD* thd_arg, const char* new_log_ident_arg,
uint ident_len_arg = 0,ulonglong pos_arg = 4)
: Log_event(thd_arg), new_log_ident(new_log_ident_arg),
- ident_len(ident_len_arg ? ident_len_arg :
- (uint) strlen(new_log_ident_arg)), pos(pos_arg),
- alloced(0)
+ pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
+ (uint) strlen(new_log_ident_arg)), alloced(0)
{}
void pack_info(String* packet);
int exec_event(struct st_relay_log_info* rli);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 172ed0a2968..75e6368712a 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3039,7 +3039,7 @@ struct my_option my_long_options[] =
"Set to 0 if you don't want to flush logs",
(gptr*) &innobase_flush_log_at_trx_commit,
(gptr*) &innobase_flush_log_at_trx_commit,
- 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ 0, GET_INT, OPT_ARG, 0, 0, 2, 0, 0, 0},
{"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
"With which method to flush data", (gptr*) &innobase_unix_file_flush_method,
(gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index bb7100f31be..122793b07a7 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -237,6 +237,7 @@ my_net_write(NET *net,const char *packet,ulong len)
buff[3]= (uchar) net->pkt_nr++;
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
return 1;
+ DBUG_DUMP("packet_header",(char*) buff,NET_HEADER_SIZE);
return net_write_buff(net,packet,len);
}
@@ -615,6 +616,7 @@ my_real_read(NET *net, ulong *complen)
("Packets out of order (Found: %d, expected %u)",
(int) net->buff[net->where_b + 3],
net->pkt_nr));
+ DBUG_DUMP("packet_header",(char*) net->buff+net->where_b, 4);
#ifdef EXTRA_DEBUG
fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
(int) net->buff[net->where_b + 3],
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 4d8290628a7..181d97ceacc 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2623,13 +2623,19 @@ int QUICK_SELECT_DESC::get_next()
}
else
{
+ /* Heikki changed Sept 11, 2002: since InnoDB does not store the cursor
+ position if READ_KEY_EXACT is used to a primary key with all
+ key columns specified, we must use below HA_READ_KEY_OR_NEXT,
+ so that InnoDB stores the cursor position and is able to move
+ the cursor one step backward after the search. */
+
DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range));
/* Note: even if max_key is only a prefix, HA_READ_AFTER_KEY will
* do the right thing - go past all keys which match the prefix */
result=file->index_read(record, (byte*) range->max_key,
range->max_length,
((range->flag & NEAR_MAX) ?
- HA_READ_KEY_EXACT : HA_READ_AFTER_KEY));
+ HA_READ_KEY_OR_NEXT : HA_READ_AFTER_KEY));
result = file->index_prev(record);
}
if (result)
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 232c3de2570..81627dceb0e 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -236,7 +236,7 @@ static int find_target_pos(LEX_MASTER_INFO *mi, IO_CACHE *log, char *errmsg)
return 1;
}
- if (ev->log_pos == log_pos && ev->server_id == target_server_id)
+ if (ev->log_pos >= log_pos && ev->server_id == target_server_id)
{
delete ev;
mi->pos = my_b_tell(log);
@@ -261,23 +261,24 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg)
int error = 1;
int cmp_res;
LINT_INIT(cmp_res);
+ DBUG_ENTER("translate_master");
if (!mysql_bin_log.is_open())
{
strmov(errmsg,"Binary log is not open");
- return 1;
+ DBUG_RETURN(1);
}
if (!server_id_supplied)
{
strmov(errmsg, "Misconfigured master - server id was not set");
- return 1;
+ DBUG_RETURN(1);
}
if (mysql_bin_log.find_log_pos(&linfo, NullS, 1))
{
strmov(errmsg,"Could not find first log");
- return 1;
+ DBUG_RETURN(1);
}
thd->current_linfo = &linfo;
@@ -366,7 +367,7 @@ err:
if (last_file >= 0 && last_file != file)
(void) my_close(last_file, MYF(MY_WME));
- return error;
+ DBUG_RETURN(error);
}
@@ -423,12 +424,9 @@ int show_new_master(THD* thd)
if (translate_master(thd, lex_mi, errmsg))
{
if (errmsg[0])
- net_printf(&thd->net, ER_ERROR_WHEN_EXECUTING_COMMAND,
- "SHOW NEW MASTER", errmsg);
- else
- send_error(&thd->net, 0);
-
- DBUG_RETURN(1);
+ my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
+ "SHOW NEW MASTER", errmsg);
+ DBUG_RETURN(-1);
}
else
{
diff --git a/sql/slave.cc b/sql/slave.cc
index 7a1a1e2a6ef..7cc37d5f691 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1468,6 +1468,8 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
int event_count = 0;
ulong init_abort_pos_wait;
DBUG_ENTER("wait_for_pos");
+ DBUG_PRINT("enter",("master_log_name: '%s' pos: %ld",
+ master_log_name, (ulong) master_log_pos));
pthread_mutex_lock(&data_lock);
// abort only if master info changes during wait
@@ -1498,6 +1500,7 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
if (pos_reached || thd->killed)
break;
+ DBUG_PRINT("info",("Waiting for master update"));
const char* msg = thd->enter_cond(&data_cond, &data_lock,
"Waiting for master update");
pthread_cond_wait(&data_cond, &data_lock);
@@ -2308,21 +2311,44 @@ err:
}
/*
- We assume we already locked mi->data_lock
+ Start using a new binary log on the master
+
+ SYNOPSIS
+ process_io_rotate()
+ mi master_info for the slave
+ rev The rotate log event read from the binary log
+
+ DESCRIPTION
+ Updates the master info and relay data with the place in the next binary
+ log where we should start reading.
+
+ NOTES
+ We assume we already locked mi->data_lock
+
+ RETURN VALUES
+ 0 ok
+ 1 Log event is illegal
*/
-static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev)
+static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev)
{
+ int return_val= 1;
DBUG_ENTER("process_io_rotate");
+ safe_mutex_assert_owner(&mi->data_lock);
if (unlikely(!rev->is_valid()))
DBUG_RETURN(1);
- DBUG_ASSERT(rev->ident_len < sizeof(mi->master_log_name));
- memcpy(mi->master_log_name,rev->new_log_ident,
- rev->ident_len);
- mi->master_log_name[rev->ident_len] = 0;
- mi->master_log_pos = rev->pos;
- DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
+
+ memcpy(mi->master_log_name, rev->new_log_ident, rev->ident_len+1);
+ mi->master_log_pos= rev->pos;
+
+ pthread_mutex_lock(&mi->rli.data_lock);
+ memcpy(mi->rli.master_log_name, rev->new_log_ident, rev->ident_len+1);
+ mi->rli.master_log_pos= rev->pos;
+ pthread_mutex_unlock(&mi->rli.data_lock);
+
+ DBUG_PRINT("info", ("master_log_pos: '%s' %d",
+ mi->master_log_name, (ulong) mi->master_log_pos));
#ifndef DBUG_OFF
/*
If we do not do this, we will be getting the first
@@ -2335,23 +2361,24 @@ static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev)
}
/*
- TODO: verify the issue with stop events, see if we need them at all
- in the relay log
- TODO: test this code before release - it has to be tested on a separte
- setup with 3.23 master
+ TODO:
+ Test this code before release - it has to be tested on a separate
+ setup with 3.23 master
*/
static int queue_old_event(MASTER_INFO *mi, const char *buf,
ulong event_len)
{
const char *errmsg = 0;
- bool inc_pos = 1;
- bool processed_stop_event = 0;
- char* tmp_buf = 0;
+ ulong inc_pos;
+ bool ignore_event= 0;
+ char *tmp_buf = 0;
+ RELAY_LOG_INFO *rli= &mi->rli;
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
+ /*
+ If we get Load event, we need to pass a non-reusable buffer
+ to read_log_event, so we do a trick
*/
if (buf[EVENT_TYPE_OFFSET] == LOAD_EVENT)
{
@@ -2377,54 +2404,52 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
pthread_mutex_lock(&mi->data_lock);
ev->log_pos = mi->master_log_pos;
switch (ev->get_type_code()) {
+ case STOP_EVENT:
+ ignore_event= mi->ignore_stop_event;
+ mi->ignore_stop_event=0;
+ inc_pos= event_len;
+ break;
case ROTATE_EVENT:
if (unlikely(process_io_rotate(mi,(Rotate_log_event*)ev)))
{
delete ev;
pthread_mutex_unlock(&mi->data_lock);
- DBUG_ASSERT(!tmp_buf);
DBUG_RETURN(1);
}
mi->ignore_stop_event=1;
- inc_pos = 0;
- break;
- case STOP_EVENT:
- processed_stop_event=1;
+ inc_pos= 0;
break;
case CREATE_FILE_EVENT:
{
+ /* We come here when and only when tmp_buf != 0 */
+ DBUG_ASSERT(tmp_buf);
int error = process_io_create_file(mi,(Create_file_log_event*)ev);
delete ev;
mi->master_log_pos += event_len;
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
pthread_mutex_unlock(&mi->data_lock);
- DBUG_ASSERT(tmp_buf);
my_free((char*)tmp_buf, MYF(0));
DBUG_RETURN(error);
}
default:
mi->ignore_stop_event=0;
+ inc_pos= event_len;
break;
}
- if (likely(!processed_stop_event || !mi->ignore_stop_event))
+ if (likely(!ignore_event))
{
- if (unlikely(mi->rli.relay_log.append(ev)))
+ if (unlikely(rli->relay_log.append(ev)))
{
delete ev;
pthread_mutex_unlock(&mi->data_lock);
- DBUG_ASSERT(!tmp_buf);
DBUG_RETURN(1);
}
- mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total);
+ rli->relay_log.harvest_bytes_written(&rli->log_space_total);
}
delete ev;
- if (likely(inc_pos))
- mi->master_log_pos += event_len;
+ mi->master_log_pos+= inc_pos;
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
- if (unlikely(processed_stop_event))
- mi->ignore_stop_event=1;
pthread_mutex_unlock(&mi->data_lock);
- DBUG_ASSERT(!tmp_buf);
DBUG_RETURN(0);
}
@@ -2435,48 +2460,52 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
{
- int error=0;
- bool inc_pos = 1;
- bool processed_stop_event = 0;
+ int error= 0;
+ ulong inc_pos;
+ bool ignore_event= 0;
+ RELAY_LOG_INFO *rli= &mi->rli;
DBUG_ENTER("queue_event");
if (mi->old_format)
DBUG_RETURN(queue_old_event(mi,buf,event_len));
pthread_mutex_lock(&mi->data_lock);
-
+
/*
TODO: figure out if other events in addition to Rotate
require special processing
*/
switch (buf[EVENT_TYPE_OFFSET]) {
case STOP_EVENT:
- processed_stop_event=1;
+ ignore_event= mi->ignore_stop_event;
+ mi->ignore_stop_event= 0;
+ inc_pos= event_len;
break;
case ROTATE_EVENT:
{
Rotate_log_event rev(buf,event_len,0);
if (unlikely(process_io_rotate(mi,&rev)))
+ {
+ pthread_mutex_unlock(&mi->data_lock);
DBUG_RETURN(1);
- inc_pos=0;
- mi->ignore_stop_event=1;
+ }
+ mi->ignore_stop_event= 1;
+ inc_pos= 0;
break;
}
default:
- mi->ignore_stop_event=0;
+ mi->ignore_stop_event= 0;
+ inc_pos= event_len;
break;
}
- if (likely((!processed_stop_event || !mi->ignore_stop_event) &&
- !(error = mi->rli.relay_log.appendv(buf,event_len,0))))
+ if (likely(!ignore_event &&
+ !(error= rli->relay_log.appendv(buf,event_len,0))))
{
- if (likely(inc_pos))
- mi->master_log_pos += event_len;
+ mi->master_log_pos+= inc_pos;
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
- mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total);
+ rli->relay_log.harvest_bytes_written(&rli->log_space_total);
}
- if (unlikely(processed_stop_event))
- mi->ignore_stop_event=1;
pthread_mutex_unlock(&mi->data_lock);
DBUG_RETURN(error);
}
diff --git a/sql/slave.h b/sql/slave.h
index b527aceb432..cbcd2957476 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -312,6 +312,7 @@ typedef struct st_master_info
} MASTER_INFO;
+
int queue_event(MASTER_INFO* mi,const char* buf,ulong event_len);
typedef struct st_table_rule_ent
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 519ac0e7ce2..c44fe2d053d 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1310,18 +1310,24 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
if (table->fields >= 31) /* From 4.0.0 we have more fields */
{
/* We write down SSL related ACL stuff */
- table->field[25]->store("",0);
- table->field[26]->store("",0);
- table->field[27]->store("",0);
switch (thd->lex.ssl_type) {
case SSL_TYPE_ANY:
table->field[24]->store("ANY",3);
+ table->field[25]->store("",0);
+ table->field[26]->store("",0);
+ table->field[27]->store("",0);
break;
case SSL_TYPE_X509:
table->field[24]->store("X509",4);
+ table->field[25]->store("",0);
+ table->field[26]->store("",0);
+ table->field[27]->store("",0);
break;
case SSL_TYPE_SPECIFIED:
table->field[24]->store("SPECIFIED",9);
+ table->field[25]->store("",0);
+ table->field[26]->store("",0);
+ table->field[27]->store("",0);
if (thd->lex.ssl_cipher)
table->field[25]->store(thd->lex.ssl_cipher,
strlen(thd->lex.ssl_cipher));
@@ -1332,8 +1338,8 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
table->field[27]->store(thd->lex.x509_subject,
strlen(thd->lex.x509_subject));
break;
- default:
- table->field[24]->store("",0);
+ case SSL_TYPE_NOT_SPECIFIED:
+ break; // Nothing to do
}
USER_RESOURCES mqh = thd->lex.mqh;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e291334a29d..2973e7bd1b1 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1356,7 +1356,12 @@ mysql_execute_command(void)
{
if (check_global_access(thd, REPL_SLAVE_ACL))
goto error;
+#ifndef WORKING_NEW_MASTER
+ net_printf(&thd->net, ER_NOT_SUPPORTED_YET, "SHOW NEW MASTER");
+ res= 1;
+#else
res = show_new_master(thd);
+#endif
break;
}
case SQLCOM_SHOW_SLAVE_HOSTS:
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 628b1775778..47b258d9ed2 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -910,6 +910,11 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
const char* log_file_name2, ulonglong log_pos2)
{
int res;
+ /*
+ TODO: Change compare function to work with file name of type
+ '.999 and .1000'
+ */
+
if ((res = strcmp(log_file_name1, log_file_name2)))
return res;
if (log_pos1 > log_pos2)
@@ -919,6 +924,7 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
return -1;
}
+
int show_binlog_events(THD* thd)
{
DBUG_ENTER("show_binlog_events");
@@ -1010,15 +1016,16 @@ err:
if (errmsg)
{
- net_printf(&thd->net, ER_ERROR_WHEN_EXECUTING_COMMAND,
- "SHOW BINLOG EVENTS", errmsg);
- DBUG_RETURN(1);
+ my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
+ "SHOW BINLOG EVENTS", errmsg);
+ DBUG_RETURN(-1);
}
send_eof(&thd->net);
DBUG_RETURN(0);
}
+
int show_binlog_info(THD* thd)
{
DBUG_ENTER("show_binlog_info");
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b535d9a4466..b63f3e08911 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3598,7 +3598,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
List_iterator_fast<Item> li(fields);
Item *item;
Field **tmp_from_field=from_field;
- while ((item=li++))
+ for(uint field_no=0; ((item=li++)); field_no++)
{
Item::Type type=item->type();
if (not_all_columns)
@@ -3613,8 +3613,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
param->using_indirect_summary_function=1;
continue;
}
- if (item->const_item()) // We don't have to store this
- continue;
+ if (item->const_item() && field_no >= hidden_field_count)
+ continue; // We don't have to store this
}
if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields)
{ /* Can't calc group yet */
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 0482313481d..021f3f07ad5 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -627,7 +627,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (!(key_info->flags & HA_NULL_PART_KEY))
unique_key=1;
key_info->key_length=(uint16) key_length;
- uint max_key_length= max(file->max_key_length(), MAX_KEY_LENGTH);
+ uint max_key_length= min(file->max_key_length(), MAX_KEY_LENGTH);
if (key_length > max_key_length && key->type != Key::FULLTEXT)
{
my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length);
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 8791f547ea6..cd85b3dbaf2 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -285,12 +285,14 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
/* TODO: This should be changed to reader locks someday! */
pthread_mutex_lock(&THR_LOCK_udf);
- udf=(udf_func*) hash_search(&udf_hash,(byte*) name,
- length ? length : (uint) strlen(name));
- if (!udf->dlhandle)
- udf=0; // Could not be opened
- else if (mark_used)
- udf->usage_count++;
+ if ((udf=(udf_func*) hash_search(&udf_hash,(byte*) name,
+ length ? length : (uint) strlen(name))))
+ {
+ if (!udf->dlhandle)
+ udf=0; // Could not be opened
+ else if (mark_used)
+ udf->usage_count++;
+ }
pthread_mutex_unlock(&THR_LOCK_udf);
DBUG_RETURN(udf);
}