[MXS-448] Better handling of queries in the binlog router Created: 2015-11-04  Updated: 2019-09-04  Resolved: 2019-09-04

Status: Closed
Project: MariaDB MaxScale
Component/s: binlogrouter
Affects Version/s: 1.2.1
Fix Version/s: N/A

Type: New Feature Priority: Minor
Reporter: Simon J Mudd Assignee: Todd Stoffel (Inactive)
Resolution: Won't Do Votes: 2
Labels: None

Issue Links:
Relates
relates to MXS-584 binlog_router disconnects client afte... Closed

 Description   

This is a general comment and a known issue of the current code but I think it's worth making the issue more visible as it may cause some confusion.

A colleague recently issued this query to a binlog server:

mysql> select @@server_uuid, @@server_id, @@global.hostname;
+--------------------------------------+
| @@server_uuid                        |
+--------------------------------------+
| 6800aaaa-0869-1aa5-8550-1458aaaaeed0 |
+--------------------------------------+

The result as you see gives a single column resultset whereas the query requested 3 columns of data. The parsing of the statements by the binlog router is rather basic at the moment. It would be good if this could be more complete, and at least in the case above, if the query does not match what the binlog router understands it should probably give an error rather than partially respond with an answer as that may confuse the client (in this case orchestrator).

So please consider improving the parsing of the statements and reporting any issues appropriately.

Note: the BLR is not a RDBMS so it's not expected that it can understand all SQL commands. All that we want is that it is able to parse enough commands to be able to provide the right responses to a slave and also some status output needed for monitoring or some commands needed to manage the BLR's state.



 Comments   
Comment by Adam Szkoda [ 2017-01-26 ]

Coming here from https://groups.google.com/forum/#!topic/maxscale/P1tSEfi8eIk .

One more reason why it would be desirable to extend the SQL parser is to support using binlog router along with Maxwell (a binlog to JSON to Kafka adapter, in a nutshell). It (more specifically, its dependency, mysql-connector-j ) expects MaxScale to handle a query for retrieving server variables:

SELECT  @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout;

and it currently (MaxScale 2.0.3) fails with:

2017-01-24 12:09:24   error  : Unexpected query from 'repluser'@'172.17.0.1': /* mysql-connector-java-5.1.39 ( Revision: 3289a357af6d09ecc1a10fd3c26e95183e5790ad ) */SELECT  @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout
2017-01-24 12:09:24   notice : Binlog_Service: Slave 172.17.0.1, server id 0, disconnected after 0 seconds. 1 SQL commands

because MaxScale does not know about these variables.

Comment by Todd Stoffel (Inactive) [ 2019-09-04 ]

Will be eliminated by newer binlog utility.

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