3876 magnus.blaudd@stripped 2012-04-13 [merge]
Merge
added:
mysql-test/suite/sys_vars/r/transaction_allow_batching_basic.result
mysql-test/suite/sys_vars/t/transaction_allow_batching_basic.test
modified:
sql/sys_vars.cc
storage/ndb/compile-cluster
3875 Martin Hansson 2012-04-13
Bug#11745578: 17392: ALTER TABLE ADD COLUMN TIMESTAMP
DEFAULT CURRENT_TIMESTAMP INSERTS ZERO
It is a standard SQL feature that every value in a column
added with ALTER TABLE ADD COLUMN should be the value from
the default clase. This was not implemented and is added by
this patch.
modified:
mysql-test/include/function_defaults.inc
mysql-test/r/function_defaults.result
sql/sql_table.cc
=== added file 'mysql-test/suite/sys_vars/r/transaction_allow_batching_basic.result'
--- a/mysql-test/suite/sys_vars/r/transaction_allow_batching_basic.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/transaction_allow_batching_basic.result 2012-04-13 08:09:09 +0000
@@ -0,0 +1,35 @@
+SET @start_global_value = @@session.transaction_allow_batching;
+SELECT @start_global_value as "Should be off by default";
+Should be off by default
+0
+select @@global.transaction_allow_batching;
+ERROR HY000: Variable 'transaction_allow_batching' is a SESSION variable
+select @@session.transaction_allow_batching;
+@@session.transaction_allow_batching
+0
+show global variables like 'transaction_allow_batching';
+Variable_name Value
+show session variables like 'transaction_allow_batching';
+Variable_name Value
+transaction_allow_batching OFF
+select * from information_schema.global_variables where variable_name='transaction_allow_batching';
+VARIABLE_NAME VARIABLE_VALUE
+select * from information_schema.session_variables where variable_name='transaction_allow_batching';
+VARIABLE_NAME VARIABLE_VALUE
+TRANSACTION_ALLOW_BATCHING OFF
+set global transaction_allow_batching = 1;
+ERROR HY000: Variable 'transaction_allow_batching' is a SESSION variable and can't be used with SET GLOBAL
+set session transaction_allow_batching = TRUE;
+select @@session.transaction_allow_batching;
+@@session.transaction_allow_batching
+1
+set transaction_allow_batching=1.1;
+ERROR 42000: Incorrect argument type to variable 'transaction_allow_batching'
+set transaction_allow_batching=1e1;
+ERROR 42000: Incorrect argument type to variable 'transaction_allow_batching'
+set transaction_allow_batching="foobar";
+ERROR 42000: Variable 'transaction_allow_batching' can't be set to the value of 'foobar'
+set session transaction_allow_batching = @start_global_value;
+select @@session.transaction_allow_batching;
+@@session.transaction_allow_batching
+0
=== added file 'mysql-test/suite/sys_vars/t/transaction_allow_batching_basic.test'
--- a/mysql-test/suite/sys_vars/t/transaction_allow_batching_basic.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/transaction_allow_batching_basic.test 2012-04-13 08:09:09 +0000
@@ -0,0 +1,44 @@
+--source include/not_embedded.inc
+
+SET @start_global_value = @@session.transaction_allow_batching;
+SELECT @start_global_value as "Should be off by default";
+
+#
+# exists as session only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@global.transaction_allow_batching;
+select @@session.transaction_allow_batching;
+show global variables like 'transaction_allow_batching';
+show session variables like 'transaction_allow_batching';
+select * from information_schema.global_variables where variable_name='transaction_allow_batching';
+select * from information_schema.session_variables where variable_name='transaction_allow_batching';
+
+#
+# show that it is writable
+#
+--error ER_LOCAL_VARIABLE
+set global transaction_allow_batching = 1;
+set session transaction_allow_batching = TRUE;
+select @@session.transaction_allow_batching;
+
+#
+# incorrect assignments
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set transaction_allow_batching=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set transaction_allow_batching=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set transaction_allow_batching="foobar";
+
+
+#
+# restore original value
+#
+set session transaction_allow_batching = @start_global_value;
+select @@session.transaction_allow_batching;
+
+#
+# See ndb_sql_transaction_allow_batching.test for a comprehensive test case.
+#
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2012-04-11 16:52:28 +0000
+++ b/sql/sys_vars.cc 2012-04-13 08:09:09 +0000
@@ -3056,6 +3056,11 @@ static Sys_var_mybool Sys_log_binlog(
DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_sql_log_bin),
ON_UPDATE(fix_sql_log_bin_after_update));
+static Sys_var_bit Sys_transaction_allow_batching(
+ "transaction_allow_batching", "transaction_allow_batching",
+ SESSION_ONLY(option_bits), NO_CMD_LINE, OPTION_ALLOW_BATCH,
+ DEFAULT(FALSE));
+
static Sys_var_bit Sys_sql_warnings(
"sql_warnings", "sql_warnings",
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_WARNINGS,
=== modified file 'storage/ndb/compile-cluster'
--- a/storage/ndb/compile-cluster 2011-06-30 18:43:59 +0000
+++ b/storage/ndb/compile-cluster 2012-04-13 06:59:56 +0000
@@ -31,24 +31,31 @@ use Getopt::Long;
# thus acting like a filter and passing all other arguments
# straight through
my $opt_debug;
+my $opt_build_type;
+my $opt_build = 1;
+my $opt_just_print;
+
Getopt::Long::Configure("pass_through");
GetOptions(
# Build MySQL Server and NDB with debug
- 'debug' => \$opt_debug,
+ 'debug!' => \$opt_debug,
'with-debug:s' => sub { $opt_debug = 1; },
-
+ 'build-type=s' => \$opt_build_type,
+ 'build!' => \$opt_build,
+ 'c|just-configure' => sub { $opt_build = 0; },
+ 'n|just-print' => \$opt_just_print,
) or exit(1);
# Find source root directory, assume this script is
# in <srcroot>/storage/ndb/
-my $srcdir = dirname(dirname(dirname(abs_path($0))));
-die unless -d $srcdir; # Sanity check that the srcdir exist
+my $opt_srcdir = dirname(dirname(dirname(abs_path($0))));
+die unless -d $opt_srcdir; # Sanity check that the srcdir exist
if ($^O eq "cygwin") {
# Convert posix path to Windows mixed path since cmake
# is most likely a windows binary
- $srcdir= `cygpath -m $srcdir`;
- chomp $srcdir;
+ $opt_srcdir= `cygpath -m $opt_srcdir`;
+ chomp $opt_srcdir;
}
# Check that cmake exists and figure out it's version
@@ -61,7 +68,7 @@ my $cmake_version_id;
{
#print "1: $1 2: $2 3: $3\n";
$cmake_version_id= $1*10000 + $2*100 + $3;
- print "cmake_version_id: $cmake_version_id\n";
+ #print "cmake_version_id: $cmake_version_id\n";
}
die "Could not parse cmake version" unless ($cmake_version_id);
}
@@ -71,37 +78,244 @@ my $cmake_version_id;
# Configure
#
{
+ # Remove old CMakeCache.txt(ignore if not exists) to
+ # force fresh configure
+ unlink("CMakeCache.txt");
+
my @args;
- push(@args, "$srcdir/cmake/configure.pl");
-
- # MySQL Server options
- push(@args, "--with-ssl");
+
+ # Hardcoded options controlling how to build MySQL Server
+ push(@args, "-DWITH_SSL=bundled");
if ($opt_debug)
{
- push(@args, "--with-debug");
- push(@args, "--disable-mysql-maintainer-mode");
+ push(@args, "-DWITH_DEBUG=1");
+ push(@args, "-DMYSQL_MAINTAINER_MODE=0");
}
- # NDB options
- push(@args, "--with-plugin-ndbcluster");
- push(@args, "--with-ndb-test");
+ # Hardcoded options controlling how to build NDB
+ push(@args, "-DWITH_PLUGIN_NDBCLUSTER=1");
+ push(@args, "-DWITH_NDB_TEST=1");
- cmd($^X, @args, @ARGV);
+ # The cmake generator to use
+ if ($opt_build_type)
+ {
+ push(@args, "-G \"$opt_build_type\"");
+ }
+
+ # Sets installation directory, bindir, libdir, libexecdir etc.
+ # The equivalent CMake variables are given without prefix
+ # e.g if --prefix is /usr and --bindir is /usr/bin
+ # then cmake variable (INSTALL_BINDIR) must be just "bin"
+ my $opt_prefix;
+ sub set_installdir
+ {
+ my($path, $varname) = @_;
+ my $prefix_length = length($opt_prefix);
+ if (($prefix_length > 0) && (index($path,$opt_prefix) == 0))
+ {
+ # path is under the prefix, remove the prefix and
+ # maybe following "/"
+ $path = substr($path, $prefix_length);
+ if(length($path) > 0)
+ {
+ my $char = substr($path, 0, 1);
+ if($char eq "/")
+ {
+ $path= substr($path, 1);
+ }
+ }
+ if(length($path) > 0)
+ {
+ push(@args, "-D$varname=$path");
+ }
+ }
+ }
+
+ # Process --configure style arguments which need special conversion
+ my $opt_bindir;
+ my $opt_libdir;
+ my $opt_libexecdir;
+ my $opt_includedir;
+ my $opt_with_zlib_dir;
+ my $opt_with_ssl;
+ my $opt_localstatedir;
+ my $opt_mysql_maintainer_mode;
+ my $opt_with_gcov;
+ my $opt_with_comment;
+ my $opt_with_plugins;
+ my $opt_without_plugin;
+ my $opt_extra_charsets;
+ my $opt_with_extra_charsets;
+ Getopt::Long::Configure("pass_through");
+ GetOptions(
+ 'prefix=s' => \$opt_prefix,
+ 'srcdir=s' => \$opt_srcdir,
+ 'bindir=s' => \$opt_bindir,
+ 'libdir=s' => \$opt_libdir,
+ 'libexecdir=s' => \$opt_libexecdir,
+ 'includedir=s' => \$opt_includedir,
+ 'with-zlib-dir=s' => \$opt_with_zlib_dir,
+ 'with-ssl:s' => \$opt_with_ssl,
+ 'localstatedir=s' => \$opt_localstatedir,
+ 'mysql-maintainer-mode=s' => \$opt_mysql_maintainer_mode,
+ 'with-gcov' => \$opt_with_gcov,
+ 'with-comment=s' => \$opt_with_comment,
+ 'with-plugins=s' => \$opt_with_plugins,
+ 'without-plugin=s' => \$opt_without_plugin,
+ 'with-extra-charsets=s' => \$opt_with_extra_charsets,
+ 'extra-charsets=s' => \$opt_extra_charsets,
+ ) or exit(1);
+
+ if($opt_prefix)
+ {
+ push(@args, "-DCMAKE_INSTALL_PREFIX=$opt_prefix");
+ }
+ if($opt_bindir)
+ {
+ set_installdir($opt_bindir, "INSTALL_BINDIR");
+ }
+ if($opt_libdir)
+ {
+ set_installdir($opt_libdir, "INSTALL_LIBDIR");
+ }
+ if($opt_libexecdir)
+ {
+ set_installdir($opt_libexecdir, "INSTALL_SBINDIR");
+ }
+ if($opt_includedir)
+ {
+ set_installdir($opt_includedir, "INSTALL_INCLUDEDIR");
+ }
+ if($opt_with_zlib_dir)
+ {
+ $opt_with_zlib_dir = "system"
+ if ($opt_with_zlib_dir ne "bundled");
+ push(@args, "-DWITH_ZLIB=$opt_with_zlib_dir");
+ }
+ if($opt_with_ssl)
+ {
+ push(@args, "-DWITH_SSL=".($opt_with_ssl ? "yes" : "bundled"));
+ }
+ if ($opt_localstatedir)
+ {
+ push(@args, "-DMYSQL_DATADIR=$opt_localstatedir");
+ }
+ if ($opt_mysql_maintainer_mode)
+ {
+ push(@args, "-DMYSQL_MAINTAINER_MODE=" .
+ ($opt_mysql_maintainer_mode =~ /enable/ ? "1" : "0"));
+ }
+ if ($opt_with_gcov)
+ {
+ push(@args, "-DENABLE_GCOV=ON");
+ }
+ if ($opt_with_comment)
+ {
+ push(@args, "\"-DWITH_COMMENT=$opt_with_comment\"");
+ }
+ if($opt_with_plugins)
+ {
+ my @plugins= split(/,/, $opt_with_plugins);
+ foreach my $p (@plugins)
+ {
+ $p =~ s/-/_/g;
+ push(@args, "-DWITH_".uc($p)."=1");
+ }
+ }
+ if($opt_without_plugin)
+ {
+ push(@args, "-DWITHOUT_".uc($opt_without_plugin)."=1");
+ }
+ if ($opt_extra_charsets)
+ {
+ push(@args, "-DWITH_CHARSETS=$opt_extra_charsets");
+ }
+ if($opt_with_extra_charsets)
+ {
+ push(@args, "-DWITH_EXTRA_CHARSETS=$opt_with_extra_charsets");
+ }
+
+
+ # Default conversion of remaining args in ARGV from
+ # 1) --arg -> -DARG=1
+ # 2) --arg=value -> -DARG=value
+ # 3) arg=value -> environment variable arg=value
+ foreach my $option (@ARGV)
+ {
+ if ($option =~ /^--/)
+ {
+ # Remove leading --
+ $option = substr($option, 2);
+
+ my @v = split('=', $option);
+ my $name = shift(@v);
+ $name = uc($name);
+ $name =~ s/-/_/g;
+ if (@v)
+ {
+ push(@args, "-D$name=".join('=', @v));
+ }
+ else
+ {
+ push(@args, "-D$name=1");
+ }
+ }
+ else
+ {
+
+ # This must be environment variable
+ my @v = split('=', $option);
+ my $name = shift(@v);
+ if(@v)
+ {
+ $ENV{$name} = join('=', @v);
+ }
+ else
+ {
+ die "unhandled argument '$option' found";
+ }
+ }
+ }
+
+ # The source directory to build from
+ die "srcdir already contains CMakeCache.txt, this will not work!"
+ if (-f "$opt_srcdir/CMakeCache.txt");
+ push(@args, $opt_srcdir);
+
+ cmd("cmake", @args);
+}
+
+if (!$opt_build)
+{
+ print "Configuration completed, skipping build(used --no-build)\n";
+ exit(0);
}
+
#
# Build
#
{
if ($cmake_version_id >= 20800)
{
- # Use the universal "cmake --build <srcdir>" way of building
+ # Use the universal "cmake --build <dir>" way of building
# which is available from cmake 2.8 and works on all platforms
my @args;
push(@args, "--build");
-
- push(@args, "$srcdir");
+ push(@args, ".");
+
+ if ($^O eq "cygwin" or $^O eq "MSWin32")
+ {
+ # Choose to build RelWitDebInfo by default on Windows
+ my $config = 'RelWithDebInfo';
+ if ($opt_debug)
+ {
+ $config = 'Debug';
+ }
+ push(@args, "--config");
+ push(@args, $config);
+ }
cmd("cmake", @args);
@@ -112,12 +326,18 @@ my $cmake_version_id;
die "You need to install cmake with version > 2.8"
if ($^O eq "cygwin" or $^O eq "MSWin32");
- cmd("make -C $srcdir");
+ cmd("make");
}
}
sub cmd {
my ($cmd, @a)= @_;
+
+ if ($opt_just_print){
+ print "$cmd ", join(' ', @a), "\n";
+ return;
+ }
+
print "compile-cluster: calling '$cmd ", join(' ', @a), "'\n";
system($cmd, @a)
and print("command failed: $!\n")
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (magnus.blaudd:3875 to 3876) | magnus.blaudd | 13 Apr |