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
@ -64,3 +64,4 @@ venu@work.mysql.com
|
|||||||
worm@altair.is.lan
|
worm@altair.is.lan
|
||||||
zak@balfor.local
|
zak@balfor.local
|
||||||
zak@linux.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
@ -2,11 +2,12 @@ OriginalAuthor: PaulDuBois
|
|||||||
|
|
||||||
!!! ManualStyleGuidelines
|
!!! ManualStyleGuidelines
|
||||||
|
|
||||||
''Version 1.0''
|
''Version 1.1''
|
||||||
|
|
||||||
!! Revision History
|
!! Revision History
|
||||||
|
|
||||||
* 2002-05-17 ArjenLentz - Version 1.0, Posted to Wiki
|
* 2002-05-17 ArjenLentz - Version 1.0, Posted to Wiki
|
||||||
|
* 2002-06-03 ArjenLentz - Version 1.1, updates.
|
||||||
|
|
||||||
!! MySQL Manual Style Guidelines
|
!! 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 NetWare, not Netware (as per Novell's trademark guidelines).
|
||||||
|
|
||||||
|
It's deprecated, not depricated.
|
||||||
|
|
||||||
|
@ -14135,8 +14135,9 @@ though.
|
|||||||
|
|
||||||
@item --core-file
|
@item --core-file
|
||||||
Write a core file if @code{mysqld} dies. For some systems you must also
|
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, ,
|
specify @code{--core-file-size} to @code{safe_mysqld}.
|
||||||
@code{safe_mysqld}}. Note that on some system like Solaris, you will
|
@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.
|
not get a core file if you are also using the @code{--user} option.
|
||||||
|
|
||||||
@item -h, --datadir=path
|
@item -h, --datadir=path
|
||||||
@ -14340,7 +14341,8 @@ privilege.
|
|||||||
|
|
||||||
@item --skip-stack-trace
|
@item --skip-stack-trace
|
||||||
Don't write stack traces. This option is useful when you are running
|
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
|
@item --skip-thread-priority
|
||||||
Disable using thread priorities for faster response time.
|
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}
|
@item @code{net_read_timeout}
|
||||||
Number of seconds to wait for more data from a connection before aborting
|
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
|
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}
|
@item @code{net_retry_count}
|
||||||
If a read on a communication port is interrupted, retry this many times
|
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
|
concerned about people being able to see what databases other users
|
||||||
have. See also @code{safe_show_database}.
|
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
|
Number of seconds to wait for more data from a master/slave connection
|
||||||
before aborting the read.
|
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
|
MySQL uses memory mapping (@code{mmap()}) on compressed tables and
|
||||||
falls back to normal read/write file usage if @code{mmap()} doesn't work.
|
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
|
@itemize @bullet
|
||||||
@item
|
@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
|
@item
|
||||||
@code{myisampack} can also pack @code{BLOB} or @code{TEXT} columns. The
|
@code{myisampack} can also pack @code{BLOB} or @code{TEXT} columns.
|
||||||
older @code{pack_isam} could not do this.
|
The older @code{pack_isam} (for @code{ISAM} tables) can not do this.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
Fixing these limitations is on our TODO list but with low priority.
|
|
||||||
|
|
||||||
@code{myisampack} is invoked like this:
|
@code{myisampack} is invoked like this:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
@ -22660,9 +22662,12 @@ Overrides option --databases (-B).
|
|||||||
@item -T, --tab=path-to-some-directory
|
@item -T, --tab=path-to-some-directory
|
||||||
Creates a @code{table_name.sql} file, that contains the SQL CREATE commands,
|
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.
|
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
|
The format of the @file{.txt} file is made according to the
|
||||||
machine as the @code{mysqld} daemon. The format of the @file{.txt} file
|
@code{--fields-xxx} and @code{--lines--xxx} options.
|
||||||
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
|
@item -u user_name, --user=user_name
|
||||||
The MySQL user name to use when connecting to the server. The
|
The MySQL user name to use when connecting to the server. The
|
||||||
default value is your Unix login name.
|
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
|
Tells the slave server not to start the slave on the startup. The user
|
||||||
can start it later with @code{SLAVE START}.
|
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
|
Number of seconds to wait for more data from the master before aborting
|
||||||
the read.
|
the read.
|
||||||
@end multitable
|
@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.
|
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.
|
Lettercase is irrelevant when you assign values to an @code{ENUM} column.
|
||||||
However, values retrieved from the column later have lettercase matching the
|
However, values retrieved from the column later have lettercase matching the
|
||||||
values that were used to specify the allowable values at table creation time.
|
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.
|
index, and the value stored is the enumeration member with that index.
|
||||||
(However, this will not work with @code{LOAD DATA}, which treats all
|
(However, this will not work with @code{LOAD DATA}, which treats all
|
||||||
input as strings.)
|
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
|
@code{ENUM} values are sorted according to the order in which the enumeration
|
||||||
members were listed in the column specification. (In other words,
|
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.
|
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
|
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
|
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
|
@code{SET} value in a numeric context, the value retrieved has bits set
|
||||||
@ -31369,6 +31382,17 @@ mysql> SELECT 'David!' LIKE 'David_';
|
|||||||
-> 1
|
-> 1
|
||||||
mysql> SELECT 'David!' LIKE '%D%v%';
|
mysql> SELECT 'David!' LIKE '%D%v%';
|
||||||
-> 1
|
-> 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
|
@end example
|
||||||
|
|
||||||
To test for literal instances of a wildcard character, precede the character
|
To test for literal instances of a wildcard character, precede the character
|
||||||
@ -47065,6 +47089,11 @@ the following things:
|
|||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@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
|
Take down the @code{mysqld} daemon with @code{mysqladmin shutdown}, run
|
||||||
@code{myisamchk --silent --force */*.MYI} on all tables, and restart the
|
@code{myisamchk --silent --force */*.MYI} on all tables, and restart the
|
||||||
@code{mysqld} daemon. This will ensure that you are running from a clean
|
@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
|
@itemize @bullet
|
||||||
@item
|
@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
|
Fixed bug in @code{GROUP BY} with two or more fields, where at least one
|
||||||
field can contain @code{NULL} values.
|
field can contain @code{NULL} values.
|
||||||
@item
|
@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
|
unsigned arithmetic rules when it comes to subtraction. (This will make
|
||||||
MySQL 4.0 behave more closely to 3.23 with @code{UNSIGNED} columns).
|
MySQL 4.0 behave more closely to 3.23 with @code{UNSIGNED} columns).
|
||||||
@item
|
@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
|
The result returned for all bit functions (@code{|}, @code{<<}, ...) is now of
|
||||||
type @code{unsigned integer}.
|
type @code{unsigned integer}.
|
||||||
@item
|
@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.
|
not yet 100% confident in this code.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
|
* News-3.23.52:: Changes in release 3.23.52
|
||||||
* News-3.23.51:: Changes in release 3.23.51
|
* 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.50:: Changes in release 3.23.50 (21 Apr 2002)
|
||||||
* News-3.23.49:: Changes in release 3.23.49
|
* 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)
|
* News-3.23.0:: Changes in release 3.23.0 (Sep 1999: Alpha)
|
||||||
@end menu
|
@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
|
@appendixsubsec Changes in release 3.23.51
|
||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@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.
|
Fixed bug in @code{CONCAT_WS()} that cut the result.
|
||||||
@item
|
@item
|
||||||
Changed name of variables @code{Com_show_master_stat} to
|
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
|
@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.
|
more information if @code{mysqld} crashes.
|
||||||
|
|
||||||
With some older @code{gdb} versions on Linux you must use @code{run
|
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] @@
|
@image{Flags/france} France [Netsample] @@
|
||||||
WWW (@uref{http://www.mysql.netsample.com/})
|
WWW (@uref{http://www.mysql.netsample.com/})
|
||||||
|
|
||||||
@item
|
|
||||||
@image{Flags/france} France [Omegatomic] @@
|
|
||||||
WWW (@uref{http://mysql.omegatomic.com/})
|
|
||||||
|
|
||||||
@item
|
@item
|
||||||
@image{Flags/france} France [Universite Paris 10] @@
|
@image{Flags/france} France [Universite Paris 10] @@
|
||||||
WWW (@uref{http://ftp.u-paris10.fr/mysql.com})
|
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/})
|
WWW (@uref{http://darkstar.ist.utl.pt/mysql/})
|
||||||
FTP (@uref{ftp://darkstar.ist.utl.pt/pub/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
|
@item
|
||||||
@image{Flags/portugal} Portugal [Netvisão] @@
|
@image{Flags/portugal} Portugal [Netvisão] @@
|
||||||
WWW (@uref{http://mysql.netvisao.pt/})
|
WWW (@uref{http://mysql.netvisao.pt/})
|
||||||
FTP (@uref{ftp://mirrors2.netvisao.pt/pub/mysql/})
|
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
|
@item
|
||||||
@image{Flags/romania} Romania [roedu.net/Bucharest] @@
|
@image{Flags/romania} Romania [roedu.net/Bucharest] @@
|
||||||
FTP (@uref{ftp://ftp.roedu.net/pub/mirrors/ftp.mysql.com/})
|
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] @@
|
@image{Flags/usa} USA [adgrafix.com / Boston, MA] @@
|
||||||
WWW (@uref{http://mysql.adgrafix.com/})
|
WWW (@uref{http://mysql.adgrafix.com/})
|
||||||
|
|
||||||
@item
|
|
||||||
@image{Flags/usa} USA [Fast Mirror / Englewood, CO] @@
|
|
||||||
WWW (@uref{http://mysql.fastmirror.com/})
|
|
||||||
|
|
||||||
@item
|
@item
|
||||||
@image{Flags/usa} USA [Hurricane Electric / San Jose, CA] @@
|
@image{Flags/usa} USA [Hurricane Electric / San Jose, CA] @@
|
||||||
WWW (@uref{http://mysql.he.net/})
|
WWW (@uref{http://mysql.he.net/})
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <violite.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 */
|
/* Don't try to make a nice table if the data is too big */
|
||||||
#define MAX_COLUMN_LENGTH 1024
|
#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.",
|
"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},
|
(gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"no-auto-rehash", 'A',
|
{"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},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"batch", 'B',
|
{"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},
|
"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,
|
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
|
||||||
0, 0, 0, 0},
|
0, 0, 0, 0},
|
||||||
{"no-named-commands", 'g',
|
{"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},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"named-commands", 'G',
|
{"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.",
|
"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.",
|
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
|
||||||
(gptr*) &line_numbers, (gptr*) &line_numbers, 0, GET_BOOL,
|
(gptr*) &line_numbers, (gptr*) &line_numbers, 0, GET_BOOL,
|
||||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
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},
|
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#ifndef __WIN__
|
#ifndef __WIN__
|
||||||
{"no-pager", OPT_NOPAGER,
|
{"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},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#endif
|
#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},
|
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered,
|
{"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered,
|
||||||
(gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
|
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
|
||||||
(gptr*) &column_names, (gptr*) &column_names, 0, GET_BOOL,
|
(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',
|
{"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},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"set-variable", 'O',
|
{"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},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"one-database", 'o',
|
{"one-database", 'o',
|
||||||
"Only update the default database. This is useful for skipping updates to other database in the update log.",
|
"Only update the default database. This is useful for skipping updates to other database in the update log.",
|
||||||
@ -617,21 +617,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
if (opt_outfile)
|
if (opt_outfile)
|
||||||
end_tee();
|
end_tee();
|
||||||
opt_outfile= 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!opt_outfile)
|
if (!opt_outfile)
|
||||||
{
|
{
|
||||||
strmov(outfile, argument);
|
strmov(outfile, argument);
|
||||||
opt_outfile= 1;
|
|
||||||
init_tee();
|
init_tee();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_NOTEE:
|
case OPT_NOTEE:
|
||||||
printf("WARNING: option depricated; use --disable-tee instead.\n");
|
printf("WARNING: option deprecated; use --disable-tee instead.\n");
|
||||||
if (opt_outfile)
|
if (opt_outfile)
|
||||||
end_tee();
|
end_tee();
|
||||||
opt_outfile= 0;
|
|
||||||
break;
|
break;
|
||||||
case OPT_PAGER:
|
case OPT_PAGER:
|
||||||
opt_nopager= 0;
|
opt_nopager= 0;
|
||||||
@ -642,12 +639,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
strmov(default_pager, pager);
|
strmov(default_pager, pager);
|
||||||
break;
|
break;
|
||||||
case OPT_NOPAGER:
|
case OPT_NOPAGER:
|
||||||
printf("WARNING: option depricated; use --disable-pager instead.\n");
|
printf("WARNING: option deprecated; use --disable-pager instead.\n");
|
||||||
opt_nopager= 1;
|
opt_nopager= 1;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
rehash= 0;
|
rehash= 0;
|
||||||
break;
|
break;
|
||||||
|
case 'N':
|
||||||
|
column_names= 0;
|
||||||
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
status.batch= 1;
|
status.batch= 1;
|
||||||
status.add_to_history= 0;
|
status.add_to_history= 0;
|
||||||
@ -739,11 +739,7 @@ static int get_options(int argc, char **argv)
|
|||||||
strmov(default_pager, pager);
|
strmov(default_pager, pager);
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status.batch) /* disable pager and outfile in this case */
|
if (status.batch) /* disable pager and outfile in this case */
|
||||||
{
|
{
|
||||||
@ -1514,17 +1510,22 @@ static void end_pager()
|
|||||||
|
|
||||||
static void init_tee()
|
static void init_tee()
|
||||||
{
|
{
|
||||||
|
if (opt_outfile)
|
||||||
|
end_tee();
|
||||||
if (!(OUTFILE= my_fopen(outfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
|
if (!(OUTFILE= my_fopen(outfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
opt_outfile= 0;
|
opt_outfile= 0;
|
||||||
init_pager();
|
init_pager();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
opt_outfile= 1;
|
||||||
|
tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void end_tee()
|
static void end_tee()
|
||||||
{
|
{
|
||||||
my_fclose(OUTFILE, MYF(0));
|
my_fclose(OUTFILE, MYF(0));
|
||||||
|
opt_outfile= 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1610,7 +1611,8 @@ print_table_data(MYSQL_RES *result)
|
|||||||
uint length= field->max_length;
|
uint length= field->max_length;
|
||||||
if (length > MAX_COLUMN_LENGTH)
|
if (length > MAX_COLUMN_LENGTH)
|
||||||
{
|
{
|
||||||
tee_fputs(str,PAGER); tee_fputs(" |",PAGER);
|
tee_fputs(str, PAGER);
|
||||||
|
tee_fputs(" |", PAGER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
|
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
|
||||||
@ -1830,7 +1832,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
|
|||||||
{
|
{
|
||||||
if (!strlen(outfile))
|
if (!strlen(outfile))
|
||||||
{
|
{
|
||||||
printf("No previous outfile available, you must give the filename!\n");
|
printf("No previous outfile available, you must give a filename!\n");
|
||||||
opt_outfile= 0;
|
opt_outfile= 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1850,12 +1852,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
|
|||||||
printf("No outfile specified!\n");
|
printf("No outfile specified!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!opt_outfile)
|
|
||||||
{
|
|
||||||
init_tee();
|
init_tee();
|
||||||
opt_outfile=1;
|
|
||||||
}
|
|
||||||
tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1865,7 +1862,6 @@ com_notee(String *buffer __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
if (opt_outfile)
|
if (opt_outfile)
|
||||||
end_tee();
|
end_tee();
|
||||||
opt_outfile=0;
|
|
||||||
tee_fprintf(stdout, "Outfile disabled.\n");
|
tee_fprintf(stdout, "Outfile disabled.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2288,11 +2284,11 @@ com_status(String *buffer __attribute__((unused)),
|
|||||||
}
|
}
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
if (mysql.net.vio->ssl_ && SSL_get_cipher(mysql.net.vio->ssl_))
|
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_));
|
SSL_get_cipher(mysql.net.vio->ssl_));
|
||||||
else
|
else
|
||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
tee_puts("SSL is not in use\n", stdout);
|
tee_puts("SSL:\t\t\tNot in use", stdout);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <my_pthread.h> /* because of signal() */
|
#include <my_pthread.h> /* because of signal() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ADMIN_VERSION "8.34"
|
#define ADMIN_VERSION "8.35"
|
||||||
#define MAX_MYSQL_VAR 64
|
#define MAX_MYSQL_VAR 64
|
||||||
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
|
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
|
||||||
#define MAX_TRUNC_LENGTH 3
|
#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,
|
(gptr*) &opt_relative, (gptr*) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
|
||||||
0, 0, 0},
|
0, 0, 0},
|
||||||
{"set-variable", 'O',
|
{"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},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"silent", 's', "Silently exit if one can't connect to server",
|
{"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},
|
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()
|
free_defaults()
|
||||||
*/
|
*/
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
|
@ -124,7 +124,7 @@ static void die(const char* fmt, ...)
|
|||||||
|
|
||||||
static void print_version()
|
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;
|
result_file = stdout;
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
|
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
|
||||||
|
|
||||||
#define CHECK_VERSION "2.3"
|
#define CHECK_VERSION "2.4"
|
||||||
|
|
||||||
#include "client_priv.h"
|
#include "client_priv.h"
|
||||||
#include <m_ctype.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);
|
load_defaults("my", load_default_groups, argc, argv);
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!what_to_do)
|
if (!what_to_do)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
** and adapted to mysqldump 05/11/01 by Jani Tolonen
|
** 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_global.h>
|
||||||
#include <my_sys.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,
|
{"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"set-variable", 'O',
|
{"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},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"opt", OPT_OPTIMIZE,
|
{"opt", OPT_OPTIMIZE,
|
||||||
"Same as --add-drop-table --add-locks --all --quick --extended-insert --lock-tables --disable-keys",
|
"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);
|
load_defaults("my",load_default_groups,argc,argv);
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_delayed)
|
if (opt_delayed)
|
||||||
opt_lock=0; /* Can't have lock with 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 "client_priv.h"
|
||||||
#include "mysql_version.h"
|
#include "mysql_version.h"
|
||||||
@ -204,11 +204,8 @@ static int get_options(int *argc, char ***argv)
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (enclosed && opt_enclosed)
|
if (enclosed && opt_enclosed)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n");
|
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
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
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 <my_global.h>
|
||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
@ -86,9 +86,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case 'V':
|
case 'V':
|
||||||
print_version();
|
print_version();
|
||||||
exit(0);
|
exit(0);
|
||||||
default:
|
|
||||||
usage();
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -99,11 +96,8 @@ int parse_args(int argc, char** argv)
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
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 <my_global.h>
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
@ -132,12 +132,10 @@ int parse_args(int argc, char **argv)
|
|||||||
|
|
||||||
load_defaults("my",load_default_groups,&argc,&argv);
|
load_defaults("my",load_default_groups,&argc,&argv);
|
||||||
default_argv= argv;
|
default_argv= argv;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/* Show databases, tables or columns */
|
/* Show databases, tables or columns */
|
||||||
|
|
||||||
#define SHOW_VERSION "9.3"
|
#define SHOW_VERSION "9.4"
|
||||||
|
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "client_priv.h"
|
#include "client_priv.h"
|
||||||
@ -241,11 +241,7 @@ get_options(int *argc,char ***argv)
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tty_password)
|
if (tty_password)
|
||||||
opt_password=get_tty_password(NullS);
|
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 <my_global.h>
|
||||||
#include <mysql_embed.h>
|
#include <mysql_embed.h>
|
||||||
@ -1446,12 +1446,14 @@ int do_connect(struct st_query* q)
|
|||||||
die("Failed on mysql_init()");
|
die("Failed on mysql_init()");
|
||||||
if (opt_compress)
|
if (opt_compress)
|
||||||
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
|
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)
|
if (con_sock && !free_con_sock && *con_sock && *con_sock != FN_LIBCHAR)
|
||||||
con_sock=fn_format(buff, con_sock, TMPDIR, "",0);
|
con_sock=fn_format(buff, con_sock, TMPDIR, "",0);
|
||||||
if (!con_db[0])
|
if (!con_db[0])
|
||||||
con_db=db;
|
con_db=db;
|
||||||
/* Special database to allow one to connect without a database name */
|
/* 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;
|
con_db=0;
|
||||||
if ((con_error = safe_connect(&next_con->mysql, con_host,
|
if ((con_error = safe_connect(&next_con->mysql, con_host,
|
||||||
con_user, con_pass,
|
con_user, con_pass,
|
||||||
@ -1957,11 +1959,7 @@ int parse_args(int argc, char **argv)
|
|||||||
default_argv= argv;
|
default_argv= argv;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
@ -2359,6 +2357,8 @@ int main(int argc, char** argv)
|
|||||||
die("Failed in mysql_init()");
|
die("Failed in mysql_init()");
|
||||||
if (opt_compress)
|
if (opt_compress)
|
||||||
mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
|
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));
|
cur_con->name = my_strdup("default", MYF(MY_WME));
|
||||||
if (!cur_con->name)
|
if (!cur_con->name)
|
||||||
die("Out of memory");
|
die("Out of memory");
|
||||||
@ -2410,9 +2410,11 @@ int main(int argc, char** argv)
|
|||||||
case Q_QUERY:
|
case Q_QUERY:
|
||||||
case Q_REAP:
|
case Q_REAP:
|
||||||
{
|
{
|
||||||
int flags = QUERY_REAP; /* we read the result always regardless
|
/*
|
||||||
* of the mode for both full query and
|
We read the result always regardless of the mode for both full
|
||||||
* read-result only ( reap) */
|
query and read-result only (reap)
|
||||||
|
*/
|
||||||
|
int flags = QUERY_REAP;
|
||||||
if (q->type != Q_REAP) /* for a full query, enable the send stage */
|
if (q->type != Q_REAP) /* for a full query, enable the send stage */
|
||||||
flags |= QUERY_SEND;
|
flags |= QUERY_SEND;
|
||||||
if (q_send_flag)
|
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 */
|
/* fix up query pointer if this is * first iteration for this line */
|
||||||
if (q->query == q->query_buf)
|
if (q->query == q->query_buf)
|
||||||
q->query += q->first_word_len;
|
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
|
run_query() can execute a query partially, depending on the flags
|
||||||
* QUERY_SEND flag without QUERY_REAP tells it to just send the
|
QUERY_SEND flag without QUERY_REAP tells it to just send the
|
||||||
* query and read the result some time later when reap instruction
|
query and read the result some time later when reap instruction
|
||||||
* is given on this connection
|
is given on this connection.
|
||||||
*/
|
*/
|
||||||
|
error |= run_query(&cur_con->mysql, q, QUERY_SEND);
|
||||||
break;
|
break;
|
||||||
case Q_RESULT:
|
case Q_RESULT:
|
||||||
get_file_name(save_file,q);
|
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);
|
load_defaults("my",load_default_groups,&argc,&argv);
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
free_defaults(argv);
|
free_defaults(argv);
|
||||||
if (tty_password)
|
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_LIB(crypt, crypt)
|
||||||
AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_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
|
# For compress in zlib
|
||||||
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
|
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
|
||||||
|
|
||||||
@ -1602,7 +1605,7 @@ then
|
|||||||
fi
|
fi
|
||||||
AC_TRY_COMPILE(
|
AC_TRY_COMPILE(
|
||||||
[#undef inline
|
[#undef inline
|
||||||
#if !defined(SCO) && !defined(__osf__)
|
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
|
||||||
#define _REENTRANT
|
#define _REENTRANT
|
||||||
#endif
|
#endif
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@ -1635,7 +1638,7 @@ then
|
|||||||
fi
|
fi
|
||||||
AC_TRY_COMPILE(
|
AC_TRY_COMPILE(
|
||||||
[#undef inline
|
[#undef inline
|
||||||
#if !defined(SCO) && !defined(__osf__)
|
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
|
||||||
#define _REENTRANT
|
#define _REENTRANT
|
||||||
#endif
|
#endif
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@ -1667,7 +1670,7 @@ then
|
|||||||
fi
|
fi
|
||||||
AC_TRY_COMPILE(
|
AC_TRY_COMPILE(
|
||||||
[#undef inline
|
[#undef inline
|
||||||
#if !defined(SCO) && !defined(__osf__)
|
#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
|
||||||
#define _REENTRANT
|
#define _REENTRANT
|
||||||
#endif
|
#endif
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@ -1693,7 +1696,7 @@ then
|
|||||||
# Check definition of pthread_getspecific
|
# Check definition of pthread_getspecific
|
||||||
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
|
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
|
||||||
AC_TRY_COMPILE(
|
AC_TRY_COMPILE(
|
||||||
[#if !defined(SCO) && !defined(__osf__)
|
[#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
|
||||||
#define _REENTRANT
|
#define _REENTRANT
|
||||||
#endif
|
#endif
|
||||||
#define _POSIX_PTHREAD_SEMANTICS
|
#define _POSIX_PTHREAD_SEMANTICS
|
||||||
|
@ -55,7 +55,7 @@ static struct my_option my_long_options[] =
|
|||||||
|
|
||||||
static void usage(my_bool version)
|
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);
|
MACHINE_TYPE);
|
||||||
if (version)
|
if (version)
|
||||||
return;
|
return;
|
||||||
@ -92,11 +92,8 @@ static int get_options(int *argc,char ***argv)
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (*argc < 1)
|
if (*argc < 1)
|
||||||
{
|
{
|
||||||
usage(0);
|
usage(0);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
/* Install or upgrade MySQL server. By Sasha Pachev <sasha@mysql.com>
|
/* 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
|
#define DONT_USE_RAID
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
@ -219,11 +219,8 @@ static int parse_args(int argc, char **argv)
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/* Return error-text for system error messages and nisam messages */
|
/* 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_global.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
@ -141,11 +141,8 @@ static int get_options(int *argc,char ***argv)
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (!*argc && !print_all_codes)
|
if (!*argc && !print_all_codes)
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#define INIT_SYM_TABLE 4096
|
#define INIT_SYM_TABLE 4096
|
||||||
#define INC_SYM_TABLE 4096
|
#define INC_SYM_TABLE 4096
|
||||||
#define MAX_SYM_SIZE 128
|
#define MAX_SYM_SIZE 128
|
||||||
#define DUMP_VERSION "1.3"
|
#define DUMP_VERSION "1.4"
|
||||||
#define HEX_INVALID (uchar)255
|
#define HEX_INVALID (uchar)255
|
||||||
|
|
||||||
typedef ulong my_long_addr_t ; /* at some point, we need to fix configure
|
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;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
The following code is to make the command compatible with the old
|
The following code is to make the command compatible with the old
|
||||||
version that required one to use the -n and -s options
|
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 */
|
/* 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 <my_global.h>
|
||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
#include <my_net.h>
|
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -30,13 +29,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
#include <my_net.h>
|
||||||
#include <my_getopt.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)
|
#if !defined(_AIX) && !defined(HAVE_UNIXWARE7_THREADS) && !defined(HAVE_UNIXWARE7_POSIX) && !defined(h_errno)
|
||||||
extern int h_errno;
|
extern int h_errno;
|
||||||
#endif
|
#endif
|
||||||
@ -99,11 +94,8 @@ static int get_options(int *argc,char ***argv)
|
|||||||
/* load_defaults("my",load_default_groups,argc,argv); */
|
/* load_defaults("my",load_default_groups,argc,argv); */
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (*argc == 0)
|
if (*argc == 0)
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
|
@ -39,6 +39,7 @@ struct my_option
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern char *disabled_my_option;
|
extern char *disabled_my_option;
|
||||||
|
extern my_bool my_getopt_print_errors;
|
||||||
|
|
||||||
extern int handle_options (int *argc, char ***argv,
|
extern int handle_options (int *argc, char ***argv,
|
||||||
const struct my_option *longopts,
|
const struct my_option *longopts,
|
||||||
|
@ -71,19 +71,22 @@ void my_inet_ntoa(struct in_addr in, char *buf);
|
|||||||
Handling of gethostbyname_r()
|
Handling of gethostbyname_r()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
|
|
||||||
#if !defined(HPUX)
|
#if !defined(HPUX)
|
||||||
struct hostent;
|
struct hostent;
|
||||||
#endif /* HPUX */
|
#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 *my_gethostbyname_r(const char *name,
|
||||||
struct hostent *result, char *buffer,
|
struct hostent *result, char *buffer,
|
||||||
int buflen, int *h_errnop);
|
int buflen, int *h_errnop);
|
||||||
#define my_gethostbyname_r_free()
|
#define my_gethostbyname_r_free()
|
||||||
#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
|
#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX)
|
||||||
#define GETHOSTBYNAME_BUFF_SIZE 2048
|
|
||||||
#else
|
|
||||||
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
|
#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)
|
#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
|
||||||
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
|
#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,
|
struct hostent *result, char *buffer,
|
||||||
int buflen, int *h_errnop);
|
int buflen, int *h_errnop);
|
||||||
#define my_gethostbyname_r_free()
|
#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
|
#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(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
|
||||||
#define my_gethostbyname_r_free()
|
#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
|
C_MODE_END
|
||||||
#endif
|
#endif
|
||||||
|
@ -349,7 +349,7 @@ extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
|
|||||||
#undef HAVE_GETHOSTBYADDR_R /* No definition */
|
#undef HAVE_GETHOSTBYADDR_R /* No definition */
|
||||||
#endif
|
#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,
|
extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
|
||||||
pthread_mutex_t *mutex,
|
pthread_mutex_t *mutex,
|
||||||
struct timespec *abstime);
|
struct timespec *abstime);
|
||||||
|
101
include/my_sys.h
101
include/my_sys.h
@ -302,30 +302,38 @@ typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
|
|||||||
|
|
||||||
typedef struct st_io_cache /* Used when cacheing files */
|
typedef struct st_io_cache /* Used when cacheing files */
|
||||||
{
|
{
|
||||||
/* pos_in_file is offset in file corresponding to the first byte of
|
/* Offset in file corresponding to the first byte of byte* buffer. */
|
||||||
byte* buffer. end_of_file is the offset of end of file for READ_CACHE
|
my_off_t pos_in_file;
|
||||||
and WRITE_CACHE. For SEQ_READ_APPEND it the maximum of the actual
|
/*
|
||||||
end of file and the position represented by read_end.
|
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;
|
my_off_t end_of_file;
|
||||||
/* read_pos points to current read position in the buffer
|
/* Points to current read position in the buffer */
|
||||||
read_end is the non-inclusive boundary in the buffer for the currently
|
byte *read_pos;
|
||||||
valid read area
|
/* the non-inclusive boundary in the buffer for the currently valid read */
|
||||||
buffer is the read buffer
|
byte *read_end;
|
||||||
not sure about request_pos except that it is used in async_io
|
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;
|
byte *append_read_pos;
|
||||||
/* write_buffer is used only in WRITE caches and in SEQ_READ_APPEND to
|
/* Points to current write position in the write buffer */
|
||||||
buffer writes
|
byte *write_pos;
|
||||||
append_read_pos is only used in SEQ_READ_APPEND, and points to the
|
/* The non-inclusive boundary of the valid write area */
|
||||||
current read position in the write buffer. Note that reads in
|
byte *write_end;
|
||||||
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
|
Current_pos and current_end are convenience variables used by
|
||||||
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
|
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
|
current_pos points to &write_pos, and current_end to &write_end in a
|
||||||
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
|
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
|
||||||
@ -336,24 +344,28 @@ typedef struct st_io_cache /* Used when cacheing files */
|
|||||||
pthread_mutex_t append_buffer_lock;
|
pthread_mutex_t append_buffer_lock;
|
||||||
/* need mutex copying from append buffer to read buffer */
|
/* need mutex copying from append buffer to read buffer */
|
||||||
#endif
|
#endif
|
||||||
/* a caller will use my_b_read() macro to read from the cache
|
/*
|
||||||
|
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
|
if the data is already in cache, it will be simply copied with
|
||||||
memcpy() and internal variables will be accordinging updated with
|
memcpy() and internal variables will be accordinging updated with
|
||||||
no functions invoked. However, if the data is not fully in the cache,
|
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
|
my_b_read() will call read_function to fetch the data. read_function
|
||||||
must never be invoked directly
|
must never be invoked directly.
|
||||||
*/
|
*/
|
||||||
int (*read_function)(struct st_io_cache *,byte *,uint);
|
int (*read_function)(struct st_io_cache *,byte *,uint);
|
||||||
/* same idea as in the case of read_function, except my_b_write() needs to
|
/*
|
||||||
|
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
|
be replaced with my_b_append() for a SEQ_READ_APPEND cache
|
||||||
*/
|
*/
|
||||||
int (*write_function)(struct st_io_cache *,const byte *,uint);
|
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
|
certain operations might not be available and yield unpredicatable
|
||||||
results. Details to be documented later
|
results. Details to be documented later
|
||||||
*/
|
*/
|
||||||
enum cache_type type;
|
enum cache_type type;
|
||||||
/* callbacks when the actual read I/O happens. These were added and
|
/*
|
||||||
|
Callbacks when the actual read I/O happens. These were added and
|
||||||
are currently used for binary logging of LOAD DATA INFILE - when a
|
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
|
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,
|
when IO_CACHE is closed, we create an end event. These functions could,
|
||||||
@ -366,40 +378,30 @@ typedef struct st_io_cache /* Used when cacheing files */
|
|||||||
char *file_name; /* if used with 'open_cached_file' */
|
char *file_name; /* if used with 'open_cached_file' */
|
||||||
char *dir,*prefix;
|
char *dir,*prefix;
|
||||||
File file; /* file descriptor */
|
File file; /* file descriptor */
|
||||||
/* seek_not_done is set by my_b_seek() to inform the upcoming read/write
|
/*
|
||||||
|
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
|
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
|
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
|
"hard" error, and the actual number of I/O-ed bytes if the read/write was
|
||||||
partial
|
partial.
|
||||||
*/
|
*/
|
||||||
int seek_not_done,error;
|
int seek_not_done,error;
|
||||||
/* buffer_length is the size of memory allocated for buffer or write_buffer
|
/* buffer_length is memory size allocated for buffer or write_buffer */
|
||||||
read_length is the same as buffer_length except when we use async io
|
uint buffer_length;
|
||||||
not sure why we need it
|
/* read_length is the same as buffer_length except when we use async io */
|
||||||
*/
|
uint read_length;
|
||||||
uint buffer_length,read_length;
|
|
||||||
myf myflags; /* Flags used to my_read/my_write */
|
myf myflags; /* Flags used to my_read/my_write */
|
||||||
/*
|
/*
|
||||||
alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
|
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
|
Currently READ_NET is the only one that will use a buffer allocated
|
||||||
somewhere else
|
somewhere else
|
||||||
*/
|
*/
|
||||||
my_bool alloced_buffer;
|
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
|
#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;
|
uint inited;
|
||||||
my_off_t aio_read_pos;
|
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_pos+=(Count)),0) : \
|
||||||
(*(info)->write_function)((info),(Buffer),(Count)))
|
(*(info)->write_function)((info),(Buffer),(Count)))
|
||||||
|
|
||||||
|
|
||||||
#define my_b_get(info) \
|
#define my_b_get(info) \
|
||||||
((info)->read_pos != (info)->read_end ?\
|
((info)->read_pos != (info)->read_end ?\
|
||||||
((info)->read_pos++, (int) (uchar) (info)->read_pos[-1]) :\
|
((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 WF_PACK *wf_comp(my_string str);
|
||||||
extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
|
extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
|
||||||
extern void wf_end(struct wild_file_pack *buffer);
|
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 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 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,
|
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_CANT_SYMLINK 25
|
||||||
#define EE_REALPATH 26
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1631,6 +1631,7 @@ srv_init(void)
|
|||||||
for (i = 0; i < OS_THREAD_MAX_N; i++) {
|
for (i = 0; i < OS_THREAD_MAX_N; i++) {
|
||||||
slot = srv_table_get_nth_slot(i);
|
slot = srv_table_get_nth_slot(i);
|
||||||
slot->in_use = FALSE;
|
slot->in_use = FALSE;
|
||||||
|
slot->type=0; /* Avoid purify errors */
|
||||||
slot->event = os_event_create(NULL);
|
slot->event = os_event_create(NULL);
|
||||||
ut_a(slot->event);
|
ut_a(slot->event);
|
||||||
}
|
}
|
||||||
@ -1899,7 +1900,6 @@ srv_conc_exit_innodb(
|
|||||||
trx_t* trx) /* in: transaction object associated with the
|
trx_t* trx) /* in: transaction object associated with the
|
||||||
thread */
|
thread */
|
||||||
{
|
{
|
||||||
srv_conc_slot_t* slot = NULL;
|
|
||||||
|
|
||||||
if (srv_thread_concurrency >= 500) {
|
if (srv_thread_concurrency >= 500) {
|
||||||
|
|
||||||
@ -2514,11 +2514,11 @@ loop:
|
|||||||
can drop tables lazily after there no longer are SELECT
|
can drop tables lazily after there no longer are SELECT
|
||||||
queries to them. */
|
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();
|
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) {
|
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
|
||||||
|
|
||||||
@ -2630,19 +2630,19 @@ background_loop:
|
|||||||
/* In this loop we run background operations when the server
|
/* In this loop we run background operations when the server
|
||||||
is quiet and we also come here about once in 10 seconds */
|
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();
|
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 */
|
/* Flush a few oldest pages to make the checkpoint younger */
|
||||||
|
|
||||||
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10, ut_dulint_max);
|
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 */
|
/* 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)
|
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);
|
MACHINE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,11 +665,7 @@ static void get_options(register int *argc, register char ***argv)
|
|||||||
testflag|=T_WRITE_LOOP;
|
testflag|=T_WRITE_LOOP;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*argc == 0)
|
if (*argc == 0)
|
||||||
{
|
{
|
||||||
|
@ -278,7 +278,7 @@ static struct my_option my_long_options[] =
|
|||||||
|
|
||||||
static void print_version(void)
|
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)
|
static void usage(void)
|
||||||
@ -353,11 +353,8 @@ static void get_options(int *argc, char ***argv)
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
my_progname= argv[0][0];
|
my_progname= argv[0][0];
|
||||||
if (isatty(fileno(stdout)))
|
if (isatty(fileno(stdout)))
|
||||||
write_loop=1;
|
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_sec = (long) timeout;
|
||||||
tv.tv_usec = 0;
|
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)
|
if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0)
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
now_time=time(NULL);
|
now_time=time(NULL);
|
||||||
timeout-= (uint) (now_time - start_time);
|
timeout-= (uint) (now_time - start_time);
|
||||||
if (errno != EINTR || (int) timeout <= 0)
|
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_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
|
||||||
{
|
{
|
||||||
Vio * vio = NULL;
|
DBUG_ENTER("vio_new");
|
||||||
vio = (Vio *) my_malloc (sizeof(*vio),MYF(MY_WME|MY_ZEROFILL));
|
Vio * vio;
|
||||||
if (vio)
|
|
||||||
|
if ((vio= (Vio *) my_malloc(sizeof(*vio),MYF(MY_WME|MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
init_alloc_root(&vio->root, 8192, 8192);
|
init_alloc_root(&vio->root, 8192, 8192);
|
||||||
vio->root.min_malloc = sizeof(char *) + 4;
|
vio->root.min_malloc = sizeof(char *) + 4;
|
||||||
vio->last_packet = &vio->packets;
|
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)
|
void vio_delete(Vio * vio)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("vio_delete");
|
||||||
if (vio)
|
if (vio)
|
||||||
{
|
{
|
||||||
if (vio->type != VIO_CLOSED) vio_close(vio);
|
if (vio->type != VIO_CLOSED)
|
||||||
|
vio_close(vio);
|
||||||
free_root(&vio->root, MYF(0));
|
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)
|
void vio_reset(Vio *vio)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("vio_reset");
|
||||||
free_root(&vio->root, MYF(MY_KEEP_PREALLOC));
|
free_root(&vio->root, MYF(MY_KEEP_PREALLOC));
|
||||||
vio->packets = vio->where_in_packet = vio->end_of_packet = 0;
|
vio->packets = vio->where_in_packet = vio->end_of_packet = 0;
|
||||||
vio->last_packet = &vio->packets;
|
vio->last_packet = &vio->packets;
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vio_errno(Vio *vio __attribute__((unused)))
|
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)
|
int vio_write(Vio * vio, const gptr buf, int size)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("vio_write");
|
||||||
char *packet;
|
char *packet;
|
||||||
if (vio->reading)
|
if (vio->reading)
|
||||||
{
|
{
|
||||||
@ -141,7 +148,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
size= -1;
|
size= -1;
|
||||||
return (size);
|
DBUG_RETURN(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int vio_blocking(Vio * vio, my_bool set_blocking_mode)
|
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;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
} /* get options */
|
} /* get options */
|
||||||
|
|
||||||
|
|
||||||
|
@ -179,11 +179,8 @@ static void get_options(int argc, char *argv[])
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if(!(d_file=argv[optind])) print_error(1,"No d_file");
|
if(!(d_file=argv[optind])) print_error(1,"No d_file");
|
||||||
if(!(df=fopen(d_file,"r")))
|
if(!(df=fopen(d_file,"r")))
|
||||||
print_error(1,"fopen(%s)",d_file);
|
print_error(1,"fopen(%s)",d_file);
|
||||||
|
@ -284,11 +284,7 @@ static void get_options(int argc,char *argv[])
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
} /* get options */
|
} /* get options */
|
||||||
|
|
||||||
|
@ -623,7 +623,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
key_cacheing=1;
|
key_cacheing=1;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
printf("test1 Ver 1.1 \n");
|
printf("test1 Ver 1.2 \n");
|
||||||
exit(0);
|
exit(0);
|
||||||
case '#':
|
case '#':
|
||||||
DEBUGGER_ON;
|
DEBUGGER_ON;
|
||||||
@ -644,11 +644,8 @@ static void get_options(int argc, char *argv[])
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
} /* get options */
|
} /* get options */
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ static struct my_option my_long_options[] =
|
|||||||
|
|
||||||
static void print_version(void)
|
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);
|
MACHINE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,13 +615,15 @@ get_one_option(int optid,
|
|||||||
|
|
||||||
static void get_options(register int *argc,register char ***argv)
|
static void get_options(register int *argc,register char ***argv)
|
||||||
{
|
{
|
||||||
|
int ho_error;
|
||||||
|
|
||||||
load_defaults("my", load_default_groups, argc, argv);
|
load_defaults("my", load_default_groups, argc, argv);
|
||||||
default_argv= *argv;
|
default_argv= *argv;
|
||||||
if (isatty(fileno(stdout)))
|
if (isatty(fileno(stdout)))
|
||||||
check_param.testflag|=T_WRITE_LOOP;
|
check_param.testflag|=T_WRITE_LOOP;
|
||||||
|
|
||||||
if (handle_options(argc, argv, my_long_options, get_one_option))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(1);
|
exit(ho_error);
|
||||||
|
|
||||||
/* If using repair, then update checksum if one uses --update-state */
|
/* If using repair, then update checksum if one uses --update-state */
|
||||||
if ((check_param.testflag & T_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)
|
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)
|
static void usage(void)
|
||||||
@ -347,11 +347,8 @@ static void get_options(int *argc,char ***argv)
|
|||||||
write_loop=1;
|
write_loop=1;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (!*argc)
|
if (!*argc)
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
|
@ -887,13 +887,23 @@ start_slave()
|
|||||||
"gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD
|
"gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD
|
||||||
elif [ x$DO_GDB = x1 ]
|
elif [ x$DO_GDB = x1 ]
|
||||||
then
|
then
|
||||||
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
|
|
||||||
if [ x$MANUAL_GDB = x1 ]
|
if [ x$MANUAL_GDB = x1 ]
|
||||||
then
|
then
|
||||||
|
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
|
||||||
echo "To start gdb for the slave, type in another window:"
|
echo "To start gdb for the slave, type in another window:"
|
||||||
echo "cd $CWD ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
|
echo "cd $CWD ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
|
||||||
wait_for_slave=1500
|
wait_for_slave=1500
|
||||||
else
|
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 \
|
manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
|
||||||
gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
|
gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
|
||||||
fi
|
fi
|
||||||
|
@ -114,3 +114,11 @@ i
|
|||||||
3
|
3
|
||||||
4
|
4
|
||||||
drop table t1;
|
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);
|
select ceiling(5.5),ceiling(-5.5);
|
||||||
ceiling(5.5) ceiling(-5.5)
|
ceiling(5.5) ceiling(-5.5)
|
||||||
6 -5
|
6 -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);
|
||||||
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) truncate(-52.64,1) truncate(-52.64,-1)
|
||||||
52.6 52.64 50 0
|
52.6 52.64 50 0 -52.6 -50
|
||||||
select round(5.5),round(-5.5);
|
select round(5.5),round(-5.5);
|
||||||
round(5.5) round(-5.5)
|
round(5.5) round(-5.5)
|
||||||
6 -6
|
6 -6
|
||||||
|
@ -393,3 +393,26 @@ One Two sum(Four)
|
|||||||
1 2 16
|
1 2 16
|
||||||
1 3 16
|
1 3 16
|
||||||
drop table if exists t1;
|
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(*)
|
count(*)
|
||||||
0
|
0
|
||||||
drop table t1,t2,t3;
|
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
|
429002
|
||||||
429003
|
429003
|
||||||
drop table t1;
|
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);
|
alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop table 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 floor(5.5),floor(-5.5);
|
||||||
select ceiling(5.5),ceiling(-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.5),round(-5.5);
|
||||||
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
|
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);
|
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);
|
insert into t1 values (1,3,4,4);
|
||||||
select One, Two, sum(Four) from t1 group by One,Two;
|
select One, Two, sum(Four) from t1 group by One,Two;
|
||||||
drop table if exists t1;
|
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;
|
select count(*) from t3 where id3;
|
||||||
|
|
||||||
drop table t1,t2,t3;
|
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));
|
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 (0.0),("-0.0"),(+0.0),(01.0),(+01.0),(-01.0);
|
||||||
insert into t1 values (-.1),(+.1),(.1);
|
insert into t1 values (-.1),(+.1),(.1);
|
||||||
insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
|
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 \
|
my_error.c errors.c my_div.c my_messnc.c \
|
||||||
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
|
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
|
||||||
my_symlink.c my_symlink2.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_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \
|
||||||
mf_qsort.c mf_qsort2.c mf_sort.c \
|
mf_qsort.c mf_qsort2.c mf_sort.c \
|
||||||
ptr_cmp.c mf_radix.c queues.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_chsize.c my_lread.c my_lwrite.c my_clock.c \
|
||||||
my_quick.c my_lockmem.c my_static.c \
|
my_quick.c my_lockmem.c my_static.c \
|
||||||
my_getopt.c getvar.c my_mkdir.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_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \
|
||||||
my_gethostbyname.c
|
my_gethostbyname.c
|
||||||
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.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->pos_in_file= seek_offset;
|
||||||
info->pre_close = info->pre_read = info->post_read = 0;
|
info->pre_close = info->pre_read = info->post_read = 0;
|
||||||
info->arg = 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->alloced_buffer = 0;
|
||||||
info->buffer=0;
|
info->buffer=0;
|
||||||
info->seek_not_done= test(file >= 0);
|
info->seek_not_done= test(file >= 0);
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#include "mysys_priv.h"
|
#include "mysys_priv.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
stripp_sp(my_string str)
|
strip_sp(my_string str)
|
||||||
Strips end-space from string and returns new length.
|
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;
|
reg2 my_string found;
|
||||||
reg3 my_string start;
|
reg3 my_string start;
|
||||||
@ -43,4 +43,4 @@ size_s stripp_sp(register my_string str)
|
|||||||
}
|
}
|
||||||
*found= '\0'; /* Stripp at first space */
|
*found= '\0'; /* Stripp at first space */
|
||||||
return (size_s) (found-start);
|
return (size_s) (found-start);
|
||||||
} /* stripp_sp */
|
} /* strip_sp */
|
@ -18,21 +18,18 @@
|
|||||||
/* Thread safe version of gethostbyname_r() */
|
/* Thread safe version of gethostbyname_r() */
|
||||||
|
|
||||||
#include "mysys_priv.h"
|
#include "mysys_priv.h"
|
||||||
|
#ifdef THREAD
|
||||||
#include "my_pthread.h"
|
#include "my_pthread.h"
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <my_net.h>
|
|
||||||
#if !defined(MSDOS) && !defined(__WIN__)
|
#if !defined(MSDOS) && !defined(__WIN__)
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <my_net.h>
|
||||||
|
|
||||||
/* This file is not needed if my_gethostbyname_r is a macro */
|
/* This file is not needed if my_gethostbyname_r is a macro */
|
||||||
#if !defined(my_gethostbyname_r)
|
#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
|
Emulate SOLARIS style calls, not because it's better, but just to make the
|
||||||
usage of getbostbyname_r simpler.
|
usage of getbostbyname_r simpler.
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <my_getopt.h>
|
#include <my_getopt.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
|
#include <mysys_err.h>
|
||||||
|
|
||||||
static int findopt (char *optpat, uint length,
|
static int findopt (char *optpat, uint length,
|
||||||
const struct my_option **opt_res,
|
const struct my_option **opt_res,
|
||||||
@ -42,17 +43,11 @@ static const char *special_opt_prefix[]=
|
|||||||
|
|
||||||
char *disabled_my_option= (char*) "0";
|
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
|
my_bool my_getopt_print_errors= 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
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -73,7 +68,7 @@ int handle_options(int *argc, char ***argv,
|
|||||||
{
|
{
|
||||||
uint opt_found, argvpos= 0, length, spec_len, i;
|
uint opt_found, argvpos= 0, length, spec_len, i;
|
||||||
my_bool end_of_options= 0, must_be_var, set_maximum_value, special_used,
|
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;
|
char *progname= *(*argv), **pos, *optend, *prev_found;
|
||||||
const struct my_option *optp;
|
const struct my_option *optp;
|
||||||
int error;
|
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 */
|
if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */
|
||||||
{
|
{
|
||||||
char *argument= 0;
|
char *argument= 0;
|
||||||
|
option_used= 1;
|
||||||
must_be_var= 0;
|
must_be_var= 0;
|
||||||
set_maximum_value= 0;
|
set_maximum_value= 0;
|
||||||
special_used= 0;
|
special_used= 0;
|
||||||
@ -106,9 +102,10 @@ int handle_options(int *argc, char ***argv,
|
|||||||
/* the argument must be in next argv */
|
/* the argument must be in next argv */
|
||||||
if (!*++pos)
|
if (!*++pos)
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr, "%s: Option '-O' requires an argument\n",
|
fprintf(stderr, "%s: Option '-O' requires an argument\n",
|
||||||
progname);
|
progname);
|
||||||
return ERR_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
}
|
}
|
||||||
cur_arg= *pos;
|
cur_arg= *pos;
|
||||||
(*argc)--;
|
(*argc)--;
|
||||||
@ -128,10 +125,11 @@ int handle_options(int *argc, char ***argv,
|
|||||||
cur_arg+= 14;
|
cur_arg+= 14;
|
||||||
if (!*cur_arg)
|
if (!*cur_arg)
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: Option '--set-variable' requires an argument\n",
|
"%s: Option '--set-variable' requires an argument\n",
|
||||||
progname);
|
progname);
|
||||||
return ERR_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cur_arg[14]) /* garbage, or another option. break out */
|
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 */
|
/* the argument must be in next argv */
|
||||||
if (!*++pos)
|
if (!*++pos)
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: Option '--set-variable' requires an argument\n",
|
"%s: Option '--set-variable' requires an argument\n",
|
||||||
progname);
|
progname);
|
||||||
return ERR_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
}
|
}
|
||||||
cur_arg= *pos;
|
cur_arg= *pos;
|
||||||
(*argc)--;
|
(*argc)--;
|
||||||
@ -200,11 +199,12 @@ int handle_options(int *argc, char ***argv,
|
|||||||
{
|
{
|
||||||
if (opt_found > 1)
|
if (opt_found > 1)
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
|
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
|
||||||
progname, special_opt_prefix[i], cur_arg,
|
progname, special_opt_prefix[i], cur_arg,
|
||||||
special_opt_prefix[i], prev_found);
|
special_opt_prefix[i], prev_found);
|
||||||
return ERR_AMBIGUOUS_OPTION;
|
return EXIT_AMBIGUOUS_OPTION;
|
||||||
}
|
}
|
||||||
if (i < DISABLE_OPTION_COUNT)
|
if (i < DISABLE_OPTION_COUNT)
|
||||||
optend= disabled_my_option;
|
optend= disabled_my_option;
|
||||||
@ -224,19 +224,21 @@ int handle_options(int *argc, char ***argv,
|
|||||||
{
|
{
|
||||||
if (must_be_var)
|
if (must_be_var)
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: %s: unknown variable '%s'\n", progname,
|
"%s: %s: unknown variable '%s'\n", progname,
|
||||||
option_is_loose ? "WARNING" : "ERROR", cur_arg);
|
option_is_loose ? "WARNING" : "ERROR", cur_arg);
|
||||||
if (!option_is_loose)
|
if (!option_is_loose)
|
||||||
return ERR_UNKNOWN_VARIABLE;
|
return EXIT_UNKNOWN_VARIABLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: %s: unknown option '--%s'\n", progname,
|
"%s: %s: unknown option '--%s'\n", progname,
|
||||||
option_is_loose ? "WARNING" : "ERROR", cur_arg);
|
option_is_loose ? "WARNING" : "ERROR", cur_arg);
|
||||||
if (!option_is_loose)
|
if (!option_is_loose)
|
||||||
return ERR_UNKNOWN_OPTION;
|
return EXIT_UNKNOWN_OPTION;
|
||||||
}
|
}
|
||||||
if (option_is_loose)
|
if (option_is_loose)
|
||||||
{
|
{
|
||||||
@ -249,30 +251,34 @@ int handle_options(int *argc, char ***argv,
|
|||||||
{
|
{
|
||||||
if (must_be_var)
|
if (must_be_var)
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
|
fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
|
||||||
progname, cur_arg);
|
progname, cur_arg);
|
||||||
return ERR_VAR_PREFIX_NOT_UNIQUE;
|
return EXIT_VAR_PREFIX_NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
|
fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
|
||||||
progname, cur_arg, prev_found, optp->name);
|
progname, cur_arg, prev_found, optp->name);
|
||||||
return ERR_AMBIGUOUS_OPTION;
|
return EXIT_AMBIGUOUS_OPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (must_be_var && (!optp->value || optp->var_type == GET_BOOL))
|
if (must_be_var && (!optp->value || optp->var_type == GET_BOOL))
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr, "%s: option '%s' cannot take an argument\n",
|
fprintf(stderr, "%s: option '%s' cannot take an argument\n",
|
||||||
progname, optp->name);
|
progname, optp->name);
|
||||||
return ERR_NO_ARGUMENT_ALLOWED;
|
return EXIT_NO_ARGUMENT_ALLOWED;
|
||||||
}
|
}
|
||||||
if (optp->arg_type == NO_ARG)
|
if (optp->arg_type == NO_ARG)
|
||||||
{
|
{
|
||||||
if (optend && !special_used)
|
if (optend && !special_used)
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
|
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
|
||||||
progname, optp->name);
|
progname, optp->name);
|
||||||
return ERR_NO_ARGUMENT_ALLOWED;
|
return EXIT_NO_ARGUMENT_ALLOWED;
|
||||||
}
|
}
|
||||||
if (optp->var_type == GET_BOOL)
|
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 */
|
/* Check if there are more arguments after this one */
|
||||||
if (!*++pos)
|
if (!*++pos)
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr, "%s: option '--%s' requires an argument\n",
|
fprintf(stderr, "%s: option '--%s' requires an argument\n",
|
||||||
progname, optp->name);
|
progname, optp->name);
|
||||||
return ERR_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
}
|
}
|
||||||
argument= *pos;
|
argument= *pos;
|
||||||
(*argc)--;
|
(*argc)--;
|
||||||
@ -318,8 +325,9 @@ int handle_options(int *argc, char ***argv,
|
|||||||
}
|
}
|
||||||
else /* must be short option */
|
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++)
|
for (optp= longopts; optp->id; optp++)
|
||||||
{
|
{
|
||||||
if (optp->id == (int) (uchar) *optend)
|
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)
|
if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG)
|
||||||
{
|
{
|
||||||
*((my_bool*) optp->value)= (my_bool) 1;
|
*((my_bool*) optp->value)= (my_bool) 1;
|
||||||
(*argc)--;
|
|
||||||
continue; // For GET_BOOL get_one_option() shouldn't be called
|
continue; // For GET_BOOL get_one_option() shouldn't be called
|
||||||
}
|
}
|
||||||
else if (optp->arg_type == REQUIRED_ARG ||
|
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 */
|
/* Check if there are more arguments after this one */
|
||||||
if (!*++pos)
|
if (!*++pos)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: option '-%c' requires an argument\n",
|
if (my_getopt_print_errors)
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: option '-%c' requires an argument\n",
|
||||||
progname, optp->id);
|
progname, optp->id);
|
||||||
return ERR_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
}
|
}
|
||||||
argument= *pos;
|
argument= *pos;
|
||||||
(*argc)--;
|
(*argc)--;
|
||||||
@ -369,9 +378,10 @@ int handle_options(int *argc, char ***argv,
|
|||||||
}
|
}
|
||||||
if (!opt_found)
|
if (!opt_found)
|
||||||
{
|
{
|
||||||
|
if (my_getopt_print_errors)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: unknown option '-%c'\n", progname, *cur_arg);
|
"%s: unknown option '-%c'\n", progname, *optend);
|
||||||
return ERR_UNKNOWN_OPTION;
|
return EXIT_UNKNOWN_OPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(*argc)--; /* option handled (short), decrease argument count */
|
(*argc)--; /* option handled (short), decrease argument count */
|
||||||
@ -391,6 +401,12 @@ int handle_options(int *argc, char ***argv,
|
|||||||
else /* non-option found */
|
else /* non-option found */
|
||||||
(*argv)[argvpos++]= cur_arg;
|
(*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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +428,7 @@ static int setval (const struct my_option *opts, char *argument,
|
|||||||
opts->u_max_value : opts->value;
|
opts->u_max_value : opts->value;
|
||||||
|
|
||||||
if (!result_pos)
|
if (!result_pos)
|
||||||
return ERR_NO_PTR_TO_VARIABLE;
|
return EXIT_NO_PTR_TO_VARIABLE;
|
||||||
|
|
||||||
switch (opts->var_type) {
|
switch (opts->var_type) {
|
||||||
case GET_INT:
|
case GET_INT:
|
||||||
@ -437,13 +453,13 @@ static int setval (const struct my_option *opts, char *argument,
|
|||||||
my_free((*(char**) result_pos),
|
my_free((*(char**) result_pos),
|
||||||
MYF(MY_WME | MY_FAE));
|
MYF(MY_WME | MY_FAE));
|
||||||
if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME))))
|
if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME))))
|
||||||
return ERR_OUT_OF_MEMORY;
|
return EXIT_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
default: /* dummy default to avoid compiler warnings */
|
default: /* dummy default to avoid compiler warnings */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (err)
|
if (err)
|
||||||
return ERR_UNKNOWN_SUFFIX;
|
return EXIT_UNKNOWN_SUFFIX;
|
||||||
}
|
}
|
||||||
return 0;
|
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)
|
#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,
|
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||||
struct timespec *abstime)
|
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)
|
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_LONG_BLOB: return 4+portable_sizeof_char_ptr;
|
||||||
case FIELD_TYPE_SET:
|
case FIELD_TYPE_SET:
|
||||||
case FIELD_TYPE_ENUM: abort(); return 0; // This shouldn't happen
|
case FIELD_TYPE_ENUM: abort(); return 0; // This shouldn't happen
|
||||||
|
default: return 0;
|
||||||
}
|
}
|
||||||
return 0; // This shouldn't happen
|
return 0; // This shouldn't happen
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ void print_arrays()
|
|||||||
|
|
||||||
static void usage(int version)
|
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);
|
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
|
||||||
if (version)
|
if (version)
|
||||||
return;
|
return;
|
||||||
@ -394,11 +394,8 @@ static int get_options(int argc, char **argv)
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (argc >= 1)
|
if (argc >= 1)
|
||||||
{
|
{
|
||||||
usage(0);
|
usage(0);
|
||||||
|
@ -655,6 +655,7 @@ innobase_close_connection(
|
|||||||
(thd->transaction.all.innobase_tid));
|
(thd->transaction.all.innobase_tid));
|
||||||
trx_free_for_mysql((trx_t*)
|
trx_free_for_mysql((trx_t*)
|
||||||
(thd->transaction.all.innobase_tid));
|
(thd->transaction.all.innobase_tid));
|
||||||
|
thd->transaction.all.innobase_tid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
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!");
|
sql_print_error("Error: Got error during commit; Binlog is not up to date!");
|
||||||
thd->tx_isolation=thd->session_tx_isolation;
|
thd->tx_isolation=thd->session_tx_isolation;
|
||||||
if (operation_done)
|
if (operation_done)
|
||||||
|
{
|
||||||
statistic_increment(ha_commit_count,&LOCK_status);
|
statistic_increment(ha_commit_count,&LOCK_status);
|
||||||
|
thd->transaction.cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // using transactions
|
#endif // using transactions
|
||||||
DBUG_RETURN(error);
|
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->transaction.trans_log.end_of_file= max_binlog_cache_size;
|
||||||
thd->tx_isolation=thd->session_tx_isolation;
|
thd->tx_isolation=thd->session_tx_isolation;
|
||||||
if (operation_done)
|
if (operation_done)
|
||||||
|
{
|
||||||
statistic_increment(ha_rollback_count,&LOCK_status);
|
statistic_increment(ha_rollback_count,&LOCK_status);
|
||||||
|
thd->transaction.cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* USING_TRANSACTIONS */
|
#endif /* USING_TRANSACTIONS */
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
@ -57,8 +57,11 @@ void hostname_cache_refresh()
|
|||||||
|
|
||||||
bool hostname_cache_init()
|
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);
|
(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,
|
sizeof(struct in_addr),NULL,
|
||||||
(void (*)(void*)) free)))
|
(void (*)(void*)) free)))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1304,13 +1304,14 @@ bool Item_func_like::fix_fields(THD *thd,struct st_table_list *tlist)
|
|||||||
{
|
{
|
||||||
pattern = first + 1;
|
pattern = first + 1;
|
||||||
pattern_len = len - 2;
|
pattern_len = len - 2;
|
||||||
DBUG_PRINT("TurboBM", ("Initializing pattern: '%s'...", first));
|
DBUG_PRINT("info", ("Initializing pattern: '%s'", first));
|
||||||
int* suff = (int*)thd->alloc(sizeof(int[pattern_len + 1]));
|
int *suff = (int*) thd->alloc(sizeof(int)*((pattern_len + 1)*2+
|
||||||
bmGs = (int*)thd->alloc(sizeof(int[pattern_len + 1]));
|
alphabet_size));
|
||||||
bmBc = (int*)thd->alloc(sizeof(int[alphabet_size]));
|
bmGs = suff + pattern_len + 1;
|
||||||
|
bmBc = bmGs + pattern_len + 1;
|
||||||
turboBM_compute_good_suffix_shifts(suff);
|
turboBM_compute_good_suffix_shifts(suff);
|
||||||
turboBM_compute_bad_character_shifts();
|
turboBM_compute_bad_character_shifts();
|
||||||
DBUG_PRINT("turboBM",("done"));
|
DBUG_PRINT("info",("done"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -495,16 +495,10 @@ class Item_func_like :public Item_bool_func2
|
|||||||
enum { alphabet_size = 256 };
|
enum { alphabet_size = 256 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Item_func_like::Item_func_like(Item *a,Item *b, char* escape_arg) :
|
Item_func_like(Item *a,Item *b, char* escape_arg)
|
||||||
Item_bool_func2(a,b),
|
:Item_bool_func2(a,b), escape(*escape_arg), canDoTurboBM(false),
|
||||||
escape(*escape_arg),
|
pattern(0), pattern_len(0), bmGs(0), bmBc(0)
|
||||||
canDoTurboBM(false),
|
|
||||||
pattern(0),
|
|
||||||
pattern_len(0),
|
|
||||||
bmGs(0),
|
|
||||||
bmBc(0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
longlong val_int();
|
longlong val_int();
|
||||||
enum Functype functype() const { return LIKE_FUNC; }
|
enum Functype functype() const { return LIKE_FUNC; }
|
||||||
optimize_type select_optimize() const;
|
optimize_type select_optimize() const;
|
||||||
|
@ -627,7 +627,12 @@ double Item_func_round::val()
|
|||||||
log_10[abs_dec] : pow(10.0,(double) abs_dec));
|
log_10[abs_dec] : pow(10.0,(double) abs_dec));
|
||||||
|
|
||||||
if (truncate)
|
if (truncate)
|
||||||
|
{
|
||||||
|
if (value >= 0)
|
||||||
return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
|
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;
|
return dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
67
sql/log.cc
67
sql/log.cc
@ -80,10 +80,10 @@ static int find_uniq_filename(char *name)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0),index_file(-1),
|
MYSQL_LOG::MYSQL_LOG()
|
||||||
name(0), log_type(LOG_CLOSED),write_error(0),
|
:bytes_written(0), last_time(0), query_start(0), index_file(-1), name(0),
|
||||||
inited(0), file_id(1),no_rotate(0),
|
file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0), inited(0),
|
||||||
need_start_event(1),bytes_written(0)
|
no_rotate(0), need_start_event(1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
We don't want to intialize LOCK_Log here as the thread system may
|
We don't want to intialize LOCK_Log here as the thread system may
|
||||||
@ -173,6 +173,8 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
|
|||||||
File file= -1;
|
File file= -1;
|
||||||
bool do_magic;
|
bool do_magic;
|
||||||
int open_flags = O_CREAT | O_APPEND | O_BINARY;
|
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))
|
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);
|
init(log_type_arg,io_cache_type_arg,no_auto_events_arg);
|
||||||
@ -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,
|
do_magic = ((log_type == LOG_BIN) && !my_stat(log_file_name,
|
||||||
&tmp_stat, MYF(0)));
|
&tmp_stat, MYF(0)));
|
||||||
|
|
||||||
|
open_count++;
|
||||||
if ((file=my_open(log_file_name,open_flags,
|
if ((file=my_open(log_file_name,open_flags,
|
||||||
MYF(MY_WME | ME_WAITTANG))) < 0 ||
|
MYF(MY_WME | ME_WAITTANG))) < 0 ||
|
||||||
init_io_cache(&log_file, file, IO_SIZE, io_cache_type,
|
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;
|
bool error;
|
||||||
if (do_magic)
|
if (do_magic)
|
||||||
{
|
{
|
||||||
if (my_b_write(&log_file, (byte*) BINLOG_MAGIC, 4) ||
|
if (my_b_write(&log_file, (byte*) BINLOG_MAGIC, BIN_LOG_HEADER_SIZE) ||
|
||||||
open_index(O_APPEND | O_RDWR | O_CREAT))
|
open_index(O_APPEND | O_RDWR | O_CREAT))
|
||||||
goto err;
|
goto err;
|
||||||
bytes_written += 4;
|
bytes_written += BIN_LOG_HEADER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_start_event && !no_auto_events)
|
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;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
DBUG_VOID_RETURN;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
sql_print_error("Could not use %s for logging (error %d)", log_name,errno);
|
sql_print_error("Could not use %s for logging (error %d)", log_name,errno);
|
||||||
@ -271,7 +274,7 @@ err:
|
|||||||
end_io_cache(&log_file);
|
end_io_cache(&log_file);
|
||||||
x_free(name); name=0;
|
x_free(name); name=0;
|
||||||
log_type=LOG_CLOSED;
|
log_type=LOG_CLOSED;
|
||||||
return;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
|
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
|
// if log_name is "" we stop at the first entry
|
||||||
|
|
||||||
int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
|
int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
|
||||||
bool need_mutex)
|
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);
|
uint log_name_len = (uint) strlen(log_name);
|
||||||
IO_CACHE io_cache;
|
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)
|
if (need_mutex)
|
||||||
pthread_mutex_lock(&LOCK_index);
|
pthread_mutex_lock(&LOCK_index);
|
||||||
if (init_io_cache(&io_cache, index_file, IO_SIZE, READ_CACHE, (my_off_t) 0,
|
if (init_io_cache(&io_cache, index_file, IO_SIZE, READ_CACHE, (my_off_t) 0,
|
||||||
@ -336,9 +342,12 @@ err:
|
|||||||
|
|
||||||
int MYSQL_LOG::find_next_log(LOG_INFO* linfo, bool need_lock)
|
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
|
Mutex needed because we need to make sure the file pointer does not move
|
||||||
if (index_file < 0) return LOG_INFO_INVALID;
|
from under our feet
|
||||||
|
*/
|
||||||
|
if (index_file < 0)
|
||||||
|
return LOG_INFO_INVALID;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
char* fname = linfo->log_file_name;
|
char* fname = linfo->log_file_name;
|
||||||
IO_CACHE io_cache;
|
IO_CACHE io_cache;
|
||||||
@ -490,7 +499,7 @@ err:
|
|||||||
rli->linfo.log_file_name);
|
rli->linfo.log_file_name);
|
||||||
goto err2;
|
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,
|
strnmov(rli->relay_log_name,rli->linfo.log_file_name,
|
||||||
sizeof(rli->relay_log_name));
|
sizeof(rli->relay_log_name));
|
||||||
flush_relay_log_info(rli);
|
flush_relay_log_info(rli);
|
||||||
@ -993,8 +1002,13 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
|
|||||||
|
|
||||||
if (is_open())
|
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;
|
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))
|
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
|
||||||
{
|
{
|
||||||
sql_print_error(ER(ER_ERROR_ON_WRITE), cache->file_name, errno);
|
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);
|
length=my_b_bytes_in_cache(cache);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
/* Write data to the binary log file */
|
||||||
if (my_b_write(&log_file, cache->read_pos, length))
|
if (my_b_write(&log_file, cache->read_pos, length))
|
||||||
{
|
{
|
||||||
if (!write_error)
|
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,
|
const char* old_msg = thd->enter_cond(&update_cond, &LOCK_log,
|
||||||
"Slave: waiting for binlog update");
|
"Slave: waiting for binlog update");
|
||||||
pthread_cond_wait(&update_cond, &LOCK_log);
|
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
|
This is not a bug:
|
||||||
// way of doing things, but this is the cleanest way I could think of to
|
We unlock the mutex for the caller, and expect him to lock it and
|
||||||
// solve the race deadlock caused by THD::awake() first acquiring mysys_var
|
then not unlock it upon return. This is a rather odd way of doing
|
||||||
// mutex and then the current mutex, while wait_for_update being called with
|
things, but this is the cleanest way I could think of to solve the
|
||||||
// the current mutex already aquired and THD::exit_cond() trying to acquire
|
race deadlock caused by THD::awake() first acquiring mysys_var
|
||||||
// mysys_var mutex. We do need the mutex to be acquired prior to the
|
mutex and then the current mutex, while wait_for_update being
|
||||||
// invocation of wait_for_update in all cases, so mutex acquisition inside
|
called with the current mutex already aquired and THD::exit_cond()
|
||||||
// wait_for_update() is not an option
|
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);
|
pthread_mutex_unlock(&LOCK_log);
|
||||||
thd->exit_cond(old_msg);
|
thd->exit_cond(old_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MYSQL_LOG::close(bool exiting)
|
void MYSQL_LOG::close(bool exiting)
|
||||||
{ // One can't set log_type here!
|
{ // One can't set log_type here!
|
||||||
if (is_open())
|
if (is_open())
|
||||||
|
@ -162,8 +162,8 @@ static void cleanup_load_tmpdir()
|
|||||||
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;
|
file=dirp->dir_entry+i;
|
||||||
if (!memcmp(file->name,"SQL_LOAD-",9))
|
if (is_prefix(file->name,"SQL_LOAD-"))
|
||||||
my_delete(file->name,MYF(MY_WME));
|
my_delete(file->name,MYF(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
my_dirend(dirp);
|
my_dirend(dirp);
|
||||||
@ -672,7 +672,7 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db)
|
|||||||
if (new_log_ident)
|
if (new_log_ident)
|
||||||
my_fwrite(file, (byte*) new_log_ident, (uint)ident_len,
|
my_fwrite(file, (byte*) new_log_ident, (uint)ident_len,
|
||||||
MYF(MY_NABP | MY_WME));
|
MYF(MY_NABP | MY_WME));
|
||||||
fprintf(file, "pos=%s\n", llstr(pos, buf));
|
fprintf(file, " pos: %s\n", llstr(pos, buf));
|
||||||
fflush(file);
|
fflush(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,8 +701,7 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
|
|||||||
bool old_format):
|
bool old_format):
|
||||||
Log_event(buf, old_format),new_log_ident(NULL),alloced(0)
|
Log_event(buf, old_format),new_log_ident(NULL),alloced(0)
|
||||||
{
|
{
|
||||||
// the caller will ensure that event_len is what we have at
|
// The caller will ensure that event_len is what we have at EVENT_LEN_OFFSET
|
||||||
// EVENT_LEN_OFFSET
|
|
||||||
int header_size = (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
|
int header_size = (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
|
||||||
uint ident_offset;
|
uint ident_offset;
|
||||||
if (event_len < header_size)
|
if (event_len < header_size)
|
||||||
@ -753,8 +752,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Query_log_event::Query_log_event(const char* buf, int event_len,
|
Query_log_event::Query_log_event(const char* buf, int event_len,
|
||||||
bool old_format):
|
bool old_format)
|
||||||
Log_event(buf, old_format),data_buf(0), query(NULL), db(NULL)
|
:Log_event(buf, old_format),data_buf(0), query(NULL), db(NULL)
|
||||||
{
|
{
|
||||||
ulong data_len;
|
ulong data_len;
|
||||||
if (old_format)
|
if (old_format)
|
||||||
@ -961,11 +960,12 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
|
|||||||
if (use_new_format)
|
if (use_new_format)
|
||||||
{
|
{
|
||||||
empty_flags=0;
|
empty_flags=0;
|
||||||
/* the code below assumes that buf will not disappear from
|
/*
|
||||||
|
The code below assumes that buf will not disappear from
|
||||||
under our feet during the lifetime of the event. This assumption
|
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
|
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
|
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
|
to read the actual file before we write out the Create_file event.
|
||||||
*/
|
*/
|
||||||
if (read_str(buf, buf_end, field_term, field_term_len) ||
|
if (read_str(buf, buf_end, field_term, field_term_len) ||
|
||||||
read_str(buf, buf_end, enclosed, enclosed_len) ||
|
read_str(buf, buf_end, enclosed, enclosed_len) ||
|
||||||
@ -1003,12 +1003,10 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
|
|||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
Load_log_event::Load_log_event(THD* thd, sql_exchange* ex,
|
Load_log_event::Load_log_event(THD* thd, sql_exchange* ex,
|
||||||
const char* db_arg, const char* table_name_arg,
|
const char* db_arg, const char* table_name_arg,
|
||||||
List<Item>& fields_arg, enum enum_duplicates handle_dup):
|
List<Item>& fields_arg, enum enum_duplicates handle_dup)
|
||||||
Log_event(thd),thread_id(thd->thread_id),
|
:Log_event(thd),thread_id(thd->thread_id), num_fields(0),fields(0),
|
||||||
num_fields(0),fields(0),field_lens(0),field_block_len(0),
|
field_lens(0),field_block_len(0), table_name(table_name_arg),
|
||||||
table_name(table_name_arg),
|
db(db_arg), fname(ex->file_name)
|
||||||
db(db_arg),
|
|
||||||
fname(ex->file_name)
|
|
||||||
{
|
{
|
||||||
time_t end_time;
|
time_t end_time;
|
||||||
time(&end_time);
|
time(&end_time);
|
||||||
@ -1409,7 +1407,7 @@ void Create_file_log_event::print(FILE* file, bool short_form,
|
|||||||
if (short_form)
|
if (short_form)
|
||||||
return;
|
return;
|
||||||
Load_log_event::print(file, 1, last_db);
|
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
|
#endif
|
||||||
|
|
||||||
@ -1467,7 +1465,7 @@ void Append_block_log_event::print(FILE* file, bool short_form,
|
|||||||
return;
|
return;
|
||||||
print_header(file);
|
print_header(file);
|
||||||
fputc('\n', 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);
|
file_id, block_len);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -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);
|
slave_print_error(rli,0, "File '%s' appears corrupted", fname);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
// we want to disable binary logging in slave thread
|
/*
|
||||||
// because we need the file events to appear in the same order
|
We want to disable binary logging in slave thread because we need the file
|
||||||
// as they do on the master relative to other events, so that we
|
events to appear in the same order as they do on the master relative to
|
||||||
// can preserve ascending order of log sequence numbers - needed
|
other events, so that we can preserve ascending order of log sequence
|
||||||
// to handle failover
|
numbers - needed to handle failover .
|
||||||
|
*/
|
||||||
save_options = thd->options;
|
save_options = thd->options;
|
||||||
thd->options &= ~ (ulong) (OPTION_BIN_LOG);
|
thd->options &= ~ (ulong) (OPTION_BIN_LOG);
|
||||||
lev->thd = thd;
|
lev->thd = thd;
|
||||||
|
@ -2407,7 +2407,7 @@ static void create_new_thread(THD *thd)
|
|||||||
inline void kill_broken_server()
|
inline void kill_broken_server()
|
||||||
{
|
{
|
||||||
/* hack to get around signals ignored in syscalls for problem OS's */
|
/* 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;
|
select_thread_in_use = 0;
|
||||||
kill_server((void*)MYSQL_KILL_SIGNAL); /* never returns */
|
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,
|
{"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},
|
(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,
|
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
|
||||||
"Undocumented: Meant for debugging and testing of replication",
|
"Undocumented: Meant for debugging and testing of replication",
|
||||||
(gptr*) &disconnect_slave_event_count,
|
(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,
|
||||||
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
|
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
|
||||||
0},
|
0},
|
||||||
#endif
|
|
||||||
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
|
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
|
||||||
"Simulate memory shortage when compiled with the --with-debug=full option",
|
"Simulate memory shortage when compiled with the --with-debug=full option",
|
||||||
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
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,
|
{"query_cache_limit", OPT_QUERY_CACHE_LIMIT,
|
||||||
"Don't cache results that are bigger than this.",
|
"Don't cache results that are bigger than this.",
|
||||||
(gptr*) &query_cache_limit, (gptr*) &query_cache_limit, 0, GET_ULONG,
|
(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*/
|
#endif /*HAVE_QUERY_CACHE*/
|
||||||
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
|
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
|
||||||
"The memory allocated to store results from old queries.",
|
"The memory allocated to store results from old queries.",
|
||||||
(gptr*) &query_cache_size, (gptr*) &query_cache_size, 0, GET_ULONG,
|
(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
|
#ifdef HAVE_QUERY_CACHE
|
||||||
{"query_cache_startup_type", OPT_QUERY_CACHE_STARTUP_TYPE,
|
{"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.",
|
"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,
|
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
|
||||||
"Undocumented", (gptr*) &relay_log_space_limit,
|
"Undocumented", (gptr*) &relay_log_space_limit,
|
||||||
(gptr*) &relay_log_space_limit, 0, GET_ULONG, REQUIRED_ARG, 0L, 0L,
|
(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,
|
{"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},
|
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
|
||||||
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
|
{"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.",
|
"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);
|
exit(0);
|
||||||
case 'T':
|
case 'T':
|
||||||
test_flags= argument ? (uint) atoi(argument) : 0;
|
test_flags= argument ? (uint) atoi(argument) : 0;
|
||||||
|
test_flags&= ~TEST_NO_THREADS;
|
||||||
opt_endinfo=1;
|
opt_endinfo=1;
|
||||||
break;
|
break;
|
||||||
case (int) OPT_BIG_TABLES:
|
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;
|
opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
|
||||||
mysql_port=0;
|
mysql_port=0;
|
||||||
break;
|
break;
|
||||||
|
#ifdef ONE_THREAD
|
||||||
case (int) OPT_ONE_THREAD:
|
case (int) OPT_ONE_THREAD:
|
||||||
test_flags |= TEST_NO_THREADS;
|
test_flags |= TEST_NO_THREADS;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case (int) OPT_WANT_CORE:
|
case (int) OPT_WANT_CORE:
|
||||||
test_flags |= TEST_CORE_ON_SIGNAL;
|
test_flags |= TEST_CORE_ON_SIGNAL;
|
||||||
@ -4421,11 +4423,7 @@ static void get_options(int argc,char **argv)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fix_paths();
|
fix_paths();
|
||||||
default_table_type_name=ha_table_typelib.type_names[default_table_type-1];
|
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)
|
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,
|
if (!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
|
||||||
mi->port, 0, 0))
|
mi->port, 0, 0))
|
||||||
{
|
{
|
||||||
@ -667,8 +670,10 @@ int load_master_data(THD* thd)
|
|||||||
int restart_thread_mask;
|
int restart_thread_mask;
|
||||||
mc_mysql_init(&mysql);
|
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_ACTIVE_MI;
|
||||||
lock_slave_threads(active_mi);
|
lock_slave_threads(active_mi);
|
||||||
init_thread_mask(&restart_thread_mask,active_mi,0 /*not inverse*/);
|
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)))
|
if (!(num_dbs = (uint) mc_mysql_num_rows(db_res)))
|
||||||
goto err;
|
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*))))
|
if (!(table_res = (MYSQL_RES**)thd->alloc(num_dbs * sizeof(MYSQL_RES*))))
|
||||||
{
|
{
|
||||||
@ -713,10 +720,12 @@ int load_master_data(THD* thd)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a temporary solution until we have online backup
|
/*
|
||||||
// capabilities - to be replaced once online backup is working
|
This is a temporary solution until we have online backup
|
||||||
// we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
|
capabilities - to be replaced once online backup is working
|
||||||
// can to minimize the lock time
|
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) ||
|
if (mc_mysql_query(&mysql, "FLUSH TABLES WITH READ LOCK", 0) ||
|
||||||
mc_mysql_query(&mysql, "SHOW MASTER STATUS",0) ||
|
mc_mysql_query(&mysql, "SHOW MASTER STATUS",0) ||
|
||||||
!(master_status_res = mc_mysql_store_result(&mysql)))
|
!(master_status_res = mc_mysql_store_result(&mysql)))
|
||||||
@ -726,8 +735,10 @@ int load_master_data(THD* thd)
|
|||||||
goto err;
|
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;
|
table_res_end = table_res + num_dbs;
|
||||||
|
|
||||||
|
421
sql/slave.cc
421
sql/slave.cc
@ -42,18 +42,20 @@ bool do_table_inited = 0, ignore_table_inited = 0;
|
|||||||
bool wild_do_table_inited = 0, wild_ignore_table_inited = 0;
|
bool wild_do_table_inited = 0, wild_ignore_table_inited = 0;
|
||||||
bool table_rules_on = 0;
|
bool table_rules_on = 0;
|
||||||
static TABLE* save_temporary_tables = 0;
|
static TABLE* save_temporary_tables = 0;
|
||||||
ulong relay_log_space_limit = 0; /* TODO: fix variables to access ulonglong
|
/* TODO: fix variables to access ulonglong values and make it ulonglong */
|
||||||
values and make it ulonglong */
|
ulong relay_log_space_limit = 0;
|
||||||
// when slave thread exits, we need to remember the temporary tables so we
|
|
||||||
// can re-use them on slave start
|
/*
|
||||||
|
When slave thread exits, we need to remember the temporary tables so we
|
||||||
|
can re-use them on slave start.
|
||||||
|
|
||||||
|
TODO: move the vars below under MASTER_INFO
|
||||||
|
*/
|
||||||
|
|
||||||
// TODO: move the vars below under MASTER_INFO
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
|
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
|
||||||
static int events_till_disconnect = -1;
|
static int events_till_disconnect = -1;
|
||||||
int events_till_abort = -1;
|
int events_till_abort = -1;
|
||||||
static int stuck_count = 0;
|
static int stuck_count = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE;
|
typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE;
|
||||||
|
|
||||||
@ -85,7 +87,8 @@ void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse)
|
|||||||
bool set_io = mi->slave_running, set_sql = mi->rli.slave_running;
|
bool set_io = mi->slave_running, set_sql = mi->rli.slave_running;
|
||||||
if (inverse)
|
if (inverse)
|
||||||
{
|
{
|
||||||
/* This makes me think of the Russian idiom "I am not I, and this is
|
/*
|
||||||
|
This makes me think of the Russian idiom "I am not I, and this is
|
||||||
not my horse", which is used to deny reponsibility for
|
not my horse", which is used to deny reponsibility for
|
||||||
one's actions.
|
one's actions.
|
||||||
*/
|
*/
|
||||||
@ -166,13 +169,16 @@ static byte* get_table_key(TABLE_RULE_ENT* e, uint* len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: check proper initialization of master_log_name/master_log_pos
|
// TODO: check proper initialization of master_log_name/master_log_pos
|
||||||
|
|
||||||
int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
|
int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
|
||||||
ulonglong pos, bool need_data_lock,
|
ulonglong pos, bool need_data_lock,
|
||||||
const char** errmsg)
|
const char** errmsg)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("init_relay_log_pos");
|
||||||
|
|
||||||
*errmsg=0;
|
*errmsg=0;
|
||||||
if (rli->log_pos_current)
|
if (rli->log_pos_current)
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
pthread_mutex_t *log_lock=rli->relay_log.get_log_lock();
|
pthread_mutex_t *log_lock=rli->relay_log.get_log_lock();
|
||||||
pthread_mutex_lock(log_lock);
|
pthread_mutex_lock(log_lock);
|
||||||
if (need_data_lock)
|
if (need_data_lock)
|
||||||
@ -192,8 +198,10 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
|
|||||||
else
|
else
|
||||||
rli->relay_log_pos = pos;
|
rli->relay_log_pos = pos;
|
||||||
|
|
||||||
// test to see if the previous run was with the skip of purging
|
/*
|
||||||
// if yes, we do not purge when we restart
|
Test to see if the previous run was with the skip of purging
|
||||||
|
If yes, we do not purge when we restart
|
||||||
|
*/
|
||||||
if (rli->relay_log.find_first_log(&rli->linfo,""))
|
if (rli->relay_log.find_first_log(&rli->linfo,""))
|
||||||
{
|
{
|
||||||
*errmsg="Could not find first log during relay log initialization";
|
*errmsg="Could not find first log during relay log initialization";
|
||||||
@ -216,10 +224,8 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
|
|||||||
{
|
{
|
||||||
if (my_b_tell((rli->cur_log=rli->relay_log.get_log_file())) == 0 &&
|
if (my_b_tell((rli->cur_log=rli->relay_log.get_log_file())) == 0 &&
|
||||||
check_binlog_magic(rli->cur_log,errmsg))
|
check_binlog_magic(rli->cur_log,errmsg))
|
||||||
{
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
rli->cur_log_old_open_count=rli->relay_log.get_open_count();
|
||||||
rli->cur_log_init_count=rli->cur_log->init_count;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -229,20 +235,19 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
|
|||||||
my_close(rli->cur_log_fd,MYF(MY_WME));
|
my_close(rli->cur_log_fd,MYF(MY_WME));
|
||||||
if ((rli->cur_log_fd=open_binlog(&rli->cache_buf,
|
if ((rli->cur_log_fd=open_binlog(&rli->cache_buf,
|
||||||
rli->linfo.log_file_name,errmsg)) < 0)
|
rli->linfo.log_file_name,errmsg)) < 0)
|
||||||
{
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
|
||||||
rli->cur_log = &rli->cache_buf;
|
rli->cur_log = &rli->cache_buf;
|
||||||
}
|
}
|
||||||
if (pos > 4)
|
if (pos > BIN_LOG_HEADER_SIZE)
|
||||||
my_b_seek(rli->cur_log,(off_t)pos);
|
my_b_seek(rli->cur_log,(off_t)pos);
|
||||||
rli->log_pos_current=1;
|
rli->log_pos_current=1;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
pthread_cond_broadcast(&rli->data_cond);
|
pthread_cond_broadcast(&rli->data_cond);
|
||||||
if (need_data_lock)
|
if (need_data_lock)
|
||||||
pthread_mutex_unlock(&rli->data_lock);
|
pthread_mutex_unlock(&rli->data_lock);
|
||||||
pthread_mutex_unlock(log_lock);
|
pthread_mutex_unlock(log_lock);
|
||||||
return (*errmsg) ? 1 : 0;
|
DBUG_RETURN ((*errmsg) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called from get_options() in mysqld.cc on start-up */
|
/* called from get_options() in mysqld.cc on start-up */
|
||||||
@ -276,8 +281,9 @@ void init_slave_skip_errors(const char* arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We assume we have a run lock on rli and that the both slave thread
|
We assume we have a run lock on rli and that both slave thread
|
||||||
are not running
|
are not running
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -286,9 +292,11 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, bool just_reset, const char** errmsg)
|
|||||||
DBUG_ENTER("purge_relay_logs");
|
DBUG_ENTER("purge_relay_logs");
|
||||||
if (!rli->inited)
|
if (!rli->inited)
|
||||||
DBUG_RETURN(0); /* successfully do nothing */
|
DBUG_RETURN(0); /* successfully do nothing */
|
||||||
|
int error=0;
|
||||||
|
|
||||||
DBUG_ASSERT(rli->slave_running == 0);
|
DBUG_ASSERT(rli->slave_running == 0);
|
||||||
DBUG_ASSERT(rli->mi->slave_running == 0);
|
DBUG_ASSERT(rli->mi->slave_running == 0);
|
||||||
int error=0;
|
|
||||||
rli->slave_skip_counter=0;
|
rli->slave_skip_counter=0;
|
||||||
pthread_mutex_lock(&rli->data_lock);
|
pthread_mutex_lock(&rli->data_lock);
|
||||||
rli->pending=0;
|
rli->pending=0;
|
||||||
@ -303,17 +311,19 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, bool just_reset, const char** errmsg)
|
|||||||
}
|
}
|
||||||
strnmov(rli->relay_log_name,rli->linfo.log_file_name,
|
strnmov(rli->relay_log_name,rli->linfo.log_file_name,
|
||||||
sizeof(rli->relay_log_name)-1);
|
sizeof(rli->relay_log_name)-1);
|
||||||
rli->log_space_total=4; //just first log with magic number and nothing else
|
// Just first log with magic number and nothing else
|
||||||
rli->relay_log_pos=4;
|
rli->log_space_total= BIN_LOG_HEADER_SIZE;
|
||||||
|
rli->relay_log_pos= BIN_LOG_HEADER_SIZE;
|
||||||
rli->relay_log.reset_bytes_written();
|
rli->relay_log.reset_bytes_written();
|
||||||
rli->log_pos_current=0;
|
rli->log_pos_current=0;
|
||||||
if (!just_reset)
|
if (!just_reset)
|
||||||
error = init_relay_log_pos(rli,0,0,0 /* do not need data lock */,errmsg);
|
error = init_relay_log_pos(rli,0,0,0 /* do not need data lock */,errmsg);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
char buf[22];
|
char buf[22];
|
||||||
#endif
|
#endif
|
||||||
DBUG_PRINT("info",("log_space_total=%s",llstr(rli->log_space_total,buf)));
|
DBUG_PRINT("info",("log_space_total: %s",llstr(rli->log_space_total,buf)));
|
||||||
pthread_mutex_unlock(&rli->data_lock);
|
pthread_mutex_unlock(&rli->data_lock);
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
@ -453,10 +463,12 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock,
|
|||||||
"Waiting for slave thread to start");
|
"Waiting for slave thread to start");
|
||||||
pthread_cond_wait(start_cond,cond_lock);
|
pthread_cond_wait(start_cond,cond_lock);
|
||||||
thd->exit_cond(old_msg);
|
thd->exit_cond(old_msg);
|
||||||
// TODO: in a very rare case of init_slave_thread failing, it is
|
/*
|
||||||
// possible that we can get stuck here since slave_running will not
|
TODO: in a very rare case of init_slave_thread failing, it is
|
||||||
// be set. We need to change slave_running to int and have -1 as
|
possible that we can get stuck here since slave_running will not
|
||||||
// error code
|
be set. We need to change slave_running to int and have -1 as
|
||||||
|
error code.
|
||||||
|
*/
|
||||||
if (thd->killed)
|
if (thd->killed)
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(cond_lock);
|
pthread_mutex_unlock(cond_lock);
|
||||||
@ -468,10 +480,14 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock,
|
|||||||
pthread_mutex_unlock(start_lock);
|
pthread_mutex_unlock(start_lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* SLAVE_FORCE_ALL is not implemented here on purpose since it does not make
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
SLAVE_FORCE_ALL is not implemented here on purpose since it does not make
|
||||||
sense to do that for starting a slave - we always care if it actually
|
sense to do that for starting a slave - we always care if it actually
|
||||||
started the threads that were not previously running
|
started the threads that were not previously running
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
|
int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
|
||||||
MASTER_INFO* mi, const char* master_info_fname,
|
MASTER_INFO* mi, const char* master_info_fname,
|
||||||
const char* slave_info_fname, int thread_mask)
|
const char* slave_info_fname, int thread_mask)
|
||||||
@ -569,9 +585,10 @@ int tables_ok(THD* thd, TABLE_LIST* tables)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no explicit rule found
|
/*
|
||||||
// and there was a do list, do not replicate. If there was
|
If no explicit rule found and there was a do list, do not replicate.
|
||||||
// no do list, go ahead
|
If there was no do list, go ahead
|
||||||
|
*/
|
||||||
return !do_table_inited && !wild_do_table_inited;
|
return !do_table_inited && !wild_do_table_inited;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,9 +646,11 @@ static int end_slave_on_walk(MASTER_INFO* mi, gptr /*unused*/)
|
|||||||
|
|
||||||
void end_slave()
|
void end_slave()
|
||||||
{
|
{
|
||||||
// TODO: replace the line below with
|
/*
|
||||||
// list_walk(&master_list, (list_walk_action)end_slave_on_walk,0);
|
TODO: replace the line below with
|
||||||
// once multi-master code is ready
|
list_walk(&master_list, (list_walk_action)end_slave_on_walk,0);
|
||||||
|
once multi-master code is ready.
|
||||||
|
*/
|
||||||
terminate_slave_threads(active_mi,SLAVE_FORCE_ALL);
|
terminate_slave_threads(active_mi,SLAVE_FORCE_ALL);
|
||||||
end_master_info(active_mi);
|
end_master_info(active_mi);
|
||||||
if (do_table_inited)
|
if (do_table_inited)
|
||||||
@ -679,7 +698,8 @@ void skip_load_data_infile(NET* net)
|
|||||||
|
|
||||||
char* rewrite_db(char* db)
|
char* rewrite_db(char* db)
|
||||||
{
|
{
|
||||||
if(replicate_rewrite_db.is_empty() || !db) return db;
|
if (replicate_rewrite_db.is_empty() || !db)
|
||||||
|
return db;
|
||||||
I_List_iterator<i_string_pair> it(replicate_rewrite_db);
|
I_List_iterator<i_string_pair> it(replicate_rewrite_db);
|
||||||
i_string_pair* tmp;
|
i_string_pair* tmp;
|
||||||
|
|
||||||
@ -688,18 +708,20 @@ char* rewrite_db(char* db)
|
|||||||
if (!strcmp(tmp->key, db))
|
if (!strcmp(tmp->key, db))
|
||||||
return tmp->val;
|
return tmp->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int db_ok(const char* db, I_List<i_string> &do_list,
|
int db_ok(const char* db, I_List<i_string> &do_list,
|
||||||
I_List<i_string> &ignore_list )
|
I_List<i_string> &ignore_list )
|
||||||
{
|
{
|
||||||
if (do_list.is_empty() && ignore_list.is_empty())
|
if (do_list.is_empty() && ignore_list.is_empty())
|
||||||
return 1; // ok to replicate if the user puts no constraints
|
return 1; // ok to replicate if the user puts no constraints
|
||||||
|
|
||||||
// if the user has specified restrictions on which databases to replicate
|
/*
|
||||||
// and db was not selected, do not replicate
|
If the user has specified restrictions on which databases to replicate
|
||||||
|
and db was not selected, do not replicate.
|
||||||
|
*/
|
||||||
if (!db)
|
if (!db)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -731,7 +753,7 @@ int db_ok(const char* db, I_List<i_string> &do_list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
|
static int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
|
||||||
char* default_val)
|
const char *default_val)
|
||||||
{
|
{
|
||||||
uint length;
|
uint length;
|
||||||
if ((length=my_b_gets(f,var, max_size)))
|
if ((length=my_b_gets(f,var, max_size)))
|
||||||
@ -741,8 +763,10 @@ static int init_strvar_from_file(char* var, int max_size, IO_CACHE* f,
|
|||||||
*last_p = 0; // if we stopped on newline, kill it
|
*last_p = 0; // if we stopped on newline, kill it
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if we truncated a line or stopped on last char, remove all chars
|
/*
|
||||||
// up to and including newline
|
If we truncated a line or stopped on last char, remove all chars
|
||||||
|
up to and including newline.
|
||||||
|
*/
|
||||||
int c;
|
int c;
|
||||||
while (((c=my_b_get(f)) != '\n' && c != my_b_EOF));
|
while (((c=my_b_get(f)) != '\n' && c != my_b_EOF));
|
||||||
}
|
}
|
||||||
@ -798,12 +822,12 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (*version)
|
switch (*version) {
|
||||||
{
|
|
||||||
case '3':
|
case '3':
|
||||||
mi->old_format = 1;
|
mi->old_format = 1;
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
|
case '5':
|
||||||
mi->old_format = 0;
|
mi->old_format = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -897,9 +921,11 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
|
|||||||
check_opt.init();
|
check_opt.init();
|
||||||
check_opt.flags|= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK;
|
check_opt.flags|= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK;
|
||||||
thd->proc_info = "Rebuilding the index on master dump table";
|
thd->proc_info = "Rebuilding the index on master dump table";
|
||||||
// we do not want repair() to spam us with messages
|
/*
|
||||||
// just send them to the error log, and report the failure in case of
|
We do not want repair() to spam us with messages
|
||||||
// problems
|
just send them to the error log, and report the failure in case of
|
||||||
|
problems.
|
||||||
|
*/
|
||||||
save_vio = thd->net.vio;
|
save_vio = thd->net.vio;
|
||||||
thd->net.vio = 0;
|
thd->net.vio = 0;
|
||||||
error=file->repair(thd,&check_opt) != 0;
|
error=file->repair(thd,&check_opt) != 0;
|
||||||
@ -980,15 +1006,15 @@ void end_master_info(MASTER_INFO* mi)
|
|||||||
int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
|
int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("init_relay_log_info");
|
DBUG_ENTER("init_relay_log_info");
|
||||||
if (rli->inited)
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
MY_STAT stat_area;
|
MY_STAT stat_area;
|
||||||
char fname[FN_REFLEN+128];
|
char fname[FN_REFLEN+128];
|
||||||
int info_fd;
|
int info_fd;
|
||||||
const char* msg = 0;
|
const char* msg = 0;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
fn_format(fname, info_fname,
|
|
||||||
mysql_data_home, "", 4+32);
|
if (rli->inited)
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
fn_format(fname, info_fname, mysql_data_home, "", 4+32);
|
||||||
pthread_mutex_lock(&rli->data_lock);
|
pthread_mutex_lock(&rli->data_lock);
|
||||||
info_fd = rli->info_fd;
|
info_fd = rli->info_fd;
|
||||||
rli->pending = 0;
|
rli->pending = 0;
|
||||||
@ -1003,7 +1029,8 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
|
|||||||
if (!opt_relay_logname)
|
if (!opt_relay_logname)
|
||||||
{
|
{
|
||||||
char tmp[FN_REFLEN];
|
char tmp[FN_REFLEN];
|
||||||
/* TODO: The following should be using fn_format(); We just need to
|
/*
|
||||||
|
TODO: The following should be using fn_format(); We just need to
|
||||||
first change fn_format() to cut the file name if it's too long.
|
first change fn_format() to cut the file name if it's too long.
|
||||||
*/
|
*/
|
||||||
strmake(tmp,glob_hostname,FN_REFLEN-5);
|
strmake(tmp,glob_hostname,FN_REFLEN-5);
|
||||||
@ -1018,12 +1045,14 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
|
|||||||
/* if file does not exist */
|
/* if file does not exist */
|
||||||
if (!my_stat(fname, &stat_area, MYF(0)))
|
if (!my_stat(fname, &stat_area, MYF(0)))
|
||||||
{
|
{
|
||||||
// if someone removed the file from underneath our feet, just close
|
/*
|
||||||
// the old descriptor and re-create the old file
|
If someone removed the file from underneath our feet, just close
|
||||||
|
the old descriptor and re-create the old file
|
||||||
|
*/
|
||||||
if (info_fd >= 0)
|
if (info_fd >= 0)
|
||||||
my_close(info_fd, MYF(MY_WME));
|
my_close(info_fd, MYF(MY_WME));
|
||||||
if ((info_fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0
|
if ((info_fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0 ||
|
||||||
|| init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0,
|
init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0,
|
||||||
MYF(MY_WME)))
|
MYF(MY_WME)))
|
||||||
{
|
{
|
||||||
if (info_fd >= 0)
|
if (info_fd >= 0)
|
||||||
@ -1032,7 +1061,8 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
|
|||||||
pthread_mutex_unlock(&rli->data_lock);
|
pthread_mutex_unlock(&rli->data_lock);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
if (init_relay_log_pos(rli,"",4,0/*no data mutex*/,&msg))
|
if (init_relay_log_pos(rli,"",BIN_LOG_HEADER_SIZE,0 /*no data mutex*/,
|
||||||
|
&msg))
|
||||||
goto err;
|
goto err;
|
||||||
rli->master_log_pos = 0; // uninitialized
|
rli->master_log_pos = 0; // uninitialized
|
||||||
rli->info_fd = info_fd;
|
rli->info_fd = info_fd;
|
||||||
@ -1041,10 +1071,9 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
|
|||||||
{
|
{
|
||||||
if (info_fd >= 0)
|
if (info_fd >= 0)
|
||||||
reinit_io_cache(&rli->info_file, READ_CACHE, 0L,0,0);
|
reinit_io_cache(&rli->info_file, READ_CACHE, 0L,0,0);
|
||||||
else if((info_fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0
|
else if ((info_fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0 ||
|
||||||
|| init_io_cache(&rli->info_file, info_fd,
|
init_io_cache(&rli->info_file, info_fd,
|
||||||
IO_SIZE*2, READ_CACHE, 0L,
|
IO_SIZE*2, READ_CACHE, 0L, 0, MYF(MY_WME)))
|
||||||
0, MYF(MY_WME)))
|
|
||||||
{
|
{
|
||||||
if (info_fd >= 0)
|
if (info_fd >= 0)
|
||||||
my_close(info_fd, MYF(0));
|
my_close(info_fd, MYF(0));
|
||||||
@ -1056,12 +1085,12 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
|
|||||||
rli->info_fd = info_fd;
|
rli->info_fd = info_fd;
|
||||||
if (init_strvar_from_file(rli->relay_log_name,
|
if (init_strvar_from_file(rli->relay_log_name,
|
||||||
sizeof(rli->relay_log_name), &rli->info_file,
|
sizeof(rli->relay_log_name), &rli->info_file,
|
||||||
(char*)"") ||
|
"") ||
|
||||||
init_intvar_from_file((int*)&rli->relay_log_pos,
|
init_intvar_from_file((int*)&rli->relay_log_pos,
|
||||||
&rli->info_file, 4) ||
|
&rli->info_file, BIN_LOG_HEADER_SIZE) ||
|
||||||
init_strvar_from_file(rli->master_log_name,
|
init_strvar_from_file(rli->master_log_name,
|
||||||
sizeof(rli->master_log_name), &rli->info_file,
|
sizeof(rli->master_log_name), &rli->info_file,
|
||||||
(char*)"") ||
|
"") ||
|
||||||
init_intvar_from_file((int*)&rli->master_log_pos,
|
init_intvar_from_file((int*)&rli->master_log_pos,
|
||||||
&rli->info_file, 0))
|
&rli->info_file, 0))
|
||||||
{
|
{
|
||||||
@ -1074,11 +1103,13 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
|
|||||||
&msg))
|
&msg))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
DBUG_ASSERT(rli->relay_log_pos >= 4);
|
DBUG_ASSERT(rli->relay_log_pos >= BIN_LOG_HEADER_SIZE);
|
||||||
DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->relay_log_pos);
|
DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->relay_log_pos);
|
||||||
rli->inited = 1;
|
rli->inited = 1;
|
||||||
// now change the cache from READ to WRITE - must do this
|
/*
|
||||||
// before flush_relay_log_info
|
Now change the cache from READ to WRITE - must do this
|
||||||
|
before flush_relay_log_info
|
||||||
|
*/
|
||||||
reinit_io_cache(&rli->info_file, WRITE_CACHE,0L,0,1);
|
reinit_io_cache(&rli->info_file, WRITE_CACHE,0L,0,1);
|
||||||
error=test(flush_relay_log_info(rli));
|
error=test(flush_relay_log_info(rli));
|
||||||
if (count_relay_log_space(rli))
|
if (count_relay_log_space(rli))
|
||||||
@ -1118,11 +1149,11 @@ static inline int add_relay_log(RELAY_LOG_INFO* rli,LOG_INFO* linfo)
|
|||||||
|
|
||||||
static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli)
|
static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli)
|
||||||
{
|
{
|
||||||
bool slave_killed;
|
bool slave_killed=0;
|
||||||
LINT_INIT(slave_killed);
|
|
||||||
MASTER_INFO* mi = rli->mi;
|
MASTER_INFO* mi = rli->mi;
|
||||||
const char* save_proc_info;
|
const char* save_proc_info;
|
||||||
THD* thd = mi->io_thd;
|
THD* thd = mi->io_thd;
|
||||||
|
|
||||||
DBUG_ENTER("wait_for_relay_log_space");
|
DBUG_ENTER("wait_for_relay_log_space");
|
||||||
pthread_mutex_lock(&rli->log_space_lock);
|
pthread_mutex_lock(&rli->log_space_lock);
|
||||||
save_proc_info = thd->proc_info;
|
save_proc_info = thd->proc_info;
|
||||||
@ -1137,6 +1168,7 @@ static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli)
|
|||||||
DBUG_RETURN(slave_killed);
|
DBUG_RETURN(slave_killed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int count_relay_log_space(RELAY_LOG_INFO* rli)
|
static int count_relay_log_space(RELAY_LOG_INFO* rli)
|
||||||
{
|
{
|
||||||
LOG_INFO linfo;
|
LOG_INFO linfo;
|
||||||
@ -1147,31 +1179,32 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli)
|
|||||||
sql_print_error("Could not find first log while counting relay log space");
|
sql_print_error("Could not find first log while counting relay log space");
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
if (add_relay_log(rli,&linfo))
|
do
|
||||||
DBUG_RETURN(1);
|
|
||||||
while (!rli->relay_log.find_next_log(&linfo))
|
|
||||||
{
|
{
|
||||||
if (add_relay_log(rli,&linfo))
|
if (add_relay_log(rli,&linfo))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
} while (!rli->relay_log.find_next_log(&linfo));
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
|
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
|
||||||
const char* slave_info_fname)
|
const char* slave_info_fname)
|
||||||
{
|
{
|
||||||
if (mi->inited)
|
|
||||||
return 0;
|
|
||||||
if (init_relay_log_info(&mi->rli, slave_info_fname))
|
|
||||||
return 1;
|
|
||||||
mi->rli.mi = mi;
|
|
||||||
mi->mysql=0;
|
|
||||||
mi->file_id=1;
|
|
||||||
mi->ignore_stop_event=0;
|
|
||||||
int fd,error;
|
int fd,error;
|
||||||
MY_STAT stat_area;
|
MY_STAT stat_area;
|
||||||
char fname[FN_REFLEN+128];
|
char fname[FN_REFLEN+128];
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
DBUG_ENTER("init_master_info");
|
||||||
|
|
||||||
|
if (mi->inited)
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
if (init_relay_log_info(&mi->rli, slave_info_fname))
|
||||||
|
DBUG_RETURN(1);
|
||||||
|
mi->rli.mi = mi;
|
||||||
|
mi->mysql=0;
|
||||||
|
mi->file_id=1;
|
||||||
|
mi->ignore_stop_event=0;
|
||||||
fn_format(fname, master_info_fname, mysql_data_home, "", 4+32);
|
fn_format(fname, master_info_fname, mysql_data_home, "", 4+32);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1185,23 +1218,19 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
|
|||||||
// we do not want any messages if the file does not exist
|
// we do not want any messages if the file does not exist
|
||||||
if (!my_stat(fname, &stat_area, MYF(0)))
|
if (!my_stat(fname, &stat_area, MYF(0)))
|
||||||
{
|
{
|
||||||
// if someone removed the file from underneath our feet, just close
|
/*
|
||||||
// the old descriptor and re-create the old file
|
if someone removed the file from underneath our feet, just close
|
||||||
|
the old descriptor and re-create the old file
|
||||||
|
*/
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
my_close(fd, MYF(MY_WME));
|
my_close(fd, MYF(MY_WME));
|
||||||
if ((fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0
|
if ((fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0 ||
|
||||||
|| init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,0,
|
init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,0,
|
||||||
MYF(MY_WME)))
|
MYF(MY_WME)))
|
||||||
{
|
goto err;
|
||||||
if(fd >= 0)
|
|
||||||
my_close(fd, MYF(0));
|
|
||||||
mi->fd=-1;
|
|
||||||
end_relay_log_info(&mi->rli);
|
|
||||||
pthread_mutex_unlock(&mi->data_lock);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
mi->master_log_name[0] = 0;
|
mi->master_log_name[0] = 0;
|
||||||
mi->master_log_pos = 4; // skip magic number
|
mi->master_log_pos = BIN_LOG_HEADER_SIZE; // skip magic number
|
||||||
mi->fd = fd;
|
mi->fd = fd;
|
||||||
|
|
||||||
if (master_host)
|
if (master_host)
|
||||||
@ -1217,22 +1246,15 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
|
|||||||
{
|
{
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
reinit_io_cache(&mi->file, READ_CACHE, 0L,0,0);
|
reinit_io_cache(&mi->file, READ_CACHE, 0L,0,0);
|
||||||
else if((fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0
|
else if ((fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0 ||
|
||||||
|| init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,
|
init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,
|
||||||
0, MYF(MY_WME)))
|
0, MYF(MY_WME)))
|
||||||
{
|
goto err;
|
||||||
if(fd >= 0)
|
|
||||||
my_close(fd, MYF(0));
|
|
||||||
mi->fd=-1;
|
|
||||||
end_relay_log_info(&mi->rli);
|
|
||||||
pthread_mutex_unlock(&mi->data_lock);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
mi->fd = fd;
|
mi->fd = fd;
|
||||||
if (init_strvar_from_file(mi->master_log_name,
|
if (init_strvar_from_file(mi->master_log_name,
|
||||||
sizeof(mi->master_log_name), &mi->file,
|
sizeof(mi->master_log_name), &mi->file,
|
||||||
(char*)"") ||
|
"") ||
|
||||||
init_intvar_from_file((int*)&mi->master_log_pos, &mi->file, 4) ||
|
init_intvar_from_file((int*)&mi->master_log_pos, &mi->file, 4) ||
|
||||||
init_strvar_from_file(mi->host, sizeof(mi->host), &mi->file,
|
init_strvar_from_file(mi->host, sizeof(mi->host), &mi->file,
|
||||||
master_host) ||
|
master_host) ||
|
||||||
@ -1244,7 +1266,7 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
|
|||||||
init_intvar_from_file((int*)&mi->connect_retry, &mi->file,
|
init_intvar_from_file((int*)&mi->connect_retry, &mi->file,
|
||||||
master_connect_retry))
|
master_connect_retry))
|
||||||
{
|
{
|
||||||
msg="Error reading master configuration";
|
sql_print_error("Error reading master configuration");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1254,17 +1276,18 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
|
|||||||
reinit_io_cache(&mi->file, WRITE_CACHE,0L,0,1);
|
reinit_io_cache(&mi->file, WRITE_CACHE,0L,0,1);
|
||||||
error=test(flush_master_info(mi));
|
error=test(flush_master_info(mi));
|
||||||
pthread_mutex_unlock(&mi->data_lock);
|
pthread_mutex_unlock(&mi->data_lock);
|
||||||
return error;
|
DBUG_RETURN(error);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
sql_print_error(msg);
|
|
||||||
end_io_cache(&mi->file);
|
|
||||||
end_relay_log_info(&mi->rli);
|
end_relay_log_info(&mi->rli);
|
||||||
DBUG_ASSERT(fd>=0);
|
if (fd >= 0)
|
||||||
|
{
|
||||||
my_close(fd, MYF(0));
|
my_close(fd, MYF(0));
|
||||||
|
end_io_cache(&mi->file);
|
||||||
|
}
|
||||||
mi->fd= -1;
|
mi->fd= -1;
|
||||||
pthread_mutex_unlock(&mi->data_lock);
|
pthread_mutex_unlock(&mi->data_lock);
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int register_slave_on_master(MYSQL* mysql)
|
int register_slave_on_master(MYSQL* mysql)
|
||||||
@ -1504,8 +1527,10 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
|
|||||||
*/
|
*/
|
||||||
thr_alarm(&alarmed, 2 * nap_time,&alarm_buff);
|
thr_alarm(&alarmed, 2 * nap_time,&alarm_buff);
|
||||||
sleep(nap_time);
|
sleep(nap_time);
|
||||||
// if we wake up before the alarm goes off, hit the button
|
/*
|
||||||
// so it will not wake up the wife and kids :-)
|
If we wake up before the alarm goes off, hit the button
|
||||||
|
so it will not wake up the wife and kids :-)
|
||||||
|
*/
|
||||||
if (thr_alarm_in_use(&alarmed))
|
if (thr_alarm_in_use(&alarmed))
|
||||||
thr_end_alarm(&alarmed);
|
thr_end_alarm(&alarmed);
|
||||||
|
|
||||||
@ -1530,9 +1555,11 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi)
|
|||||||
memcpy(buf + 10, logname,len);
|
memcpy(buf + 10, logname,len);
|
||||||
if (mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 10, 1))
|
if (mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 10, 1))
|
||||||
{
|
{
|
||||||
// something went wrong, so we will just reconnect and retry later
|
/*
|
||||||
// in the future, we should do a better error analysis, but for
|
Something went wrong, so we will just reconnect and retry later
|
||||||
// now we just fill up the error log :-)
|
in the future, we should do a better error analysis, but for
|
||||||
|
now we just fill up the error log :-)
|
||||||
|
*/
|
||||||
sql_print_error("Error on COM_BINLOG_DUMP: %s, will retry in %d secs",
|
sql_print_error("Error on COM_BINLOG_DUMP: %s, will retry in %d secs",
|
||||||
mc_mysql_error(mysql), master_connect_retry);
|
mc_mysql_error(mysql), master_connect_retry);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1573,8 +1600,10 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi)
|
|||||||
{
|
{
|
||||||
ulong len = packet_error;
|
ulong len = packet_error;
|
||||||
|
|
||||||
// my_real_read() will time us out
|
/*
|
||||||
// we check if we were told to die, and if not, try reading again
|
my_real_read() will time us out
|
||||||
|
We check if we were told to die, and if not, try reading again
|
||||||
|
*/
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
if (disconnect_slave_event_count && !(events_till_disconnect--))
|
if (disconnect_slave_event_count && !(events_till_disconnect--))
|
||||||
return packet_error;
|
return packet_error;
|
||||||
@ -1645,10 +1674,12 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
|
|||||||
type_code != STOP_EVENT ? ev->log_pos : LL(0),
|
type_code != STOP_EVENT ? ev->log_pos : LL(0),
|
||||||
1/* skip lock*/);
|
1/* skip lock*/);
|
||||||
flush_relay_log_info(rli);
|
flush_relay_log_info(rli);
|
||||||
if (rli->slave_skip_counter && /* protect against common user error of
|
|
||||||
setting the counter to 1 instead of 2
|
/*
|
||||||
while recovering from an failed
|
Protect against common user error of setting the counter to 1
|
||||||
auto-increment insert */
|
instead of 2 while recovering from an failed auto-increment insert
|
||||||
|
*/
|
||||||
|
if (rli->slave_skip_counter &&
|
||||||
!((type_code == INTVAR_EVENT || type_code == STOP_EVENT) &&
|
!((type_code == INTVAR_EVENT || type_code == STOP_EVENT) &&
|
||||||
rli->slave_skip_counter == 1))
|
rli->slave_skip_counter == 1))
|
||||||
--rli->slave_skip_counter;
|
--rli->slave_skip_counter;
|
||||||
@ -1720,7 +1751,7 @@ slave_begin:
|
|||||||
pthread_cond_broadcast(&mi->start_cond);
|
pthread_cond_broadcast(&mi->start_cond);
|
||||||
pthread_mutex_unlock(&mi->run_lock);
|
pthread_mutex_unlock(&mi->run_lock);
|
||||||
|
|
||||||
DBUG_PRINT("info",("master info: log_file_name=%s, position=%s",
|
DBUG_PRINT("info",("master info: log_file_name='%s', position=%s",
|
||||||
mi->master_log_name, llstr(mi->master_log_pos,llbuff)));
|
mi->master_log_name, llstr(mi->master_log_pos,llbuff)));
|
||||||
|
|
||||||
if (!(mi->mysql = mysql = mc_mysql_init(NULL)))
|
if (!(mi->mysql = mysql = mc_mysql_init(NULL)))
|
||||||
@ -1972,22 +2003,22 @@ slave_begin:
|
|||||||
rli->abort_slave = 0;
|
rli->abort_slave = 0;
|
||||||
pthread_cond_broadcast(&rli->start_cond);
|
pthread_cond_broadcast(&rli->start_cond);
|
||||||
pthread_mutex_unlock(&rli->run_lock);
|
pthread_mutex_unlock(&rli->run_lock);
|
||||||
rli->pending = 0; //this should always be set to 0 when the slave thread
|
// This should always be set to 0 when the slave thread is started
|
||||||
// is started
|
rli->pending = 0;
|
||||||
if (init_relay_log_pos(rli,0,0,1 /*need data lock*/, &errmsg))
|
if (init_relay_log_pos(rli,0,0,1 /*need data lock*/, &errmsg))
|
||||||
{
|
{
|
||||||
sql_print_error("Error initializing relay log position: %s",
|
sql_print_error("Error initializing relay log position: %s",
|
||||||
errmsg);
|
errmsg);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
DBUG_ASSERT(rli->relay_log_pos >= 4);
|
DBUG_ASSERT(rli->relay_log_pos >= BIN_LOG_HEADER_SIZE);
|
||||||
DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->relay_log_pos);
|
DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->relay_log_pos);
|
||||||
|
|
||||||
DBUG_PRINT("info",("master info: log_file_name=%s, position=%s",
|
DBUG_PRINT("info",("master info: log_file_name: %s, position: %s",
|
||||||
rli->master_log_name, llstr(rli->master_log_pos,llbuff)));
|
rli->master_log_name, llstr(rli->master_log_pos,llbuff)));
|
||||||
DBUG_ASSERT(rli->sql_thd == thd);
|
DBUG_ASSERT(rli->sql_thd == thd);
|
||||||
sql_print_error("Slave SQL thread initialized, starting replication in \
|
sql_print_error("Slave SQL thread initialized, starting replication in \
|
||||||
log '%s' at position %s,relay log: name='%s',pos='%s'", RPL_LOG_NAME,
|
log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
|
||||||
llstr(rli->master_log_pos,llbuff),rli->relay_log_name,
|
llstr(rli->master_log_pos,llbuff),rli->relay_log_name,
|
||||||
llstr(rli->relay_log_pos,llbuff1));
|
llstr(rli->relay_log_pos,llbuff1));
|
||||||
while (!sql_slave_killed(thd,rli))
|
while (!sql_slave_killed(thd,rli))
|
||||||
@ -2055,16 +2086,17 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev)
|
|||||||
bool cev_not_written;
|
bool cev_not_written;
|
||||||
THD* thd;
|
THD* thd;
|
||||||
NET* net = &mi->mysql->net;
|
NET* net = &mi->mysql->net;
|
||||||
|
DBUG_ENTER("process_io_create_file");
|
||||||
|
|
||||||
if (unlikely(!cev->is_valid()))
|
if (unlikely(!cev->is_valid()))
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
/*
|
/*
|
||||||
TODO: fix to honor table rules, not only db rules
|
TODO: fix to honor table rules, not only db rules
|
||||||
*/
|
*/
|
||||||
if (!db_ok(cev->db, replicate_do_db, replicate_ignore_db))
|
if (!db_ok(cev->db, replicate_do_db, replicate_ignore_db))
|
||||||
{
|
{
|
||||||
skip_load_data_infile(net);
|
skip_load_data_infile(net);
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
DBUG_ASSERT(cev->inited_from_old);
|
DBUG_ASSERT(cev->inited_from_old);
|
||||||
thd = mi->io_thd;
|
thd = mi->io_thd;
|
||||||
@ -2139,10 +2171,13 @@ relay log");
|
|||||||
}
|
}
|
||||||
error=0;
|
error=0;
|
||||||
err:
|
err:
|
||||||
return error;
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We assume we already locked mi->data_lock
|
/*
|
||||||
|
We assume we already locked mi->data_lock
|
||||||
|
*/
|
||||||
|
|
||||||
static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev)
|
static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev)
|
||||||
{
|
{
|
||||||
if (unlikely(!rev->is_valid()))
|
if (unlikely(!rev->is_valid()))
|
||||||
@ -2177,6 +2212,8 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
|
|||||||
bool inc_pos = 1;
|
bool inc_pos = 1;
|
||||||
bool processed_stop_event = 0;
|
bool processed_stop_event = 0;
|
||||||
char* tmp_buf = 0;
|
char* tmp_buf = 0;
|
||||||
|
DBUG_ENTER("queue_old_event");
|
||||||
|
|
||||||
/* if we get Load event, we need to pass a non-reusable buffer
|
/* if we get Load event, we need to pass a non-reusable buffer
|
||||||
to read_log_event, so we do a trick
|
to read_log_event, so we do a trick
|
||||||
*/
|
*/
|
||||||
@ -2185,7 +2222,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
|
|||||||
if (unlikely(!(tmp_buf=(char*)my_malloc(event_len+1,MYF(MY_WME)))))
|
if (unlikely(!(tmp_buf=(char*)my_malloc(event_len+1,MYF(MY_WME)))))
|
||||||
{
|
{
|
||||||
sql_print_error("Slave I/O: out of memory for Load event");
|
sql_print_error("Slave I/O: out of memory for Load event");
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
memcpy(tmp_buf,buf,event_len);
|
memcpy(tmp_buf,buf,event_len);
|
||||||
tmp_buf[event_len]=0; // Create_file constructor wants null-term buffer
|
tmp_buf[event_len]=0; // Create_file constructor wants null-term buffer
|
||||||
@ -2199,7 +2236,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
|
|||||||
master could be corrupt but a more likely cause of this is a bug",
|
master could be corrupt but a more likely cause of this is a bug",
|
||||||
errmsg);
|
errmsg);
|
||||||
my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR));
|
my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR));
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
pthread_mutex_lock(&mi->data_lock);
|
pthread_mutex_lock(&mi->data_lock);
|
||||||
ev->log_pos = mi->master_log_pos;
|
ev->log_pos = mi->master_log_pos;
|
||||||
@ -2210,7 +2247,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
|
|||||||
delete ev;
|
delete ev;
|
||||||
pthread_mutex_unlock(&mi->data_lock);
|
pthread_mutex_unlock(&mi->data_lock);
|
||||||
DBUG_ASSERT(!tmp_buf);
|
DBUG_ASSERT(!tmp_buf);
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
mi->ignore_stop_event=1;
|
mi->ignore_stop_event=1;
|
||||||
inc_pos = 0;
|
inc_pos = 0;
|
||||||
@ -2226,7 +2263,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
|
|||||||
pthread_mutex_unlock(&mi->data_lock);
|
pthread_mutex_unlock(&mi->data_lock);
|
||||||
DBUG_ASSERT(tmp_buf);
|
DBUG_ASSERT(tmp_buf);
|
||||||
my_free((char*)tmp_buf, MYF(0));
|
my_free((char*)tmp_buf, MYF(0));
|
||||||
return error;
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
mi->ignore_stop_event=0;
|
mi->ignore_stop_event=0;
|
||||||
@ -2239,7 +2276,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
|
|||||||
delete ev;
|
delete ev;
|
||||||
pthread_mutex_unlock(&mi->data_lock);
|
pthread_mutex_unlock(&mi->data_lock);
|
||||||
DBUG_ASSERT(!tmp_buf);
|
DBUG_ASSERT(!tmp_buf);
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total);
|
mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total);
|
||||||
}
|
}
|
||||||
@ -2250,7 +2287,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
|
|||||||
mi->ignore_stop_event=1;
|
mi->ignore_stop_event=1;
|
||||||
pthread_mutex_unlock(&mi->data_lock);
|
pthread_mutex_unlock(&mi->data_lock);
|
||||||
DBUG_ASSERT(!tmp_buf);
|
DBUG_ASSERT(!tmp_buf);
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2263,8 +2300,10 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
|
|||||||
int error=0;
|
int error=0;
|
||||||
bool inc_pos = 1;
|
bool inc_pos = 1;
|
||||||
bool processed_stop_event = 0;
|
bool processed_stop_event = 0;
|
||||||
|
DBUG_ENTER("queue_event");
|
||||||
|
|
||||||
if (mi->old_format)
|
if (mi->old_format)
|
||||||
return queue_old_event(mi,buf,event_len);
|
DBUG_RETURN(queue_old_event(mi,buf,event_len));
|
||||||
|
|
||||||
pthread_mutex_lock(&mi->data_lock);
|
pthread_mutex_lock(&mi->data_lock);
|
||||||
|
|
||||||
@ -2280,7 +2319,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
|
|||||||
{
|
{
|
||||||
Rotate_log_event rev(buf,event_len,0);
|
Rotate_log_event rev(buf,event_len,0);
|
||||||
if (unlikely(process_io_rotate(mi,&rev)))
|
if (unlikely(process_io_rotate(mi,&rev)))
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
inc_pos=0;
|
inc_pos=0;
|
||||||
mi->ignore_stop_event=1;
|
mi->ignore_stop_event=1;
|
||||||
break;
|
break;
|
||||||
@ -2300,7 +2339,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
|
|||||||
if (unlikely(processed_stop_event))
|
if (unlikely(processed_stop_event))
|
||||||
mi->ignore_stop_event=1;
|
mi->ignore_stop_event=1;
|
||||||
pthread_mutex_unlock(&mi->data_lock);
|
pthread_mutex_unlock(&mi->data_lock);
|
||||||
return error;
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2427,18 +2466,27 @@ int flush_relay_log_info(RELAY_LOG_INFO* rli)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
IO_CACHE* reopen_relay_log(RELAY_LOG_INFO* rli, const char** errmsg)
|
|
||||||
|
/*
|
||||||
|
This function is called when we notice that the current "hot" log
|
||||||
|
got rotated under our feet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(rli->cur_log != &rli->cache_buf);
|
DBUG_ASSERT(rli->cur_log != &rli->cache_buf);
|
||||||
IO_CACHE* cur_log = rli->cur_log=&rli->cache_buf;
|
|
||||||
DBUG_ASSERT(rli->cur_log_fd == -1);
|
DBUG_ASSERT(rli->cur_log_fd == -1);
|
||||||
|
DBUG_ENTER("reopen_relay_log");
|
||||||
|
|
||||||
|
IO_CACHE *cur_log = rli->cur_log=&rli->cache_buf;
|
||||||
if ((rli->cur_log_fd=open_binlog(cur_log,rli->relay_log_name,
|
if ((rli->cur_log_fd=open_binlog(cur_log,rli->relay_log_name,
|
||||||
errmsg)) <0)
|
errmsg)) <0)
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
my_b_seek(cur_log,rli->relay_log_pos);
|
my_b_seek(cur_log,rli->relay_log_pos);
|
||||||
return cur_log;
|
DBUG_RETURN(cur_log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Log_event* next_event(RELAY_LOG_INFO* rli)
|
Log_event* next_event(RELAY_LOG_INFO* rli)
|
||||||
{
|
{
|
||||||
Log_event* ev;
|
Log_event* ev;
|
||||||
@ -2447,6 +2495,7 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
const char* errmsg=0;
|
const char* errmsg=0;
|
||||||
THD* thd = rli->sql_thd;
|
THD* thd = rli->sql_thd;
|
||||||
bool was_killed;
|
bool was_killed;
|
||||||
|
DBUG_ENTER("next_event");
|
||||||
DBUG_ASSERT(thd != 0);
|
DBUG_ASSERT(thd != 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2458,16 +2507,18 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
*/
|
*/
|
||||||
pthread_mutex_lock(&rli->data_lock);
|
pthread_mutex_lock(&rli->data_lock);
|
||||||
|
|
||||||
for (; !(was_killed=sql_slave_killed(thd,rli)) ;)
|
while (!(was_killed=sql_slave_killed(thd,rli)))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
We can have two kinds of log reading:
|
We can have two kinds of log reading:
|
||||||
hot_log - rli->cur_log points at the IO_CACHE of relay_log, which
|
hot_log:
|
||||||
|
rli->cur_log points at the IO_CACHE of relay_log, which
|
||||||
is actively being updated by the I/O thread. We need to be careful
|
is actively being updated by the I/O thread. We need to be careful
|
||||||
in this case and make sure that we are not looking at a stale log that
|
in this case and make sure that we are not looking at a stale log that
|
||||||
has already been rotated. If it has been, we reopen the log
|
has already been rotated. If it has been, we reopen the log.
|
||||||
the other case is much simpler - we just have a read only log that
|
|
||||||
nobody else will be updating.
|
The other case is much simpler:
|
||||||
|
We just have a read only log that nobody else will be updating.
|
||||||
*/
|
*/
|
||||||
bool hot_log;
|
bool hot_log;
|
||||||
if ((hot_log = (cur_log != &rli->cache_buf)))
|
if ((hot_log = (cur_log != &rli->cache_buf)))
|
||||||
@ -2476,23 +2527,23 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
pthread_mutex_lock(log_lock);
|
pthread_mutex_lock(log_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Reading cur_log->init_count here is safe because the log will only
|
Reading xxx_file_id is safe because the log will only
|
||||||
be rotated when we hold relay_log.LOCK_log
|
be rotated when we hold relay_log.LOCK_log
|
||||||
*/
|
*/
|
||||||
if (cur_log->init_count != rli->cur_log_init_count)
|
if (rli->relay_log.get_open_count() != rli->cur_log_old_open_count)
|
||||||
{
|
|
||||||
if (!(cur_log=reopen_relay_log(rli,&errmsg)))
|
|
||||||
{
|
{
|
||||||
|
// The master has switched to a new log file; Reopen the old log file
|
||||||
|
cur_log=reopen_relay_log(rli, &errmsg);
|
||||||
pthread_mutex_unlock(log_lock);
|
pthread_mutex_unlock(log_lock);
|
||||||
|
if (!cur_log) // No more log files
|
||||||
goto err;
|
goto err;
|
||||||
}
|
hot_log=0; // Using old binary log
|
||||||
pthread_mutex_unlock(log_lock);
|
|
||||||
hot_log=0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBUG_ASSERT(my_b_tell(cur_log) >= 4);
|
DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE);
|
||||||
DBUG_ASSERT(my_b_tell(cur_log) == rli->relay_log_pos + rli->pending);
|
DBUG_ASSERT(my_b_tell(cur_log) == rli->relay_log_pos + rli->pending);
|
||||||
/* relay log is always in new format - if the master is 3.23, the
|
/*
|
||||||
|
Relay log is always in new format - if the master is 3.23, the
|
||||||
I/O thread will convert the format for us
|
I/O thread will convert the format for us
|
||||||
*/
|
*/
|
||||||
if ((ev=Log_event::read_log_event(cur_log,0,(bool)0 /* new format */)))
|
if ((ev=Log_event::read_log_event(cur_log,0,(bool)0 /* new format */)))
|
||||||
@ -2501,18 +2552,18 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
if (hot_log)
|
if (hot_log)
|
||||||
pthread_mutex_unlock(log_lock);
|
pthread_mutex_unlock(log_lock);
|
||||||
pthread_mutex_unlock(&rli->data_lock);
|
pthread_mutex_unlock(&rli->data_lock);
|
||||||
return ev;
|
DBUG_RETURN(ev);
|
||||||
}
|
}
|
||||||
DBUG_ASSERT(thd==rli->sql_thd);
|
DBUG_ASSERT(thd==rli->sql_thd);
|
||||||
if (opt_reckless_slave)
|
if (opt_reckless_slave) // For mysql-test
|
||||||
cur_log->error = 0;
|
cur_log->error = 0;
|
||||||
if (cur_log->error < 0)
|
if (cur_log->error < 0)
|
||||||
{
|
{
|
||||||
errmsg = "slave SQL thread aborted because of I/O error";
|
errmsg = "slave SQL thread aborted because of I/O error";
|
||||||
|
if (hot_log)
|
||||||
|
pthread_mutex_unlock(log_lock);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!cur_log->error) /* EOF */
|
if (!cur_log->error) /* EOF */
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -2522,7 +2573,7 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
*/
|
*/
|
||||||
if (hot_log)
|
if (hot_log)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(cur_log->init_count == rli->cur_log_init_count);
|
DBUG_ASSERT(rli->relay_log.get_open_count() == rli->cur_log_old_open_count);
|
||||||
/*
|
/*
|
||||||
We can, and should release data_lock while we are waiting for
|
We can, and should release data_lock while we are waiting for
|
||||||
update. If we do not, show slave status will block
|
update. If we do not, show slave status will block
|
||||||
@ -2530,7 +2581,7 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
pthread_mutex_unlock(&rli->data_lock);
|
pthread_mutex_unlock(&rli->data_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
IMPORTANT: note that wait_for_update will unlock LOCK_log, but
|
IMPORTANT: note that wait_for_update will unlock lock_log, but
|
||||||
expects the caller to lock it
|
expects the caller to lock it
|
||||||
*/
|
*/
|
||||||
rli->relay_log.wait_for_update(rli->sql_thd);
|
rli->relay_log.wait_for_update(rli->sql_thd);
|
||||||
@ -2539,8 +2590,6 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
pthread_mutex_lock(&rli->data_lock);
|
pthread_mutex_lock(&rli->data_lock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
If the log was not hot, we need to move to the next log in
|
If the log was not hot, we need to move to the next log in
|
||||||
sequence. The next log could be hot or cold, we deal with both
|
sequence. The next log could be hot or cold, we deal with both
|
||||||
@ -2551,8 +2600,10 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
my_close(rli->cur_log_fd, MYF(MY_WME));
|
my_close(rli->cur_log_fd, MYF(MY_WME));
|
||||||
rli->cur_log_fd = -1;
|
rli->cur_log_fd = -1;
|
||||||
|
|
||||||
// TODO: make skip_log_purge a start-up option. At this point this
|
/*
|
||||||
// is not critical priority
|
TODO: make skip_log_purge a start-up option. At this point this
|
||||||
|
is not critical priority
|
||||||
|
*/
|
||||||
if (!rli->skip_log_purge)
|
if (!rli->skip_log_purge)
|
||||||
{
|
{
|
||||||
// purge_first_log will properly set up relay log coordinates in rli
|
// purge_first_log will properly set up relay log coordinates in rli
|
||||||
@ -2564,17 +2615,19 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: verify that no lock is ok here. At this point, if we
|
/*
|
||||||
// get this wrong, this is actually no big deal - the only time
|
TODO: verify that no lock is ok here. At this point, if we
|
||||||
// this code will ever be executed is if we are recovering from
|
get this wrong, this is actually no big deal - the only time
|
||||||
// a bug when a full reload of the slave is not feasible or
|
this code will ever be executed is if we are recovering from
|
||||||
// desirable.
|
a bug when a full reload of the slave is not feasible or
|
||||||
|
desirable.
|
||||||
|
*/
|
||||||
if (rli->relay_log.find_next_log(&rli->linfo,0/*no lock*/))
|
if (rli->relay_log.find_next_log(&rli->linfo,0/*no lock*/))
|
||||||
{
|
{
|
||||||
errmsg = "error switching to the next log";
|
errmsg = "error switching to the next log";
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
rli->relay_log_pos = 4;
|
rli->relay_log_pos = BIN_LOG_HEADER_SIZE;
|
||||||
rli->pending=0;
|
rli->pending=0;
|
||||||
strnmov(rli->relay_log_name,rli->linfo.log_file_name,
|
strnmov(rli->relay_log_name,rli->linfo.log_file_name,
|
||||||
sizeof(rli->relay_log_name));
|
sizeof(rli->relay_log_name));
|
||||||
@ -2589,7 +2642,7 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
rli->linfo.log_file_name);
|
rli->linfo.log_file_name);
|
||||||
#endif
|
#endif
|
||||||
rli->cur_log= cur_log= rli->relay_log.get_log_file();
|
rli->cur_log= cur_log= rli->relay_log.get_log_file();
|
||||||
rli->cur_log_init_count = cur_log->init_count;
|
rli->cur_log_old_open_count= rli->relay_log.get_open_count();
|
||||||
DBUG_ASSERT(rli->cur_log_fd == -1);
|
DBUG_ASSERT(rli->cur_log_fd == -1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2613,28 +2666,32 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
|
|||||||
&errmsg)) <0)
|
&errmsg)) <0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else // read failed with a non-EOF error
|
|
||||||
{
|
{
|
||||||
// TODO: come up with something better to handle this error
|
/*
|
||||||
|
Read failed with a non-EOF error.
|
||||||
|
TODO: come up with something better to handle this error
|
||||||
|
*/
|
||||||
|
if (hot_log)
|
||||||
|
pthread_mutex_unlock(log_lock);
|
||||||
sql_print_error("Slave SQL thread: I/O error reading \
|
sql_print_error("Slave SQL thread: I/O error reading \
|
||||||
event(errno=%d,cur_log->error=%d)",
|
event(errno: %d cur_log->error: %d)",
|
||||||
my_errno,cur_log->error);
|
my_errno,cur_log->error);
|
||||||
// set read position to the beginning of the event
|
// set read position to the beginning of the event
|
||||||
my_b_seek(cur_log,rli->relay_log_pos+rli->pending);
|
my_b_seek(cur_log,rli->relay_log_pos+rli->pending);
|
||||||
/* otherwise, we have had a partial read */
|
/* otherwise, we have had a partial read */
|
||||||
/* TODO; see if there is a way to do this without this goto */
|
|
||||||
errmsg = "Aborting slave SQL thread because of partial event read";
|
errmsg = "Aborting slave SQL thread because of partial event read";
|
||||||
|
/* TODO; see if there is a way to do this without this goto */
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!errmsg && was_killed)
|
if (!errmsg && was_killed)
|
||||||
errmsg = "slave SQL thread was killed";
|
errmsg = "slave SQL thread was killed";
|
||||||
|
|
||||||
err:
|
err:
|
||||||
pthread_mutex_unlock(&rli->data_lock);
|
pthread_mutex_unlock(&rli->data_lock);
|
||||||
sql_print_error("Error reading relay log event: %s", errmsg);
|
sql_print_error("Error reading relay log event: %s", errmsg);
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
67
sql/slave.h
67
sql/slave.h
@ -84,18 +84,9 @@ typedef struct st_relay_log_info
|
|||||||
volatile my_off_t master_log_pos;
|
volatile my_off_t master_log_pos;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
current offset in the relay log.
|
Protected with internal locks.
|
||||||
pending - in some cases we do not increment offset immediately after
|
Must get data_lock when resetting the logs.
|
||||||
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;
|
|
||||||
|
|
||||||
// protected with internal locks
|
|
||||||
// must get data_lock when resetting the logs
|
|
||||||
MYSQL_LOG relay_log;
|
MYSQL_LOG relay_log;
|
||||||
LOG_INFO linfo;
|
LOG_INFO linfo;
|
||||||
IO_CACHE cache_buf,*cur_log;
|
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;
|
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
|
// parent master info structure
|
||||||
struct st_master_info *mi;
|
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
|
Needed to deal properly with cur_log getting closed and re-opened with
|
||||||
a different log under our feet
|
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
|
Needed for problems when slave stops and we want to restart it
|
||||||
@ -145,24 +143,26 @@ typedef struct st_relay_log_info
|
|||||||
errors, and have been manually applied by DBA already.
|
errors, and have been manually applied by DBA already.
|
||||||
*/
|
*/
|
||||||
volatile uint32 slave_skip_counter;
|
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
|
#ifndef DBUG_OFF
|
||||||
int events_till_abort;
|
int events_till_abort;
|
||||||
#endif
|
#endif
|
||||||
int last_slave_errno;
|
|
||||||
char last_slave_error[MAX_SLAVE_ERRMSG];
|
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 log_pos_current;
|
||||||
bool abort_pos_wait;
|
bool abort_pos_wait;
|
||||||
bool skip_log_purge;
|
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),
|
st_relay_log_info()
|
||||||
cur_log_init_count(0),
|
:info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0),
|
||||||
abort_slave(0),slave_running(0),
|
inited(0), abort_slave(0), slave_running(0), log_pos_current(0),
|
||||||
log_pos_current(0),abort_pos_wait(0),
|
abort_pos_wait(0), skip_log_purge(0)
|
||||||
skip_log_purge(0)
|
|
||||||
{
|
{
|
||||||
relay_log_name[0] = master_log_name[0] = 0;
|
relay_log_name[0] = master_log_name[0] = 0;
|
||||||
bzero(&info_file,sizeof(info_file));
|
bzero(&info_file,sizeof(info_file));
|
||||||
@ -215,24 +215,17 @@ typedef struct st_relay_log_info
|
|||||||
int wait_for_pos(THD* thd, String* log_name, ulonglong log_pos);
|
int wait_for_pos(THD* thd, String* log_name, ulonglong log_pos);
|
||||||
} RELAY_LOG_INFO;
|
} 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);
|
Log_event* next_event(RELAY_LOG_INFO* rli);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
st_master_info contains information about how to connect to a master,
|
st_master_info contains information about how to connect to a master,
|
||||||
current master log name, and current log offset, as well as misc
|
current master log name, and current log offset, as well as misc
|
||||||
control variables
|
control variables
|
||||||
|
|
||||||
st_master_info is initialized once from the master.info file if such
|
st_master_info is initialized once from the master.info file if such
|
||||||
exists. Otherwise, data members corresponding to master.info fields are
|
exists. Otherwise, data members corresponding to master.info fields
|
||||||
initialized with defaults specified by master-* options. The initialization
|
are initialized with defaults specified by master-* options. The
|
||||||
is done through init_master_info() call.
|
initialization is done through init_master_info() call.
|
||||||
|
|
||||||
The format of master.info file:
|
The format of master.info file:
|
||||||
|
|
||||||
@ -415,9 +408,7 @@ extern bool do_table_inited, ignore_table_inited,
|
|||||||
wild_do_table_inited, wild_ignore_table_inited;
|
wild_do_table_inited, wild_ignore_table_inited;
|
||||||
extern bool table_rules_on;
|
extern bool table_rules_on;
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
extern int disconnect_slave_event_count, abort_slave_event_count ;
|
extern int disconnect_slave_event_count, abort_slave_event_count ;
|
||||||
#endif
|
|
||||||
|
|
||||||
// the master variables are defaults read from my.cnf or command line
|
// the master variables are defaults read from my.cnf or command line
|
||||||
extern uint master_port, master_connect_retry, report_port;
|
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)
|
(*param->item)->val() < 0)
|
||||||
{
|
{
|
||||||
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
|
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();
|
pc->max_tree_elements = (uint) (*param->item)->val_int();
|
||||||
param = param->next;
|
param = param->next;
|
||||||
if (param->next) // no third parameter possible
|
if (param->next) // no third parameter possible
|
||||||
{
|
{
|
||||||
net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name);
|
net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name);
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
// second parameter
|
// second parameter
|
||||||
if ((*param->item)->type() != Item::INT_ITEM ||
|
if ((*param->item)->type() != Item::INT_ITEM ||
|
||||||
(*param->item)->val() < 0)
|
(*param->item)->val() < 0)
|
||||||
{
|
{
|
||||||
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
|
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
pc->max_treemem = (uint) (*param->item)->val_int();
|
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)
|
(*param->item)->val() < 0)
|
||||||
{
|
{
|
||||||
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
|
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
|
// if only one parameter was given, it will be the value of max_tree_elements
|
||||||
else
|
else
|
||||||
@ -148,21 +148,26 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||||||
if (item->result_type() == STRING_RESULT)
|
if (item->result_type() == STRING_RESULT)
|
||||||
*f_info++ = new field_str(item, pc);
|
*f_info++ = new field_str(item, pc);
|
||||||
}
|
}
|
||||||
return pc;
|
DBUG_RETURN(pc);
|
||||||
} // proc_analyse_init
|
}
|
||||||
|
|
||||||
|
|
||||||
// return 1 if number, else return 0
|
/*
|
||||||
// store info about found number in info
|
Return 1 if number, else return 0
|
||||||
// NOTE:It is expected, that elements of 'info' are all zero!
|
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)
|
bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
|
||||||
{
|
{
|
||||||
const char *begin, *end = str + str_len;
|
const char *begin, *end = str + str_len;
|
||||||
|
|
||||||
DBUG_ENTER("test_if_number");
|
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++) ;
|
for (; str != end && isspace(*str); str++) ;
|
||||||
if (str == end)
|
if (str == end)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -704,17 +704,17 @@ Query_cache::Query_cache(ulong query_cache_limit,
|
|||||||
query_cache_limit(query_cache_limit),
|
query_cache_limit(query_cache_limit),
|
||||||
queries_in_cache(0), hits(0), inserts(0), refused(0),
|
queries_in_cache(0), hits(0), inserts(0), refused(0),
|
||||||
total_blocks(0),
|
total_blocks(0),
|
||||||
min_allocation_unit(min_allocation_unit),
|
min_allocation_unit(ALIGN_SIZE(min_allocation_unit)),
|
||||||
min_result_data_size(min_result_data_size),
|
min_result_data_size(ALIGN_SIZE(min_result_data_size)),
|
||||||
def_query_hash_size(def_query_hash_size),
|
def_query_hash_size(ALIGN_SIZE(def_query_hash_size)),
|
||||||
def_table_hash_size(def_table_hash_size),
|
def_table_hash_size(ALIGN_SIZE(def_table_hash_size)),
|
||||||
initialized(0)
|
initialized(0)
|
||||||
{
|
{
|
||||||
ulong min_needed=(ALIGN_SIZE(sizeof(Query_cache_block)) +
|
ulong min_needed=(ALIGN_SIZE(sizeof(Query_cache_block)) +
|
||||||
ALIGN_SIZE(sizeof(Query_cache_block_table)) +
|
ALIGN_SIZE(sizeof(Query_cache_block_table)) +
|
||||||
ALIGN_SIZE(sizeof(Query_cache_query)) + 3);
|
ALIGN_SIZE(sizeof(Query_cache_query)) + 3);
|
||||||
set_if_bigger(min_allocation_unit,min_needed);
|
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);
|
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);
|
invalidate_table((byte*) tables_used->key, tables_used->key_length);
|
||||||
DBUG_PRINT("qcache", (" db %s, table %s", tables_used->key,
|
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);
|
STRUCT_UNLOCK(&structure_guard_mutex);
|
||||||
@ -1218,6 +1219,7 @@ ulong Query_cache::init_cache()
|
|||||||
uint mem_bin_count, num, step;
|
uint mem_bin_count, num, step;
|
||||||
ulong mem_bin_size, prev_size, inc;
|
ulong mem_bin_size, prev_size, inc;
|
||||||
ulong additional_data_size, max_mem_bin_size, approx_additional_data_size;
|
ulong additional_data_size, max_mem_bin_size, approx_additional_data_size;
|
||||||
|
int align;
|
||||||
|
|
||||||
DBUG_ENTER("Query_cache::init_cache");
|
DBUG_ENTER("Query_cache::init_cache");
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
@ -1229,6 +1231,12 @@ ulong Query_cache::init_cache()
|
|||||||
goto err;
|
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.
|
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)) +
|
ALIGN_SIZE(ntab*sizeof(Query_cache_block_table)) +
|
||||||
header_len);
|
header_len);
|
||||||
ulong len = data_len + all_headers_len;
|
ulong len = data_len + all_headers_len;
|
||||||
|
ulong align_len= ALIGN_SIZE(len);
|
||||||
DBUG_ENTER("Query_cache::write_block_data");
|
DBUG_ENTER("Query_cache::write_block_data");
|
||||||
DBUG_PRINT("qcache", ("data: %ld, header: %ld, all header: %ld",
|
DBUG_PRINT("qcache", ("data: %ld, header: %ld, all header: %ld",
|
||||||
data_len, header_len, all_headers_len));
|
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);
|
1, 0, under_guard);
|
||||||
if (block != 0)
|
if (block != 0)
|
||||||
{
|
{
|
||||||
@ -1741,6 +1751,7 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
|
|||||||
ulong all_headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
|
ulong all_headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
|
||||||
ALIGN_SIZE(sizeof(Query_cache_result)));
|
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_ENTER("Query_cache::allocate_data_chain");
|
||||||
DBUG_PRINT("qcache", ("data_len %lu, all_headers_len %lu",
|
DBUG_PRINT("qcache", ("data_len %lu, all_headers_len %lu",
|
||||||
data_len, all_headers_len));
|
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 ?
|
ulong min_size = (first_block ?
|
||||||
get_min_first_result_data_size():
|
get_min_first_result_data_size():
|
||||||
get_min_append_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,
|
min_result_data_size == 0,
|
||||||
all_headers_len + min_result_data_size,
|
all_headers_len + min_result_data_size,
|
||||||
1);
|
1);
|
||||||
@ -1984,7 +1995,7 @@ Query_cache_block *
|
|||||||
Query_cache::allocate_block(ulong len, my_bool not_less, ulong min,
|
Query_cache::allocate_block(ulong len, my_bool not_less, ulong min,
|
||||||
my_bool under_guard)
|
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",
|
DBUG_PRINT("qcache", ("len %lu, not less %d, min %lu, uder_guard %d",
|
||||||
len, not_less,min,under_guard));
|
len, not_less,min,under_guard));
|
||||||
|
|
||||||
@ -2670,6 +2681,7 @@ my_bool Query_cache::move_by_type(byte **border,
|
|||||||
*before = new_block;
|
*before = new_block;
|
||||||
/* If result writing complete && we have free space in 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 &&
|
if (query->result()->type == Query_cache_block::RESULT &&
|
||||||
new_block->length > new_block->used &&
|
new_block->length > new_block->used &&
|
||||||
*gap + free_space > min_allocation_unit &&
|
*gap + free_space > min_allocation_unit &&
|
||||||
@ -2677,6 +2689,8 @@ my_bool Query_cache::move_by_type(byte **border,
|
|||||||
{
|
{
|
||||||
*border-= free_space;
|
*border-= free_space;
|
||||||
*gap+= free_space;
|
*gap+= free_space;
|
||||||
|
DBUG_PRINT("qcache",
|
||||||
|
("rest of result free space added to gap (%lu)", *gap));
|
||||||
new_block->length -= free_space;
|
new_block->length -= free_space;
|
||||||
}
|
}
|
||||||
BLOCK_UNLOCK_WR(query_block);
|
BLOCK_UNLOCK_WR(query_block);
|
||||||
@ -2737,7 +2751,7 @@ my_bool Query_cache::join_results(ulong join_limit)
|
|||||||
header->length() > join_limit)
|
header->length() > join_limit)
|
||||||
{
|
{
|
||||||
Query_cache_block *new_result_block =
|
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_block)) +
|
||||||
ALIGN_SIZE(sizeof(Query_cache_result)), 1, 0);
|
ALIGN_SIZE(sizeof(Query_cache_result)), 1, 0);
|
||||||
if (new_result_block != 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...",
|
DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
|
||||||
(ulong) block, (uint) block->type));
|
(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
|
// Check memory allocation
|
||||||
if (block->pnext == first_block) // Is it last block?
|
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)));
|
ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST)));
|
||||||
new_table->next = 0;
|
new_table->next = 0;
|
||||||
new_table->key_length = table->key_length;
|
new_table->key_length = table->key_length;
|
||||||
uint32 db_len = ((new_table->table_name =
|
::memcpy(new_table->key, table->table_cache_key, table->key_length);
|
||||||
::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);
|
|
||||||
return new_table;
|
return new_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,31 +60,33 @@ class Log_event;
|
|||||||
class MYSQL_LOG {
|
class MYSQL_LOG {
|
||||||
private:
|
private:
|
||||||
pthread_mutex_t LOCK_log, LOCK_index;
|
pthread_mutex_t LOCK_log, LOCK_index;
|
||||||
|
pthread_cond_t update_cond;
|
||||||
|
ulonglong bytes_written;
|
||||||
time_t last_time,query_start;
|
time_t last_time,query_start;
|
||||||
IO_CACHE log_file;
|
IO_CACHE log_file;
|
||||||
File index_file;
|
File index_file;
|
||||||
char *name;
|
char *name;
|
||||||
volatile enum_log_type log_type;
|
|
||||||
char time_buff[20],db[NAME_LEN+1];
|
char time_buff[20],db[NAME_LEN+1];
|
||||||
char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN];
|
char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN];
|
||||||
bool write_error,inited;
|
// current file sequence number for load data infile binary logging
|
||||||
uint file_id; // current file sequence number for load data infile
|
uint file_id;
|
||||||
// binary logging
|
uint open_count; // For replication
|
||||||
bool no_rotate; // for binlog - if log name can never change
|
/*
|
||||||
// we should not try to rotate it or write any rotation events
|
For binlog - if log name can never change we should not try to rotate it
|
||||||
// the user should use FLUSH MASTER instead of FLUSH LOGS for
|
or write any rotation events. The user should use FLUSH MASTER instead
|
||||||
// purging
|
of FLUSH LOGS for purging.
|
||||||
|
*/
|
||||||
|
volatile enum_log_type log_type;
|
||||||
enum cache_type io_cache_type;
|
enum cache_type io_cache_type;
|
||||||
|
bool write_error,inited;
|
||||||
|
bool no_rotate;
|
||||||
bool need_start_event;
|
bool need_start_event;
|
||||||
pthread_cond_t update_cond;
|
|
||||||
bool no_auto_events; // for relay binlog
|
bool no_auto_events; // for relay binlog
|
||||||
ulonglong bytes_written;
|
|
||||||
friend class Log_event;
|
friend class Log_event;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MYSQL_LOG();
|
MYSQL_LOG();
|
||||||
~MYSQL_LOG();
|
~MYSQL_LOG();
|
||||||
pthread_mutex_t* get_log_lock() { return &LOCK_log; }
|
|
||||||
void reset_bytes_written()
|
void reset_bytes_written()
|
||||||
{
|
{
|
||||||
bytes_written = 0;
|
bytes_written = 0;
|
||||||
@ -96,12 +98,11 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
DBUG_ENTER("harvest_bytes_written");
|
DBUG_ENTER("harvest_bytes_written");
|
||||||
(*counter)+=bytes_written;
|
(*counter)+=bytes_written;
|
||||||
DBUG_PRINT("info",("counter=%s,bytes_written=%s", llstr(*counter,buf1),
|
DBUG_PRINT("info",("counter: %s bytes_written: %s", llstr(*counter,buf1),
|
||||||
llstr(bytes_written,buf2)));
|
llstr(bytes_written,buf2)));
|
||||||
bytes_written=0;
|
bytes_written=0;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
IO_CACHE* get_log_file() { return &log_file; }
|
|
||||||
void signal_update() { pthread_cond_broadcast(&update_cond);}
|
void signal_update() { pthread_cond_broadcast(&update_cond);}
|
||||||
void wait_for_update(THD* thd);
|
void wait_for_update(THD* thd);
|
||||||
void set_need_start_event() { need_start_event = 1; }
|
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_logs(THD* thd, const char* to_log);
|
||||||
int purge_first_log(struct st_relay_log_info* rli);
|
int purge_first_log(struct st_relay_log_info* rli);
|
||||||
int reset_logs(THD* thd);
|
int reset_logs(THD* thd);
|
||||||
void close(bool exiting = 0); // if we are exiting, we also want to close the
|
// if we are exiting, we also want to close the index file
|
||||||
// index file
|
void close(bool exiting = 0);
|
||||||
|
|
||||||
// iterating through the log index file
|
// iterating through the log index file
|
||||||
int find_first_log(LOG_INFO* linfo, const char* log_name,
|
int find_first_log(LOG_INFO* linfo, const char* log_name,
|
||||||
@ -146,11 +147,15 @@ public:
|
|||||||
uint next_file_id();
|
uint next_file_id();
|
||||||
|
|
||||||
inline bool is_open() { return log_type != LOG_CLOSED; }
|
inline bool is_open() { return log_type != LOG_CLOSED; }
|
||||||
char* get_index_fname() { return index_file_name;}
|
inline char* get_index_fname() { return index_file_name;}
|
||||||
char* get_log_fname() { return log_file_name; }
|
inline char* get_log_fname() { return log_file_name; }
|
||||||
void lock_index() { pthread_mutex_lock(&LOCK_index);}
|
inline pthread_mutex_t* get_log_lock() { return &LOCK_log; }
|
||||||
void unlock_index() { pthread_mutex_unlock(&LOCK_index);}
|
inline IO_CACHE* get_log_file() { return &log_file; }
|
||||||
File get_index_file() { return index_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 */
|
/* character conversion tables */
|
||||||
|
@ -332,7 +332,7 @@ bool mysql_change_db(THD *thd,const char *name)
|
|||||||
uint db_access;
|
uint db_access;
|
||||||
DBUG_ENTER("mysql_change_db");
|
DBUG_ENTER("mysql_change_db");
|
||||||
|
|
||||||
if (!dbname || !(db_length=stripp_sp(dbname)))
|
if (!dbname || !(db_length=strip_sp(dbname)))
|
||||||
{
|
{
|
||||||
x_free(dbname); /* purecov: inspected */
|
x_free(dbname); /* purecov: inspected */
|
||||||
send_error(&thd->net,ER_NO_DB_ERROR); /* 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
|
send_ok(&thd->net); // This should return record count
|
||||||
}
|
}
|
||||||
|
VOID(pthread_mutex_lock(&LOCK_open));
|
||||||
unlock_table_name(thd, table_list);
|
unlock_table_name(thd, table_list);
|
||||||
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||||
}
|
}
|
||||||
else if (error)
|
else if (error)
|
||||||
|
{
|
||||||
|
VOID(pthread_mutex_lock(&LOCK_open));
|
||||||
unlock_table_name(thd, table_list);
|
unlock_table_name(thd, table_list);
|
||||||
|
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||||
|
}
|
||||||
DBUG_RETURN(error ? -1 : 0);
|
DBUG_RETURN(error ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
|
|||||||
{
|
{
|
||||||
char buff[160];
|
char buff[160];
|
||||||
if (duplic == DUP_IGNORE)
|
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);
|
thd->cuted_fields);
|
||||||
else
|
else
|
||||||
sprintf(buff,ER(ER_INSERT_INFO),info.records,info.deleted,
|
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->connections = 1;
|
||||||
uc->questions=uc->updates=uc->conn_per_hour=0;
|
uc->questions=uc->updates=uc->conn_per_hour=0;
|
||||||
uc->user_resources=*mqh;
|
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->user_resources.connections = max_user_connections;
|
||||||
uc->intime=thd->thr_create_time;
|
uc->intime=thd->thr_create_time;
|
||||||
if (hash_insert(&hash_user_connections, (byte*) uc))
|
if (hash_insert(&hash_user_connections, (byte*) uc))
|
||||||
@ -317,12 +317,7 @@ static void decrease_user_connections(USER_CONN *uc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
DBUG_ENTER("decrease_user_connections");
|
DBUG_ENTER("decrease_user_connections");
|
||||||
if (mqh_used)
|
if (!mqh_used && uc->connections && !--uc->connections)
|
||||||
{
|
|
||||||
if (uc->conn_per_hour)
|
|
||||||
uc->conn_per_hour--;
|
|
||||||
}
|
|
||||||
else if (!--uc->connections)
|
|
||||||
{
|
{
|
||||||
/* Last connection for user; Delete it */
|
/* Last connection for user; Delete it */
|
||||||
(void) pthread_mutex_lock(&LOCK_user_conn);
|
(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
|
#if !defined( __WIN__) && !defined(OS2) // Win32 calls this in pthread_create
|
||||||
// The following calls needs to be done before we call DBUG_ macros
|
// 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);
|
close_connection(&thd->net,ER_OUT_OF_RESOURCES);
|
||||||
statistic_increment(aborted_connects,&LOCK_thread_count);
|
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);
|
thread_safe_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_thread_count);
|
||||||
char *db=thd->strdup(packet);
|
char *db=thd->strdup(packet);
|
||||||
// null test to handle EOM
|
// 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");
|
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
|
||||||
break;
|
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);
|
thread_safe_increment(com_stat[SQLCOM_DROP_DB],&LOCK_thread_count);
|
||||||
char *db=thd->strdup(packet);
|
char *db=thd->strdup(packet);
|
||||||
// null test to handle EOM
|
// 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");
|
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
|
||||||
break;
|
break;
|
||||||
@ -1797,6 +1792,7 @@ mysql_execute_command(void)
|
|||||||
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
|
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
|
||||||
if ((res=open_and_lock_tables(thd,tables)))
|
if ((res=open_and_lock_tables(thd,tables)))
|
||||||
break;
|
break;
|
||||||
|
thd->select_limit=HA_POS_ERROR;
|
||||||
if (!setup_fields(thd,tables,select_lex->item_list,1,0,0) &&
|
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 &&
|
!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,
|
(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->lock_type=walk->lock_type=TL_WRITE;
|
||||||
auxi->table= (TABLE *) walk; // Remember corresponding table
|
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);
|
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
|
||||||
if (add_item_to_list(new Item_null()))
|
|
||||||
{
|
|
||||||
res= -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
thd->proc_info="init";
|
thd->proc_info="init";
|
||||||
if ((res=open_and_lock_tables(thd,tables)))
|
if ((res=open_and_lock_tables(thd,tables)))
|
||||||
break;
|
break;
|
||||||
@ -2241,7 +2233,7 @@ mysql_execute_command(void)
|
|||||||
break;
|
break;
|
||||||
case SQLCOM_CREATE_DB:
|
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);
|
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
|
||||||
break;
|
break;
|
||||||
@ -2253,7 +2245,7 @@ mysql_execute_command(void)
|
|||||||
}
|
}
|
||||||
case SQLCOM_DROP_DB:
|
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);
|
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
|
||||||
break;
|
break;
|
||||||
@ -2440,7 +2432,6 @@ mysql_execute_command(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
res= -1;
|
res= -1;
|
||||||
thd->transaction.cleanup();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SQLCOM_ROLLBACK:
|
case SQLCOM_ROLLBACK:
|
||||||
@ -2455,7 +2446,6 @@ mysql_execute_command(void)
|
|||||||
else
|
else
|
||||||
res= -1;
|
res= -1;
|
||||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
||||||
thd->transaction.cleanup();
|
|
||||||
break;
|
break;
|
||||||
default: /* Impossible */
|
default: /* Impossible */
|
||||||
send_ok(&thd->net);
|
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,
|
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))
|
0, no_errors))
|
||||||
return TRUE; // Access denied
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (grant_option)
|
if (grant_option)
|
||||||
return check_grant(thd,want_access & ~EXTRA_ACL,org_tables,
|
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;
|
lex->sql_command = SQLCOM_DELETE_MULTI;
|
||||||
mysql_init_select(lex);
|
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->auxilliary_table_list=lex->select_lex.table_list;
|
||||||
lex->select->table_list.elements=0;
|
lex->select->table_list.elements=0;
|
||||||
lex->select->table_list.first=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_STRING:
|
||||||
case FIELD_TYPE_VAR_STRING:
|
case FIELD_TYPE_VAR_STRING:
|
||||||
case FIELD_TYPE_NULL:
|
case FIELD_TYPE_NULL:
|
||||||
|
case FIELD_TYPE_GEOMETRY:
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_DECIMAL:
|
case FIELD_TYPE_DECIMAL:
|
||||||
if (!length)
|
if (!length)
|
||||||
@ -2991,7 +2991,9 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
|||||||
new_field->interval=interval;
|
new_field->interval=interval;
|
||||||
new_field->length=0;
|
new_field->length=0;
|
||||||
for (const char **pos=interval->type_names; *pos ; pos++)
|
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--;
|
new_field->length--;
|
||||||
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
||||||
if (default_value)
|
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->interval=interval;
|
||||||
new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe
|
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++)
|
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_bigger(new_field->length,length);
|
||||||
}
|
}
|
||||||
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
|
||||||
|
@ -27,11 +27,9 @@
|
|||||||
|
|
||||||
extern const char* any_db;
|
extern const char* any_db;
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
int max_binlog_dump_events = 0; // unlimited
|
int max_binlog_dump_events = 0; // unlimited
|
||||||
bool opt_sporadic_binlog_dump_fail = 0;
|
bool opt_sporadic_binlog_dump_fail = 0;
|
||||||
static int binlog_dump_count = 0;
|
static int binlog_dump_count = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
int check_binlog_magic(IO_CACHE* log, const char** errmsg)
|
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)
|
const char **errmsg)
|
||||||
{
|
{
|
||||||
File file;
|
File file;
|
||||||
|
DBUG_ENTER("open_binlog");
|
||||||
|
|
||||||
if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0 ||
|
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,
|
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))
|
if (check_binlog_magic(log,errmsg))
|
||||||
goto err;
|
goto err;
|
||||||
return file;
|
DBUG_RETURN(file);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (file >= 0)
|
if (file >= 0)
|
||||||
@ -174,7 +173,7 @@ err:
|
|||||||
my_close(file,MYF(0));
|
my_close(file,MYF(0));
|
||||||
end_io_cache(log);
|
end_io_cache(log);
|
||||||
}
|
}
|
||||||
return -1;
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -630,6 +629,7 @@ int reset_slave(MASTER_INFO* mi)
|
|||||||
char fname[FN_REFLEN];
|
char fname[FN_REFLEN];
|
||||||
int restart_thread_mask = 0,error=0;
|
int restart_thread_mask = 0,error=0;
|
||||||
const char* errmsg=0;
|
const char* errmsg=0;
|
||||||
|
DBUG_ENTER("reset_slave");
|
||||||
|
|
||||||
lock_slave_threads(mi);
|
lock_slave_threads(mi);
|
||||||
init_thread_mask(&restart_thread_mask,mi,0 /* not inverse */);
|
init_thread_mask(&restart_thread_mask,mi,0 /* not inverse */);
|
||||||
@ -658,7 +658,7 @@ int reset_slave(MASTER_INFO* mi)
|
|||||||
// TODO: fix error messages so they get to the client
|
// TODO: fix error messages so they get to the client
|
||||||
err:
|
err:
|
||||||
unlock_slave_threads(mi);
|
unlock_slave_threads(mi);
|
||||||
return error;
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void kill_zombie_dump_threads(uint32 slave_server_id)
|
void kill_zombie_dump_threads(uint32 slave_server_id)
|
||||||
|
@ -21,10 +21,8 @@ extern uint32 server_id;
|
|||||||
extern bool server_id_supplied;
|
extern bool server_id_supplied;
|
||||||
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
extern int max_binlog_dump_events;
|
extern int max_binlog_dump_events;
|
||||||
extern bool opt_sporadic_binlog_dump_fail;
|
extern bool opt_sporadic_binlog_dump_fail;
|
||||||
#endif
|
|
||||||
|
|
||||||
#define KICK_SLAVE(thd) thd->awake(0 /* do not prepare to die*/);
|
#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 void calc_group_buffer(JOIN *join,ORDER *group);
|
||||||
static bool alloc_group_fields(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 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 bool change_refs_to_tmp_fields(THD *thd, List<Item> &func);
|
||||||
static void init_tmptable_sum_functions(Item_sum **func);
|
static void init_tmptable_sum_functions(Item_sum **func);
|
||||||
static void update_tmptable_sum_func(Item_sum **func,TABLE *tmp_table);
|
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;
|
tmp_table=tmp_table2;
|
||||||
join.join_tab[0].table=0; // Table is freed
|
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;
|
goto err;
|
||||||
join.tmp_table_param.field_count+=join.tmp_table_param.sum_func_count;
|
join.tmp_table_param.field_count+=join.tmp_table_param.sum_func_count;
|
||||||
join.tmp_table_param.sum_func_count=0;
|
join.tmp_table_param.sum_func_count=0;
|
||||||
@ -6764,7 +6764,7 @@ make_sum_func_list(JOIN *join,List<Item> &fields)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static bool
|
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);
|
List_iterator<Item> it(items);
|
||||||
Item *item_field,*item;
|
Item *item_field,*item;
|
||||||
@ -6776,6 +6776,11 @@ change_to_use_tmp_fields(List<Item> &items)
|
|||||||
continue;
|
continue;
|
||||||
if (item->type() == Item::FIELD_ITEM)
|
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)->field=
|
||||||
((Item_field*) item)->result_field;
|
((Item_field*) item)->result_field;
|
||||||
}
|
}
|
||||||
|
@ -432,6 +432,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
|||||||
TABLE *table;
|
TABLE *table;
|
||||||
handler *file;
|
handler *file;
|
||||||
char tmp[MAX_FIELD_WIDTH];
|
char tmp[MAX_FIELD_WIDTH];
|
||||||
|
Item *item;
|
||||||
CONVERT *convert=thd->convert_set;
|
CONVERT *convert=thd->convert_set;
|
||||||
DBUG_ENTER("mysqld_show_fields");
|
DBUG_ENTER("mysqld_show_fields");
|
||||||
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
|
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("Type",40));
|
||||||
field_list.push_back(new Item_empty_string("Null",1));
|
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("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));
|
field_list.push_back(new Item_empty_string("Extra",20));
|
||||||
if (verbose)
|
if (verbose)
|
||||||
field_list.push_back(new Item_empty_string("Privileges",80));
|
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";
|
thd->proc_info="init";
|
||||||
table_name=table_list->real_name;
|
table_name=table_list->real_name;
|
||||||
db=table_list->db;
|
db=table_list->db;
|
||||||
if (!new_db)
|
if (!new_db || !strcmp(new_db,db))
|
||||||
new_db=db;
|
new_db=db;
|
||||||
used_fields=create_info->used_fields;
|
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 */
|
/* In some simple cases we need not to recreate the table */
|
||||||
|
|
||||||
thd->proc_info="setup";
|
thd->proc_info="setup";
|
||||||
if (simple_alter)
|
if (simple_alter && !table->tmp_table)
|
||||||
{
|
{
|
||||||
error=0;
|
error=0;
|
||||||
if (new_name != table_name)
|
if (new_name != table_name || new_db != db)
|
||||||
{
|
{
|
||||||
thd->proc_info="rename";
|
thd->proc_info="rename";
|
||||||
VOID(pthread_mutex_lock(&LOCK_open));
|
VOID(pthread_mutex_lock(&LOCK_open));
|
||||||
@ -1315,9 +1315,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
}
|
}
|
||||||
if (!error)
|
if (!error)
|
||||||
{
|
{
|
||||||
switch (keys_onoff)
|
switch (keys_onoff) {
|
||||||
{
|
case LEAVE_AS_IS:
|
||||||
case LEAVE_AS_IS: break;
|
break;
|
||||||
case ENABLE:
|
case ENABLE:
|
||||||
error=table->file->activate_all_index(thd);
|
error=table->file->activate_all_index(thd);
|
||||||
break;
|
break;
|
||||||
@ -1720,7 +1720,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
thd->proc_info="rename result table";
|
thd->proc_info="rename result table";
|
||||||
sprintf(old_name,"%s2-%lx-%lx", tmp_file_prefix, current_pid,
|
sprintf(old_name,"%s2-%lx-%lx", tmp_file_prefix, current_pid,
|
||||||
thd->thread_id);
|
thd->thread_id);
|
||||||
if (new_name != table_name)
|
if (new_name != table_name || new_db != db)
|
||||||
{
|
{
|
||||||
if (!access(new_name_buff,F_OK))
|
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
|
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
|
table_name=thd->strdup(table_name); // must be saved
|
||||||
if (close_cached_table(thd,table))
|
if (close_cached_table(thd,table))
|
||||||
|
@ -1069,7 +1069,8 @@ attribute:
|
|||||||
| AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
|
| AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
|
||||||
| PRIMARY_SYM KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
|
| PRIMARY_SYM KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
|
||||||
| UNIQUE_SYM { Lex->type|= UNIQUE_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:
|
opt_binary:
|
||||||
/* empty */ {}
|
/* empty */ {}
|
||||||
@ -1204,7 +1205,6 @@ alter_list_item:
|
|||||||
lex->default_value, $3.str,
|
lex->default_value, $3.str,
|
||||||
lex->interval))
|
lex->interval))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
lex->simple_alter=0;
|
|
||||||
}
|
}
|
||||||
opt_place
|
opt_place
|
||||||
| DROP opt_column field_ident opt_restrict
|
| DROP opt_column field_ident opt_restrict
|
||||||
@ -1245,7 +1245,6 @@ alter_list_item:
|
|||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
lex->select->db=$3->db.str;
|
lex->select->db=$3->db.str;
|
||||||
lex->name= $3->table.str;
|
lex->name= $3->table.str;
|
||||||
lex->simple_alter=0;
|
|
||||||
}
|
}
|
||||||
| create_table_options { Lex->simple_alter=0; }
|
| create_table_options { Lex->simple_alter=0; }
|
||||||
| order_clause { 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 {
|
typedef struct st_changed_table_list {
|
||||||
struct st_changed_table_list *next;
|
struct st_changed_table_list *next;
|
||||||
char *key, *table_name;
|
char *key;
|
||||||
uint32 key_length;
|
uint32 key_length;
|
||||||
} CHANGED_TABLE_LIST;
|
} CHANGED_TABLE_LIST;
|
||||||
|
|
||||||
|
@ -129,6 +129,10 @@ bfill((A)->null_flags,(A)->null_bytes,255);\
|
|||||||
*/
|
*/
|
||||||
#define MIN_TURBOBM_PATTERN_LEN 3
|
#define MIN_TURBOBM_PATTERN_LEN 3
|
||||||
|
|
||||||
|
/* Defines for binary logging */
|
||||||
|
|
||||||
|
#define BIN_LOG_HEADER_SIZE 4
|
||||||
|
|
||||||
/* Include prototypes for unireg */
|
/* Include prototypes for unireg */
|
||||||
|
|
||||||
#include "mysqld_error.h"
|
#include "mysqld_error.h"
|
||||||
|
@ -35,8 +35,23 @@ set-variable = thread_cache=8
|
|||||||
# Try number of CPU's*2 for thread_concurrency
|
# Try number of CPU's*2 for thread_concurrency
|
||||||
set-variable = thread_concurrency=8
|
set-variable = thread_concurrency=8
|
||||||
set-variable = myisam_sort_buffer_size=64M
|
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
|
# Point the following paths to different dedicated disks
|
||||||
#tmpdir = /tmp/
|
#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>
|
#include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MANAGER_VERSION "1.1"
|
#define MANAGER_VERSION "1.2"
|
||||||
#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.0"
|
#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.2"
|
||||||
|
|
||||||
#define LOG_ERR 1
|
#define LOG_ERR 1
|
||||||
#define LOG_WARN 2
|
#define LOG_WARN 2
|
||||||
@ -1332,11 +1332,8 @@ static int parse_args(int argc, char **argv)
|
|||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
exit(ho_error);
|
||||||
printf("%s: handle_options() failed with error %d\n", my_progname,
|
|
||||||
ho_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +36,14 @@ const char *VER="0.2";
|
|||||||
const char *default_dbug_option="d:t:O,-";
|
const char *default_dbug_option="d:t:O,-";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
fatal_error( const char* r)
|
fatal_error( const char* r)
|
||||||
{
|
{
|
||||||
perror(r);
|
perror(r);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int sd;
|
int sd;
|
||||||
@ -72,11 +74,11 @@ client_thread( void* arg)
|
|||||||
{
|
{
|
||||||
my_thread_init();
|
my_thread_init();
|
||||||
do_ssl_stuff((TH_ARGS*)arg);
|
do_ssl_stuff((TH_ARGS*)arg);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main( int argc __attribute__((unused)),
|
main(int argc __attribute__((unused)), char** argv)
|
||||||
char** argv)
|
|
||||||
{
|
{
|
||||||
char server_key[] = "../SSL/server-key.pem",
|
char server_key[] = "../SSL/server-key.pem",
|
||||||
server_cert[] = "../SSL/server-cert.pem";
|
server_cert[] = "../SSL/server-cert.pem";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user