Commit 22075460 authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into narttu.mysql.fi:/my/mysql-4.1
parents 1c9e9bb6 a7708c79
...@@ -30,6 +30,7 @@ chomp ($LOGFILE= `pwd`); ...@@ -30,6 +30,7 @@ chomp ($LOGFILE= `pwd`);
$LOGFILE.= "/Bootstrap.log"; $LOGFILE.= "/Bootstrap.log";
chomp ($opt_directory= `pwd`); chomp ($opt_directory= `pwd`);
$opt_docdir= $opt_directory . "/mysqldoc"; $opt_docdir= $opt_directory . "/mysqldoc";
$opt_build_command= undef;
$opt_changelog= undef; $opt_changelog= undef;
$opt_delete= undef; $opt_delete= undef;
$opt_dry_run= undef; $opt_dry_run= undef;
...@@ -44,6 +45,7 @@ $opt_skip_manual= undef; ...@@ -44,6 +45,7 @@ $opt_skip_manual= undef;
$version= "unknown"; $version= "unknown";
GetOptions( GetOptions(
"build-command|b=s",
"changelog|c:s", "changelog|c:s",
"directory|d=s", "directory|d=s",
"delete", "delete",
...@@ -54,7 +56,6 @@ GetOptions( ...@@ -54,7 +56,6 @@ GetOptions(
"log|l:s", "log|l:s",
"mail|m=s", "mail|m=s",
"revision|r=s", "revision|r=s",
"revision|r=s",
"skip-check|s", "skip-check|s",
"skip-manual", "skip-manual",
"suffix=s", "suffix=s",
...@@ -81,6 +82,14 @@ if (defined $opt_log) ...@@ -81,6 +82,14 @@ if (defined $opt_log)
} }
} }
#
# Override predefined build command
#
if (defined $opt_build_command)
{
$build_command= $opt_build_command;
}
print_help("") if ($opt_help); print_help("") if ($opt_help);
defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!"); defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!");
...@@ -329,36 +338,41 @@ archive is being created. ...@@ -329,36 +338,41 @@ archive is being created.
Options: Options:
-c, --changelog[=<rev>] Add a ChangeLog [down to revision <rev>] -b, --build-command=<cmd> Use <cmd> to compile the sources before packing
This will automatically be included in the source the distribution.
distribution. To get a ChangeLog down to the last (default is "$build_command")
tagged Changeset, simply use "last" as the revision -c, --changelog[=<rev>] Add a ChangeLog [down to revision <rev>]
number. This will automatically be included in the source
--delete Delete an already existing distribution directory distribution. To get a ChangeLog down to the last
in the target directory instead of renaming it. tagged Changeset, simply use "last" as the revision
-d, --directory=<dir> Specify the target directory number.
(default is "$opt_directory") --delete Delete an already existing distribution directory
--docdir=<dir> Use the MySQL documentation BK tree located in in <dir> in the target directory instead of renaming it.
(default is "$opt_docdir") -d, --directory=<dir> Specify the target directory
--dry-run Dry run without executing (default is "$opt_directory")
-e, --export-only Just export (and add the ChangeLog, if requested), --docdir=<dir> Use the MySQL documentation BK tree located
do not build or test the source distribution in <dir>
-h, --help Print this help message (default is "$opt_docdir")
-l, --log[=<filename>] Write a log file [to <filename>] --dry-run Dry run without executing
(default is "$LOGFILE") -e, --export-only Just export (and add the ChangeLog, if requested),
-m, --mail=<address> Mail a failure report to the given address (and do not build or test the source distribution
include a log file snippet, if logging is enabled) -h, --help Print this help message
Note that the \@-Sign needs to be quoted! -l, --log[=<filename>] Write a log file [to <filename>]
Example: --mail=user\\\@domain.com (default is "$LOGFILE")
-r, --revision=<rev> Export the tree as of revision <rev> -m, --mail=<address> Mail a failure report to the given address (and
(default is up to the latest revision) include a log file snippet, if logging is enabled)
-s, --skip-check Skip checking the distribution with "make distcheck" Note that the \@-Sign needs to be quoted!
--skip-manual Skip updating the manual from the mysqldoc tree Example: --mail=user\\\@domain.com
--suffix=<suffix> Append <suffix> to the version number in configure.in. -r, --revision=<rev> Export the tree as of revision <rev>
Using the special suffix "YMD" will add the current (default is up to the latest revision)
date as the suffix (e.g. "-20020518"). -s, --skip-check Skip checking the distribution with "make distcheck"
-t, --test Run the test suite after build --skip-manual Skip updating the manual from the mysqldoc tree
-v, --verbose Be verbose --suffix=<suffix> Append <suffix> to the version number in
configure.in. Using the special suffix "YMD" will
add the current date as the suffix
(e.g. "-20020518").
-t, --test Run the test suite after build
-v, --verbose Be verbose
Example: Example:
......
...@@ -37,6 +37,7 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, ...@@ -37,6 +37,7 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL, OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL,
OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE, OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
OPT_DELETE_MASTER_LOGS,
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION, OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT }; OPT_COMPATIBLE, OPT_RECONNECT };
...@@ -845,8 +845,8 @@ static int read_lines(bool execute_commands) ...@@ -845,8 +845,8 @@ static int read_lines(bool execute_commands)
/* Remove the '\n' */ /* Remove the '\n' */
{ {
char *p = strrchr(line, '\n'); char *p = strrchr(line, '\n');
if (p != NULL) if (p != NULL)
*p = '\0'; *p = '\0';
} }
#else #else
linebuffer[0]= (char) sizeof(linebuffer); linebuffer[0]= (char) sizeof(linebuffer);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
** Added --single-transaction option 06/06/2002 by Peter Zaitsev ** Added --single-transaction option 06/06/2002 by Peter Zaitsev
*/ */
#define DUMP_VERSION "10.1" #define DUMP_VERSION "10.2"
#include <my_global.h> #include <my_global.h>
#include <my_sys.h> #include <my_sys.h>
...@@ -79,7 +79,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1, ...@@ -79,7 +79,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0, opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0, opt_alldbs=0,opt_create_db=0,opt_first_slave=0,
opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0, opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
tty_password=0,opt_single_transaction=0; opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0;
static MYSQL mysql_connection,*sock=0; static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0, *current_host=0,*path=0,*fields_terminated=0,
...@@ -153,6 +154,9 @@ static struct my_option my_long_options[] = ...@@ -153,6 +154,9 @@ static struct my_option my_long_options[] =
{"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.", {"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.",
(gptr*) &opt_delayed, (gptr*) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, (gptr*) &opt_delayed, (gptr*) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
{"delete-master-logs", OPT_DELETE_MASTER_LOGS,
"Delete logs on master after backup. This will automagically enable --first-slave.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-keys", 'K', {"disable-keys", 'K',
"'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (gptr*) &opt_disable_keys, "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (gptr*) &opt_disable_keys,
(gptr*) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, (gptr*) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
...@@ -354,15 +358,20 @@ static void write_footer(FILE *sql_file) ...@@ -354,15 +358,20 @@ static void write_footer(FILE *sql_file)
} /* write_footer */ } /* write_footer */
static my_bool static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument) char *argument)
{ {
switch(optid) { switch (optid) {
case OPT_MASTER_DATA: case OPT_MASTER_DATA:
opt_master_data=1; opt_master_data=1;
opt_first_slave=1; opt_first_slave=1;
break; break;
case OPT_DELETE_MASTER_LOGS:
opt_delete_master_logs=1;
opt_first_slave=1;
break;
case 'p': case 'p':
if (argument) if (argument)
{ {
...@@ -1590,6 +1599,11 @@ int main(int argc, char **argv) ...@@ -1590,6 +1599,11 @@ int main(int argc, char **argv)
if (opt_first_slave) if (opt_first_slave)
{ {
if (opt_delete_master_logs && mysql_query(sock, "FLUSH MASTER"))
{
my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s",
MYF(0), mysql_error(sock));
}
if (opt_master_data) if (opt_master_data)
{ {
if (mysql_query(sock, "SHOW MASTER STATUS") || if (mysql_query(sock, "SHOW MASTER STATUS") ||
...@@ -1611,9 +1625,6 @@ int main(int argc, char **argv) ...@@ -1611,9 +1625,6 @@ int main(int argc, char **argv)
mysql_free_result(master); mysql_free_result(master);
} }
} }
if (mysql_query(sock, "FLUSH MASTER"))
my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s",
MYF(0), mysql_error(sock));
if (mysql_query(sock, "UNLOCK TABLES")) if (mysql_query(sock, "UNLOCK TABLES"))
my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s", my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s",
MYF(0), mysql_error(sock)); MYF(0), mysql_error(sock));
......
...@@ -10,7 +10,7 @@ link_sources: ...@@ -10,7 +10,7 @@ link_sources:
DEFS = -DEMBEDDED_LIBRARY DEFS = -DEMBEDDED_LIBRARY
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \ INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client $(openssl_includes) -I$(top_srcdir) -I$(top_srcdir)/client $(openssl_includes)
LIBS = @LIBS@ LIBS = @LIBS@ @WRAPLIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @bdb_libs_with_path@ @LIBDL@ $(CXXLDFLAGS) LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @bdb_libs_with_path@ @LIBDL@ $(CXXLDFLAGS)
mysqltest_SOURCES = mysqltest.c mysqltest_SOURCES = mysqltest.c
......
...@@ -62,7 +62,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) ...@@ -62,7 +62,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
MI_DYN_DELETE_BLOCK_HEADER+1); MI_DYN_DELETE_BLOCK_HEADER+1);
reclength= (info->s->base.pack_reclength+ reclength= (info->s->base.pack_reclength + info->s->base.pack_bits +
_my_calc_total_blob_length(info,record)+ extra); _my_calc_total_blob_length(info,record)+ extra);
#ifdef NOT_USED /* We now support big rows */ #ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH) if (reclength > MI_DYN_MAX_ROW_LENGTH)
......
...@@ -240,6 +240,9 @@ CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"' ...@@ -240,6 +240,9 @@ CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"'
SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1; SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1;
CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter)
Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4 Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4
SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc;
bugdesc REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb')
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
drop table t1; drop table t1;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) TYPE=MyISAM; CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) TYPE=MyISAM;
INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf'); INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
......
...@@ -244,7 +244,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 ...@@ -244,7 +244,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
int, i999 int, i1000 int) row_format=dynamic; int, i999 int, i1000 int, b blob) row_format=dynamic;
insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
...@@ -283,7 +283,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...@@ -283,7 +283,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
drop table t1; drop table t1;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`post_id` mediumint(8) unsigned NOT NULL auto_increment, `post_id` mediumint(8) unsigned NOT NULL auto_increment,
......
...@@ -6,8 +6,19 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; ...@@ -6,8 +6,19 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
create table t1(a int not null auto_increment, b int, primary key(a) ); create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1; load data infile '../../std_data/rpl_loaddata.dat' into table t1;
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
select * from t1; select * from t1;
a b a b
1 10 1 10
2 15 2 15
select * from t3;
day id category name
2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
2003-04-22 2416 a bbbbb
drop table t1; drop table t1;
drop table t2;
drop table t3;
2003-01-21,6328,%a%,%aaaaa%
##
2003-02-22,2461,b,%a a a @@ @% @b ' " a%
##
2003-03-22,2161,%c%,%asdf%
##
2003-04-22,2416,%a%,%bbbbb%
##
...@@ -10,10 +10,10 @@ set SQL_LOG_BIN=0; ...@@ -10,10 +10,10 @@ set SQL_LOG_BIN=0;
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3;
--enable_warnings --enable_warnings
create table t4(n int); create table t4(n int);
--replace_result "errno: 2" "errno: X" "errno: 22" "errno: X" "errno: 23" "errno: X" --replace_result "errno: 1" "errno: X" "errno: 2" "errno: X" "errno: 22" "errno: X" "errno: 23" "errno: X"
backup table t4 to '../bogus'; backup table t4 to '../bogus';
backup table t4 to '../tmp'; backup table t4 to '../tmp';
--replace_result "errno: 17" "errno: X" --replace_result "errno: 7" "errno: X" "errno: 17" "errno: X"
backup table t4 to '../tmp'; backup table t4 to '../tmp';
drop table t4; drop table t4;
restore table t4 from '../tmp'; restore table t4 from '../tmp';
......
...@@ -121,6 +121,7 @@ INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ...@@ -121,6 +121,7 @@ INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') FROM t1; SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') FROM t1;
SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1; SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1;
SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1; SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1;
SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc;
drop table t1; drop table t1;
# #
......
...@@ -252,7 +252,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 ...@@ -252,7 +252,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
int, i999 int, i1000 int) row_format=dynamic; int, i999 int, i1000 int, b blob) row_format=dynamic;
insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
...@@ -291,7 +291,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...@@ -291,7 +291,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
drop table t1; drop table t1;
# #
......
# See if replication of a "LOAD DATA in an autoincrement column" # See if replication of a "LOAD DATA in an autoincrement column"
# Honours autoincrement values # Honours autoincrement values
# i.e. if the master and slave have the same sequence # i.e. if the master and slave have the same sequence
#
# check replication of load data for temporary tables with additional parameters
#
source include/master-slave.inc; source include/master-slave.inc;
create table t1(a int not null auto_increment, b int, primary key(a) ); create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1; load data infile '../../std_data/rpl_loaddata.dat' into table t1;
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
#load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionaly enclosed by '%' escaped by '@' lines terminated by '\n%%\n' ignore 1 lines;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
select * from t1;
select * from t1;
select * from t3;
connection master; connection master;
drop table t1; drop table t1;
drop table t2;
drop table t3;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
...@@ -380,11 +380,11 @@ static void netware_init() ...@@ -380,11 +380,11 @@ static void netware_init()
{ {
if (*name == '\\') if (*name == '\\')
{ {
*name = '/'; *name = '/';
} }
else else
{ {
*name = tolower(*name); *name = tolower(*name);
} }
} }
} }
......
File mode changed from 100644 to 100755
...@@ -141,7 +141,13 @@ if [ $BASE_SYSTEM = "netware" ] ; then ...@@ -141,7 +141,13 @@ if [ $BASE_SYSTEM = "netware" ] ; then
$CP -r netware/*.pl $BASE/scripts $CP -r netware/*.pl $BASE/scripts
fi fi
for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* libmysqld/libmysqld.a netware/libmysql.imp for i in \
libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* \
libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a \
libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* \
mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a \
libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* \
libmysqld/libmysqld.a netware/libmysql.imp
do do
if [ -f $i ] if [ -f $i ]
then then
......
...@@ -2210,6 +2210,40 @@ if ($limits{'foreign_key'} eq 'yes') ...@@ -2210,6 +2210,40 @@ if ($limits{'foreign_key'} eq 'yes')
} }
} }
if ($limits{'func_sql_character_length'} eq 'yes')
{
my $result = 'error';
my ($resultset);
my $key = 'length_of_varchar_field';
my $prompt='CHARACTER_LENGTH(varchar_field)';
print $prompt," = ";
if (!defined($limits{$key})) {
save_incomplete($key,$prompt);
safe_query_l($key,[
"CREATE TABLE crash_me1 (S1 VARCHAR(100))",
"INSERT INTO crash_me1 VALUES ('X')"
]);
my $recset = get_recordset($key,
"SELECT CHARACTER_LENGTH(S1) FROM crash_me1");
print_recordset($key,$recset);
if (defined($recset)){
if ( $recset->[0][0] eq 1 ) {
$result = 'actual length';
} elsif( $recset->[0][0] eq 100 ) {
$result = 'defined length';
};
} else {
add_log($key,$DBI::errstr);
}
safe_query_l($key, "drop table crash_me1 $drop_attr");
save_config_data($key,$result,$prompt);
} else {
$result = $limits{$key};
};
print "$result\n";
}
check_constraint("Column constraints","constraint_check", check_constraint("Column constraints","constraint_check",
"create table crash_q (a int check (a>0))", "create table crash_q (a int check (a>0))",
"insert into crash_q values(0)", "insert into crash_q values(0)",
...@@ -2873,6 +2907,81 @@ sub make_date { ...@@ -2873,6 +2907,81 @@ sub make_date {
} }
sub print_recordset{
my ($key,$recset) = @_;
my $rec;
foreach $rec (@$recset)
{
add_log($key, " > ".join(',', map(repr($_), @$rec)));
}
}
#
# read result recordset from sql server.
# returns arrayref to (arrayref to) values
# or undef (in case of sql errors)
#
sub get_recordset{
my ($key,$query) = @_;
add_log($key, "< $query");
return $dbh->selectall_arrayref($query);
}
# function for comparing recordset (that was returned by get_recordset)
# and arrayref of (arrayref of) values.
#
# returns : zero if recordset equal that array, 1 if it doesn't equal
#
# parameters:
# $key - current operation (for logging)
# $recset - recordset
# $mustbe - array of values that we expect
#
# example: $a=get_recordset('some_parameter','select a,b from c');
# if (compare_recordset('some_parameter',$a,[[1,1],[1,2],[1,3]]) neq 0)
# {
# print "unexpected result\n";
# } ;
#
sub compare_recordset {
my ($key,$recset,$mustbe) = @_;
my $rec,$recno,$fld,$fldno,$fcount;
add_log($key,"\n Check recordset:");
$recno=0;
foreach $rec (@$recset)
{
add_log($key," " . join(',', map(repr($_),@$rec)) . " expected: " .
join(',', map(repr($_), @{$mustbe->[$recno]} ) ));
$fcount = @$rec;
$fcount--;
foreach $fldno (0 .. $fcount )
{
if ($mustbe->[$recno][$fldno] ne $rec->[$fldno])
{
add_log($key," Recordset doesn't correspond with template");
return 1;
};
}
$recno++;
}
add_log($key," Recordset corresponds with template");
return 0;
}
#
# converts inner perl value to printable representation
# for example: undef maps to 'NULL',
# string -> 'string'
# int -> int
#
sub repr {
my $s = shift;
return "'$s'"if ($s =~ /\D/);
return 'NULL'if ( not defined($s));
return $s;
}
sub version sub version
{ {
print "$0 Ver $version\n"; print "$0 Ver $version\n";
......
...@@ -1051,7 +1051,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg, ...@@ -1051,7 +1051,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
&keyseg, &keyseg,
((table_arg->key_parts + table_arg->keys) * ((table_arg->key_parts + table_arg->keys) *
sizeof(HA_KEYSEG)), sizeof(HA_KEYSEG)),
0))) NullS)))
DBUG_RETURN(1); DBUG_RETURN(1);
pos=table_arg->key_info; pos=table_arg->key_info;
......
...@@ -814,7 +814,7 @@ void Item_func_replace::fix_length_and_dec() ...@@ -814,7 +814,7 @@ void Item_func_replace::fix_length_and_dec()
if (diff > 0 && args[1]->max_length) if (diff > 0 && args[1]->max_length)
{ // Calculate of maxreplaces { // Calculate of maxreplaces
uint max_substrs= max_length/args[1]->max_length; uint max_substrs= max_length/args[1]->max_length;
max_length+= max_substrs*(uint) diff; max_length+= max_substrs * (uint) diff;
} }
if (max_length > MAX_BLOB_WIDTH) if (max_length > MAX_BLOB_WIDTH)
{ {
......
...@@ -1670,6 +1670,8 @@ void sql_print_error(const char *format,...) ...@@ -1670,6 +1670,8 @@ void sql_print_error(const char *format,...)
char buff[1024]; char buff[1024];
my_vsnprintf(buff,sizeof(buff)-1,format,args); my_vsnprintf(buff,sizeof(buff)-1,format,args);
DBUG_PRINT("error",("%s",buff)); DBUG_PRINT("error",("%s",buff));
va_end(args);
va_start(args,format);
} }
#endif #endif
skr=time(NULL); skr=time(NULL);
......
...@@ -1136,9 +1136,9 @@ void Load_log_event::pack_info(Protocol *protocol) ...@@ -1136,9 +1136,9 @@ void Load_log_event::pack_info(Protocol *protocol)
pos+= fname_len; pos+= fname_len;
pos= strmov(pos, "' "); pos= strmov(pos, "' ");
if (sql_ex.opt_flags && REPLACE_FLAG ) if (sql_ex.opt_flags & REPLACE_FLAG)
pos= strmov(pos, " REPLACE "); pos= strmov(pos, " REPLACE ");
else if (sql_ex.opt_flags && IGNORE_FLAG ) else if (sql_ex.opt_flags & IGNORE_FLAG)
pos= strmov(pos, " IGNORE "); pos= strmov(pos, " IGNORE ");
pos= strmov(pos ,"INTO TABLE "); pos= strmov(pos ,"INTO TABLE ");
...@@ -1153,7 +1153,7 @@ void Load_log_event::pack_info(Protocol *protocol) ...@@ -1153,7 +1153,7 @@ void Load_log_event::pack_info(Protocol *protocol)
if (sql_ex.enclosed_len) if (sql_ex.enclosed_len)
{ {
if (sql_ex.opt_flags && OPT_ENCLOSED_FLAG ) if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
pos= strmov(pos, " OPTIONALLY "); pos= strmov(pos, " OPTIONALLY ");
pos= strmov(pos, " ENCLOSED BY "); pos= strmov(pos, " ENCLOSED BY ");
pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len); pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len);
...@@ -1279,18 +1279,18 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex, ...@@ -1279,18 +1279,18 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex,
sql_ex.cached_new_format = -1; sql_ex.cached_new_format = -1;
if (ex->dumpfile) if (ex->dumpfile)
sql_ex.opt_flags |= DUMPFILE_FLAG; sql_ex.opt_flags|= DUMPFILE_FLAG;
if (ex->opt_enclosed) if (ex->opt_enclosed)
sql_ex.opt_flags |= OPT_ENCLOSED_FLAG; sql_ex.opt_flags|= OPT_ENCLOSED_FLAG;
sql_ex.empty_flags = 0; sql_ex.empty_flags= 0;
switch (handle_dup) { switch (handle_dup) {
case DUP_IGNORE: case DUP_IGNORE:
sql_ex.opt_flags |= IGNORE_FLAG; sql_ex.opt_flags|= IGNORE_FLAG;
break; break;
case DUP_REPLACE: case DUP_REPLACE:
sql_ex.opt_flags |= REPLACE_FLAG; sql_ex.opt_flags|= REPLACE_FLAG;
break; break;
case DUP_UPDATE: // Impossible here case DUP_UPDATE: // Impossible here
case DUP_ERROR: case DUP_ERROR:
...@@ -1426,9 +1426,9 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -1426,9 +1426,9 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
fprintf(file, "LOCAL "); fprintf(file, "LOCAL ");
fprintf(file, "DATA INFILE '%-*s' ", fname_len, fname); fprintf(file, "DATA INFILE '%-*s' ", fname_len, fname);
if (sql_ex.opt_flags && REPLACE_FLAG ) if (sql_ex.opt_flags & REPLACE_FLAG)
fprintf(file," REPLACE "); fprintf(file," REPLACE ");
else if (sql_ex.opt_flags && IGNORE_FLAG ) else if (sql_ex.opt_flags & IGNORE_FLAG)
fprintf(file," IGNORE "); fprintf(file," IGNORE ");
fprintf(file, "INTO TABLE %s ", table_name); fprintf(file, "INTO TABLE %s ", table_name);
...@@ -1440,7 +1440,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -1440,7 +1440,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
if (sql_ex.enclosed) if (sql_ex.enclosed)
{ {
if (sql_ex.opt_flags && OPT_ENCLOSED_FLAG ) if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
fprintf(file," OPTIONALLY "); fprintf(file," OPTIONALLY ");
fprintf(file, " ENCLOSED BY "); fprintf(file, " ENCLOSED BY ");
pretty_print_str(file, sql_ex.enclosed, sql_ex.enclosed_len); pretty_print_str(file, sql_ex.enclosed, sql_ex.enclosed_len);
...@@ -1565,15 +1565,19 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ...@@ -1565,15 +1565,19 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
{ {
char llbuff[22]; char llbuff[22];
enum enum_duplicates handle_dup = DUP_IGNORE; enum enum_duplicates handle_dup = DUP_IGNORE;
if (sql_ex.opt_flags && REPLACE_FLAG) if (sql_ex.opt_flags & REPLACE_FLAG)
handle_dup = DUP_REPLACE; handle_dup= DUP_REPLACE;
sql_exchange ex((char*)fname, sql_ex.opt_flags && sql_exchange ex((char*)fname, sql_ex.opt_flags & DUMPFILE_FLAG);
DUMPFILE_FLAG );
String field_term(sql_ex.field_term,sql_ex.field_term_len,log_cs); String field_term(sql_ex.field_term,sql_ex.field_term_len,log_cs);
String enclosed(sql_ex.enclosed,sql_ex.enclosed_len,log_cs); String enclosed(sql_ex.enclosed,sql_ex.enclosed_len,log_cs);
String line_term(sql_ex.line_term,sql_ex.line_term_len,log_cs); String line_term(sql_ex.line_term,sql_ex.line_term_len,log_cs);
String line_start(sql_ex.line_start,sql_ex.line_start_len,log_cs); String line_start(sql_ex.line_start,sql_ex.line_start_len,log_cs);
String escaped(sql_ex.escaped,sql_ex.escaped_len, log_cs); String escaped(sql_ex.escaped,sql_ex.escaped_len, log_cs);
ex.field_term= &field_term;
ex.enclosed= &enclosed;
ex.line_term= &line_term;
ex.line_start= &line_start;
ex.escaped= &escaped;
ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG); ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
if (sql_ex.empty_flags & FIELD_TERM_EMPTY) if (sql_ex.empty_flags & FIELD_TERM_EMPTY)
...@@ -1582,7 +1586,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ...@@ -1582,7 +1586,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
ex.skip_lines = skip_lines; ex.skip_lines = skip_lines;
List<Item> field_list; List<Item> field_list;
set_fields(field_list); set_fields(field_list);
thd->variables.pseudo_thread_id= thd->thread_id; thd->variables.pseudo_thread_id= thread_id;
if (net) if (net)
{ {
// mysql_load will use thd->net to read the file // mysql_load will use thd->net to read the file
...@@ -1597,9 +1601,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ...@@ -1597,9 +1601,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
thd->query_error = 1; thd->query_error = 1;
if (thd->cuted_fields) if (thd->cuted_fields)
{ {
/* /*
log_pos is the position of the LOAD log_pos is the position of the LOAD event in the master log
event in the master log
*/ */
sql_print_error("Slave: load data infile at position %s in log \ sql_print_error("Slave: load data infile at position %s in log \
'%s' produced %d warning(s)", llstr(log_pos,llbuff), RPL_LOG_NAME, '%s' produced %d warning(s)", llstr(log_pos,llbuff), RPL_LOG_NAME,
......
...@@ -2047,7 +2047,7 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2047,7 +2047,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
size_t stack_size= 0; size_t stack_size= 0;
pthread_attr_getstacksize(&connection_attrib, &stack_size); pthread_attr_getstacksize(&connection_attrib, &stack_size);
/* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */ /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */
if (stack_size && stack_size != thread_stack) if (stack_size && stack_size < thread_stack)
{ {
if (global_system_variables.log_warnings) if (global_system_variables.log_warnings)
sql_print_error("Warning: Asked for %ld thread stack, but got %ld", sql_print_error("Warning: Asked for %ld thread stack, but got %ld",
...@@ -3632,7 +3632,7 @@ struct my_option my_long_options[] = ...@@ -3632,7 +3632,7 @@ struct my_option my_long_options[] =
"Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second)", "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second)",
(gptr*) &innobase_flush_log_at_trx_commit, (gptr*) &innobase_flush_log_at_trx_commit,
(gptr*) &innobase_flush_log_at_trx_commit, (gptr*) &innobase_flush_log_at_trx_commit,
0, GET_UINT, OPT_ARG, 0, 0, 2, 0, 0, 0}, 0, GET_UINT, OPT_ARG, 1, 0, 2, 0, 0, 0},
{"innodb_flush_method", OPT_INNODB_FLUSH_METHOD, {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
"With which method to flush data", (gptr*) &innobase_unix_file_flush_method, "With which method to flush data", (gptr*) &innobase_unix_file_flush_method,
(gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include "sql_acl.h" #include "sql_acl.h"
#include "hash_filo.h" #include "hash_filo.h"
#ifdef HAVE_REPLICATION
#include "sql_repl.h" //for tables_ok()
#endif
#include <m_ctype.h> #include <m_ctype.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -2128,6 +2131,15 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, ...@@ -2128,6 +2131,15 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_WRITE; tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_WRITE;
tables[0].db=tables[1].db=tables[2].db=(char*) "mysql"; tables[0].db=tables[1].db=tables[2].db=(char*) "mysql";
#ifdef HAVE_REPLICATION
/*
GRANT and REVOKE are applied the slave in/exclusion rules as they are
some kind of updates to the mysql.% tables.
*/
if (thd->slave_thread && table_rules_on && !tables_ok(0, tables))
DBUG_RETURN(0);
#endif
if (open_and_lock_tables(thd,tables)) if (open_and_lock_tables(thd,tables))
{ // Should never happen { // Should never happen
close_thread_tables(thd); /* purecov: deadcode */ close_thread_tables(thd); /* purecov: deadcode */
...@@ -2289,6 +2301,16 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, ...@@ -2289,6 +2301,16 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
tables[0].lock_type=tables[1].lock_type=TL_WRITE; tables[0].lock_type=tables[1].lock_type=TL_WRITE;
tables[0].db=tables[1].db=(char*) "mysql"; tables[0].db=tables[1].db=(char*) "mysql";
tables[0].table=tables[1].table=0; tables[0].table=tables[1].table=0;
#ifdef HAVE_REPLICATION
/*
GRANT and REVOKE are applied the slave in/exclusion rules as they are
some kind of updates to the mysql.% tables.
*/
if (thd->slave_thread && table_rules_on && !tables_ok(0, tables))
DBUG_RETURN(0);
#endif
if (open_and_lock_tables(thd,tables)) if (open_and_lock_tables(thd,tables))
{ // This should never happen { // This should never happen
close_thread_tables(thd); /* purecov: deadcode */ close_thread_tables(thd); /* purecov: deadcode */
......
...@@ -2468,6 +2468,19 @@ mysql_execute_command(THD *thd) ...@@ -2468,6 +2468,19 @@ mysql_execute_command(THD *thd)
break; break;
} }
} }
else
{
/*
If this is a slave thread, we may sometimes execute some
DROP / * 40005 TEMPORARY * / TABLE
that come from parts of binlogs (likely if we use RESET SLAVE or CHANGE
MASTER TO), while the temporary table has already been dropped.
To not generate such irrelevant "table does not exist errors", we
silently add IF EXISTS if TEMPORARY was used.
*/
if (thd->slave_thread)
lex->drop_if_exists= 1;
}
res= mysql_rm_table(thd,tables,lex->drop_if_exists, lex->drop_temporary); res= mysql_rm_table(thd,tables,lex->drop_if_exists, lex->drop_temporary);
} }
break; break;
......
...@@ -1330,7 +1330,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) ...@@ -1330,7 +1330,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thd_info->user=thd->strdup(tmp->user ? tmp->user : thd_info->user=thd->strdup(tmp->user ? tmp->user :
(tmp->system_thread ? (tmp->system_thread ?
"system user" : "unauthenticated user")); "system user" : "unauthenticated user"));
if (tmp->peer_port && (tmp->host || tmp->ip)) if (tmp->peer_port && (tmp->host || tmp->ip) && thd->host_or_ip[0])
{ {
if ((thd_info->host= thd->alloc(LIST_PROCESS_HOST_LEN+1))) if ((thd_info->host= thd->alloc(LIST_PROCESS_HOST_LEN+1)))
my_snprintf((char *) thd_info->host, LIST_PROCESS_HOST_LEN, my_snprintf((char *) thd_info->host, LIST_PROCESS_HOST_LEN,
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
int my_snprintf(char* to, size_t n, const char* fmt, ...) int my_snprintf(char* to, size_t n, const char* fmt, ...)
{ {
int result;
va_list args; va_list args;
int result; int result;
va_start(args,fmt); va_start(args,fmt);
...@@ -127,6 +128,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) ...@@ -127,6 +128,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
return (uint) (to - start); return (uint) (to - start);
} }
#ifdef MAIN #ifdef MAIN
#define OVERRUN_SENTRY 250 #define OVERRUN_SENTRY 250
static void my_printf(const char * fmt, ...) static void my_printf(const char * fmt, ...)
...@@ -147,6 +149,7 @@ static void my_printf(const char * fmt, ...) ...@@ -147,6 +149,7 @@ static void my_printf(const char * fmt, ...)
va_end(ar); va_end(ar);
} }
int main() int main()
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment