Skip to content

Commit f070082

Browse files
committed
WL#15831: Step 3/4: Renaming structures in server code
As a result of the renaming done in the past steps, several files in the server need to be updated to use the new command names, class names, enumeration values, etc. Change-Id: I6f969d68a56ae292f99fb1162c0ed3d8d1183758
1 parent 3d96561 commit f070082

23 files changed

+327
-389
lines changed

sql/binlog.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -3407,7 +3407,7 @@ bool show_binlog_events(THD *thd, MYSQL_BIN_LOG *binary_log) {
34073407
thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS);
34083408

34093409
if (binary_log->is_open()) {
3410-
LEX_MASTER_INFO *lex_mi = &thd->lex->mi;
3410+
LEX_SOURCE_INFO *lex_mi = &thd->lex->mi;
34113411
Query_expression *unit = thd->lex->unit;
34123412
ha_rows event_count, limit_start, limit_end;
34133413
my_off_t pos =
@@ -3753,7 +3753,7 @@ static int find_uniq_filename(char *name, uint32 new_index_number) {
37533753
}
37543754

37553755
/* print warning if reaching the end of available extensions. */
3756-
if (next > MAX_ALLOWED_FN_EXT_RESET_MASTER)
3756+
if (next > MAX_ALLOWED_FN_EXT_RESET_BIN_LOGS)
37573757
LogErr(WARNING_LEVEL, ER_BINLOG_FILE_EXTENSION_NUMBER_RUNNING_LOW, next,
37583758
(MAX_LOG_UNIQUE_FN_EXT - next));
37593759

sql/binlog.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ typedef int64 query_id_t;
8484
Maximum allowed unique log filename extension for
8585
RESET BINARY LOGS AND GTIDS command - 2 Billion
8686
*/
87-
#define MAX_ALLOWED_FN_EXT_RESET_MASTER 2000000000
87+
#define MAX_ALLOWED_FN_EXT_RESET_BIN_LOGS 2000000000
8888

8989
struct Binlog_user_var_event {
9090
user_var_entry *user_var_event;

sql/changestreams/apply/constants.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
#ifndef CHANGE_STREAM_APPLY_CONSTANTS_H_
2626
#define CHANGE_STREAM_APPLY_CONSTANTS_H_
2727

28-
/* masks for start/stop operations on io and sql slave threads */
29-
static constexpr unsigned long SLAVE_IO = 1;
30-
static constexpr unsigned long SLAVE_SQL = 2;
28+
/* masks for start/stop operations on io and sql threads */
29+
static constexpr unsigned long REPLICA_IO = 1;
30+
static constexpr unsigned long REPLICA_SQL = 2;
3131
// We also have SLAVE_FORCE_ALL 4
3232
static constexpr unsigned long SLAVE_MONITOR = 8;
3333

sql/changestreams/apply/replication_thread_status.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ void init_thread_mask(int *mask, Master_info *mi, bool inverse,
5353
int tmp_mask{0};
5454
DBUG_TRACE;
5555

56-
if (set_io) tmp_mask |= SLAVE_IO;
57-
if (set_sql) tmp_mask |= SLAVE_SQL;
56+
if (set_io) tmp_mask |= REPLICA_IO;
57+
if (set_sql) tmp_mask |= REPLICA_SQL;
5858
if (!ignore_monitor_thread && set_monitor &&
5959
mi->is_source_connection_auto_failover()) {
6060
tmp_mask |= SLAVE_MONITOR;
6161
}
6262

6363
if (inverse) {
64-
tmp_mask ^= (SLAVE_IO | SLAVE_SQL);
64+
tmp_mask ^= (REPLICA_IO | REPLICA_SQL);
6565
if (!ignore_monitor_thread && mi->is_source_connection_auto_failover()) {
6666
tmp_mask ^= SLAVE_MONITOR;
6767
}

sql/parse_tree_nodes.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -3732,7 +3732,7 @@ class PT_show_keys final : public PT_show_table_base {
37323732
class PT_show_binary_log_status final : public PT_show_base {
37333733
public:
37343734
PT_show_binary_log_status(const POS &pos)
3735-
: PT_show_base(pos, SQLCOM_SHOW_MASTER_STAT) {}
3735+
: PT_show_base(pos, SQLCOM_SHOW_BINLOG_STATUS) {}
37363736

37373737
Sql_cmd *make_cmd(THD *thd) override;
37383738

@@ -3877,8 +3877,7 @@ class PT_show_relaylog_events final : public PT_show_base {
38773877

38783878
class PT_show_replicas final : public PT_show_base {
38793879
public:
3880-
PT_show_replicas(const POS &pos)
3881-
: PT_show_base(pos, SQLCOM_SHOW_SLAVE_HOSTS) {}
3880+
PT_show_replicas(const POS &pos) : PT_show_base(pos, SQLCOM_SHOW_REPLICAS) {}
38823881

38833882
Sql_cmd *make_cmd(THD *thd) override;
38843883

@@ -3891,7 +3890,7 @@ class PT_show_replicas final : public PT_show_base {
38913890
class PT_show_replica_status final : public PT_show_base {
38923891
public:
38933892
PT_show_replica_status(const POS &pos, LEX_CSTRING opt_channel_name = {})
3894-
: PT_show_base(pos, SQLCOM_SHOW_SLAVE_STAT),
3893+
: PT_show_base(pos, SQLCOM_SHOW_REPLICA_STATUS),
38953894
m_opt_channel_name(opt_channel_name) {}
38963895

38973896
Sql_cmd *make_cmd(THD *thd) override;

sql/rpl_async_conn_failover.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ bool Async_conn_failover_manager::set_channel_conn_details(
258258
init_thread_mask(&thread_mask, mi, false);
259259

260260
/* If the receiver is stopped, flush master_info to disk. */
261-
if ((thread_mask & SLAVE_IO) == 0 && flush_master_info(mi, true)) {
261+
if ((thread_mask & REPLICA_IO) == 0 && flush_master_info(mi, true)) {
262262
error = true;
263263
my_error(ER_RELAY_LOG_INIT, MYF(0),
264264
"Failed to flush connection metadata repository");

sql/rpl_channel_service_interface.cc

+39-39
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ void initialize_channel_connection_info(Channel_connection_info *channel_info) {
226226
channel_info->view_id = nullptr;
227227
}
228228

229-
static void set_mi_ssl_options(LEX_MASTER_INFO *lex_mi,
229+
static void set_mi_ssl_options(LEX_SOURCE_INFO *lex_mi,
230230
Channel_ssl_info *channel_ssl_info) {
231-
lex_mi->ssl = (channel_ssl_info->use_ssl) ? LEX_MASTER_INFO::LEX_MI_ENABLE
232-
: LEX_MASTER_INFO::LEX_MI_DISABLE;
231+
lex_mi->ssl = (channel_ssl_info->use_ssl) ? LEX_SOURCE_INFO::LEX_MI_ENABLE
232+
: LEX_SOURCE_INFO::LEX_MI_DISABLE;
233233

234234
if (channel_ssl_info->ssl_ca_file_name != nullptr) {
235235
lex_mi->ssl_ca = channel_ssl_info->ssl_ca_file_name;
@@ -264,23 +264,23 @@ static void set_mi_ssl_options(LEX_MASTER_INFO *lex_mi,
264264
}
265265

266266
if (channel_ssl_info->tls_ciphersuites != nullptr) {
267-
lex_mi->tls_ciphersuites = LEX_MASTER_INFO::SPECIFIED_STRING;
267+
lex_mi->tls_ciphersuites = LEX_SOURCE_INFO::SPECIFIED_STRING;
268268
lex_mi->tls_ciphersuites_string = channel_ssl_info->tls_ciphersuites;
269269
} else {
270-
lex_mi->tls_ciphersuites = LEX_MASTER_INFO::SPECIFIED_NULL;
270+
lex_mi->tls_ciphersuites = LEX_SOURCE_INFO::SPECIFIED_NULL;
271271
}
272272

273273
lex_mi->ssl_verify_server_cert = (channel_ssl_info->ssl_verify_server_cert)
274-
? LEX_MASTER_INFO::LEX_MI_ENABLE
275-
: LEX_MASTER_INFO::LEX_MI_DISABLE;
274+
? LEX_SOURCE_INFO::LEX_MI_ENABLE
275+
: LEX_SOURCE_INFO::LEX_MI_DISABLE;
276276
}
277277

278278
int channel_create(const char *channel, Channel_creation_info *channel_info) {
279279
DBUG_TRACE;
280280

281281
Master_info *mi = nullptr;
282282
int error = 0;
283-
LEX_MASTER_INFO *lex_mi = nullptr;
283+
LEX_SOURCE_INFO *lex_mi = nullptr;
284284

285285
bool thd_created = false;
286286
THD *thd = current_thd;
@@ -306,32 +306,32 @@ int channel_create(const char *channel, Channel_creation_info *channel_info) {
306306
if ((error = add_new_channel(&mi, channel))) goto err;
307307
}
308308

309-
lex_mi = new LEX_MASTER_INFO();
309+
lex_mi = new LEX_SOURCE_INFO();
310310
lex_mi->channel = channel;
311311
lex_mi->host = channel_info->hostname;
312312
/*
313313
'group_replication_recovery' channel (*after recovery is done*)
314314
or 'group_replication_applier' channel wants to set the port number
315315
to '0' as there is no actual network usage on these channels.
316316
*/
317-
lex_mi->port_opt = LEX_MASTER_INFO::LEX_MI_ENABLE;
317+
lex_mi->port_opt = LEX_SOURCE_INFO::LEX_MI_ENABLE;
318318
lex_mi->port = channel_info->port;
319319
lex_mi->user = channel_info->user;
320320
lex_mi->password = channel_info->password;
321321
lex_mi->sql_delay = channel_info->sql_delay;
322322
lex_mi->connect_retry = channel_info->connect_retry;
323323
if (channel_info->retry_count) {
324-
lex_mi->retry_count_opt = LEX_MASTER_INFO::LEX_MI_ENABLE;
324+
lex_mi->retry_count_opt = LEX_SOURCE_INFO::LEX_MI_ENABLE;
325325
lex_mi->retry_count = channel_info->retry_count;
326326
}
327327

328328
if (channel_info->auto_position) {
329-
lex_mi->auto_position = LEX_MASTER_INFO::LEX_MI_ENABLE;
329+
lex_mi->auto_position = LEX_SOURCE_INFO::LEX_MI_ENABLE;
330330
if ((mi && mi->is_auto_position()) ||
331331
channel_info->auto_position == RPL_SERVICE_SERVER_DEFAULT) {
332332
// So change replication source allows new configurations with a running
333333
// SQL thread
334-
lex_mi->auto_position = LEX_MASTER_INFO::LEX_MI_UNCHANGED;
334+
lex_mi->auto_position = LEX_SOURCE_INFO::LEX_MI_UNCHANGED;
335335
}
336336
}
337337

@@ -340,18 +340,18 @@ int channel_create(const char *channel, Channel_creation_info *channel_info) {
340340
}
341341

342342
if (channel_info->get_public_key) {
343-
lex_mi->get_public_key = LEX_MASTER_INFO::LEX_MI_ENABLE;
343+
lex_mi->get_public_key = LEX_SOURCE_INFO::LEX_MI_ENABLE;
344344
if (mi && mi->get_public_key) {
345345
// So change replication source allows new configurations with a running
346346
// SQL thread
347-
lex_mi->get_public_key = LEX_MASTER_INFO::LEX_MI_UNCHANGED;
347+
lex_mi->get_public_key = LEX_SOURCE_INFO::LEX_MI_UNCHANGED;
348348
}
349349
} else {
350-
lex_mi->get_public_key = LEX_MASTER_INFO::LEX_MI_DISABLE;
350+
lex_mi->get_public_key = LEX_SOURCE_INFO::LEX_MI_DISABLE;
351351
if (mi && !mi->get_public_key) {
352352
// So change replication source allows new configurations with a running
353353
// SQL thread
354-
lex_mi->get_public_key = LEX_MASTER_INFO::LEX_MI_UNCHANGED;
354+
lex_mi->get_public_key = LEX_SOURCE_INFO::LEX_MI_UNCHANGED;
355355
}
356356
}
357357

@@ -362,16 +362,16 @@ int channel_create(const char *channel, Channel_creation_info *channel_info) {
362362
lex_mi->zstd_compression_level = channel_info->zstd_compression_level;
363363
}
364364

365-
lex_mi->m_source_connection_auto_failover = LEX_MASTER_INFO::LEX_MI_UNCHANGED;
365+
lex_mi->m_source_connection_auto_failover = LEX_SOURCE_INFO::LEX_MI_UNCHANGED;
366366
if (channel_info->m_source_connection_auto_failover) {
367367
if (mi && !mi->is_source_connection_auto_failover()) {
368368
lex_mi->m_source_connection_auto_failover =
369-
LEX_MASTER_INFO::LEX_MI_ENABLE;
369+
LEX_SOURCE_INFO::LEX_MI_ENABLE;
370370
}
371371
} else {
372372
if (mi && mi->is_source_connection_auto_failover()) {
373373
lex_mi->m_source_connection_auto_failover =
374-
LEX_MASTER_INFO::LEX_MI_DISABLE;
374+
LEX_SOURCE_INFO::LEX_MI_DISABLE;
375375
}
376376
}
377377

@@ -418,7 +418,7 @@ int channel_start(const char *channel, Channel_connection_info *connection_info,
418418
DBUG_TRACE;
419419
int error = 0;
420420
int thread_mask = 0;
421-
LEX_MASTER_INFO lex_mi;
421+
LEX_SOURCE_INFO lex_mi;
422422
ulong thread_start_id = 0;
423423
bool thd_created = false;
424424
THD *thd = current_thd;
@@ -445,16 +445,16 @@ int channel_start(const char *channel, Channel_connection_info *connection_info,
445445
}
446446

447447
if (threads_to_start & CHANNEL_APPLIER_THREAD) {
448-
thread_mask |= SLAVE_SQL;
448+
thread_mask |= REPLICA_SQL;
449449
}
450450
if (threads_to_start & CHANNEL_RECEIVER_THREAD) {
451-
thread_mask |= SLAVE_IO;
451+
thread_mask |= REPLICA_IO;
452452
}
453453

454454
// Nothing to be done here
455455
if (!thread_mask) goto err;
456456

457-
LEX_SLAVE_CONNECTION lex_connection;
457+
LEX_REPLICA_CONNECTION lex_connection;
458458
lex_connection.reset();
459459

460460
if (!Rpl_channel_credentials::get_instance().get_credentials(channel, user,
@@ -470,26 +470,26 @@ int channel_start(const char *channel, Channel_connection_info *connection_info,
470470
if (connection_info->until_condition != CHANNEL_NO_UNTIL_CONDITION) {
471471
switch (connection_info->until_condition) {
472472
case CHANNEL_UNTIL_APPLIER_AFTER_GTIDS:
473-
lex_mi.gtid_until_condition = LEX_MASTER_INFO::UNTIL_SQL_AFTER_GTIDS;
473+
lex_mi.gtid_until_condition = LEX_SOURCE_INFO::UNTIL_SQL_AFTER_GTIDS;
474474
lex_mi.gtid = connection_info->gtid;
475475
break;
476476
case CHANNEL_UNTIL_APPLIER_BEFORE_GTIDS:
477-
lex_mi.gtid_until_condition = LEX_MASTER_INFO::UNTIL_SQL_BEFORE_GTIDS;
477+
lex_mi.gtid_until_condition = LEX_SOURCE_INFO::UNTIL_SQL_BEFORE_GTIDS;
478478
lex_mi.gtid = connection_info->gtid;
479479
break;
480480
case CHANNEL_UNTIL_APPLIER_AFTER_GAPS:
481481
lex_mi.until_after_gaps = true;
482482
break;
483483
case CHANNEL_UNTIL_VIEW_ID:
484-
assert((thread_mask & SLAVE_SQL) && connection_info->view_id);
484+
assert((thread_mask & REPLICA_SQL) && connection_info->view_id);
485485
lex_mi.view_id = connection_info->view_id;
486486
break;
487487
default:
488488
assert(0);
489489
}
490490
}
491491

492-
if (wait_for_connection && (thread_mask & SLAVE_IO))
492+
if (wait_for_connection && (thread_mask & REPLICA_IO))
493493
thread_start_id = mi->slave_run_id;
494494

495495
if (!thd) {
@@ -500,7 +500,7 @@ int channel_start(const char *channel, Channel_connection_info *connection_info,
500500
error = start_slave(thd, &lex_connection, &lex_mi, thread_mask, mi,
501501
use_server_mta_configuration);
502502

503-
if (wait_for_connection && (thread_mask & SLAVE_IO) && !error) {
503+
if (wait_for_connection && (thread_mask & REPLICA_IO) && !error) {
504504
mysql_mutex_lock(&mi->run_lock);
505505
/*
506506
If the ids are still equal this means the start thread method did not
@@ -551,12 +551,12 @@ int channel_stop(Master_info *mi, int threads_to_stop, long timeout) {
551551
init_thread_mask(&server_thd_mask, mi, false /* not inverse*/);
552552

553553
if ((threads_to_stop & CHANNEL_APPLIER_THREAD) &&
554-
(server_thd_mask & SLAVE_SQL)) {
555-
thread_mask |= SLAVE_SQL;
554+
(server_thd_mask & REPLICA_SQL)) {
555+
thread_mask |= REPLICA_SQL;
556556
}
557557
if ((threads_to_stop & CHANNEL_RECEIVER_THREAD) &&
558-
(server_thd_mask & SLAVE_IO)) {
559-
thread_mask |= SLAVE_IO;
558+
(server_thd_mask & REPLICA_IO)) {
559+
thread_mask |= REPLICA_IO;
560560
}
561561
if ((threads_to_stop & CHANNEL_RECEIVER_THREAD) &&
562562
(server_thd_mask & SLAVE_MONITOR)) {
@@ -716,9 +716,9 @@ bool channel_is_active(const char *channel,
716716
case CHANNEL_NO_THD:
717717
return true; // return true as the channel exists
718718
case CHANNEL_RECEIVER_THREAD:
719-
return thread_mask & SLAVE_IO;
719+
return thread_mask & REPLICA_IO;
720720
case CHANNEL_APPLIER_THREAD:
721-
return thread_mask & SLAVE_SQL;
721+
return thread_mask & REPLICA_SQL;
722722
default:
723723
assert(0);
724724
}
@@ -1206,7 +1206,7 @@ bool is_any_slave_channel_running(int thread_mask) {
12061206
mi = it->second;
12071207

12081208
if (mi) {
1209-
if ((thread_mask & SLAVE_IO) != 0) {
1209+
if ((thread_mask & REPLICA_IO) != 0) {
12101210
mysql_mutex_lock(&mi->run_lock);
12111211
is_running = mi->slave_running;
12121212
mysql_mutex_unlock(&mi->run_lock);
@@ -1216,7 +1216,7 @@ bool is_any_slave_channel_running(int thread_mask) {
12161216
}
12171217
}
12181218

1219-
if ((thread_mask & SLAVE_SQL) != 0) {
1219+
if ((thread_mask & REPLICA_SQL) != 0) {
12201220
mysql_mutex_lock(&mi->rli->run_lock);
12211221
is_running = mi->rli->slave_running;
12221222
mysql_mutex_unlock(&mi->rli->run_lock);
@@ -1245,7 +1245,7 @@ bool is_any_slave_channel_running_with_failover_enabled(int thread_mask) {
12451245

12461246
if (mi && Master_info::is_configured(mi) &&
12471247
mi->is_source_connection_auto_failover()) {
1248-
if ((thread_mask & SLAVE_IO) != 0) {
1248+
if ((thread_mask & REPLICA_IO) != 0) {
12491249
mysql_mutex_lock(&mi->run_lock);
12501250
is_running = mi->slave_running;
12511251
mysql_mutex_unlock(&mi->run_lock);
@@ -1255,7 +1255,7 @@ bool is_any_slave_channel_running_with_failover_enabled(int thread_mask) {
12551255
}
12561256
}
12571257

1258-
if ((thread_mask & SLAVE_SQL) != 0) {
1258+
if ((thread_mask & REPLICA_SQL) != 0) {
12591259
mysql_mutex_lock(&mi->rli->run_lock);
12601260
is_running = mi->rli->slave_running;
12611261
mysql_mutex_unlock(&mi->rli->run_lock);

sql/rpl_filter.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#include "sql/psi_memory_key.h"
5454
#include "sql/rpl_mi.h" // Master_info
5555
#include "sql/rpl_msr.h" // channel_map
56-
#include "sql/rpl_replica.h" // SLAVE_SQL
56+
#include "sql/rpl_replica.h" // REPLICA_SQL
5757
#include "sql/rpl_rli.h" // Relay_log_info
5858
#include "sql/sql_class.h"
5959
#include "sql/sql_lex.h"
@@ -200,7 +200,8 @@ int Rpl_filter::copy_global_replication_filters() {
200200
if (rpl_global_filter.is_empty()) return 0;
201201

202202
THD *thd = current_thd;
203-
if (thd != nullptr && thd->lex->sql_command == SQLCOM_CHANGE_MASTER) {
203+
if (thd != nullptr &&
204+
thd->lex->sql_command == SQLCOM_CHANGE_REPLICATION_SOURCE) {
204205
/*
205206
Acquire the write lock when copying global replication filter if
206207
a new channel is being created by CHANGE REPLICATION SOURCE TO ... FOR
@@ -1402,7 +1403,7 @@ bool Sql_cmd_change_repl_filter::change_rpl_filter(THD *thd) {
14021403
mysql_mutex_lock(&mi->rli->run_lock);
14031404
/* Check the running status of all SQL threads */
14041405
init_thread_mask(&thread_mask, mi, false /*not inverse*/);
1405-
if (thread_mask & SLAVE_SQL) {
1406+
if (thread_mask & REPLICA_SQL) {
14061407
/* We refuse if any slave thread is running */
14071408
my_error(ER_REPLICA_CHANNEL_SQL_THREAD_MUST_STOP, MYF(0),
14081409
mi->get_channel());
@@ -1521,7 +1522,7 @@ bool Sql_cmd_change_repl_filter::change_rpl_filter(THD *thd) {
15211522
/* check the status of SQL thread */
15221523
init_thread_mask(&thread_mask, mi, false /*not inverse*/);
15231524
/* We refuse if the slave thread is running */
1524-
if (thread_mask & SLAVE_SQL) {
1525+
if (thread_mask & REPLICA_SQL) {
15251526
my_error(ER_REPLICA_CHANNEL_SQL_THREAD_MUST_STOP, MYF(0),
15261527
mi->get_channel());
15271528
ret = true;

0 commit comments

Comments
 (0)