Merge branch '2.1' into develop

This commit is contained in:
Markus Mäkelä 2017-08-03 15:51:15 +03:00
commit 1f4856cdc5
11 changed files with 88 additions and 47 deletions

View File

@ -93,11 +93,6 @@ if [ "$cmake_version" \< "3.7.1" ] ; then
cd ..
fi
# Flex
wget http://maxscale-jenkins.mariadb.com/x/flex-2.5.35-0.8.el5.rfb.x86_64.rpm
sudo yum install flex-2.5.35-0.8.el5.rfb.x86_64.rpm -y --nogpgcheck
rm flex-2.5.35-0.8.el5.rfb.x86_64*
# RabbitMQ C client
mkdir rabbit
cd rabbit

View File

@ -60,8 +60,7 @@ will still go to the central database.
## Bug fixes
[Here is a list of bugs fixed in MaxScale 2.1.5.]
(https://jira.mariadb.org/issues/?jql=project%20%3D%20MXS%20AND%20issuetype%20%3D%20Bug%20AND%20status%20%3D%20Closed%20AND%20fixVersion%20%3D%202.1.5)
[Here is a list of bugs fixed in MaxScale 2.1.5.](https://jira.mariadb.org/issues/?jql=project%20%3D%20MXS%20AND%20issuetype%20%3D%20Bug%20AND%20status%20%3D%20Closed%20AND%20fixVersion%20%3D%202.1.5)
* [MXS-1335](https://jira.mariadb.org/browse/MXS-1335) root_node_as_master should not be enabled by default
* [MXS-1330](https://jira.mariadb.org/browse/MXS-1330) insertstream attempts to parse all buffers

View File

@ -67,24 +67,13 @@ typedef enum
#define GWBUF_IS_IGNORABLE(b) (b->gwbuf_type & GWBUF_TYPE_IGNORABLE)
#define GWBUF_SHOULD_COLLECT_RESULT(b) (b->gwbuf_type & GWBUF_TYPE_COLLECT_RESULT)
/**
* A structure to encapsulate the data in a form that the data itself can be
* shared between multiple GWBUF's without the need to make multiple copies
* but still maintain separate data pointers.
*/
typedef struct
{
unsigned char *data; /*< Physical memory that was allocated */
int refcount; /*< Reference count on the buffer */
} SHARED_BUF;
typedef enum
{
GWBUF_INFO_NONE = 0x0,
GWBUF_INFO_PARSED = 0x1
} gwbuf_info_t;
#define GWBUF_IS_PARSED(b) (b->gwbuf_info & GWBUF_INFO_PARSED)
#define GWBUF_IS_PARSED(b) (b->sbuf->info & GWBUF_INFO_PARSED)
/**
* A structure for cleaning up memory allocations of structures which are
@ -107,6 +96,18 @@ struct buffer_object_st
buffer_object_t* bo_next;
};
/**
* A structure to encapsulate the data in a form that the data itself can be
* shared between multiple GWBUF's without the need to make multiple copies
* but still maintain separate data pointers.
*/
typedef struct
{
unsigned char *data; /*< Physical memory that was allocated */
int refcount; /*< Reference count on the buffer */
buffer_object_t *bufobj; /*< List of objects referred to by GWBUF */
uint32_t info; /*< Info bits */
} SHARED_BUF;
/**
* The buffer structure used by the descriptor control blocks.
@ -124,9 +125,7 @@ typedef struct gwbuf
void *start; /*< Start of the valid data */
void *end; /*< First byte after the valid data */
SHARED_BUF *sbuf; /*< The shared buffer with the real data */
buffer_object_t *gwbuf_bufobj; /*< List of objects referred to by GWBUF */
uint32_t gwbuf_info; /*< Info bits; mask of gwbuf_info_t values. */
uint32_t gwbuf_type; /*< Type bits; mask of gwbuf_type_t values. */
uint32_t gwbuf_type; /*< buffer's data type information */
HINT *hint; /*< Hint data for this buffer */
BUF_PROPERTY *properties; /*< Buffer properties */
struct server *server; /*< The target server where the buffer is executed */

View File

@ -286,6 +286,13 @@ void mon_process_state_changes(MXS_MONITOR *monitor, const char *script, uint64_
*/
void mon_hangup_failed_servers(MXS_MONITOR *monitor);
/**
* @brief Report query errors
*
* @param db Database where the query failed
*/
void mon_report_query_error(MXS_MONITOR_SERVERS* db);
/**
* @brief Convert monitor to JSON
*

View File

@ -78,18 +78,19 @@ gwbuf_alloc(unsigned int size)
rval = NULL;
goto retblock;
}
sbuf->refcount = 1;
sbuf->info = GWBUF_INFO_NONE;
sbuf->bufobj = NULL;
spinlock_init(&rval->gwbuf_lock);
rval->start = sbuf->data;
rval->end = (void *)((char *)rval->start + size);
sbuf->refcount = 1;
rval->sbuf = sbuf;
rval->next = NULL;
rval->tail = rval;
rval->hint = NULL;
rval->properties = NULL;
rval->gwbuf_type = GWBUF_TYPE_UNDEFINED;
rval->gwbuf_info = GWBUF_INFO_NONE;
rval->gwbuf_bufobj = NULL;
CHK_GWBUF(rval);
retblock:
if (rval == NULL)
@ -254,16 +255,17 @@ gwbuf_free_one(GWBUF *buf)
if (atomic_add(&buf->sbuf->refcount, -1) == 1)
{
MXS_FREE(buf->sbuf->data);
MXS_FREE(buf->sbuf);
bo = buf->gwbuf_bufobj;
bo = buf->sbuf->bufobj;
while (bo != NULL)
{
bo = gwbuf_remove_buffer_object(buf, bo);
}
MXS_FREE(buf->sbuf->data);
MXS_FREE(buf->sbuf);
}
while (buf->properties)
{
prop = buf->properties;
@ -310,8 +312,6 @@ gwbuf_clone_one(GWBUF *buf)
rval->start = buf->start;
rval->end = buf->end;
rval->gwbuf_type = buf->gwbuf_type;
rval->gwbuf_info = buf->gwbuf_info;
rval->gwbuf_bufobj = buf->gwbuf_bufobj;
rval->tail = rval;
rval->next = NULL;
CHK_GWBUF(rval);
@ -396,8 +396,6 @@ static GWBUF *gwbuf_clone_portion(GWBUF *buf,
clonebuf->gwbuf_type = buf->gwbuf_type; /*< clone the type for now */
clonebuf->properties = NULL;
clonebuf->hint = NULL;
clonebuf->gwbuf_info = buf->gwbuf_info;
clonebuf->gwbuf_bufobj = buf->gwbuf_bufobj;
clonebuf->next = NULL;
clonebuf->tail = clonebuf;
CHK_GWBUF(clonebuf);
@ -694,7 +692,7 @@ void gwbuf_add_buffer_object(GWBUF* buf,
newb->bo_next = NULL;
/** Lock */
spinlock_acquire(&buf->gwbuf_lock);
p_b = &buf->gwbuf_bufobj;
p_b = &buf->sbuf->bufobj;
/** Search the end of the list and add there */
while (*p_b != NULL)
{
@ -702,7 +700,7 @@ void gwbuf_add_buffer_object(GWBUF* buf,
}
*p_b = newb;
/** Set flag */
buf->gwbuf_info |= GWBUF_INFO_PARSED;
buf->sbuf->info |= GWBUF_INFO_PARSED;
/** Unlock */
spinlock_release(&buf->gwbuf_lock);
}
@ -714,7 +712,7 @@ void* gwbuf_get_buffer_object_data(GWBUF* buf, bufobj_id_t id)
CHK_GWBUF(buf);
/** Lock */
spinlock_acquire(&buf->gwbuf_lock);
bo = buf->gwbuf_bufobj;
bo = buf->sbuf->bufobj;
while (bo != NULL && bo->bo_id != id)
{

View File

@ -1375,6 +1375,14 @@ void mon_hangup_failed_servers(MXS_MONITOR *monitor)
}
}
}
void mon_report_query_error(MXS_MONITOR_SERVERS* db)
{
MXS_ERROR("Failed to execute query on server '%s' ([%s]:%d): %s",
db->server->unique_name, db->server->name,
db->server->port, mysql_error(db->con));
}
/**
* Acquire locks on all servers monitored by this monitor. There should
* only be max 1 monitor per server.

View File

@ -80,10 +80,7 @@ void update_server_status(MXS_MONITOR *monitor, MXS_MONITOR_SERVERS *database)
}
else
{
MXS_ERROR("Failed to query server %s ([%s]:%d): %d, %s",
database->server->unique_name, database->server->name,
database->server->port, mysql_errno(database->con),
mysql_error(database->con));
mon_report_query_error(database);
}
}
else

View File

@ -394,6 +394,10 @@ monitorDatabase(MXS_MONITOR *mon, MXS_MONITOR_SERVERS *database)
}
mysql_free_result(result2);
}
else
{
mon_report_query_error(database);
}
}
else
{
@ -463,6 +467,10 @@ monitorDatabase(MXS_MONITOR *mon, MXS_MONITOR_SERVERS *database)
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
}
/**
@ -878,9 +886,7 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
}
else
{
MXS_ERROR("Error while selecting 'wsrep_node_name' from node %s: %s",
ptr->server->unique_name,
mysql_error(ptr->con));
mon_report_query_error(ptr);
}
}
@ -907,9 +913,7 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
}
else
{
MXS_ERROR("SET GLOBAL rep_sst_donor error in node %s: %s",
ptr->server->unique_name,
mysql_error(ptr->con));
mon_report_query_error(ptr);
}
}

View File

@ -291,7 +291,10 @@ monitorDatabase(MXS_MONITOR* mon, MXS_MONITOR_SERVERS *database)
}
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
/* Check if the Slave_SQL_Running and Slave_IO_Running status is
* set to Yes
*/
@ -356,6 +359,10 @@ monitorDatabase(MXS_MONITOR* mon, MXS_MONITOR_SERVERS *database)
isslave = 0;
}
}
else
{
mon_report_query_error(database);
}
}
else
{
@ -417,6 +424,10 @@ monitorDatabase(MXS_MONITOR* mon, MXS_MONITOR_SERVERS *database)
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
}
/* get variable 'read_only' set by an external component */
@ -444,6 +455,10 @@ monitorDatabase(MXS_MONITOR* mon, MXS_MONITOR_SERVERS *database)
}
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
/* Remove addition info */
monitor_clear_pending_status(database, SERVER_STALE_STATUS);

View File

@ -543,6 +543,10 @@ static inline void monitor_mysql_db(MXS_MONITOR_SERVERS* database, MYSQL_SERVER_
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
}
/**
@ -595,7 +599,10 @@ static MXS_MONITOR_SERVERS *build_mysql51_replication_tree(MXS_MONITOR *mon)
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
/* Set the Slave Role */
if (ismaster)
@ -771,6 +778,10 @@ monitorDatabase(MXS_MONITOR *mon, MXS_MONITOR_SERVERS *database)
}
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
/* Check first for MariaDB 10.x.x and get status for multi-master replication */
if (server_version >= 100000)

View File

@ -250,6 +250,10 @@ monitorDatabase(MXS_MONITOR_SERVERS *database, char *defaultUser, char *defaultP
}
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
/* Check the the SQL node id in the MySQL cluster */
if (mysql_query(database->con, "SHOW STATUS LIKE 'Ndb_cluster_node_id'") == 0
@ -277,6 +281,10 @@ monitorDatabase(MXS_MONITOR_SERVERS *database, char *defaultUser, char *defaultP
}
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
if (isjoined)
{