https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43381

--- Comment #2 from Kyle M Hall (khall) <[email protected]> ---
Created attachment 204171
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204171&action=edit
Bug 43381: Report row count query ( nb_rows ) ignores
report_sql_max_statement_time_seconds

Bug 39164 added report_sql_max_statement_time_seconds, which wraps report SQL
in a SET STATEMENT max_statement_time so the database kills a runaway report.
It works for the query that fetches the results, but not for the query that
counts them.

C4::Reports::Guided::execute_query() applies the limit to its own copy of the
SQL, so the caller's copy is untouched. reports/guided_reports.pl then hands
that original SQL to nb_rows(), which runs SELECT COUNT(*) FROM $sql with no 
time limit. If that wrapper fails ( e.g. "Duplicate column name" ), nb_rows
falls back to running the report a second time and counting every row by hand,
also with no limit.

Test Plan:
1) Apply the first patch
2) prove t/db_dependent/Reports/Guided.t
3) Note the 'nb_rows() tests' subtest fails!
4) Apply the remaining patches
5) prove t/db_dependent/Reports/Guided.t
6) Note the tests pass now!
7) Add this to koha-conf.xml:
  
<report_sql_max_statement_time_seconds>2<report_sql_max_statement_time_seconds>
8) Restart all the things!
9) Create a report with the SQL:
   SELECT b1.borrowernumber FROM borrowers b1, borrowers b2 WHERE SLEEP(0.005)
= 0
10) Run the report
11) Note the page comes back in about 2 seconds, the first 20 rows are shown,
and "Total number of results" is *not* displayed!
12) Comment out report_sql_max_statement_time_seconds in koha-conf.xml
13) Restart plack again
14) Run the report again
15) Note the page now takes about 20 seconds and "Total number of results" is
displayed!

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to