MXS-2011 Store CHANGE MASTER options as std::strings

In order support the possiblity for having multiple alternative
masters for the binlog server, we need to have multiple configs
around.

Originally the config values were stored as 'char *':s, which
would have made the lifetime management of the strings laborious
and error prone.

Now, the options are stored as std::string:s, which makes the
lifetime management a non-issue.
This commit is contained in:
Johan Wikman
2018-08-23 13:02:12 +03:00
parent 51fffedf7d
commit e85c4387c7
3 changed files with 152 additions and 183 deletions

View File

@ -27,6 +27,7 @@
#include <stdint.h>
#include <zlib.h>
#include <string>
#include <thread>
#include <maxscale/buffer.h>
@ -364,23 +365,23 @@ typedef struct master_server_config
/* Config struct for CHANGE MASTER TO options */
typedef struct change_master_options
{
char *host;
char *port;
char *binlog_file;
char *binlog_pos;
char *user;
char *password;
std::string host;
std::string port;
std::string binlog_file;
std::string binlog_pos;
std::string user;
std::string password;
/* SSL options */
char *ssl_key;
char *ssl_cert;
char *ssl_ca;
char *ssl_enabled;
char *ssl_version;
std::string ssl_key;
std::string ssl_cert;
std::string ssl_ca;
std::string ssl_enabled;
std::string ssl_version;
/* MariaDB 10 GTID */
char *use_mariadb10_gtid;
std::string use_mariadb10_gtid;
/* Connection options */
char *heartbeat_period;
char *connect_retry;
std::string heartbeat_period;
std::string connect_retry;
} CHANGE_MASTER_OPTIONS;
/**