[MXS-1418] remove server does not drain node Created: 2017-09-15  Updated: 2018-02-20  Resolved: 2017-09-18

Status: Closed
Project: MariaDB MaxScale
Component/s: readconnroute, readwritesplit
Affects Version/s: 2.1.7
Fix Version/s: 2.1.8

Type: Bug Priority: Major
Reporter: Oli Sennhauser Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None
Environment:

linux ubntu 14.04 n.a.



 Description   

MaxScale> list services
Services.
--------------------------------------------------------------------------------
Service Name | Router Module | #Users | Total Sessions | Backend databases
--------------------------------------------------------------------------------
MarGal101 | readconnroute | 2 | 35 | nodeA, nodeB, nodeC
MaxAdmin Service | cli | 2 | 2 |
--------------------------------------------------------------------------------

MaxScale> remove server nodeA MarGal101
Removed server 'nodeA' from 'MarGal101'
MaxScale> list services
Services.
--------------------------------------------------------------------------------
Service Name | Router Module | #Users | Total Sessions | Backend databases
--------------------------------------------------------------------------------
MarGal101 | readconnroute | 2 | 35 | nodeB, nodeC
MaxAdmin Service | cli | 2 | 2 |
--------------------------------------------------------------------------------

root@mariadb-10.2 [(none)] SQL> SELECT @@hostname, @@wsrep_node_name;
-----------------------------+

@@hostname @@wsrep_node_name

-----------------------------+

chef Node A

-----------------------------+
1 row in set (0.00 sec)

root@mariadb-10.2 [(none)] SQL> SELECT @@hostname, @@wsrep_node_name;
ERROR 2003 (HY000): Routing failed. Session is closed.
root@mariadb-10.2 [(none)] SQL> SELECT @@hostname, @@wsrep_node_name;
ERROR 2013 (HY000): Lost connection to MySQL server during query
root@mariadb-10.2 [(none)] SQL> SELECT @@hostname, @@wsrep_node_name;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 24163
Current database: *** NONE ***

-----------------------------+

@@hostname @@wsrep_node_name

-----------------------------+

chef Node B

-----------------------------+
1 row in set (0.00 sec)



 Comments   
Comment by Oli Sennhauser [ 2017-09-15 ]

cat maxscale.cnf
[maxscale]
threads=auto

[nodeA]
type=server
address=127.0.0.1
port=3330
protocol=MySQLBackend
monitoruser=maxscale
monitorpw=maxscale

[nodeB]
type=server
address=127.0.0.1
port=3331
protocol=MySQLBackend
monitoruser=maxscale
monitorpw=maxscale

[nodeC]
type=server
address=127.0.0.1
port=3332
protocol=MySQLBackend
monitoruser=maxscale
monitorpw=maxscale

[MySQL Monitor]
type=monitor
module=galeramon
servers=nodeA,nodeB,nodeC
user=maxscale
passwd=maxscale
monitor_interval=10000

[ProductsSelectLogger]
type=filter
module=qlafilter
filebase=/tmp/SelectProducts

[MarGal101]
type=service
router=readconnroute
router_options=synced
servers=nodeA,nodeB,nodeC
user=maxscale
passwd=maxscale
enable_root_user=1

[MaxAdmin Service]
type=service
router=cli

[MarGal101 Listener]
type=listener
service=MarGal101
protocol=MySQLClient
port=3306

[MaxAdmin Listener]
type=listener
service=MaxAdmin Service
protocol=maxscaled
port=3333

Comment by Oli Sennhauser [ 2017-09-15 ]

MariaDB MaxScale /tmp/maxscale.log Fri Sep 15 11:23:55 2017
---------------------------------------------------------------
2017-09-15 11:23:55 notice : Working directory: /tmp
2017-09-15 11:23:55 notice : MariaDB MaxScale 2.1.7 started
2017-09-15 11:23:55 notice : MaxScale is running in process 24146
2017-09-15 11:23:55 notice : Configuration file: /home/mysql/etc/maxscale.cnf
2017-09-15 11:23:55 notice : Log directory: /tmp
2017-09-15 11:23:55 notice : Data directory: /tmp
2017-09-15 11:23:55 notice : Module directory: /usr/lib/x86_64-linux-gnu/maxscale
2017-09-15 11:23:55 notice : Service cache: /tmp
2017-09-15 11:23:55 notice : Loading /home/mysql/etc/maxscale.cnf.
2017-09-15 11:23:55 notice : /home/mysql/etc/maxscale.cnf.d does not exist, not reading.
2017-09-15 11:23:55 notice : [cli] Initialise CLI router module
2017-09-15 11:23:55 notice : Loaded module cli: V1.0.0 from /usr/lib/x86_64-linux-gnu/maxscale/libcli.so
2017-09-15 11:23:55 notice : [readconnroute] Initialise readconnroute router module.
2017-09-15 11:23:55 notice : Loaded module readconnroute: V1.1.0 from /usr/lib/x86_64-linux-gnu/maxscale/libreadconnroute.so
2017-09-15 11:23:55 notice : Loaded module qlafilter: V1.1.1 from /usr/lib/x86_64-linux-gnu/maxscale/libqlafilter.so
2017-09-15 11:23:55 notice : [galeramon] Initialise the MySQL Galera Monitor module.
2017-09-15 11:23:55 notice : Loaded module galeramon: V2.0.0 from /usr/lib/x86_64-linux-gnu/maxscale/libgaleramon.so
2017-09-15 11:23:55 notice : Loaded module MySQLBackend: V2.0.0 from /usr/lib/x86_64-linux-gnu/maxscale/libMySQLBackend.so
2017-09-15 11:23:55 notice : Loaded module MySQLBackendAuth: V1.0.0 from /usr/lib/x86_64-linux-gnu/maxscale/libMySQLBackendAuth.so
2017-09-15 11:23:55 notice : Loaded module maxscaled: V2.0.0 from /usr/lib/x86_64-linux-gnu/maxscale/libmaxscaled.so
2017-09-15 11:23:55 notice : Loaded module MaxAdminAuth: V2.1.0 from /usr/lib/x86_64-linux-gnu/maxscale/libMaxAdminAuth.so
2017-09-15 11:23:55 notice : Loaded module MySQLClient: V1.1.0 from /usr/lib/x86_64-linux-gnu/maxscale/libMySQLClient.so
2017-09-15 11:23:55 notice : Loaded module MySQLAuth: V1.1.0 from /usr/lib/x86_64-linux-gnu/maxscale/libMySQLAuth.so
2017-09-15 11:23:55 notice : No query classifier specified, using default 'qc_sqlite'.
2017-09-15 11:23:55 notice : Loaded module qc_sqlite: V1.0.0 from /usr/lib/x86_64-linux-gnu/maxscale/libqc_sqlite.so
2017-09-15 11:23:55 notice : Encrypted password file /tmp/.secrets can't be accessed (No such file or directory). Password encryption is not used.
2017-09-15 11:23:55 notice : [MySQLAuth] [MarGal101] Loaded 6 MySQL users for listener MarGal101 Listener.
2017-09-15 11:23:55 notice : Listening for connections at [::]:3306 with protocol MySQL
2017-09-15 11:23:55 notice : Listening for connections at [::]:3333 with protocol MaxScale Admin
2017-09-15 11:23:55 notice : Started MaxScale log flusher.
2017-09-15 11:23:55 notice : MaxScale started with 3 server threads.
2017-09-15 11:23:55 notice : Server changed state: nodeA[127.0.0.1:3330]: new_slave. [Running] -> [Slave, Synced, Running]
2017-09-15 11:23:55 notice : Server changed state: nodeB[127.0.0.1:3331]: new_master. [Running] -> [Master, Synced, Running]
2017-09-15 11:23:55 notice : Server changed state: nodeC[127.0.0.1:3332]: new_slave. [Running] -> [Slave, Synced, Running]
2017-09-15 11:25:19 notice : (14) Removed server 'nodeB' from service 'MarGal101'
2017-09-15 11:25:42 notice : (14) Added server 'nodeB' to service 'MarGal101'
2017-09-15 11:27:01 notice : (14) Removed server 'nodeA' from service 'MarGal101'
2017-09-15 11:27:08 error : (37) [readconnroute] Failed to route MySQL command 3 to backend server. Server 'nodeA' was removed from the service.
2017-09-15 11:27:08 error : (37) [MySQLClient] Routing the query failed. Session will be closed.
2017-09-15 11:30:08 notice : (14) Added server 'nodeA' to service 'MarGal101'
2017-09-15 11:32:46 notice : Finished MaxScale log flusher.
2017-09-15 11:32:46 notice : Waiting for housekeeper to shut down.
2017-09-15 11:32:47 notice : Housekeeper shutting down.
2017-09-15 11:32:47 notice : Housekeeper has shut down.
2017-09-15 11:32:47 notice : MaxScale is shutting down.
2017-09-15 11:32:47 notice : MaxScale shutdown completed.
2017-09-15 11:32:47 MariaDB MaxScale is shut down.
----------------------------------------------------

Comment by markus makela [ 2017-09-16 ]

The code checks for each query that the server is in the service. The removal of a server should only affect new sessions that connect to the service.

Generated at Thu Feb 08 04:06:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.