ygrek / ocaml-mysql

OCaml bindings to libmysqlclient
https://ygrek.org.ua/p/ocaml-mysql
GNU Lesser General Public License v2.1
23 stars 11 forks source link

Setting MAX_EXECUTION_TIME returns fewer results but no error #12

Open Leonidas-from-XIV opened 6 years ago

Leonidas-from-XIV commented 6 years ago

We were wondering why we sometimes get less than our LIMIT 100 results on our queries, even though the should still have been more results. This is important because we paginate through a big dataset and would like to detect the fact when we reached the last page (which would be signalled by returning less then LIMIT results).

As it turned out this is due to our setting of SET MAX_EXECUTION_TIME=10; to limit the execution time of our queries, which correctly causes timeout errors in MySQL clients (error code 3024) but not with this library. Instead ocaml-mysql returns fewer results without any obvious indication (like an exception) that the underlying query actually failed.

Is there a way to make this library signal errors when this problem happens?

ygrek commented 6 years ago

Sounds like a bug. Patch is welcome..

ygrek commented 4 years ago

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_execution_time I cannot find any mention what happens to query result if timeout is reached (I would expect error returned with no results), are you sure max_execution_time is the reason of result set truncation?

Leonidas-from-XIV commented 4 years ago

This error goes away if we don't set it. If we set the execution time limit on a 3rd party client like Sequel Pro, we are getting an error message that the execution time limit was reached.