Merge branch 'develop' into MAX-268

This commit is contained in:
MassimilianoPinto
2014-10-03 16:28:38 +02:00
165 changed files with 690 additions and 434 deletions

View File

@ -1,4 +1,4 @@
# This file is distributed as part of MaxScale form SkySQL. It is free
# This file is distributed as part of MaxScale form MariaDB Corporation. It is free
# software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation,
# version 2.
@ -12,7 +12,7 @@
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright SkySQL Ab 2014
# Copyright MariaDB Corporation Ab 2014
#
# Revision History
# Date Who Description

View File

@ -1,4 +1,4 @@
# This file is distributed as part of MaxScale form SkySQL. It is free
# This file is distributed as part of MaxScale form MariaDB Corporation. It is free
# software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation,
# version 2.
@ -12,7 +12,7 @@
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright SkySQL Ab 2014
# Copyright MariaDB Corporation Ab 2014
#
# Revision History
# Date Who Description

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of MaxScale by SkySQL. It is free
* This file is distributed as part of MaxScale by MariaDB Corporation. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
#include <stdio.h>
#include <filter.h>

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of MaxScale by SkySQL. It is free
* This file is distributed as part of MaxScale by MariaDB Corporation. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
#include <stdio.h>
#include <ctype.h>

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of MaxScale by SkySQL. It is free
* This file is distributed as part of MaxScale by MariaDB Corporation. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of MaxScale by SkySQL. It is free
* This file is distributed as part of MaxScale by MariaDB Corporation. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of MaxScale by SkySQL. It is free
* This file is distributed as part of MaxScale by MariaDB Corporation. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
#include <stdio.h>
#include <filter.h>

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of MaxScale by SkySQL. It is free
* This file is distributed as part of MaxScale by MariaDB Corporation. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of MaxScale by SkySQL. It is free
* This file is distributed as part of MaxScale by MariaDB Corporation. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
#include <stdio.h>
#include <filter.h>

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of MaxScale by SkySQL. It is free
* This file is distributed as part of MaxScale by MariaDB Corporation. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -1,7 +1,7 @@
#ifndef _DEBUGCLI_H
#define _DEBUGCLI_H
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
#include <service.h>
#include <session.h>

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/*

View File

@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -1,7 +1,7 @@
#ifndef _MYSQL_PROTOCOL_H
#define _MYSQL_PROTOCOL_H
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/*

View File

@ -1,7 +1,7 @@
#ifndef _MYSQLHINT_H
#define _MYSQLHINT_H
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/*

View File

@ -1,7 +1,7 @@
#ifndef _READCONNECTION_H
#define _READCONNECTION_H
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**

View File

@ -1,7 +1,7 @@
#ifndef _RWSPLITROUTER_H
#define _RWSPLITROUTER_H
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**

View File

@ -1,7 +1,7 @@
#ifndef _TELNETD_H
#define _TELNETD_H
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**

View File

@ -1,11 +1,11 @@
add_library(mysqlmon SHARED mysql_mon.c)
target_link_libraries(mysqlmon log_manager utils ${EMBEDDED_LIB})
target_link_libraries(mysqlmon log_manager utils)
install(TARGETS mysqlmon DESTINATION modules)
add_library(galeramon SHARED galera_mon.c)
target_link_libraries(galeramon log_manager utils ${EMBEDDED_LIB})
target_link_libraries(galeramon log_manager utils)
install(TARGETS galeramon DESTINATION modules)
add_library(ndbclustermon SHARED ndbcluster_mon.c)
target_link_libraries(ndbclustermon log_manager utils ${EMBEDDED_LIB})
install(TARGETS ndbclustermon DESTINATION modules)
target_link_libraries(ndbclustermon log_manager utils)
install(TARGETS ndbclustermon DESTINATION modules)

View File

@ -1,4 +1,4 @@
# This file is distributed as part of the SkySQL Gateway. It is free
# This file is distributed as part of the MariaDB Corporation MaxScale. It is free
# software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation,
# version 2.
@ -12,7 +12,7 @@
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright SkySQL Ab 2013
# Copyright MariaDB Corporation Ab 2013
#
# Revision History
# Date Who Description

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**

View File

@ -1,7 +1,7 @@
#ifndef _MYSQLMON_H
#define _MYSQLMON_H
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
#include <server.h>
#include <spinlock.h>

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**

View File

@ -1,4 +1,4 @@
# This file is distributed as part of the SkySQL Gateway. It is free
# This file is distributed as part of the MariaDB Corporation MaxScale. It is free
# software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation,
# version 2.
@ -12,7 +12,7 @@
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright SkySQL Ab 2013
# Copyright MariaDB Corporation Ab 2013
#
# Revision History
# Date Who Description

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**
@ -49,7 +49,7 @@ MODULE_INFO info = {
};
#define ISspace(x) isspace((int)(x))
#define HTTP_SERVER_STRING "Gateway(c) v.1.0.0"
#define HTTP_SERVER_STRING "MaxScale(c) v.1.0.0"
static char *version_str = "V1.0.1";
static int httpd_read_event(DCB* dcb);
@ -233,7 +233,7 @@ HTTPD_session *client_data = NULL;
*
*/
dcb_printf(dcb, "Welcome to HTTPD Gateway (c) %s\n\n", version_str);
dcb_printf(dcb, "Welcome to HTTPD MaxScale (c) %s\n\n", version_str);
if (strcmp(url, "/show") == 0) {
if (strlen(query_string)) {

View File

@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
#include "mysql_client_server_protocol.h"
@ -27,7 +27,7 @@
* Revision History
* Date Who Description
* 14/06/2013 Mark Riddoch Initial version
* 17/06/2013 Massimiliano Pinto Added Gateway To Backends routines
* 17/06/2013 Massimiliano Pinto Added MaxScale To Backends routines
* 27/06/2013 Vilho Raatikka Added skygw_log_write command as an example
* and necessary headers.
* 01/07/2013 Massimiliano Pinto Put Log Manager example code behind SS_DEBUG macros.

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**
@ -25,7 +25,7 @@
* Revision History
* Date Who Description
* 14/06/2013 Mark Riddoch Initial version
* 17/06/2013 Massimiliano Pinto Added Client To Gateway routines
* 17/06/2013 Massimiliano Pinto Added Client To MaxScale routines
* 24/06/2013 Massimiliano Pinto Added: fetch passwords from service users' hashtable
* 02/09/2013 Massimiliano Pinto Added: session refcount
* 16/12/2013 Massimiliano Pinto Added: client closed socket detection with recv(..., MSG_PEEK)
@ -494,7 +494,7 @@ static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue) {
}
/**
* Write function for client DCB: writes data from Gateway to Client
* Write function for client DCB: writes data from MaxScale to Client
*
* @param dcb The DCB of the client
* @param queue Queue of buffers to write

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/*
@ -1315,7 +1315,7 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le
/**
* gw_find_mysql_user_password_sha1
*
* The routine fetches look for an user int he Gateway users' table
* The routine fetches look for an user int he MaxScale users' table
* The users' table is dcb->service->users or a different one specified with void *repository
*
* If found the HEX password, representing sha1(sha1(password)), is converted in binary data and
@ -1703,9 +1703,11 @@ void protocol_archive_srv_command(
s1 = &p->protocol_command;
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Move command %s from fd %d to command history.",
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [protocol_archive_srv_command] Move command %s from fd %d "
"to command history.",
pthread_self(),
STRPACKETTYPE(s1->scom_cmd),
p->owner_dcb->fd)));
@ -1777,8 +1779,8 @@ void protocol_add_srv_command(
p->protocol_command.scom_next = server_command_init(NULL, cmd);
}
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"Added command %s to fd %d.",
STRPACKETTYPE(cmd),
p->owner_dcb->fd)));
@ -1788,8 +1790,8 @@ void protocol_add_srv_command(
while (c != NULL && c->scom_cmd != MYSQL_COM_UNDEFINED)
{
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"fd %d : %d %s",
p->owner_dcb->fd,
c->scom_cmd,

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of SkySQL MaxScale. It is free
* This file is distributed as part of MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**

View File

@ -1,4 +1,4 @@
# This file is distributed as part of the SkySQL Gateway. It is free
# This file is distributed as part of the MariaDB Corporation MaxScale. It is free
# software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation,
# version 2.
@ -12,7 +12,7 @@
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright SkySQL Ab 2013
# Copyright MariaDB Corporation Ab 2013
#
# Revision History
# Date Who Description

View File

@ -1,4 +1,4 @@
# This file is distributed as part of the SkySQL Gateway. It is free
# This file is distributed as part of the MariaDB Corporation MaxScale. It is free
# software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation,
# version 2.
@ -12,7 +12,7 @@
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright SkySQL Ab 2013
# Copyright MariaDB Corporation Ab 2013
#
# Revision History
# Date Who Description

View File

@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
/**

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**
@ -210,7 +210,7 @@ CLI_SESSION *client;
session->state = SESSION_STATE_READY;
client->mode = inst->mode;
dcb_printf(session->client, "Welcome the SkySQL MaxScale Debug Interface (%s).\n",
dcb_printf(session->client, "Welcome the MariaDB Corporation MaxScale Debug Interface (%s).\n",
version_str);
if (client->mode == CLIM_DEVELOPER)
{

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**

View File

@ -1,6 +1,6 @@
add_library(readwritesplit SHARED readwritesplit.c)
target_link_libraries(readwritesplit ssl pthread log_manager utils query_classifier ${EMBEDDED_LIB})
target_link_libraries(readwritesplit ssl pthread log_manager utils query_classifier)
install(TARGETS readwritesplit DESTINATION modules)
if(BUILD_TESTS)
add_subdirectory(test)
endif()
endif()

View File

@ -1,4 +1,4 @@
# This file is distributed as part of the SkySQL Gateway. It is free
# This file is distributed as part of the MariaDB Corporation MaxScale. It is free
# software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation,
# version 2.
@ -12,7 +12,7 @@
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright SkySQL Ab 2013
# Copyright MariaDB Corporation Ab 2013
#
# Revision History
# Date Who Description

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
#include <stdio.h>
#include <strings.h>
@ -1282,9 +1282,10 @@ static route_target_t get_route_target (
if (hint->type == HINT_ROUTE_TO_MASTER)
{
target = TARGET_MASTER; /*< override */
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Hint: route to master.")));
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [get_route_target] Hint: route to master.",
pthread_self())));
break;
}
else if (hint->type == HINT_ROUTE_TO_NAMED_SERVER)
@ -1294,9 +1295,11 @@ static route_target_t get_route_target (
* found, the oroginal target is chosen.
*/
target |= TARGET_NAMED_SERVER;
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Hint: route to named server : ")));
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [get_route_target] Hint: route to "
"named server : ",
pthread_self())));
}
else if (hint->type == HINT_ROUTE_TO_UPTODATE_SERVER)
{
@ -1334,9 +1337,11 @@ static route_target_t get_route_target (
else if (hint->type == HINT_ROUTE_TO_SLAVE)
{
target = TARGET_SLAVE;
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Hint: route to slave.")));
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%lu [get_route_target] Hint: route to "
"slave.",
pthread_self())));
}
hint = hint->next;
} /*< while (hint != NULL) */
@ -1637,7 +1642,7 @@ void check_create_tmp_table(
*
* @param instance The query router instance
* @param session The session associated with the client
* @param queue Gateway buffer queue with the packets received
* @param queue MaxScale buffer queue with the packets received
*
* @return if succeed 1, otherwise 0
* If routeQuery fails, it means that router session has failed.
@ -1653,7 +1658,6 @@ static int routeQuery(
GWBUF* querybuf)
{
skygw_query_type_t qtype = QUERY_TYPE_UNKNOWN;
char* querystr = NULL;
mysql_server_cmd_t packet_type;
uint8_t* packet;
int ret = 0;
@ -1793,8 +1797,33 @@ static int routeQuery(
{
router_cli_ses->rses_autocommit_enabled = true;
router_cli_ses->rses_transaction_active = false;
}
}
if (LOG_IS_ENABLED(LOGFILE_TRACE))
{
uint8_t* packet = GWBUF_DATA(querybuf);
unsigned char ptype = packet[4];
size_t len = MIN(GWBUF_LENGTH(querybuf),
MYSQL_GET_PACKET_LEN((unsigned char *)querybuf->start)-1);
char* data = (char*)&packet[5];
char* contentstr = strndup(data, len);
char* qtypestr = skygw_get_qtype_str(qtype);
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"> Autocommit: %s, trx is %s, cmd: %s, type: %s, "
"stmt: %s%s %s",
(router_cli_ses->rses_autocommit_enabled ? "[enabled]" : "[disabled]"),
(router_cli_ses->rses_transaction_active ? "[open]" : "[not open]"),
STRPACKETTYPE(ptype),
(qtypestr==NULL ? "N/A" : qtypestr),
contentstr,
(querybuf->hint == NULL ? "" : ", Hint:"),
(querybuf->hint == NULL ? "" : STRHINTTYPE(querybuf->hint->type)))));
free(contentstr);
free(qtypestr);
}
/**
* Find out where to route the query. Result may not be clear; it is
* possible to have a hint for routing to a named server which can
@ -1911,6 +1940,27 @@ static int routeQuery(
btype,
named_server,
rlag_max);
if (!succp)
{
if (TARGET_IS_NAMED_SERVER(route_target))
{
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Was supposed to route to named server "
"%s but couldn't find the server in a "
"suitable state.",
named_server)));
}
else if (TARGET_IS_RLAG_MAX(route_target))
{
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Was supposed to route to server with "
"replication lag at most %d but couldn't "
"find such a slave.",
rlag_max)));
}
}
}
if (!succp && TARGET_IS_SLAVE(route_target))
@ -1930,9 +1980,16 @@ static int routeQuery(
NULL,
rlag_max);
if (succp)
{
{
atomic_add(&inst->stats.n_slave, 1);
}
else
{
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
"Was supposed to route to slave"
"but finding suitable one "
"failed.")));
}
}
if (!succp && TARGET_IS_MASTER(route_target))
@ -1944,6 +2001,16 @@ static int routeQuery(
BE_MASTER,
NULL,
MAX_RLAG_UNDEFINED);
if (!succp)
{
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
"Was supposed to "
"route to master "
"but couldn't find "
"master in a "
"suitable state "
"failed.")));
}
}
else
{
@ -1951,9 +2018,7 @@ static int routeQuery(
}
atomic_add(&inst->stats.n_master, 1);
target_dcb = master_dcb;
}
ss_dassert(succp);
}
if (succp) /*< Have DCB of the target backend */
{
@ -1962,6 +2027,14 @@ static int routeQuery(
bref = get_bref_from_dcb(router_cli_ses, target_dcb);
scur = &bref->bref_sescmd_cur;
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Route query to %s\t%s:%d <",
(SERVER_IS_MASTER(bref->bref_backend->backend_server) ?
"master" : "slave"),
bref->bref_backend->backend_server->name,
bref->bref_backend->backend_server->port)));
/**
* Store current stmt if execution of previous session command
* haven't completed yet. Note that according to MySQL protocol
@ -1993,8 +2066,7 @@ static int routeQuery(
{
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Routing query \"%s\" failed.",
querystr)));
"Error : Routing query failed.")));
}
}
rses_end_locked_router_action(router_cli_ses);
@ -3441,12 +3513,6 @@ static bool execute_sescmd_in_backend(
sescmd_cursor_clone_querybuf(scur));
break;
}
LOGIF(LT, (skygw_log_write_flush(
LOGFILE_TRACE,
"%lu [execute_sescmd_in_backend] Routed %s cmd %p.",
pthread_self(),
STRPACKETTYPE(scur->scmd_cur_cmd->my_sescmd_packet_type),
scur->scmd_cur_cmd)));
if (rc == 1)
{
@ -3573,8 +3639,8 @@ static void tracelog_routed_query(
querystr = (char *)malloc(len);
memcpy(querystr, startpos, len-1);
querystr[len-1] = '\0';
LOGIF(LT, (skygw_log_write_flush(
LOGFILE_TRACE,
LOGIF(LD, (skygw_log_write_flush(
LOGFILE_DEBUG,
"%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
pthread_self(),
funcname,
@ -3595,8 +3661,8 @@ static void tracelog_routed_query(
querystr = (char *)malloc(len);
memcpy(querystr, startpos, len-1);
querystr[len-1] = '\0';
LOGIF(LT, (skygw_log_write_flush(
LOGFILE_TRACE,
LOGIF(LD, (skygw_log_write_flush(
LOGFILE_DEBUG,
"%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
pthread_self(),
funcname,
@ -3663,10 +3729,7 @@ static bool route_session_write(
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Session write, query type\t%s, packet type %s, "
"routing to all servers.",
STRQTYPE(qtype),
STRPACKETTYPE(packet_type))));
"Session write, routing to all servers.")));
backend_ref = router_cli_ses->rses_backend_ref;
@ -3693,7 +3756,19 @@ static bool route_session_write(
for (i=0; i<router_cli_ses->rses_nbackends; i++)
{
DCB* dcb = backend_ref[i].bref_dcb;
DCB* dcb = backend_ref[i].bref_dcb;
if (LOG_IS_ENABLED(LOGFILE_TRACE))
{
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Route query to %s\t%s:%d%s",
(SERVER_IS_MASTER(backend_ref[i].bref_backend->backend_server) ?
"master" : "slave"),
backend_ref[i].bref_backend->backend_server->name,
backend_ref[i].bref_backend->backend_server->port,
(i+1==router_cli_ses->rses_nbackends ? " <" : ""))));
}
if (BREF_IS_IN_USE((&backend_ref[i])))
{
@ -3703,14 +3778,7 @@ static bool route_session_write(
{
succp = false;
}
else if (LOG_IS_ENABLED(LOGFILE_TRACE))
{
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Wrote to %s:%d",
backend_ref[i].bref_backend->backend_server->name,
backend_ref[i].bref_backend->backend_server->port)));
}
}
}
rses_end_locked_router_action(router_cli_ses);
@ -3740,6 +3808,18 @@ static bool route_session_write(
{
sescmd_cursor_t* scur;
if (LOG_IS_ENABLED(LOGFILE_TRACE))
{
LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE,
"Route query to %s\t%s:%d%s",
(SERVER_IS_MASTER(backend_ref[i].bref_backend->backend_server) ?
"master" : "slave"),
backend_ref[i].bref_backend->backend_server->name,
backend_ref[i].bref_backend->backend_server->port,
(i+1==router_cli_ses->rses_nbackends ? " <" : ""))));
}
scur = backend_ref_get_sescmd_cursor(&backend_ref[i]);
/**
@ -3747,7 +3827,7 @@ static bool route_session_write(
*/
bref_set_state(get_bref_from_dcb(router_cli_ses,
backend_ref[i].bref_dcb),
BREF_WAITING_RESULT);
BREF_WAITING_RESULT);
/**
* Start execution if cursor is not already executing.
* Otherwise, cursor will execute pending commands

View File

@ -1,5 +1,5 @@
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
* Copyright MariaDB Corporation Ab 2013-2014
*/
#include <stdio.h>
#include <router.h>

View File

@ -13,7 +13,7 @@
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2014
* Copyright MariaDB Corporation Ab 2014
*/
#include <stdio.h>
#include <router.h>