Skip to content

Commit 3ba73e6

Browse files
committed
issues found by CI, 1st batch
1 parent 7a8834b commit 3ba73e6

File tree

6 files changed

+21
-11
lines changed

6 files changed

+21
-11
lines changed

mysql-test/suite/rpl/r/rpl_heartbeat_debug.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set @restore_slave_net_timeout= @@global.slave_net_timeout;
66
set @@global.slave_net_timeout= 10;
77
show status like 'Slave_heartbeat_period';;
88
Variable_name Slave_heartbeat_period
9-
Value 60.000
9+
Value 5.000
1010
SET @saved_dbug= @@GLOBAL.debug_dbug;
1111
SET GLOBAL debug_dbug="+d,simulate_slave_heartbeat_network_error";
1212
include/start_slave.inc

sql/mysqld.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6821,11 +6821,11 @@ struct my_option my_long_options[]=
68216821
"more than one storage engine, when binary log is disabled)",
68226822
&opt_tc_log_file, &opt_tc_log_file, 0, GET_STR,
68236823
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
6824+
#ifdef HAVE_REPLICATION
68246825
{"master-retry-count", 0,
68256826
"The number of tries the slave will make to connect to the master before giving up",
68266827
&master_retry_count, &master_retry_count, 0, GET_ULL,
68276828
REQUIRED_ARG, static_cast<longlong>(master_retry_count), 0, 0, 0, 0, 0},
6828-
#ifdef HAVE_REPLICATION
68296829
{"init-rpl-role", 0, "Set the replication role",
68306830
&rpl_status, &rpl_status, &rpl_role_typelib,
68316831
GET_ENUM, REQUIRED_ARG, RPL_AUTH_MASTER, 0, 0, 0, 0, 0},

sql/rpl_info_file.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#ifndef RPL_INFO_FILE_HH
1919
#define RPL_INFO_FILE_HH
2020

21+
#include <cstdint> // uintN_t
2122
#include <charconv> // std::from/to_chars and other helpers
2223
#include <functional> // superclass of InfoFile::mem_fn
2324
#include <my_sys.h> // IO_CACHE
@@ -254,7 +255,7 @@ protected:
254255
lines= default_lines;
255256
for (; i < lines; ++i)
256257
{
257-
char c;
258+
int c;
258259
if (i < fields.size()) // line known in the ` list
259260
{
260261
const mem_fn &pm= fields.begin()[i];

sql/rpl_master_info_file.hh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ inline static constexpr uint32_t SLAVE_MAX_HEARTBEAT_PERIOD=
3737
inline static int change_master_id_cmp(const void *arg1, const void *arg2)
3838
{
3939
const ulong &id1= *(const ulong *)arg1, &id2= *(const ulong *)arg2;
40-
return (id2 > id1) - (id2 < id1);
40+
return (id1 > id2) - (id1 < id2);
4141
}
4242

4343
/// enum for @ref MasterInfoFile::master_use_gtid
@@ -357,6 +357,7 @@ struct MasterInfoFile: InfoFile
357357
bool set_default() override
358358
{
359359
mode= enum_master_use_gtid::DEFAULT;
360+
gtid_supported= true;
360361
return false;
361362
}
362363
/** @return
@@ -418,12 +419,20 @@ struct MasterInfoFile: InfoFile
418419
*/
419420
char buf[IntIOCache::BUF_SIZE<uint32_t> + 3];
420421
size_t length= my_b_gets(file, buf, sizeof(buf));
421-
if (!length ||
422-
std::from_chars(buf, &buf[length], seconds,
423-
std::chars_format::fixed).ec != IntIOCache::ERRC_OK ||
424-
seconds < 0 || seconds > SLAVE_MAX_HEARTBEAT_PERIOD)
422+
if (!length)
425423
return true;
426-
operator=(seconds / 1000);
424+
#ifdef __clang__
425+
// FIXME: floating-point variants of `std::from_chars()` not supported
426+
char end;
427+
if (sscanf(buf, "%lf%c", &seconds, &end) < 2 || end
428+
#else
429+
std::from_chars_result result=
430+
std::from_chars(buf, &buf[length], seconds, std::chars_format::fixed);
431+
if (result.ec != IntIOCache::ERRC_OK || *(result.ptr)
432+
#endif
433+
!= '\n' || seconds < 0 || seconds > SLAVE_MAX_HEARTBEAT_PERIOD)
434+
return true;
435+
operator=(static_cast<uint32_t>(seconds / 1000));
427436
return false;
428437
}
429438
/**

sql/rpl_mi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class Master_info: public MasterInfoFile, public Slave_reporting_capability
369369
first need to test if the master supports GTIDs. If not, fall back to 'No'.
370370
Cache the value so future RESET SLAVE commands don't revert to Slave_Pos.
371371
*/
372-
bool &master_supports_gtid= master_use_gtid.gtid_supported= true;
372+
bool &master_supports_gtid= master_use_gtid.gtid_supported;
373373

374374
/*
375375
When TRUE, transition this server from being an active master to a slave.

sql/slave.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct rpl_parallel_thread;
113113
(so that you have to update the .index file).
114114
*/
115115

116-
extern ulong master_retry_count;
116+
extern uint64_t master_retry_count;
117117
extern MY_BITMAP slave_error_mask;
118118
extern char slave_skip_error_names[];
119119
extern bool use_slave_mask;

0 commit comments

Comments
 (0)