[Rt-commit] rt branch, 4.2/warn-mysql-5.6-innodb, created. rt-4.2.10-233-g2011cc7

Alex Vandiver alexmv at bestpractical.com
Mon Apr 6 14:49:08 EDT 2015


The branch, 4.2/warn-mysql-5.6-innodb has been created
        at  2011cc77ade3677a914dd48b3861ea0d5dffa39d (commit)

- Log -----------------------------------------------------------------
commit aa41701d858cfeb26cf64534d27983a9d4d4defe
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 5 20:20:21 2015 -0500

    Warn if innodb_log_file_size would limit uploads to < 5M
    
    On MySQL 5.6.20 and above, the largest allowed BLOB is 10% of the redo
    log size, aka innodb_log_file_size:
    
        http://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-20.html
    
    Attempts to insert larger data will fail.
    
    Warn during server startup if the innodb_log_file_size is set
    sufficiently small that 5M attachments are not supported.

diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index a80c6ab..9445cc7 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -299,10 +299,26 @@ sub CheckCompatibility {
             }
         }
 
-        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";
+        if ($state =~ /^(create|post)$/) {
+            my $show_var = sub { $dbh->selectrow_arrayref("SHOW VARIABLES LIKE ?",{},$_[0])->[1] };
+
+            my $max_packet = $show_var->("max_allowed_packet");
+            if ($max_packet <= (1024 * 1024)) {
+                $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";
+            }
+
+            my $full_version = $show_var->("version");
+            if ($full_version =~ /^5\.(\d+)\.(\d+)$/ and (($1 == 6 and $2 >= 20) or $1 > 6)) {
+                my $redo_log_size = $show_var->("innodb_log_file_size");
+                $redo_log_size *= $show_var->("innodb_log_files_in_group")
+                    if $full_version =~ /^5\.(\d+)\.(\d+)$/ and (($1 == 6 and $2 >= 22) or $1 > 6);
+
+                if ($redo_log_size / 10 < 5 * 1024 * 1024) {
+                    $redo_log_size = sprintf("%.1fM",$redo_log_size/1024/1024);
+                    warn "innodb_log_file_size is set to $redo_log_size; attachments can only be 10% of this value on MySQL 5.6.  Consider adjusting MySQL's innodb_log_file_size setting.\n";
+                }
+            }
         }
     }
     return (1)

commit 252b3b879c2c0ee857b9751aa841a7d26fcbda22
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Apr 6 14:35:24 2015 -0400

    Refactor "SHOW CREATE TABLE" statements into a common local sub

diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 9445cc7..84fe381 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -287,13 +287,12 @@ sub CheckCompatibility {
         }
 
         if ( $state eq 'post' ) {
-            my $create_table = $dbh->selectrow_arrayref("SHOW CREATE TABLE Tickets")->[1];
-            unless ( $create_table =~ /(?:ENGINE|TYPE)\s*=\s*InnoDB/i ) {
+            my $show_table = sub { $dbh->selectrow_arrayref("SHOW CREATE TABLE $_[0]")->[1] };
+            unless ( $show_table->("Tickets") =~ /(?:ENGINE|TYPE)\s*=\s*InnoDB/i ) {
                 return (0, "RT requires that all its tables be of InnoDB type. Upgrade RT tables.");
             }
 
-            $create_table = $dbh->selectrow_arrayref("SHOW CREATE TABLE Attachments")->[1];
-            unless ( $create_table =~ /\bContent\b[^,]*BLOB/i ) {
+            unless ( $show_table->("Attachments") =~ /\bContent\b[^,]*BLOB/i ) {
                 return (0, "RT since version 3.8 has new schema for MySQL versions after 4.1.0\n"
                     ."Follow instructions in the UPGRADING.mysql file.");
             }

commit 2011cc77ade3677a914dd48b3861ea0d5dffa39d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 5 20:27:03 2015 -0500

    Increase the warn threshold on max_allowed_packet to 5M
    
    The default on MySQL 5.6 is 4M, which is still likely too small.
    Additionally, increasing this to 5M brings it into parity with the redo
    log size warning.

diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 84fe381..e11a2a0 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -302,7 +302,7 @@ sub CheckCompatibility {
             my $show_var = sub { $dbh->selectrow_arrayref("SHOW VARIABLES LIKE ?",{},$_[0])->[1] };
 
             my $max_packet = $show_var->("max_allowed_packet");
-            if ($max_packet <= (1024 * 1024)) {
+            if ($max_packet <= (5 * 1024 * 1024)) {
                 $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";
             }

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


More information about the rt-commit mailing list