Skip to content

Commit 1ecfb1b

Browse files
author
Pavan Naik
committed
WL#12137: ENHANCE MTR TO DISABLE/ENABLE SECONDARY STORAGE ENGINE
Post-push fix. Change-Id: I72057aba74366006289b4d3ace3e884c966b80e6
1 parent 135a577 commit 1ecfb1b

File tree

5 files changed

+30
-53
lines changed

5 files changed

+30
-53
lines changed

client/mysqltest.cc

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ Expected_warnings *disabled_warnings = new Expected_warnings();
154154
Expected_warnings *enabled_warnings = new Expected_warnings();
155155

156156
enum {
157-
OPT_CHANGE_PROPAGATION = OPT_MAX_CLIENT_OPTION,
158-
OPT_COLORED_DIFF,
157+
OPT_COLORED_DIFF = OPT_MAX_CLIENT_OPTION,
159158
OPT_CURSOR_PROTOCOL,
160159
OPT_EXPLAIN_PROTOCOL,
161160
OPT_JSON_EXPLAIN_PROTOCOL,
161+
OPT_LOAD_POOL,
162162
OPT_LOG_DIR,
163163
OPT_MARK_PROGRESS,
164164
OPT_MAX_CONNECT_RETRIES,
@@ -219,9 +219,9 @@ static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos = line_buffer;
219219
static bool can_handle_expired_passwords = true;
220220

221221
// Secondary engine options
222+
static const char *opt_load_pool = 0;
222223
static const char *opt_offload_count_file;
223224
static const char *opt_secondary_engine;
224-
static int opt_change_propagation;
225225

226226
static Secondary_engine *secondary_engine = nullptr;
227227

@@ -7177,10 +7177,6 @@ static struct my_option my_long_options[] = {
71777177
#include "sslopt-longopts.h"
71787178
{"basedir", 'b', "Basedir for tests.", &opt_basedir, &opt_basedir, 0,
71797179
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
7180-
{"change-propagation", OPT_CHANGE_PROPAGATION,
7181-
"Disable/enable change propagation when secondary engine is enabled.",
7182-
&opt_change_propagation, &opt_change_propagation, 0, GET_INT, REQUIRED_ARG,
7183-
-1, -1, 1, 0, 0, 0},
71847180
{"character-sets-dir", OPT_CHARSETS_DIR,
71857181
"Directory for character set files.", &opt_charsets_dir, &opt_charsets_dir,
71867182
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -7234,6 +7230,9 @@ static struct my_option my_long_options[] = {
72347230
"FORMAT=JSON",
72357231
&json_explain_protocol, &json_explain_protocol, 0, GET_BOOL, NO_ARG, 0, 0,
72367232
0, 0, 0, 0},
7233+
{"load-pool", OPT_LOAD_POOL, "Load pool value for secondary engine.",
7234+
&opt_load_pool, &opt_load_pool, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
7235+
0},
72377236
{"logdir", OPT_LOG_DIR, "Directory for log files", &opt_logdir, &opt_logdir,
72387237
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
72397238
{"mark-progress", OPT_MARK_PROGRESS,
@@ -8055,7 +8054,7 @@ static void run_query_normal(struct st_connection *cn,
80558054
MYSQL *mysql = &cn->mysql;
80568055
MYSQL_RES *res = 0;
80578056

8058-
if (opt_change_propagation != -1) {
8057+
if (opt_load_pool) {
80598058
secondary_engine->match_statement(query, expected_errors->count());
80608059
if (secondary_engine->statement_type()) {
80618060
std::vector<unsigned int> ignore_errors = expected_errors->errors();
@@ -8159,7 +8158,7 @@ static void run_query_normal(struct st_connection *cn,
81598158
// variable then can be used from the test case itself.
81608159
var_set_errno(mysql_errno(mysql));
81618160

8162-
if (opt_change_propagation != -1 && secondary_engine->statement_type()) {
8161+
if (opt_load_pool && secondary_engine->statement_type()) {
81638162
std::vector<unsigned int> ignore_errors = expected_errors->errors();
81648163
// Run secondary engine load statements.
81658164
if (secondary_engine->run_load_statements(mysql, ignore_errors))
@@ -8187,7 +8186,7 @@ static void run_query_stmt(MYSQL *mysql, struct st_command *command,
81878186
cur_con->stmt = stmt;
81888187
}
81898188

8190-
if (opt_change_propagation != -1) {
8189+
if (opt_load_pool) {
81918190
secondary_engine->match_statement(query, expected_errors->count());
81928191
if (secondary_engine->statement_type()) {
81938192
std::vector<unsigned int> ignore_errors = expected_errors->errors();
@@ -8363,7 +8362,7 @@ static void run_query_stmt(MYSQL *mysql, struct st_command *command,
83638362
cur_con->stmt = NULL;
83648363
}
83658364

8366-
if (opt_change_propagation != -1 && secondary_engine->statement_type()) {
8365+
if (opt_load_pool && secondary_engine->statement_type()) {
83678366
std::vector<unsigned int> ignore_errors = expected_errors->errors();
83688367
// Run secondary engine load statements.
83698368
if (secondary_engine->run_load_statements(mysql, ignore_errors))
@@ -9286,9 +9285,9 @@ int main(int argc, char **argv) {
92869285
open_file(opt_include);
92879286
}
92889287

9289-
if (opt_change_propagation != -1) {
9288+
if (opt_load_pool) {
92909289
secondary_engine =
9291-
new Secondary_engine(opt_change_propagation, opt_secondary_engine);
9290+
new Secondary_engine(opt_load_pool, opt_secondary_engine);
92929291
} else if (opt_offload_count_file) {
92939292
secondary_engine = new Secondary_engine();
92949293
}

client/mysqltest/secondary_engine.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ static int offload_count_before = 0;
3939

4040
/// Constructor function for 'Secondary_engine' class
4141
///
42-
/// @param change_propagation Boolean flag indicating whether change
43-
/// propagation is enabled or not.
44-
/// @param engine_name Secondary engine name
45-
Secondary_engine::Secondary_engine(bool change_propagation,
42+
/// @param load_pool Load pool value for secondary engine.
43+
/// @param engine_name Secondary engine name
44+
Secondary_engine::Secondary_engine(const char *load_pool,
4645
const char *engine_name)
47-
: m_change_propagation(change_propagation),
48-
m_engine_name(engine_name),
46+
: m_engine_name(engine_name),
47+
m_load_pool(load_pool),
4948
m_table_name(""),
5049
m_stmt_type(UNKNOWN_STMT),
5150
m_secondary_engine_errors{
@@ -364,7 +363,7 @@ void Secondary_engine::match_statement(char *statement, std::size_t errors) {
364363
if (match_create_statement(statement, &m_table_name)) {
365364
// CREATE TABLE statement
366365
m_stmt_type = CREATE_STMT;
367-
} else if (!m_change_propagation &&
366+
} else if (!std::strcmp(m_load_pool, "SNAPSHOT") &&
368367
match_dml_statement(statement, &m_table_name)) {
369368
// DML statement
370369
m_stmt_type = DML_STMT;

client/mysqltest/secondary_engine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ typedef std::vector<unsigned int> Errors;
4141
class Secondary_engine {
4242
public:
4343
Secondary_engine() {}
44-
Secondary_engine(bool change_propagation, const char *engine_name);
44+
Secondary_engine(const char *load_pool, const char *engine_name);
4545

4646
~Secondary_engine() {}
4747

@@ -129,8 +129,8 @@ class Secondary_engine {
129129
/// @retval True if execution of unload statement fails, false otherwise.
130130
bool run_secondary_unload_statement(MYSQL *mysql, Errors expected_errors);
131131

132-
bool m_change_propagation;
133132
const char *m_engine_name;
133+
const char *m_load_pool;
134134
std::string m_table_name;
135135
Statement_type m_stmt_type;
136136

mysql-test/lib/mtr_cases.pm

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ sub create_disabled_test_list($$) {
165165
unshift(@disabled_collection, $internal_disabled_def_file)
166166
if -f $internal_disabled_def_file;
167167

168+
# 'disabled.def' file in cloud directory.
169+
$internal_disabled_def_file =
170+
"$::basedir/internal/cloud/mysql-test/collections/disabled.def";
171+
unshift(@disabled_collection, $internal_disabled_def_file)
172+
if -f $internal_disabled_def_file;
173+
168174
# Add 'disabled_ndb.def' to the list of disabled files if ndb is enabled.
169175
unshift(@disabled_collection,
170176
"$::glob_mysql_test_dir/collections/disabled_ndb.def")
@@ -1196,18 +1202,6 @@ sub collect_one_test_case {
11961202
return $tinfo;
11971203
}
11981204

1199-
if ($::secondary_engine_support and
1200-
defined $::opt_change_propagation and
1201-
defined $tinfo->{'change_propagation'}) {
1202-
if ($tinfo->{'change_propagation'} and !$::opt_change_propagation) {
1203-
skip_test($tinfo, "Test requires change propagation to be ON");
1204-
return $tinfo;
1205-
} elsif (!$tinfo->{'change_propagation'} and $::opt_change_propagation) {
1206-
skip_test($tinfo, "Test requires change propagation to be OFF");
1207-
return $tinfo;
1208-
}
1209-
}
1210-
12111205
# Find config file to use if not already selected in <testname>.opt file
12121206
if (defined $defaults_file) {
12131207
# Using same config file for all tests
@@ -1315,8 +1309,8 @@ my @tags = (
13151309
# option along with valgrind option.
13161310
[ "include/no_valgrind_without_big.inc", "no_valgrind_without_big", 1 ],
13171311

1318-
[ "include/have_change_propagation_off.inc", "change_propagation", 0 ],
1319-
[ "include/have_change_propagation_on.inc", "change_propagation", 1 ],);
1312+
[ "include/have_change_propagation_off.inc", "change-propagation", 0 ],
1313+
[ "include/have_change_propagation_on.inc", "change-propagation", 1 ],);
13201314

13211315
sub tags_from_test_file {
13221316
my $tinfo = shift;

mysql-test/mysql-test-run.pl

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@
173173
my %visited_suite_names;
174174

175175
# Global variables
176-
our $opt_change_propagation;
177176
our $opt_client_dbx;
178177
our $opt_client_ddd;
179178
our $opt_client_debugger;
@@ -1428,9 +1427,6 @@ sub command_line_setup {
14281427
# Extra options used when running test clients
14291428
'mysqltest=s' => \@opt_extra_mysqltest_opt,
14301429

1431-
# Secondary engine options
1432-
'change-propagation:1' => \$opt_change_propagation,
1433-
14341430
# Debugging
14351431
'boot-dbx' => \$opt_boot_dbx,
14361432
'boot-ddd' => \$opt_boot_ddd,
@@ -1670,16 +1666,6 @@ sub command_line_setup {
16701666
mtr_error("Invalid value '$opt_test_progress' for option 'test-progress'.");
16711667
}
16721668

1673-
if (defined $opt_change_propagation) {
1674-
if (!$secondary_engine_support) {
1675-
mtr_error("Can't use '--change-propagation' option");
1676-
} elsif ($opt_change_propagation < 0 or $opt_change_propagation > 1) {
1677-
# 'change-propagation' option value should be either 0 or 1.
1678-
mtr_error("Invalid value '$opt_change_propagation' for option " .
1679-
"'--change-propagation'.");
1680-
}
1681-
}
1682-
16831669
# Read the file and store it in a string.
16841670
if ($opt_no_skip) {
16851671
$excluded_string = '';
@@ -5338,7 +5324,7 @@ ($$)
53385324
my $restart_flag = 1;
53395325
# Start secondary engine servers.
53405326
start_secondary_engine_servers($tinfo, $restart_flag);
5341-
load_table_contents($mysqld) if defined $opt_change_propagation;
5327+
load_table_contents($mysqld) if defined $tinfo->{'load_pool'};
53425328
}
53435329

53445330
return 1;
@@ -6446,8 +6432,7 @@ ($)
64466432
mtr_add_arg($args, "%s", $_) for @args_saved;
64476433
}
64486434

6449-
add_secondary_engine_options($tinfo, $args, $opt_change_propagation)
6450-
if $tinfo->{'secondary-engine'};
6435+
add_secondary_engine_options($tinfo, $args) if $tinfo->{'secondary-engine'};
64516436

64526437
mtr_add_arg($args, "--test-file=%s", $tinfo->{'path'});
64536438

0 commit comments

Comments
 (0)