Koha/C4
Jonathan Druart 4ae3665ad8 Bug 10611: Use mysql_auto_reconnect instead of ping
DBD::Mysql provides a mysql_auto_reconnect flag. Using it avoids
the time required to do a $dbh->ping().

Benchmarks:

use Modern::Perl;
use C4::Context;
for ( 1 .. 1000 ) {
    $dbh = C4::Context->dbh;
}

* without this patch on a local DB:
perl t.pl  0,49s user 0,02s system 98% cpu 0,525 total
* without this patch on a remote DB:
perl t.pl  0,52s user 0,05s system 1% cpu 37,358 total
* with this patch on a local DB:
perl t.pl  0,46s user 0,04s system 99% cpu 0,509 total
* with this patch on a remote DB:
perl t.pl  0,49s user 0,02s system 56% cpu 0,892 total

Testing the auto reconnect:
use Modern::Perl;
use C4::Context;
my $ping = $dbh->ping;
say $ping;
$dbh->disconnect;
$ping = $dbh->ping;
say $ping;

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Real improvement. No koha-qa errors

prove t/db_dependent/Circulation_issuingrules.t produces no error
prove t/db_dependent/Context.t produces no error

Test
1) dumped Koha DB, load it on a non-local server
2) run sample script whit and without patch, local and remote

use Modern::Perl;
use C4::Context;
for ( 1 .. 100000 ) {
    my $dbh = C4::Context->dbh;
}

Main difference I note is with remote server
a) without patch
real    0m16.357s
user    0m2.592s
sys     0m2.132s

b) with patch
real    0m0.259s
user    0m0.240s
sys     0m0.012s

I think this could be good for DBs placed on
remote servers

Bug 10611: add a "new" parameter to C4::Context->dbh

When dbh->disconnect is called and the mysql_auto_reconnect flag is set,
the dbh is not recreated: the old one is used.

Adding a new flag, we can now force the C4::Context->dbh method to
return a new dbh.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Bug 10611: Followup: remove useless calls to dbh->disconnect

These 3 calls to disconnect are done at the end of the script, they are
useless.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 23:15:35 +00:00
..
AuthoritiesMarc
Barcodes Bug 11539: removing 2 unused files 2014-01-14 20:55:28 +00:00
ClassSortRoutine Bug 9770: fix sorting of Dewey call numbers that contain prefixes 2013-07-15 16:12:47 +00:00
Creators Bug 10763 - [SIGNED-OFF] Update POD of C4::Creators::Lib::html_table() to use TT syntax 2013-08-20 14:31:34 +00:00
External Bug 10320: (follow-up) correct license statement 2013-09-08 07:04:45 +00:00
Form
Heading
ILSDI Bug 8918: Fix reserve priority in ILS-DI 2014-03-10 17:31:05 +00:00
Installer Bug 11096: support the retrieval of large MARCXML records 2014-02-28 19:50:09 +00:00
Labels Bug 11402: make Labels::_guide_box return undef if undefned data is passed 2013-12-30 16:17:35 +00:00
Linker Bug 8447: Make sure we have enough subfields for broader_headings 2012-09-14 14:56:48 +02:00
Members Bug 7919: Fix unit test (Members_AttributeTypes.t) 2012-12-07 18:26:37 -05:00
OAI Bug 9295: Introduce operator equal/ notequal to OAI set mapping instead of hardcoded 'equal' value. 2013-10-10 23:03:30 +00:00
Output
Patroncards
Reports Bug 10761: (follow-up) use explicit return in C4::Reports::Guided::delete_report() 2013-08-21 14:45:41 +00:00
Search
Serials Bug 7688: (follow-up) update license statements 2013-10-30 02:56:32 +00:00
SIP Bug 11783: ensure CD field in SIP patron information response is populated 2014-02-19 16:55:13 +00:00
Utils Bug 11474: (follow-up) correct typos in POD 2014-01-06 05:46:32 +00:00
VirtualShelves Bug 10853: All existing routing to get a CSV should return a MARC csv 2013-10-11 02:16:33 +00:00
Accounts.pm Bug 2546: make description of standard fine types translatable 2013-12-05 18:44:33 +00:00
Acquisition.pm Bug 11224 : Add UT to routines of C4::Acquisition returning order(s) 2014-03-10 16:27:21 +00:00
Auth.pm Bug 10952: (follow-up) clear seach history from session after saving it to DB 2014-01-10 16:49:01 +00:00
Auth_cas_servers.yaml.orig
Auth_with_cas.pm Bug 10927: remove disused C4::Utils module 2013-10-03 14:53:02 +00:00
Auth_with_ldap.pm Bug 10908: restore docs on principal_name LDAP option 2013-10-21 15:28:11 +00:00
AuthoritiesMarc.pm Bug 11096: support the retrieval of large MARCXML records 2014-02-28 19:50:09 +00:00
BackgroundJob.pm Bug 10601: (follow-up) improvements to ->set() and ->get() 2013-09-18 17:23:44 +00:00
Barcodes.pm Bug 6679 - [SIGNED-OFF] fix 8 perlcritic violations in C4/Barcodes.pm 2012-09-20 12:01:36 +02:00
Biblio.pm Bug 9823: Refactor return from GetReservesFromBiblionumber 2014-01-30 16:19:55 +00:00
Bookseller.pm Bug 7965: Silence warns in staff log 2014-01-10 15:42:09 +00:00
Boolean.pm Bug 10080 - Change system pref IndependantBranches to IndependentBranches 2013-05-22 07:58:23 -07:00
Branch.pm Bug 11051: remove unneccessary SQL queries in GetBranches 2014-01-10 16:02:39 +00:00
Breeding.pm Bug 11419: display Z39.50 search errors more completely 2013-12-27 00:25:39 +00:00
Budgets.pm Bug 10983: Remove unused private subroutines from C4::Budgets 2013-12-13 15:14:18 +00:00
Calendar.pm Bug 7351 : feature that allows to delete a range of dates 2012-09-28 12:19:45 +02:00
Category.pm Bug 7919: FIX the "all" categories method 2013-01-02 16:50:52 -05:00
Charset.pm Bug 11730: ensure that C4::Charset loads C4::Context 2014-02-18 21:52:21 +00:00
Circulation.pm Bug 10277 - Add C4::Context->IsSuperLibrarian() 2013-12-30 15:47:23 +00:00
ClassSortRoutine.pm
ClassSource.pm Bug 10643: fix inappropriate uses of $sth->finish() in C4::ClassSource.pm 2013-08-09 15:32:22 +00:00
Context.pm Bug 10611: Use mysql_auto_reconnect instead of ping 2014-03-10 23:15:35 +00:00
Contract.pm
CourseReserves.pm bug 8215: (followup) rename GetItemReservesInfo 2013-05-21 15:51:03 -07:00
Creators.pm
Csv.pm Bug 10853: All existing routing to get a CSV should return a MARC csv 2013-10-11 02:16:33 +00:00
Dates.pm
Debug.pm
Heading.pm
HoldsQueue.pm Bug 10452: (follow-up) remove duplicate check of damaged status 2014-03-10 18:15:44 +00:00
HTML5Media.pm Bug 8377: Followup move style in a css file and do not pass template to a pm 2012-12-27 09:28:00 -05:00
Images.pm Bug 8710 - Don't show the images tab in the OPAC if the record has no local images 2012-11-28 18:54:40 -05:00
ImportBatch.pm Bug 10558 [QA Follow-up] 2014-03-10 15:48:32 +00:00
ImportExportFramework.pm Bug 11666: remove SQL as an option for MARC framework exports and imports 2014-02-05 19:48:27 +00:00
Input.pm Bug 7919 : Display of values depending on the connexion library 2012-12-05 10:10:57 -05:00
Installer.pm Bug 10523: Remove two obsolete routines from Installer.pm 2013-10-31 16:51:47 +00:00
ItemCirculationAlertPreference.pm Bug 6679 - [SIGNED-OFF] fix 2 perlcritic violations in C4/ItemCirculationAlertPreference.pm 2012-09-20 12:01:39 +02:00
Items.pm Bug 11803: use $dbh consistently in _koha_modify_item 2014-02-25 14:55:32 +00:00
ItemType.pm Bug 10513: display a warning/message when returning a chosen item type 2013-09-16 17:45:31 +00:00
Koha.pm Bug 11279: (follow-up) remove unnecessary check on number of quotes 2013-12-19 15:06:39 +00:00
Labels.pm
Languages.pm Bug 10309 - New OPAC theme based on Bootstrap 2013-10-14 23:13:05 +00:00
Letters.pm Bug 11732: Eliminate warning on undefined branchcode 2014-02-19 21:20:51 +00:00
Linker.pm
Log.pm Bug 7067 - OPAC Borrower Self Registration 2012-12-14 08:08:59 -05:00
Maintainance.pm
MarcModificationTemplates.pm Bug 11479: Remove experimental given/when keywords 2014-02-20 15:55:21 +00:00
Matcher.pm Bug 11096: support the retrieval of large MARCXML records 2014-02-28 19:50:09 +00:00
Members.pm Bug 7372: Move road types from the roadtype table to the ROADTYPE AV 2014-02-21 16:00:53 +00:00
Message.pm Bug 6679 - [SIGNED-OFF] fix 3 perlcritic violations in C4/Message.pm 2012-09-20 12:01:39 +02:00
NewsChannels.pm Bug 11736 - Use new DataTables include in Koha news templates 2014-02-27 15:42:34 +00:00
Output.pm Bug 10016: force zero browser-side caching of SCO pages 2013-10-21 18:05:12 +00:00
Overdues.pm Bug 11359: Add the borrower's cardnumber and phonenumber to the branch overdues report 2014-03-10 20:25:26 +00:00
Patroncards.pm
Print.pm Bug 6679 - [SIGNED-OFF] fix 2 perlcritic violations in C4/Print.pm 2012-09-20 12:17:43 +02:00
Ratings.pm
Record.pm Bug 11066: make RIS and Bibtex exports RDA compatible 2014-01-03 15:54:38 +00:00
Reports.pm
Reserves.pm Bug 10452: make AllowHoldsOnDamagedItems control using damaged items to fulfill holds 2014-03-10 18:15:12 +00:00
Review.pm
Ris.pm Bug 11066: make RIS and Bibtex exports RDA compatible 2014-01-03 15:54:38 +00:00
RotatingCollections.pm Bug 11384: rename the collections_tracking.ctId column 2013-12-23 16:14:57 +00:00
Scheduler.pm
Scrubber.pm
Search.pm Bug 11096: support the retrieval of large MARCXML records 2014-02-28 19:50:09 +00:00
Serials.pm Bug 10851: (follow-up) fix issues reported by QA script 2014-02-04 17:48:37 +00:00
Service.pm
ShelfBrowser.pm Bug 10856: (follow-up) if callnumbers are equal, order should be on itemnumber 2013-10-04 15:57:03 +00:00
SMS.pm
SocialData.pm
SQLHelper.pm Bug 11221: ensure that SQLHelper uses NULL rather than 0000-00-00 as default date value 2013-11-19 15:29:08 +00:00
Stats.pm Bug 4118 - Add Collection Code to Statistics Table 2012-09-13 18:42:46 +02:00
Suggestions.pm Bug 10277 - Add C4::Context->IsSuperLibrarian() 2013-12-30 15:47:23 +00:00
Tags.pm Bug 9136: C4::Tags not Plack-compatible 2012-12-22 15:47:48 -05:00
Templates.pm Bug 7684: multiple fixes for inventory 2013-11-01 00:10:49 +00:00
TmplToken.pm
TmplTokenType.pm Revert "Bug 6679 - [SIGNED-OFF] fix 9 perlcritic violations in C4/TmplTokenType.pm" 2012-09-20 13:29:59 +02:00
TTParser.pm
UploadedFile.pm
VirtualShelves.pm Bug 11799: Housekeeping: Remove _biblionumber_sth from VirtualShelves.pm 2014-02-21 18:24:11 +00:00
XISBN.pm Bug 11096: support the retrieval of large MARCXML records 2014-02-28 19:50:09 +00:00
XSLT.pm Bug 10550: Fix database typo wthdrawn 2013-09-08 01:58:41 +00:00