[MXS-1866] Prepared statements do not work Created: 2018-05-11 Updated: 2018-05-18 Resolved: 2018-05-18 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | readconnroute |
| Affects Version/s: | 2.2.5 |
| Fix Version/s: | 2.2.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Bob Sauvage | Assignee: | markus makela |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
RHEL 7 |
||
| Attachments: |
|
| Sprint: | MXS-SPRINT-58 |
| Description |
|
Hi there, I'm in simple setup. Two hosts: one master, one slave. All requests (W/R) are forwarded to the master. Here is my config:
When executing a batch of prepared statements from my application, I encounter a JAVA Exception. You will find the Exception as an attachment. |
| Comments |
| Comment by Bob Sauvage [ 2018-05-11 ] |
|
I've activated all logs in MaxScale. I cannot see the prepared statement. I've activate the general_log in MariaDB, I see the prepared statement: Prepare insert into JBPM_BYTEBLOCK (PROCESSFILE_, INDEX_, BYTES_) values (?, ?, ?) I've activated slow log on MariaDB (>0), I don't see the request with the parameters... While I see it when by passing MaxScale... |
| Comment by markus makela [ 2018-05-12 ] |
|
Possibly a problem with batch execution of statements. Adding useBatchMultiSend=false to the connection string would verify this. |
| Comment by Bob Sauvage [ 2018-05-12 ] |
|
@markus makela Thanks for your quick reply I've added the option like this in the configuration of my datasource in JBoss: <connection-url>jdbc:mariadb://127.0.0.1:3306/MyDB?useBatchMultiSend=false</connection-url> but it is not working better :/ I'm surprized that the option does not appear in the boot.log. Normal ? Thanks, Bob |
| Comment by markus makela [ 2018-05-15 ] |
|
If you add version_string=10.1.30-fake-version to the service, does it fix it? The likely cause is the fact that MaxScale 2.2 does not treat the COM_STMT_BULK_EXECUTE correctly. |
| Comment by Bob Sauvage [ 2018-05-15 ] |
|
@Markus Makela Have I to add it to maxscale.cnf ? [maxscale] If yes, the error continues to appear: ERROR hibernate flush failed: org.hibernate.exception.JDBCConnectionException: Could not execute JDBC batch update Have I to test another version of Maxscale ? |
| Comment by Bob Sauvage [ 2018-05-15 ] |
|
Markus, It's working, thanks a lot ! The parameter was to add in the service section. Do you know if I risk to encounter other issues during failover due to this "bug" ? In order to remove this parameter safely, have I to wait a new release of MaxScale ? Again, thanks for your support. |
| Comment by markus makela [ 2018-05-15 ] |
|
The new style of bulk insert/update added for the 10.2.7 release of MariaDB is not currently supported by MaxScale (it doesn't treat it as a prepared statement command). Using a version string of an older release guarantees that the connector (if it's smart enough) won't use this new command. The connector can also be configured to not use this command by adding useBulkStmts=false but this has to be done on all clients that use MaxScale. Given that this appears to be a relatively simple bug to fix so I would assume it'll be a part of either the next 2.2 release or the one after that. MaxScale versions prior to 2.2 should work with this as they don't load balance prepared statements and hence don't really care about "unknown" commands (they are treated as if they were writes →they are routed to the master). |
| Comment by Bob Sauvage [ 2018-05-16 ] |
|
Thanks a lot for your complete answer and the time you took to explain me the issue and the future actions.
|