Merge branch '2.2' into develop
This commit is contained in:
@ -78,11 +78,11 @@ bool binlog_next_file_exists(const char* binlogdir, const char* binlog)
|
||||
{
|
||||
char buf[BLRM_BINLOG_NAME_STR_LEN + 1];
|
||||
char filename[PATH_MAX + 1];
|
||||
char next_file[BLRM_BINLOG_NAME_STR_LEN + 1];
|
||||
char next_file[BLRM_BINLOG_NAME_STR_LEN + 1 + 20];
|
||||
int offset = sptr - binlog;
|
||||
memcpy(buf, binlog, offset);
|
||||
buf[offset] = '\0';
|
||||
sprintf(next_file, BINLOG_NAMEFMT, buf, filenum);
|
||||
snprintf(next_file, sizeof(next_file), BINLOG_NAMEFMT, buf, filenum);
|
||||
snprintf(filename, PATH_MAX, "%s/%s", binlogdir, next_file);
|
||||
filename[PATH_MAX] = '\0';
|
||||
|
||||
|
@ -240,7 +240,7 @@ typedef struct start_encryption_event
|
||||
int
|
||||
blr_file_init(ROUTER_INSTANCE *router)
|
||||
{
|
||||
char path[PATH_MAX + 1] = "";
|
||||
char path[PATH_MAX + 1 - BINLOG_FILE_EXTRA_INFO - BINLOG_FNAMELEN - 2] = "";
|
||||
char filename[PATH_MAX + 1] = "";
|
||||
int file_found, n = 1;
|
||||
int root_len, i;
|
||||
@ -262,9 +262,7 @@ blr_file_init(ROUTER_INSTANCE *router)
|
||||
return 0;
|
||||
}
|
||||
|
||||
strcpy(path, datadir);
|
||||
strcat(path, "/");
|
||||
strcat(path, router->service->name);
|
||||
snprintf(path, sizeof(path), "%s/%s", datadir, router->service->name);
|
||||
|
||||
if (access(path, R_OK) == -1)
|
||||
{
|
||||
|
@ -7047,9 +7047,9 @@ static bool blr_slave_gtid_request(ROUTER_INSTANCE *router,
|
||||
SQLITE_OPEN_READONLY,
|
||||
NULL) != SQLITE_OK)
|
||||
{
|
||||
char errmsg[BINLOG_ERROR_MSG_LEN + 1];
|
||||
char errmsg[BINLOG_ERROR_MSG_LEN + sizeof(dbpath) + 1];
|
||||
snprintf(errmsg,
|
||||
BINLOG_ERROR_MSG_LEN,
|
||||
sizeof(errmsg),
|
||||
"Slave %lu: failed to open GTID maps db '%s': %s",
|
||||
(unsigned long)slave->serverid,
|
||||
dbpath,
|
||||
@ -8180,7 +8180,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE *router,
|
||||
else
|
||||
{
|
||||
int rc;
|
||||
char error_string[BINLOG_ERROR_MSG_LEN + 1] = "";
|
||||
char error_string[BINLOG_ERROR_MSG_LEN + 1 + BINLOG_ERROR_MSG_LEN + 1] = "";
|
||||
MASTER_SERVER_CFG *current_master = NULL;
|
||||
|
||||
current_master = (MASTER_SERVER_CFG *)MXS_CALLOC(1, sizeof(MASTER_SERVER_CFG));
|
||||
@ -8228,7 +8228,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE *router,
|
||||
|
||||
spinlock_release(&router->lock);
|
||||
|
||||
snprintf(error_string, BINLOG_ERROR_MSG_LEN,
|
||||
snprintf(error_string, sizeof(error_string),
|
||||
"Error writing into %s/master.ini: %s",
|
||||
router->binlogdir,
|
||||
error);
|
||||
|
@ -192,7 +192,13 @@ bool RWSplitSession::route_single_stmt(GWBUF *querybuf)
|
||||
if ((target = handle_slave_is_target(command, stmt_id)))
|
||||
{
|
||||
succp = true;
|
||||
store_stmt = m_config.retry_failed_reads;
|
||||
|
||||
if (m_config.retry_failed_reads &&
|
||||
(command == MXS_COM_QUERY || command == MXS_COM_STMT_EXECUTE))
|
||||
{
|
||||
// Only commands that can contain an SQL statement should be stored
|
||||
store_stmt = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (TARGET_IS_MASTER(route_target))
|
||||
@ -258,6 +264,18 @@ bool RWSplitSession::route_single_stmt(GWBUF *querybuf)
|
||||
return succp;
|
||||
}
|
||||
|
||||
static inline bool is_large_query(GWBUF* buf)
|
||||
{
|
||||
uint32_t buflen = gwbuf_length(buf);
|
||||
|
||||
// The buffer should contain at most (2^24 - 1) + 4 bytes ...
|
||||
ss_dassert(buflen <= MYSQL_HEADER_LEN + GW_MYSQL_MAX_PACKET_LEN);
|
||||
// ... and the payload should be buflen - 4 bytes
|
||||
ss_dassert(MYSQL_GET_PAYLOAD_LEN(GWBUF_DATA(buf)) == buflen - MYSQL_HEADER_LEN);
|
||||
|
||||
return buflen == MYSQL_HEADER_LEN + GW_MYSQL_MAX_PACKET_LEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge session command history
|
||||
*
|
||||
@ -326,6 +344,13 @@ void RWSplitSession::purge_history(mxs::SSessionCommand& sescmd)
|
||||
*/
|
||||
bool RWSplitSession::route_session_write(GWBUF *querybuf, uint8_t command, uint32_t type)
|
||||
{
|
||||
if (is_large_query(querybuf))
|
||||
{
|
||||
MXS_ERROR("Session command is too large, session cannot continue. "
|
||||
"Large session commands are not supported in 2.2.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/** The SessionCommand takes ownership of the buffer */
|
||||
uint64_t id = m_sescmd_count++;
|
||||
mxs::SSessionCommand sescmd(new mxs::SessionCommand(querybuf, id));
|
||||
@ -848,18 +873,6 @@ bool RWSplitSession::handle_master_is_target(SRWBackend* dest)
|
||||
return succp;
|
||||
}
|
||||
|
||||
static inline bool is_large_query(GWBUF* buf)
|
||||
{
|
||||
uint32_t buflen = gwbuf_length(buf);
|
||||
|
||||
// The buffer should contain at most (2^24 - 1) + 4 bytes ...
|
||||
ss_dassert(buflen <= MYSQL_HEADER_LEN + GW_MYSQL_MAX_PACKET_LEN);
|
||||
// ... and the payload should be buflen - 4 bytes
|
||||
ss_dassert(MYSQL_GET_PAYLOAD_LEN(GWBUF_DATA(buf)) == buflen - MYSQL_HEADER_LEN);
|
||||
|
||||
return buflen == MYSQL_HEADER_LEN + GW_MYSQL_MAX_PACKET_LEN;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a wait gitd query in front of user's query to achive causal read;
|
||||
*
|
||||
|
Reference in New Issue
Block a user