Skip to content

Commit a5cfaa3

Browse files
author
magnus.blaudd@oracle.com
committedApr 13, 2012
Merge
2 parents e242be3 + 3e8a7c9 commit a5cfaa3

File tree

4 files changed

+325
-21
lines changed

4 files changed

+325
-21
lines changed
 
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
SET @start_global_value = @@session.transaction_allow_batching;
2+
SELECT @start_global_value as "Should be off by default";
3+
Should be off by default
4+
0
5+
select @@global.transaction_allow_batching;
6+
ERROR HY000: Variable 'transaction_allow_batching' is a SESSION variable
7+
select @@session.transaction_allow_batching;
8+
@@session.transaction_allow_batching
9+
0
10+
show global variables like 'transaction_allow_batching';
11+
Variable_name Value
12+
show session variables like 'transaction_allow_batching';
13+
Variable_name Value
14+
transaction_allow_batching OFF
15+
select * from information_schema.global_variables where variable_name='transaction_allow_batching';
16+
VARIABLE_NAME VARIABLE_VALUE
17+
select * from information_schema.session_variables where variable_name='transaction_allow_batching';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
TRANSACTION_ALLOW_BATCHING OFF
20+
set global transaction_allow_batching = 1;
21+
ERROR HY000: Variable 'transaction_allow_batching' is a SESSION variable and can't be used with SET GLOBAL
22+
set session transaction_allow_batching = TRUE;
23+
select @@session.transaction_allow_batching;
24+
@@session.transaction_allow_batching
25+
1
26+
set transaction_allow_batching=1.1;
27+
ERROR 42000: Incorrect argument type to variable 'transaction_allow_batching'
28+
set transaction_allow_batching=1e1;
29+
ERROR 42000: Incorrect argument type to variable 'transaction_allow_batching'
30+
set transaction_allow_batching="foobar";
31+
ERROR 42000: Variable 'transaction_allow_batching' can't be set to the value of 'foobar'
32+
set session transaction_allow_batching = @start_global_value;
33+
select @@session.transaction_allow_batching;
34+
@@session.transaction_allow_batching
35+
0
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--source include/not_embedded.inc
2+
3+
SET @start_global_value = @@session.transaction_allow_batching;
4+
SELECT @start_global_value as "Should be off by default";
5+
6+
#
7+
# exists as session only
8+
#
9+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
10+
select @@global.transaction_allow_batching;
11+
select @@session.transaction_allow_batching;
12+
show global variables like 'transaction_allow_batching';
13+
show session variables like 'transaction_allow_batching';
14+
select * from information_schema.global_variables where variable_name='transaction_allow_batching';
15+
select * from information_schema.session_variables where variable_name='transaction_allow_batching';
16+
17+
#
18+
# show that it is writable
19+
#
20+
--error ER_LOCAL_VARIABLE
21+
set global transaction_allow_batching = 1;
22+
set session transaction_allow_batching = TRUE;
23+
select @@session.transaction_allow_batching;
24+
25+
#
26+
# incorrect assignments
27+
#
28+
--error ER_WRONG_TYPE_FOR_VAR
29+
set transaction_allow_batching=1.1;
30+
--error ER_WRONG_TYPE_FOR_VAR
31+
set transaction_allow_batching=1e1;
32+
--error ER_WRONG_VALUE_FOR_VAR
33+
set transaction_allow_batching="foobar";
34+
35+
36+
#
37+
# restore original value
38+
#
39+
set session transaction_allow_batching = @start_global_value;
40+
select @@session.transaction_allow_batching;
41+
42+
#
43+
# See ndb_sql_transaction_allow_batching.test for a comprehensive test case.
44+
#

‎sql/sys_vars.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,6 +3056,11 @@ static Sys_var_mybool Sys_log_binlog(
30563056
DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_sql_log_bin),
30573057
ON_UPDATE(fix_sql_log_bin_after_update));
30583058

3059+
static Sys_var_bit Sys_transaction_allow_batching(
3060+
"transaction_allow_batching", "transaction_allow_batching",
3061+
SESSION_ONLY(option_bits), NO_CMD_LINE, OPTION_ALLOW_BATCH,
3062+
DEFAULT(FALSE));
3063+
30593064
static Sys_var_bit Sys_sql_warnings(
30603065
"sql_warnings", "sql_warnings",
30613066
SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_WARNINGS,

‎storage/ndb/compile-cluster

Lines changed: 241 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,31 @@ use Getopt::Long;
3131
# thus acting like a filter and passing all other arguments
3232
# straight through
3333
my $opt_debug;
34+
my $opt_build_type;
35+
my $opt_build = 1;
36+
my $opt_just_print;
37+
3438
Getopt::Long::Configure("pass_through");
3539
GetOptions(
3640

3741
# Build MySQL Server and NDB with debug
38-
'debug' => \$opt_debug,
42+
'debug!' => \$opt_debug,
3943
'with-debug:s' => sub { $opt_debug = 1; },
40-
44+
'build-type=s' => \$opt_build_type,
45+
'build!' => \$opt_build,
46+
'c|just-configure' => sub { $opt_build = 0; },
47+
'n|just-print' => \$opt_just_print,
4148
) or exit(1);
4249

4350
# Find source root directory, assume this script is
4451
# in <srcroot>/storage/ndb/
45-
my $srcdir = dirname(dirname(dirname(abs_path($0))));
46-
die unless -d $srcdir; # Sanity check that the srcdir exist
52+
my $opt_srcdir = dirname(dirname(dirname(abs_path($0))));
53+
die unless -d $opt_srcdir; # Sanity check that the srcdir exist
4754
if ($^O eq "cygwin") {
4855
# Convert posix path to Windows mixed path since cmake
4956
# is most likely a windows binary
50-
$srcdir= `cygpath -m $srcdir`;
51-
chomp $srcdir;
57+
$opt_srcdir= `cygpath -m $opt_srcdir`;
58+
chomp $opt_srcdir;
5259
}
5360

5461
# Check that cmake exists and figure out it's version
@@ -61,7 +68,7 @@ my $cmake_version_id;
6168
{
6269
#print "1: $1 2: $2 3: $3\n";
6370
$cmake_version_id= $1*10000 + $2*100 + $3;
64-
print "cmake_version_id: $cmake_version_id\n";
71+
#print "cmake_version_id: $cmake_version_id\n";
6572
}
6673
die "Could not parse cmake version" unless ($cmake_version_id);
6774
}
@@ -71,37 +78,244 @@ my $cmake_version_id;
7178
# Configure
7279
#
7380
{
81+
# Remove old CMakeCache.txt(ignore if not exists) to
82+
# force fresh configure
83+
unlink("CMakeCache.txt");
84+
7485
my @args;
75-
push(@args, "$srcdir/cmake/configure.pl");
76-
77-
# MySQL Server options
78-
push(@args, "--with-ssl");
86+
87+
# Hardcoded options controlling how to build MySQL Server
88+
push(@args, "-DWITH_SSL=bundled");
7989

8090
if ($opt_debug)
8191
{
82-
push(@args, "--with-debug");
83-
push(@args, "--disable-mysql-maintainer-mode");
92+
push(@args, "-DWITH_DEBUG=1");
93+
push(@args, "-DMYSQL_MAINTAINER_MODE=0");
8494
}
8595

86-
# NDB options
87-
push(@args, "--with-plugin-ndbcluster");
88-
push(@args, "--with-ndb-test");
96+
# Hardcoded options controlling how to build NDB
97+
push(@args, "-DWITH_PLUGIN_NDBCLUSTER=1");
98+
push(@args, "-DWITH_NDB_TEST=1");
8999

90-
cmd($^X, @args, @ARGV);
100+
# The cmake generator to use
101+
if ($opt_build_type)
102+
{
103+
push(@args, "-G \"$opt_build_type\"");
104+
}
105+
106+
# Sets installation directory, bindir, libdir, libexecdir etc.
107+
# The equivalent CMake variables are given without prefix
108+
# e.g if --prefix is /usr and --bindir is /usr/bin
109+
# then cmake variable (INSTALL_BINDIR) must be just "bin"
110+
my $opt_prefix;
111+
sub set_installdir
112+
{
113+
my($path, $varname) = @_;
114+
my $prefix_length = length($opt_prefix);
115+
if (($prefix_length > 0) && (index($path,$opt_prefix) == 0))
116+
{
117+
# path is under the prefix, remove the prefix and
118+
# maybe following "/"
119+
$path = substr($path, $prefix_length);
120+
if(length($path) > 0)
121+
{
122+
my $char = substr($path, 0, 1);
123+
if($char eq "/")
124+
{
125+
$path= substr($path, 1);
126+
}
127+
}
128+
if(length($path) > 0)
129+
{
130+
push(@args, "-D$varname=$path");
131+
}
132+
}
133+
}
134+
135+
# Process --configure style arguments which need special conversion
136+
my $opt_bindir;
137+
my $opt_libdir;
138+
my $opt_libexecdir;
139+
my $opt_includedir;
140+
my $opt_with_zlib_dir;
141+
my $opt_with_ssl;
142+
my $opt_localstatedir;
143+
my $opt_mysql_maintainer_mode;
144+
my $opt_with_gcov;
145+
my $opt_with_comment;
146+
my $opt_with_plugins;
147+
my $opt_without_plugin;
148+
my $opt_extra_charsets;
149+
my $opt_with_extra_charsets;
150+
Getopt::Long::Configure("pass_through");
151+
GetOptions(
152+
'prefix=s' => \$opt_prefix,
153+
'srcdir=s' => \$opt_srcdir,
154+
'bindir=s' => \$opt_bindir,
155+
'libdir=s' => \$opt_libdir,
156+
'libexecdir=s' => \$opt_libexecdir,
157+
'includedir=s' => \$opt_includedir,
158+
'with-zlib-dir=s' => \$opt_with_zlib_dir,
159+
'with-ssl:s' => \$opt_with_ssl,
160+
'localstatedir=s' => \$opt_localstatedir,
161+
'mysql-maintainer-mode=s' => \$opt_mysql_maintainer_mode,
162+
'with-gcov' => \$opt_with_gcov,
163+
'with-comment=s' => \$opt_with_comment,
164+
'with-plugins=s' => \$opt_with_plugins,
165+
'without-plugin=s' => \$opt_without_plugin,
166+
'with-extra-charsets=s' => \$opt_with_extra_charsets,
167+
'extra-charsets=s' => \$opt_extra_charsets,
168+
) or exit(1);
169+
170+
if($opt_prefix)
171+
{
172+
push(@args, "-DCMAKE_INSTALL_PREFIX=$opt_prefix");
173+
}
174+
if($opt_bindir)
175+
{
176+
set_installdir($opt_bindir, "INSTALL_BINDIR");
177+
}
178+
if($opt_libdir)
179+
{
180+
set_installdir($opt_libdir, "INSTALL_LIBDIR");
181+
}
182+
if($opt_libexecdir)
183+
{
184+
set_installdir($opt_libexecdir, "INSTALL_SBINDIR");
185+
}
186+
if($opt_includedir)
187+
{
188+
set_installdir($opt_includedir, "INSTALL_INCLUDEDIR");
189+
}
190+
if($opt_with_zlib_dir)
191+
{
192+
$opt_with_zlib_dir = "system"
193+
if ($opt_with_zlib_dir ne "bundled");
194+
push(@args, "-DWITH_ZLIB=$opt_with_zlib_dir");
195+
}
196+
if($opt_with_ssl)
197+
{
198+
push(@args, "-DWITH_SSL=".($opt_with_ssl ? "yes" : "bundled"));
199+
}
200+
if ($opt_localstatedir)
201+
{
202+
push(@args, "-DMYSQL_DATADIR=$opt_localstatedir");
203+
}
204+
if ($opt_mysql_maintainer_mode)
205+
{
206+
push(@args, "-DMYSQL_MAINTAINER_MODE=" .
207+
($opt_mysql_maintainer_mode =~ /enable/ ? "1" : "0"));
208+
}
209+
if ($opt_with_gcov)
210+
{
211+
push(@args, "-DENABLE_GCOV=ON");
212+
}
213+
if ($opt_with_comment)
214+
{
215+
push(@args, "\"-DWITH_COMMENT=$opt_with_comment\"");
216+
}
217+
if($opt_with_plugins)
218+
{
219+
my @plugins= split(/,/, $opt_with_plugins);
220+
foreach my $p (@plugins)
221+
{
222+
$p =~ s/-/_/g;
223+
push(@args, "-DWITH_".uc($p)."=1");
224+
}
225+
}
226+
if($opt_without_plugin)
227+
{
228+
push(@args, "-DWITHOUT_".uc($opt_without_plugin)."=1");
229+
}
230+
if ($opt_extra_charsets)
231+
{
232+
push(@args, "-DWITH_CHARSETS=$opt_extra_charsets");
233+
}
234+
if($opt_with_extra_charsets)
235+
{
236+
push(@args, "-DWITH_EXTRA_CHARSETS=$opt_with_extra_charsets");
237+
}
238+
239+
240+
# Default conversion of remaining args in ARGV from
241+
# 1) --arg -> -DARG=1
242+
# 2) --arg=value -> -DARG=value
243+
# 3) arg=value -> environment variable arg=value
244+
foreach my $option (@ARGV)
245+
{
246+
if ($option =~ /^--/)
247+
{
248+
# Remove leading --
249+
$option = substr($option, 2);
250+
251+
my @v = split('=', $option);
252+
my $name = shift(@v);
253+
$name = uc($name);
254+
$name =~ s/-/_/g;
255+
if (@v)
256+
{
257+
push(@args, "-D$name=".join('=', @v));
258+
}
259+
else
260+
{
261+
push(@args, "-D$name=1");
262+
}
263+
}
264+
else
265+
{
266+
267+
# This must be environment variable
268+
my @v = split('=', $option);
269+
my $name = shift(@v);
270+
if(@v)
271+
{
272+
$ENV{$name} = join('=', @v);
273+
}
274+
else
275+
{
276+
die "unhandled argument '$option' found";
277+
}
278+
}
279+
}
280+
281+
# The source directory to build from
282+
die "srcdir already contains CMakeCache.txt, this will not work!"
283+
if (-f "$opt_srcdir/CMakeCache.txt");
284+
push(@args, $opt_srcdir);
285+
286+
cmd("cmake", @args);
287+
}
288+
289+
if (!$opt_build)
290+
{
291+
print "Configuration completed, skipping build(used --no-build)\n";
292+
exit(0);
91293
}
92294

295+
93296
#
94297
# Build
95298
#
96299
{
97300
if ($cmake_version_id >= 20800)
98301
{
99-
# Use the universal "cmake --build <srcdir>" way of building
302+
# Use the universal "cmake --build <dir>" way of building
100303
# which is available from cmake 2.8 and works on all platforms
101304
my @args;
102305
push(@args, "--build");
103-
104-
push(@args, "$srcdir");
306+
push(@args, ".");
307+
308+
if ($^O eq "cygwin" or $^O eq "MSWin32")
309+
{
310+
# Choose to build RelWitDebInfo by default on Windows
311+
my $config = 'RelWithDebInfo';
312+
if ($opt_debug)
313+
{
314+
$config = 'Debug';
315+
}
316+
push(@args, "--config");
317+
push(@args, $config);
318+
}
105319

106320
cmd("cmake", @args);
107321

@@ -112,12 +326,18 @@ my $cmake_version_id;
112326
die "You need to install cmake with version > 2.8"
113327
if ($^O eq "cygwin" or $^O eq "MSWin32");
114328

115-
cmd("make -C $srcdir");
329+
cmd("make");
116330
}
117331
}
118332

119333
sub cmd {
120334
my ($cmd, @a)= @_;
335+
336+
if ($opt_just_print){
337+
print "$cmd ", join(' ', @a), "\n";
338+
return;
339+
}
340+
121341
print "compile-cluster: calling '$cmd ", join(' ', @a), "'\n";
122342
system($cmd, @a)
123343
and print("command failed: $!\n")

0 commit comments

Comments
 (0)
Please sign in to comment.