Bugzilla – Attachment 147689 Details for
Bug 33116
Limit reports execution time with SQL variables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33116: Add sql statement limit to report query
Bug-33116-Add-sql-statement-limit-to-report-query.patch (text/plain), 2.22 KB, created by
Didier Gautheron
on 2023-03-03 11:39:57 UTC
(
hide
)
Description:
Bug 33116: Add sql statement limit to report query
Filename:
MIME Type:
Creator:
Didier Gautheron
Created:
2023-03-03 11:39:57 UTC
Size:
2.22 KB
patch
obsolete
>From 7b74343e9e204b80c26ed303e465526389d45caf Mon Sep 17 00:00:00 2001 >From: Didier Gautheron <didier.gautheron@biblibre.com> >Date: Thu, 16 Feb 2023 21:28:47 +0100 >Subject: [PATCH] Bug 33116: Add sql statement limit to report query > >--- > C4/Reports/Guided.pm | 13 +++++++++++++ > debian/templates/koha-conf-site.xml.in | 8 ++++++++ > 2 files changed, 21 insertions(+) > >diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm >index cbbc1a6f88..4e01dacfd5 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -608,6 +608,19 @@ sub execute_query { > my $dbh = C4::Context->dbh; > > $dbh->do( 'UPDATE saved_sql SET last_run = NOW() WHERE id = ?', undef, $report_id ) if $report_id; >+ if (C4::Context->config('report_sql_max_statement_time') or C4::Context->config('report_sql_max_join_size') ) { >+ my $sql_limit = "SET STATEMENT "; >+ my $timeout = 0; >+ if (C4::Context->config('report_sql_max_statement_time')) { >+ $sql_limit .= "MAX_STATEMENT_TIME=" . C4::Context->config('report_sql_max_statement_time'); >+ $timeout = 1; >+ } >+ if (C4::Context->config('report_sql_max_join_size')) { >+ $sql_limit .= "," if $timeout; >+ $sql_limit .= "MAX_JOIN_SIZE=". C4::Context->config('report_sql_max_join_size'); >+ } >+ $sql = $sql_limit . " FOR " . $sql; >+ } > > my $sth = $dbh->prepare($sql); > eval { >diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in >index bdb994c517..5a135b582f 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -260,6 +260,14 @@ __END_SRU_PUBLICSERVER__ > <ca>__DB_TLS_CA_CERTIFICATE__</ca> > <cert>__DB_TLS_CLIENT_CERTIFICATE__</cert> > <key>__DB_TLS_CLIENT_KEY__</key> >+ >+ <!-- default report max sql statement time is infinite. mariaDB in second >+ milli second for mysql --> >+ <! -- <report_sql_max_statement_time>300</<report_sql_max_statement_time> --> >+ >+ <!-- default report max sql join size is infinite. --> >+ <! -- <report_sql_max_join_size>10000000</<report_sql_max_join_size> --> >+ > <biblioserver>biblios</biblioserver> > <biblioservershadow>1</biblioservershadow> > <authorityserver>authorities</authorityserver> >-- >2.39.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33116
: 147689