Skip to content

Commit 6668f3e

Browse files
author
Pavan Naik
committed
WL#12137: ENHANCE MTR TO DISABLE/ENABLE SECONDARY STORAGE ENGINE
Description: ------------ MySQL now supports secondary storage engine for a table. This WL will introduce a new MTR option --secondary-engine=engine_name. * When --secondary-engine=engine_name option is enabled, MTR will take care of doing the necessary setup needed to support the secondary engine. * Engine name argument value is case-insensitive. * MTR will throw an error if an engine name arguments is not valid. Change-Id: I032d30994141fc213dc05ed16238ff03af0a5bf6
1 parent f62c704 commit 6668f3e

File tree

6 files changed

+576
-53
lines changed

6 files changed

+576
-53
lines changed

mysql-test/lib/My/ConfigFactory.pm

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,45 @@ if (IS_WINDOWS) {
313313
push(@mysqld_rules, { 'shared-memory-base-name' => \&fix_socket });
314314
}
315315

316+
sub fix_memory_heap_size {
317+
return 8 * 1024 * 1024 * 1024;
318+
}
319+
320+
sub fix_network_interface {
321+
return My::SysInfo->network_interface();
322+
}
323+
324+
# Rules to run for each mysqld server in the config if
325+
# secondary engine rapid is enabled.
326+
# - will be run in order listed here
327+
my @rapid_mysqld_rules = ({ 'binlog-format' => "ROW" },
328+
{ 'binlog-row-image' => "FULL" },
329+
{ 'binlog-checksum' => "NONE" },
330+
{ 'gtid-mode' => "OFF" },
331+
{ 'log-bin' => "binlog" },
332+
{ 'innodb_buffer_pool_size' => 268435456 },
333+
{ 'innodb_read_io_threads' => 32 },
334+
{ 'innodb_thread_concurrency' => 32 },
335+
{ 'innodb_use_native_aio' => "ON" },);
336+
337+
# Rules to run for each rapid server in the config
338+
# - will be run in order listed here
339+
my @rapid_rules = (
340+
{ 'load_multi_buffering' => 2 },
341+
{ 'memory_heap_size' => \&fix_memory_heap_size },
342+
{ 'orma_heartbeat_check_interval' => 60 },
343+
{ 'orma_rapid_nodes_join_timeout_sec' => 300 },
344+
{ 'query_network_dump' => 0 },
345+
{ 'rapid_enabled' => 1 },
346+
{ 'rapid_settings' => 149 },
347+
{ 'trans_interface' => \&fix_network_interface },
348+
{ 'trans_ipc_enabled' => 1 },
349+
{ 'trans_iplist' => "127.0.0.1" },
350+
{ 'trans_spareiplist' => "" },
351+
352+
{ 'trans_ports' => sub { return $::rapid_port }
353+
},);
354+
316355
sub fix_ndb_mgmd_port {
317356
my ($self, $config, $group_name, $group) = @_;
318357
my $hostname = $group->value('HostName');
@@ -376,6 +415,44 @@ my @mysqlbinlog_rules = (
376415
# - will be run in order listed here
377416
my @mysql_upgrade_rules = ();
378417

418+
# Generate a [rapid] group to be used for connecting
419+
# to a rapid server.
420+
sub post_check_rapid_group {
421+
my ($self, $config) = @_;
422+
423+
foreach my $hash (@rapid_rules) {
424+
while (my ($option, $rule) = each(%{$hash})) {
425+
my $value;
426+
if (ref $rule eq "CODE") {
427+
# Call the rule function
428+
$value = &$rule($self, $config);
429+
} else {
430+
$value = $rule;
431+
}
432+
$config->insert("rapid", $option, $value);
433+
}
434+
}
435+
}
436+
437+
# Insert mysqld server options required when secondary engine
438+
# rapid is enabled.
439+
sub post_check_rapid_mysqld_group {
440+
my ($self, $config) = @_;
441+
442+
foreach my $hash (@rapid_mysqld_rules) {
443+
while (my ($option, $rule) = each(%{$hash})) {
444+
my $value;
445+
if (ref $rule eq "CODE") {
446+
# Call the rule function
447+
$value = &$rule($self, $config);
448+
} else {
449+
$value = $rule;
450+
}
451+
$config->insert("mysqld", $option, $value);
452+
}
453+
}
454+
}
455+
379456
# Generate a [client.<suffix>] group to be used for
380457
# connecting to [mysqld.<suffix>].
381458
sub post_check_client_group {
@@ -633,6 +710,13 @@ sub new_config {
633710
$self->run_rules_for_group($config, $config->insert('mysqltest'),
634711
@mysqltest_rules);
635712

713+
if ($::secondary_engine_rapid) {
714+
# Additional rules required for [rapid]
715+
push(@post_rules, \&post_check_rapid_group);
716+
# Additional rules required for [mysqld] when rapid is enabled
717+
push(@post_rules, \&post_check_rapid_mysqld_group);
718+
}
719+
636720
# Run post rules
637721
foreach my $rule (@post_rules) {
638722
&$rule($self, $config);

mysql-test/lib/My/CoreDump.pm

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use My::Platform;
3131
use mtr_results;
3232

3333
# Last resort guess for executable path
34-
my $hint_mysqld;
34+
my $hint_exe;
3535

3636
# If path in core file is 79 chars we assume it's been truncated.
3737
# Looks like we can still find the full path using 'strings'. If
@@ -40,7 +40,11 @@ sub _verify_binpath {
4040
my ($binary, $core_name) = @_;
4141

4242
my $binpath;
43-
if (length $binary != 79) {
43+
if ($::secondary_engine_rapid) {
44+
return unless $hint_exe;
45+
$binpath = $hint_exe;
46+
print "Core generated by '$binpath'\n";
47+
} elsif (length $binary != 79) {
4448
$binpath = $binary;
4549
print "Core generated by '$binpath'\n";
4650
} else {
@@ -49,8 +53,8 @@ sub _verify_binpath {
4953
$binpath = $1;
5054
print "Guessing that core was generated by '$binpath'\n";
5155
} else {
52-
return unless $hint_mysqld;
53-
$binpath = $hint_mysqld;
56+
return unless $hint_exe;
57+
$binpath = $hint_exe;
5458
print "Wild guess that core was generated by '$binpath'\n";
5559
}
5660
}
@@ -261,7 +265,7 @@ EOF
261265

262266
sub show {
263267
my ($class, $core_name, $exe_mysqld, $parallel) = @_;
264-
$hint_mysqld = $exe_mysqld;
268+
$hint_exe = $exe_mysqld;
265269

266270
# On Windows, rely on cdb to be there.
267271
if (IS_WINDOWS) {

mysql-test/lib/My/SysInfo.pm

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,21 @@ sub print_info {
223223
}
224224
}
225225

226+
# Return the network interface
227+
sub network_interface {
228+
my $out = (IS_WINDOWS) ? 'nul' : '/dev/null';
229+
230+
# Hardcode the default value, in case the below check fails.
231+
my $network_interface = "eth0";
232+
233+
`ip link 2> $out`;
234+
if ($? == 0) {
235+
$network_interface =
236+
`ip link show | grep "state UP" | cut -d ':' -f 2 | tr -d ' ' | head -n1 2> $out`;
237+
chomp($network_interface);
238+
}
239+
240+
return $network_interface;
241+
}
242+
226243
1;

0 commit comments

Comments
 (0)