[MXS-3657] CCR Filter ignores PCRE2 option ignorecase Created: 2021-07-02  Updated: 2021-08-23  Resolved: 2021-08-19

Status: Closed
Project: MariaDB MaxScale
Component/s: ccrfilter, Core
Affects Version/s: 2.5.6
Fix Version/s: 2.5.16

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

CentOS 7.7.1908


Sprint: MXS-SPRINT-138

 Description   

Config:

[CCRf]
type=filter
module=ccrfilter
time=15
options=ignorecase
match=/.*INSERT.*/
 
[Read-Write-Service]
type=service
router=readwritesplit
servers=server1,server2,server3
user=max
password=max
filters=CCRf
master_accept_reads=true
max_sescmd_history=1500
prune_sescmd_history=true
delayed_retry=true
delayed_retry_timeout=1

Servers:

┌─────────┬────────────┬──────┬─────────────┬─────────────────┬───────────────────────┐
│ Server  │ Address    │ Port │ Connections │ State           │ GTID                  │
├─────────┼────────────┼──────┼─────────────┼─────────────────┼───────────────────────┤
│ server1 │ 10.0.0.125 │ 3306 │ 0           │ Master, Running │ 125-125-161           │
├─────────┼────────────┼──────┼─────────────┼─────────────────┼───────────────────────┤
│ server2 │ 10.0.0.131 │ 3306 │ 0           │ Slave, Running  │ 125-125-161           │
├─────────┼────────────┼──────┼─────────────┼─────────────────┼───────────────────────┤
│ server3 │ 10.0.0.124 │ 3306 │ 0           │ Slave, Running  │ 124-124-4,125-125-161 │
└─────────┴────────────┴──────┴─────────────┴─────────────────┴───────────────────────┘

Filter:

┌────────────┬──────────────────────────────┐
│ Filter     │ CCRf                         │
├────────────┼──────────────────────────────┤
│ Module     │ ccrfilter                    │
├────────────┼──────────────────────────────┤
│ Services   │ Read-Write-Service           │
├────────────┼──────────────────────────────┤
│ Parameters │ {                            │
│            │     "count": 0,              │
│            │     "global": false,         │
│            │     "ignore": "",            │
│            │     "match": ".*INSERT.*",   │
│            │     "options": "ignorecase", │
│            │     "time": 15               │
│            │ }                            │
└────────────┴──────────────────────────────┘

Results:

~# mysql -h 10.0.0.87 -u max -pmax -e "insert into test.simple( val, blah) values( $RANDOM, '$(hostname)'); select now(), @@hostname; select sleep(10); select now(), @@hostname; select sleep(10); select now(), @@hostname;"
+---------------------+-----------------------------------------+
| now()               | @@hostname                              |
+---------------------+-----------------------------------------+
| 2021-07-01 23:38:04 | MariaDB-10-5-8-Maxscale-2-5-6-C77-S-131 |
+---------------------+-----------------------------------------+
+-----------+
| sleep(10) |
+-----------+
|         0 |
+-----------+
+---------------------+-----------------------------------------+
| now()               | @@hostname                              |
+---------------------+-----------------------------------------+
| 2021-07-01 23:38:14 | MariaDB-10-5-8-Maxscale-2-5-6-C77-S-125 |
+---------------------+-----------------------------------------+
+-----------+
| sleep(10) |
+-----------+
|         0 |
+-----------+
+---------------------+-----------------------------------------+
| now()               | @@hostname                              |
+---------------------+-----------------------------------------+
| 2021-07-01 23:38:24 | MariaDB-10-5-8-Maxscale-2-5-6-C77-S-124 |
+---------------------+-----------------------------------------+
~# mysql -h 10.0.0.87 -u max -pmax -e "INSERT into test.simple( val, blah) values( $RANDOM, '$(hostname)'); select now(), @@hostname; select sleep(10); select now(), @@hostname; select sleep(10); select now(), @@hostname;"
+---------------------+-----------------------------------------+
| now()               | @@hostname                              |
+---------------------+-----------------------------------------+
| 2021-07-01 23:38:44 | MariaDB-10-5-8-Maxscale-2-5-6-C77-S-125 |
+---------------------+-----------------------------------------+
+-----------+
| sleep(10) |
+-----------+
|         0 |
+-----------+
+---------------------+-----------------------------------------+
| now()               | @@hostname                              |
+---------------------+-----------------------------------------+
| 2021-07-01 23:38:54 | MariaDB-10-5-8-Maxscale-2-5-6-C77-S-125 |
+---------------------+-----------------------------------------+
+-----------+
| sleep(10) |
+-----------+
|         0 |
+-----------+
+---------------------+-----------------------------------------+
| now()               | @@hostname                              |
+---------------------+-----------------------------------------+
| 2021-07-01 23:39:04 | MariaDB-10-5-8-Maxscale-2-5-6-C77-S-131 |
+---------------------+-----------------------------------------+



 Comments   
Comment by markus makela [ 2021-07-28 ]

Does the behavior change if you use the following as the pattern?

match=/(?i).*INSERT.*/

If this works but the configuration parameter doesn't then the problem is probably somewhere in the regex compilation. If this doesn't work then the problem might be somewhere else.

Comment by markus makela [ 2021-08-18 ]

Looks like the options parameter isn't working correctly. A workaround is to use the in-pattern options as was mentioned earlier.

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