[MXS-4633] Error 4042 using config_sync Created: 2023-06-06  Updated: 2023-06-26  Resolved: 2023-06-26

Status: Closed
Project: MariaDB MaxScale
Component/s: N/A
Affects Version/s: 6.4.7, 22.08.6, 23.02.1
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Maria M Pflaum Assignee: markus makela
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Ubuntu Linux



 Description   

Customer has configured a pair of maxscale instances using `config_sync`. They are `maxscale-blue` and `maxscale-green` using the following steps:

  • `systemctl stop maxscale` on `blue`
  • `rm /var/lib/maxscale/*.json` to make sure the only config it will load is what is in the config files (both hosts have `persist_runtime_changes` and `load_persistend_configs` set to FALSE)
  • `systemctl start maxscale` on `blue`
  • Set one of the nodes to maintenance mode to trigger a config change and verify a new config is written to the database
  • `systemctl stop maxscale` on `green`
  • Update `/etc/maxscale.cnf` to be identical to what is configured on `blue` and similarly run `rm /var/lib/maxscale/*.json`
  • `systemctl start maxscale` on `green`

Looking at the logs on `green`, the following warning is logged approximately every 5 seconds:
warning: (ConfigManager); Failed to update node state to 'OK' for hostname 'maxscale-green': Query 'UPDATE maxscale_config SET nodes = JSON_SET(nodes, CONCAT('$.', JSON_QUOTE('maxscale-green')), 'OK') WHERE version = 1 AND cluster = 'mariadb-monitor'' failed. Error 4042: Syntax error in JSON path in argument 2 to function 'json_set' at position 12.

The hostname is "maxscale-green".
Here are the config_sync parameters:
config_sync_cluster=mariadb-monitor
config_sync_db=db_admin
config_sync_user=maxscale
config_sync_password=REDACTED

Running `SELECT VERSION();` on the backend DB shows "MariaDB 10.11.1-MariaDB-1:10.11.1+maria~ubu2004-log".

The Maxscale user's grants are as follows:
GRANT SELECT, INSERT, UPDATE, CREATE ON `db_admin`.`maxscale_config` TO `maxscale`@`%`;

No errors found in the logs for `blue`. Both hosts are successfully handle client SQL queries.



 Comments   
Comment by markus makela [ 2023-06-06 ]

I tested it locally by creating an identical table and oddly enough it seems to work:

MariaDB [test]> CREATE OR REPLACE TABLE maxscale_config (cluster VARCHAR(256) PRIMARY KEY, version BIGINT NOT NULL, config JSON NOT NULL, origin VARCHAR(254) NOT NULL, nodes JSON NOT NULL) ENGINE=InnoDB;
Query OK, 0 rows affected (0.002 sec)
 
MariaDB [test]> INSERT INTO maxscale_config VALUES ('mariadb-monitor', 1, '{}', 'maxscale-blue', '{"maxscale-blue": "OK", "blah": "OK"}');
Query OK, 1 row affected (0.001 sec)
 
MariaDB [test]> UPDATE maxscale_config SET nodes= JSON_SET(nodes, CONCAT('$.', '"maxscale"'), 'OK');
Query OK, 1 row affected (0.000 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
MariaDB [test]> SELECT nodes FROM maxscale_config;
+---------------------------------------------------------+
| nodes                                                   |
+---------------------------------------------------------+
| {"maxscale-blue": "OK", "blah": "OK", "maxscale": "OK"} |
+---------------------------------------------------------+
1 row in set (0.000 sec)
 
MariaDB [test]> UPDATE maxscale_config SET nodes= JSON_SET(nodes, CONCAT('$.', '"maxscalegreen"'), 'OK');
Query OK, 1 row affected (0.000 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
MariaDB [test]> UPDATE maxscale_config SET nodes= JSON_SET(nodes, CONCAT('$.', '"maxscale-green"'), 'OK');
Query OK, 1 row affected (0.000 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
MariaDB [test]> UPDATE maxscale_config SET nodes= JSON_SET(nodes, CONCAT('$.', JSON_QUOTE('nodashes')), 'OK');
Query OK, 1 row affected (0.000 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
MariaDB [test]> UPDATE maxscale_config SET nodes= JSON_SET(nodes, CONCAT('$.', JSON_QUOTE('i-cannot-believe-it-has-dashes')), 'OK');
Query OK, 1 row affected (0.000 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
MariaDB [test]> SELECT nodes FROM maxscale_config;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| nodes                                                                                                                                                            |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| {"maxscale-blue": "OK", "blah": "OK", "maxscale": "OK", "maxscalegreen": "OK", "maxscale-green": "OK", "nodashes": "OK", "i-cannot-believe-it-has-dashes": "OK"} |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
 
MariaDB [test]> SELECT @@version, @@version_comment;
+---------------------------------------------+---------------------------------+
| @@version                                   | @@version_comment               |
+---------------------------------------------+---------------------------------+
| 10.11.3-MariaDB-1:10.11.3+maria~ubu2204-log | mariadb.org binary distribution |
+---------------------------------------------+---------------------------------+
1 row in set (0.000 sec)

Comment by markus makela [ 2023-06-06 ]

Could it be the fact that 10.11.1 was a beta release? If possible, testing with a newer version would be good.

Comment by markus makela [ 2023-06-26 ]

Does not appear to happen with MariaDB 10.11.3, seems like it was fixed there.

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