← Back to team overview

maria-discuss team mailing list archive

New Question: Multi-threading and Statement.cancel()



A new question has been asked in "MariaDB Java Client" by rstepanski:
Attempting to execute queries on multiple threads (10 to 20) with the ability to cancel each Thread's unique Statement mid execution from a separate thread.

However, when sharing a single Connection among all threads for their Statement creation, a cancel() on one Statement will cause other thread's executeQuery() to throw a "Query execution was interrupted".

Switching to per thread Connections and a thread pool, the cancel() will sometimes fail with "Unknown thread id: xx". I'm assuming this occurs when a thread previously used to work with another connection attempts to cancel() another.

This had worked previously with MySql jdbc (and still does with MySql jdbc + MariaDb server). 

The queries themselves are single table, limited/offset, selects. Where clauses would generally be related:
query 1: like 'a%'
query 2: like 'ab%'
query 3: like 'abc%'

With each previous query being cancelled when a more specific query was available. 

Any comments/suggestions appreciated. Thanks!

To view or answer this question please visit: http://kb.askmonty.org/en/multi-threading-and-statementcancel/