[Bug 27511] New: Don't use NOW() in saved sql last run update
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 Bug ID: 27511 Summary: Don't use NOW() in saved sql last run update Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Reports Assignee: koha-bugs@lists.koha-community.org Reporter: fridolin.somers@biblibre.com QA Contact: testopia@bugs.koha-community.org When running a report, column last run is updated with current date-time. We should avoid using NOW(), better calculated date-time in perl. With NOW(), when importing a backup dump, you get current date-time in all rows. Also, sometimes we see errors in plack logs : DBD::mysql::db do failed: Lock wait timeout exceeded; try restarting transaction [for Statement "UPDATE saved_sql SET last_run = NOW() WHERE id = ?"] at /home /koha/src/C4/Reports/Guided.pm line 576. Replacing NOW() should avoid this. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |fridolin.somers@biblibre.co |ity.org |m Status|NEW |ASSIGNED -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=26669 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 --- Comment #1 from Fridolin Somers <fridolin.somers@biblibre.com> --- See that NOW() has been replaces in C4::Stats by Bug 24151 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 --- Comment #2 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 115565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115565&action=edit Bug 27511: Don't use NOW() in saved sql last run update When running a report, column last run is updated with current date-time. We should avoid using NOW(), better calculated date-time in perl. With NOW(), when importing a backup dump, you get current date-time in all rows. Also, sometimes we see errors in plack logs : DBD::mysql::db do failed: Lock wait timeout exceeded; try restarting transaction [for Statement "UPDATE saved_sql SET last_run = NOW() WHERE id = ?"] at /home /koha/src/C4/Reports/Guided.pm line 576. Replacing NOW() should avoid this. Test plan: 1) Run a sql report 2) Check last run date and time is OK -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 --- Comment #3 from Fridolin Somers <fridolin.somers@biblibre.com> --- Or maybe we should use Koha::Report (ORM) ? with $report->last_run($date)->store(); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27573 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27573 [Bug 27573] Use of NOW() in SQL should be avoided -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=27574 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 PTFS Europe Sandboxes <sandboxes@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #115565|0 |1 is obsolete| | --- Comment #4 from PTFS Europe Sandboxes <sandboxes@ptfs-europe.com> --- Created attachment 119050 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=119050&action=edit Bug 27511: Don't use NOW() in saved sql last run update When running a report, column last run is updated with current date-time. We should avoid using NOW(), better calculated date-time in perl. With NOW(), when importing a backup dump, you get current date-time in all rows. Also, sometimes we see errors in plack logs : DBD::mysql::db do failed: Lock wait timeout exceeded; try restarting transaction [for Statement "UPDATE saved_sql SET last_run = NOW() WHERE id = ?"] at /home /koha/src/C4/Reports/Guided.pm line 576. Replacing NOW() should avoid this. Test plan: 1) Run a sql report 2) Check last run date and time is OK Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 Séverine Queune <severine.queune@bulac.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |severine.queune@bulac.fr Status|Needs Signoff |Signed Off --- Comment #5 from Séverine Queune <severine.queune@bulac.fr> --- (In reply to Fridolin Somers from comment #3)
Or maybe we should use Koha::Report (ORM) ? with $report->last_run($date)->store();
I don't have any opinion about that point, the way the patch is written works fine to me. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 --- Comment #6 from Fridolin Somers <fridolin.somers@biblibre.com> --- (In reply to Séverine Queune from comment #5)
(In reply to Fridolin Somers from comment #3)
Or maybe we should use Koha::Report (ORM) ? with $report->last_run($date)->store();
I don't have any opinion about that point, the way the patch is written works fine to me.
QA will tell ;) Thanks a lot for testing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |RESOLVED CC| |jonathan.druart@bugs.koha-c | |ommunity.org, | |martin.renvoize@ptfs-europe | |.com Resolution|--- |INVALID --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- We had this discussion on #koha IIRC, a couple of weeks ago. We don't think this is actually needed. The timezone we use from the DBMS and the perl code should be the same and so this patch won't have any effects and is not fixing a bug. Feel free to reopen if you have an example of what you are trying to fix. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Additionally, I don't think replacing NOW will fix the error "Lock wait timeout exceeded". The problem must be somewhere else. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27511 --- Comment #9 from Fridolin Somers <fridolin.somers@biblibre.com> --- Ok no problem. One known consequence of NOW() is that when re-import a dump, you loose the original date. But it is not really important. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org