Develop branch update

Develop branch update
This commit is contained in:
MassimilianoPinto
2016-11-14 17:44:39 +01:00
310 changed files with 16920 additions and 9914 deletions

View File

@ -61,6 +61,8 @@
* 09/05/2016 Massimiliano Pinto Added SELECT USER()
* 11/07/2016 Massimiliano Pinto Added SSL backend support
* 24/08/2016 Massimiliano Pinto Added slave notification via CS_WAIT_DATA
* 16/09/2016 Massimiliano Pinto IGNORABLE_EVENT created by MaxScale is not sent to slaves,
* Events with LOG_EVENT_IGNORABLE_F are also skipped.
*
* @endverbatim
*/
@ -69,24 +71,21 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <maxscale.h>
#include <service.h>
#include <server.h>
#include <router.h>
#include <atomic.h>
#include <spinlock.h>
#include <blr.h>
#include <dcb.h>
#include <spinlock.h>
#include <housekeeper.h>
#include <maxscale/maxscale.h>
#include <maxscale/service.h>
#include <maxscale/server.h>
#include <maxscale/router.h>
#include <maxscale/atomic.h>
#include <maxscale/spinlock.h>
#include "blr.h"
#include <maxscale/dcb.h>
#include <maxscale/spinlock.h>
#include <maxscale/housekeeper.h>
#include <sys/stat.h>
#include <skygw_types.h>
#include <skygw_utils.h>
#include <log_manager.h>
#include <version.h>
#include <maxscale/log_manager.h>
#include <maxscale/version.h>
#include <zlib.h>
#include <maxscale/alloc.h>
#include <gw.h>
extern int load_mysql_users(SERV_LISTENER *listener);
extern void blr_master_close(ROUTER_INSTANCE* router);
@ -264,7 +263,7 @@ blr_slave_request(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
case COM_QUIT:
MXS_DEBUG("COM_QUIT received from slave with server_id %d",
slave->serverid);
break;
return 1;
default:
blr_send_custom_error(slave->dcb, 1, 0,
"You have an error in your SQL syntax; Check the "
@ -436,7 +435,7 @@ blr_slave_query(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
else if (strcasecmp(word, "USER()") == 0)
{
/* Return user@host */
char user_host[MYSQL_USER_MAXLEN + 1 + MYSQL_HOSTNAME_MAXLEN + 1] = "";
char user_host[MYSQL_USER_MAXLEN + 1 + MYSQL_HOST_MAXLEN + 1] = "";
MXS_FREE(query_text);
snprintf(user_host, sizeof(user_host),
@ -876,7 +875,7 @@ blr_slave_query(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
if (removed_cfg == -1)
{
char err_msg[STRERROR_BUFLEN];
char err_msg[MXS_STRERROR_BUFLEN];
snprintf(error_string, BINLOG_ERROR_MSG_LEN,
"Error removing %s, %s, errno %u", path,
strerror_r(errno, err_msg, sizeof(err_msg)), errno);
@ -2304,6 +2303,15 @@ blr_slave_catchup(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, bool large)
strcpy(binlog_name, slave->binlogfile);
binlog_pos = slave->binlog_pos;
/* Don't sent special events generated by MaxScale */
if (hdr.event_type == IGNORABLE_EVENT || (hdr.flags & LOG_EVENT_IGNORABLE_F))
{
slave->binlog_pos = hdr.next_pos;
gwbuf_free(record);
record = NULL;
continue;
}
if (hdr.event_type == ROTATE_EVENT)
{
unsigned long beat1 = hkheartbeat;
@ -3337,8 +3345,6 @@ blr_stop_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
static int
blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
{
int loaded;
/* if unconfigured return an error */
if (router->master_state == BLRM_UNCONFIGURED)
{
@ -3468,28 +3474,7 @@ blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
router->current_pos, router->binlog_position);
/* Try reloading new users and update cached credentials */
loaded = service_refresh_users(router->service);
if (loaded == 0)
{
for (SERV_LISTENER *port = router->service->ports; port; port = port->next)
{
char path[PATH_MAX];
sprintf(path, "%s/%s/%s/", router->binlogdir, BLR_DBUSERS_DIR, port->name);
if (mxs_mkdir_all(path, 0775))
{
strcat(path, BLR_DBUSERS_FILE);
dbusers_save(port->users, path);
}
}
}
else
{
MXS_NOTICE("Service %s: user credentials could not be refreshed. "
"Will use existing cached credentials (%s/%s) if possible.",
router->service->name, router->binlogdir, BLR_DBUSERS_DIR);
}
service_refresh_users(router->service);
return blr_slave_send_ok(router, slave);
}