]> git.koha-community.org Git - koha.git/commit
Bug 18364: Do not LOCK/UNLOCK tables from tests
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 31 Mar 2017 16:43:38 +0000 (13:43 -0300)
committerKatrin Fischer <katrin.fischer.83@web.de>
Fri, 21 Apr 2017 22:19:58 +0000 (00:19 +0200)
commitfd4b3555d83c44e8026f3899faa879ba25c7a598
tree79750d049c9999b1b36cf9644982df3df54e4195
parentc8fbbecf789773bc6e4972361788499ab77470d8
Bug 18364: Do not LOCK/UNLOCK tables from tests

From the MySQL doc:
"LOCK TABLES is not transaction-safe and implicitly commits any active transaction before attempting to lock the tables."
If the LOCK/UNLOCK statements are executed from tests, the current transaction will be committed.
To avoid that we need to guess if this code is execute from testsa or not (yes it is a bit hacky)

Better ideas are welcome!

Another fix would have been to revert
  commit be156d9ad9e5bcfadab34d44f90e04fd61e256ad
  Bug 15854: Use a READ and WRITE LOCK on message_queue
but theorically a race is still possible.

Existing tests seem to be safe, to test this patch you will need new
tests from bug 17964.
Test plan:
  prove t/db_dependent/Letters/TemplateToolkit.t
twice, and notice that changes have been comitted.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit b40456f7dd4b8a988f9c6a5718452936101cb8ff)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
C4/Circulation.pm