Merge branch '2.1' into develop
This commit is contained in:
@ -81,7 +81,7 @@ static void clientReply(MXS_ROUTER *instance, void *router_session, GWBUF *queue
|
||||
DCB *backend_dcb);
|
||||
static void errorReply(MXS_ROUTER *instance, void *router_session, GWBUF *message,
|
||||
DCB *backend_dcb, mxs_error_action_t action, bool *succp);
|
||||
static uint64_t getCapabilities(void);
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance);
|
||||
extern int MaxScaleUptime();
|
||||
extern void avro_get_used_tables(AVRO_INSTANCE *router, DCB *dcb);
|
||||
void converter_func(void* data);
|
||||
@ -998,7 +998,7 @@ errorReply(MXS_ROUTER *instance, void *router_session, GWBUF *message, DCB *back
|
||||
ss_dassert(false);
|
||||
}
|
||||
|
||||
static uint64_t getCapabilities(void)
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance)
|
||||
{
|
||||
return RCAP_TYPE_NO_RSESSION;
|
||||
}
|
||||
|
@ -519,10 +519,9 @@ avro_binlog_end_t avro_read_all_events(AVRO_INSTANCE *router)
|
||||
case -1:
|
||||
{
|
||||
char err_msg[BLRM_STRERROR_R_MSG_SIZE + 1] = "";
|
||||
strerror_r(errno, err_msg, BLRM_STRERROR_R_MSG_SIZE);
|
||||
MXS_ERROR("Failed to read binlog file %s at position %llu"
|
||||
" (%s).", router->binlog_name,
|
||||
pos, err_msg);
|
||||
MXS_ERROR("Failed to read binlog file %s at position %llu (%s).",
|
||||
router->binlog_name, pos,
|
||||
strerror_r(errno, err_msg, sizeof(err_msg)));
|
||||
|
||||
if (errno == EBADF)
|
||||
MXS_ERROR("Bad file descriptor in read binlog for file %s"
|
||||
@ -630,7 +629,6 @@ avro_binlog_end_t avro_read_all_events(AVRO_INSTANCE *router)
|
||||
{
|
||||
int event_header_length;
|
||||
int event_header_ntypes;
|
||||
int n_events;
|
||||
|
||||
/** Extract the event header lengths */
|
||||
event_header_length = ptr[2 + 50 + 4];
|
||||
@ -653,15 +651,10 @@ avro_binlog_end_t avro_read_all_events(AVRO_INSTANCE *router)
|
||||
break;
|
||||
}
|
||||
|
||||
n_events = hdr.event_size - event_header_length - (2 + 50 + 4 + 1);
|
||||
|
||||
if (event_header_ntypes < n_events)
|
||||
uint8_t *checksum = ptr + hdr.event_size - event_header_length - event_header_ntypes;
|
||||
if (checksum[0] == 1)
|
||||
{
|
||||
uint8_t *checksum = ptr + hdr.event_size - event_header_length - event_header_ntypes;
|
||||
if (checksum[0] == 1)
|
||||
{
|
||||
found_chksum = true;
|
||||
}
|
||||
found_chksum = true;
|
||||
}
|
||||
}
|
||||
/* Decode CLOSE/STOP Event */
|
||||
@ -892,7 +885,10 @@ void avro_flush_all_tables(AVRO_INSTANCE *router, enum avrorouter_file_op flush)
|
||||
}
|
||||
|
||||
/** Update the GTID index */
|
||||
avro_update_index(router);
|
||||
if (flush == AVROROUTER_FLUSH)
|
||||
{
|
||||
avro_update_index(router);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,7 @@ static void errorReply(MXS_ROUTER *instance,
|
||||
mxs_error_action_t action,
|
||||
bool *succp);
|
||||
|
||||
static uint64_t getCapabilities(void);
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance);
|
||||
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_load_dbusers(const ROUTER_INSTANCE *router);
|
||||
@ -1906,7 +1906,7 @@ static void rses_end_locked_router_action(ROUTER_SLAVE *rses)
|
||||
}
|
||||
|
||||
|
||||
static uint64_t getCapabilities(void)
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance)
|
||||
{
|
||||
return RCAP_TYPE_NO_RSESSION | RCAP_TYPE_CONTIGUOUS_OUTPUT | RCAP_TYPE_RESULTSET_OUTPUT;
|
||||
}
|
||||
|
@ -1197,8 +1197,12 @@ blr_cache_response(ROUTER_INSTANCE *router, char *response, GWBUF *buf)
|
||||
{
|
||||
return;
|
||||
}
|
||||
write(fd, GWBUF_DATA(buf), GWBUF_LENGTH(buf));
|
||||
// TODO: Check result.
|
||||
if (write(fd, GWBUF_DATA(buf), GWBUF_LENGTH(buf)) == -1)
|
||||
{
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to write cached response: %d, %s",
|
||||
errno, strerror_r(errno, err, sizeof(err)));
|
||||
}
|
||||
|
||||
close(fd);
|
||||
}
|
||||
@ -1251,7 +1255,12 @@ blr_cache_read_response(ROUTER_INSTANCE *router, char *response)
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
read(fd, GWBUF_DATA(buf), statb.st_size);
|
||||
if (read(fd, GWBUF_DATA(buf), statb.st_size) == -1)
|
||||
{
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to read cached response: %d, %s",
|
||||
errno, strerror_r(errno, err, sizeof(err)));
|
||||
}
|
||||
close(fd);
|
||||
return buf;
|
||||
}
|
||||
@ -1421,11 +1430,10 @@ blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debug)
|
||||
break;
|
||||
case -1:
|
||||
{
|
||||
char err_msg[BLRM_STRERROR_R_MSG_SIZE + 1] = "";
|
||||
strerror_r(errno, err_msg, BLRM_STRERROR_R_MSG_SIZE);
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to read binlog file %s at position %llu"
|
||||
" (%s).", router->binlog_name,
|
||||
pos, err_msg);
|
||||
" (%s).", router->binlog_name, pos,
|
||||
strerror_r(errno, err, sizeof(err)));
|
||||
|
||||
if (errno == EBADF)
|
||||
{
|
||||
@ -1533,7 +1541,7 @@ blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debug)
|
||||
}
|
||||
else
|
||||
{
|
||||
char errmsg[BLRM_STRERROR_R_MSG_SIZE + 1] = "";
|
||||
char errmsg[BINLOG_ERROR_MSG_LEN + 1] = "";
|
||||
/* fill replication header struct */
|
||||
hdr.timestamp = EXTRACT32(hdbuf);
|
||||
hdr.event_type = hdbuf[4];
|
||||
@ -1641,12 +1649,12 @@ blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debug)
|
||||
{
|
||||
if (n == -1)
|
||||
{
|
||||
char err_msg[BLRM_STRERROR_R_MSG_SIZE + 1] = "";
|
||||
strerror_r(errno, err_msg, BLRM_STRERROR_R_MSG_SIZE);
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Error reading the event at %llu in %s. "
|
||||
"%s, expected %d bytes.",
|
||||
pos, router->binlog_name,
|
||||
err_msg, hdr.event_size - BINLOG_EVENT_HDR_LEN);
|
||||
strerror_r(errno, err, sizeof(err)),
|
||||
hdr.event_size - BINLOG_EVENT_HDR_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1709,7 +1717,7 @@ blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debug)
|
||||
uint32_t event_size = EXTRACT32(hdbuf + BINLOG_EVENT_LEN_OFFSET);
|
||||
uint8_t *decrypt_ptr;
|
||||
unsigned long next_pos;
|
||||
char errmsg[BLRM_STRERROR_R_MSG_SIZE + 1] = "";
|
||||
char errmsg[BINLOG_ERROR_MSG_LEN + 1] = "";
|
||||
|
||||
/**
|
||||
* Events are encrypted.
|
||||
|
@ -3664,7 +3664,12 @@ blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
|
||||
router->prevbinlog,
|
||||
router->last_safe_pos);
|
||||
/* Truncate previous binlog file to last_safe pos */
|
||||
truncate(file, router->last_safe_pos);
|
||||
if (truncate(file, router->last_safe_pos) == -1)
|
||||
{
|
||||
char err[MXS_STRERROR_BUFLEN];
|
||||
MXS_ERROR("Failed to truncate file: %d, %s",
|
||||
errno, strerror_r(errno, err, sizeof(err)));
|
||||
}
|
||||
|
||||
/* Log it */
|
||||
MXS_WARNING("A transaction is still opened at pos %lu"
|
||||
|
@ -49,7 +49,7 @@ static void closeSession(MXS_ROUTER *instance, void *router_session);
|
||||
static void freeSession(MXS_ROUTER *instance, void *router_session);
|
||||
static int execute(MXS_ROUTER *instance, void *router_session, GWBUF *queue);
|
||||
static void diagnostics(MXS_ROUTER *instance, DCB *dcb);
|
||||
static uint64_t getCapabilities(void);
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance);
|
||||
|
||||
extern int execute_cmd(CLI_SESSION *cli);
|
||||
|
||||
@ -288,7 +288,7 @@ diagnostics(MXS_ROUTER *instance, DCB *dcb)
|
||||
return; /* Nothing to do currently */
|
||||
}
|
||||
|
||||
static uint64_t getCapabilities(void)
|
||||
static uint64_t getCapabilities(MXS_ROUTER *instance)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ static void closeSession(MXS_ROUTER *instance, void *router_session);
|
||||
static void freeSession(MXS_ROUTER *instance, void *router_session);
|
||||
static int execute(MXS_ROUTER *instance, void *router_session, GWBUF *queue);
|
||||
static void diagnostics(MXS_ROUTER *instance, DCB *dcb);
|
||||
static uint64_t getCapabilities ();
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance);
|
||||
|
||||
extern int execute_cmd(CLI_SESSION *cli);
|
||||
|
||||
@ -293,7 +293,7 @@ diagnostics(MXS_ROUTER *instance, DCB *dcb)
|
||||
return; /* Nothing to do currently */
|
||||
}
|
||||
|
||||
static uint64_t getCapabilities(void)
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ static void closeSession(MXS_ROUTER *instance, void *router_session);
|
||||
static void freeSession(MXS_ROUTER *instance, void *router_session);
|
||||
static int execute(MXS_ROUTER *instance, void *router_session, GWBUF *queue);
|
||||
static void diagnostics(MXS_ROUTER *instance, DCB *dcb);
|
||||
static uint64_t getCapabilities(void);
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance);
|
||||
static void handleError(MXS_ROUTER *instance,
|
||||
void *router_session,
|
||||
GWBUF *errbuf,
|
||||
@ -392,7 +392,7 @@ diagnostics(MXS_ROUTER *instance, DCB *dcb)
|
||||
* Not used for the maxinfo router
|
||||
*/
|
||||
static uint64_t
|
||||
getCapabilities(void)
|
||||
getCapabilities(MXS_ROUTER* instance)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ static void clientReply(MXS_ROUTER *instance, void *router_session, GWBUF *queue
|
||||
DCB *backend_dcb);
|
||||
static void handleError(MXS_ROUTER *instance, void *router_session, GWBUF *errbuf,
|
||||
DCB *problem_dcb, mxs_error_action_t action, bool *succp);
|
||||
static uint64_t getCapabilities(void);
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance);
|
||||
static bool rses_begin_locked_router_action(ROUTER_CLIENT_SES* rses);
|
||||
static void rses_end_locked_router_action(ROUTER_CLIENT_SES* rses);
|
||||
static SERVER_REF *get_root_master(SERVER_REF *servers);
|
||||
@ -785,7 +785,7 @@ static void rses_end_locked_router_action(ROUTER_CLIENT_SES* rses)
|
||||
spinlock_release(&rses->rses_lock);
|
||||
}
|
||||
|
||||
static uint64_t getCapabilities(void)
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance)
|
||||
{
|
||||
return RCAP_TYPE_NONE;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ static void clientReply(MXS_ROUTER *instance, void *router_session, GWBUF *queue
|
||||
static void handleError(MXS_ROUTER *instance, void *router_session,
|
||||
GWBUF *errmsgbuf, DCB *backend_dcb,
|
||||
mxs_error_action_t action, bool *succp);
|
||||
static uint64_t getCapabilities(void);
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance);
|
||||
|
||||
/*
|
||||
* End of the API functions; now the module structure that links to them.
|
||||
@ -864,7 +864,7 @@ lock_failed:
|
||||
*
|
||||
* @return RCAP_TYPE_STMT_INPUT.
|
||||
*/
|
||||
static uint64_t getCapabilities(void)
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance)
|
||||
{
|
||||
return RCAP_TYPE_STMT_INPUT | RCAP_TYPE_TRANSACTION_TRACKING;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ static route_target_t get_shard_route_target(qc_query_type_t qtype,
|
||||
bool trx_active,
|
||||
HINT* hint);
|
||||
|
||||
static uint64_t getCapabilities(void);
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance);
|
||||
|
||||
static bool connect_backend_servers(backend_ref_t* backend_ref,
|
||||
int router_nservers,
|
||||
@ -3320,7 +3320,7 @@ static rses_property_t* mysql_sescmd_get_property(mysql_sescmd_t* scmd)
|
||||
/**
|
||||
* Return RCAP_TYPE_STMT_INPUT.
|
||||
*/
|
||||
static uint64_t getCapabilities(void)
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance)
|
||||
{
|
||||
return RCAP_TYPE_STMT_INPUT;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ static void freeSession(MXS_ROUTER *instance, void *session);
|
||||
static int routeQuery(MXS_ROUTER *instance, void *session, GWBUF *queue);
|
||||
static void clientReply(MXS_ROUTER *instance, void *session, GWBUF *queue, DCB*);
|
||||
static void diagnostic(MXS_ROUTER *instance, DCB *dcb);
|
||||
static uint64_t getCapabilities ();
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance);
|
||||
static void handleError(MXS_ROUTER *instance,
|
||||
void *router_session,
|
||||
GWBUF *errbuf,
|
||||
@ -150,7 +150,7 @@ diagnostic(MXS_ROUTER *instance, DCB *dcb)
|
||||
{
|
||||
}
|
||||
|
||||
static uint64_t getCapabilities(void)
|
||||
static uint64_t getCapabilities(MXS_ROUTER* instance)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user