[MXS-3404] maxscale write in the slave with function Created: 2021-02-11  Updated: 2021-04-19  Resolved: 2021-03-01

Status: Closed
Project: MariaDB MaxScale
Component/s: qc_sqlite
Affects Version/s: 2.4.13, 2.4.16
Fix Version/s: 2.4.17, 2.5.9

Type: Bug Priority: Critical
Reporter: Massimo Assignee: Johan Wikman
Resolution: Fixed Votes: 1
Labels: None
Environment:

maxscale + primary/secondary


Sprint: MXS-SPRINT-125

 Description   

There is a call function that make write, and the write and up to the slave and not to the master.

The user of LEADING is the route reason.



 Comments   
Comment by Massimo [ 2021-02-11 ]

Topology:

maxscale
1 master
1 slave

Function:

DELIMITER $$
CREATE FUNCTION rdba_test() RETURNS int(11)
BEGIN
DECLARE sID INT;
SELECT @@server_id INTO sID ;
RETURN sID;
END$$
DELIMITER ;

sending the query:
SELECT rdba_test() AS crmid, trim(LEADING 0 FROM @@server_id);

is going to send on the slave. with a presence of a function that make WRITE as it happen on the customer, it write on the slave and break consistency and replication .

Configuration of maxscale:

[maxscale]
auth_connect_timeout=3
auth_read_timeout=1
auth_write_timeout=2
admin_auth=true
passive=0
admin_log_auth_failures=true
query_classifier_cache_size=591866265
writeq_high_water=0
writeq_low_water=0
ms_timestamp=false
skip_permission_checks=false
query_retries=1
query_retry_timeout=5
retain_last_statements=0
dump_last_statements=never
max_auth_errors_until_block=10
session_trace=0

[cluster-monitor]
type=monitor
module=mariadbmon
user=maxmon
password=maxmon
servers=node02,node01
monitor_interval=1000
backend_connect_timeout=3
backend_read_timeout=1
backend_write_timeout=2
backend_connect_attempts=1
journal_max_age=10
disk_space_check_interval=0
script_timeout=90
events=all
detect_stale_master=true
detect_stale_slave=true
detect_standalone_master=true
failcount=3
ignore_external_masters=false
auto_failover=true
failover_timeout=90
switchover_timeout=90
replication_user=repl
replication_password=repl
replication_master_ssl=false
verify_master_failure=true
master_failure_timeout=10
auto_rejoin=true
enforce_read_only_slaves=true
switchover_on_low_disk_space=false
maintenance_on_low_disk_space=true
handle_events=true
assume_unique_hostnames=true
enforce_simple_topology=false

[rwsplit-service]
type=service
router=readwritesplit
user=maxusr
password=maxusr
servers=node02,node01
transaction_replay=true
transaction_replay_max_size=2M
master_failure_mode=fail_on_write
master_reconnection=true
max_sescmd_history=1000
prune_sescmd_history=true
use_sql_variables_in=master

[rwsplit-listener]
type=listener
protocol=mariadbclient
service=rwsplit-service
address=0.0.0.0
port=3306
authenticator=MySQLAuth

[node01]
type=server
port=3306
extra_port=0
persistpoolmax=0
persistmaxtime=0
proxy_protocol=false
ssl=false
ssl_version=MAX
ssl_cert_verify_depth=9
ssl_verify_peer_certificate=true
protocol=mariadbbackend
address=192.168.54.10

[node02]
type=server
port=3306
extra_port=0
persistpoolmax=0
persistmaxtime=0
proxy_protocol=false
ssl=false
ssl_version=MAX
ssl_cert_verify_depth=9
ssl_verify_peer_certificate=true
protocol=mariadbbackend
address=192.168.54.11

MariaDB Enterprise Version 10.4.17-10-MariaDB-enterprise-log , OS:
CentOS Linux release 7.3.1611 (Core)
Derived from Red Hat Enterprise Linux 7.3 (Source)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.3.1611 (Core)
CentOS Linux release 7.3.1611 (Core)
cpe:/o:centos:centos:7

Comment by Johan Wikman [ 2021-02-15 ]

massimo.disaro What is

trim(LEADING 0 FROM @@server_id);

expected to do? According to the documentation LEADING should be followed by a string. A number is accepted by MariaDB but I can't figure out its effect?

Comment by Johan Wikman [ 2021-02-15 ]

Ok, a number seems to be converted into a string of that number. That is, 0 is intepreted as '0'.

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