[Rt-commit] rt branch, 4.2/init-once-in-db-insert-action, created. rt-4.2.10-17-g8790845

? sunnavy sunnavy at bestpractical.com
Thu Mar 5 12:17:35 EST 2015


The branch, 4.2/init-once-in-db-insert-action has been created
        at  8790845878430f90fb992e3156ca8eeb9afc79b3 (commit)

- Log -----------------------------------------------------------------
commit 8790845878430f90fb992e3156ca8eeb9afc79b3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Feb 25 16:22:35 2015 -0500

    reduce the number of Init() calls per upgrade
    
    it drops the time on an empty 3.8.17 database, upgraded to 4.2.10, from 6.5 minutes to 17s.

diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 46b0c42..339912f 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -48,6 +48,7 @@
 # END BPS TAGGED BLOCK }}}
 use strict;
 use warnings;
+use 5.010;
 
 use vars qw($Nobody $SystemUser $item);
 
@@ -348,9 +349,13 @@ sub action_coredata {
 }
 
 sub action_insert {
+    state $RAN_INIT;
     my %args = @_;
-    $RT::Handle = RT::Handle->new;
-    RT::Init();
+    unless ($RAN_INIT) {
+        $RT::Handle = RT::Handle->new;
+        RT::Init();
+        $RAN_INIT++;
+    }
     $log_actions = 1;
 
     my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'insert' );

-----------------------------------------------------------------------


More information about the rt-commit mailing list