[CONC-184] Provide a way to cancel/interrupt current call via new mysql_cancel() function Created: 2016-05-20  Updated: 2016-06-30  Resolved: 2016-05-21

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.1

Type: Bug Priority: Major
Reporter: Vladislav Vaintroub Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-9293 change clients to use Connector/C Closed

 Description   

the effect should be similar to mysql_query("KILL <id>"), however this is for environment where creating a second connection to issue kill is not feasible.

mysql_close cannot be used because it deallocates the memory, which we do not want ( we do not want even to close the socket because it may have some interesting race conditions)

Specifically, this call is required inside the server to interrupt slave thread that is stuck in long read call. Currently, server uses mysql->net.vio of the slave connection to issue a vio_shutdown() which comes down to either socket shutdown() call, or to CancelIoEx(), or to setting some event for shared memory. This will make further calls than require IO fail, without deallocating or invalidating the rest of MYSQL struct.

There is no NET and no VIO in Connector/C, we do not want to expose there structures, the high-level new call should be mysql_cancel(MYSQL *mysql) , or mysql_abort(MYSQL *mysql) that does the job of killing the connection pointed to my `mysql` parameter slightly less gracefully than a KILL would do (but more reliable and much cheaper and faster)



 Comments   
Comment by Vladislav Vaintroub [ 2016-05-20 ]

The mentioned server functionality (using vio of slaves MYSQL struct) is inside
sql/slave.cc (set_active_vio)
sql/class.cc (vio_shutdown)

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