Merge branch 'release-1.2' into develop
Conflicts: server/core/adminusers.c server/modules/protocol/mysql_client.c
This commit is contained in:
@ -171,6 +171,9 @@ install(FILES ${CMAKE_BINARY_DIR}/Changelog.txt DESTINATION ${MAXSCALE_SHAREDIR}
|
|||||||
install(FILES ${CMAKE_BINARY_DIR}/ReleaseNotes.txt DESTINATION ${MAXSCALE_SHAREDIR})
|
install(FILES ${CMAKE_BINARY_DIR}/ReleaseNotes.txt DESTINATION ${MAXSCALE_SHAREDIR})
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/UpgradingToMaxScale110.txt DESTINATION ${MAXSCALE_SHAREDIR})
|
install(FILES ${CMAKE_BINARY_DIR}/UpgradingToMaxScale110.txt DESTINATION ${MAXSCALE_SHAREDIR})
|
||||||
install(FILES server/maxscale_template.cnf DESTINATION ${MAXSCALE_SHAREDIR})
|
install(FILES server/maxscale_template.cnf DESTINATION ${MAXSCALE_SHAREDIR})
|
||||||
|
if(WITH_MAXSCALE_CNF)
|
||||||
|
install(FILES server/maxscale_template.cnf DESTINATION ${MAXSCALE_CONFDIR} RENAME maxscale.cnf)
|
||||||
|
endif()
|
||||||
install(FILES server/maxscale_binlogserver_template.cnf DESTINATION ${MAXSCALE_SHAREDIR})
|
install(FILES server/maxscale_binlogserver_template.cnf DESTINATION ${MAXSCALE_SHAREDIR})
|
||||||
install(FILES ${ERRMSG} DESTINATION ${MAXSCALE_VARDIR}/lib/maxscale
|
install(FILES ${ERRMSG} DESTINATION ${MAXSCALE_VARDIR}/lib/maxscale
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||||
|
@ -44,33 +44,35 @@
|
|||||||
- [Replication Proxy with the Binlog Router Tutorial](Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md)
|
- [Replication Proxy with the Binlog Router Tutorial](Tutorials/Replication-Proxy-Binlog-Router-Tutorial.md)
|
||||||
- [RabbitMQ Setup and MaxScale Integration Tutorial](Tutorials/RabbitMQ-Setup-And-MaxScale-Integration.md)
|
- [RabbitMQ Setup and MaxScale Integration Tutorial](Tutorials/RabbitMQ-Setup-And-MaxScale-Integration.md)
|
||||||
- [Nagios Plugins for MaxScale Tutorial](Tutorials/Nagios-Plugins.md)
|
- [Nagios Plugins for MaxScale Tutorial](Tutorials/Nagios-Plugins.md)
|
||||||
|
- [Simple Schema Sharding Tutorial](Tutorials/Simple-Sharding-Tutorial.md)
|
||||||
|
|
||||||
## Routers
|
## Routers
|
||||||
|
|
||||||
- [Read Write Split](routers/ReadWriteSplit.md)
|
- [Read Write Split](Routers/ReadWriteSplit.md)
|
||||||
- [Read Connnection Router](routers/ReadConnRoute.md)
|
- [Read Connnection Router](Routers/ReadConnRoute.md)
|
||||||
- [Schemarouter](routers/SchemaRouter.md)
|
- [Schemarouter](Routers/SchemaRouter.md)
|
||||||
|
|
||||||
## Filters
|
## Filters
|
||||||
|
|
||||||
Here are detailed documents about the filters MaxScale offers. They contain configuration guides and example use cases. Before reading these,you should have read the filter tutorial so that you know how they work and how to configure them.
|
Here are detailed documents about the filters MaxScale offers. They contain configuration guides and example use cases. Before reading these,you should have read the filter tutorial so that you know how they work and how to configure them.
|
||||||
|
|
||||||
- [Query Log All](filters/Query-Log-All-Filter.md)
|
- [Query Log All](Filters/Query-Log-All-Filter.md)
|
||||||
- [Regex Filter](filters/Regex-Filter.md)
|
- [Regex Filter](Filters/Regex-Filter.md)
|
||||||
- [Tee Filter](filters/Tee-Filter.md)
|
- [Tee Filter](Filters/Tee-Filter.md)
|
||||||
- [Top N Filter](filters/Top-N-Filter.md)
|
- [Top N Filter](Filters/Top-N-Filter.md)
|
||||||
- [Database Firewall Filter](filters/Database-Firewall-Filter.md)
|
- [Database Firewall Filter](Filters/Database-Firewall-Filter.md)
|
||||||
- [RabbitMQ Filter](filters/RabbitMQ-Filter.md)
|
- [RabbitMQ Filter](Filters/RabbitMQ-Filter.md)
|
||||||
|
- [Named Server Filter](Filters/Named-Server-Filter.md)
|
||||||
|
|
||||||
## Monitors
|
## Monitors
|
||||||
- [MySQL Monitor](monitors/MySQL-Monitor.md)
|
- [MySQL Monitor](Monitors/MySQL-Monitor.md)
|
||||||
- [Galera Monitor](monitors/Galera-Monitor.md)
|
- [Galera Monitor](Monitors/Galera-Monitor.md)
|
||||||
- [Multi-Master Monitor](monitors/MM-Monitor.md)
|
- [Multi-Master Monitor](Monitors/MM-Monitor.md)
|
||||||
- [MySQL Cluster Monitor](monitors/NDB-Cluster-Monitor.md)
|
- [MySQL Cluster Monitor](Monitors/NDB-Cluster-Monitor.md)
|
||||||
|
|
||||||
## Utilities
|
## Utilities
|
||||||
|
|
||||||
- [RabbitMQ Consumer Client](filters/RabbitMQ-Consumer-Client.md)
|
- [RabbitMQ Consumer Client](Filters/RabbitMQ-Consumer-Client.md)
|
||||||
|
|
||||||
## Design Documents
|
## Design Documents
|
||||||
|
|
||||||
|
92
Documentation/Filters/Named-Server-Filter.md
Normal file
92
Documentation/Filters/Named-Server-Filter.md
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
Named Server Filter
|
||||||
|
|
||||||
|
# Overview
|
||||||
|
|
||||||
|
The **namedserverfilter** is a filter module for MaxScale which is able to route queries to servers based on regular expression matches.
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
The configuration block for the Named Server filter requires the minimal filter options in it’s section within the maxscale.cnf file, stored in /etc/maxscale.cnf.
|
||||||
|
|
||||||
|
```
|
||||||
|
[NamedServerFilter]
|
||||||
|
type=filter
|
||||||
|
module=namedserverfilter
|
||||||
|
match=some string
|
||||||
|
server=server2
|
||||||
|
|
||||||
|
[MyService]
|
||||||
|
type=service
|
||||||
|
router=readwritesplit
|
||||||
|
servers=server1,server2
|
||||||
|
user=myuser
|
||||||
|
passwd=mypasswd
|
||||||
|
filters=NamedServerFilter
|
||||||
|
```
|
||||||
|
|
||||||
|
## Filter Options
|
||||||
|
|
||||||
|
The named server filter accepts the options ignorecase or case. These define if the pattern text should take the case of the string it is matching against into consideration or not.
|
||||||
|
|
||||||
|
## Filter Parameters
|
||||||
|
|
||||||
|
The named server filter requires two mandatory parameters to be defined.
|
||||||
|
|
||||||
|
### `match`
|
||||||
|
|
||||||
|
A parameter that can be used to match text in the SQL statement which should be replaced.
|
||||||
|
|
||||||
|
```
|
||||||
|
match=TYPE[ ]*=
|
||||||
|
```
|
||||||
|
|
||||||
|
If the filter option ignorecase is used all regular expressions are evaluated with the option to ignore the case of the text, therefore a match option of select will match both type, TYPE and any form of the word with upper or lowercase characters.
|
||||||
|
|
||||||
|
### `server`
|
||||||
|
|
||||||
|
This is the server where matching queries will be router. The server should be in use by the service which uses this filter.
|
||||||
|
|
||||||
|
```
|
||||||
|
server=server2
|
||||||
|
```
|
||||||
|
|
||||||
|
### `source`
|
||||||
|
|
||||||
|
The optional source parameter defines an address that is used to match against the address from which the client connection to MaxScale originates. Only sessions that originate from this address will have the match and replacement applied to them.
|
||||||
|
|
||||||
|
```
|
||||||
|
source=127.0.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
### `user`
|
||||||
|
|
||||||
|
The optional user parameter defines a user name that is used to match against the user from which the client connection to MaxScale originates. Only sessions that are connected using this username will have the match and replacement applied to them.
|
||||||
|
|
||||||
|
```
|
||||||
|
user=john
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Example 1 - Route queries targeting a specific table to a server
|
||||||
|
|
||||||
|
This will route all queries matching the regular expression ` *from *users` to the server named *server2*. The filter will ignore character case in queries.
|
||||||
|
|
||||||
|
A query like `SELECT * FROM users` would be routed to server2 where as a query like `SELECT * FROM accounts` would be routed according to the normal rules of the router.
|
||||||
|
|
||||||
|
```
|
||||||
|
[NamedServerFilter]
|
||||||
|
type=filter
|
||||||
|
module=namedserverfilter
|
||||||
|
match= *from *users
|
||||||
|
options=ignorecase
|
||||||
|
server=server2
|
||||||
|
|
||||||
|
[MyService]
|
||||||
|
type=service
|
||||||
|
router=readwritesplit
|
||||||
|
servers=server1,server2
|
||||||
|
user=myuser
|
||||||
|
passwd=mypasswd
|
||||||
|
filters=NamedServerFilter
|
||||||
|
```
|
@ -1,4 +1,4 @@
|
|||||||
MaxScale Release Notes
|
# MariaDB MaxScale 0.5 Alpha Release Notes
|
||||||
|
|
||||||
0.5 Alpha
|
0.5 Alpha
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MaxScale Release Notes
|
# MariaDB MaxScale 0.6 Alpha Release Notes
|
||||||
|
|
||||||
0.6 Alpha
|
0.6 Alpha
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MaxScale Release Notes
|
# MariaDB MaxScale 0.7 Alpha Release Notes
|
||||||
|
|
||||||
0.7 Alpha
|
0.7 Alpha
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MaxScale Release Notes
|
# MariaDB MaxScale 1.0 Beta Release Notes
|
||||||
|
|
||||||
1.0 Beta
|
1.0 Beta
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MaxScale Release Notes
|
# MariaDB MaxScale 1.0.1 Beta Release Notes
|
||||||
|
|
||||||
1.0.1 Beta
|
1.0.1 Beta
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MaxScale Release Notes
|
# MariaDB MaxScale 1.0.3 Release Notes
|
||||||
|
|
||||||
1.0.3 GA
|
1.0.3 GA
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# MaxScale Release Notes
|
# MariaDB MaxScale 1.0.4 Release Notes
|
||||||
|
|
||||||
1.0.4 GA
|
1.0.4 GA
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MaxScale Release Notes 1.0.5 GA
|
# MariaDB MaxScale 1.0.5 Release Notes
|
||||||
|
|
||||||
This document details the changes in version 1.0.5 since the release of the 1.0.4 GA of the MaxScale product.
|
This document details the changes in version 1.0.5 since the release of the 1.0.4 GA of the MaxScale product.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# MaxScale Release Notes
|
# MariaDB MaxScale 1.1 Release Notes
|
||||||
|
|
||||||
## 1.1 GA
|
## 1.1 GA
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# MaxScale Release Notes
|
# MariaDB MaxScale 1.1.1 Release Notes
|
||||||
|
|
||||||
## 1.1 GA
|
## 1.1.1 GA
|
||||||
|
|
||||||
This document details the changes in version 1.1.1 since the release of the 1.1 GA Release of the MaxScale product.
|
This document details the changes in version 1.1.1 since the release of the 1.1 GA Release of the MaxScale product.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# MaxScale Release Notes
|
# MariaDB MaxScale 1.2 Release Notes
|
||||||
|
|
||||||
## 1.2 GA
|
## 1.2 GA
|
||||||
|
|
||||||
|
@ -100,6 +100,10 @@ disable_slave_recovery=true
|
|||||||
master_accept_reads=true
|
master_accept_reads=true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Routing hints
|
||||||
|
|
||||||
|
The readwritesplit router supports routing hints. For a detailed guide on hint syntax and functionality, please see [this](../Reference/Hint-Syntax.md) document.
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
In Master-Slave replication cluster also read-only queries are routed to master too in the following situations:
|
In Master-Slave replication cluster also read-only queries are routed to master too in the following situations:
|
@ -64,4 +64,4 @@ The schemarouter router currently has some limitations due to the nature of the
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
[Here](../../Tutorials/Simple-Sharding-Tutorial.md) is a small tutorial on how to set up a sharded database.
|
[Here](../Tutorials/Simple-Sharding-Tutorial.md) is a small tutorial on how to set up a sharded database.
|
@ -5,8 +5,7 @@ set(MAXSCALE_LIBDIR ${CMAKE_INSTALL_LIBDIR}/maxscale CACHE PATH "Library install
|
|||||||
set(MAXSCALE_BINDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Executable installation path")
|
set(MAXSCALE_BINDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Executable installation path")
|
||||||
set(MAXSCALE_SHAREDIR ${CMAKE_INSTALL_DATADIR}/maxscale CACHE PATH "Share file installation path, includes licence and readme files")
|
set(MAXSCALE_SHAREDIR ${CMAKE_INSTALL_DATADIR}/maxscale CACHE PATH "Share file installation path, includes licence and readme files")
|
||||||
set(MAXSCALE_DOCDIR ${CMAKE_INSTALL_DOCDIR}/maxscale CACHE PATH "Documentation installation path, text versions only")
|
set(MAXSCALE_DOCDIR ${CMAKE_INSTALL_DOCDIR}/maxscale CACHE PATH "Documentation installation path, text versions only")
|
||||||
set(MAXSCALE_CONFDIR ${CMAKE_INSTALL_SYSCONFDIR} CACHE PATH "Configuration file installation path, this is not usually needed")
|
|
||||||
|
|
||||||
# This is the only hard-coded absolute path
|
# These are the only hard-coded absolute paths
|
||||||
set(MAXSCALE_VARDIR /var CACHE PATH "Data file path (usually /var/)")
|
set(MAXSCALE_VARDIR /var CACHE PATH "Data file path (usually /var/)")
|
||||||
|
set(MAXSCALE_CONFDIR /etc CACHE PATH "Configuration file installation path (/etc/)")
|
||||||
|
@ -23,6 +23,9 @@ macro(set_variables)
|
|||||||
# Use C99
|
# Use C99
|
||||||
set(USE_C99 FALSE CACHE BOOL "Use C99 standard")
|
set(USE_C99 FALSE CACHE BOOL "Use C99 standard")
|
||||||
|
|
||||||
|
# Install the template maxscale.cnf file
|
||||||
|
set(WITH_MAXSCALE_CNF TRUE CACHE BOOL "Install the template maxscale.cnf file")
|
||||||
|
|
||||||
# hostname or IP address of MaxScale's host
|
# hostname or IP address of MaxScale's host
|
||||||
set(TEST_HOST "127.0.0.1" CACHE STRING "hostname or IP address of MaxScale's host")
|
set(TEST_HOST "127.0.0.1" CACHE STRING "hostname or IP address of MaxScale's host")
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifndef _XOPEN_SOURCE
|
||||||
|
#define _XOPEN_SOURCE 700
|
||||||
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <crypt.h>
|
#include <crypt.h>
|
||||||
#include <users.h>
|
#include <users.h>
|
||||||
|
@ -197,6 +197,7 @@ GWBUF *rval;
|
|||||||
rval->gwbuf_info = buf->gwbuf_info;
|
rval->gwbuf_info = buf->gwbuf_info;
|
||||||
rval->gwbuf_bufobj = buf->gwbuf_bufobj;
|
rval->gwbuf_bufobj = buf->gwbuf_bufobj;
|
||||||
rval->tail = rval;
|
rval->tail = rval;
|
||||||
|
rval->next = NULL;
|
||||||
CHK_GWBUF(rval);
|
CHK_GWBUF(rval);
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,10 @@ module=regexfilter
|
|||||||
match=fetch
|
match=fetch
|
||||||
replace=select
|
replace=select
|
||||||
|
|
||||||
|
[hint]
|
||||||
|
type=filter
|
||||||
|
module=hintfilter
|
||||||
|
|
||||||
|
|
||||||
## A series of service definition
|
## A series of service definition
|
||||||
#
|
#
|
||||||
@ -218,11 +222,21 @@ router=readwritesplit
|
|||||||
servers=server1,server2,server3
|
servers=server1,server2,server3
|
||||||
user=myuser
|
user=myuser
|
||||||
passwd=mypwd
|
passwd=mypwd
|
||||||
#use_sql_variables_in=
|
max_slave_connections=100%
|
||||||
#max_slave_connections=100%
|
#use_sql_variables_in=master
|
||||||
#max_slave_replication_lag=21
|
#max_slave_replication_lag=21
|
||||||
#router_options=slave_selection_criteria=
|
#filters=hint|fetch|qla
|
||||||
#filters=fetch|qla
|
#router_options=slave_selection_criteria=LEAST_CURRENT_OPERATIONS
|
||||||
|
|
||||||
|
# Uncomment this to disable the saving of session modifying comments. Some scripting
|
||||||
|
# languages use connection pooling and will use the same session. MaxScale sees them
|
||||||
|
# as the same session and stores them for the slave recovery process.
|
||||||
|
#router_options=disable_sescmd_history=true,disable_slave_recovery=true
|
||||||
|
|
||||||
|
# This will allow the master server to be used for read queries. By default
|
||||||
|
# MaxScale will only use the master for write queries.
|
||||||
|
#router_options=master_accept_reads=true
|
||||||
|
|
||||||
|
|
||||||
[Debug Interface]
|
[Debug Interface]
|
||||||
type=service
|
type=service
|
||||||
@ -265,27 +279,26 @@ service=Read Connection Router
|
|||||||
protocol=MySQLClient
|
protocol=MySQLClient
|
||||||
address=192.168.100.102
|
address=192.168.100.102
|
||||||
port=4008
|
port=4008
|
||||||
#socket=/tmp/readconn.sock
|
socket=/var/lib/maxscale/readconn.sock
|
||||||
|
|
||||||
[RW Split Listener]
|
[RW Split Listener]
|
||||||
type=listener
|
type=listener
|
||||||
service=RW Split Router
|
service=RW Split Router
|
||||||
protocol=MySQLClient
|
protocol=MySQLClient
|
||||||
port=4006
|
port=4006
|
||||||
#socket=/tmp/rwsplit.sock
|
#socket=/var/lib/maxscale/rwsplit.sock
|
||||||
|
|
||||||
[Debug Listener]
|
[Debug Listener]
|
||||||
type=listener
|
type=listener
|
||||||
service=Debug Interface
|
service=Debug Interface
|
||||||
protocol=telnetd
|
protocol=telnetd
|
||||||
#address=127.0.0.1
|
address=127.0.0.1
|
||||||
port=4442
|
port=4442
|
||||||
|
|
||||||
[CLI Listener]
|
[CLI Listener]
|
||||||
type=listener
|
type=listener
|
||||||
service=CLI
|
service=CLI
|
||||||
protocol=maxscaled
|
protocol=maxscaled
|
||||||
#address=localhost
|
|
||||||
port=6603
|
port=6603
|
||||||
|
|
||||||
## Definition of the servers
|
## Definition of the servers
|
||||||
@ -314,18 +327,18 @@ port=6603
|
|||||||
|
|
||||||
[server1]
|
[server1]
|
||||||
type=server
|
type=server
|
||||||
address=192.168.100.101
|
address=127.0.0.1
|
||||||
port=3000
|
port=3306
|
||||||
protocol=MySQLBackend
|
protocol=MySQLBackend
|
||||||
|
|
||||||
[server2]
|
[server2]
|
||||||
type=server
|
type=server
|
||||||
address=192.168.100.102
|
address=127.0.0.1
|
||||||
port=3000
|
port=3306
|
||||||
protocol=MySQLBackend
|
protocol=MySQLBackend
|
||||||
|
|
||||||
[server3]
|
[server3]
|
||||||
type=server
|
type=server
|
||||||
address=192.168.100.103
|
address=127.0.0.1
|
||||||
port=3000
|
port=3306
|
||||||
protocol=MySQLBackend
|
protocol=MySQLBackend
|
||||||
|
@ -35,7 +35,7 @@ extern __thread log_info_t tls_log_info;
|
|||||||
* that routes to a named server if a regular expression match is found.
|
* that routes to a named server if a regular expression match is found.
|
||||||
* @verbatim
|
* @verbatim
|
||||||
*
|
*
|
||||||
* A simple regular expression query rewrite filter.
|
* A simple regular expression based query routing filter.
|
||||||
* Two parameters should be defined in the filter configuration
|
* Two parameters should be defined in the filter configuration
|
||||||
* match=<regular expression>
|
* match=<regular expression>
|
||||||
* server=<server to route statement to>
|
* server=<server to route statement to>
|
||||||
|
@ -1091,7 +1091,7 @@ gw_backend_hangup(DCB *dcb)
|
|||||||
len = sizeof(error);
|
len = sizeof(error);
|
||||||
if (getsockopt(dcb->fd, SOL_SOCKET, SO_ERROR, &error, (socklen_t *)&len) == 0)
|
if (getsockopt(dcb->fd, SOL_SOCKET, SO_ERROR, &error, (socklen_t *)&len) == 0)
|
||||||
{
|
{
|
||||||
if (error != 0)
|
if (error != 0 && ses_state != SESSION_STATE_STOPPING)
|
||||||
{
|
{
|
||||||
strerror_r(error, buf, 100);
|
strerror_r(error, buf, 100);
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
@ -1105,9 +1105,12 @@ gw_backend_hangup(DCB *dcb)
|
|||||||
goto retblock;
|
goto retblock;
|
||||||
}
|
}
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
if(ses_state != SESSION_STATE_STOPPING)
|
||||||
LOGFILE_ERROR,
|
{
|
||||||
"Backend hangup error handling.")));
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Backend hangup error handling.")));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
router->handleError(router_instance,
|
router->handleError(router_instance,
|
||||||
|
@ -1093,7 +1093,8 @@ int gw_read_client_event(
|
|||||||
case MYSQL_IDLE:
|
case MYSQL_IDLE:
|
||||||
{
|
{
|
||||||
uint8_t* payload = NULL;
|
uint8_t* payload = NULL;
|
||||||
|
session_state_t ses_state;
|
||||||
|
|
||||||
session = dcb->session;
|
session = dcb->session;
|
||||||
ss_dassert(session!= NULL);
|
ss_dassert(session!= NULL);
|
||||||
|
|
||||||
@ -1101,13 +1102,18 @@ int gw_read_client_event(
|
|||||||
{
|
{
|
||||||
CHK_SESSION(session);
|
CHK_SESSION(session);
|
||||||
}
|
}
|
||||||
|
spinlock_acquire(&session->ses_lock);
|
||||||
|
ses_state = session->state;
|
||||||
|
spinlock_release(&session->ses_lock);
|
||||||
/* Now, we are assuming in the first buffer there is
|
/* Now, we are assuming in the first buffer there is
|
||||||
* the information form mysql command */
|
* the information form mysql command */
|
||||||
payload = GWBUF_DATA(read_buffer);
|
payload = GWBUF_DATA(read_buffer);
|
||||||
|
|
||||||
/** Route COM_QUIT to backend */
|
if(ses_state == SESSION_STATE_ROUTER_READY)
|
||||||
if (MYSQL_IS_COM_QUIT(payload))
|
{
|
||||||
{
|
/** Route COM_QUIT to backend */
|
||||||
|
if (MYSQL_IS_COM_QUIT(payload))
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Sends COM_QUIT packets since buffer is already
|
* Sends COM_QUIT packets since buffer is already
|
||||||
* created. A BREF_CLOSED flag is set so dcb_close won't
|
* created. A BREF_CLOSED flag is set so dcb_close won't
|
||||||
@ -1115,79 +1121,87 @@ int gw_read_client_event(
|
|||||||
*/
|
*/
|
||||||
/* Temporarily suppressed: SESSION_ROUTE_QUERY(session, read_buffer); */
|
/* Temporarily suppressed: SESSION_ROUTE_QUERY(session, read_buffer); */
|
||||||
/**
|
/**
|
||||||
* Close router session which causes closing of backends.
|
* Close router session which causes closing of backends.
|
||||||
*/
|
*/
|
||||||
dcb_close(dcb);
|
dcb_close(dcb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/** Reset error handler when routing of the new query begins */
|
/** Reset error handler when routing of the new query begins */
|
||||||
router->handleError(NULL, NULL, NULL, dcb, ERRACT_RESET, NULL);
|
router->handleError(NULL, NULL, NULL, dcb, ERRACT_RESET, NULL);
|
||||||
|
|
||||||
if (stmt_input)
|
if (stmt_input)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Feed each statement completely and separately
|
* Feed each statement completely and separately
|
||||||
* to router.
|
* to router.
|
||||||
*/
|
*/
|
||||||
rc = route_by_statement(session, &read_buffer);
|
rc = route_by_statement(session, &read_buffer);
|
||||||
|
|
||||||
if (read_buffer != NULL)
|
if (read_buffer != NULL)
|
||||||
{
|
{
|
||||||
/** add incomplete mysql packet to read queue */
|
/** add incomplete mysql packet to read queue */
|
||||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/** Feed whole packet to router */
|
/** Feed whole packet to router */
|
||||||
rc = SESSION_ROUTE_QUERY(session, read_buffer);
|
rc = SESSION_ROUTE_QUERY(session, read_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Routing succeed */
|
/** Routing succeed */
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
rc = 0; /**< here '0' means success */
|
rc = 0; /**< here '0' means success */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool succp;
|
bool succp;
|
||||||
GWBUF* errbuf;
|
GWBUF* errbuf;
|
||||||
/**
|
/**
|
||||||
* Create error to be sent to client if session
|
* Create error to be sent to client if session
|
||||||
* can't be continued.
|
* can't be continued.
|
||||||
*/
|
*/
|
||||||
errbuf = mysql_create_custom_error(
|
errbuf = mysql_create_custom_error(
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
"Routing failed. Session is closed.");
|
"Routing failed. Session is closed.");
|
||||||
/**
|
/**
|
||||||
* Ensure that there are enough backends
|
* Ensure that there are enough backends
|
||||||
* available.
|
* available.
|
||||||
*/
|
*/
|
||||||
router->handleError(
|
router->handleError(
|
||||||
router_instance,
|
router_instance,
|
||||||
session->router_session,
|
session->router_session,
|
||||||
errbuf,
|
errbuf,
|
||||||
dcb,
|
dcb,
|
||||||
ERRACT_NEW_CONNECTION,
|
ERRACT_NEW_CONNECTION,
|
||||||
&succp);
|
&succp);
|
||||||
gwbuf_free(errbuf);
|
gwbuf_free(errbuf);
|
||||||
/**
|
/**
|
||||||
* If there are not enough backends close
|
* If there are not enough backends close
|
||||||
* session
|
* session
|
||||||
*/
|
*/
|
||||||
if (!succp)
|
if (!succp)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Routing the query failed. "
|
"Error : Routing the query failed. "
|
||||||
"Session will be closed.")));
|
"Session will be closed.")));
|
||||||
|
|
||||||
dcb_close(dcb);
|
dcb_close(dcb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skygw_log_write_flush(LT,"Session received a query in state %s",
|
||||||
|
STRSESSIONSTATE(ses_state));
|
||||||
|
while((read_buffer = GWBUF_CONSUME_ALL(read_buffer)) != NULL);
|
||||||
|
goto return_rc;
|
||||||
|
}
|
||||||
goto return_rc;
|
goto return_rc;
|
||||||
} /* MYSQL_IDLE */
|
} /* MYSQL_IDLE */
|
||||||
break;
|
break;
|
||||||
|
@ -723,16 +723,10 @@ routeQuery(ROUTER *instance, void *router_session, GWBUF *queue)
|
|||||||
SERVER_IS_DOWN(router_cli_ses->backend->server))
|
SERVER_IS_DOWN(router_cli_ses->backend->server))
|
||||||
{
|
{
|
||||||
LOGIF(LT, (skygw_log_write(
|
LOGIF(LT, (skygw_log_write(
|
||||||
LOGFILE_TRACE,
|
LOGFILE_TRACE|LOGFILE_ERROR,
|
||||||
"Error : Failed to route MySQL command %d to backend "
|
"Error : Failed to route MySQL command %d to backend "
|
||||||
"server.",
|
"server.%s",
|
||||||
mysql_command)));
|
mysql_command,rses_is_closed ? " Session is closed." : "")));
|
||||||
skygw_log_write(
|
|
||||||
LOGFILE_ERROR,
|
|
||||||
"Error : Failed to route MySQL command %d to backend "
|
|
||||||
"server %s.",
|
|
||||||
mysql_command,
|
|
||||||
router_cli_ses->backend->server->unique_name);
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto return_rc;
|
goto return_rc;
|
||||||
|
|
||||||
|
@ -3913,7 +3913,7 @@ static GWBUF* sescmd_cursor_clone_querybuf(
|
|||||||
}
|
}
|
||||||
ss_dassert(scur->scmd_cur_cmd != NULL);
|
ss_dassert(scur->scmd_cur_cmd != NULL);
|
||||||
|
|
||||||
buf = gwbuf_clone(scur->scmd_cur_cmd->my_sescmd_buf);
|
buf = gwbuf_clone_all(scur->scmd_cur_cmd->my_sescmd_buf);
|
||||||
|
|
||||||
CHK_GWBUF(buf);
|
CHK_GWBUF(buf);
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -1701,7 +1701,7 @@ routeQuery(ROUTER* instance,
|
|||||||
querybuf)))
|
querybuf)))
|
||||||
{
|
{
|
||||||
extract_database(querybuf,db);
|
extract_database(querybuf,db);
|
||||||
snprintf(errbuf,"Unknown database: %s",db);
|
snprintf(errbuf,25+MYSQL_DATABASE_MAXLEN,"Unknown database: %s",db);
|
||||||
create_error_reply(errbuf,router_cli_ses->replydcb);
|
create_error_reply(errbuf,router_cli_ses->replydcb);
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
|
Reference in New Issue
Block a user