[Rt-commit] rt branch, 4.0/warn-max-allowed-packet, created. rt-4.0.11rc1-7-gebae01c

Alex Vandiver alexmv at bestpractical.com
Wed Apr 24 18:31:47 EDT 2013


The branch, 4.0/warn-max-allowed-packet has been created
        at  ebae01c6cdd5f2482cbf4ca282d96ab793a24007 (commit)

- Log -----------------------------------------------------------------
commit 9ebdbe566b8a298f056fa42e936ffbbc77e59a07
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Apr 24 18:02:16 2013 -0400

    Differentiate different actions when calling CheckCompatibility
    
    When CheckCompatibility was initially moved out to RT::Handle in
    aa9e58d, it flattened the various actions into "pre" and "post" -- and
    later 38af184 made all database checks "pre".  As the only test in
    CheckCompatibility is comparing to "post", the precise value of "pre" is
    irrelevant.
    
    To allow compatibility checks to be precisely targetted at stages of the
    rt-setup-database process, pass in a different value for the stage of
    each.

diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 164fe44..f4beb2c 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -204,7 +204,7 @@ foreach my $action ( @actions ) {
 sub action_create {
     my %args = @_;
     my $dbh = get_system_dbh();
-    my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'pre' );
+    my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'create' );
     return ($status, $msg) unless $status;
 
     print "Now creating a $db_type database $db_name for RT.\n";
@@ -232,7 +232,7 @@ END
 sub action_schema {
     my %args = @_;
     my $dbh = get_admin_dbh();
-    my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'pre' );
+    my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'schema' );
     return ($status, $msg) unless $status;
 
     print "Now populating database schema.\n";
@@ -242,7 +242,7 @@ sub action_schema {
 sub action_acl {
     my %args = @_;
     my $dbh = get_admin_dbh();
-    my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'pre' );
+    my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'acl' );
     return ($status, $msg) unless $status;
 
     print "Now inserting database ACLs.\n";
@@ -255,7 +255,7 @@ sub action_coredata {
     $RT::Handle->dbh( undef );
     RT::ConnectToDatabase();
     RT::InitLogging();
-    my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'pre' );
+    my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'coredata' );
     return ($status, $msg) unless $status;
 
     print "Now inserting RT core system objects.\n";
@@ -266,7 +266,7 @@ sub action_insert {
     my %args = @_;
     $RT::Handle = RT::Handle->new;
     RT::Init();
-    my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'pre' );
+    my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'insert' );
     return ($status, $msg) unless $status;
 
     print "Now inserting data.\n";

commit ebae01c6cdd5f2482cbf4ca282d96ab793a24007
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Mar 29 18:06:56 2013 -0400

    Detect and warn of configurations with too small max_allowed_packet
    
    MySQL's max_allowed_packet controls the largest ata that can be inserted
    into the database; surpassing this causes inserts to fail.  This setting
    defaults to 1M -- as RT stores attachments in the database, this is far
    too small for most deployments.
    
    Detect and warn of this situation, both when installing and at run-time.
    Unlike the other cases in CheckCompatibility, we simply warn, rather
    than returning false -- it is _possible_ to run with a small
    max_allowed_packet, merely highly discouraged.

diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 0a1d61e..ef9830c 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -288,6 +288,12 @@ sub CheckCompatibility {
                     ."Follow instructions in the UPGRADING.mysql file.");
             }
         }
+
+        my $max_packet = ($dbh->selectrow_array("show variables like 'max_allowed_packet'"))[1];
+        if ($state =~ /^(create|post)$/ and $max_packet <= (1024 * 1024)) {
+            my $max_packet = sprintf("%.1fM", $max_packet/1024/1024);
+            warn "max_allowed_packet is set to $max_packet, which limits the maximum attachment or email size that RT can process.  Consider adjusting MySQL's max_allowed_packet setting.\n";
+        }
     }
     return (1)
 }

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


More information about the Rt-commit mailing list