mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Merge jcole@work.mysql.com:/home/bk/mysql-4.0
into mugatu.spaceapes.com:/home/jcole/bk/mysql-4.0 configure.in: Auto merged
This commit is contained in:
commit
168efb92ce
98 changed files with 1824 additions and 1242 deletions
|
@ -64,3 +64,4 @@ venu@work.mysql.com
|
|||
worm@altair.is.lan
|
||||
zak@balfor.local
|
||||
zak@linux.local
|
||||
tfr@indrek.tfr.cafe.ee
|
||||
|
|
98
Docs/Flags/new-zealand.eps
Normal file
98
Docs/Flags/new-zealand.eps
Normal file
|
@ -0,0 +1,98 @@
|
|||
%!PS-Adobe-2.0 EPSF-2.0
|
||||
%%Creator: pnmtops
|
||||
%%Title: new-zealand.ps
|
||||
%%Pages: 1
|
||||
%%BoundingBox: 290 385 321 407
|
||||
%%EndComments
|
||||
/readstring {
|
||||
currentfile exch readhexstring pop
|
||||
} bind def
|
||||
/rpicstr 32 string def
|
||||
/gpicstr 32 string def
|
||||
/bpicstr 32 string def
|
||||
%%EndProlog
|
||||
%%Page: 1 1
|
||||
gsave
|
||||
290.64 385.44 translate
|
||||
30.72 21.12 scale
|
||||
32 22 8
|
||||
[ 32 0 0 -22 0 22 ]
|
||||
{ rpicstr readstring }
|
||||
{ gpicstr readstring }
|
||||
{ bpicstr readstring }
|
||||
true 3
|
||||
colorimage
|
||||
000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000ce770d08080874c6770808080c77ce0808080808080808
|
||||
0808080808080800003e58050000004d005000000005583e000000000000
|
||||
000000000000000000000042b4b6b5b5b5aa00abb5b5b5b6b442b5b5b5b5
|
||||
b5b5b5b5b5b5b5b5b5b5b50000aed2b433080874c677080833b4d2ae0808
|
||||
0808080808080808080808080800008a3d5e2b00004d005000002b5e3d8a
|
||||
0000000000000000000000000000000000bb3d81bfb5b5aa00abb5b5bf81
|
||||
3dbbb5b5b5b5b5b5b5b5b5b5b5b5b5b5b500000967d3ce770d74c6770c77
|
||||
ced36709080808080808083e230808080808080000015f733e58054d0050
|
||||
05583e735f0100000000000000341c0000000000000000b5cb7d42b4b6aa
|
||||
00abb6b4427dcbb5b5b5b5b5b5b5b5bfbcb5b5b5b5b5b50000080825aed2
|
||||
b49bc69db3d2ae25080808080808080a65a49a5a0808080808000000001e
|
||||
893d5e7400765d3d8a1e000000000000000253444c4d00000000000000b5
|
||||
b5bdbb3d81b300b4813dbbbdb5b5b5b5b5b5b5b6bf7285c3b5b5b5b5b500
|
||||
00d3d3d3d3d6d5d3c6d3d5d6d3d3d3d30808080808081ccfc01308080808
|
||||
0800004d4d4d4d4f4d4200424d4f4d4d4d4d00000000000015484a0b0000
|
||||
00000000004f4f4f4f4f4d4200424d4f4f4f4f4fb5b5b5b5b5b5ba4e5fb8
|
||||
b5b5b5b5b50000d6d6d6d6d6d6d3c6d3d6d6d6d6d6d60808080808082c59
|
||||
6b1808080808080000505050505050420042505050505050000000000000
|
||||
25475a1000000000000000505050505050420042505050505050b5b5b5b5
|
||||
b5b5bfbdc2b9b5b5b5b5b50000080825aed2b49bc69db4d2ae2508080808
|
||||
08080908080808080832080808000000001e8a3d5e7400775e3d8a1e0000
|
||||
00000000010000000000002c0000000000b5b5bdbb3d81b300b4813dbbbd
|
||||
b5b5b5b5b5b5b5b5b5b5b5b5b5c1b5b5b500000967d3ce770d74c6770c77
|
||||
ced36709080808086408080808183eb14528080000015f733e58054d0050
|
||||
05583e735f010000000058000000001138714021000000b5cb7d42b4b6aa
|
||||
00abb6b4427dcbb5b5b5b5b5c6b5b5b5b5b9c49bc6beb50000aed2b43308
|
||||
0874c677080833b4d2ae08083188c8821e08080a7ec8a6190800008a3d5e
|
||||
2b00004d005000002b5e3d8a00002b534b591700000252074912000000bb
|
||||
3d81bfb5b5aa00abb5b5bf813dbbb5b5c09f58abbbb5b5b6a70776bab500
|
||||
00ce770d08080874c6770808080c77ce08080882cd5f0808080861798a08
|
||||
0800003e58050000004d005000000005583e0000004b2649000000005249
|
||||
660000000042b4b6b5b5b5aa00abb5b5b5b6b442b5b5b59a26b9b5b5b5b5
|
||||
c2a1b3b5b50000080808080808080808080808080808080808622d540808
|
||||
080810081008080000000000000000000000000000000000000000552548
|
||||
0000000008000800000000b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5c4
|
||||
bec2b5b5b5b5b7b5b7b5b500000808080808080808080808080808080808
|
||||
080808080808080808080808080000000000000000000000000000000000
|
||||
0000000000000000000000000000000000b5b5b5b5b5b5b5b5b5b5b5b5b5
|
||||
b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b500000808080808080808080808
|
||||
080808080808080808080808080808080808080000000000000000000000
|
||||
0000000000000000000000000000000000000000000000b5b5b5b5b5b5b5
|
||||
b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b500000808080808
|
||||
080808080808080808080808080808080808080808080808080000000000
|
||||
0000000000000000000000000000000000000000000000000000000000b5
|
||||
b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b500
|
||||
00080808080808080808080808080808080808080808081c080808080808
|
||||
080000000000000000000000000000000000000000000000001400000000
|
||||
0000000000b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5bab5b5
|
||||
b5b5b5b5b500000808080808080808080808080808080808080808080886
|
||||
200808080808080000000000000000000000000000000000000000000000
|
||||
005f190000000000000000b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5
|
||||
b5b5b5adbcb5b5b5b5b5b500000808080808080808080808080808080808
|
||||
0808081196cdc94808080808080000000000000000000000000000000000
|
||||
00000000000a7728674100000000000000b5b5b5b5b5b5b5b5b5b5b5b5b5
|
||||
b5b5b5b5b5b5b5b8bc2978c5b5b5b5b5b500000808080808080808080808
|
||||
080808080808080808083dada00808080808080000000000000000000000
|
||||
0000000000000000000000003555670000000000000000b5b5b5b5b5b5b5
|
||||
b5b5b5b5b5b5b5b5b5b5b5b5b5b5c17e9fb5b5b5b5b5b500000808080808
|
||||
08080808080808080808080808080808240a250908080808080000000000
|
||||
0000000000000000000000000000000000001d021e0100000000000000b5
|
||||
b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5bdb5bdb5b5b5b5b5b500
|
||||
000808080808080808080808080808080808080808080808080808080808
|
||||
080000000000000000000000000000000000000000000000000000000000
|
||||
0000000000b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5
|
||||
b5b5b5b5b500000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000
|
||||
grestore
|
||||
showpage
|
||||
%%Trailer
|
BIN
Docs/Flags/new-zealand.gif
Normal file
BIN
Docs/Flags/new-zealand.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 661 B |
BIN
Docs/Flags/new-zealand.pdf
Normal file
BIN
Docs/Flags/new-zealand.pdf
Normal file
Binary file not shown.
0
Docs/Flags/new-zealand.txt
Normal file
0
Docs/Flags/new-zealand.txt
Normal file
|
@ -1,12 +1,13 @@
|
|||
OriginalAuthor: PaulDuBois
|
||||
OriginalAuthor: Paul DuBois
|
||||
|
||||
!!! ManualStyleGuidelines
|
||||
|
||||
''Version 1.0''
|
||||
''Version 1.1''
|
||||
|
||||
!! Revision History
|
||||
|
||||
* 2002-05-17 ArjenLentz - Version 1.0, Posted to Wiki
|
||||
* 2002-06-03 ArjenLentz - Version 1.1, updates.
|
||||
|
||||
!! MySQL Manual Style Guidelines
|
||||
|
||||
|
@ -277,3 +278,5 @@ Logical NOT/OR/AND are operators, not functions, so they take operands, not argu
|
|||
|
||||
It's NetWare, not Netware (as per Novell's trademark guidelines).
|
||||
|
||||
It's deprecated, not depricated.
|
||||
|
||||
|
|
|
@ -14135,8 +14135,9 @@ though.
|
|||
|
||||
@item --core-file
|
||||
Write a core file if @code{mysqld} dies. For some systems you must also
|
||||
specify @code{--core-file-size} to @code{safe_mysqld}. @xref{safe_mysqld, ,
|
||||
@code{safe_mysqld}}. Note that on some system like Solaris, you will
|
||||
specify @code{--core-file-size} to @code{safe_mysqld}.
|
||||
@xref{safe_mysqld, ,@code{safe_mysqld}}.
|
||||
Note that on some systems, like Solaris, you will
|
||||
not get a core file if you are also using the @code{--user} option.
|
||||
|
||||
@item -h, --datadir=path
|
||||
|
@ -14340,7 +14341,8 @@ privilege.
|
|||
|
||||
@item --skip-stack-trace
|
||||
Don't write stack traces. This option is useful when you are running
|
||||
@code{mysqld} under a debugger. @xref{Debugging server}.
|
||||
@code{mysqld} under a debugger. On some systems you also have to use
|
||||
this option to get a core file. @xref{Debugging server}.
|
||||
|
||||
@item --skip-thread-priority
|
||||
Disable using thread priorities for faster response time.
|
||||
|
@ -19981,7 +19983,7 @@ is automatically enlarged, up to @code{max_allowed_packet} bytes.)
|
|||
@item @code{net_read_timeout}
|
||||
Number of seconds to wait for more data from a connection before aborting
|
||||
the read. Note that when we don't expect data from a connection, the timeout
|
||||
is defined by @code{write_timeout}. See also @code{slave_read_timeout}.
|
||||
is defined by @code{write_timeout}. See also @code{slave_net_timeout}.
|
||||
|
||||
@item @code{net_retry_count}
|
||||
If a read on a communication port is interrupted, retry this many times
|
||||
|
@ -20060,7 +20062,7 @@ the @strong{process} privilege. This can improve security if you're
|
|||
concerned about people being able to see what databases other users
|
||||
have. See also @code{safe_show_database}.
|
||||
|
||||
@item @code{slave_read_timeout}
|
||||
@item @code{slave_net_timeout}
|
||||
Number of seconds to wait for more data from a master/slave connection
|
||||
before aborting the read.
|
||||
|
||||
|
@ -21192,17 +21194,17 @@ Usually, @code{myisampack} packs the datafile 40%-70%.
|
|||
MySQL uses memory mapping (@code{mmap()}) on compressed tables and
|
||||
falls back to normal read/write file usage if @code{mmap()} doesn't work.
|
||||
|
||||
There are currently two limitations with @code{myisampack}:
|
||||
Please note the following:
|
||||
@itemize @bullet
|
||||
@item
|
||||
After packing, the table is read-only.
|
||||
After packing, the table is read-only. This is generally intended
|
||||
(such as when accessing packed tables on a CD). Also allowing writes
|
||||
to a packed table is on our TODO list but with low priority.
|
||||
@item
|
||||
@code{myisampack} can also pack @code{BLOB} or @code{TEXT} columns. The
|
||||
older @code{pack_isam} could not do this.
|
||||
@code{myisampack} can also pack @code{BLOB} or @code{TEXT} columns.
|
||||
The older @code{pack_isam} (for @code{ISAM} tables) can not do this.
|
||||
@end itemize
|
||||
|
||||
Fixing these limitations is on our TODO list but with low priority.
|
||||
|
||||
@code{myisampack} is invoked like this:
|
||||
|
||||
@example
|
||||
|
@ -22660,9 +22662,12 @@ Overrides option --databases (-B).
|
|||
@item -T, --tab=path-to-some-directory
|
||||
Creates a @code{table_name.sql} file, that contains the SQL CREATE commands,
|
||||
and a @code{table_name.txt} file, that contains the data, for each give table.
|
||||
@strong{Note}: This only works if @code{mysqldump} is run on the same
|
||||
machine as the @code{mysqld} daemon. The format of the @file{.txt} file
|
||||
is made according to the @code{--fields-xxx} and @code{--lines--xxx} options.
|
||||
The format of the @file{.txt} file is made according to the
|
||||
@code{--fields-xxx} and @code{--lines--xxx} options.
|
||||
@strong{Note}: This option only works if @code{mysqldump} is run on the same
|
||||
machine as the @code{mysqld} daemon, and the user/group that @code{mysqld}
|
||||
is running as (normally user @code{mysql}, group @code{mysql}) needs to have
|
||||
permission to create/write a file at the location you specify.
|
||||
@item -u user_name, --user=user_name
|
||||
The MySQL user name to use when connecting to the server. The
|
||||
default value is your Unix login name.
|
||||
|
@ -24057,7 +24062,7 @@ Example:
|
|||
Tells the slave server not to start the slave on the startup. The user
|
||||
can start it later with @code{SLAVE START}.
|
||||
|
||||
@item @code{slave_read_timeout=#} @tab
|
||||
@item @code{slave_net_timeout=#} @tab
|
||||
Number of seconds to wait for more data from the master before aborting
|
||||
the read.
|
||||
@end multitable
|
||||
|
@ -29907,6 +29912,9 @@ have any of the values shown here. The index of each value is also shown:
|
|||
|
||||
An enumeration can have a maximum of 65535 elements.
|
||||
|
||||
Starting from 3.23.51 trailing spaces are automatically deleted from
|
||||
@code{ENUM} values when the table is created.
|
||||
|
||||
Lettercase is irrelevant when you assign values to an @code{ENUM} column.
|
||||
However, values retrieved from the column later have lettercase matching the
|
||||
values that were used to specify the allowable values at table creation time.
|
||||
|
@ -29923,6 +29931,8 @@ If you store a number into an @code{ENUM}, the number is treated as an
|
|||
index, and the value stored is the enumeration member with that index.
|
||||
(However, this will not work with @code{LOAD DATA}, which treats all
|
||||
input as strings.)
|
||||
It's not advisable to store numbers in an @code{ENUM} string because
|
||||
it will make things confusing.
|
||||
|
||||
@code{ENUM} values are sorted according to the order in which the enumeration
|
||||
members were listed in the column specification. (In other words,
|
||||
|
@ -29961,6 +29971,9 @@ any of these values:
|
|||
|
||||
A @code{SET} can have a maximum of 64 different members.
|
||||
|
||||
Starting from 3.23.51 trailing spaces are automatically deleted from
|
||||
@code{SET} values when the table is created.
|
||||
|
||||
MySQL stores @code{SET} values numerically, with the low-order bit
|
||||
of the stored value corresponding to the first set member. If you retrieve a
|
||||
@code{SET} value in a numeric context, the value retrieved has bits set
|
||||
|
@ -31369,6 +31382,17 @@ mysql> SELECT 'David!' LIKE 'David_';
|
|||
-> 1
|
||||
mysql> SELECT 'David!' LIKE '%D%v%';
|
||||
-> 1
|
||||
mysql> select TRUNCATE(-1,999,1);
|
||||
-> -1.9
|
||||
@end example
|
||||
|
||||
Starting from MySQL 3.23.51 all numbers are rounded towards zero.
|
||||
|
||||
If @code{D} is negative, then the whole part of the number is zeroed out:
|
||||
|
||||
@example
|
||||
mysql> select truncate(122,-2);
|
||||
-> 100
|
||||
@end example
|
||||
|
||||
To test for literal instances of a wildcard character, precede the character
|
||||
|
@ -47065,6 +47089,11 @@ the following things:
|
|||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Cleaned up @code{NULL} handling for default values in @code{DESCRIBE
|
||||
table_name}.
|
||||
@item
|
||||
Fixed @code{truncate()} to round up negative values to the nearest integer.
|
||||
@item
|
||||
Take down the @code{mysqld} daemon with @code{mysqladmin shutdown}, run
|
||||
@code{myisamchk --silent --force */*.MYI} on all tables, and restart the
|
||||
@code{mysqld} daemon. This will ensure that you are running from a clean
|
||||
|
@ -49314,6 +49343,18 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
|
|||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Fixed query cache align data bug.
|
||||
@item
|
||||
Fixed mutex bug in replication when reading from master fails.
|
||||
@item
|
||||
Added missing mutex in @code{TRUNCATE TABLE}; This fixes some core
|
||||
dump/hangup problems when using @code{TRUNCATE TABLE}.
|
||||
@item
|
||||
Fixed bug in multi-table @code{DELETE} when optimiser uses only indices.
|
||||
@item
|
||||
Fixed that @code{ALTER TABLE table_name RENAME new_table_name} is as fast
|
||||
as @code{RENAME TABLE}.
|
||||
@item
|
||||
Fixed bug in @code{GROUP BY} with two or more fields, where at least one
|
||||
field can contain @code{NULL} values.
|
||||
@item
|
||||
|
@ -49444,8 +49485,6 @@ specified with the @code{--sql-mode} option for @code{mysqld}. It disables
|
|||
unsigned arithmetic rules when it comes to subtraction. (This will make
|
||||
MySQL 4.0 behave more closely to 3.23 with @code{UNSIGNED} columns).
|
||||
@item
|
||||
Added @code{WITH MAX_QUERIES_PER_HOUR=#} to @code{GRANT} command.
|
||||
@item
|
||||
The result returned for all bit functions (@code{|}, @code{<<}, ...) is now of
|
||||
type @code{unsigned integer}.
|
||||
@item
|
||||
|
@ -49745,6 +49784,7 @@ users use this code as the rest of the code and because of this we are
|
|||
not yet 100% confident in this code.
|
||||
|
||||
@menu
|
||||
* News-3.23.52:: Changes in release 3.23.52
|
||||
* News-3.23.51:: Changes in release 3.23.51
|
||||
* News-3.23.50:: Changes in release 3.23.50 (21 Apr 2002)
|
||||
* News-3.23.49:: Changes in release 3.23.49
|
||||
|
@ -49800,11 +49840,25 @@ not yet 100% confident in this code.
|
|||
* News-3.23.0:: Changes in release 3.23.0 (Sep 1999: Alpha)
|
||||
@end menu
|
||||
|
||||
@node News-3.23.51, News-3.23.50, News-3.23.x, News-3.23.x
|
||||
@node News-3.23.52, News-3.23.51, News-3.23.x, News-3.23.x
|
||||
@appendixsubsec Changes in release 3.23.52
|
||||
@itemize @bullet
|
||||
@item
|
||||
Fixed possible problem in replication when doing @code{DROP DATABASE} on a
|
||||
database with InnoDB tables.
|
||||
@item
|
||||
Fixed that @code{mysql_info()} returns 0 for 'Duplicates' when using
|
||||
@code{INSERT DELAYED IGNORE}.
|
||||
@end itemize
|
||||
|
||||
@node News-3.23.51, News-3.23.50, News-3.23.52, News-3.23.x
|
||||
@appendixsubsec Changes in release 3.23.51
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Remove end space from @code{enum} values. (This fixed a problem with
|
||||
@code{SHOW CREATE TABLE}).
|
||||
@item
|
||||
Fixed bug in @code{CONCAT_WS()} that cut the result.
|
||||
@item
|
||||
Changed name of variables @code{Com_show_master_stat} to
|
||||
|
@ -55860,7 +55914,7 @@ The trace file is made with the @strong{DBUG} package by Fred Fish.
|
|||
|
||||
@cindex gdb, using
|
||||
|
||||
On most system you can also start @code{mysqld} from @code{gdb} to get
|
||||
On most systems you can also start @code{mysqld} from @code{gdb} to get
|
||||
more information if @code{mysqld} crashes.
|
||||
|
||||
With some older @code{gdb} versions on Linux you must use @code{run
|
||||
|
|
|
@ -71,10 +71,6 @@ FTP (@uref{ftp://mir1.ovh.net/ftp.mysql.com/})
|
|||
@image{Flags/france} France [Netsample] @@
|
||||
WWW (@uref{http://www.mysql.netsample.com/})
|
||||
|
||||
@item
|
||||
@image{Flags/france} France [Omegatomic] @@
|
||||
WWW (@uref{http://mysql.omegatomic.com/})
|
||||
|
||||
@item
|
||||
@image{Flags/france} France [Universite Paris 10] @@
|
||||
WWW (@uref{http://ftp.u-paris10.fr/mysql.com})
|
||||
|
@ -183,16 +179,16 @@ FTP (@uref{ftp://sunsite.icm.edu.pl/pub/unix/mysql/})
|
|||
WWW (@uref{http://darkstar.ist.utl.pt/mysql/})
|
||||
FTP (@uref{ftp://darkstar.ist.utl.pt/pub/mysql/})
|
||||
|
||||
@item
|
||||
@image{Flags/portugal} Portugal [Netc] @@
|
||||
WWW (@uref{http://ftp.netc.pt/pub/mysql/})
|
||||
FTP (@uref{ftp://ftp.netc.pt/pub/mysql/})
|
||||
|
||||
@item
|
||||
@image{Flags/portugal} Portugal [Netvisão] @@
|
||||
WWW (@uref{http://mysql.netvisao.pt/})
|
||||
FTP (@uref{ftp://mirrors2.netvisao.pt/pub/mysql/})
|
||||
|
||||
@item
|
||||
@image{Flags/portugal} Portugal [VIZZAVI] @@
|
||||
WWW (@uref{http://ftp.vizzavi.pt/pub/mysql/})
|
||||
FTP (@uref{ftp://ftp.vizzavi.pt/pub/mysql/})
|
||||
|
||||
@item
|
||||
@image{Flags/romania} Romania [roedu.net/Bucharest] @@
|
||||
FTP (@uref{ftp://ftp.roedu.net/pub/mirrors/ftp.mysql.com/})
|
||||
|
@ -269,10 +265,6 @@ FTP (@uref{ftp://mysql.unam.mx/pub/mysql/})
|
|||
@image{Flags/usa} USA [adgrafix.com / Boston, MA] @@
|
||||
WWW (@uref{http://mysql.adgrafix.com/})
|
||||
|
||||
@item
|
||||
@image{Flags/usa} USA [Fast Mirror / Englewood, CO] @@
|
||||
WWW (@uref{http://mysql.fastmirror.com/})
|
||||
|
||||
@item
|
||||
@image{Flags/usa} USA [Hurricane Electric / San Jose, CA] @@
|
||||
WWW (@uref{http://mysql.he.net/})
|
||||
|
|
274
client/mysql.cc
274
client/mysql.cc
|
@ -40,7 +40,7 @@
|
|||
#include <signal.h>
|
||||
#include <violite.h>
|
||||
|
||||
const char *VER= "12.7";
|
||||
const char *VER= "12.10";
|
||||
|
||||
/* Don't try to make a nice table if the data is too big */
|
||||
#define MAX_COLUMN_LENGTH 1024
|
||||
|
@ -440,7 +440,7 @@ static struct my_option my_long_options[] =
|
|||
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
|
||||
(gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"no-auto-rehash", 'A',
|
||||
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options depricated; use --disable-auto-rehash instead.",
|
||||
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"batch", 'B',
|
||||
"Print results with a tab as separator, each row on new line. Doesn't use history file.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -468,7 +468,7 @@ static struct my_option my_long_options[] =
|
|||
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
|
||||
0, 0, 0, 0},
|
||||
{"no-named-commands", 'g',
|
||||
"Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option depricated; use --disable-named-commands instead.",
|
||||
"Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"named-commands", 'G',
|
||||
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
|
||||
|
@ -489,25 +489,25 @@ static struct my_option my_long_options[] =
|
|||
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
|
||||
(gptr*) &line_numbers, (gptr*) &line_numbers, 0, GET_BOOL,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is depricated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
|
||||
{"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifndef __WIN__
|
||||
{"no-pager", OPT_NOPAGER,
|
||||
"Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option depricated; use --disable-pager instead.",
|
||||
"Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option depricated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
|
||||
{"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered,
|
||||
(gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
|
||||
(gptr*) &column_names, (gptr*) &column_names, 0, GET_BOOL,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||
{"skip-column-names", 'N',
|
||||
"Don't write column names in results. WARNING: -N is depricated, use long version of this options instead.",
|
||||
"Don't write column names in results. WARNING: -N is deprecated, use long version of this options instead.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"set-variable", 'O',
|
||||
"Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
|
||||
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"one-database", 'o',
|
||||
"Only update the default database. This is useful for skipping updates to other database in the update log.",
|
||||
|
@ -604,115 +604,115 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
char *argument)
|
||||
{
|
||||
switch(optid) {
|
||||
case OPT_CHARSETS_DIR:
|
||||
strmov(mysql_charsets_dir, argument);
|
||||
charsets_dir = mysql_charsets_dir;
|
||||
break;
|
||||
case OPT_LOCAL_INFILE:
|
||||
using_opt_local_infile=1;
|
||||
opt_local_infile= test(!argument || atoi(argument)>0);
|
||||
break;
|
||||
case OPT_TEE:
|
||||
if (argument == disabled_my_option)
|
||||
{
|
||||
if (opt_outfile)
|
||||
end_tee();
|
||||
opt_outfile= 0;
|
||||
}
|
||||
else
|
||||
if (!opt_outfile)
|
||||
{
|
||||
strmov(outfile, argument);
|
||||
opt_outfile= 1;
|
||||
init_tee();
|
||||
}
|
||||
break;
|
||||
case OPT_NOTEE:
|
||||
printf("WARNING: option depricated; use --disable-tee instead.\n");
|
||||
case OPT_CHARSETS_DIR:
|
||||
strmov(mysql_charsets_dir, argument);
|
||||
charsets_dir = mysql_charsets_dir;
|
||||
break;
|
||||
case OPT_LOCAL_INFILE:
|
||||
using_opt_local_infile=1;
|
||||
opt_local_infile= test(!argument || atoi(argument)>0);
|
||||
break;
|
||||
case OPT_TEE:
|
||||
if (argument == disabled_my_option)
|
||||
{
|
||||
if (opt_outfile)
|
||||
end_tee();
|
||||
opt_outfile= 0;
|
||||
break;
|
||||
case OPT_PAGER:
|
||||
opt_nopager= 0;
|
||||
if (argument)
|
||||
strmov(pager, argument);
|
||||
else
|
||||
strmov(pager, default_pager);
|
||||
strmov(default_pager, pager);
|
||||
break;
|
||||
case OPT_NOPAGER:
|
||||
printf("WARNING: option depricated; use --disable-pager instead.\n");
|
||||
opt_nopager= 1;
|
||||
break;
|
||||
case 'A':
|
||||
rehash= 0;
|
||||
break;
|
||||
case 'e':
|
||||
}
|
||||
else
|
||||
if (!opt_outfile)
|
||||
{
|
||||
strmov(outfile, argument);
|
||||
init_tee();
|
||||
}
|
||||
break;
|
||||
case OPT_NOTEE:
|
||||
printf("WARNING: option deprecated; use --disable-tee instead.\n");
|
||||
if (opt_outfile)
|
||||
end_tee();
|
||||
break;
|
||||
case OPT_PAGER:
|
||||
opt_nopager= 0;
|
||||
if (argument)
|
||||
strmov(pager, argument);
|
||||
else
|
||||
strmov(pager, default_pager);
|
||||
strmov(default_pager, pager);
|
||||
break;
|
||||
case OPT_NOPAGER:
|
||||
printf("WARNING: option deprecated; use --disable-pager instead.\n");
|
||||
opt_nopager= 1;
|
||||
break;
|
||||
case 'A':
|
||||
rehash= 0;
|
||||
break;
|
||||
case 'N':
|
||||
column_names= 0;
|
||||
break;
|
||||
case 'e':
|
||||
status.batch= 1;
|
||||
status.add_to_history= 0;
|
||||
batch_readline_end(status.line_buff); // If multiple -e
|
||||
if (!(status.line_buff= batch_readline_command(argument)))
|
||||
return 1;
|
||||
ignore_errors= 0;
|
||||
break;
|
||||
case 'o':
|
||||
if (argument == disabled_my_option)
|
||||
one_database= 0;
|
||||
else
|
||||
one_database= skip_updates= 1;
|
||||
break;
|
||||
case 'p':
|
||||
if (argument == disabled_my_option)
|
||||
argument= (char*) ""; // Don't require password
|
||||
if (argument)
|
||||
{
|
||||
char *start= argument;
|
||||
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
|
||||
opt_password= my_strdup(argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; // Destroy argument
|
||||
if (*start)
|
||||
start[1]=0 ;
|
||||
}
|
||||
else
|
||||
tty_password= 1;
|
||||
break;
|
||||
case '#':
|
||||
DBUG_PUSH(argument ? argument : default_dbug_option);
|
||||
info_flag= 1;
|
||||
break;
|
||||
case 's':
|
||||
if (argument == disabled_my_option)
|
||||
opt_silent= 0;
|
||||
else
|
||||
opt_silent++;
|
||||
break;
|
||||
case 'v':
|
||||
if (argument == disabled_my_option)
|
||||
verbose= 0;
|
||||
else
|
||||
verbose++;
|
||||
break;
|
||||
case 'B':
|
||||
if (!status.batch)
|
||||
{
|
||||
status.batch= 1;
|
||||
status.add_to_history= 0;
|
||||
batch_readline_end(status.line_buff); // If multiple -e
|
||||
if (!(status.line_buff= batch_readline_command(argument)))
|
||||
return 1;
|
||||
ignore_errors= 0;
|
||||
break;
|
||||
case 'o':
|
||||
if (argument == disabled_my_option)
|
||||
one_database= 0;
|
||||
else
|
||||
one_database= skip_updates= 1;
|
||||
break;
|
||||
case 'p':
|
||||
if (argument == disabled_my_option)
|
||||
argument= (char*) ""; // Don't require password
|
||||
if (argument)
|
||||
{
|
||||
char *start= argument;
|
||||
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
|
||||
opt_password= my_strdup(argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; // Destroy argument
|
||||
if (*start)
|
||||
start[1]=0 ;
|
||||
}
|
||||
else
|
||||
tty_password= 1;
|
||||
break;
|
||||
case '#':
|
||||
DBUG_PUSH(argument ? argument : default_dbug_option);
|
||||
info_flag= 1;
|
||||
break;
|
||||
case 's':
|
||||
if (argument == disabled_my_option)
|
||||
opt_silent= 0;
|
||||
else
|
||||
opt_silent++;
|
||||
break;
|
||||
case 'v':
|
||||
if (argument == disabled_my_option)
|
||||
verbose= 0;
|
||||
else
|
||||
verbose++;
|
||||
break;
|
||||
case 'B':
|
||||
if (!status.batch)
|
||||
{
|
||||
status.batch= 1;
|
||||
status.add_to_history= 0;
|
||||
opt_silent++; // more silent
|
||||
}
|
||||
break;
|
||||
case 'W':
|
||||
opt_silent++; // more silent
|
||||
}
|
||||
break;
|
||||
case 'W':
|
||||
#ifdef __WIN__
|
||||
opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
|
||||
opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
|
||||
#endif
|
||||
break;
|
||||
case 'V':
|
||||
usage(1);
|
||||
exit(0);
|
||||
case 'I':
|
||||
case '?':
|
||||
usage(0);
|
||||
exit(0);
|
||||
break;
|
||||
case 'V':
|
||||
usage(1);
|
||||
exit(0);
|
||||
case 'I':
|
||||
case '?':
|
||||
usage(0);
|
||||
exit(0);
|
||||
#include "sslopt-case.h"
|
||||
}
|
||||
return 0;
|
||||
|
@ -739,11 +739,7 @@ static int get_options(int argc, char **argv)
|
|||
strmov(default_pager, pager);
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (status.batch) /* disable pager and outfile in this case */
|
||||
{
|
||||
|
@ -1514,17 +1510,22 @@ static void end_pager()
|
|||
|
||||
static void init_tee()
|
||||
{
|
||||
if (opt_outfile)
|
||||
end_tee();
|
||||
if (!(OUTFILE= my_fopen(outfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
|
||||
{
|
||||
opt_outfile=0;
|
||||
opt_outfile= 0;
|
||||
init_pager();
|
||||
return;
|
||||
}
|
||||
opt_outfile= 1;
|
||||
tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
|
||||
}
|
||||
|
||||
static void end_tee()
|
||||
{
|
||||
my_fclose(OUTFILE, MYF(0));
|
||||
opt_outfile= 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1599,18 +1600,19 @@ print_table_data(MYSQL_RES *result)
|
|||
tee_puts(separator.c_ptr(), PAGER);
|
||||
}
|
||||
|
||||
while ((cur = mysql_fetch_row(result)))
|
||||
while ((cur= mysql_fetch_row(result)))
|
||||
{
|
||||
(void) tee_fputs("|", PAGER);
|
||||
mysql_field_seek(result,0);
|
||||
for (uint off=0 ; off < mysql_num_fields(result); off++)
|
||||
mysql_field_seek(result, 0);
|
||||
for (uint off= 0; off < mysql_num_fields(result); off++)
|
||||
{
|
||||
const char *str=cur[off] ? cur[off] : "NULL";
|
||||
field = mysql_fetch_field(result);
|
||||
uint length=field->max_length;
|
||||
const char *str= cur[off] ? cur[off] : "NULL";
|
||||
field= mysql_fetch_field(result);
|
||||
uint length= field->max_length;
|
||||
if (length > MAX_COLUMN_LENGTH)
|
||||
{
|
||||
tee_fputs(str,PAGER); tee_fputs(" |",PAGER);
|
||||
tee_fputs(str, PAGER);
|
||||
tee_fputs(" |", PAGER);
|
||||
}
|
||||
else
|
||||
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
|
||||
|
@ -1811,7 +1813,7 @@ print_tab_data(MYSQL_RES *result)
|
|||
for (uint off=1 ; off < mysql_num_fields(result); off++)
|
||||
{
|
||||
(void) tee_fputs("\t", PAGER);
|
||||
safe_put_field(cur[off],lengths[off]);
|
||||
safe_put_field(cur[off], lengths[off]);
|
||||
}
|
||||
(void) tee_fputs("\n", PAGER);
|
||||
}
|
||||
|
@ -1830,8 +1832,8 @@ com_tee(String *buffer, char *line __attribute__((unused)))
|
|||
{
|
||||
if (!strlen(outfile))
|
||||
{
|
||||
printf("No previous outfile available, you must give the filename!\n");
|
||||
opt_outfile=0;
|
||||
printf("No previous outfile available, you must give a filename!\n");
|
||||
opt_outfile= 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1839,10 +1841,10 @@ com_tee(String *buffer, char *line __attribute__((unused)))
|
|||
{
|
||||
while (isspace(*param))
|
||||
param++;
|
||||
end=strmake(file_name, param, sizeof(file_name)-1);
|
||||
end= strmake(file_name, param, sizeof(file_name) - 1);
|
||||
while (end > file_name && (isspace(end[-1]) || iscntrl(end[-1])))
|
||||
end--;
|
||||
end[0]=0;
|
||||
end[0]= 0;
|
||||
strmov(outfile, file_name);
|
||||
}
|
||||
if (!strlen(outfile))
|
||||
|
@ -1850,12 +1852,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
|
|||
printf("No outfile specified!\n");
|
||||
return 0;
|
||||
}
|
||||
if (!opt_outfile)
|
||||
{
|
||||
init_tee();
|
||||
opt_outfile=1;
|
||||
}
|
||||
tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
|
||||
init_tee();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1865,7 +1862,6 @@ com_notee(String *buffer __attribute__((unused)),
|
|||
{
|
||||
if (opt_outfile)
|
||||
end_tee();
|
||||
opt_outfile=0;
|
||||
tee_fprintf(stdout, "Outfile disabled.\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -2288,11 +2284,11 @@ com_status(String *buffer __attribute__((unused)),
|
|||
}
|
||||
#ifdef HAVE_OPENSSL
|
||||
if (mysql.net.vio->ssl_ && SSL_get_cipher(mysql.net.vio->ssl_))
|
||||
tee_fprintf(stdout, "SSL cipher in use is %s\n",
|
||||
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
|
||||
SSL_get_cipher(mysql.net.vio->ssl_));
|
||||
else
|
||||
#endif /* HAVE_OPENSSL */
|
||||
tee_puts("SSL is not in use\n", stdout);
|
||||
tee_puts("SSL:\t\t\tNot in use", stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <my_pthread.h> /* because of signal() */
|
||||
#endif
|
||||
|
||||
#define ADMIN_VERSION "8.34"
|
||||
#define ADMIN_VERSION "8.35"
|
||||
#define MAX_MYSQL_VAR 64
|
||||
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
|
||||
#define MAX_TRUNC_LENGTH 3
|
||||
|
@ -130,7 +130,7 @@ static struct my_option my_long_options[] =
|
|||
(gptr*) &opt_relative, (gptr*) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
|
||||
0, 0, 0},
|
||||
{"set-variable", 'O',
|
||||
"Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
|
||||
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"silent", 's', "Silently exit if one can't connect to server",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -247,11 +247,8 @@ int main(int argc,char *argv[])
|
|||
free_defaults()
|
||||
*/
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
usage();
|
||||
|
|
|
@ -124,7 +124,7 @@ static void die(const char* fmt, ...)
|
|||
|
||||
static void print_version()
|
||||
{
|
||||
printf("%s Ver 2.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
printf("%s Ver 2.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,11 +223,8 @@ static int parse_args(int *argc, char*** argv)
|
|||
|
||||
result_file = stdout;
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
|
||||
|
||||
#define CHECK_VERSION "2.3"
|
||||
#define CHECK_VERSION "2.4"
|
||||
|
||||
#include "client_priv.h"
|
||||
#include <m_ctype.h>
|
||||
|
@ -265,11 +265,7 @@ static int get_options(int *argc, char ***argv)
|
|||
load_defaults("my", load_default_groups, argc, argv);
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (!what_to_do)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
** and adapted to mysqldump 05/11/01 by Jani Tolonen
|
||||
*/
|
||||
|
||||
#define DUMP_VERSION "9.05"
|
||||
#define DUMP_VERSION "9.06"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
|
@ -180,7 +180,7 @@ static struct my_option my_long_options[] =
|
|||
{"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
|
||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"set-variable", 'O',
|
||||
"Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
|
||||
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"opt", OPT_OPTIMIZE,
|
||||
"Same as --add-drop-table --add-locks --all --quick --extended-insert --lock-tables --disable-keys",
|
||||
|
@ -360,11 +360,7 @@ static int get_options(int *argc, char ***argv)
|
|||
load_defaults("my",load_default_groups,argc,argv);
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (opt_delayed)
|
||||
opt_lock=0; /* Can't have lock with delayed */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
** * *
|
||||
** *************************
|
||||
*/
|
||||
#define IMPORT_VERSION "3.3"
|
||||
#define IMPORT_VERSION "3.4"
|
||||
|
||||
#include "client_priv.h"
|
||||
#include "mysql_version.h"
|
||||
|
@ -204,11 +204,8 @@ static int get_options(int *argc, char ***argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (enclosed && opt_enclosed)
|
||||
{
|
||||
fprintf(stderr, "You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n");
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define MANAGER_PWGEN_VERSION "1.2"
|
||||
#define MANAGER_PWGEN_VERSION "1.4"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <m_ctype.h>
|
||||
|
@ -86,9 +86,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
case 'V':
|
||||
print_version();
|
||||
exit(0);
|
||||
default:
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -99,11 +96,8 @@ int parse_args(int argc, char** argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define MANAGER_CLIENT_VERSION "1.3"
|
||||
#define MANAGER_CLIENT_VERSION "1.4"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysql.h>
|
||||
|
@ -132,12 +132,10 @@ int parse_args(int argc, char **argv)
|
|||
|
||||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
default_argv= argv;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
return 0;
|
||||
}
|
||||
int main(int argc, char** argv)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
/* Show databases, tables or columns */
|
||||
|
||||
#define SHOW_VERSION "9.3"
|
||||
#define SHOW_VERSION "9.4"
|
||||
|
||||
#include <my_global.h>
|
||||
#include "client_priv.h"
|
||||
|
@ -241,11 +241,7 @@ get_options(int *argc,char ***argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (tty_password)
|
||||
opt_password=get_tty_password(NullS);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
**********************************************************************/
|
||||
|
||||
#define MTEST_VERSION "1.21"
|
||||
#define MTEST_VERSION "1.24"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysql_embed.h>
|
||||
|
@ -1446,12 +1446,14 @@ int do_connect(struct st_query* q)
|
|||
die("Failed on mysql_init()");
|
||||
if (opt_compress)
|
||||
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
|
||||
mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
|
||||
|
||||
if (con_sock && !free_con_sock && *con_sock && *con_sock != FN_LIBCHAR)
|
||||
con_sock=fn_format(buff, con_sock, TMPDIR, "",0);
|
||||
if (!con_db[0])
|
||||
con_db=db;
|
||||
/* Special database to allow one to connect without a database name */
|
||||
if (!strcmp(con_db,"*NO-ONE*"))
|
||||
if (con_db && !strcmp(con_db,"*NO-ONE*"))
|
||||
con_db=0;
|
||||
if ((con_error = safe_connect(&next_con->mysql, con_host,
|
||||
con_user, con_pass,
|
||||
|
@ -1957,11 +1959,7 @@ int parse_args(int argc, char **argv)
|
|||
default_argv= argv;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
|
@ -2359,6 +2357,8 @@ int main(int argc, char** argv)
|
|||
die("Failed in mysql_init()");
|
||||
if (opt_compress)
|
||||
mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
|
||||
mysql_options(&cur_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
|
||||
|
||||
cur_con->name = my_strdup("default", MYF(MY_WME));
|
||||
if (!cur_con->name)
|
||||
die("Out of memory");
|
||||
|
@ -2410,9 +2410,11 @@ int main(int argc, char** argv)
|
|||
case Q_QUERY:
|
||||
case Q_REAP:
|
||||
{
|
||||
int flags = QUERY_REAP; /* we read the result always regardless
|
||||
* of the mode for both full query and
|
||||
* read-result only ( reap) */
|
||||
/*
|
||||
We read the result always regardless of the mode for both full
|
||||
query and read-result only (reap)
|
||||
*/
|
||||
int flags = QUERY_REAP;
|
||||
if (q->type != Q_REAP) /* for a full query, enable the send stage */
|
||||
flags |= QUERY_SEND;
|
||||
if (q_send_flag)
|
||||
|
@ -2439,12 +2441,13 @@ int main(int argc, char** argv)
|
|||
/* fix up query pointer if this is * first iteration for this line */
|
||||
if (q->query == q->query_buf)
|
||||
q->query += q->first_word_len;
|
||||
error |= run_query(&cur_con->mysql, q, QUERY_SEND);
|
||||
/* run query can execute a query partially, depending on the flags
|
||||
* QUERY_SEND flag without QUERY_REAP tells it to just send the
|
||||
* query and read the result some time later when reap instruction
|
||||
* is given on this connection
|
||||
/*
|
||||
run_query() can execute a query partially, depending on the flags
|
||||
QUERY_SEND flag without QUERY_REAP tells it to just send the
|
||||
query and read the result some time later when reap instruction
|
||||
is given on this connection.
|
||||
*/
|
||||
error |= run_query(&cur_con->mysql, q, QUERY_SEND);
|
||||
break;
|
||||
case Q_RESULT:
|
||||
get_file_name(save_file,q);
|
||||
|
|
|
@ -173,11 +173,7 @@ static void get_options(int argc, char **argv)
|
|||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
free_defaults(argv);
|
||||
if (tty_password)
|
||||
|
|
11
configure.in
11
configure.in
|
@ -690,6 +690,9 @@ AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
|
|||
AC_CHECK_LIB(crypt, crypt)
|
||||
AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT))
|
||||
|
||||
# For sem_xxx functions on Solaris 2.6
|
||||
AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4))
|
||||
|
||||
# For compress in zlib
|
||||
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
|
||||
|
||||
|
@ -1602,7 +1605,7 @@ then
|
|||
fi
|
||||
AC_TRY_COMPILE(
|
||||
[#undef inline
|
||||
#if !defined(SCO) && !defined(__osf__)
|
||||
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
|
||||
#define _REENTRANT
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
|
@ -1635,7 +1638,7 @@ then
|
|||
fi
|
||||
AC_TRY_COMPILE(
|
||||
[#undef inline
|
||||
#if !defined(SCO) && !defined(__osf__)
|
||||
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
|
||||
#define _REENTRANT
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
|
@ -1667,7 +1670,7 @@ then
|
|||
fi
|
||||
AC_TRY_COMPILE(
|
||||
[#undef inline
|
||||
#if !defined(SCO) && !defined(__osf__)
|
||||
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
|
||||
#define _REENTRANT
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
|
@ -1693,7 +1696,7 @@ then
|
|||
# Check definition of pthread_getspecific
|
||||
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
|
||||
AC_TRY_COMPILE(
|
||||
[#if !defined(SCO) && !defined(__osf__)
|
||||
[#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
|
||||
#define _REENTRANT
|
||||
#endif
|
||||
#define _POSIX_PTHREAD_SEMANTICS
|
||||
|
|
|
@ -55,7 +55,7 @@ static struct my_option my_long_options[] =
|
|||
|
||||
static void usage(my_bool version)
|
||||
{
|
||||
printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
printf("%s Ver 1.5 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
if (version)
|
||||
return;
|
||||
|
@ -92,11 +92,8 @@ static int get_options(int *argc,char ***argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (*argc < 1)
|
||||
{
|
||||
usage(0);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
/* Install or upgrade MySQL server. By Sasha Pachev <sasha@mysql.com>
|
||||
*/
|
||||
|
||||
#define INSTALL_VERSION "1.1"
|
||||
#define INSTALL_VERSION "1.2"
|
||||
|
||||
#define DONT_USE_RAID
|
||||
#include <my_global.h>
|
||||
|
@ -219,11 +219,8 @@ static int parse_args(int argc, char **argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
/* Return error-text for system error messages and nisam messages */
|
||||
|
||||
#define PERROR_VERSION "2.8"
|
||||
#define PERROR_VERSION "2.9"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
|
@ -141,11 +141,8 @@ static int get_options(int *argc,char ***argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (!*argc && !print_all_codes)
|
||||
{
|
||||
usage();
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define INIT_SYM_TABLE 4096
|
||||
#define INC_SYM_TABLE 4096
|
||||
#define MAX_SYM_SIZE 128
|
||||
#define DUMP_VERSION "1.3"
|
||||
#define DUMP_VERSION "1.4"
|
||||
#define HEX_INVALID (uchar)255
|
||||
|
||||
typedef ulong my_long_addr_t ; /* at some point, we need to fix configure
|
||||
|
@ -121,11 +121,8 @@ static int parse_args(int argc, char **argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
/*
|
||||
The following code is to make the command compatible with the old
|
||||
version that required one to use the -n and -s options
|
||||
|
|
|
@ -16,11 +16,10 @@
|
|||
|
||||
/* Resolves IP's to hostname and hostnames to IP's */
|
||||
|
||||
#define RESOLVE_VERSION "2.1"
|
||||
#define RESOLVE_VERSION "2.2"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <m_ctype.h>
|
||||
#include <my_net.h>
|
||||
#include <my_sys.h>
|
||||
#include <m_string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -30,13 +29,9 @@
|
|||
#endif
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <my_net.h>
|
||||
#include <my_getopt.h>
|
||||
|
||||
#ifdef SCO
|
||||
#undef h_errno
|
||||
#define h_errno errno
|
||||
#endif
|
||||
|
||||
#if !defined(_AIX) && !defined(HAVE_UNIXWARE7_THREADS) && !defined(HAVE_UNIXWARE7_POSIX) && !defined(h_errno)
|
||||
extern int h_errno;
|
||||
#endif
|
||||
|
@ -99,11 +94,8 @@ static int get_options(int *argc,char ***argv)
|
|||
/* load_defaults("my",load_default_groups,argc,argv); */
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (*argc == 0)
|
||||
{
|
||||
usage();
|
||||
|
|
|
@ -39,6 +39,7 @@ struct my_option
|
|||
};
|
||||
|
||||
extern char *disabled_my_option;
|
||||
extern my_bool my_getopt_print_errors;
|
||||
|
||||
extern int handle_options (int *argc, char ***argv,
|
||||
const struct my_option *longopts,
|
||||
|
|
|
@ -71,19 +71,22 @@ void my_inet_ntoa(struct in_addr in, char *buf);
|
|||
Handling of gethostbyname_r()
|
||||
*/
|
||||
|
||||
#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
|
||||
#if !defined(HPUX)
|
||||
struct hostent;
|
||||
#endif /* HPUX */
|
||||
#if !defined(HAVE_GETHOSTBYNAME_R)
|
||||
struct hostent *my_gethostbyname_r(const char *name,
|
||||
struct hostent *result, char *buffer,
|
||||
int buflen, int *h_errnop);
|
||||
void my_gethostbyname_r_free();
|
||||
#elif defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
|
||||
struct hostent *my_gethostbyname_r(const char *name,
|
||||
struct hostent *result, char *buffer,
|
||||
int buflen, int *h_errnop);
|
||||
#define my_gethostbyname_r_free()
|
||||
#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
|
||||
#define GETHOSTBYNAME_BUFF_SIZE 2048
|
||||
#else
|
||||
#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX)
|
||||
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
|
||||
#endif /* defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
|
||||
#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
|
||||
|
||||
#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
|
||||
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
|
||||
|
@ -91,17 +94,20 @@ struct hostent *my_gethostbyname_r(const char *name,
|
|||
struct hostent *result, char *buffer,
|
||||
int buflen, int *h_errnop);
|
||||
#define my_gethostbyname_r_free()
|
||||
#elif !defined(HAVE_GETHOSTBYNAME_R)
|
||||
#define GETHOSTBYNAME_BUFF_SIZE 2048
|
||||
struct hostent *my_gethostbyname_r(const char *name,
|
||||
struct hostent *result, char *buffer,
|
||||
int buflen, int *h_errnop);
|
||||
void my_gethostbyname_r_free();
|
||||
#else
|
||||
#define GETHOSTBYNAME_BUFF_SIZE 2048
|
||||
#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
|
||||
#define my_gethostbyname_r_free()
|
||||
#endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
|
||||
#endif /* !defined(HAVE_GETHOSTBYNAME_R) */
|
||||
|
||||
#ifndef GETHOSTBYNAME_BUFF_SIZE
|
||||
#define GETHOSTBYNAME_BUFF_SIZE 2048
|
||||
#endif
|
||||
|
||||
/* On SCO you get a link error when refering to h_errno */
|
||||
#ifdef SCO
|
||||
#undef h_errno
|
||||
#define h_errno errno
|
||||
#endif
|
||||
|
||||
C_MODE_END
|
||||
#endif
|
||||
|
|
|
@ -349,7 +349,7 @@ extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
|
|||
#undef HAVE_GETHOSTBYADDR_R /* No definition */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT)
|
||||
#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) && !defined(SAFE_MUTEX)
|
||||
extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
|
||||
pthread_mutex_t *mutex,
|
||||
struct timespec *abstime);
|
||||
|
|
135
include/my_sys.h
135
include/my_sys.h
|
@ -302,33 +302,41 @@ typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
|
|||
|
||||
typedef struct st_io_cache /* Used when cacheing files */
|
||||
{
|
||||
/* pos_in_file is offset in file corresponding to the first byte of
|
||||
byte* buffer. end_of_file is the offset of end of file for READ_CACHE
|
||||
and WRITE_CACHE. For SEQ_READ_APPEND it the maximum of the actual
|
||||
end of file and the position represented by read_end.
|
||||
/* Offset in file corresponding to the first byte of byte* buffer. */
|
||||
my_off_t pos_in_file;
|
||||
/*
|
||||
The offset of end of file for READ_CACHE and WRITE_CACHE.
|
||||
For SEQ_READ_APPEND it the maximum of the actual end of file and
|
||||
the position represented by read_end.
|
||||
*/
|
||||
my_off_t pos_in_file,end_of_file;
|
||||
/* read_pos points to current read position in the buffer
|
||||
read_end is the non-inclusive boundary in the buffer for the currently
|
||||
valid read area
|
||||
buffer is the read buffer
|
||||
not sure about request_pos except that it is used in async_io
|
||||
my_off_t end_of_file;
|
||||
/* Points to current read position in the buffer */
|
||||
byte *read_pos;
|
||||
/* the non-inclusive boundary in the buffer for the currently valid read */
|
||||
byte *read_end;
|
||||
byte *buffer; /* The read buffer */
|
||||
/* Used in ASYNC_IO */
|
||||
byte *request_pos;
|
||||
|
||||
/* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */
|
||||
byte *write_buffer;
|
||||
/*
|
||||
Only used in SEQ_READ_APPEND, and points to the current read position
|
||||
in the write buffer. Note that reads in SEQ_READ_APPEND caches can
|
||||
happen from both read buffer (byte* buffer) and write buffer
|
||||
(byte* write_buffer).
|
||||
*/
|
||||
byte *read_pos,*read_end,*buffer,*request_pos;
|
||||
/* write_buffer is used only in WRITE caches and in SEQ_READ_APPEND to
|
||||
buffer writes
|
||||
append_read_pos is only used in SEQ_READ_APPEND, and points to the
|
||||
current read position in the write buffer. Note that reads in
|
||||
SEQ_READ_APPEND caches can happen from both read buffer (byte* buffer),
|
||||
and write buffer (byte* write_buffer).
|
||||
write_pos points to current write position in the write buffer and
|
||||
write_end is the non-inclusive boundary of the valid write area
|
||||
*/
|
||||
byte *write_buffer, *append_read_pos, *write_pos, *write_end;
|
||||
/* current_pos and current_end are convenience variables used by
|
||||
my_b_tell() and other routines that need to know the current offset
|
||||
current_pos points to &write_pos, and current_end to &write_end in a
|
||||
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
|
||||
byte *append_read_pos;
|
||||
/* Points to current write position in the write buffer */
|
||||
byte *write_pos;
|
||||
/* The non-inclusive boundary of the valid write area */
|
||||
byte *write_end;
|
||||
|
||||
/*
|
||||
Current_pos and current_end are convenience variables used by
|
||||
my_b_tell() and other routines that need to know the current offset
|
||||
current_pos points to &write_pos, and current_end to &write_end in a
|
||||
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
|
||||
*/
|
||||
byte **current_pos, **current_end;
|
||||
/* The lock is for append buffer used in SEQ_READ_APPEND cache */
|
||||
|
@ -336,70 +344,64 @@ typedef struct st_io_cache /* Used when cacheing files */
|
|||
pthread_mutex_t append_buffer_lock;
|
||||
/* need mutex copying from append buffer to read buffer */
|
||||
#endif
|
||||
/* a caller will use my_b_read() macro to read from the cache
|
||||
if the data is already in cache, it will be simply copied with
|
||||
memcpy() and internal variables will be accordinging updated with
|
||||
no functions invoked. However, if the data is not fully in the cache,
|
||||
my_b_read() will call read_function to fetch the data. read_function
|
||||
must never be invoked directly
|
||||
/*
|
||||
A caller will use my_b_read() macro to read from the cache
|
||||
if the data is already in cache, it will be simply copied with
|
||||
memcpy() and internal variables will be accordinging updated with
|
||||
no functions invoked. However, if the data is not fully in the cache,
|
||||
my_b_read() will call read_function to fetch the data. read_function
|
||||
must never be invoked directly.
|
||||
*/
|
||||
int (*read_function)(struct st_io_cache *,byte *,uint);
|
||||
/* same idea as in the case of read_function, except my_b_write() needs to
|
||||
be replaced with my_b_append() for a SEQ_READ_APPEND cache
|
||||
/*
|
||||
Same idea as in the case of read_function, except my_b_write() needs to
|
||||
be replaced with my_b_append() for a SEQ_READ_APPEND cache
|
||||
*/
|
||||
int (*write_function)(struct st_io_cache *,const byte *,uint);
|
||||
/* specifies the type of the cache. Depending on the type of the cache
|
||||
/*
|
||||
Specifies the type of the cache. Depending on the type of the cache
|
||||
certain operations might not be available and yield unpredicatable
|
||||
results. Details to be documented later
|
||||
*/
|
||||
enum cache_type type;
|
||||
/* callbacks when the actual read I/O happens. These were added and
|
||||
are currently used for binary logging of LOAD DATA INFILE - when a
|
||||
block is read from the file, we create a block create/append event, and
|
||||
when IO_CACHE is closed, we create an end event. These functions could,
|
||||
of course be used for other things
|
||||
/*
|
||||
Callbacks when the actual read I/O happens. These were added and
|
||||
are currently used for binary logging of LOAD DATA INFILE - when a
|
||||
block is read from the file, we create a block create/append event, and
|
||||
when IO_CACHE is closed, we create an end event. These functions could,
|
||||
of course be used for other things
|
||||
*/
|
||||
IO_CACHE_CALLBACK pre_read;
|
||||
IO_CACHE_CALLBACK post_read;
|
||||
IO_CACHE_CALLBACK pre_close;
|
||||
void* arg; /* for use by pre/post_read */
|
||||
void* arg; /* for use by pre/post_read */
|
||||
char *file_name; /* if used with 'open_cached_file' */
|
||||
char *dir,*prefix;
|
||||
File file; /* file descriptor */
|
||||
/* seek_not_done is set by my_b_seek() to inform the upcoming read/write
|
||||
operation that a seek needs to be preformed prior to the actual I/O
|
||||
error is 0 if the cache operation was successful, -1 if there was a
|
||||
"hard" error, and the actual number of I/O-ed bytes if the read/write was
|
||||
partial
|
||||
/*
|
||||
seek_not_done is set by my_b_seek() to inform the upcoming read/write
|
||||
operation that a seek needs to be preformed prior to the actual I/O
|
||||
error is 0 if the cache operation was successful, -1 if there was a
|
||||
"hard" error, and the actual number of I/O-ed bytes if the read/write was
|
||||
partial.
|
||||
*/
|
||||
int seek_not_done,error;
|
||||
/* buffer_length is the size of memory allocated for buffer or write_buffer
|
||||
read_length is the same as buffer_length except when we use async io
|
||||
not sure why we need it
|
||||
*/
|
||||
uint buffer_length,read_length;
|
||||
/* buffer_length is memory size allocated for buffer or write_buffer */
|
||||
uint buffer_length;
|
||||
/* read_length is the same as buffer_length except when we use async io */
|
||||
uint read_length;
|
||||
myf myflags; /* Flags used to my_read/my_write */
|
||||
/*
|
||||
/*
|
||||
alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
|
||||
0 if it was supplied by the user
|
||||
0 if it was supplied by the user.
|
||||
Currently READ_NET is the only one that will use a buffer allocated
|
||||
somewhere else
|
||||
*/
|
||||
my_bool alloced_buffer;
|
||||
/* init_count is incremented every time we call init_io_cache()
|
||||
It is not reset in end_io_cache(). This variable
|
||||
was introduced for slave relay logs - RELAY_LOG_INFO stores a pointer
|
||||
to IO_CACHE that could in some cases refer to the IO_CACHE of the
|
||||
currently active relay log. The IO_CACHE then could be closed,
|
||||
re-opened and start pointing to a different log file. In that case,
|
||||
we could not know reliably if this happened without init_count
|
||||
one must be careful with bzero() prior to the subsequent init_io_cache()
|
||||
call
|
||||
*/
|
||||
int init_count;
|
||||
#ifdef HAVE_AIOWAIT
|
||||
/* as inidicated by ifdef, this is for async I/O, we will have
|
||||
Sinisa comment this some time
|
||||
/*
|
||||
As inidicated by ifdef, this is for async I/O, which is not currently
|
||||
used (because it's not reliable on all systems)
|
||||
*/
|
||||
uint inited;
|
||||
my_off_t aio_read_pos;
|
||||
|
@ -428,7 +430,6 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
|
|||
((info)->write_pos+=(Count)),0) : \
|
||||
(*(info)->write_function)((info),(Buffer),(Count)))
|
||||
|
||||
|
||||
#define my_b_get(info) \
|
||||
((info)->read_pos != (info)->read_end ?\
|
||||
((info)->read_pos++, (int) (uchar) (info)->read_pos[-1]) :\
|
||||
|
@ -591,7 +592,7 @@ extern int my_sortncmp(const char *s,uint s_len, const char *t,uint t_len);
|
|||
extern WF_PACK *wf_comp(my_string str);
|
||||
extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
|
||||
extern void wf_end(struct wild_file_pack *buffer);
|
||||
extern size_s stripp_sp(my_string str);
|
||||
extern size_s strip_sp(my_string str);
|
||||
extern void get_date(my_string to,int timeflag,time_t use_time);
|
||||
extern void soundex(my_string out_pntr, my_string in_pntr,pbool remove_garbage);
|
||||
extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file,
|
||||
|
|
|
@ -54,7 +54,23 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
|
|||
#define EE_CANT_SYMLINK 25
|
||||
#define EE_REALPATH 26
|
||||
|
||||
/* exit codes for all MySQL programs */
|
||||
|
||||
#define EXIT_UNSPECIFIED_ERROR 1
|
||||
#define EXIT_UNKNOWN_OPTION 2
|
||||
#define EXIT_AMBIGUOUS_OPTION 3
|
||||
#define EXIT_NO_ARGUMENT_ALLOWED 4
|
||||
#define EXIT_ARGUMENT_REQUIRED 5
|
||||
#define EXIT_VAR_PREFIX_NOT_UNIQUE 6
|
||||
#define EXIT_UNKNOWN_VARIABLE 7
|
||||
#define EXIT_OUT_OF_MEMORY 8
|
||||
#define EXIT_UNKNOWN_SUFFIX 9
|
||||
#define EXIT_NO_PTR_TO_VARIABLE 10
|
||||
#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1631,6 +1631,7 @@ srv_init(void)
|
|||
for (i = 0; i < OS_THREAD_MAX_N; i++) {
|
||||
slot = srv_table_get_nth_slot(i);
|
||||
slot->in_use = FALSE;
|
||||
slot->type=0; /* Avoid purify errors */
|
||||
slot->event = os_event_create(NULL);
|
||||
ut_a(slot->event);
|
||||
}
|
||||
|
@ -1899,7 +1900,6 @@ srv_conc_exit_innodb(
|
|||
trx_t* trx) /* in: transaction object associated with the
|
||||
thread */
|
||||
{
|
||||
srv_conc_slot_t* slot = NULL;
|
||||
|
||||
if (srv_thread_concurrency >= 500) {
|
||||
|
||||
|
@ -2514,11 +2514,11 @@ loop:
|
|||
can drop tables lazily after there no longer are SELECT
|
||||
queries to them. */
|
||||
|
||||
srv_main_thread_op_info = "doing background drop tables";
|
||||
srv_main_thread_op_info = (char*) "doing background drop tables";
|
||||
|
||||
row_drop_tables_for_mysql_in_background();
|
||||
|
||||
srv_main_thread_op_info = "";
|
||||
srv_main_thread_op_info = (char*) "";
|
||||
|
||||
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
|
||||
|
||||
|
@ -2630,19 +2630,19 @@ background_loop:
|
|||
/* In this loop we run background operations when the server
|
||||
is quiet and we also come here about once in 10 seconds */
|
||||
|
||||
srv_main_thread_op_info = "doing background drop tables";
|
||||
srv_main_thread_op_info = (char*) "doing background drop tables";
|
||||
|
||||
n_tables_to_drop = row_drop_tables_for_mysql_in_background();
|
||||
|
||||
srv_main_thread_op_info = "";
|
||||
srv_main_thread_op_info = (char*) "";
|
||||
|
||||
srv_main_thread_op_info = "flushing buffer pool pages";
|
||||
srv_main_thread_op_info = (char*) "flushing buffer pool pages";
|
||||
|
||||
/* Flush a few oldest pages to make the checkpoint younger */
|
||||
|
||||
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10, ut_dulint_max);
|
||||
|
||||
srv_main_thread_op_info = "making checkpoint";
|
||||
srv_main_thread_op_info = (char*) "making checkpoint";
|
||||
|
||||
/* Make a new checkpoint about once in 10 seconds */
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ static struct my_option my_long_options[] =
|
|||
|
||||
static void print_version(void)
|
||||
{
|
||||
printf("%s Ver 6.00 for %s at %s\n", my_progname, SYSTEM_TYPE,
|
||||
printf("%s Ver 6.01 for %s at %s\n", my_progname, SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
}
|
||||
|
||||
|
@ -665,11 +665,7 @@ static void get_options(register int *argc, register char ***argv)
|
|||
testflag|=T_WRITE_LOOP;
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (*argc == 0)
|
||||
{
|
||||
|
|
|
@ -278,7 +278,7 @@ static struct my_option my_long_options[] =
|
|||
|
||||
static void print_version(void)
|
||||
{
|
||||
printf("%s Ver 5.9 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
printf("%s Ver 5.10 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
}
|
||||
|
||||
static void usage(void)
|
||||
|
@ -353,11 +353,8 @@ static void get_options(int *argc, char ***argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
my_progname= argv[0][0];
|
||||
if (isatty(fileno(stdout)))
|
||||
write_loop=1;
|
||||
|
|
|
@ -217,8 +217,13 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen,
|
|||
{
|
||||
tv.tv_sec = (long) timeout;
|
||||
tv.tv_usec = 0;
|
||||
#if defined(HPUX) && defined(THREAD)
|
||||
if ((res = select(s+1, NULL, (int*) &sfds, NULL, &tv)) >= 0)
|
||||
break;
|
||||
#else
|
||||
if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0)
|
||||
break;
|
||||
#endif
|
||||
now_time=time(NULL);
|
||||
timeout-= (uint) (now_time - start_time);
|
||||
if (errno != EINTR || (int) timeout <= 0)
|
||||
|
|
|
@ -61,15 +61,16 @@ struct st_vio
|
|||
|
||||
Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
|
||||
{
|
||||
Vio * vio = NULL;
|
||||
vio = (Vio *) my_malloc (sizeof(*vio),MYF(MY_WME|MY_ZEROFILL));
|
||||
if (vio)
|
||||
DBUG_ENTER("vio_new");
|
||||
Vio * vio;
|
||||
|
||||
if ((vio= (Vio *) my_malloc(sizeof(*vio),MYF(MY_WME|MY_ZEROFILL))))
|
||||
{
|
||||
init_alloc_root(&vio->root, 8192, 8192);
|
||||
vio->root.min_malloc = sizeof(char *) + 4;
|
||||
vio->last_packet = &vio->packets;
|
||||
}
|
||||
return (vio);
|
||||
DBUG_RETURN(vio);
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,19 +85,24 @@ Vio *vio_new_win32pipe(HANDLE hPipe)
|
|||
|
||||
void vio_delete(Vio * vio)
|
||||
{
|
||||
DBUG_ENTER("vio_delete");
|
||||
if (vio)
|
||||
{
|
||||
if (vio->type != VIO_CLOSED) vio_close(vio);
|
||||
if (vio->type != VIO_CLOSED)
|
||||
vio_close(vio);
|
||||
free_root(&vio->root, MYF(0));
|
||||
my_free((gptr)vio, MYF(0));
|
||||
my_free((gptr) vio, MYF(0));
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
void vio_reset(Vio *vio)
|
||||
{
|
||||
DBUG_ENTER("vio_reset");
|
||||
free_root(&vio->root, MYF(MY_KEEP_PREALLOC));
|
||||
vio->packets = vio->where_in_packet = vio->end_of_packet = 0;
|
||||
vio->last_packet = &vio->packets;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
int vio_errno(Vio *vio __attribute__((unused)))
|
||||
|
@ -124,6 +130,7 @@ int vio_read(Vio * vio, gptr buf, int size)
|
|||
|
||||
int vio_write(Vio * vio, const gptr buf, int size)
|
||||
{
|
||||
DBUG_ENTER("vio_write");
|
||||
char *packet;
|
||||
if (vio->reading)
|
||||
{
|
||||
|
@ -141,7 +148,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
|
|||
}
|
||||
else
|
||||
size= -1;
|
||||
return (size);
|
||||
DBUG_RETURN(size);
|
||||
}
|
||||
|
||||
int vio_blocking(Vio * vio, my_bool set_blocking_mode)
|
||||
|
|
|
@ -245,11 +245,7 @@ static void get_options(int argc, char *argv[])
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
} /* get options */
|
||||
|
||||
|
||||
|
|
|
@ -179,11 +179,8 @@ static void get_options(int argc, char *argv[])
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if(!(d_file=argv[optind])) print_error(1,"No d_file");
|
||||
if(!(df=fopen(d_file,"r")))
|
||||
print_error(1,"fopen(%s)",d_file);
|
||||
|
|
|
@ -284,11 +284,7 @@ static void get_options(int argc,char *argv[])
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
return;
|
||||
} /* get options */
|
||||
|
||||
|
|
|
@ -623,7 +623,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
key_cacheing=1;
|
||||
break;
|
||||
case 'V':
|
||||
printf("test1 Ver 1.1 \n");
|
||||
printf("test1 Ver 1.2 \n");
|
||||
exit(0);
|
||||
case '#':
|
||||
DEBUGGER_ON;
|
||||
|
@ -644,11 +644,8 @@ static void get_options(int argc, char *argv[])
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
return;
|
||||
} /* get options */
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ static struct my_option my_long_options[] =
|
|||
|
||||
static void print_version(void)
|
||||
{
|
||||
printf("%s Ver 2.5 for %s at %s\n", my_progname, SYSTEM_TYPE,
|
||||
printf("%s Ver 2.6 for %s at %s\n", my_progname, SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
}
|
||||
|
||||
|
@ -615,13 +615,15 @@ get_one_option(int optid,
|
|||
|
||||
static void get_options(register int *argc,register char ***argv)
|
||||
{
|
||||
int ho_error;
|
||||
|
||||
load_defaults("my", load_default_groups, argc, argv);
|
||||
default_argv= *argv;
|
||||
if (isatty(fileno(stdout)))
|
||||
check_param.testflag|=T_WRITE_LOOP;
|
||||
|
||||
if (handle_options(argc, argv, my_long_options, get_one_option))
|
||||
exit(1);
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
exit(ho_error);
|
||||
|
||||
/* If using repair, then update checksum if one uses --update-state */
|
||||
if ((check_param.testflag & T_UPDATE_STATE) &&
|
||||
|
|
|
@ -269,7 +269,7 @@ static struct my_option my_long_options[] =
|
|||
|
||||
static void print_version(void)
|
||||
{
|
||||
printf("%s Ver 1.20 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
printf("%s Ver 1.21 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
}
|
||||
|
||||
static void usage(void)
|
||||
|
@ -347,11 +347,8 @@ static void get_options(int *argc,char ***argv)
|
|||
write_loop=1;
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (!*argc)
|
||||
{
|
||||
usage();
|
||||
|
|
|
@ -675,9 +675,9 @@ manager_launch()
|
|||
ident=$1
|
||||
shift
|
||||
if [ $USE_MANAGER = 0 ] ; then
|
||||
$@ >$CUR_MYERR 2>&1 &
|
||||
sleep 2 #hack
|
||||
return
|
||||
$@ >$CUR_MYERR 2>&1 &
|
||||
sleep 2 #hack
|
||||
return
|
||||
fi
|
||||
$MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
|
||||
--password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF
|
||||
|
@ -687,7 +687,7 @@ set_exec_stderr $ident $CUR_MYERR
|
|||
set_exec_con $ident root localhost $CUR_MYSOCK
|
||||
start_exec $ident $START_WAIT_TIMEOUT
|
||||
EOF
|
||||
abort_if_failed "Could not execute manager command"
|
||||
abort_if_failed "Could not execute manager command"
|
||||
}
|
||||
|
||||
manager_term()
|
||||
|
@ -887,13 +887,23 @@ start_slave()
|
|||
"gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD
|
||||
elif [ x$DO_GDB = x1 ]
|
||||
then
|
||||
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
|
||||
if [ x$MANUAL_GDB = x1 ]
|
||||
then
|
||||
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
|
||||
echo "To start gdb for the slave, type in another window:"
|
||||
echo "cd $CWD ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
|
||||
wait_for_slave=1500
|
||||
else
|
||||
( $ECHO set args $slave_args;
|
||||
if [ $USE_MANAGER = 0 ] ; then
|
||||
cat <<EOF
|
||||
b mysql_parse
|
||||
commands 1
|
||||
disa 1
|
||||
end
|
||||
r
|
||||
EOF
|
||||
fi ) > $GDB_SLAVE_INIT
|
||||
manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
|
||||
gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
|
||||
fi
|
||||
|
|
|
@ -114,3 +114,11 @@ i
|
|||
3
|
||||
4
|
||||
drop table t1;
|
||||
create table t1 (i int unsigned not null auto_increment primary key);
|
||||
alter table t1 rename t2;
|
||||
alter table t2 rename t1, add c char(10) comment "no comment";
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
i int(10) unsigned PRI NULL auto_increment
|
||||
c char(10) YES NULL
|
||||
drop table t1;
|
||||
|
|
|
@ -4,9 +4,9 @@ floor(5.5) floor(-5.5)
|
|||
select ceiling(5.5),ceiling(-5.5);
|
||||
ceiling(5.5) ceiling(-5.5)
|
||||
6 -5
|
||||
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2);
|
||||
truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2)
|
||||
52.6 52.64 50 0
|
||||
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
|
||||
truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)
|
||||
52.6 52.64 50 0 -52.6 -50
|
||||
select round(5.5),round(-5.5);
|
||||
round(5.5) round(-5.5)
|
||||
6 -6
|
||||
|
|
|
@ -393,3 +393,26 @@ One Two sum(Four)
|
|||
1 2 16
|
||||
1 3 16
|
||||
drop table if exists t1;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (id integer primary key not null auto_increment, gender char(1));
|
||||
insert into t1 values(NULL, 'M');
|
||||
insert into t1 values(NULL, 'F');
|
||||
insert into t1 values(NULL, 'F');
|
||||
insert into t1 values(NULL, 'F');
|
||||
insert into t1 values(NULL, 'M');
|
||||
create table t2 (user_id integer not null, timestamp datetime);
|
||||
insert into t2 values (1, sysdate());
|
||||
insert into t2 values (2, sysdate());
|
||||
insert into t2 values (1, sysdate());
|
||||
insert into t2 values (3, sysdate());
|
||||
insert into t2 values (4, sysdate());
|
||||
insert into t2 values (4, sysdate());
|
||||
select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender;
|
||||
gender dist_count percentage
|
||||
F 3 60.00
|
||||
M 1 20.00
|
||||
select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender order by percentage;
|
||||
gender dist_count percentage
|
||||
M 1 20.00
|
||||
F 3 60.00
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -66,3 +66,7 @@ select count(*) from t3 where id3;
|
|||
count(*)
|
||||
0
|
||||
drop table t1,t2,t3;
|
||||
create table t1(id1 int not null auto_increment primary key, t varchar(100));
|
||||
create table t2(id2 int not null, t varchar(100), index(id2));
|
||||
delete t1, t2 from t2,t1 where t1.id1 = t2.id2 and t1.id1 > 100;
|
||||
drop table t1,t2;
|
||||
|
|
12
mysql-test/r/rpl_empty_master_crash.result
Normal file
12
mysql-test/r/rpl_empty_master_crash.result
Normal file
|
@ -0,0 +1,12 @@
|
|||
slave stop;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
0 0 0 0 No No 0 0 0 0
|
||||
load table t1 from master;
|
||||
Error in fetch_master_table
|
|
@ -1622,3 +1622,17 @@ field
|
|||
429002
|
||||
429003
|
||||
drop table t1;
|
||||
create table t1 (a enum (' ','a','b') not null);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` enum('','a','b') NOT NULL default ''
|
||||
) TYPE=MyISAM
|
||||
drop table t1;
|
||||
create table t1 (a enum (' ','a','b ') not null default 'b ');
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` enum('','a','b') NOT NULL default 'b'
|
||||
) TYPE=MyISAM
|
||||
drop table t1;
|
||||
|
|
14
mysql-test/r/type_set.result
Normal file
14
mysql-test/r/type_set.result
Normal file
|
@ -0,0 +1,14 @@
|
|||
create table t1 (a set (' ','a','b') not null);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` set('','a','b') NOT NULL default ''
|
||||
) TYPE=MyISAM
|
||||
drop table t1;
|
||||
create table t1 (a set (' ','a','b ') not null default 'b ');
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` set('','a','b') NOT NULL default 'b'
|
||||
) TYPE=MyISAM
|
||||
drop table t1;
|
|
@ -105,3 +105,13 @@ insert into t1 values (null),(null),(null),(null);
|
|||
alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Alter table and rename
|
||||
#
|
||||
|
||||
create table t1 (i int unsigned not null auto_increment primary key);
|
||||
alter table t1 rename t2;
|
||||
alter table t2 rename t1, add c char(10) comment "no comment";
|
||||
show columns from t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
select floor(5.5),floor(-5.5);
|
||||
select ceiling(5.5),ceiling(-5.5);
|
||||
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2);
|
||||
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
|
||||
select round(5.5),round(-5.5);
|
||||
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
|
||||
select abs(-10), sign(-5), sign(5), sign(0);
|
||||
|
|
|
@ -299,3 +299,20 @@ insert into t1 values (1,3,3,4);
|
|||
insert into t1 values (1,3,4,4);
|
||||
select One, Two, sum(Four) from t1 group by One,Two;
|
||||
drop table if exists t1;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (id integer primary key not null auto_increment, gender char(1));
|
||||
insert into t1 values(NULL, 'M');
|
||||
insert into t1 values(NULL, 'F');
|
||||
insert into t1 values(NULL, 'F');
|
||||
insert into t1 values(NULL, 'F');
|
||||
insert into t1 values(NULL, 'M');
|
||||
create table t2 (user_id integer not null, timestamp datetime);
|
||||
insert into t2 values (1, sysdate());
|
||||
insert into t2 values (2, sysdate());
|
||||
insert into t2 values (1, sysdate());
|
||||
insert into t2 values (3, sysdate());
|
||||
insert into t2 values (4, sysdate());
|
||||
insert into t2 values (4, sysdate());
|
||||
select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender;
|
||||
select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender order by percentage;
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -62,3 +62,21 @@ select count(*) from t2 where id2;
|
|||
select count(*) from t3 where id3;
|
||||
|
||||
drop table t1,t2,t3;
|
||||
create table t1(id1 int not null auto_increment primary key, t varchar(100));
|
||||
create table t2(id2 int not null, t varchar(100), index(id2));
|
||||
disable_query_log;
|
||||
let $1 = 1000;
|
||||
while ($1)
|
||||
{
|
||||
let $2 = 5;
|
||||
eval insert into t1(t) values ('aaaaaaaaaaaaaaaaaaaa');
|
||||
while ($2)
|
||||
{
|
||||
eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb');
|
||||
dec $2;
|
||||
}
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
delete t1, t2 from t2,t1 where t1.id1 = t2.id2 and t1.id1 > 100;
|
||||
drop table t1,t2;
|
||||
|
|
7
mysql-test/t/rpl_empty_master_crash.test
Normal file
7
mysql-test/t/rpl_empty_master_crash.test
Normal file
|
@ -0,0 +1,7 @@
|
|||
source include/master-slave.inc;
|
||||
connection master;
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
show slave status;
|
||||
--error 1218
|
||||
load table t1 from master;
|
|
@ -183,7 +183,7 @@ drop table t1;
|
|||
|
||||
|
||||
create table t1 (a decimal(10,2));
|
||||
# The -0.0 needs to be typed as not all platforms supports this
|
||||
# The -0.0 needs to be quoted as not all platforms supports this
|
||||
insert into t1 values (0.0),("-0.0"),(+0.0),(01.0),(+01.0),(-01.0);
|
||||
insert into t1 values (-.1),(+.1),(.1);
|
||||
insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
|
||||
|
|
File diff suppressed because one or more lines are too long
10
mysql-test/t/type_set.test
Normal file
10
mysql-test/t/type_set.test
Normal file
|
@ -0,0 +1,10 @@
|
|||
#
|
||||
# Test of SET with space
|
||||
#
|
||||
|
||||
create table t1 (a set (' ','a','b') not null);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
create table t1 (a set (' ','a','b ') not null default 'b ');
|
||||
show create table t1;
|
||||
drop table t1;
|
|
@ -35,7 +35,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
|
|||
my_error.c errors.c my_div.c my_messnc.c \
|
||||
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
|
||||
my_symlink.c my_symlink2.c \
|
||||
mf_pack.c mf_unixpath.c mf_stripp.c \
|
||||
mf_pack.c mf_unixpath.c mf_strip.c \
|
||||
mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \
|
||||
mf_qsort.c mf_qsort2.c mf_sort.c \
|
||||
ptr_cmp.c mf_radix.c queues.c \
|
||||
|
@ -45,7 +45,8 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
|
|||
my_chsize.c my_lread.c my_lwrite.c my_clock.c \
|
||||
my_quick.c my_lockmem.c my_static.c \
|
||||
my_getopt.c getvar.c my_mkdir.c \
|
||||
default.c my_compress.c checksum.c raid.cc my_net.c \
|
||||
default.c my_compress.c checksum.c raid.cc \
|
||||
my_net.c \
|
||||
my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \
|
||||
my_gethostbyname.c
|
||||
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
|
||||
|
|
|
@ -122,8 +122,6 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
|
|||
info->pos_in_file= seek_offset;
|
||||
info->pre_close = info->pre_read = info->post_read = 0;
|
||||
info->arg = 0;
|
||||
info->init_count++; /* we assume the user had set it to 0 prior to
|
||||
first call */
|
||||
info->alloced_buffer = 0;
|
||||
info->buffer=0;
|
||||
info->seek_not_done= test(file >= 0);
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
#include "mysys_priv.h"
|
||||
|
||||
/*
|
||||
stripp_sp(my_string str)
|
||||
strip_sp(my_string str)
|
||||
Strips end-space from string and returns new length.
|
||||
*/
|
||||
|
||||
size_s stripp_sp(register my_string str)
|
||||
size_s strip_sp(register my_string str)
|
||||
{
|
||||
reg2 my_string found;
|
||||
reg3 my_string start;
|
||||
|
@ -43,4 +43,4 @@ size_s stripp_sp(register my_string str)
|
|||
}
|
||||
*found= '\0'; /* Stripp at first space */
|
||||
return (size_s) (found-start);
|
||||
} /* stripp_sp */
|
||||
} /* strip_sp */
|
|
@ -18,21 +18,18 @@
|
|||
/* Thread safe version of gethostbyname_r() */
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#ifdef THREAD
|
||||
#include "my_pthread.h"
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <my_net.h>
|
||||
#if !defined(MSDOS) && !defined(__WIN__)
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <my_net.h>
|
||||
|
||||
/* This file is not needed if my_gethostbyname_r is a macro */
|
||||
#if !defined(my_gethostbyname_r)
|
||||
|
||||
#ifndef THREAD
|
||||
#define pthread_mutex_lock(A)
|
||||
#define pthread_mutex_unlock(A)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Emulate SOLARIS style calls, not because it's better, but just to make the
|
||||
usage of getbostbyname_r simpler.
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <my_getopt.h>
|
||||
#include <assert.h>
|
||||
#include <my_sys.h>
|
||||
#include <mysys_err.h>
|
||||
|
||||
static int findopt (char *optpat, uint length,
|
||||
const struct my_option **opt_res,
|
||||
|
@ -42,17 +43,11 @@ static const char *special_opt_prefix[]=
|
|||
|
||||
char *disabled_my_option= (char*) "0";
|
||||
|
||||
/* Return error values from handle_options */
|
||||
/* This is a flag that can be set in client programs. 0 means that
|
||||
my_getopt will not print error messages, but the client should do
|
||||
it by itself */
|
||||
|
||||
#define ERR_UNKNOWN_OPTION 1
|
||||
#define ERR_AMBIGUOUS_OPTION 2
|
||||
#define ERR_NO_ARGUMENT_ALLOWED 3
|
||||
#define ERR_ARGUMENT_REQUIRED 4
|
||||
#define ERR_VAR_PREFIX_NOT_UNIQUE 5
|
||||
#define ERR_UNKNOWN_VARIABLE 6
|
||||
#define ERR_OUT_OF_MEMORY 7
|
||||
#define ERR_UNKNOWN_SUFFIX 8
|
||||
#define ERR_NO_PTR_TO_VARIABLE 9
|
||||
my_bool my_getopt_print_errors= 1;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -73,7 +68,7 @@ int handle_options(int *argc, char ***argv,
|
|||
{
|
||||
uint opt_found, argvpos= 0, length, spec_len, i;
|
||||
my_bool end_of_options= 0, must_be_var, set_maximum_value, special_used,
|
||||
option_is_loose;
|
||||
option_is_loose, option_used= 0;
|
||||
char *progname= *(*argv), **pos, *optend, *prev_found;
|
||||
const struct my_option *optp;
|
||||
int error;
|
||||
|
@ -89,6 +84,7 @@ int handle_options(int *argc, char ***argv,
|
|||
if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */
|
||||
{
|
||||
char *argument= 0;
|
||||
option_used= 1;
|
||||
must_be_var= 0;
|
||||
set_maximum_value= 0;
|
||||
special_used= 0;
|
||||
|
@ -106,9 +102,10 @@ int handle_options(int *argc, char ***argv,
|
|||
/* the argument must be in next argv */
|
||||
if (!*++pos)
|
||||
{
|
||||
fprintf(stderr, "%s: Option '-O' requires an argument\n",
|
||||
progname);
|
||||
return ERR_ARGUMENT_REQUIRED;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr, "%s: Option '-O' requires an argument\n",
|
||||
progname);
|
||||
return EXIT_ARGUMENT_REQUIRED;
|
||||
}
|
||||
cur_arg= *pos;
|
||||
(*argc)--;
|
||||
|
@ -128,10 +125,11 @@ int handle_options(int *argc, char ***argv,
|
|||
cur_arg+= 14;
|
||||
if (!*cur_arg)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: Option '--set-variable' requires an argument\n",
|
||||
progname);
|
||||
return ERR_ARGUMENT_REQUIRED;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr,
|
||||
"%s: Option '--set-variable' requires an argument\n",
|
||||
progname);
|
||||
return EXIT_ARGUMENT_REQUIRED;
|
||||
}
|
||||
}
|
||||
else if (cur_arg[14]) /* garbage, or another option. break out */
|
||||
|
@ -141,10 +139,11 @@ int handle_options(int *argc, char ***argv,
|
|||
/* the argument must be in next argv */
|
||||
if (!*++pos)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: Option '--set-variable' requires an argument\n",
|
||||
progname);
|
||||
return ERR_ARGUMENT_REQUIRED;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr,
|
||||
"%s: Option '--set-variable' requires an argument\n",
|
||||
progname);
|
||||
return EXIT_ARGUMENT_REQUIRED;
|
||||
}
|
||||
cur_arg= *pos;
|
||||
(*argc)--;
|
||||
|
@ -200,11 +199,12 @@ int handle_options(int *argc, char ***argv,
|
|||
{
|
||||
if (opt_found > 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
|
||||
progname, special_opt_prefix[i], cur_arg,
|
||||
special_opt_prefix[i], prev_found);
|
||||
return ERR_AMBIGUOUS_OPTION;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr,
|
||||
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
|
||||
progname, special_opt_prefix[i], cur_arg,
|
||||
special_opt_prefix[i], prev_found);
|
||||
return EXIT_AMBIGUOUS_OPTION;
|
||||
}
|
||||
if (i < DISABLE_OPTION_COUNT)
|
||||
optend= disabled_my_option;
|
||||
|
@ -224,19 +224,21 @@ int handle_options(int *argc, char ***argv,
|
|||
{
|
||||
if (must_be_var)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: %s: unknown variable '%s'\n", progname,
|
||||
option_is_loose ? "WARNING" : "ERROR", cur_arg);
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr,
|
||||
"%s: %s: unknown variable '%s'\n", progname,
|
||||
option_is_loose ? "WARNING" : "ERROR", cur_arg);
|
||||
if (!option_is_loose)
|
||||
return ERR_UNKNOWN_VARIABLE;
|
||||
return EXIT_UNKNOWN_VARIABLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: %s: unknown option '--%s'\n", progname,
|
||||
option_is_loose ? "WARNING" : "ERROR", cur_arg);
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr,
|
||||
"%s: %s: unknown option '--%s'\n", progname,
|
||||
option_is_loose ? "WARNING" : "ERROR", cur_arg);
|
||||
if (!option_is_loose)
|
||||
return ERR_UNKNOWN_OPTION;
|
||||
return EXIT_UNKNOWN_OPTION;
|
||||
}
|
||||
if (option_is_loose)
|
||||
{
|
||||
|
@ -249,30 +251,34 @@ int handle_options(int *argc, char ***argv,
|
|||
{
|
||||
if (must_be_var)
|
||||
{
|
||||
fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
|
||||
progname, cur_arg);
|
||||
return ERR_VAR_PREFIX_NOT_UNIQUE;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
|
||||
progname, cur_arg);
|
||||
return EXIT_VAR_PREFIX_NOT_UNIQUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
|
||||
progname, cur_arg, prev_found, optp->name);
|
||||
return ERR_AMBIGUOUS_OPTION;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
|
||||
progname, cur_arg, prev_found, optp->name);
|
||||
return EXIT_AMBIGUOUS_OPTION;
|
||||
}
|
||||
}
|
||||
if (must_be_var && (!optp->value || optp->var_type == GET_BOOL))
|
||||
{
|
||||
fprintf(stderr, "%s: option '%s' cannot take an argument\n",
|
||||
progname, optp->name);
|
||||
return ERR_NO_ARGUMENT_ALLOWED;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr, "%s: option '%s' cannot take an argument\n",
|
||||
progname, optp->name);
|
||||
return EXIT_NO_ARGUMENT_ALLOWED;
|
||||
}
|
||||
if (optp->arg_type == NO_ARG)
|
||||
{
|
||||
if (optend && !special_used)
|
||||
{
|
||||
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
|
||||
progname, optp->name);
|
||||
return ERR_NO_ARGUMENT_ALLOWED;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
|
||||
progname, optp->name);
|
||||
return EXIT_NO_ARGUMENT_ALLOWED;
|
||||
}
|
||||
if (optp->var_type == GET_BOOL)
|
||||
{
|
||||
|
@ -306,9 +312,10 @@ int handle_options(int *argc, char ***argv,
|
|||
/* Check if there are more arguments after this one */
|
||||
if (!*++pos)
|
||||
{
|
||||
fprintf(stderr, "%s: option '--%s' requires an argument\n",
|
||||
progname, optp->name);
|
||||
return ERR_ARGUMENT_REQUIRED;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr, "%s: option '--%s' requires an argument\n",
|
||||
progname, optp->name);
|
||||
return EXIT_ARGUMENT_REQUIRED;
|
||||
}
|
||||
argument= *pos;
|
||||
(*argc)--;
|
||||
|
@ -318,8 +325,9 @@ int handle_options(int *argc, char ***argv,
|
|||
}
|
||||
else /* must be short option */
|
||||
{
|
||||
for (optend= cur_arg; *optend; optend++, opt_found= 0)
|
||||
for (optend= cur_arg; *optend; optend++)
|
||||
{
|
||||
opt_found= 0;
|
||||
for (optp= longopts; optp->id; optp++)
|
||||
{
|
||||
if (optp->id == (int) (uchar) *optend)
|
||||
|
@ -329,7 +337,6 @@ int handle_options(int *argc, char ***argv,
|
|||
if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG)
|
||||
{
|
||||
*((my_bool*) optp->value)= (my_bool) 1;
|
||||
(*argc)--;
|
||||
continue; // For GET_BOOL get_one_option() shouldn't be called
|
||||
}
|
||||
else if (optp->arg_type == REQUIRED_ARG ||
|
||||
|
@ -347,9 +354,11 @@ int handle_options(int *argc, char ***argv,
|
|||
/* Check if there are more arguments after this one */
|
||||
if (!*++pos)
|
||||
{
|
||||
fprintf(stderr, "%s: option '-%c' requires an argument\n",
|
||||
progname, optp->id);
|
||||
return ERR_ARGUMENT_REQUIRED;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr,
|
||||
"%s: option '-%c' requires an argument\n",
|
||||
progname, optp->id);
|
||||
return EXIT_ARGUMENT_REQUIRED;
|
||||
}
|
||||
argument= *pos;
|
||||
(*argc)--;
|
||||
|
@ -369,9 +378,10 @@ int handle_options(int *argc, char ***argv,
|
|||
}
|
||||
if (!opt_found)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: unknown option '-%c'\n", progname, *cur_arg);
|
||||
return ERR_UNKNOWN_OPTION;
|
||||
if (my_getopt_print_errors)
|
||||
fprintf(stderr,
|
||||
"%s: unknown option '-%c'\n", progname, *optend);
|
||||
return EXIT_UNKNOWN_OPTION;
|
||||
}
|
||||
}
|
||||
(*argc)--; /* option handled (short), decrease argument count */
|
||||
|
@ -391,6 +401,12 @@ int handle_options(int *argc, char ***argv,
|
|||
else /* non-option found */
|
||||
(*argv)[argvpos++]= cur_arg;
|
||||
}
|
||||
/* Destroy the first, already handled option, so that programs that look
|
||||
for arguments in 'argv', without checking 'argc', know when to stop.
|
||||
Items in argv, before the destroyed one, are all non-option -arguments
|
||||
to the program, yet to be (possibly) handled. */
|
||||
if (option_used)
|
||||
(*argv)[argvpos]= 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -412,7 +428,7 @@ static int setval (const struct my_option *opts, char *argument,
|
|||
opts->u_max_value : opts->value;
|
||||
|
||||
if (!result_pos)
|
||||
return ERR_NO_PTR_TO_VARIABLE;
|
||||
return EXIT_NO_PTR_TO_VARIABLE;
|
||||
|
||||
switch (opts->var_type) {
|
||||
case GET_INT:
|
||||
|
@ -437,13 +453,13 @@ static int setval (const struct my_option *opts, char *argument,
|
|||
my_free((*(char**) result_pos),
|
||||
MYF(MY_WME | MY_FAE));
|
||||
if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME))))
|
||||
return ERR_OUT_OF_MEMORY;
|
||||
return EXIT_OUT_OF_MEMORY;
|
||||
break;
|
||||
default: /* dummy default to avoid compiler warnings */
|
||||
break;
|
||||
}
|
||||
if (err)
|
||||
return ERR_UNKNOWN_SUFFIX;
|
||||
return EXIT_UNKNOWN_SUFFIX;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -419,6 +419,7 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
|
|||
****************************************************************************/
|
||||
|
||||
#if defined(HPUX) || defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT)
|
||||
#undef pthread_cond_timedwait
|
||||
|
||||
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
struct timespec *abstime)
|
||||
|
|
31
mysys/raid2.c
Normal file
31
mysys/raid2.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* Copyright (C) 2002 MySQL AB
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
/*
|
||||
RAID support for MySQL. For full comments, check raid.cc
|
||||
This is in a separate file to not cause problems on OS that can't
|
||||
put C++ files in archives.
|
||||
*/
|
||||
|
||||
#include "mysys_priv.h"
|
||||
|
||||
const char *raid_type_string[]={"none","striped"};
|
||||
|
||||
const char *my_raid_type(int raid_type)
|
||||
{
|
||||
return raid_type_string[raid_type];
|
||||
}
|
|
@ -4628,7 +4628,7 @@ bool Field_num::eq_def(Field *field)
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
** Make a field from the .frm file info
|
||||
Make a field from the .frm file info
|
||||
*/
|
||||
|
||||
uint32 calc_pack_length(enum_field_types type,uint32 length)
|
||||
|
@ -4657,6 +4657,7 @@ uint32 calc_pack_length(enum_field_types type,uint32 length)
|
|||
case FIELD_TYPE_LONG_BLOB: return 4+portable_sizeof_char_ptr;
|
||||
case FIELD_TYPE_SET:
|
||||
case FIELD_TYPE_ENUM: abort(); return 0; // This shouldn't happen
|
||||
default: return 0;
|
||||
}
|
||||
return 0; // This shouldn't happen
|
||||
}
|
||||
|
|
|
@ -356,7 +356,7 @@ void print_arrays()
|
|||
|
||||
static void usage(int version)
|
||||
{
|
||||
printf("%s Ver 3.4 Distrib %s, for %s (%s)\n",
|
||||
printf("%s Ver 3.5 Distrib %s, for %s (%s)\n",
|
||||
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
if (version)
|
||||
return;
|
||||
|
@ -394,11 +394,8 @@ static int get_options(int argc, char **argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
if (argc >= 1)
|
||||
{
|
||||
usage(0);
|
||||
|
|
|
@ -655,6 +655,7 @@ innobase_close_connection(
|
|||
(thd->transaction.all.innobase_tid));
|
||||
trx_free_for_mysql((trx_t*)
|
||||
(thd->transaction.all.innobase_tid));
|
||||
thd->transaction.all.innobase_tid = NULL;
|
||||
}
|
||||
|
||||
return(0);
|
||||
|
|
|
@ -316,7 +316,10 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
|
|||
sql_print_error("Error: Got error during commit; Binlog is not up to date!");
|
||||
thd->tx_isolation=thd->session_tx_isolation;
|
||||
if (operation_done)
|
||||
{
|
||||
statistic_increment(ha_commit_count,&LOCK_status);
|
||||
thd->transaction.cleanup();
|
||||
}
|
||||
}
|
||||
#endif // using transactions
|
||||
DBUG_RETURN(error);
|
||||
|
@ -361,7 +364,10 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
|
|||
thd->transaction.trans_log.end_of_file= max_binlog_cache_size;
|
||||
thd->tx_isolation=thd->session_tx_isolation;
|
||||
if (operation_done)
|
||||
{
|
||||
statistic_increment(ha_rollback_count,&LOCK_status);
|
||||
thd->transaction.cleanup();
|
||||
}
|
||||
}
|
||||
#endif /* USING_TRANSACTIONS */
|
||||
DBUG_RETURN(error);
|
||||
|
|
|
@ -57,8 +57,11 @@ void hostname_cache_refresh()
|
|||
|
||||
bool hostname_cache_init()
|
||||
{
|
||||
host_entry *tmp;
|
||||
uint offset= (uint) ((char*) (&tmp->ip) - (char*) tmp);
|
||||
(void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
|
||||
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE,offsetof(host_entry,ip),
|
||||
|
||||
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
|
||||
sizeof(struct in_addr),NULL,
|
||||
(void (*)(void*)) free)))
|
||||
return 1;
|
||||
|
|
|
@ -1304,13 +1304,14 @@ bool Item_func_like::fix_fields(THD *thd,struct st_table_list *tlist)
|
|||
{
|
||||
pattern = first + 1;
|
||||
pattern_len = len - 2;
|
||||
DBUG_PRINT("TurboBM", ("Initializing pattern: '%s'...", first));
|
||||
int* suff = (int*)thd->alloc(sizeof(int[pattern_len + 1]));
|
||||
bmGs = (int*)thd->alloc(sizeof(int[pattern_len + 1]));
|
||||
bmBc = (int*)thd->alloc(sizeof(int[alphabet_size]));
|
||||
DBUG_PRINT("info", ("Initializing pattern: '%s'", first));
|
||||
int *suff = (int*) thd->alloc(sizeof(int)*((pattern_len + 1)*2+
|
||||
alphabet_size));
|
||||
bmGs = suff + pattern_len + 1;
|
||||
bmBc = bmGs + pattern_len + 1;
|
||||
turboBM_compute_good_suffix_shifts(suff);
|
||||
turboBM_compute_bad_character_shifts();
|
||||
DBUG_PRINT("turboBM",("done"));
|
||||
DBUG_PRINT("info",("done"));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -495,16 +495,10 @@ class Item_func_like :public Item_bool_func2
|
|||
enum { alphabet_size = 256 };
|
||||
|
||||
public:
|
||||
Item_func_like::Item_func_like(Item *a,Item *b, char* escape_arg) :
|
||||
Item_bool_func2(a,b),
|
||||
escape(*escape_arg),
|
||||
canDoTurboBM(false),
|
||||
pattern(0),
|
||||
pattern_len(0),
|
||||
bmGs(0),
|
||||
bmBc(0)
|
||||
Item_func_like(Item *a,Item *b, char* escape_arg)
|
||||
:Item_bool_func2(a,b), escape(*escape_arg), canDoTurboBM(false),
|
||||
pattern(0), pattern_len(0), bmGs(0), bmBc(0)
|
||||
{}
|
||||
|
||||
longlong val_int();
|
||||
enum Functype functype() const { return LIKE_FUNC; }
|
||||
optimize_type select_optimize() const;
|
||||
|
|
|
@ -627,7 +627,12 @@ double Item_func_round::val()
|
|||
log_10[abs_dec] : pow(10.0,(double) abs_dec));
|
||||
|
||||
if (truncate)
|
||||
return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
|
||||
{
|
||||
if (value >= 0)
|
||||
return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
|
||||
else
|
||||
return dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp;
|
||||
}
|
||||
return dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
|
||||
}
|
||||
|
||||
|
|
77
sql/log.cc
77
sql/log.cc
|
@ -80,10 +80,10 @@ static int find_uniq_filename(char *name)
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0),index_file(-1),
|
||||
name(0), log_type(LOG_CLOSED),write_error(0),
|
||||
inited(0), file_id(1),no_rotate(0),
|
||||
need_start_event(1),bytes_written(0)
|
||||
MYSQL_LOG::MYSQL_LOG()
|
||||
:bytes_written(0), last_time(0), query_start(0), index_file(-1), name(0),
|
||||
file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0), inited(0),
|
||||
no_rotate(0), need_start_event(1)
|
||||
{
|
||||
/*
|
||||
We don't want to intialize LOCK_Log here as the thread system may
|
||||
|
@ -173,8 +173,10 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
|||
File file= -1;
|
||||
bool do_magic;
|
||||
int open_flags = O_CREAT | O_APPEND | O_BINARY;
|
||||
DBUG_ENTER("MYSQL_LOG::open");
|
||||
|
||||
if (!inited && log_type_arg == LOG_BIN && *fn_ext(log_name))
|
||||
no_rotate = 1;
|
||||
no_rotate = 1;
|
||||
init(log_type_arg,io_cache_type_arg,no_auto_events_arg);
|
||||
|
||||
if (!(name=my_strdup(log_name,MYF(MY_WME))))
|
||||
|
@ -196,6 +198,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
|||
do_magic = ((log_type == LOG_BIN) && !my_stat(log_file_name,
|
||||
&tmp_stat, MYF(0)));
|
||||
|
||||
open_count++;
|
||||
if ((file=my_open(log_file_name,open_flags,
|
||||
MYF(MY_WME | ME_WAITTANG))) < 0 ||
|
||||
init_io_cache(&log_file, file, IO_SIZE, io_cache_type,
|
||||
|
@ -237,10 +240,10 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
|||
bool error;
|
||||
if (do_magic)
|
||||
{
|
||||
if (my_b_write(&log_file, (byte*) BINLOG_MAGIC, 4) ||
|
||||
open_index(O_APPEND | O_RDWR | O_CREAT))
|
||||
if (my_b_write(&log_file, (byte*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE) ||
|
||||
open_index(O_APPEND | O_RDWR | O_CREAT))
|
||||
goto err;
|
||||
bytes_written += 4;
|
||||
bytes_written += BIN_LOG_HEADER_SIZE;
|
||||
}
|
||||
|
||||
if (need_start_event && !no_auto_events)
|
||||
|
@ -262,7 +265,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
|||
goto err;
|
||||
}
|
||||
}
|
||||
return;
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
err:
|
||||
sql_print_error("Could not use %s for logging (error %d)", log_name,errno);
|
||||
|
@ -271,7 +274,7 @@ err:
|
|||
end_io_cache(&log_file);
|
||||
x_free(name); name=0;
|
||||
log_type=LOG_CLOSED;
|
||||
return;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
|
||||
|
@ -284,6 +287,7 @@ int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
|
|||
}
|
||||
|
||||
// if log_name is "" we stop at the first entry
|
||||
|
||||
int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
|
||||
bool need_mutex)
|
||||
{
|
||||
|
@ -294,8 +298,10 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
|
|||
uint log_name_len = (uint) strlen(log_name);
|
||||
IO_CACHE io_cache;
|
||||
|
||||
// mutex needed because we need to make sure the file pointer does not move
|
||||
// from under our feet
|
||||
/*
|
||||
Mutex needed because we need to make sure the file pointer does not move
|
||||
from under our feet
|
||||
*/
|
||||
if (need_mutex)
|
||||
pthread_mutex_lock(&LOCK_index);
|
||||
if (init_io_cache(&io_cache, index_file, IO_SIZE, READ_CACHE, (my_off_t) 0,
|
||||
|
@ -304,7 +310,7 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
|
|||
error = LOG_INFO_SEEK;
|
||||
goto err;
|
||||
}
|
||||
for(;;)
|
||||
for (;;)
|
||||
{
|
||||
uint length;
|
||||
if (!(length=my_b_gets(&io_cache, fname, FN_REFLEN-1)))
|
||||
|
@ -336,9 +342,12 @@ err:
|
|||
|
||||
int MYSQL_LOG::find_next_log(LOG_INFO* linfo, bool need_lock)
|
||||
{
|
||||
// mutex needed because we need to make sure the file pointer does not move
|
||||
// from under our feet
|
||||
if (index_file < 0) return LOG_INFO_INVALID;
|
||||
/*
|
||||
Mutex needed because we need to make sure the file pointer does not move
|
||||
from under our feet
|
||||
*/
|
||||
if (index_file < 0)
|
||||
return LOG_INFO_INVALID;
|
||||
int error = 0;
|
||||
char* fname = linfo->log_file_name;
|
||||
IO_CACHE io_cache;
|
||||
|
@ -382,7 +391,7 @@ int MYSQL_LOG::reset_logs(THD* thd)
|
|||
goto err;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
for (;;)
|
||||
{
|
||||
my_delete(linfo.log_file_name, MYF(MY_WME));
|
||||
if (find_next_log(&linfo))
|
||||
|
@ -490,7 +499,7 @@ err:
|
|||
rli->linfo.log_file_name);
|
||||
goto err2;
|
||||
}
|
||||
rli->relay_log_pos = 4;
|
||||
rli->relay_log_pos = BIN_LOG_HEADER_SIZE;
|
||||
strnmov(rli->relay_log_name,rli->linfo.log_file_name,
|
||||
sizeof(rli->relay_log_name));
|
||||
flush_relay_log_info(rli);
|
||||
|
@ -550,7 +559,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
|
|||
my_off_t init_purge_offset= my_b_tell(&io_cache);
|
||||
if (!(fname_len=my_b_gets(&io_cache, fname, FN_REFLEN)))
|
||||
{
|
||||
if(!io_cache.error)
|
||||
if (!io_cache.error)
|
||||
break;
|
||||
error = LOG_INFO_IO;
|
||||
goto err;
|
||||
|
@ -993,8 +1002,13 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
|
|||
|
||||
if (is_open())
|
||||
{
|
||||
/*
|
||||
We come here when the queries to be logged could not fit into memory
|
||||
and part of the queries are stored in a log file on disk.
|
||||
*/
|
||||
|
||||
uint length;
|
||||
//QQ: this looks like a bug - why READ_CACHE?
|
||||
/* Read from the file used to cache the queries .*/
|
||||
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
|
||||
{
|
||||
sql_print_error(ER(ER_ERROR_ON_WRITE), cache->file_name, errno);
|
||||
|
@ -1003,6 +1017,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
|
|||
length=my_b_bytes_in_cache(cache);
|
||||
do
|
||||
{
|
||||
/* Write data to the binary log file */
|
||||
if (my_b_write(&log_file, cache->read_pos, length))
|
||||
{
|
||||
if (!write_error)
|
||||
|
@ -1168,19 +1183,23 @@ void MYSQL_LOG:: wait_for_update(THD* thd)
|
|||
const char* old_msg = thd->enter_cond(&update_cond, &LOCK_log,
|
||||
"Slave: waiting for binlog update");
|
||||
pthread_cond_wait(&update_cond, &LOCK_log);
|
||||
// this is not a bug - we unlock the mutex for the caller, and expect him
|
||||
// to lock it and then not unlock it upon return. This is a rather odd
|
||||
// way of doing things, but this is the cleanest way I could think of to
|
||||
// solve the race deadlock caused by THD::awake() first acquiring mysys_var
|
||||
// mutex and then the current mutex, while wait_for_update being called with
|
||||
// the current mutex already aquired and THD::exit_cond() trying to acquire
|
||||
// mysys_var mutex. We do need the mutex to be acquired prior to the
|
||||
// invocation of wait_for_update in all cases, so mutex acquisition inside
|
||||
// wait_for_update() is not an option
|
||||
/*
|
||||
This is not a bug:
|
||||
We unlock the mutex for the caller, and expect him to lock it and
|
||||
then not unlock it upon return. This is a rather odd way of doing
|
||||
things, but this is the cleanest way I could think of to solve the
|
||||
race deadlock caused by THD::awake() first acquiring mysys_var
|
||||
mutex and then the current mutex, while wait_for_update being
|
||||
called with the current mutex already aquired and THD::exit_cond()
|
||||
trying to acquire mysys_var mutex. We do need the mutex to be
|
||||
acquired prior to the invocation of wait_for_update in all cases,
|
||||
so mutex acquisition inside wait_for_update() is not an option.
|
||||
*/
|
||||
pthread_mutex_unlock(&LOCK_log);
|
||||
thd->exit_cond(old_msg);
|
||||
}
|
||||
|
||||
|
||||
void MYSQL_LOG::close(bool exiting)
|
||||
{ // One can't set log_type here!
|
||||
if (is_open())
|
||||
|
|
259
sql/log_event.cc
259
sql/log_event.cc
|
@ -159,11 +159,11 @@ static void cleanup_load_tmpdir()
|
|||
if (!(dirp=my_dir(slave_load_tmpdir,MYF(MY_WME))))
|
||||
return;
|
||||
|
||||
for (i=0;i<(uint)dirp->number_off_files;i++)
|
||||
for (i=0 ; i < (uint)dirp->number_off_files; i++)
|
||||
{
|
||||
file=dirp->dir_entry+i;
|
||||
if (!memcmp(file->name,"SQL_LOAD-",9))
|
||||
my_delete(file->name,MYF(MY_WME));
|
||||
if (is_prefix(file->name,"SQL_LOAD-"))
|
||||
my_delete(file->name,MYF(0));
|
||||
}
|
||||
|
||||
my_dirend(dirp);
|
||||
|
@ -246,7 +246,7 @@ void Load_log_event::pack_info(String* packet)
|
|||
char buf[256];
|
||||
String tmp(buf, sizeof(buf));
|
||||
tmp.length(0);
|
||||
if(db && db_len)
|
||||
if (db && db_len)
|
||||
{
|
||||
tmp.append("use ");
|
||||
tmp.append(db, db_len);
|
||||
|
@ -256,9 +256,9 @@ void Load_log_event::pack_info(String* packet)
|
|||
tmp.append("LOAD DATA INFILE '");
|
||||
tmp.append(fname, fname_len);
|
||||
tmp.append("' ", 2);
|
||||
if(sql_ex.opt_flags && REPLACE_FLAG )
|
||||
if (sql_ex.opt_flags && REPLACE_FLAG )
|
||||
tmp.append(" REPLACE ");
|
||||
else if(sql_ex.opt_flags && IGNORE_FLAG )
|
||||
else if (sql_ex.opt_flags && IGNORE_FLAG )
|
||||
tmp.append(" IGNORE ");
|
||||
|
||||
tmp.append("INTO TABLE ");
|
||||
|
@ -305,7 +305,7 @@ void Load_log_event::pack_info(String* packet)
|
|||
tmp.append(" (");
|
||||
for(i = 0; i < num_fields; i++)
|
||||
{
|
||||
if(i)
|
||||
if (i)
|
||||
tmp.append(" ,");
|
||||
tmp.append( field);
|
||||
|
||||
|
@ -326,7 +326,7 @@ void Rotate_log_event::pack_info(String* packet)
|
|||
tmp.append(new_log_ident, ident_len);
|
||||
tmp.append(";pos=");
|
||||
tmp.append(llstr(pos,buf));
|
||||
if(flags & LOG_EVENT_FORCED_ROTATE_F)
|
||||
if (flags & LOG_EVENT_FORCED_ROTATE_F)
|
||||
tmp.append("; forced by master");
|
||||
net_store_data(packet, tmp.ptr(), tmp.length());
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
|
|||
// if the read hits eof, we must report it as eof
|
||||
// so the caller will know it can go into cond_wait to be woken up
|
||||
// on the next update to the log
|
||||
if(!file->error) return LOG_READ_EOF;
|
||||
if (!file->error) return LOG_READ_EOF;
|
||||
return file->error > 0 ? LOG_READ_TRUNC: LOG_READ_IO;
|
||||
}
|
||||
data_len = uint4korr(buf + EVENT_LEN_OFFSET);
|
||||
|
@ -452,7 +452,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
|
|||
{
|
||||
if (packet->append(file, data_len))
|
||||
{
|
||||
if(log_lock)
|
||||
if (log_lock)
|
||||
pthread_mutex_unlock(log_lock);
|
||||
// here we should never hit eof in a non-error condtion
|
||||
// eof means we are reading the event partially, which should
|
||||
|
@ -467,13 +467,13 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
|
|||
#endif // MYSQL_CLIENT
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
#define UNLOCK_MUTEX if(log_lock) pthread_mutex_unlock(log_lock);
|
||||
#define UNLOCK_MUTEX if (log_lock) pthread_mutex_unlock(log_lock);
|
||||
#else
|
||||
#define UNLOCK_MUTEX
|
||||
#endif
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
#define LOCK_MUTEX if(log_lock) pthread_mutex_lock(log_lock);
|
||||
#define LOCK_MUTEX if (log_lock) pthread_mutex_lock(log_lock);
|
||||
#else
|
||||
#define LOCK_MUTEX
|
||||
#endif
|
||||
|
@ -672,7 +672,7 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db)
|
|||
if (new_log_ident)
|
||||
my_fwrite(file, (byte*) new_log_ident, (uint)ident_len,
|
||||
MYF(MY_NABP | MY_WME));
|
||||
fprintf(file, "pos=%s\n", llstr(pos, buf));
|
||||
fprintf(file, " pos: %s\n", llstr(pos, buf));
|
||||
fflush(file);
|
||||
}
|
||||
|
||||
|
@ -701,11 +701,10 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
|
|||
bool old_format):
|
||||
Log_event(buf, old_format),new_log_ident(NULL),alloced(0)
|
||||
{
|
||||
// the caller will ensure that event_len is what we have at
|
||||
// EVENT_LEN_OFFSET
|
||||
// The caller will ensure that event_len is what we have at EVENT_LEN_OFFSET
|
||||
int header_size = (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
|
||||
uint ident_offset;
|
||||
if(event_len < header_size)
|
||||
if (event_len < header_size)
|
||||
return;
|
||||
buf += header_size;
|
||||
if (old_format)
|
||||
|
@ -753,8 +752,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
|
|||
#endif
|
||||
|
||||
Query_log_event::Query_log_event(const char* buf, int event_len,
|
||||
bool old_format):
|
||||
Log_event(buf, old_format),data_buf(0), query(NULL), db(NULL)
|
||||
bool old_format)
|
||||
:Log_event(buf, old_format),data_buf(0), query(NULL), db(NULL)
|
||||
{
|
||||
ulong data_len;
|
||||
if (old_format)
|
||||
|
@ -801,9 +800,9 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
|
|||
|
||||
bool same_db = 0;
|
||||
|
||||
if(db && last_db)
|
||||
if (db && last_db)
|
||||
{
|
||||
if(!(same_db = !memcmp(last_db, db, db_len + 1)))
|
||||
if (!(same_db = !memcmp(last_db, db, db_len + 1)))
|
||||
memcpy(last_db, db, db_len + 1);
|
||||
}
|
||||
|
||||
|
@ -864,7 +863,7 @@ int Intvar_log_event::write_data(IO_CACHE* file)
|
|||
void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
|
||||
{
|
||||
char llbuff[22];
|
||||
if(!short_form)
|
||||
if (!short_form)
|
||||
{
|
||||
print_header(file);
|
||||
fprintf(file, "\tIntvar\n");
|
||||
|
@ -961,11 +960,12 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
|
|||
if (use_new_format)
|
||||
{
|
||||
empty_flags=0;
|
||||
/* the code below assumes that buf will not disappear from
|
||||
under our feet during the lifetime of the event. This assumption
|
||||
holds true in the slave thread if the log is in new format, but is not
|
||||
the case when we have old format because we will be reusing net buffer
|
||||
to read the actual file before we write out the Create_file event
|
||||
/*
|
||||
The code below assumes that buf will not disappear from
|
||||
under our feet during the lifetime of the event. This assumption
|
||||
holds true in the slave thread if the log is in new format, but is not
|
||||
the case when we have old format because we will be reusing net buffer
|
||||
to read the actual file before we write out the Create_file event.
|
||||
*/
|
||||
if (read_str(buf, buf_end, field_term, field_term_len) ||
|
||||
read_str(buf, buf_end, enclosed, enclosed_len) ||
|
||||
|
@ -1003,77 +1003,75 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
|
|||
#ifndef MYSQL_CLIENT
|
||||
Load_log_event::Load_log_event(THD* thd, sql_exchange* ex,
|
||||
const char* db_arg, const char* table_name_arg,
|
||||
List<Item>& fields_arg, enum enum_duplicates handle_dup):
|
||||
Log_event(thd),thread_id(thd->thread_id),
|
||||
num_fields(0),fields(0),field_lens(0),field_block_len(0),
|
||||
table_name(table_name_arg),
|
||||
db(db_arg),
|
||||
fname(ex->file_name)
|
||||
List<Item>& fields_arg, enum enum_duplicates handle_dup)
|
||||
:Log_event(thd),thread_id(thd->thread_id), num_fields(0),fields(0),
|
||||
field_lens(0),field_block_len(0), table_name(table_name_arg),
|
||||
db(db_arg), fname(ex->file_name)
|
||||
{
|
||||
time_t end_time;
|
||||
time(&end_time);
|
||||
exec_time = (ulong) (end_time - thd->start_time);
|
||||
db_len = (db) ? (uint32) strlen(db) : 0;
|
||||
table_name_len = (table_name) ? (uint32) strlen(table_name) : 0;
|
||||
fname_len = (fname) ? (uint) strlen(fname) : 0;
|
||||
sql_ex.field_term = (char*) ex->field_term->ptr();
|
||||
sql_ex.field_term_len = (uint8) ex->field_term->length();
|
||||
sql_ex.enclosed = (char*) ex->enclosed->ptr();
|
||||
sql_ex.enclosed_len = (uint8) ex->enclosed->length();
|
||||
sql_ex.line_term = (char*) ex->line_term->ptr();
|
||||
sql_ex.line_term_len = (uint8) ex->line_term->length();
|
||||
sql_ex.line_start = (char*) ex->line_start->ptr();
|
||||
sql_ex.line_start_len = (uint8) ex->line_start->length();
|
||||
sql_ex.escaped = (char*) ex->escaped->ptr();
|
||||
sql_ex.escaped_len = (uint8) ex->escaped->length();
|
||||
sql_ex.opt_flags = 0;
|
||||
sql_ex.cached_new_format = -1;
|
||||
|
||||
if (ex->dumpfile)
|
||||
sql_ex.opt_flags |= DUMPFILE_FLAG;
|
||||
if (ex->opt_enclosed)
|
||||
sql_ex.opt_flags |= OPT_ENCLOSED_FLAG;
|
||||
|
||||
sql_ex.empty_flags = 0;
|
||||
|
||||
switch(handle_dup)
|
||||
{
|
||||
time_t end_time;
|
||||
time(&end_time);
|
||||
exec_time = (ulong) (end_time - thd->start_time);
|
||||
db_len = (db) ? (uint32) strlen(db) : 0;
|
||||
table_name_len = (table_name) ? (uint32) strlen(table_name) : 0;
|
||||
fname_len = (fname) ? (uint) strlen(fname) : 0;
|
||||
sql_ex.field_term = (char*) ex->field_term->ptr();
|
||||
sql_ex.field_term_len = (uint8) ex->field_term->length();
|
||||
sql_ex.enclosed = (char*) ex->enclosed->ptr();
|
||||
sql_ex.enclosed_len = (uint8) ex->enclosed->length();
|
||||
sql_ex.line_term = (char*) ex->line_term->ptr();
|
||||
sql_ex.line_term_len = (uint8) ex->line_term->length();
|
||||
sql_ex.line_start = (char*) ex->line_start->ptr();
|
||||
sql_ex.line_start_len = (uint8) ex->line_start->length();
|
||||
sql_ex.escaped = (char*) ex->escaped->ptr();
|
||||
sql_ex.escaped_len = (uint8) ex->escaped->length();
|
||||
sql_ex.opt_flags = 0;
|
||||
sql_ex.cached_new_format = -1;
|
||||
|
||||
if(ex->dumpfile)
|
||||
sql_ex.opt_flags |= DUMPFILE_FLAG;
|
||||
if(ex->opt_enclosed)
|
||||
sql_ex.opt_flags |= OPT_ENCLOSED_FLAG;
|
||||
|
||||
sql_ex.empty_flags = 0;
|
||||
|
||||
switch(handle_dup)
|
||||
{
|
||||
case DUP_IGNORE: sql_ex.opt_flags |= IGNORE_FLAG; break;
|
||||
case DUP_REPLACE: sql_ex.opt_flags |= REPLACE_FLAG; break;
|
||||
case DUP_ERROR: break;
|
||||
}
|
||||
|
||||
|
||||
if(!ex->field_term->length())
|
||||
sql_ex.empty_flags |= FIELD_TERM_EMPTY;
|
||||
if(!ex->enclosed->length())
|
||||
sql_ex.empty_flags |= ENCLOSED_EMPTY;
|
||||
if(!ex->line_term->length())
|
||||
sql_ex.empty_flags |= LINE_TERM_EMPTY;
|
||||
if(!ex->line_start->length())
|
||||
sql_ex.empty_flags |= LINE_START_EMPTY;
|
||||
if(!ex->escaped->length())
|
||||
sql_ex.empty_flags |= ESCAPED_EMPTY;
|
||||
|
||||
skip_lines = ex->skip_lines;
|
||||
|
||||
List_iterator<Item> li(fields_arg);
|
||||
field_lens_buf.length(0);
|
||||
fields_buf.length(0);
|
||||
Item* item;
|
||||
while((item = li++))
|
||||
{
|
||||
num_fields++;
|
||||
uchar len = (uchar) strlen(item->name);
|
||||
field_block_len += len + 1;
|
||||
fields_buf.append(item->name, len + 1);
|
||||
field_lens_buf.append((char*)&len, 1);
|
||||
}
|
||||
|
||||
field_lens = (const uchar*)field_lens_buf.ptr();
|
||||
fields = fields_buf.ptr();
|
||||
case DUP_IGNORE: sql_ex.opt_flags |= IGNORE_FLAG; break;
|
||||
case DUP_REPLACE: sql_ex.opt_flags |= REPLACE_FLAG; break;
|
||||
case DUP_ERROR: break;
|
||||
}
|
||||
|
||||
|
||||
if (!ex->field_term->length())
|
||||
sql_ex.empty_flags |= FIELD_TERM_EMPTY;
|
||||
if (!ex->enclosed->length())
|
||||
sql_ex.empty_flags |= ENCLOSED_EMPTY;
|
||||
if (!ex->line_term->length())
|
||||
sql_ex.empty_flags |= LINE_TERM_EMPTY;
|
||||
if (!ex->line_start->length())
|
||||
sql_ex.empty_flags |= LINE_START_EMPTY;
|
||||
if (!ex->escaped->length())
|
||||
sql_ex.empty_flags |= ESCAPED_EMPTY;
|
||||
|
||||
skip_lines = ex->skip_lines;
|
||||
|
||||
List_iterator<Item> li(fields_arg);
|
||||
field_lens_buf.length(0);
|
||||
fields_buf.length(0);
|
||||
Item* item;
|
||||
while ((item = li++))
|
||||
{
|
||||
num_fields++;
|
||||
uchar len = (uchar) strlen(item->name);
|
||||
field_block_len += len + 1;
|
||||
fields_buf.append(item->name, len + 1);
|
||||
field_lens_buf.append((char*)&len, 1);
|
||||
}
|
||||
|
||||
field_lens = (const uchar*)field_lens_buf.ptr();
|
||||
fields = fields_buf.ptr();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// the caller must do buf[event_len] = 0 before he starts using the
|
||||
|
@ -1145,32 +1143,32 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
|
|||
|
||||
bool same_db = 0;
|
||||
|
||||
if(db && last_db)
|
||||
{
|
||||
if(!(same_db = !memcmp(last_db, db, db_len + 1)))
|
||||
memcpy(last_db, db, db_len + 1);
|
||||
}
|
||||
if (db && last_db)
|
||||
{
|
||||
if (!(same_db = !memcmp(last_db, db, db_len + 1)))
|
||||
memcpy(last_db, db, db_len + 1);
|
||||
}
|
||||
|
||||
if(db && db[0] && !same_db)
|
||||
if (db && db[0] && !same_db)
|
||||
fprintf(file, "use %s;\n", db);
|
||||
|
||||
fprintf(file, "LOAD DATA INFILE '%-*s' ", fname_len, fname);
|
||||
|
||||
if(sql_ex.opt_flags && REPLACE_FLAG )
|
||||
if (sql_ex.opt_flags && REPLACE_FLAG )
|
||||
fprintf(file," REPLACE ");
|
||||
else if(sql_ex.opt_flags && IGNORE_FLAG )
|
||||
else if (sql_ex.opt_flags && IGNORE_FLAG )
|
||||
fprintf(file," IGNORE ");
|
||||
|
||||
fprintf(file, "INTO TABLE %s ", table_name);
|
||||
if(sql_ex.field_term)
|
||||
if (sql_ex.field_term)
|
||||
{
|
||||
fprintf(file, " FIELDS TERMINATED BY ");
|
||||
pretty_print_str(file, sql_ex.field_term, sql_ex.field_term_len);
|
||||
}
|
||||
|
||||
if(sql_ex.enclosed)
|
||||
if (sql_ex.enclosed)
|
||||
{
|
||||
if(sql_ex.opt_flags && OPT_ENCLOSED_FLAG )
|
||||
if (sql_ex.opt_flags && OPT_ENCLOSED_FLAG )
|
||||
fprintf(file," OPTIONALLY ");
|
||||
fprintf(file, " ENCLOSED BY ");
|
||||
pretty_print_str(file, sql_ex.enclosed, sql_ex.enclosed_len);
|
||||
|
@ -1194,7 +1192,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
|
|||
pretty_print_str(file, sql_ex.line_start, sql_ex.line_start_len);
|
||||
}
|
||||
|
||||
if((int)skip_lines > 0)
|
||||
if ((int)skip_lines > 0)
|
||||
fprintf(file, " IGNORE %ld LINES ", (long) skip_lines);
|
||||
|
||||
if (num_fields)
|
||||
|
@ -1204,7 +1202,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
|
|||
fprintf( file, " (");
|
||||
for(i = 0; i < num_fields; i++)
|
||||
{
|
||||
if(i)
|
||||
if (i)
|
||||
fputc(',', file);
|
||||
fprintf(file, field);
|
||||
|
||||
|
@ -1282,7 +1280,7 @@ Slave_log_event::~Slave_log_event()
|
|||
void Slave_log_event::print(FILE* file, bool short_form, char* last_db)
|
||||
{
|
||||
char llbuff[22];
|
||||
if(short_form)
|
||||
if (short_form)
|
||||
return;
|
||||
print_header(file);
|
||||
fputc('\n', file);
|
||||
|
@ -1314,7 +1312,7 @@ void Slave_log_event::init_from_mem_pool(int data_size)
|
|||
master_host_len = strlen(master_host);
|
||||
// safety
|
||||
master_log = master_host + master_host_len + 1;
|
||||
if(master_log > mem_pool + data_size)
|
||||
if (master_log > mem_pool + data_size)
|
||||
{
|
||||
master_host = 0;
|
||||
return;
|
||||
|
@ -1326,9 +1324,9 @@ Slave_log_event::Slave_log_event(const char* buf, int event_len):
|
|||
Log_event(buf,0),mem_pool(0),master_host(0)
|
||||
{
|
||||
event_len -= LOG_EVENT_HEADER_LEN;
|
||||
if(event_len < 0)
|
||||
if (event_len < 0)
|
||||
return;
|
||||
if(!(mem_pool = (char*)my_malloc(event_len + 1, MYF(MY_WME))))
|
||||
if (!(mem_pool = (char*)my_malloc(event_len + 1, MYF(MY_WME))))
|
||||
return;
|
||||
memcpy(mem_pool, buf + LOG_EVENT_HEADER_LEN, event_len);
|
||||
mem_pool[event_len] = 0;
|
||||
|
@ -1341,7 +1339,7 @@ Create_file_log_event::Create_file_log_event(THD* thd_arg, sql_exchange* ex,
|
|||
List<Item>& fields_arg, enum enum_duplicates handle_dup,
|
||||
char* block_arg, uint block_len_arg):
|
||||
Load_log_event(thd_arg,ex,db_arg,table_name_arg,fields_arg,handle_dup),
|
||||
fake_base(0),block(block_arg),block_len(block_len_arg),
|
||||
fake_base(0),block(block_arg),block_len(block_len_arg),
|
||||
file_id(thd_arg->file_id = mysql_bin_log.next_file_id())
|
||||
{
|
||||
sql_ex.force_new_format();
|
||||
|
@ -1409,7 +1407,7 @@ void Create_file_log_event::print(FILE* file, bool short_form,
|
|||
if (short_form)
|
||||
return;
|
||||
Load_log_event::print(file, 1, last_db);
|
||||
fprintf(file, " file_id=%d, block_len=%d\n", file_id, block_len);
|
||||
fprintf(file, " file_id: %d block_len: %d\n", file_id, block_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1444,7 +1442,7 @@ Append_block_log_event::Append_block_log_event(THD* thd_arg, char* block_arg,
|
|||
Append_block_log_event::Append_block_log_event(const char* buf, int len):
|
||||
Log_event(buf, 0),block(0)
|
||||
{
|
||||
if((uint)len < APPEND_BLOCK_EVENT_OVERHEAD)
|
||||
if ((uint)len < APPEND_BLOCK_EVENT_OVERHEAD)
|
||||
return;
|
||||
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN + AB_FILE_ID_OFFSET);
|
||||
block = (char*)buf + APPEND_BLOCK_EVENT_OVERHEAD;
|
||||
|
@ -1467,7 +1465,7 @@ void Append_block_log_event::print(FILE* file, bool short_form,
|
|||
return;
|
||||
print_header(file);
|
||||
fputc('\n', file);
|
||||
fprintf(file, "#Append_block: file_id=%d, block_len=%d\n",
|
||||
fprintf(file, "#Append_block: file_id: %d block_len: %d\n",
|
||||
file_id, block_len);
|
||||
}
|
||||
#endif
|
||||
|
@ -1496,7 +1494,7 @@ Delete_file_log_event::Delete_file_log_event(THD* thd_arg):
|
|||
Delete_file_log_event::Delete_file_log_event(const char* buf, int len):
|
||||
Log_event(buf, 0),file_id(0)
|
||||
{
|
||||
if((uint)len < DELETE_FILE_EVENT_OVERHEAD)
|
||||
if ((uint)len < DELETE_FILE_EVENT_OVERHEAD)
|
||||
return;
|
||||
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN + AB_FILE_ID_OFFSET);
|
||||
}
|
||||
|
@ -1543,7 +1541,7 @@ Execute_load_log_event::Execute_load_log_event(THD* thd_arg):
|
|||
Execute_load_log_event::Execute_load_log_event(const char* buf,int len):
|
||||
Log_event(buf, 0),file_id(0)
|
||||
{
|
||||
if((uint)len < EXEC_LOAD_EVENT_OVERHEAD)
|
||||
if ((uint)len < EXEC_LOAD_EVENT_OVERHEAD)
|
||||
return;
|
||||
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN + EL_FILE_ID_OFFSET);
|
||||
}
|
||||
|
@ -1662,7 +1660,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||
thd->query = 0;
|
||||
thd->query_error = 0;
|
||||
|
||||
if(db_ok(thd->db, replicate_do_db, replicate_ignore_db))
|
||||
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
|
||||
{
|
||||
thd->set_time((time_t)when);
|
||||
thd->current_tablenr = 0;
|
||||
|
@ -1676,7 +1674,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||
tables.name = tables.real_name = (char*)table_name;
|
||||
tables.lock_type = TL_WRITE;
|
||||
// the table will be opened in mysql_load
|
||||
if(table_rules_on && !tables_ok(thd, &tables))
|
||||
if (table_rules_on && !tables_ok(thd, &tables))
|
||||
{
|
||||
// TODO: this is a bug - this needs to be moved to the I/O thread
|
||||
if (net)
|
||||
|
@ -1712,14 +1710,14 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||
// about the packet sequence
|
||||
thd->net.pkt_nr = net->pkt_nr;
|
||||
}
|
||||
if(mysql_load(thd, &ex, &tables, fields, handle_dup, net != 0,
|
||||
if (mysql_load(thd, &ex, &tables, fields, handle_dup, net != 0,
|
||||
TL_WRITE))
|
||||
thd->query_error = 1;
|
||||
if(thd->cuted_fields)
|
||||
if (thd->cuted_fields)
|
||||
sql_print_error("Slave: load data infile at position %s in log \
|
||||
'%s' produced %d warning(s)", llstr(rli->master_log_pos,llbuff), RPL_LOG_NAME,
|
||||
thd->cuted_fields );
|
||||
if(net)
|
||||
if (net)
|
||||
net->pkt_nr = thd->net.pkt_nr;
|
||||
}
|
||||
}
|
||||
|
@ -1735,7 +1733,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||
thd->net.vio = 0;
|
||||
thd->db = 0;// prevent db from being freed
|
||||
close_thread_tables(thd);
|
||||
if(thd->query_error)
|
||||
if (thd->query_error)
|
||||
{
|
||||
int sql_error = thd->net.last_errno;
|
||||
if (!sql_error)
|
||||
|
@ -1749,7 +1747,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||
}
|
||||
free_root(&thd->mem_root,0);
|
||||
|
||||
if(thd->fatal_error)
|
||||
if (thd->fatal_error)
|
||||
{
|
||||
sql_print_error("Slave: Fatal error running LOAD DATA INFILE ");
|
||||
return 1;
|
||||
|
@ -1849,7 +1847,7 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
|
||||
int Slave_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
{
|
||||
if(mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open())
|
||||
mysql_bin_log.write(this);
|
||||
return Log_event::exec_event(rli);
|
||||
}
|
||||
|
@ -1978,11 +1976,12 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
slave_print_error(rli,0, "File '%s' appears corrupted", fname);
|
||||
goto err;
|
||||
}
|
||||
// we want to disable binary logging in slave thread
|
||||
// because we need the file events to appear in the same order
|
||||
// as they do on the master relative to other events, so that we
|
||||
// can preserve ascending order of log sequence numbers - needed
|
||||
// to handle failover
|
||||
/*
|
||||
We want to disable binary logging in slave thread because we need the file
|
||||
events to appear in the same order as they do on the master relative to
|
||||
other events, so that we can preserve ascending order of log sequence
|
||||
numbers - needed to handle failover .
|
||||
*/
|
||||
save_options = thd->options;
|
||||
thd->options &= ~ (ulong) (OPTION_BIN_LOG);
|
||||
lev->thd = thd;
|
||||
|
|
|
@ -2407,7 +2407,7 @@ static void create_new_thread(THD *thd)
|
|||
inline void kill_broken_server()
|
||||
{
|
||||
/* hack to get around signals ignored in syscalls for problem OS's */
|
||||
if (unix_sock == INVALID_SOCKET || ip_sock ==INVALID_SOCKET)
|
||||
if (unix_sock == INVALID_SOCKET || (!opt_disable_networking && ip_sock ==INVALID_SOCKET))
|
||||
{
|
||||
select_thread_in_use = 0;
|
||||
kill_server((void*)MYSQL_KILL_SIGNAL); /* never returns */
|
||||
|
@ -3053,7 +3053,6 @@ static struct my_option my_long_options[] =
|
|||
*/
|
||||
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory,
|
||||
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifndef DBUG_OFF
|
||||
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
|
||||
"Undocumented: Meant for debugging and testing of replication",
|
||||
(gptr*) &disconnect_slave_event_count,
|
||||
|
@ -3070,7 +3069,6 @@ static struct my_option my_long_options[] =
|
|||
(gptr*) &opt_sporadic_binlog_dump_fail,
|
||||
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
|
||||
0},
|
||||
#endif
|
||||
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
|
||||
"Simulate memory shortage when compiled with the --with-debug=full option",
|
||||
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -3474,12 +3472,12 @@ static struct my_option my_long_options[] =
|
|||
{"query_cache_limit", OPT_QUERY_CACHE_LIMIT,
|
||||
"Don't cache results that are bigger than this.",
|
||||
(gptr*) &query_cache_limit, (gptr*) &query_cache_limit, 0, GET_ULONG,
|
||||
REQUIRED_ARG, 1024*1024L, 0, ULONG_MAX, 0, 1, 0},
|
||||
REQUIRED_ARG, 1024*1024L, 0, (longlong) ULONG_MAX, 0, 1, 0},
|
||||
#endif /*HAVE_QUERY_CACHE*/
|
||||
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
|
||||
"The memory allocated to store results from old queries.",
|
||||
(gptr*) &query_cache_size, (gptr*) &query_cache_size, 0, GET_ULONG,
|
||||
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0},
|
||||
REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1, 0},
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
{"query_cache_startup_type", OPT_QUERY_CACHE_STARTUP_TYPE,
|
||||
"0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.",
|
||||
|
@ -3499,9 +3497,10 @@ static struct my_option my_long_options[] =
|
|||
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
|
||||
"Undocumented", (gptr*) &relay_log_space_limit,
|
||||
(gptr*) &relay_log_space_limit, 0, GET_ULONG, REQUIRED_ARG, 0L, 0L,
|
||||
ULONG_MAX, 0, 1, 0},
|
||||
(longlong) ULONG_MAX, 0, 1, 0},
|
||||
{"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT,
|
||||
"Undocumented", (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
|
||||
"Number of seconds to wait for more data from a master/slave connection before aborting the read.",
|
||||
(gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
|
||||
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
|
||||
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
|
||||
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
|
||||
|
@ -4005,6 +4004,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
exit(0);
|
||||
case 'T':
|
||||
test_flags= argument ? (uint) atoi(argument) : 0;
|
||||
test_flags&= ~TEST_NO_THREADS;
|
||||
opt_endinfo=1;
|
||||
break;
|
||||
case (int) OPT_BIG_TABLES:
|
||||
|
@ -4193,8 +4193,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
|
||||
mysql_port=0;
|
||||
break;
|
||||
#ifdef ONE_THREAD
|
||||
case (int) OPT_ONE_THREAD:
|
||||
test_flags |= TEST_NO_THREADS;
|
||||
#endif
|
||||
break;
|
||||
case (int) OPT_WANT_CORE:
|
||||
test_flags |= TEST_CORE_ON_SIGNAL;
|
||||
|
@ -4421,11 +4423,7 @@ static void get_options(int argc,char **argv)
|
|||
#endif
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
fix_paths();
|
||||
default_table_type_name=ha_table_typelib.type_names[default_table_type-1];
|
||||
|
|
|
@ -608,6 +608,9 @@ int show_slave_hosts(THD* thd)
|
|||
|
||||
int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
|
||||
{
|
||||
if (!mi->host || !*mi->host) /* empty host */
|
||||
return 1;
|
||||
|
||||
if (!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
|
||||
mi->port, 0, 0))
|
||||
{
|
||||
|
@ -667,8 +670,10 @@ int load_master_data(THD* thd)
|
|||
int restart_thread_mask;
|
||||
mc_mysql_init(&mysql);
|
||||
|
||||
// we do not want anyone messing with the slave at all for the entire
|
||||
// duration of the data load;
|
||||
/*
|
||||
We do not want anyone messing with the slave at all for the entire
|
||||
duration of the data load.
|
||||
*/
|
||||
LOCK_ACTIVE_MI;
|
||||
lock_slave_threads(active_mi);
|
||||
init_thread_mask(&restart_thread_mask,active_mi,0 /*not inverse*/);
|
||||
|
@ -704,8 +709,10 @@ int load_master_data(THD* thd)
|
|||
|
||||
if (!(num_dbs = (uint) mc_mysql_num_rows(db_res)))
|
||||
goto err;
|
||||
// in theory, the master could have no databases at all
|
||||
// and run with skip-grant
|
||||
/*
|
||||
In theory, the master could have no databases at all
|
||||
and run with skip-grant
|
||||
*/
|
||||
|
||||
if (!(table_res = (MYSQL_RES**)thd->alloc(num_dbs * sizeof(MYSQL_RES*))))
|
||||
{
|
||||
|
@ -713,10 +720,12 @@ int load_master_data(THD* thd)
|
|||
goto err;
|
||||
}
|
||||
|
||||
// this is a temporary solution until we have online backup
|
||||
// capabilities - to be replaced once online backup is working
|
||||
// we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
|
||||
// can to minimize the lock time
|
||||
/*
|
||||
This is a temporary solution until we have online backup
|
||||
capabilities - to be replaced once online backup is working
|
||||
we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
|
||||
can to minimize the lock time.
|
||||
*/
|
||||
if (mc_mysql_query(&mysql, "FLUSH TABLES WITH READ LOCK", 0) ||
|
||||
mc_mysql_query(&mysql, "SHOW MASTER STATUS",0) ||
|
||||
!(master_status_res = mc_mysql_store_result(&mysql)))
|
||||
|
@ -726,8 +735,10 @@ int load_master_data(THD* thd)
|
|||
goto err;
|
||||
}
|
||||
|
||||
// go through every table in every database, and if the replication
|
||||
// rules allow replicating it, get it
|
||||
/*
|
||||
Go through every table in every database, and if the replication
|
||||
rules allow replicating it, get it
|
||||
*/
|
||||
|
||||
table_res_end = table_res + num_dbs;
|
||||
|
||||
|
@ -816,7 +827,7 @@ int load_master_data(THD* thd)
|
|||
}
|
||||
}
|
||||
thd->proc_info="purging old relay logs";
|
||||
if (purge_relay_logs(&active_mi->rli,0 /* not only reset, but also reinit*/,
|
||||
if (purge_relay_logs(&active_mi->rli,0 /* not only reset, but also reinit */,
|
||||
&errmsg))
|
||||
{
|
||||
send_error(&thd->net, 0, "Failed purging old relay logs");
|
||||
|
|
697
sql/slave.cc
697
sql/slave.cc
File diff suppressed because it is too large
Load diff
137
sql/slave.h
137
sql/slave.h
|
@ -84,18 +84,9 @@ typedef struct st_relay_log_info
|
|||
volatile my_off_t master_log_pos;
|
||||
|
||||
/*
|
||||
current offset in the relay log.
|
||||
pending - in some cases we do not increment offset immediately after
|
||||
processing an event, because the following event needs to be processed
|
||||
atomically together with this one ( so far, there is only one type of
|
||||
such event - Intvar_event that sets auto_increment value). However, once
|
||||
both events have been processed, we need to increment by the cumulative
|
||||
offset. pending stored the extra offset to be added to the position.
|
||||
Protected with internal locks.
|
||||
Must get data_lock when resetting the logs.
|
||||
*/
|
||||
ulonglong relay_log_pos, pending;
|
||||
|
||||
// protected with internal locks
|
||||
// must get data_lock when resetting the logs
|
||||
MYSQL_LOG relay_log;
|
||||
LOG_INFO linfo;
|
||||
IO_CACHE cache_buf,*cur_log;
|
||||
|
@ -125,9 +116,6 @@ typedef struct st_relay_log_info
|
|||
*/
|
||||
pthread_cond_t start_cond, stop_cond, data_cond;
|
||||
|
||||
// if not set, the value of other members of the structure are undefined
|
||||
bool inited;
|
||||
|
||||
// parent master info structure
|
||||
struct st_master_info *mi;
|
||||
|
||||
|
@ -135,9 +123,19 @@ typedef struct st_relay_log_info
|
|||
Needed to deal properly with cur_log getting closed and re-opened with
|
||||
a different log under our feet
|
||||
*/
|
||||
int cur_log_init_count;
|
||||
uint32 cur_log_old_open_count;
|
||||
|
||||
volatile bool abort_slave, slave_running;
|
||||
/*
|
||||
current offset in the relay log.
|
||||
pending - in some cases we do not increment offset immediately after
|
||||
processing an event, because the following event needs to be processed
|
||||
atomically together with this one ( so far, there is only one type of
|
||||
such event - Intvar_event that sets auto_increment value). However, once
|
||||
both events have been processed, we need to increment by the cumulative
|
||||
offset. pending stored the extra offset to be added to the position.
|
||||
*/
|
||||
ulonglong relay_log_pos, pending;
|
||||
ulonglong log_space_limit,log_space_total;
|
||||
|
||||
/*
|
||||
Needed for problems when slave stops and we want to restart it
|
||||
|
@ -145,45 +143,47 @@ typedef struct st_relay_log_info
|
|||
errors, and have been manually applied by DBA already.
|
||||
*/
|
||||
volatile uint32 slave_skip_counter;
|
||||
pthread_mutex_t log_space_lock;
|
||||
pthread_cond_t log_space_cond;
|
||||
THD * sql_thd;
|
||||
int last_slave_errno;
|
||||
#ifndef DBUG_OFF
|
||||
int events_till_abort;
|
||||
#endif
|
||||
int last_slave_errno;
|
||||
char last_slave_error[MAX_SLAVE_ERRMSG];
|
||||
THD* sql_thd;
|
||||
|
||||
// if not set, the value of other members of the structure are undefined
|
||||
bool inited;
|
||||
volatile bool abort_slave, slave_running;
|
||||
bool log_pos_current;
|
||||
bool abort_pos_wait;
|
||||
bool skip_log_purge;
|
||||
ulonglong log_space_limit,log_space_total;
|
||||
pthread_mutex_t log_space_lock;
|
||||
pthread_cond_t log_space_cond;
|
||||
|
||||
st_relay_log_info():info_fd(-1),cur_log_fd(-1),inited(0),
|
||||
cur_log_init_count(0),
|
||||
abort_slave(0),slave_running(0),
|
||||
log_pos_current(0),abort_pos_wait(0),
|
||||
skip_log_purge(0)
|
||||
{
|
||||
relay_log_name[0] = master_log_name[0] = 0;
|
||||
bzero(&info_file,sizeof(info_file));
|
||||
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&data_cond, NULL);
|
||||
pthread_cond_init(&start_cond, NULL);
|
||||
pthread_cond_init(&stop_cond, NULL);
|
||||
pthread_cond_init(&log_space_cond, NULL);
|
||||
}
|
||||
st_relay_log_info()
|
||||
:info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0),
|
||||
inited(0), abort_slave(0), slave_running(0), log_pos_current(0),
|
||||
abort_pos_wait(0), skip_log_purge(0)
|
||||
{
|
||||
relay_log_name[0] = master_log_name[0] = 0;
|
||||
bzero(&info_file,sizeof(info_file));
|
||||
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&data_cond, NULL);
|
||||
pthread_cond_init(&start_cond, NULL);
|
||||
pthread_cond_init(&stop_cond, NULL);
|
||||
pthread_cond_init(&log_space_cond, NULL);
|
||||
}
|
||||
~st_relay_log_info()
|
||||
{
|
||||
pthread_mutex_destroy(&run_lock);
|
||||
pthread_mutex_destroy(&data_lock);
|
||||
pthread_mutex_destroy(&log_space_lock);
|
||||
pthread_cond_destroy(&data_cond);
|
||||
pthread_cond_destroy(&start_cond);
|
||||
pthread_cond_destroy(&stop_cond);
|
||||
pthread_cond_destroy(&log_space_cond);
|
||||
}
|
||||
{
|
||||
pthread_mutex_destroy(&run_lock);
|
||||
pthread_mutex_destroy(&data_lock);
|
||||
pthread_mutex_destroy(&log_space_lock);
|
||||
pthread_cond_destroy(&data_cond);
|
||||
pthread_cond_destroy(&start_cond);
|
||||
pthread_cond_destroy(&stop_cond);
|
||||
pthread_cond_destroy(&log_space_cond);
|
||||
}
|
||||
inline void inc_pending(ulonglong val)
|
||||
{
|
||||
pending += val;
|
||||
|
@ -215,40 +215,33 @@ typedef struct st_relay_log_info
|
|||
int wait_for_pos(THD* thd, String* log_name, ulonglong log_pos);
|
||||
} RELAY_LOG_INFO;
|
||||
|
||||
/*
|
||||
repopen_relay_log() is called when we notice that the current "hot" log
|
||||
got rotated under our feet
|
||||
*/
|
||||
|
||||
IO_CACHE* reopen_relay_log(RELAY_LOG_INFO* rli, const char** errmsg);
|
||||
Log_event* next_event(RELAY_LOG_INFO* rli);
|
||||
|
||||
|
||||
/*
|
||||
st_master_info contains information about how to connect to a master,
|
||||
current master log name, and current log offset, as well as misc
|
||||
control variables
|
||||
current master log name, and current log offset, as well as misc
|
||||
control variables
|
||||
|
||||
st_master_info is initialized once from the master.info file if such
|
||||
exists. Otherwise, data members corresponding to master.info fields are
|
||||
initialized with defaults specified by master-* options. The initialization
|
||||
is done through init_master_info() call.
|
||||
st_master_info is initialized once from the master.info file if such
|
||||
exists. Otherwise, data members corresponding to master.info fields
|
||||
are initialized with defaults specified by master-* options. The
|
||||
initialization is done through init_master_info() call.
|
||||
|
||||
The format of master.info file:
|
||||
The format of master.info file:
|
||||
|
||||
log_name
|
||||
log_pos
|
||||
master_host
|
||||
master_user
|
||||
master_pass
|
||||
master_port
|
||||
master_connect_retry
|
||||
log_name
|
||||
log_pos
|
||||
master_host
|
||||
master_user
|
||||
master_pass
|
||||
master_port
|
||||
master_connect_retry
|
||||
|
||||
To write out the contents of master.info file to disk ( needed every
|
||||
time we read and queue data from the master ), a call to
|
||||
flush_master_info() is required.
|
||||
To write out the contents of master.info file to disk ( needed every
|
||||
time we read and queue data from the master ), a call to
|
||||
flush_master_info() is required.
|
||||
|
||||
To clean up, call end_master_info()
|
||||
To clean up, call end_master_info()
|
||||
*/
|
||||
|
||||
|
||||
|
@ -415,9 +408,7 @@ extern bool do_table_inited, ignore_table_inited,
|
|||
wild_do_table_inited, wild_ignore_table_inited;
|
||||
extern bool table_rules_on;
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
extern int disconnect_slave_event_count, abort_slave_event_count ;
|
||||
#endif
|
||||
|
||||
// the master variables are defaults read from my.cnf or command line
|
||||
extern uint master_port, master_connect_retry, report_port;
|
||||
|
|
|
@ -90,21 +90,21 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||
(*param->item)->val() < 0)
|
||||
{
|
||||
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
pc->max_tree_elements = (uint) (*param->item)->val_int();
|
||||
param = param->next;
|
||||
if (param->next) // no third parameter possible
|
||||
{
|
||||
net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name);
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
// second parameter
|
||||
if ((*param->item)->type() != Item::INT_ITEM ||
|
||||
(*param->item)->val() < 0)
|
||||
{
|
||||
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
pc->max_treemem = (uint) (*param->item)->val_int();
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||
(*param->item)->val() < 0)
|
||||
{
|
||||
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
// if only one parameter was given, it will be the value of max_tree_elements
|
||||
else
|
||||
|
@ -148,21 +148,26 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||
if (item->result_type() == STRING_RESULT)
|
||||
*f_info++ = new field_str(item, pc);
|
||||
}
|
||||
return pc;
|
||||
} // proc_analyse_init
|
||||
DBUG_RETURN(pc);
|
||||
}
|
||||
|
||||
|
||||
// return 1 if number, else return 0
|
||||
// store info about found number in info
|
||||
// NOTE:It is expected, that elements of 'info' are all zero!
|
||||
/*
|
||||
Return 1 if number, else return 0
|
||||
store info about found number in info
|
||||
NOTE:It is expected, that elements of 'info' are all zero!
|
||||
*/
|
||||
|
||||
bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
|
||||
{
|
||||
const char *begin, *end = str + str_len;
|
||||
|
||||
DBUG_ENTER("test_if_number");
|
||||
|
||||
// MySQL removes any endspaces of a string, so we must take care only of
|
||||
// spaces in front of a string
|
||||
/*
|
||||
MySQL removes any endspaces of a string, so we must take care only of
|
||||
spaces in front of a string
|
||||
*/
|
||||
for (; str != end && isspace(*str); str++) ;
|
||||
if (str == end)
|
||||
return 0;
|
||||
|
|
|
@ -704,17 +704,17 @@ Query_cache::Query_cache(ulong query_cache_limit,
|
|||
query_cache_limit(query_cache_limit),
|
||||
queries_in_cache(0), hits(0), inserts(0), refused(0),
|
||||
total_blocks(0),
|
||||
min_allocation_unit(min_allocation_unit),
|
||||
min_result_data_size(min_result_data_size),
|
||||
def_query_hash_size(def_query_hash_size),
|
||||
def_table_hash_size(def_table_hash_size),
|
||||
min_allocation_unit(ALIGN_SIZE(min_allocation_unit)),
|
||||
min_result_data_size(ALIGN_SIZE(min_result_data_size)),
|
||||
def_query_hash_size(ALIGN_SIZE(def_query_hash_size)),
|
||||
def_table_hash_size(ALIGN_SIZE(def_table_hash_size)),
|
||||
initialized(0)
|
||||
{
|
||||
ulong min_needed=(ALIGN_SIZE(sizeof(Query_cache_block)) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_block_table)) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_query)) + 3);
|
||||
set_if_bigger(min_allocation_unit,min_needed);
|
||||
this->min_allocation_unit = min_allocation_unit;
|
||||
this->min_allocation_unit = ALIGN_SIZE(min_allocation_unit);
|
||||
set_if_bigger(this->min_result_data_size,min_allocation_unit);
|
||||
}
|
||||
|
||||
|
@ -1073,7 +1073,8 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used)
|
|||
{
|
||||
invalidate_table((byte*) tables_used->key, tables_used->key_length);
|
||||
DBUG_PRINT("qcache", (" db %s, table %s", tables_used->key,
|
||||
tables_used->table_name));
|
||||
tables_used->key+
|
||||
strlen(tables_used->key)+1));
|
||||
}
|
||||
}
|
||||
STRUCT_UNLOCK(&structure_guard_mutex);
|
||||
|
@ -1218,6 +1219,7 @@ ulong Query_cache::init_cache()
|
|||
uint mem_bin_count, num, step;
|
||||
ulong mem_bin_size, prev_size, inc;
|
||||
ulong additional_data_size, max_mem_bin_size, approx_additional_data_size;
|
||||
int align;
|
||||
|
||||
DBUG_ENTER("Query_cache::init_cache");
|
||||
if (!initialized)
|
||||
|
@ -1228,7 +1230,13 @@ ulong Query_cache::init_cache()
|
|||
if (query_cache_size < approx_additional_data_size)
|
||||
goto err;
|
||||
|
||||
query_cache_size -= approx_additional_data_size;
|
||||
query_cache_size-= approx_additional_data_size;
|
||||
align= query_cache_size % ALIGN_SIZE(1);
|
||||
if (align)
|
||||
{
|
||||
query_cache_size-= align;
|
||||
approx_additional_data_size+= align;
|
||||
}
|
||||
|
||||
/*
|
||||
Count memory bins number.
|
||||
|
@ -1542,10 +1550,12 @@ Query_cache::write_block_data(ulong data_len, gptr data,
|
|||
ALIGN_SIZE(ntab*sizeof(Query_cache_block_table)) +
|
||||
header_len);
|
||||
ulong len = data_len + all_headers_len;
|
||||
ulong align_len= ALIGN_SIZE(len);
|
||||
DBUG_ENTER("Query_cache::write_block_data");
|
||||
DBUG_PRINT("qcache", ("data: %ld, header: %ld, all header: %ld",
|
||||
data_len, header_len, all_headers_len));
|
||||
Query_cache_block *block = allocate_block(max(len, min_allocation_unit),
|
||||
Query_cache_block *block = allocate_block(max(align_len,
|
||||
min_allocation_unit),
|
||||
1, 0, under_guard);
|
||||
if (block != 0)
|
||||
{
|
||||
|
@ -1740,7 +1750,8 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
|
|||
{
|
||||
ulong all_headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_result)));
|
||||
ulong len = data_len + all_headers_len;
|
||||
ulong len= data_len + all_headers_len;
|
||||
ulong align_len= ALIGN_SIZE(len);
|
||||
DBUG_ENTER("Query_cache::allocate_data_chain");
|
||||
DBUG_PRINT("qcache", ("data_len %lu, all_headers_len %lu",
|
||||
data_len, all_headers_len));
|
||||
|
@ -1748,7 +1759,7 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
|
|||
ulong min_size = (first_block ?
|
||||
get_min_first_result_data_size():
|
||||
get_min_append_result_data_size());
|
||||
*result_block = allocate_block(max(min_size,len),
|
||||
*result_block = allocate_block(max(min_size, align_len),
|
||||
min_result_data_size == 0,
|
||||
all_headers_len + min_result_data_size,
|
||||
1);
|
||||
|
@ -1984,7 +1995,7 @@ Query_cache_block *
|
|||
Query_cache::allocate_block(ulong len, my_bool not_less, ulong min,
|
||||
my_bool under_guard)
|
||||
{
|
||||
DBUG_ENTER("Query_cache::allocate_n_lock_block");
|
||||
DBUG_ENTER("Query_cache::allocate_block");
|
||||
DBUG_PRINT("qcache", ("len %lu, not less %d, min %lu, uder_guard %d",
|
||||
len, not_less,min,under_guard));
|
||||
|
||||
|
@ -2669,14 +2680,17 @@ my_bool Query_cache::move_by_type(byte **border,
|
|||
*border += len;
|
||||
*before = new_block;
|
||||
/* If result writing complete && we have free space in block */
|
||||
ulong free_space = new_block->length - new_block->used;
|
||||
ulong free_space= new_block->length - new_block->used;
|
||||
free_space-= free_space % ALIGN_SIZE(1);
|
||||
if (query->result()->type == Query_cache_block::RESULT &&
|
||||
new_block->length > new_block->used &&
|
||||
*gap + free_space > min_allocation_unit &&
|
||||
new_block->length - free_space > min_allocation_unit)
|
||||
{
|
||||
*border -= free_space;
|
||||
*gap += free_space;
|
||||
*border-= free_space;
|
||||
*gap+= free_space;
|
||||
DBUG_PRINT("qcache",
|
||||
("rest of result free space added to gap (%lu)", *gap));
|
||||
new_block->length -= free_space;
|
||||
}
|
||||
BLOCK_UNLOCK_WR(query_block);
|
||||
|
@ -2737,7 +2751,7 @@ my_bool Query_cache::join_results(ulong join_limit)
|
|||
header->length() > join_limit)
|
||||
{
|
||||
Query_cache_block *new_result_block =
|
||||
get_free_block(header->length() +
|
||||
get_free_block(ALIGN_SIZE(header->length()) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_block)) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_result)), 1, 0);
|
||||
if (new_result_block != 0)
|
||||
|
@ -3046,6 +3060,15 @@ my_bool Query_cache::check_integrity(bool not_locked)
|
|||
{
|
||||
DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
|
||||
(ulong) block, (uint) block->type));
|
||||
// Check allignment
|
||||
if ((((ulonglong)block) % (ulonglong)ALIGN_SIZE(1)) !=
|
||||
(((ulonglong)first_block) % (ulonglong)ALIGN_SIZE(1)))
|
||||
{
|
||||
DBUG_PRINT("error",
|
||||
("block 0x%lx do not aligned by %d", (ulong) block,
|
||||
ALIGN_SIZE(1)));
|
||||
result = 1;
|
||||
}
|
||||
// Check memory allocation
|
||||
if (block->pnext == first_block) // Is it last block?
|
||||
{
|
||||
|
|
|
@ -345,11 +345,7 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(TABLE *table)
|
|||
ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST)));
|
||||
new_table->next = 0;
|
||||
new_table->key_length = table->key_length;
|
||||
uint32 db_len = ((new_table->table_name =
|
||||
::strmake(new_table->key, table->table_cache_key,
|
||||
table->key_length) + 1) - new_table->key);
|
||||
::memcpy(new_table->key + db_len, table->table_cache_key + db_len,
|
||||
table->key_length - db_len);
|
||||
::memcpy(new_table->key, table->table_cache_key, table->key_length);
|
||||
return new_table;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,48 +60,49 @@ class Log_event;
|
|||
class MYSQL_LOG {
|
||||
private:
|
||||
pthread_mutex_t LOCK_log, LOCK_index;
|
||||
pthread_cond_t update_cond;
|
||||
ulonglong bytes_written;
|
||||
time_t last_time,query_start;
|
||||
IO_CACHE log_file;
|
||||
File index_file;
|
||||
char *name;
|
||||
volatile enum_log_type log_type;
|
||||
char time_buff[20],db[NAME_LEN+1];
|
||||
char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN];
|
||||
bool write_error,inited;
|
||||
uint file_id; // current file sequence number for load data infile
|
||||
// binary logging
|
||||
bool no_rotate; // for binlog - if log name can never change
|
||||
// we should not try to rotate it or write any rotation events
|
||||
// the user should use FLUSH MASTER instead of FLUSH LOGS for
|
||||
// purging
|
||||
// current file sequence number for load data infile binary logging
|
||||
uint file_id;
|
||||
uint open_count; // For replication
|
||||
/*
|
||||
For binlog - if log name can never change we should not try to rotate it
|
||||
or write any rotation events. The user should use FLUSH MASTER instead
|
||||
of FLUSH LOGS for purging.
|
||||
*/
|
||||
volatile enum_log_type log_type;
|
||||
enum cache_type io_cache_type;
|
||||
bool write_error,inited;
|
||||
bool no_rotate;
|
||||
bool need_start_event;
|
||||
pthread_cond_t update_cond;
|
||||
bool no_auto_events; // for relay binlog
|
||||
ulonglong bytes_written;
|
||||
friend class Log_event;
|
||||
|
||||
public:
|
||||
MYSQL_LOG();
|
||||
~MYSQL_LOG();
|
||||
pthread_mutex_t* get_log_lock() { return &LOCK_log; }
|
||||
void reset_bytes_written()
|
||||
{
|
||||
bytes_written = 0;
|
||||
}
|
||||
{
|
||||
bytes_written = 0;
|
||||
}
|
||||
void harvest_bytes_written(ulonglong* counter)
|
||||
{
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
char buf1[22],buf2[22];
|
||||
char buf1[22],buf2[22];
|
||||
#endif
|
||||
DBUG_ENTER("harvest_bytes_written");
|
||||
(*counter)+=bytes_written;
|
||||
DBUG_PRINT("info",("counter=%s,bytes_written=%s", llstr(*counter,buf1),
|
||||
llstr(bytes_written,buf2)));
|
||||
bytes_written=0;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
IO_CACHE* get_log_file() { return &log_file; }
|
||||
DBUG_ENTER("harvest_bytes_written");
|
||||
(*counter)+=bytes_written;
|
||||
DBUG_PRINT("info",("counter: %s bytes_written: %s", llstr(*counter,buf1),
|
||||
llstr(bytes_written,buf2)));
|
||||
bytes_written=0;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
void signal_update() { pthread_cond_broadcast(&update_cond);}
|
||||
void wait_for_update(THD* thd);
|
||||
void set_need_start_event() { need_start_event = 1; }
|
||||
|
@ -135,8 +136,8 @@ public:
|
|||
int purge_logs(THD* thd, const char* to_log);
|
||||
int purge_first_log(struct st_relay_log_info* rli);
|
||||
int reset_logs(THD* thd);
|
||||
void close(bool exiting = 0); // if we are exiting, we also want to close the
|
||||
// index file
|
||||
// if we are exiting, we also want to close the index file
|
||||
void close(bool exiting = 0);
|
||||
|
||||
// iterating through the log index file
|
||||
int find_first_log(LOG_INFO* linfo, const char* log_name,
|
||||
|
@ -146,11 +147,15 @@ public:
|
|||
uint next_file_id();
|
||||
|
||||
inline bool is_open() { return log_type != LOG_CLOSED; }
|
||||
char* get_index_fname() { return index_file_name;}
|
||||
char* get_log_fname() { return log_file_name; }
|
||||
void lock_index() { pthread_mutex_lock(&LOCK_index);}
|
||||
void unlock_index() { pthread_mutex_unlock(&LOCK_index);}
|
||||
File get_index_file() { return index_file;}
|
||||
inline char* get_index_fname() { return index_file_name;}
|
||||
inline char* get_log_fname() { return log_file_name; }
|
||||
inline pthread_mutex_t* get_log_lock() { return &LOCK_log; }
|
||||
inline IO_CACHE* get_log_file() { return &log_file; }
|
||||
|
||||
inline void lock_index() { pthread_mutex_lock(&LOCK_index);}
|
||||
inline void unlock_index() { pthread_mutex_unlock(&LOCK_index);}
|
||||
inline File get_index_file() { return index_file;}
|
||||
inline uint32 get_open_count() { return open_count; }
|
||||
};
|
||||
|
||||
/* character conversion tables */
|
||||
|
|
|
@ -332,7 +332,7 @@ bool mysql_change_db(THD *thd,const char *name)
|
|||
uint db_access;
|
||||
DBUG_ENTER("mysql_change_db");
|
||||
|
||||
if (!dbname || !(db_length=stripp_sp(dbname)))
|
||||
if (!dbname || !(db_length=strip_sp(dbname)))
|
||||
{
|
||||
x_free(dbname); /* purecov: inspected */
|
||||
send_error(&thd->net,ER_NO_DB_ERROR); /* purecov: inspected */
|
||||
|
|
|
@ -573,9 +573,15 @@ end:
|
|||
}
|
||||
send_ok(&thd->net); // This should return record count
|
||||
}
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
unlock_table_name(thd, table_list);
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
}
|
||||
else if (error)
|
||||
{
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
unlock_table_name(thd, table_list);
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
}
|
||||
DBUG_RETURN(error ? -1 : 0);
|
||||
}
|
||||
|
|
|
@ -332,7 +332,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
|
|||
{
|
||||
char buff[160];
|
||||
if (duplic == DUP_IGNORE)
|
||||
sprintf(buff,ER(ER_INSERT_INFO),info.records,info.records-info.copied,
|
||||
sprintf(buff,ER(ER_INSERT_INFO),info.records,
|
||||
(lock_type == TL_WRITE_DELAYED) ? 0 :
|
||||
info.records-info.copied,
|
||||
thd->cuted_fields);
|
||||
else
|
||||
sprintf(buff,ER(ER_INSERT_INFO),info.records,info.deleted,
|
||||
|
|
|
@ -160,7 +160,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
|
|||
uc->connections = 1;
|
||||
uc->questions=uc->updates=uc->conn_per_hour=0;
|
||||
uc->user_resources=*mqh;
|
||||
if (mqh->connections > max_user_connections)
|
||||
if (max_user_connections && mqh->connections > max_user_connections)
|
||||
uc->user_resources.connections = max_user_connections;
|
||||
uc->intime=thd->thr_create_time;
|
||||
if (hash_insert(&hash_user_connections, (byte*) uc))
|
||||
|
@ -298,7 +298,7 @@ static int check_for_max_user_connections(USER_CONN *uc)
|
|||
goto end;
|
||||
}
|
||||
uc->connections++;
|
||||
if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections)
|
||||
if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections)
|
||||
{
|
||||
net_printf(¤t_thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_connections",
|
||||
(long) uc->user_resources.connections);
|
||||
|
@ -317,12 +317,7 @@ static void decrease_user_connections(USER_CONN *uc)
|
|||
*/
|
||||
|
||||
DBUG_ENTER("decrease_user_connections");
|
||||
if (mqh_used)
|
||||
{
|
||||
if (uc->conn_per_hour)
|
||||
uc->conn_per_hour--;
|
||||
}
|
||||
else if (!--uc->connections)
|
||||
if (!mqh_used && uc->connections && !--uc->connections)
|
||||
{
|
||||
/* Last connection for user; Delete it */
|
||||
(void) pthread_mutex_lock(&LOCK_user_conn);
|
||||
|
@ -594,7 +589,7 @@ pthread_handler_decl(handle_one_connection,arg)
|
|||
|
||||
#if !defined( __WIN__) && !defined(OS2) // Win32 calls this in pthread_create
|
||||
// The following calls needs to be done before we call DBUG_ macros
|
||||
if (my_thread_init())
|
||||
if (!(test_flags & TEST_NO_THREADS) & my_thread_init())
|
||||
{
|
||||
close_connection(&thd->net,ER_OUT_OF_RESOURCES);
|
||||
statistic_increment(aborted_connects,&LOCK_thread_count);
|
||||
|
@ -1047,7 +1042,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
thread_safe_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_thread_count);
|
||||
char *db=thd->strdup(packet);
|
||||
// null test to handle EOM
|
||||
if (!db || !stripp_sp(db) || check_db_name(db))
|
||||
if (!db || !strip_sp(db) || check_db_name(db))
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
|
||||
break;
|
||||
|
@ -1063,7 +1058,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
thread_safe_increment(com_stat[SQLCOM_DROP_DB],&LOCK_thread_count);
|
||||
char *db=thd->strdup(packet);
|
||||
// null test to handle EOM
|
||||
if (!db || !stripp_sp(db) || check_db_name(db))
|
||||
if (!db || !strip_sp(db) || check_db_name(db))
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
|
||||
break;
|
||||
|
@ -1797,6 +1792,7 @@ mysql_execute_command(void)
|
|||
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
|
||||
if ((res=open_and_lock_tables(thd,tables)))
|
||||
break;
|
||||
thd->select_limit=HA_POS_ERROR;
|
||||
if (!setup_fields(thd,tables,select_lex->item_list,1,0,0) &&
|
||||
!setup_fields(thd,tables,lex->value_list,0,0,0) && ! thd->fatal_error &&
|
||||
(result=new multi_update(thd,tables,select_lex->item_list,lex->duplicates,
|
||||
|
@ -1964,13 +1960,9 @@ mysql_execute_command(void)
|
|||
}
|
||||
auxi->lock_type=walk->lock_type=TL_WRITE;
|
||||
auxi->table= (TABLE *) walk; // Remember corresponding table
|
||||
(void)add_item_to_list(new Item_field(auxi->db,auxi->real_name,"*"));
|
||||
}
|
||||
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
|
||||
if (add_item_to_list(new Item_null()))
|
||||
{
|
||||
res= -1;
|
||||
break;
|
||||
}
|
||||
thd->proc_info="init";
|
||||
if ((res=open_and_lock_tables(thd,tables)))
|
||||
break;
|
||||
|
@ -2241,7 +2233,7 @@ mysql_execute_command(void)
|
|||
break;
|
||||
case SQLCOM_CREATE_DB:
|
||||
{
|
||||
if (!stripp_sp(lex->name) || check_db_name(lex->name))
|
||||
if (!strip_sp(lex->name) || check_db_name(lex->name))
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
|
||||
break;
|
||||
|
@ -2253,7 +2245,7 @@ mysql_execute_command(void)
|
|||
}
|
||||
case SQLCOM_DROP_DB:
|
||||
{
|
||||
if (!stripp_sp(lex->name) || check_db_name(lex->name))
|
||||
if (!strip_sp(lex->name) || check_db_name(lex->name))
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
|
||||
break;
|
||||
|
@ -2440,7 +2432,6 @@ mysql_execute_command(void)
|
|||
}
|
||||
else
|
||||
res= -1;
|
||||
thd->transaction.cleanup();
|
||||
break;
|
||||
}
|
||||
case SQLCOM_ROLLBACK:
|
||||
|
@ -2455,7 +2446,6 @@ mysql_execute_command(void)
|
|||
else
|
||||
res= -1;
|
||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
||||
thd->transaction.cleanup();
|
||||
break;
|
||||
default: /* Impossible */
|
||||
send_ok(&thd->net);
|
||||
|
@ -2574,8 +2564,17 @@ check_table_access(THD *thd,uint want_access,TABLE_LIST *tables,
|
|||
}
|
||||
}
|
||||
else if (check_access(thd,want_access,tables->db,&tables->grant.privilege,
|
||||
0, no_errors | grant_option))
|
||||
{
|
||||
if (grant_option)
|
||||
{
|
||||
if ( check_access(thd,want_access & (uint) ~TABLE_ACLS,tables->db,&tables->grant.privilege,
|
||||
0, no_errors))
|
||||
return TRUE; // Access denied
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (grant_option)
|
||||
return check_grant(thd,want_access & ~EXTRA_ACL,org_tables,
|
||||
|
@ -2746,7 +2745,7 @@ void mysql_init_multi_delete(LEX *lex)
|
|||
{
|
||||
lex->sql_command = SQLCOM_DELETE_MULTI;
|
||||
mysql_init_select(lex);
|
||||
lex->select->select_limit=HA_POS_ERROR;
|
||||
lex->select->select_limit=lex->thd->select_limit=HA_POS_ERROR;
|
||||
lex->auxilliary_table_list=lex->select_lex.table_list;
|
||||
lex->select->table_list.elements=0;
|
||||
lex->select->table_list.first=0;
|
||||
|
@ -2890,6 +2889,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
|||
case FIELD_TYPE_STRING:
|
||||
case FIELD_TYPE_VAR_STRING:
|
||||
case FIELD_TYPE_NULL:
|
||||
case FIELD_TYPE_GEOMETRY:
|
||||
break;
|
||||
case FIELD_TYPE_DECIMAL:
|
||||
if (!length)
|
||||
|
@ -2991,7 +2991,9 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
|||
new_field->interval=interval;
|
||||
new_field->length=0;
|
||||
for (const char **pos=interval->type_names; *pos ; pos++)
|
||||
new_field->length+=(uint) strlen(*pos)+1;
|
||||
{
|
||||
new_field->length+=(uint) strip_sp((char*) *pos)+1;
|
||||
}
|
||||
new_field->length--;
|
||||
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
||||
if (default_value)
|
||||
|
@ -3012,10 +3014,10 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
|||
{
|
||||
new_field->interval=interval;
|
||||
new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe
|
||||
new_field->length=(uint) strlen(interval->type_names[0]);
|
||||
new_field->length=(uint) strip_sp((char*) interval->type_names[0]);
|
||||
for (const char **pos=interval->type_names+1; *pos ; pos++)
|
||||
{
|
||||
uint length=(uint) strlen(*pos);
|
||||
uint length=(uint) strip_sp((char*) *pos);
|
||||
set_if_bigger(new_field->length,length);
|
||||
}
|
||||
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
||||
|
|
|
@ -27,11 +27,9 @@
|
|||
|
||||
extern const char* any_db;
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
int max_binlog_dump_events = 0; // unlimited
|
||||
bool opt_sporadic_binlog_dump_fail = 0;
|
||||
static int binlog_dump_count = 0;
|
||||
#endif
|
||||
|
||||
int check_binlog_magic(IO_CACHE* log, const char** errmsg)
|
||||
{
|
||||
|
@ -156,6 +154,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
|
|||
const char **errmsg)
|
||||
{
|
||||
File file;
|
||||
DBUG_ENTER("open_binlog");
|
||||
|
||||
if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0 ||
|
||||
init_io_cache(log, file, IO_SIZE*2, READ_CACHE, 0, 0,
|
||||
|
@ -166,7 +165,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
|
|||
}
|
||||
if (check_binlog_magic(log,errmsg))
|
||||
goto err;
|
||||
return file;
|
||||
DBUG_RETURN(file);
|
||||
|
||||
err:
|
||||
if (file >= 0)
|
||||
|
@ -174,7 +173,7 @@ err:
|
|||
my_close(file,MYF(0));
|
||||
end_io_cache(log);
|
||||
}
|
||||
return -1;
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -630,7 +629,8 @@ int reset_slave(MASTER_INFO* mi)
|
|||
char fname[FN_REFLEN];
|
||||
int restart_thread_mask = 0,error=0;
|
||||
const char* errmsg=0;
|
||||
|
||||
DBUG_ENTER("reset_slave");
|
||||
|
||||
lock_slave_threads(mi);
|
||||
init_thread_mask(&restart_thread_mask,mi,0 /* not inverse */);
|
||||
if ((error=terminate_slave_threads(mi,restart_thread_mask,1 /*skip lock*/))
|
||||
|
@ -651,14 +651,14 @@ int reset_slave(MASTER_INFO* mi)
|
|||
goto err;
|
||||
}
|
||||
if (restart_thread_mask)
|
||||
error=start_slave_threads(0 /* mutex not needed*/,
|
||||
1 /* wait for start*/,
|
||||
mi,master_info_file,relay_log_info_file,
|
||||
restart_thread_mask);
|
||||
error=start_slave_threads(0 /* mutex not needed */,
|
||||
1 /* wait for start*/,
|
||||
mi,master_info_file,relay_log_info_file,
|
||||
restart_thread_mask);
|
||||
// TODO: fix error messages so they get to the client
|
||||
err:
|
||||
unlock_slave_threads(mi);
|
||||
return error;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
void kill_zombie_dump_threads(uint32 slave_server_id)
|
||||
|
|
|
@ -21,10 +21,8 @@ extern uint32 server_id;
|
|||
extern bool server_id_supplied;
|
||||
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
extern int max_binlog_dump_events;
|
||||
extern bool opt_sporadic_binlog_dump_fail;
|
||||
#endif
|
||||
|
||||
#define KICK_SLAVE(thd) thd->awake(0 /* do not prepare to die*/);
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ static TABLE *get_sort_by_table(ORDER *a,ORDER *b,TABLE_LIST *tables);
|
|||
static void calc_group_buffer(JOIN *join,ORDER *group);
|
||||
static bool alloc_group_fields(JOIN *join,ORDER *group);
|
||||
static bool make_sum_func_list(JOIN *join,List<Item> &fields);
|
||||
static bool change_to_use_tmp_fields(List<Item> &func);
|
||||
static bool change_to_use_tmp_fields(List<Item> &func, bool change=false);
|
||||
static bool change_refs_to_tmp_fields(THD *thd, List<Item> &func);
|
||||
static void init_tmptable_sum_functions(Item_sum **func);
|
||||
static void update_tmptable_sum_func(Item_sum **func,TABLE *tmp_table);
|
||||
|
@ -788,7 +788,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
|
|||
tmp_table=tmp_table2;
|
||||
join.join_tab[0].table=0; // Table is freed
|
||||
|
||||
if (change_to_use_tmp_fields(all_fields)) // No sum funcs anymore
|
||||
if (change_to_use_tmp_fields(all_fields,true)) // No sum funcs anymore
|
||||
goto err;
|
||||
join.tmp_table_param.field_count+=join.tmp_table_param.sum_func_count;
|
||||
join.tmp_table_param.sum_func_count=0;
|
||||
|
@ -6764,7 +6764,7 @@ make_sum_func_list(JOIN *join,List<Item> &fields)
|
|||
*/
|
||||
|
||||
static bool
|
||||
change_to_use_tmp_fields(List<Item> &items)
|
||||
change_to_use_tmp_fields(List<Item> &items, bool change)
|
||||
{
|
||||
List_iterator<Item> it(items);
|
||||
Item *item_field,*item;
|
||||
|
@ -6776,6 +6776,11 @@ change_to_use_tmp_fields(List<Item> &items)
|
|||
continue;
|
||||
if (item->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
if (change)
|
||||
{
|
||||
((Item_field*) item)->result_field->null_ptr=0;
|
||||
item->maybe_null=0;
|
||||
}
|
||||
((Item_field*) item)->field=
|
||||
((Item_field*) item)->result_field;
|
||||
}
|
||||
|
|
|
@ -432,6 +432,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
|||
TABLE *table;
|
||||
handler *file;
|
||||
char tmp[MAX_FIELD_WIDTH];
|
||||
Item *item;
|
||||
CONVERT *convert=thd->convert_set;
|
||||
DBUG_ENTER("mysqld_show_fields");
|
||||
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
|
||||
|
@ -451,7 +452,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
|||
field_list.push_back(new Item_empty_string("Type",40));
|
||||
field_list.push_back(new Item_empty_string("Null",1));
|
||||
field_list.push_back(new Item_empty_string("Key",3));
|
||||
field_list.push_back(new Item_empty_string("Default",NAME_LEN));
|
||||
field_list.push_back(item=new Item_empty_string("Default",NAME_LEN));
|
||||
item->maybe_null=1;
|
||||
field_list.push_back(new Item_empty_string("Extra",20));
|
||||
if (verbose)
|
||||
field_list.push_back(new Item_empty_string("Privileges",80));
|
||||
|
|
|
@ -1235,7 +1235,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
thd->proc_info="init";
|
||||
table_name=table_list->real_name;
|
||||
db=table_list->db;
|
||||
if (!new_db)
|
||||
if (!new_db || !strcmp(new_db,db))
|
||||
new_db=db;
|
||||
used_fields=create_info->used_fields;
|
||||
|
||||
|
@ -1289,10 +1289,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
/* In some simple cases we need not to recreate the table */
|
||||
|
||||
thd->proc_info="setup";
|
||||
if (simple_alter)
|
||||
if (simple_alter && !table->tmp_table)
|
||||
{
|
||||
error=0;
|
||||
if (new_name != table_name)
|
||||
if (new_name != table_name || new_db != db)
|
||||
{
|
||||
thd->proc_info="rename";
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
|
@ -1315,15 +1315,15 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
}
|
||||
if (!error)
|
||||
{
|
||||
switch (keys_onoff)
|
||||
{
|
||||
case LEAVE_AS_IS: break;
|
||||
case ENABLE:
|
||||
error=table->file->activate_all_index(thd);
|
||||
break;
|
||||
case DISABLE:
|
||||
table->file->deactivate_non_unique_index(HA_POS_ERROR);
|
||||
break;
|
||||
switch (keys_onoff) {
|
||||
case LEAVE_AS_IS:
|
||||
break;
|
||||
case ENABLE:
|
||||
error=table->file->activate_all_index(thd);
|
||||
break;
|
||||
case DISABLE:
|
||||
table->file->deactivate_non_unique_index(HA_POS_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!error)
|
||||
|
@ -1720,7 +1720,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
thd->proc_info="rename result table";
|
||||
sprintf(old_name,"%s2-%lx-%lx", tmp_file_prefix, current_pid,
|
||||
thd->thread_id);
|
||||
if (new_name != table_name)
|
||||
if (new_name != table_name || new_db != db)
|
||||
{
|
||||
if (!access(new_name_buff,F_OK))
|
||||
{
|
||||
|
@ -1738,7 +1738,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
{
|
||||
/*
|
||||
Win32 and InnoDB can't drop a table that is in use, so we must
|
||||
close all the original table at before doing the rename
|
||||
close the original table at before doing the rename
|
||||
*/
|
||||
table_name=thd->strdup(table_name); // must be saved
|
||||
if (close_cached_table(thd,table))
|
||||
|
|
|
@ -1069,7 +1069,8 @@ attribute:
|
|||
| AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
|
||||
| PRIMARY_SYM KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
|
||||
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
|
||||
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; };
|
||||
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
|
||||
| COMMENT_SYM text_literal {};
|
||||
|
||||
opt_binary:
|
||||
/* empty */ {}
|
||||
|
@ -1203,8 +1204,7 @@ alter_list_item:
|
|||
lex->length,lex->dec,lex->type,
|
||||
lex->default_value, $3.str,
|
||||
lex->interval))
|
||||
YYABORT;
|
||||
lex->simple_alter=0;
|
||||
YYABORT;
|
||||
}
|
||||
opt_place
|
||||
| DROP opt_column field_ident opt_restrict
|
||||
|
@ -1245,7 +1245,6 @@ alter_list_item:
|
|||
LEX *lex=Lex;
|
||||
lex->select->db=$3->db.str;
|
||||
lex->name= $3->table.str;
|
||||
lex->simple_alter=0;
|
||||
}
|
||||
| create_table_options { Lex->simple_alter=0; }
|
||||
| order_clause { Lex->simple_alter=0; };
|
||||
|
|
|
@ -154,7 +154,7 @@ typedef struct st_table_list {
|
|||
|
||||
typedef struct st_changed_table_list {
|
||||
struct st_changed_table_list *next;
|
||||
char *key, *table_name;
|
||||
char *key;
|
||||
uint32 key_length;
|
||||
} CHANGED_TABLE_LIST;
|
||||
|
||||
|
|
|
@ -129,6 +129,10 @@ bfill((A)->null_flags,(A)->null_bytes,255);\
|
|||
*/
|
||||
#define MIN_TURBOBM_PATTERN_LEN 3
|
||||
|
||||
/* Defines for binary logging */
|
||||
|
||||
#define BIN_LOG_HEADER_SIZE 4
|
||||
|
||||
/* Include prototypes for unireg */
|
||||
|
||||
#include "mysqld_error.h"
|
||||
|
|
|
@ -35,8 +35,23 @@ set-variable = thread_cache=8
|
|||
# Try number of CPU's*2 for thread_concurrency
|
||||
set-variable = thread_concurrency=8
|
||||
set-variable = myisam_sort_buffer_size=64M
|
||||
log-bin
|
||||
server-id = 1
|
||||
|
||||
# Replication Master Server (default)
|
||||
log-bin # required for replication
|
||||
server-id = 1 # required unique id between 1 and 2^32 - 1
|
||||
# defaults to 1 if master-host is not set
|
||||
# but will not function as a master if omitted
|
||||
|
||||
# Replication Slave Server (comment out master section to use this)
|
||||
#master-host = # MUST BE SET
|
||||
#master-user = # MUST BE SET
|
||||
#master-password = # MUST BE SET
|
||||
#master-port = # optional--defaults to 3306
|
||||
#log-bin # not required for slaves, but recommended
|
||||
#server-id = 2 # required unique id between 2 and 2^32 - 1
|
||||
# (and different from the master)
|
||||
# defaults to 2 if master-host is set
|
||||
# but will not function as a slave if omitted
|
||||
|
||||
# Point the following paths to different dedicated disks
|
||||
#tmpdir = /tmp/
|
||||
|
|
125
tests/truncate.pl
Executable file
125
tests/truncate.pl
Executable file
|
@ -0,0 +1,125 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# This is a test with uses many processes to test a MySQL server.
|
||||
#
|
||||
|
||||
$opt_loop_count=10000; # Change this to make test harder/easier
|
||||
|
||||
##################### Standard benchmark inits ##############################
|
||||
|
||||
use DBI;
|
||||
use Getopt::Long;
|
||||
use Benchmark;
|
||||
|
||||
package main;
|
||||
|
||||
$opt_skip_create=$opt_skip_in=$opt_verbose=$opt_fast_insert=
|
||||
$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=0;
|
||||
$opt_threads=2;
|
||||
$opt_host=$opt_user=$opt_password=""; $opt_db="test";
|
||||
|
||||
GetOptions("host=s","db=s","user=s","password=s","loop-count=i","skip-create","skip-in","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","threads=i") || die "Aborted";
|
||||
$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$opt_force=undef; # Ignore warnings from these
|
||||
|
||||
print "Testing truncate from $opt_threads multiple connections $opt_loop_count times\n";
|
||||
|
||||
@testtables = ( ["bench_f31", "type=heap"]);
|
||||
|
||||
####
|
||||
#### Start timeing and start test
|
||||
####
|
||||
|
||||
$start_time=new Benchmark;
|
||||
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
|
||||
$opt_user, $opt_password,
|
||||
{ PrintError => 0}) || die $DBI::errstr;
|
||||
if (!$opt_skip_create)
|
||||
{
|
||||
my $table_def;
|
||||
foreach $table_def (@testtables)
|
||||
{
|
||||
my ($table,$extra)= ($table_def->[0], $table_def->[1]);
|
||||
print "Creating table $table in database $opt_db\n";
|
||||
$dbh->do("drop table if exists $table");
|
||||
$dbh->do("create table $table".
|
||||
" (id int(6) not null,".
|
||||
" info varchar(32)," .
|
||||
" marker timestamp," .
|
||||
" flag int not null," .
|
||||
" primary key(id)) $extra")
|
||||
|
||||
or die $DBI::errstr;
|
||||
}
|
||||
}
|
||||
|
||||
$dbh->disconnect; $dbh=0; # Close handler
|
||||
$|= 1; # Autoflush
|
||||
|
||||
####
|
||||
#### Start the tests
|
||||
####
|
||||
|
||||
for ($i=0 ; $i < $opt_threads ; $i ++)
|
||||
{
|
||||
test_truncate() if (($pid=fork()) == 0); $work{$pid}="truncate";
|
||||
}
|
||||
|
||||
print "Started $opt_threads threads\n";
|
||||
|
||||
$errors=0;
|
||||
$running_insert_threads=$opt_threads;
|
||||
while (($pid=wait()) != -1)
|
||||
{
|
||||
$ret=$?/256;
|
||||
print "thread '" . $work{$pid} . "' finished with exit code $ret\n";
|
||||
--$running_insert_threads;
|
||||
$errors++ if ($ret != 0);
|
||||
}
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
|
||||
if (!$opt_skip_delete && !$errors)
|
||||
{
|
||||
my $table_def;
|
||||
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
|
||||
$opt_user, $opt_password,
|
||||
{ PrintError => 0}) || die $DBI::errstr;
|
||||
|
||||
foreach $table_def (@testtables)
|
||||
{
|
||||
$dbh->do("drop table " . $table_def->[0]);
|
||||
}
|
||||
$dbh->disconnect; $dbh=0; # Close handler
|
||||
}
|
||||
|
||||
print ($errors ? "Test failed\n" :"Test ok\n");
|
||||
$end_time=new Benchmark;
|
||||
print "Total time: " .
|
||||
timestr(timediff($end_time, $start_time),"noc") . "\n";
|
||||
|
||||
exit(0);
|
||||
|
||||
|
||||
#
|
||||
# Insert records in the table
|
||||
#
|
||||
|
||||
sub test_truncate
|
||||
{
|
||||
my ($dbh,$i,$j,$count,$table_def,$table);
|
||||
|
||||
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
|
||||
$opt_user, $opt_password,
|
||||
{ PrintError => 0}) || die $DBI::errstr;
|
||||
|
||||
for ($count=0; $count < $opt_loop_count ; $count++)
|
||||
{
|
||||
my ($table)= ($testtables[0]->[0]);
|
||||
$dbh->do("truncate table $table") || die "Got error on truncate: $DBI::errstr\n";
|
||||
}
|
||||
$dbh->disconnect; $dbh=0;
|
||||
print "Test_truncate: Run $count times\n";
|
||||
exit(0);
|
||||
}
|
|
@ -41,8 +41,8 @@
|
|||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#define MANAGER_VERSION "1.1"
|
||||
#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.0"
|
||||
#define MANAGER_VERSION "1.2"
|
||||
#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.2"
|
||||
|
||||
#define LOG_ERR 1
|
||||
#define LOG_WARN 2
|
||||
|
@ -1332,11 +1332,8 @@ static int parse_args(int argc, char **argv)
|
|||
int ho_error;
|
||||
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
||||
ho_error);
|
||||
exit(1);
|
||||
}
|
||||
exit(ho_error);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,12 +36,14 @@ const char *VER="0.2";
|
|||
const char *default_dbug_option="d:t:O,-";
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void
|
||||
fatal_error( const char* r)
|
||||
{
|
||||
perror(r);
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int sd;
|
||||
|
@ -70,13 +72,13 @@ do_ssl_stuff( TH_ARGS* args)
|
|||
static void*
|
||||
client_thread( void* arg)
|
||||
{
|
||||
my_thread_init();
|
||||
do_ssl_stuff((TH_ARGS*)arg);
|
||||
my_thread_init();
|
||||
do_ssl_stuff((TH_ARGS*)arg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main( int argc __attribute__((unused)),
|
||||
char** argv)
|
||||
main(int argc __attribute__((unused)), char** argv)
|
||||
{
|
||||
char server_key[] = "../SSL/server-key.pem",
|
||||
server_cert[] = "../SSL/server-cert.pem";
|
||||
|
|
Loading…
Reference in a new issue