[CONJ-970] No records returned with useServerPrepStmts and large result size Created: 2022-05-05  Updated: 2022-05-23  Resolved: 2022-05-13

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 2.3.0, 2.7.5
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Manos Vekrakis Assignee: Diego Dupin
Resolution: Won't Fix Votes: 0
Labels: None

Attachments: Java Source File BugDemo.java    
Issue Links:
Problem/Incident
is caused by MDEV-28557 No results-set returned when results ... Closed

 Description   

There is a bug that is apparent in multiple MariaDB versions, where records are not being returned if useServerPrepStmts is true and the batch size is >= 1000. What happens is that only the last batch is returned and all the previous ones are returned empty.

MariaDB versions that trigger the bug: 10.3.34, 10.5.15, 10.6.7, 10.7.3, 10.8.2
MariaDB versions that do not trigger the bug: 10.3.32, 10.5.12.1, 10.5.13

You can find a Java class attached that can be used to demonstrate the bug on a MariaDB database. This basically populates a MariaDB table with seedCount ids. Then, it performs a query on that table in a sequence of operations, each covering a subset of the id values to be queried (called batchSize).

Below, there are different executions of the BugDemo.java class that showcase the bug. The MariaDB version in this case is 10.5.15 and the seedCount is 2500.

Case 1:

  • useServerPrepStmts: true
  • batchSize: 1000
    Output:

    DB version: 10.5.15-MariaDB
    Total records available: 2500
    Batch retrieved record count: 0
    Batch retrieved record count: 0
    Batch retrieved record count: 500
    Total records retrieved: 500
    Not all records retrieved: bug was triggered
    

Case 2:

  • useServerPrepStmts: false
  • batchSize: 1000
    Output:

    DB version: 10.5.15-MariaDB
    Total records available: 2500
    Batch retrieved record count: 1000
    Batch retrieved record count: 1000
    Batch retrieved record count: 500
    Total records retrieved: 2500
    All records retrieved: bug was not triggered
    

Case 3:

  • useServerPrepStmts: true
  • batchSize: 999
    Output:

    DB version: 10.5.15-MariaDB
    Total records available: 2500
    Batch retrieved record count: 999
    Batch retrieved record count: 999
    Batch retrieved record count: 502
    Total records retrieved: 2500
    All records retrieved: bug was not triggered
    



 Comments   
Comment by Diego Dupin [ 2022-05-13 ]

bug reproduced.
This is a server bug. I'll try to better identify the issue for now. Very strange issue.

Comment by Diego Dupin [ 2022-05-13 ]

Problem reside server side for recent version: I've create the issue MDEV-28557 for server, closing this issue since this isn't specific for java connector.

Thank again for reproductible example !

Comment by Manos Vekrakis [ 2022-05-16 ]

Thank you very much for taking the time. I see that this issue is fixed and expected to be in the next release. Do we have an estimate about when this will happen?

Comment by Diego Dupin [ 2022-05-23 ]

see version correction in https://jira.mariadb.org/browse/MDEV-27937. Corrected version are now released

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