Commit 53ca5954 authored by unknown's avatar unknown

Merge with 4.0 to get bug fixes


Build-tools/Bootstrap:
  Auto merged
Build-tools/Do-compile:
  Auto merged
mysql-test/r/lowercase_table2.result:
  Auto merged
mysql-test/r/system_mysql_db.result:
  Auto merged
mysql-test/r/system_mysql_db_refs.result:
  Auto merged
mysql-test/t/system_mysql_db_fix-master.opt:
  Auto merged
mysql-test/t/system_mysql_db.test:
  Auto merged
parents 661b8165 ee989016
......@@ -46,6 +46,7 @@ $opt_test= undef;
$opt_skip_check= undef;
$opt_skip_manual= undef;
$opt_win_dist= undef;
$opt_quiet= undef;
$version= "unknown";
$major=$minor=$release=0;
......@@ -67,7 +68,8 @@ GetOptions(
"suffix=s",
"test|t",
"verbose|v",
"win-dist|w"
"win-dist|w",
"quiet|q",
) || print_help("");
#
......@@ -99,8 +101,6 @@ if (defined $opt_build_command)
print_help("") if ($opt_help);
defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!");
$subject= "Bootstrap of $REPO failed" if $opt_mail;
&logger("Starting build");
&abort("The directory \"$REPO\" could not be found!") if (!-d $REPO);
&logger("Using $REPO as the BK parent repository");
......@@ -306,7 +306,7 @@ if (!$opt_dry_run)
#
# Now build the source distribution
#
&logger("Compiling");
&logger("Compiling...");
$command= $build_command;
&run_command($command, "Compilation failed!");
......@@ -403,6 +403,7 @@ Options:
include a log file snippet, if logging is enabled)
Note that the \@-Sign needs to be quoted!
Example: --mail=user\\\@domain.com
-q, --quiet Be quiet
-p, --pull Update the source BK trees before building
-r, --revision=<rev> Export the tree as of revision <rev>
(default is up to the latest revision)
......
......@@ -204,6 +204,17 @@ if ($opt_stage == 0)
safe_cd($host);
if ($opt_stage == 0 && ! $opt_use_old_distribution)
{
$md5_result= safe_system("./my_md5sum -c ${opt_distribution}.md5");
if ($md5_result != 0)
{
abort("MD5 failed for $opt_distribution!");
}
else
{
info("SUCCESS: MD5 checks for $opt_distribution");
}
safe_system("gunzip < $opt_distribution | $tar xf -");
# Fix file times; This is needed because the time for files may be
......@@ -331,6 +342,9 @@ if ($opt_stage <= 3)
$tar_file=<$pwd/$host/mysql*.t*gz>;
abort ("Could not find tarball!") unless ($tar_file);
# Generate the MD5 for the binary distribution
safe_system("./my_md5sum $tar_file > ${tar_file}.md5}");
#
# Unpack the binary distribution
#
......@@ -660,7 +674,10 @@ sub safe_system
my($com,$res)=@_;
print LOG "$com\n";
print "$host: $com\n" if ($opt_debug);
system("$com >> $log 2>&1") && abort("error: Couldn't execute command, error: " . ($? / 256));
my $result= system("$com >> $log 2>&1");
abort("error: Couldn't execute command, error: " . ($? / 256)) unless $result == 0;
return $result;
}
sub check_system
......
......@@ -5,7 +5,10 @@
#
sub logger
{
my $message=$_[0];
my $message= $_[0];
my $cmnd= $_[1];
print $message . "\n" if !$opt_quiet && !$opt_verbose && !$cmnd;
print timestamp() . " " . $message . "\n" if $opt_verbose;
if (defined $opt_log && !$opt_dry_run)
{
......@@ -30,9 +33,12 @@ sub run_command
}
else
{
&logger($command);
$command.= " >> $LOGFILE 2>&1" if defined $opt_log;
$command.= " > /dev/null" if (!$opt_verbose && !$opt_log);
&logger($command, 1);
$command.= ';' unless ($command =~ m/^.*;$/);
$command =~ s/;/ >> $LOGFILE 2>&1;/g if defined $opt_log;
$command =~ s/;/ > \/dev\/null;/g if (!$opt_verbose && !$opt_log);
system($command) == 0 or &abort("$errormsg\n");
}
}
......@@ -47,6 +53,7 @@ sub abort
{
my $message= $_[0];
my $messagefile;
my $subject= "Bootstrap of $REPO failed" if $opt_mail;
$message= "ERROR: " . $message;
&logger($message);
......
......@@ -10,10 +10,22 @@
# Written by Matt Wagner <matt@mysql.com>
#
use strict;
#
# Use local perl libraries first. 'unshift' adds to the front of @INC
# The local perl library dir hidden is $HOME/.perllibs on each build host
#
BEGIN
{
my $homedir= $ENV{HOME};
unshift (@INC, "$homedir/.perllibs");
}
use Digest::MD5;
use Getopt::Long;
my $VER= "1.1";
my $VER= "1.3";
my $EXIT= 0;
#
# Strip the leading path info off the program name ($0). We want 'my_md5sum'
......@@ -67,6 +79,9 @@ if ($opt_check)
# Print an error message if they don't match, else print OK
print "$checkfile: FAILED\n" if $digest ne $checksum;
print "$checkfile: OK\n" if $digest eq $checksum;
# Set the exit() status to non-zero if FAILED
$EXIT= 1 if $digest ne $checksum;
}
}
# Else generate the MD5 digest to STDOUT
......@@ -80,6 +95,8 @@ else
}
}
exit($EXIT);
#
# This routine generates the MD5 digest of a file
......
......@@ -1851,12 +1851,6 @@ int read_query(struct st_query** q_ptr)
q->record_file[0]= 0;
q->require_file= 0;
q->first_word_len= 0;
memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
sizeof(global_expected_errno));
q->expected_errors= global_expected_errors;
q->abort_on_error= global_expected_errors == 0;
bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
global_expected_errors=0;
q->type = Q_UNKNOWN;
q->query_buf= q->query= 0;
......@@ -1869,8 +1863,16 @@ int read_query(struct st_query** q_ptr)
if (*p == '#')
{
q->type = Q_COMMENT;
/* This goto is to avoid losing the "expected error" info. */
goto end;
}
else if (p[0] == '-' && p[1] == '-')
memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
sizeof(global_expected_errno));
q->expected_errors= global_expected_errors;
q->abort_on_error= global_expected_errors == 0;
bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
global_expected_errors=0;
if (p[0] == '-' && p[1] == '-')
{
q->type= Q_COMMENT_WITH_COMMAND;
p+= 2; /* To calculate first word */
......@@ -1905,6 +1907,8 @@ int read_query(struct st_query** q_ptr)
*p1 = 0;
}
}
end:
while (*p && my_isspace(charset_info, *p))
p++;
if (!(q->query_buf= q->query= my_strdup(p, MYF(MY_WME))))
......
......@@ -16,10 +16,17 @@
C_MODE_START
enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG,
GET_ULONG, GET_LL, GET_ULL, GET_STR, GET_STR_ALLOC,
GET_DISABLED
};
#define GET_NO_ARG 1
#define GET_BOOL 2
#define GET_INT 3
#define GET_UINT 4
#define GET_LONG 5
#define GET_ULONG 6
#define GET_LL 7
#define GET_ULL 8
#define GET_STR 9
#define GET_STR_ALLOC 10
#define GET_DISABLED 11
#define GET_ASK_ADDR 128
#define GET_TYPE_MASK 127
......@@ -34,7 +41,7 @@ struct my_option
gptr *value; /* The variable value */
gptr *u_max_value; /* The user def. max variable value */
const char **str_values; /* Pointer to possible values */
enum get_opt_var_type var_type;
ulong var_type;
enum get_opt_arg_type arg_type;
longlong def_value; /* Default value */
longlong min_value; /* Min allowed value */
......
......@@ -80,4 +80,3 @@ DROP TABLE help_relation;
DROP TABLE help_topic;
-- enable_query_log
......@@ -99,4 +99,3 @@ drop table test_func;
drop table test_host;
drop table test_user;
drop table test_db;
......@@ -461,6 +461,17 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
else
finfo.mystat= NULL;
/*
If the directory is the root directory of the drive, Windows sometimes
creates hidden or system files there (like RECYCLER); do not show
them. We would need to see how this can be achieved with a Borland
compiler.
*/
#ifndef __BORLANDC__
if (attrib & (_A_HIDDEN | _A_SYSTEM))
continue;
#endif
if (push_dynamic(dir_entries_storage, (gptr)&finfo))
goto error;
......
......@@ -1696,9 +1696,9 @@ void Load_log_event::set_fields(List<Item> &field_list)
int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
bool use_rli_only_for_errors)
{
char *load_data_query= 0;
thd->db= (char*) rewrite_db(db);
DBUG_ASSERT(thd->query == 0);
thd->query= 0; // Should not be needed
thd->query_length= 0; // Should not be needed
thd->query_error= 0;
clear_all_errors(thd, rli);
......@@ -1749,6 +1749,19 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
{
char llbuff[22];
enum enum_duplicates handle_dup;
/*
Make a simplified LOAD DATA INFILE query, for the information of the
user in SHOW PROCESSLIST. Note that db is known in the 'db' column.
*/
if ((load_data_query= (char *) my_alloca(18 + strlen(fname) + 14 +
strlen(tables.real_name) + 8)))
{
thd->query_length= (uint)(strxmov(load_data_query,
"LOAD DATA INFILE '", fname,
"' INTO TABLE `", tables.real_name,
"` <...>", NullS) - load_data_query);
thd->query= load_data_query;
}
if (sql_ex.opt_flags & REPLACE_FLAG)
handle_dup= DUP_REPLACE;
else if (sql_ex.opt_flags & IGNORE_FLAG)
......@@ -1830,8 +1843,14 @@ Slave: load data infile on table '%s' at log position %s in log \
}
thd->net.vio = 0;
thd->db= 0; // prevent db from being freed
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->db= 0;
thd->query= 0;
thd->query_length= 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
close_thread_tables(thd);
if (load_data_query)
my_afree(load_data_query);
if (thd->query_error)
{
/* this err/sql_errno code is copy-paste from send_error() */
......@@ -2846,7 +2865,7 @@ void Create_file_log_event::pack_info(Protocol *protocol)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
{
char fname_buf[FN_REFLEN+10];
char proc_info[17+FN_REFLEN+10], *fname_buf= proc_info+17;
char *p;
int fd = -1;
IO_CACHE file;
......@@ -2855,6 +2874,8 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
bzero((char*)&file, sizeof(file));
p = slave_load_file_stem(fname_buf, file_id, server_id);
strmov(p, ".info"); // strmov takes less code than memcpy
strnmov(proc_info, "Making temp file ", 17); // no end 0
thd->proc_info= proc_info;
if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC,
MYF(MY_WME))) < 0 ||
init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0,
......@@ -2898,6 +2919,7 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
end_io_cache(&file);
if (fd >= 0)
my_close(fd, MYF(0));
thd->proc_info= 0;
return error ? 1 : Log_event::exec_event(rli);
}
#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
......@@ -2995,13 +3017,15 @@ void Append_block_log_event::pack_info(Protocol *protocol)
#if defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
{
char fname[FN_REFLEN+10];
char proc_info[17+FN_REFLEN+10], *fname= proc_info+17;
char *p= slave_load_file_stem(fname, file_id, server_id);
int fd;
int error = 1;
DBUG_ENTER("Append_block_log_event::exec_event");
memcpy(p, ".data", 6);
strnmov(proc_info, "Making temp file ", 17); // no end 0
thd->proc_info= proc_info;
if ((fd = my_open(fname, O_WRONLY|O_APPEND|O_BINARY, MYF(MY_WME))) < 0)
{
slave_print_error(rli,my_errno, "Error in Append_block event: could not open file '%s'", fname);
......@@ -3017,6 +3041,7 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
err:
if (fd >= 0)
my_close(fd, MYF(0));
thd->proc_info= 0;
DBUG_RETURN(error ? error : Log_event::exec_event(rli));
}
#endif
......
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