FTS-1936: Remove potential deadlock in MySqlAPI::terminateReuseProcess(..) and make DB queries more efficient
FTS-1936: Change MySqlAPI::terminateReuseProcess(..)
to examine less database rows and remove risk of potential deadlock.
The pid filer was removed from the WHERE
clause in the UPDATE
statement because updating based on the job_id
is enough.
Instead of updating multiple rows on the t_file
table that share the same job_id
, this change creates a transaction and inside it updates, in order, each row on the t_file
table individually.
The new algorithm is the following:
-
SELECT
the rows to be updated - Start a transaction
- In a loop
UPDATE
each row individually using thefile_id
- Commit the transaction
Closes FTS-1936