Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA
This commit is contained in:
@ -11,7 +11,7 @@ macro(set_maxscale_version)
|
||||
set(MAXSCALE_VERSION_MINOR "0")
|
||||
set(MAXSCALE_VERSION_PATCH "2")
|
||||
set(MAXSCALE_VERSION_NUMERIC "${MAXSCALE_VERSION_MAJOR}.${MAXSCALE_VERSION_MINOR}.${MAXSCALE_VERSION_PATCH}")
|
||||
set(MAXSCALE_VERSION "${MAXSCALE_VERSION_MAJOR}.${MAXSCALE_VERSION_MINOR}.${MAXSCALE_VERSION_PATCH}-beta")
|
||||
set(MAXSCALE_VERSION "${MAXSCALE_VERSION_MAJOR}.${MAXSCALE_VERSION_MINOR}.${MAXSCALE_VERSION_PATCH}-rc")
|
||||
|
||||
endmacro()
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
* Date Who Description
|
||||
* 20/06/2014 Mark Riddoch Initial implementation
|
||||
* 24/06/2014 Mark Riddoch Addition of support for multi-packet queries
|
||||
* 12/12/2014 Mark Riddoch Add support for otehr packet types
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
@ -58,6 +59,29 @@
|
||||
#include <router.h>
|
||||
#include <dcb.h>
|
||||
|
||||
#define MYSQL_COM_QUIT 0x01
|
||||
#define MYSQL_COM_INITDB 0x02
|
||||
#define MYSQL_COM_FIELD_LIST 0x04
|
||||
#define MYSQL_COM_CHANGE_USER 0x11
|
||||
#define MYSQL_COM_STMT_PREPARE 0x16
|
||||
#define MYSQL_COM_STMT_EXECUTE 0x17
|
||||
#define MYSQL_COM_STMT_SEND_LONG_DATA 0x18
|
||||
#define MYSQL_COM_STMT_CLOSE 0x19
|
||||
#define MYSQL_COM_STMT_RESET 0x1a
|
||||
|
||||
|
||||
static unsigned char required_packets[] = {
|
||||
MYSQL_COM_QUIT,
|
||||
MYSQL_COM_INITDB,
|
||||
MYSQL_COM_FIELD_LIST,
|
||||
MYSQL_COM_CHANGE_USER,
|
||||
MYSQL_COM_STMT_PREPARE,
|
||||
MYSQL_COM_STMT_EXECUTE,
|
||||
MYSQL_COM_STMT_SEND_LONG_DATA,
|
||||
MYSQL_COM_STMT_CLOSE,
|
||||
MYSQL_COM_STMT_RESET,
|
||||
0 };
|
||||
|
||||
/** Defined in log_manager.cc */
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
extern size_t log_ses_count[];
|
||||
@ -128,6 +152,7 @@ typedef struct {
|
||||
int residual; /* Any outstanding SQL text */
|
||||
} TEE_SESSION;
|
||||
|
||||
static int packet_is_required(GWBUF *queue);
|
||||
/**
|
||||
* Implementation of the mandatory version entry point
|
||||
*
|
||||
@ -280,6 +305,13 @@ TEE_INSTANCE *my_instance = (TEE_INSTANCE *)instance;
|
||||
TEE_SESSION *my_session;
|
||||
char *remote, *userName;
|
||||
|
||||
if (strcmp(my_instance->service->name, session->service->name) == 0)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"%s: Recursive use of tee filter in service.",
|
||||
session->service->name)));
|
||||
return NULL;
|
||||
}
|
||||
if ((my_session = calloc(1, sizeof(TEE_SESSION))) != NULL)
|
||||
{
|
||||
my_session->active = 1;
|
||||
@ -431,6 +463,10 @@ GWBUF *clone = NULL;
|
||||
}
|
||||
free(ptr);
|
||||
}
|
||||
else if (packet_is_required(queue))
|
||||
{
|
||||
clone = gwbuf_clone(queue);
|
||||
}
|
||||
|
||||
/* Pass the query downstream */
|
||||
rval = my_session->down.routeQuery(my_session->down.instance,
|
||||
@ -486,3 +522,25 @@ TEE_SESSION *my_session = (TEE_SESSION *)fsession;
|
||||
my_session->n_rejected);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the packet is a command that must be sent to the branch
|
||||
* to maintain the session consistancy. These are COM_INIT_DB,
|
||||
* COM_CHANGE_USER and COM_QUIT packets.
|
||||
*
|
||||
* @param queue The buffer to check
|
||||
* @return non-zero if the packet should be sent to the branch
|
||||
*/
|
||||
static int
|
||||
packet_is_required(GWBUF *queue)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
int i;
|
||||
|
||||
ptr = GWBUF_DATA(queue);
|
||||
if (GWBUF_LENGTH(queue) > 4)
|
||||
for (i = 0; required_packets[i]; i++)
|
||||
if (ptr[4] == required_packets[i])
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,27 +1,5 @@
|
||||
#
|
||||
# Example MaxScale.cnf configuration file
|
||||
#
|
||||
#
|
||||
#
|
||||
# Number of server threads
|
||||
# Valid options are:
|
||||
# threads=<number of threads>
|
||||
|
||||
[maxscale]
|
||||
threads=1
|
||||
|
||||
# Define a monitor that can be used to determine the state and role of
|
||||
# the servers.
|
||||
#
|
||||
# Valid options are:
|
||||
#
|
||||
# module=<name of module to load>
|
||||
# servers=<server name>,<server name>,...
|
||||
# user =<user name - must have slave replication and
|
||||
# slave client privileges>
|
||||
# passwd=<password of the above user, plain text currently>
|
||||
# monitor_interval=<sampling interval in milliseconds,
|
||||
# default value is 10000>
|
||||
threads=4
|
||||
|
||||
[MySQL Monitor]
|
||||
type=monitor
|
||||
@ -29,41 +7,19 @@ module=mysqlmon
|
||||
servers=server1,server2,server3,server4
|
||||
user=maxuser
|
||||
passwd=maxpwd
|
||||
|
||||
# A series of service definition
|
||||
#
|
||||
# Valid options are:
|
||||
#
|
||||
# router=<name of router module>
|
||||
# servers=<server name>,<server name>,...
|
||||
# user=<User to fetch password inforamtion with>
|
||||
# passwd=<Password of the user, plain text currently>
|
||||
# enable_root_user=<0 or 1, default is 0>
|
||||
# version_string=<specific string for server handshake,
|
||||
# default is the MariaDB embedded library version>
|
||||
#
|
||||
# Valid router modules currently are:
|
||||
# readwritesplit, readconnroute and debugcli
|
||||
|
||||
monitor_interval=10000
|
||||
|
||||
[RW Split Router]
|
||||
type=service
|
||||
router=readwritesplit
|
||||
servers=server1,server2,server3,server4
|
||||
max_slave_connections=90%
|
||||
write_ses_variables_to_all=Yes
|
||||
read_ses_variables_from_slaves=Yes
|
||||
user=maxuser
|
||||
passwd=maxpwd
|
||||
filters=Hint
|
||||
|
||||
[RW Split Hint Router]
|
||||
type=service
|
||||
router=readwritesplit
|
||||
servers=server1,server2,server3,server4
|
||||
max_slave_connections=90%
|
||||
write_ses_variables_to_all=Yes
|
||||
read_ses_variables_from_slaves=Yes
|
||||
user=maxuser
|
||||
passwd=maxpwd
|
||||
filters=Hint
|
||||
@ -77,31 +33,23 @@ servers=server1
|
||||
user=maxuser
|
||||
passwd=maxpwd
|
||||
|
||||
|
||||
[HTTPD Router]
|
||||
type=service
|
||||
router=testroute
|
||||
servers=server1,server2,server3
|
||||
[Hint]
|
||||
type=filter
|
||||
module=hintfilter
|
||||
|
||||
[Debug Interface]
|
||||
type=service
|
||||
router=debugcli
|
||||
|
||||
[CLI]
|
||||
type=service
|
||||
router=cli
|
||||
|
||||
[Hint]
|
||||
type=filter
|
||||
module=hintfilter
|
||||
|
||||
|
||||
# Listener definitions for the services
|
||||
#
|
||||
# Valid options are:
|
||||
#
|
||||
# service=<name of service defined elsewhere>
|
||||
# protocol=<name of protocol module with which to listen>
|
||||
# port=<Listening port>
|
||||
# address=<Address to bind to>
|
||||
# socket=<Listening socket>
|
||||
[Read Connection Listener]
|
||||
type=listener
|
||||
service=Read Connection Router
|
||||
protocol=MySQLClient
|
||||
port=4008
|
||||
|
||||
[RW Split Listener]
|
||||
type=listener
|
||||
@ -115,28 +63,17 @@ service=RW Split Hint Router
|
||||
protocol=MySQLClient
|
||||
port=4009
|
||||
|
||||
[Read Connection Listener]
|
||||
type=listener
|
||||
service=Read Connection Router
|
||||
protocol=MySQLClient
|
||||
port=4008
|
||||
#socket=/tmp/readconn.sock
|
||||
|
||||
[Debug Listener]
|
||||
type=listener
|
||||
service=Debug Interface
|
||||
protocol=telnetd
|
||||
port=4442
|
||||
#address=127.0.0.1
|
||||
|
||||
[HTTPD Listener]
|
||||
[CLI Listener]
|
||||
type=listener
|
||||
service=HTTPD Router
|
||||
protocol=HTTPD
|
||||
port=6444
|
||||
|
||||
# Definition of the servers
|
||||
|
||||
service=CLI
|
||||
protocol=maxscaled
|
||||
port=6603
|
||||
[server1]
|
||||
type=server
|
||||
address=127.0.0.1
|
||||
|
Reference in New Issue
Block a user