[MXS-1203]  Batch inserts through Maxscale with C/J stall Created: 2017-03-28  Updated: 2020-08-25  Resolved: 2017-04-24

Status: Closed
Project: MariaDB MaxScale
Component/s: Core, mariadbbackend, readwritesplit
Affects Version/s: 2.0.3, 2.0.4, 2.1.1
Fix Version/s: 2.2.0

Type: Bug Priority: Major
Reporter: Kyle Joiner (Inactive) Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MXS-1245 Support statement pipelining Closed
Sprint: 2017-31, 2017-32

 Description   

User had reported this issue in MXS-1047 against 2.0.2 - They are still seeing it in 2.0.3, 2.0.4 and 2.1.1

getting period EOF errors when executing select

1.5.5 driver
2.1.1 max scale
10.1.19-MariaDB-enterprise

there are no errors on the proxy or on any of the nodes.

Caused by: java.io.EOFException: unexpected end of stream, read 0 bytes from 4

at org.mariadb.jdbc.internal.packet.read.ReadPacketFetcher.getReusableBuffer(ReadPacketFetcher.java:178)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1055)
Update Issue Reply Reply as Note Assign Issue To Myself Mark as Duplicate Close Issue
Signup as Authorized Replier Change Status To >

Test case:

public class BatchInsert {
 
    static final String ADDRESS = "127.0.0.1";
    static final String PORT = "4006";
    static final String USER = "maxuser";
    static final String PASSWORD = "maxpwd";
    static final String DB = "test";
 
    public static void main(String[] args) {
        try (Connection connection = DriverManager.getConnection("jdbc:mariadb://"
                + ADDRESS + ":" + PORT + "/" + DB + "?user=" + USER + "&password="
                + PASSWORD + "&useBatchMultiSendNumber=500")) {
            Statement stmt = connection.createStatement();
            stmt.execute("DROP TABLE IF EXISTS tt");
            stmt.execute("CREATE TABLE tt (d int)ENGINE=BLACKHOLE");
            for (int i = 0; i < 300; i++) {
                stmt.addBatch("INSERT INTO tt(d) VALUES (1)");
                if (i % 3 == 0) {
                    stmt.addBatch("SET @test2='aaa'");
                }
            }
            stmt.executeBatch();
            System.out.println("finished");
        } catch (Exception e) {
            System.out.println("Error: " + e.getMessage());
        }
    }
}

The backend protocol module discarded extra data after a response to session command was received. The router also didn't write data to the master if it was already executing something.



 Comments   
Comment by markus makela [ 2017-03-30 ]

Managed to reproduce this on a testing server. The connection closed was caused by MaxScale being killed by the kernel as it was consuming all the memory.

Comment by markus makela [ 2017-03-31 ]

The real reason for the failures is the fact that JDBC bulk statement execution is used. There is fix which should solve this problem in commit 7eff0f96701b7a75596f5f3b13725469f239b0fc.

Comment by Dipti Joshi (Inactive) [ 2017-04-04 ]

markus makelaCan we back port the fix from 2.2.0 to 2.1.3 ?

Thanks,
Dipti

Comment by markus makela [ 2017-04-04 ]

The fix to this is found on the develop-rwsplit-batch branch on GitHub. As can be seen from the commit log, it is a fairly extensive change and during development, quite a bit of test failures were seen.

I'd say that it's not trivially safe to backport it to 2.1.3 and should be left for either 2.2.0 or 2.1.4 where more extensive testing can be done.

Comment by Johan Wikman [ 2017-04-04 ]

As it is non-trivial, I think it is too late to backport it to 2.1.3. Better to save it for a 2.1.4 release or even better 2.2.

Comment by markus makela [ 2017-04-24 ]

The readwritesplit can now process batched statements. The implementation does not yet pipeline the statements as that would require further changes to the router. This problem is described in MXS-1245.

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