Merge branch 'develop' into 1.2.1-binlog_router_trx
This commit is contained in:
@ -16,8 +16,10 @@ add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master
|
||||
${CMAKE_SOURCE_DIR}/server/core/resultset.c ${CMAKE_SOURCE_DIR}/server/core/load_utils.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/monitor.c ${CMAKE_SOURCE_DIR}/server/core/gw_utils.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/thread.c ${CMAKE_SOURCE_DIR}/server/core/secrets.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/random_jkiss.c
|
||||
${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc)
|
||||
|
||||
|
||||
target_link_libraries(maxbinlogcheck utils ssl pthread ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} aio rt crypt dl crypto inih z m stdc++ ${CURL_LIBRARIES})
|
||||
|
||||
install(TARGETS maxbinlogcheck DESTINATION bin)
|
||||
|
@ -46,8 +46,10 @@
|
||||
* If set those values are sent to slaves instead of
|
||||
* saved master responses
|
||||
* 23/08/2015 Massimiliano Pinto Added strerror_r
|
||||
* 09/09/2015 Martin Brampton Modify error handler
|
||||
* 30/09/2015 Massimiliano Pinto Addition of send_slave_heartbeat option
|
||||
* 23/10/2015 Markus Makela Added current_safe_event
|
||||
* 27/10/2015 Martin Brampton Amend getCapabilities to return RCAP_TYPE_NO_RSESSION
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
@ -75,10 +77,6 @@
|
||||
#include <ini.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
extern __thread log_info_t tls_log_info;
|
||||
|
||||
static char *version_str = "V2.0.0";
|
||||
|
||||
/* The router entry points */
|
||||
@ -101,7 +99,7 @@ static void errorReply(
|
||||
error_action_t action,
|
||||
bool *succp);
|
||||
|
||||
static uint8_t getCapabilities (ROUTER* inst, void* router_session);
|
||||
static int getCapabilities ();
|
||||
static int blr_handler_config(void *userdata, const char *section, const char *name, const char *value);
|
||||
static int blr_handle_config_item(const char *name, const char *value, ROUTER_INSTANCE *inst);
|
||||
static int blr_set_service_mysql_user(SERVICE *service);
|
||||
@ -115,7 +113,6 @@ extern int blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debu
|
||||
void blr_master_close(ROUTER_INSTANCE *);
|
||||
char * blr_last_event_description(ROUTER_INSTANCE *router);
|
||||
extern int MaxScaleUptime();
|
||||
static uint8_t getCapabilities (ROUTER* inst, void* router_session);
|
||||
char *blr_get_event_description(ROUTER_INSTANCE *router, uint8_t event);
|
||||
|
||||
/** The module object definition */
|
||||
@ -472,8 +469,8 @@ char task_name[BLRM_TASK_NAME_LEN+1] = "";
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Warning : invalid heartbeat period %s."
|
||||
" Setting it to default value %d.",
|
||||
value, inst->heartbeat )));
|
||||
" Setting it to default value %ld.",
|
||||
value, inst->heartbeat)));
|
||||
} else {
|
||||
inst->heartbeat = h_val;
|
||||
}
|
||||
@ -532,8 +529,9 @@ char task_name[BLRM_TASK_NAME_LEN+1] = "";
|
||||
|
||||
if (inst->serverid <= 0) {
|
||||
skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"Error : Service %s, server-id is not configured. Please configure it with a unique positive integer value (1..2^32-1)",
|
||||
service->name, inst->serverid);
|
||||
"Error : Service %s, server-id is not configured. "
|
||||
"Please configure it with a unique positive integer value (1..2^32-1)",
|
||||
service->name);
|
||||
free(inst);
|
||||
return NULL;
|
||||
}
|
||||
@ -583,6 +581,7 @@ char task_name[BLRM_TASK_NAME_LEN+1] = "";
|
||||
inst->service->name)));
|
||||
if (service->users) {
|
||||
users_free(service->users);
|
||||
service->users = NULL;
|
||||
}
|
||||
|
||||
free(inst);
|
||||
@ -661,6 +660,7 @@ char task_name[BLRM_TASK_NAME_LEN+1] = "";
|
||||
|
||||
if (service->users) {
|
||||
users_free(service->users);
|
||||
service->users = NULL;
|
||||
}
|
||||
|
||||
if (service->dbref && service->dbref->server) {
|
||||
@ -889,7 +889,7 @@ ROUTER_SLAVE *slave = (ROUTER_SLAVE *)router_session;
|
||||
LOGIF(LM, (skygw_log_write_flush(
|
||||
LOGFILE_MESSAGE,
|
||||
"%s: Master %s disconnected after %ld seconds. "
|
||||
"%d events read,",
|
||||
"%lu events read,",
|
||||
router->service->name, router->service->dbref->server->name,
|
||||
time(0) - router->connect_time, router->stats.n_binlogs_ses)));
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
@ -1393,8 +1393,8 @@ int len;
|
||||
* @param router_session The router session
|
||||
* @param message The error message to reply
|
||||
* @param backend_dcb The backend DCB
|
||||
* @param action The action: REPLY, REPLY_AND_CLOSE, NEW_CONNECTION
|
||||
* @param succp Result of action
|
||||
* @param action The action: ERRACT_NEW_CONNECTION or ERRACT_REPLY_CLIENT
|
||||
* @param succp Result of action: true iff router can continue
|
||||
*
|
||||
*/
|
||||
static void
|
||||
@ -1407,12 +1407,6 @@ char msg[STRERROR_BUFLEN + 1 + 5] = "";
|
||||
char *errmsg;
|
||||
unsigned long mysql_errno;
|
||||
|
||||
if (action == ERRACT_RESET)
|
||||
{
|
||||
backend_dcb->dcb_errhandle_called = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/** Don't handle same error twice on same DCB */
|
||||
if (backend_dcb->dcb_errhandle_called)
|
||||
{
|
||||
@ -1466,10 +1460,11 @@ unsigned long mysql_errno;
|
||||
if (errmsg)
|
||||
free(errmsg);
|
||||
*succp = true;
|
||||
dcb_close(backend_dcb);
|
||||
LOGIF(LM, (skygw_log_write_flush(
|
||||
LOGFILE_MESSAGE,
|
||||
"%s: Master %s disconnected after %ld seconds. "
|
||||
"%d events read.",
|
||||
"%lu events read.",
|
||||
router->service->name, router->service->dbref->server->name,
|
||||
time(0) - router->connect_time, router->stats.n_binlogs_ses)));
|
||||
blr_master_reconnect(router);
|
||||
@ -1524,9 +1519,9 @@ static void rses_end_locked_router_action(ROUTER_SLAVE * rses)
|
||||
}
|
||||
|
||||
|
||||
static uint8_t getCapabilities(ROUTER *inst, void *router_session)
|
||||
static int getCapabilities()
|
||||
{
|
||||
return 0;
|
||||
return RCAP_TYPE_NO_RSESSION;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,11 +53,6 @@
|
||||
#include <log_manager.h>
|
||||
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
extern __thread log_info_t tls_log_info;
|
||||
|
||||
|
||||
/**
|
||||
* Initialise the cache for this instanceof the binlog router. As a side
|
||||
* effect also determine the binlog file to read and the position to read
|
||||
|
@ -63,10 +63,6 @@
|
||||
#include <skygw_utils.h>
|
||||
#include <log_manager.h>
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
extern __thread log_info_t tls_log_info;
|
||||
|
||||
static int blr_file_create(ROUTER_INSTANCE *router, char *file);
|
||||
static void blr_file_append(ROUTER_INSTANCE *router, char *file);
|
||||
static void blr_log_header(logfile_id_t file, char *msg, uint8_t *ptr);
|
||||
@ -286,7 +282,7 @@ int fd;
|
||||
/* If for any reason the file's length is between 1 and 3 bytes
|
||||
* then report an error. */
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"%s: binlog file %s has an invalid length %d.",
|
||||
"%s: binlog file %s has an invalid length %lu.",
|
||||
router->service->name, path, router->current_pos)));
|
||||
close(fd);
|
||||
spinlock_release(&router->binlog_lock);
|
||||
@ -484,7 +480,7 @@ struct stat statb;
|
||||
{
|
||||
case 0:
|
||||
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
|
||||
"Reached end of binlog file '%s' at %d.",
|
||||
"Reached end of binlog file '%s' at %lu.",
|
||||
file->binlogname, pos)));
|
||||
|
||||
/* set ok indicator */
|
||||
@ -552,7 +548,7 @@ struct stat statb;
|
||||
{
|
||||
case 0:
|
||||
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
|
||||
"Reached end of binlog file at %d.",
|
||||
"Reached end of binlog file at %lu.",
|
||||
pos)));
|
||||
|
||||
/* set ok indicator */
|
||||
@ -929,8 +925,8 @@ int fde_seen = 0;
|
||||
LOGIF(LM, (skygw_log_write_flush(LOGFILE_MESSAGE,
|
||||
"Transaction Summary for binlog '%s'\n"
|
||||
"\t\t\tDescription %17s%17s%17s\n\t\t\t"
|
||||
"No. of Transactions %16llu\n\t\t\t"
|
||||
"No. of Events %16llu %16.1f %16llu\n\t\t\t"
|
||||
"No. of Transactions %16lu\n\t\t\t"
|
||||
"No. of Events %16lu %16.1f %16lu\n\t\t\t"
|
||||
"No. of Bytes %16.1f%s%16.1f%s%16.1f%s", router->binlog_name,
|
||||
"Total", "Average", "Max",
|
||||
n_transactions, total_events,
|
||||
@ -1036,7 +1032,7 @@ int fde_seen = 0;
|
||||
if (hdr.event_type > MAX_EVENT_TYPE_MARIADB10) {
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"Invalid MariaDB 10 event type 0x%x. "
|
||||
"Binlog file is %s, position %d",
|
||||
"Binlog file is %s, position %llu",
|
||||
hdr.event_type,
|
||||
router->binlog_name, pos)));
|
||||
|
||||
@ -1046,7 +1042,7 @@ int fde_seen = 0;
|
||||
if (hdr.event_type > MAX_EVENT_TYPE) {
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"Invalid event type 0x%x. "
|
||||
"Binlog file is %s, position %d",
|
||||
"Binlog file is %s, position %llu",
|
||||
hdr.event_type,
|
||||
router->binlog_name, pos)));
|
||||
|
||||
@ -1308,7 +1304,7 @@ int fde_seen = 0;
|
||||
|
||||
if(debug)
|
||||
LOGIF(LD, (skygw_log_write_flush(LOGFILE_DEBUG,
|
||||
"- Rotate event @ %llu, next file is [%s] @ %llu",
|
||||
"- Rotate event @ %llu, next file is [%s] @ %lu",
|
||||
pos, file, new_pos)));
|
||||
}
|
||||
|
||||
@ -1331,7 +1327,7 @@ int fde_seen = 0;
|
||||
if (pending_transaction > 0) {
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"ERROR: Transaction cannot be @ pos %llu: "
|
||||
"Another MariaDB 10 transaction (GTID %lu-%lu-%llu)"
|
||||
"Another MariaDB 10 transaction (GTID %u-%u-%lu)"
|
||||
" was opened at %llu",
|
||||
pos, domainid, hdr.serverid, n_sequence, last_known_commit)));
|
||||
|
||||
@ -1346,7 +1342,7 @@ int fde_seen = 0;
|
||||
|
||||
if (debug)
|
||||
LOGIF(LD, (skygw_log_write_flush(LOGFILE_DEBUG,
|
||||
"> MariaDB 10 Transaction (GTID %lu-%lu-%llu)"
|
||||
"> MariaDB 10 Transaction (GTID %u-%u-%lu)"
|
||||
" starts @ pos %llu",
|
||||
domainid, hdr.serverid, n_sequence, pos)));
|
||||
}
|
||||
@ -1440,7 +1436,7 @@ int fde_seen = 0;
|
||||
/* pos and next_pos sanity checks */
|
||||
if (hdr.next_pos > 0 && hdr.next_pos < pos) {
|
||||
LOGIF(LT, (skygw_log_write_flush(LOGFILE_TRACE,
|
||||
"Binlog %s: next pos %llu < pos %llu, truncating to %llu",
|
||||
"Binlog %s: next pos %u < pos %llu, truncating to %llu",
|
||||
router->binlog_name,
|
||||
hdr.next_pos,
|
||||
pos,
|
||||
@ -1469,7 +1465,7 @@ int fde_seen = 0;
|
||||
|
||||
if (hdr.next_pos > 0 && hdr.next_pos != (pos + hdr.event_size)) {
|
||||
LOGIF(LT, (skygw_log_write_flush(LOGFILE_TRACE,
|
||||
"Binlog %s: next pos %llu != (pos %llu + event_size %llu), truncating to %llu",
|
||||
"Binlog %s: next pos %u != (pos %llu + event_size %u), truncating to %llu",
|
||||
router->binlog_name,
|
||||
hdr.next_pos,
|
||||
pos,
|
||||
@ -1513,7 +1509,7 @@ int fde_seen = 0;
|
||||
} else {
|
||||
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"Current event type %lu @ %llu has nex pos = %llu : exiting", hdr.event_type, pos, hdr.next_pos)));
|
||||
"Current event type %d @ %llu has nex pos = %u : exiting", hdr.event_type, pos, hdr.next_pos)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1663,7 +1659,7 @@ char err_msg[STRERROR_BUFLEN];
|
||||
|
||||
snprintf(filename,(PATH_MAX - 4), "%s/master.ini", path);
|
||||
|
||||
snprintf(tmp_file, (PATH_MAX -4), filename);
|
||||
snprintf(tmp_file, (PATH_MAX - 4), "%s", filename);
|
||||
|
||||
strcat(tmp_file, ".tmp");
|
||||
|
||||
|
@ -78,10 +78,6 @@
|
||||
#include <mysql_client_server_protocol.h>
|
||||
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
extern __thread log_info_t tls_log_info;
|
||||
|
||||
static GWBUF *blr_make_query(char *statement);
|
||||
static GWBUF *blr_make_registration(ROUTER_INSTANCE *router);
|
||||
static GWBUF *blr_make_binlog_dump(ROUTER_INSTANCE *router);
|
||||
@ -401,7 +397,7 @@ char task_name[BLRM_TASK_NAME_LEN + 1] = "";
|
||||
|
||||
LOGIF(LE, (skygw_log_write(
|
||||
LOGFILE_ERROR,
|
||||
"%s: Received error: %u, '%s' from master during '%s' phase "
|
||||
"%s: Received error: %lu, '%s' from master during '%s' phase "
|
||||
"of the master state machine.",
|
||||
router->service->name,
|
||||
mysql_errno, msg_err,
|
||||
@ -872,11 +868,11 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
if ((msg = malloc(len)) == NULL)
|
||||
{
|
||||
LOGIF(LE,(skygw_log_write(
|
||||
LOGFILE_ERROR,
|
||||
"Insufficient memory to buffer event "
|
||||
"of %d bytes. Binlog %s @ %d.",
|
||||
len, router->binlog_name,
|
||||
router->current_pos)));
|
||||
LOGFILE_ERROR,
|
||||
"Insufficient memory to buffer event "
|
||||
"of %d bytes. Binlog %s @ %lu.",
|
||||
len, router->binlog_name,
|
||||
router->current_pos)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -896,10 +892,10 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
if (remainder)
|
||||
{
|
||||
LOGIF(LE,(skygw_log_write(
|
||||
LOGFILE_ERROR,
|
||||
LOGFILE_ERROR,
|
||||
"Expected entire message in buffer "
|
||||
"chain, but failed to create complete "
|
||||
"message as expected. %s @ %d",
|
||||
"message as expected. %s @ %lu",
|
||||
router->binlog_name,
|
||||
router->current_pos)));
|
||||
free(msg);
|
||||
@ -920,7 +916,7 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
router->stats.n_residuals++;
|
||||
LOGIF(LD,(skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"Residual data left after %d records. %s @ %d",
|
||||
"Residual data left after %lu records. %s @ %lu",
|
||||
router->stats.n_binlogs,
|
||||
router->binlog_name, router->current_pos)));
|
||||
break;
|
||||
@ -971,7 +967,7 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
LOGIF(LE,(skygw_log_write(
|
||||
LOGFILE_ERROR,
|
||||
"Packet length is %d, but event size is %d, "
|
||||
"binlog file %s position %d "
|
||||
"binlog file %s position %lu "
|
||||
"reslen is %d and preslen is %d, "
|
||||
"length of previous event %d. %s",
|
||||
len, hdr.event_size,
|
||||
@ -1037,7 +1033,7 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
LOGIF(LE,(skygw_log_write(LOGFILE_ERROR,
|
||||
"%s: Checksum error in event "
|
||||
"from master, "
|
||||
"binlog %s @ %d. "
|
||||
"binlog %s @ %lu. "
|
||||
"Closing master connection.",
|
||||
router->service->name,
|
||||
router->binlog_name,
|
||||
@ -1094,7 +1090,7 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
LOGIF(LE,(skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"Error: a MariaDB 10 transaction "
|
||||
"is already open "
|
||||
"@ %lu (GTID %lu-%lu-%llu) and "
|
||||
"@ %lu (GTID %u-%u-%lu) and "
|
||||
"a new one starts @ %lu",
|
||||
router->binlog_position,
|
||||
domainid, hdr.serverid, n_sequence,
|
||||
@ -1173,7 +1169,7 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
// Fake format description message
|
||||
LOGIF(LD,(skygw_log_write(LOGFILE_DEBUG,
|
||||
"Replication fake event. "
|
||||
"Binlog %s @ %d.",
|
||||
"Binlog %s @ %lu.",
|
||||
router->binlog_name,
|
||||
router->current_pos)));
|
||||
router->stats.n_fakeevents++;
|
||||
@ -1219,7 +1215,7 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
LOGIF(LD,(skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"Replication heartbeat. "
|
||||
"Binlog %s @ %d.",
|
||||
"Binlog %s @ %lu.",
|
||||
router->binlog_name,
|
||||
router->current_pos)));
|
||||
|
||||
@ -1356,7 +1352,7 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
/* Some events have been sent */
|
||||
LOGIF(LE,(skygw_log_write(LOGFILE_ERROR,
|
||||
"Some events were not distributed to slaves for a pending transaction "
|
||||
"in %s at %lu. Last distributed even at %lu, last event from master at %lu",
|
||||
"in %s at %lu. Last distributed even at %llu, last event from master at %lu",
|
||||
router->binlog_name,
|
||||
router->binlog_position,
|
||||
pos,
|
||||
@ -1389,7 +1385,7 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
"Artificial event not written "
|
||||
"to disk or distributed. "
|
||||
"Type 0x%x, Length %d, Binlog "
|
||||
"%s @ %d.",
|
||||
"%s @ %lu.",
|
||||
hdr.event_type,
|
||||
hdr.event_size,
|
||||
router->binlog_name,
|
||||
@ -1444,7 +1440,7 @@ int n_bufs = -1, pn_bufs = -1;
|
||||
spinlock_release(&router->lock);
|
||||
|
||||
LOGIF(LE,(skygw_log_write(LOGFILE_ERROR,
|
||||
"Error packet in binlog stream.%s @ %d.",
|
||||
"Error packet in binlog stream.%s @ %lu.",
|
||||
router->binlog_name,
|
||||
router->current_pos)));
|
||||
|
||||
@ -1691,7 +1687,7 @@ int action;
|
||||
* try to resolve the issue.
|
||||
*/
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"Slave %d is ahead of expected position %s@%d. "
|
||||
"Slave %d is ahead of expected position %s@%lu. "
|
||||
"Expected position %d",
|
||||
slave->serverid, slave->binlogfile,
|
||||
(unsigned long)slave->binlog_pos,
|
||||
@ -1927,7 +1923,7 @@ int event_limit;
|
||||
if (pos > end_pos)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"Error: Reading saved events, the specified pos %lu "
|
||||
"Error: Reading saved events, the specified pos %llu "
|
||||
"is ahead of current pos %lu for file %s",
|
||||
pos, router->current_pos, router->binlog_name)));
|
||||
return NULL;
|
||||
@ -1940,14 +1936,14 @@ int event_limit;
|
||||
{
|
||||
case 0:
|
||||
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
|
||||
"Reading saved events: reached end of binlog file at %d.", pos)));
|
||||
"Reading saved events: reached end of binlog file at %llu.", pos)));
|
||||
break;
|
||||
case -1:
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"Error: Reading saved events: failed to read binlog "
|
||||
"file %s at position %d"
|
||||
"file %s at position %llu"
|
||||
" (%s).", router->binlog_name,
|
||||
pos, strerror_r(errno, err_msg, sizeof(err_msg)))));
|
||||
|
||||
@ -1962,7 +1958,7 @@ int event_limit;
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"Error: Reading saved events: short read when reading the header. "
|
||||
"Expected 19 bytes but got %d bytes. "
|
||||
"Binlog file is %s, position %d",
|
||||
"Binlog file is %s, position %llu",
|
||||
n, router->binlog_name, pos)));
|
||||
break;
|
||||
}
|
||||
@ -1983,7 +1979,7 @@ int event_limit;
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"Error: Reading saved events: invalid event type 0x%x. "
|
||||
"Binlog file is %s, position %d",
|
||||
"Binlog file is %s, position %llu",
|
||||
hdr->event_type,
|
||||
router->binlog_name, pos)));
|
||||
return NULL;
|
||||
@ -1993,7 +1989,7 @@ int event_limit;
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"Error: Reading saved events: failed to allocate memory for binlog entry, "
|
||||
"size %d at %d.",
|
||||
"size %d at %llu.",
|
||||
hdr->event_size, pos)));
|
||||
return NULL;
|
||||
}
|
||||
@ -2009,14 +2005,14 @@ int event_limit;
|
||||
{
|
||||
char err_msg[STRERROR_BUFLEN];
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"Error: Reading saved events: the event at %ld in %s. "
|
||||
"Error: Reading saved events: the event at %llu in %s. "
|
||||
"%s, expected %d bytes.",
|
||||
pos, router->binlog_name,
|
||||
strerror_r(errno, err_msg, sizeof(err_msg)), hdr->event_size - 19)));
|
||||
} else {
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"Error: Reading saved events: short read when reading "
|
||||
"the event at %ld in %s. "
|
||||
"the event at %llu in %s. "
|
||||
"Expected %d bytes got %d bytes.",
|
||||
pos, router->binlog_name, hdr->event_size - 19, n)));
|
||||
|
||||
@ -2025,7 +2021,7 @@ int event_limit;
|
||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||
"Error: Reading saved events: binlog event "
|
||||
"is close to the end of the binlog file, "
|
||||
"current file size is %u.", end_pos)));
|
||||
"current file size is %llu.", end_pos)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2153,7 +2149,7 @@ char *event_desc = NULL;
|
||||
if (router->master_state == BLRM_BINLOGDUMP && router->lastEventReceived > 0) {
|
||||
if ((t_now - router->stats.lastReply) > (router->heartbeat + BLR_NET_LATENCY_WAIT_TIME)) {
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"ERROR: No event received from master %s:%d in heartbeat period (%d seconds), last event (%s %d) received %lu seconds ago. Assuming connection is dead and reconnecting.",
|
||||
"ERROR: No event received from master %s:%d in heartbeat period (%lu seconds), last event (%s %d) received %lu seconds ago. Assuming connection is dead and reconnecting.",
|
||||
router->service->dbref->server->name,
|
||||
router->service->dbref->server->port,
|
||||
router->heartbeat,
|
||||
|
@ -58,6 +58,7 @@
|
||||
* 25/09/2015 Massimiliano Pinto Addition of slave heartbeat:
|
||||
* the period set during registration is checked
|
||||
* and heartbeat event might be sent to the affected slave.
|
||||
* 25/09/2015 Martin Brampton Block callback processing when no router session in the DCB
|
||||
* 23/10/15 Markus Makela Added current_safe_event
|
||||
*
|
||||
* @endverbatim
|
||||
@ -154,10 +155,6 @@ static int blr_slave_send_heartbeat(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave
|
||||
|
||||
void poll_fake_write_event(DCB *dcb);
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
extern __thread log_info_t tls_log_info;
|
||||
|
||||
/**
|
||||
* Process a request packet from the slave server.
|
||||
*
|
||||
@ -2003,7 +2000,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1];
|
||||
blr_close_binlog(router, slave->file);
|
||||
if (hkheartbeat - beat1 > 1)
|
||||
LOGIF(LE, (skygw_log_write(
|
||||
LOGFILE_ERROR, "blr_close_binlog took %d maxscale beats",
|
||||
LOGFILE_ERROR, "blr_close_binlog took %lu maxscale beats",
|
||||
hkheartbeat - beat1)));
|
||||
blr_slave_rotate(router, slave, GWBUF_DATA(record));
|
||||
beat1 = hkheartbeat;
|
||||
@ -2040,7 +2037,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1];
|
||||
}
|
||||
if (hkheartbeat - beat1 > 1)
|
||||
LOGIF(LE, (skygw_log_write(
|
||||
LOGFILE_ERROR, "blr_open_binlog took %d beats",
|
||||
LOGFILE_ERROR, "blr_open_binlog took %lu beats",
|
||||
hkheartbeat - beat1)));
|
||||
}
|
||||
slave->stats.n_bytes += gwbuf_length(head);
|
||||
@ -2245,6 +2242,15 @@ blr_slave_callback(DCB *dcb, DCB_REASON reason, void *data)
|
||||
ROUTER_SLAVE *slave = (ROUTER_SLAVE *)data;
|
||||
ROUTER_INSTANCE *router = slave->router;
|
||||
|
||||
if (NULL == dcb->session->router_session)
|
||||
{
|
||||
/*
|
||||
* The following processing will fail if there is no router session,
|
||||
* because the "data" parameter will not contain meaningful data,
|
||||
* so we have no choice but to stop here.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
if (reason == DCB_REASON_DRAINED)
|
||||
{
|
||||
if (slave->state == BLRS_DUMPING)
|
||||
@ -2981,7 +2987,7 @@ blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
|
||||
LOGFILE_ERROR,
|
||||
"Warning: a transaction is still opened at pos %lu"
|
||||
" File %s will be truncated. "
|
||||
"Next binlog file is %s at pos %lu, "
|
||||
"Next binlog file is %s at pos %d, "
|
||||
"START SLAVE is required again.",
|
||||
router->last_safe_pos,
|
||||
router->prevbinlog,
|
||||
@ -3368,7 +3374,7 @@ int blr_handle_change_master(ROUTER_INSTANCE* router, char *command, char *error
|
||||
router->binlog_name)));
|
||||
}
|
||||
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "%s: New MASTER_LOG_POS is [%u]",
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "%s: New MASTER_LOG_POS is [%lu]",
|
||||
router->service->name,
|
||||
router->current_pos)));
|
||||
}
|
||||
|
@ -63,9 +63,6 @@
|
||||
#include <version.h>
|
||||
#include <gwdirs.h>
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
extern __thread log_info_t tls_log_info;
|
||||
extern int blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debug);
|
||||
extern uint32_t extract_field(uint8_t *src, int bits);
|
||||
static void printVersion(const char *progname);
|
||||
@ -89,8 +86,6 @@ return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char** arg_vector;
|
||||
int arg_count = 4;
|
||||
ROUTER_INSTANCE *inst;
|
||||
int fd;
|
||||
int ret;
|
||||
@ -129,36 +124,16 @@ int main(int argc, char **argv) {
|
||||
|
||||
num_args = optind;
|
||||
|
||||
arg_vector = malloc(sizeof(char*)*(arg_count + 1));
|
||||
|
||||
if(arg_vector == NULL)
|
||||
{
|
||||
fprintf(stderr,"Error: Memory allocation failed for log manager arg_vector.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
arg_vector[0] = "logmanager";
|
||||
arg_vector[1] = "-j";
|
||||
arg_vector[2] = "/tmp/maxbinlogcheck";
|
||||
arg_vector[3] = "-o";
|
||||
arg_vector[4] = NULL;
|
||||
skygw_logmanager_init(arg_count,arg_vector);
|
||||
|
||||
skygw_log_set_augmentation(0);
|
||||
|
||||
free(arg_vector);
|
||||
|
||||
if (!debug_out)
|
||||
skygw_log_disable(LOGFILE_DEBUG);
|
||||
else
|
||||
skygw_log_enable(LOGFILE_DEBUG);
|
||||
mxs_log_init(NULL, NULL, LOG_TARGET_DEFAULT);
|
||||
mxs_log_set_augmentation(0);
|
||||
mxs_log_set_priority_enabled(LOG_DEBUG, debug_out);
|
||||
|
||||
if ((inst = calloc(1, sizeof(ROUTER_INSTANCE))) == NULL) {
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"Error: Memory allocation failed for ROUTER_INSTANCE")));
|
||||
|
||||
skygw_log_sync_all();
|
||||
skygw_logmanager_done();
|
||||
mxs_log_flush_sync();
|
||||
mxs_log_finish();
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -181,8 +156,8 @@ int main(int argc, char **argv) {
|
||||
"Failed to open binlog file %s: %s",
|
||||
path, strerror(errno))));
|
||||
|
||||
skygw_log_sync_all();
|
||||
skygw_logmanager_done();
|
||||
mxs_log_flush_sync();
|
||||
mxs_log_finish();
|
||||
|
||||
free(inst);
|
||||
|
||||
@ -214,13 +189,13 @@ int main(int argc, char **argv) {
|
||||
|
||||
close(inst->binlog_fd);
|
||||
|
||||
skygw_log_sync_all();
|
||||
mxs_log_flush_sync();
|
||||
|
||||
LOGIF(LM, (skygw_log_write_flush(LOGFILE_MESSAGE,
|
||||
"Check retcode: %i, Binlog Pos = %llu", ret, inst->binlog_position)));
|
||||
"Check retcode: %i, Binlog Pos = %lu", ret, inst->binlog_position)));
|
||||
|
||||
skygw_log_sync_all();
|
||||
skygw_logmanager_done();
|
||||
mxs_log_flush_sync();
|
||||
mxs_log_finish();
|
||||
|
||||
free(inst);
|
||||
|
||||
|
@ -51,9 +51,6 @@
|
||||
|
||||
#include <version.h>
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
extern __thread log_info_t tls_log_info;
|
||||
static void printVersion(const char *progname);
|
||||
static void printUsage(const char *progname);
|
||||
extern int blr_test_parse_change_master_command(char *input, char *error_string, CHANGE_MASTER_OPTIONS *config);
|
||||
@ -76,11 +73,9 @@ static struct option long_options[] = {
|
||||
};
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char** arg_vector;
|
||||
ROUTER_INSTANCE *inst;
|
||||
int ret;
|
||||
int rc;
|
||||
int arg_count = 4;
|
||||
char error_string[BINLOG_ERROR_MSG_LEN + 1] = "";
|
||||
CHANGE_MASTER_OPTIONS change_master;
|
||||
char query[255+1]="";
|
||||
@ -94,26 +89,12 @@ int main(int argc, char **argv) {
|
||||
|
||||
roptions = strdup("server-id=3,heartbeat=200,binlogdir=/not_exists/my_dir,transaction_safety=1,master_version=5.6.99-common,master_hostname=common_server,master_uuid=xxx-fff-cccc-fff,master-id=999");
|
||||
|
||||
arg_vector = malloc(sizeof(char*)*(arg_count + 1));
|
||||
mxs_log_init(NULL, NULL, LOG_TARGET_DEFAULT);
|
||||
|
||||
if(arg_vector == NULL)
|
||||
{
|
||||
fprintf(stderr,"Error: Memory allocation FAILED for log manager arg_vector.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
arg_vector[0] = "logmanager";
|
||||
arg_vector[1] = "-j";
|
||||
arg_vector[2] = "/tmp/maxbinlogcheck";
|
||||
arg_vector[3] = "-o";
|
||||
arg_vector[4] = NULL;
|
||||
skygw_logmanager_init(arg_count,arg_vector);
|
||||
free(arg_vector);
|
||||
|
||||
skygw_log_disable(LOGFILE_DEBUG);
|
||||
skygw_log_disable(LOGFILE_TRACE);
|
||||
skygw_log_disable(LOGFILE_ERROR);
|
||||
skygw_log_disable(LOGFILE_MESSAGE);
|
||||
mxs_log_set_priority_enabled(LOG_DEBUG, false);
|
||||
mxs_log_set_priority_enabled(LOG_INFO, false);
|
||||
mxs_log_set_priority_enabled(LOG_NOTICE, false);
|
||||
mxs_log_set_priority_enabled(LOG_ERR, false);
|
||||
|
||||
service = service_alloc("test_service", "binlogrouter");
|
||||
service->credentials.name = strdup("foo");
|
||||
@ -146,8 +127,8 @@ int main(int argc, char **argv) {
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"Error: Memory allocation FAILED for ROUTER_INSTANCE")));
|
||||
|
||||
skygw_log_sync_all();
|
||||
skygw_logmanager_done();
|
||||
mxs_log_flush_sync();
|
||||
mxs_log_finish();
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -597,8 +578,8 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
skygw_log_sync_all();
|
||||
skygw_logmanager_done();
|
||||
mxs_log_flush_sync();
|
||||
mxs_log_finish();
|
||||
|
||||
free(inst);
|
||||
|
||||
|
Reference in New Issue
Block a user