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

Alex Vandiver alexmv at bestpractical.com
Fri Mar 29 18:08:59 EDT 2013


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

- Log -----------------------------------------------------------------
commit ee7f040a749c8a7bf149c75c523e606e81843dd6
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.

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)
 }
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 164fe44..455c512 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";

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


More information about the Rt-commit mailing list