Fixed compiler issue on connecting to server binlog using binlog position or gtid.

This commit is contained in:
Jan Lindström
2013-08-08 10:32:08 +03:00
parent 685f3b0bda
commit 1f3665c8b0
10 changed files with 41 additions and 21 deletions

View File

@ -154,6 +154,16 @@ unsigned long Binary_log::get_position(std::string &filename)
return m_binlog_position; return m_binlog_position;
} }
int Binary_log::connect()
{
return m_driver->connect();
}
int Binary_log::connect(const boost::uint64_t binlog_pos)
{
return m_driver->connect(binlog_pos);
}
int Binary_log::connect(const Gtid gtid) int Binary_log::connect(const Gtid gtid)
{ {
return m_driver->connect(gtid); return m_driver->connect(gtid);

View File

@ -76,7 +76,9 @@ public:
Dummy_driver() : Binary_log_driver("", 0) {} Dummy_driver() : Binary_log_driver("", 0) {}
virtual ~Dummy_driver() {} virtual ~Dummy_driver() {}
virtual int connect(Gtid gtid = Gtid()) { return 1; } virtual int connect() { return 1; }
virtual int connect(const Gtid gtid) { return 1; }
virtual int connect(const boost::uint64_t binlog_pos) { return 1;}
virtual int wait_for_next_event(mysql::Binary_log_event **event) { virtual int wait_for_next_event(mysql::Binary_log_event **event) {
return ERR_EOF; return ERR_EOF;
@ -124,7 +126,9 @@ public:
Binary_log(system::Binary_log_driver *drv, std::string); Binary_log(system::Binary_log_driver *drv, std::string);
~Binary_log() {} ~Binary_log() {}
int connect(Gtid gtid = Gtid()); int connect();
int connect(const Gtid gtid);
int connect(const boost::uint64_t binlog_pos);
/** /**
* Blocking attempt to get the next binlog event from the stream * Blocking attempt to get the next binlog event from the stream

View File

@ -57,8 +57,10 @@ public:
* @retval 0 Success * @retval 0 Success
* @retval >0 Error code (to be specified) * @retval >0 Error code (to be specified)
*/ */
virtual int connect(Gtid gtid = Gtid())= 0;
virtual int connect(Gtid gtid)= 0;
virtual int connect() = 0;
virtual int connect(const boost::uint64_t binlog_pos) = 0;
/** /**
* Blocking attempt to get the next binlog event from the stream * Blocking attempt to get the next binlog event from the stream

View File

@ -951,11 +951,17 @@ int Binlog_tcp_driver::connect(const Gtid gtid)
return connect(m_user, m_passwd, m_host, m_port, gtid); return connect(m_user, m_passwd, m_host, m_port, gtid);
} }
int Binlog_tcp_driver::connect(size_t binlog_pos) int Binlog_tcp_driver::connect()
{
Gtid gtid = Gtid();
return connect(m_user, m_passwd, m_host, m_port, gtid);
}
int Binlog_tcp_driver::connect(boost::uint64_t binlog_pos)
{ {
Gtid gtid = Gtid(); Gtid gtid = Gtid();
std::string bf = std::string(""); std::string bf = std::string("");
return connect(m_user, m_passwd, m_host, m_port, gtid, bf, binlog_pos); return connect(m_user, m_passwd, m_host, m_port, gtid, bf, (size_t)binlog_pos);
} }
/** /**

View File

@ -76,8 +76,9 @@ public:
/** /**
* Connect using previously declared connection parameters. * Connect using previously declared connection parameters.
*/ */
int connect(Gtid gtid = Gtid()); int connect();
int connect(size_t binlog_pos); int connect(const Gtid gtid);
int connect(const boost::uint64_t binlog_pos);
/** /**
* Blocking wait for the next binary log event to reach the client * Blocking wait for the next binary log event to reach the client

View File

@ -1,4 +1,4 @@
project (skysql_gateway_table_replication_concistency) project (skysql_m_table_replication_concistency)
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
# This configuration file builds both the static and shared version of # This configuration file builds both the static and shared version of
@ -15,7 +15,7 @@ SET(Boost_ADDITIONAL_VERSIONS "1.41" "1.41.0")
FIND_PACKAGE(Boost REQUIRED system thread) FIND_PACKAGE(Boost REQUIRED system thread)
# --------- Find crypt # --------- Find crypt
FIND_LIBRARY(LIB_CRYPTO crypto /opt/local/lib /opt/lib /usr/lib /usr/local/lib) FIND_LIBRARY(LIB_CRYPTO crypto /opt/local/lib /opt/lib /usr/lib /usr/local/lib /usr/local/ssl/lib)
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
@ -23,16 +23,17 @@ INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
find_library(MySQL_LIBRARY NAMES libmysqld.a PATHS find_library(MySQL_LIBRARY NAMES libmysqld.a PATHS
/usr/lib64/mysql /usr/lib/mysql /usr/local/mysql/lib) /usr/lib64/mysql /usr/lib/mysql /usr/local/mysql/lib)
find_path(MySQL_INCLUDE_DIR mysql.h find_path(MySQL_INCLUDE_DIR mysql.h
/usr/local/include/mysql /usr/include/mysql) /usr/local/include/mysql /usr/include/mysql /usr/local/mysql/include)
include_directories(${MySQL_INCLUDE_DIR}) include_directories(${MySQL_INCLUDE_DIR})
#SkySQL #SkySQL
find_path(SkySQL_INCLUDE_DIR skygw_debug.h find_path(SkySQL_INCLUDE_DIR skygw_debug.h
/usr/local/include /usr/include ../utils) /usr/local/include /usr/include ../utils)
include_directories(${SkySQL_INCLUDE_DIR}) include_directories(${SkySQL_INCLUDE_DIR})
include_directories(../replication_listener)
#log_manager #log_manager
FIND_LIBRARY(LIB_LOGMANAGER log_manager /lib /opt/local/lib /opt/lib /usr/lib /usr/local/lib) FIND_LIBRARY(LIB_LOGMANAGER log_manager /lib /opt/local/lib /opt/lib /usr/lib /usr/local/lib ../log_manager)
find_path(LogManager_INCLUDE_DIR log_manager.h find_path(LogManager_INCLUDE_DIR log_manager.h
/usr/local/include /usr/include ../log_manager) /usr/local/include /usr/include ../log_manager)
include_directories(${LogManager_INCLUDE_DIR}) include_directories(${LogManager_INCLUDE_DIR})

View File

@ -23,7 +23,6 @@ Updated:
*/ */
#include <iostream> #include <iostream>
#include "my_pthread.h"
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>

View File

@ -22,7 +22,6 @@ Updated:
*/ */
#include "binlog_api.h" #include "binlog_api.h"
#include "my_pthread.h"
#include <getopt.h> #include <getopt.h>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
@ -339,7 +338,7 @@ void* tb_replication_listener_reader(
pthread_t id = pthread_self(); pthread_t id = pthread_self();
string database_dot_table; string database_dot_table;
const char* server_type; const char* server_type;
Gtid gtid(0,1,31); Gtid gtid;
bool gtid_known = false; bool gtid_known = false;
boost::uint64_t binlog_pos = 0; boost::uint64_t binlog_pos = 0;
bool use_binlog_pos = true; bool use_binlog_pos = true;
@ -361,7 +360,7 @@ void* tb_replication_listener_reader(
gtid = Gtid(domain, server, sno); gtid = Gtid(domain, server, sno);
use_binlog_pos = false; use_binlog_pos = false;
} else if (rlt->use_mysql_gtid) { } else if (rlt->use_mysql_gtid) {
gtid(rlt->gtid); gtid = Gtid(rlt->gtid);
use_binlog_pos = false; use_binlog_pos = false;
} else { } else {
// At startup we need to iterate through servers and see if // At startup we need to iterate through servers and see if

View File

@ -21,7 +21,6 @@ Created: 15-07-2013
Updated: Updated:
*/ */
#include "binlog_api.h" #include "binlog_api.h"
#include "my_pthread.h"
#include <getopt.h> #include <getopt.h>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>

View File

@ -53,8 +53,7 @@ typedef struct {
// Not really nice, but currently we support only these two // Not really nice, but currently we support only these two
// server types. // server types.
#define TRC_SERVER_TYPE_MARIADB = 1, enum trc_server_type { TRC_SERVER_TYPE_MARIADB = 1, TRC_SERVER_TYPE_MYSQL = 2 };
#define TRC_SERVER_TYPE_MYSQL = 2
/***********************************************************************//** /***********************************************************************//**