Commit 86197400 authored by tomas@poseidon.ndb.mysql.com's avatar tomas@poseidon.ndb.mysql.com

Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0

into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
parents bca4f687 dd6958eb
......@@ -22,7 +22,6 @@ use Getopt::Long;
Getopt::Long::Configure ("bundling");
use Sys::Hostname;
$opt_nobuild = undef;
$opt_cc= undef;
$opt_cflags= undef;
$opt_clean= undef;
......@@ -33,6 +32,9 @@ $opt_help= undef;
$opt_log= undef;
$opt_mail= "";
$opt_verbose= undef;
$opt_susebuild= undef;
$opt_susebuildroot= undef;
$opt_suserpms= undef;
# Set a dummy version until we know the correct one
$VERSION= "x.y.z";
......@@ -49,7 +51,9 @@ GetOptions(
"help|h",
"log|l:s",
"mail|m=s",
"nobuild",
"susebuild|s",
"susebuildroot|r=s",
"suserpms=s",
"verbose|v",
) || &print_help;
......@@ -57,6 +61,20 @@ GetOptions(
defined($SPECFILE=$ARGV[0]) || print_help("Please provide the spec file name!");
&print_help("Please define the location of the RPM repository!") if $opt_susebuild && !($opt_suserpms || $ENV{BUILD_RPMS});
unless ($opt_susebuildroot)
{
if ($ENV{BUILD_ROOT})
{
$opt_susebuildroot= $ENV{BUILD_ROOT};
}
else
{
$opt_susebuildroot="/var/tmp/build-root";
}
}
# Include helper functions
$PWD= cwd();
$LOGGER= "$PWD/logger.pm";
......@@ -72,7 +90,7 @@ else
$subject= "RPM build for $SPECFILE failed" if $opt_mail;
# Open the spec file and extract the version number
open(SPEC, $SPECFILE) or &abort("Unable to open \"$ARGV[0]\": $!");
open(SPEC, $SPECFILE) or die "Unable to open \"$ARGV[0]\": $!";
@spec= <SPEC>;
close SPEC;
......@@ -94,7 +112,7 @@ $HOST= hostname();
$HOST=~ /^([^.-]*)/;
$HOST= $1;
$LOGFILE= "$PWD/Logs/Do-rpm-$HOST-$MAJOR.$MINOR.log";
&logger("Using spec file for version: $VERSION");
&logger("Logging to $LOGFILE");
#
# Override predefined Log file name
......@@ -114,103 +132,149 @@ if (defined $opt_log)
}
}
#
# Newer RPM versions ship with a separate tool "rpmbuild" to build RPMs
#
if (-x "/usr/bin/rpmbuild")
&logger("Using spec file for version: $VERSION");
if ($opt_susebuild)
{
$RPM= "/usr/bin/rpmbuild";
$RMSOURCE= "--rmsource --rmspec";
&susebuild;
}
else
{
$RPM= "/bin/rpm";
$RMSOURCE= "--rmspec";
{
&rpmbuild;
}
if ($RPM)
{
&logger("Found rpm binary: $RPM");
}
else
&logger("SUCCESS: RPM files successfully created.") unless ($opt_dry_run);
exit 0;
#
# Build using SUSE's "build" script
#
sub susebuild
{
&abort("Unable to find RPM binary!");
$BUILD= "/usr/bin/build";
( -x $BUILD) ? &logger("$BUILD found, proceeding.") : &abort("$BUILD could not be found!");
$command= "sudo $BUILD --clean";
$command.= " --root=$opt_susebuildroot";
$command.= " --rpms=$opt_suserpms" if $opt_suserpms;
$command.= " $SPECFILE";
&logger("Building RPMs using SUSE build.");
&run_command($command, "Error while running the SUSE RPM build!");
#
# Move the resulting RPMs into the pwd - we can use broad globs here
# as the build root has been cleaned up before so there should not be
# any residuals from previous build runs
#
$command= "cp";
$command.= " -v " if ($opt_verbose);
$command.= " $opt_susebuildroot/usr/src/packages/SRPMS/MySQL*.src.rpm $PWD";
&logger("Copying source RPM to current dir.");
&run_command($command, "Error moving source RPM!");
$command= "cp";
$command.= " -v " if ($opt_verbose);
$command.= " $opt_susebuildroot/usr/src/packages/RPMS/*/MySQL*.rpm $PWD";
&logger("Copying binary RPMs to current dir.");
&run_command($command, "Error moving binary RPMs!");
}
#
# determine some RPM settings for this host
# Build using "plain" RPM
#
chomp($RPMARCH= `$RPM --eval "%{_arch}" 2> /dev/null`);
chomp($RPMDIR= `$RPM --eval "%{_rpmdir}" 2> /dev/null`);
chomp($SOURCEDIR= `$RPM --eval "%{_sourcedir}" 2> /dev/null`);
chomp($SPECDIR= `$RPM --eval "%{_specdir}" 2> /dev/null`);
chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`);
$SOURCEFILE= glob "mysql*-$VERSION.tar.gz";
sub rpmbuild
{
unless($opt_nobuild) {
#
# Newer RPM versions ship with a separate tool "rpmbuild" to build RPMs
#
if (-x "/usr/bin/rpmbuild")
{
$RPM= "/usr/bin/rpmbuild";
$RMSOURCE= "--rmsource --rmspec";
}
else
{
$RPM= "/bin/rpm";
$RMSOURCE= "--rmspec";
}
&logger("Starting RPM build of MySQL-$VERSION on $HOST");
if ($RPM)
{
&logger("Found rpm binary: $RPM");
}
else
{
&abort("Unable to find RPM binary!");
}
foreach $file ($SOURCEFILE, $SPECFILE)
{
&abort("Unable to find $file!") unless (-f "$file");
}
#
# determine some RPM settings for this host
#
chomp($RPMARCH= `$RPM --eval "%{_arch}" 2> /dev/null`);
chomp($RPMDIR= `$RPM --eval "%{_rpmdir}" 2> /dev/null`);
chomp($SOURCEDIR= `$RPM --eval "%{_sourcedir}" 2> /dev/null`);
chomp($SPECDIR= `$RPM --eval "%{_specdir}" 2> /dev/null`);
chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`);
#
# Install source and spec file
#
&logger("Copying SOURCE and SPEC file to build directories.");
unless ($opt_dry_run)
{
copy($SOURCEFILE, $SOURCEDIR)
or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!");
copy($SPECFILE, $SPECDIR)
or &abort("Unable to copy $SPECFILE to $SPECDIR!");
}
$SOURCEFILE= glob "mysql*-$VERSION.tar.gz";
#
# Set environment variables - these are being used in the
# official MySQL RPM spec file
#
&logger("Setting special build environment variables")
if ($opt_cc) or ($opt_cflags) or ($opt_cxxflags) or ($opt_cxx);
$ENV{MYSQL_BUILD_CC}=$opt_cc if ($opt_cc);
$ENV{MYSQL_BUILD_CFLAGS}=$opt_cflags if ($opt_cflags);
$ENV{MYSQL_BUILD_CXXFLAGS}=$opt_cxxflags if ($opt_cxxflags);
$ENV{MYSQL_BUILD_CXX}=$opt_cxx if ($opt_cxx);
&logger("Starting RPM build of MySQL-$VERSION on $HOST");
#
# Build the RPMs
#
$command= "$RPM";
$command.= " -v" if ($opt_verbose);
$command.= " -ba";
$command.= " --clean $RMSOURCE" if $opt_clean;
$command.= " $SPECDIR/";
$command.= basename($SPECFILE);
&logger("Building RPM.");
&run_command($command, "Error while building the RPMs!");
}
foreach $file ($SOURCEFILE, $SPECFILE)
{
&abort("Unable to find $file!") unless (-f "$file");
}
#
# Move the resulting RPMs into the pwd
#
$command= "mv";
$command.= " -v " if ($opt_verbose);
$command.= " $SRCRPMDIR/MySQL*$VERSION_SRPM*.src.rpm $PWD";
&logger("Moving source RPM to current dir.");
&run_command($command, "Error moving source RPM!");
$command= "mv";
$command.= " -v " if ($opt_verbose);
# $command.= " $RPMDIR/$RPMARCH/MySQL*$VERSION*.$RPMARCH.rpm $PWD";
$command.= " $RPMDIR/$RPMARCH/MySQL*$VERSION_SRPM*.$RPMARCH.rpm $PWD";
&logger("Moving binary RPMs to current dir.");
&run_command($command, "Error moving binary RPMs!");
#
# Install source and spec file
#
&logger("Copying SOURCE and SPEC file to build directories.");
unless ($opt_dry_run)
{
copy($SOURCEFILE, $SOURCEDIR)
or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!");
copy($SPECFILE, $SPECDIR)
or &abort("Unable to copy $SPECFILE to $SPECDIR!");
}
&logger("SUCCESS: RPM files successfully created.") unless ($opt_dry_run);
exit 0;
#
# Set environment variables - these are being used in the
# official MySQL RPM spec file
#
&logger("Setting special build environment variables")
if ($opt_cc) or ($opt_cflags) or ($opt_cxxflags) or ($opt_cxx);
$ENV{MYSQL_BUILD_CC}=$opt_cc if ($opt_cc);
$ENV{MYSQL_BUILD_CFLAGS}=$opt_cflags if ($opt_cflags);
$ENV{MYSQL_BUILD_CXXFLAGS}=$opt_cxxflags if ($opt_cxxflags);
$ENV{MYSQL_BUILD_CXX}=$opt_cxx if ($opt_cxx);
#
# Build the RPMs
#
$command= "$RPM";
$command.= " -v" if ($opt_verbose);
$command.= " -ba";
$command.= " --clean $RMSOURCE" if $opt_clean;
$command.= " $SPECDIR/";
$command.= basename($SPECFILE);
&logger("Building RPM.");
&run_command($command, "Error while building the RPMs!");
#
# Move the resulting RPMs into the pwd
#
$command= "mv";
$command.= " -v " if ($opt_verbose);
$command.= " $SRCRPMDIR/MySQL*$VERSION_SRPM*.src.rpm $PWD";
&logger("Moving source RPM to current dir.");
&run_command($command, "Error moving source RPM!");
$command= "mv";
$command.= " -v " if ($opt_verbose);
$command.= " $RPMDIR/$RPMARCH/MySQL*$VERSION_SRPM*.$RPMARCH.rpm $PWD";
&logger("Moving binary RPMs to current dir.");
&run_command($command, "Error moving binary RPMs!");
}
sub print_help
{
......@@ -218,7 +282,7 @@ sub print_help
if ($message ne "")
{
print "\n";
print "ERROR: $message\n\n}";
print "ERROR: $message\n\n";
}
print <<EOF;
......@@ -241,12 +305,22 @@ Options:
-t, --dry-run Dry run without executing
-h, --help Print this help
-l, --log[=<filename>] Write a log file [to <filename>]
(default is "$LOGFILE")
-m, --mail=<address> Mail a failure report to the given address
(and include a log file snippet, if logging
is enabled)
Note that the \@-Sign needs to be quoted!
Example: --mail=user\\\@domain.com
-s, --susebuild Use the SUSE "build" script instead of RPM
directly (requires sudo privileges to run the
/usr/bin/build command)
-r, --susebuildroot=<root> Use <root> as the build root directory for the
SUSE "build" (default is /var/tmp/build-root
or defined by the BUILD_ROOT environment
variable)
--suserpms=<path> Path to the SUSE RPM repository to build up
the build root (mandatory option when using
--susebuild and the BUILD_RPMS environment
variable is not set.)
-v, --verbose Verbose execution
Example:
......
......@@ -540,6 +540,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
INSTALL_DB="./install_test_db"
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables"
NDB_TOOLS_DIR="$BASEDIR/ndb/tools"
NDB_MGM="$BASEDIR/ndb/src/mgmclient/ndb_mgm"
else
if test -x "$BASEDIR/libexec/mysqld"
then
......@@ -566,6 +567,7 @@ else
INSTALL_DB="./install_test_db --bin"
MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
NDB_TOOLS_DIR="$CLIENT_BINDIR"
NDB_MGM="$CLIENT_BINDIR/ndb_mgm"
if test -d "$BASEDIR/share/mysql/english"
then
LANGUAGE="$BASEDIR/share/mysql/english/"
......@@ -615,6 +617,7 @@ MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --u
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
export CLIENT_BINDIR TESTS_BINDIR CHARSETSDIR
export NDB_TOOLS_DIR
export NDB_MGM
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
......
......@@ -157,6 +157,14 @@ a
bbbb
цццц
drop table t1;
create table t1 (a char(10) character set latin1 not null);
insert into t1 values ('a'),('b'),('c');
select a from t1 where a IN ('a','b','c') order by a;
a
a
b
c
drop table t1;
set names latin1;
select '1.0' in (1,2);
'1.0' in (1,2)
......
......@@ -359,6 +359,16 @@ information_schema
mysql
test
use test;
drop database if exists test_only_ndb_tables;
create database test_only_ndb_tables;
use test_only_ndb_tables;
create table t1 (a int primary key) engine=ndb;
select * from t1;
a
select * from t1;
ERROR HY000: Can't lock file (errno: 4009)
use test;
drop database test_only_ndb_tables;
CREATE TABLE t9 (
a int NOT NULL PRIMARY KEY,
b int
......
......@@ -80,6 +80,11 @@ create table t1 (a char(10) character set utf8 not null);
insert into t1 values ('bbbb'),(_koi8r'ÃÃÃÃ'),(_latin1'ÄÄÄÄ');
select a from t1 where a in ('bbbb',_koi8r'ÃÃÃÃ',_latin1'ÄÄÄÄ') order by a;
drop table t1;
# Bug#7834 Illegal mix of collations in IN operator
create table t1 (a char(10) character set latin1 not null);
insert into t1 values ('a'),('b'),('c');
select a from t1 where a IN ('a','b','c') order by a;
drop table t1;
set names latin1;
select '1.0' in (1,2);
......
......@@ -452,6 +452,26 @@ drop database test2;
show databases;
use test;
#########################################################
# Bug#8035
# mysqld would segfault on second select * before bug was fixed
#
--disable_warnings
drop database if exists test_only_ndb_tables;
--enable_warnings
create database test_only_ndb_tables;
use test_only_ndb_tables;
create table t1 (a int primary key) engine=ndb;
select * from t1;
--exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null
--error 1015
select * from t1;
--exec $NDB_MGM --no-defaults -e "all start" > /dev/null
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null
use test;
drop database test_only_ndb_tables;
######################################################
# Note! This should always be the last step in this
# file, the table t9 will be used and dropped
......
......@@ -1312,7 +1312,10 @@ void Dbtc::execTCRELEASEREQ(Signal* signal)
if (tapiBlockref == apiConnectptr.p->ndbapiBlockref) {
if (apiConnectptr.p->apiConnectstate == CS_CONNECTED ||
(apiConnectptr.p->apiConnectstate == CS_ABORTING &&
apiConnectptr.p->abortState == AS_IDLE)){
apiConnectptr.p->abortState == AS_IDLE) ||
(apiConnectptr.p->apiConnectstate == CS_STARTED &&
apiConnectptr.p->firstTcConnect == RNIL))
{
jam(); /* JUST REPLY OK */
releaseApiCon(signal, apiConnectptr.i);
signal->theData[0] = tuserpointer;
......
......@@ -31,11 +31,13 @@ waitClusterStatus(const char* _addr, ndb_mgm_node_status _status,
unsigned int _timeout);
enum ndb_waiter_options {
NDB_STD_OPTS_OPTIONS
NDB_STD_OPTS_OPTIONS,
OPT_WAIT_STATUS_NOT_STARTED
};
NDB_STD_OPTS_VARS;
static int _no_contact = 0;
static int _not_started = 0;
static int _timeout = 120;
static struct my_option my_long_options[] =
{
......@@ -43,6 +45,9 @@ static struct my_option my_long_options[] =
{ "no-contact", 'n', "Wait for cluster no contact",
(gptr*) &_no_contact, (gptr*) &_no_contact, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started",
(gptr*) &_not_started, (gptr*) &_not_started, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "timeout", 't', "Timeout to wait",
(gptr*) &_timeout, (gptr*) &_timeout, 0,
GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 },
......@@ -91,12 +96,22 @@ int main(int argc, char** argv){
if (_hostName == 0)
_hostName= opt_connect_str;
if (_no_contact) {
if (waitClusterStatus(_hostName, NDB_MGM_NODE_STATUS_NO_CONTACT, _timeout) != 0)
return NDBT_ProgramExit(NDBT_FAILED);
} else if (waitClusterStatus(_hostName, NDB_MGM_NODE_STATUS_STARTED, _timeout) != 0)
return NDBT_ProgramExit(NDBT_FAILED);
enum ndb_mgm_node_status wait_status;
if (_no_contact)
{
wait_status= NDB_MGM_NODE_STATUS_NO_CONTACT;
}
else if (_not_started)
{
wait_status= NDB_MGM_NODE_STATUS_NOT_STARTED;
}
else
{
wait_status= NDB_MGM_NODE_STATUS_STARTED;
}
if (waitClusterStatus(_hostName, wait_status, _timeout) != 0)
return NDBT_ProgramExit(NDBT_FAILED);
return NDBT_ProgramExit(NDBT_OK);
}
......
......@@ -1776,64 +1776,13 @@ void Item_func_in::fix_length_and_dec()
agg_cmp_type(&cmp_type, args, arg_count);
if (cmp_type == STRING_RESULT &&
agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV))
return;
for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
const_itm&= arg[0]->const_item();
if (cmp_type == STRING_RESULT)
{
/*
We allow consts character set conversion for
item IN (const1, const2, const3, ...)
if item is in a superset for all arguments,
and if it is a stong side according to coercibility rules.
TODO: add covnersion for non-constant IN values
via creating Item_func_conv_charset().
*/
if (agg_arg_collations_for_comparison(cmp_collation, args, arg_count,
MY_COLL_ALLOW_SUPERSET_CONV))
return;
if ((!my_charset_same(args[0]->collation.collation,
cmp_collation.collation) || !const_itm))
{
if (agg_arg_collations_for_comparison(cmp_collation, args, arg_count))
return;
}
else
{
/*
Conversion is possible:
All IN arguments are constants.
*/
Item_arena *arena, backup;
arena= thd->change_arena_if_needed(&backup);
for (arg= args+1, arg_end= args+arg_count; arg < arg_end; arg++)
{
if (!arg[0]->null_value &&
!my_charset_same(cmp_collation.collation,
arg[0]->collation.collation))
{
Item_string *conv;
String tmp, cstr, *ostr= arg[0]->val_str(&tmp);
uint dummy_errors;
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(),
cmp_collation.collation, &dummy_errors);
conv= new Item_string(cstr.ptr(),cstr.length(), cstr.charset(),
arg[0]->collation.derivation);
conv->str_value.copy();
arg[0]= conv;
}
}
if (arena)
thd->restore_backup_item_arena(arena, &backup);
}
}
/*
Row item with NULLs inside can return NULL or FALSE =>
they can't be processed as static
......
......@@ -182,12 +182,12 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
if ((error=(*tables)->file->external_lock(thd,lock_type)))
{
print_lock_error(error, (*tables)->file->table_type());
for (; i-- ; tables--)
{
(*tables)->file->external_lock(thd, F_UNLCK);
(*tables)->current_lock=F_UNLCK;
}
print_lock_error(error, (*tables)->file->table_type());
DBUG_RETURN(error);
}
else
......@@ -375,12 +375,13 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
{
(*table)->current_lock = F_UNLCK;
if ((error=(*table)->file->external_lock(thd, F_UNLCK)))
{
error_code=error;
print_lock_error(error_code, (*table)->file->table_type());
}
}
table++;
} while (--count);
if (error_code)
print_lock_error(error_code, (*table)->file->table_type());
DBUG_RETURN(error_code);
}
......
This diff is collapsed.
# This logname is set in mysql.server.sh that ends up in /etc/rc.d/init.d/mysql
# This logname can be set in /etc/my.cnf
# by setting the variable "err-log"
# in the [safe_mysqld] section as follows:
#
# [safe_mysqld]
# err-log=@localstatedir@/mysqld.log
#
# If the root user has a password you have to create a
# /root/.my.cnf configuration file with the following
......@@ -22,8 +27,10 @@
compress
postrotate
# just if mysqld is really running
if test -n "`ps acx|grep mysqld`"; then
@bindir@/mysqladmin flush-logs
if test -x @bindir@/mysqladmin && \
@bindir@/mysqladmin ping &>/dev/null
then
@bindir@/mysqladmin flush-logs
fi
endscript
}
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