[Rt-commit] rt branch, 4.2/upgrading-indexes-and-review, updated. rt-4.1.19-46-ge19e7ec

Alex Vandiver alexmv at bestpractical.com
Wed Sep 4 12:01:33 EDT 2013


The branch, 4.2/upgrading-indexes-and-review has been updated
       via  e19e7ec7f1ee497f42e52c63d43a0f4ad6a47675 (commit)
       via  2449c65b0c85983772c1447ace846fe3e65c2b4e (commit)
       via  0140d8da36596c8226794b9956c7f5dfcbff91ec (commit)
      from  40cd35095ded1644dffe426aa2f4bfa4340a5f7d (commit)

Summary of changes:
 etc/upgrade/{4.1.10 => 4.1.23}/indexes       | 29 ++++++++++++++++------------
 etc/upgrade/{4.1.10 => 4.1.23}/schema.Oracle |  0
 etc/upgrade/{4.1.10 => 4.1.23}/schema.Pg     |  0
 etc/upgrade/{4.1.10 => 4.1.23}/schema.mysql  |  0
 lib/RT/Handle.pm                             |  8 +++++---
 5 files changed, 22 insertions(+), 15 deletions(-)
 rename etc/upgrade/{4.1.10 => 4.1.23}/indexes (83%)
 rename etc/upgrade/{4.1.10 => 4.1.23}/schema.Oracle (100%)
 rename etc/upgrade/{4.1.10 => 4.1.23}/schema.Pg (100%)
 rename etc/upgrade/{4.1.10 => 4.1.23}/schema.mysql (100%)

- Log -----------------------------------------------------------------
commit 0140d8da36596c8226794b9956c7f5dfcbff91ec
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Aug 29 17:23:01 2013 -0400

    Move to open upgrade slot

diff --git a/etc/upgrade/4.1.10/indexes b/etc/upgrade/4.1.23/indexes
similarity index 100%
rename from etc/upgrade/4.1.10/indexes
rename to etc/upgrade/4.1.23/indexes
diff --git a/etc/upgrade/4.1.10/schema.Oracle b/etc/upgrade/4.1.23/schema.Oracle
similarity index 100%
rename from etc/upgrade/4.1.10/schema.Oracle
rename to etc/upgrade/4.1.23/schema.Oracle
diff --git a/etc/upgrade/4.1.10/schema.Pg b/etc/upgrade/4.1.23/schema.Pg
similarity index 100%
rename from etc/upgrade/4.1.10/schema.Pg
rename to etc/upgrade/4.1.23/schema.Pg
diff --git a/etc/upgrade/4.1.10/schema.mysql b/etc/upgrade/4.1.23/schema.mysql
similarity index 100%
rename from etc/upgrade/4.1.10/schema.mysql
rename to etc/upgrade/4.1.23/schema.mysql

commit 2449c65b0c85983772c1447ace846fe3e65c2b4e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Sep 4 03:47:15 2013 -0400

    Switch to a de-duplication name that is predictable and understandable

diff --git a/etc/upgrade/4.1.23/indexes b/etc/upgrade/4.1.23/indexes
index 53bcd0b..10a2b2f 100644
--- a/etc/upgrade/4.1.23/indexes
+++ b/etc/upgrade/4.1.23/indexes
@@ -68,17 +68,16 @@ my $dedup = sub {
         # skip first
         shift @$ids;
 
-        my $i = 0;
         foreach my $id ( @$ids ) {
             RT->Logger->debug("Changing $column of $record_class #". $id );
-            $dbh->do("UPDATE $table SET $column = ? WHERE id = ?", undef,  $value . '-dup-'.$$.++$i, $id);
+            $dbh->do("UPDATE $table SET $column = ? WHERE id = ?", undef,  $value . '-dup-'.$id, $id);
         }
     }
 
     if ( $found ) {
         RT->Logger->warning(
-            "Records in $table table had not unique values in $column column."
-            ." $column has been changed for such records, search LIKE '%-dup-$$%'"
+            "Records in $table table had non-unique values in $column column."
+            ." $column has been changed for such records, and now matches '%-dup-%'"
         );
     }
 };

commit e19e7ec7f1ee497f42e52c63d43a0f4ad6a47675
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Sep 4 03:48:03 2013 -0400

    Adjust log levels to reduce noise and not hide true errors

diff --git a/etc/upgrade/4.1.23/indexes b/etc/upgrade/4.1.23/indexes
index 10a2b2f..d76264f 100644
--- a/etc/upgrade/4.1.23/indexes
+++ b/etc/upgrade/4.1.23/indexes
@@ -7,7 +7,8 @@ use warnings;
         my ($status, $msg) = $RT::Handle->DropIndexIfExists(
             Table => 'Groups', Name => $name,
         );
-        RT->Logger->info($msg);
+        my $method = $status ? 'debug' : 'warning';
+        RT->Logger->$method($msg);
     }
 
     my ($name, $msg) = $RT::Handle->CreateIndex(
@@ -15,20 +16,23 @@ use warnings;
         Columns => [qw(Domain Type Instance)],
         CaseInsensitive => { domain => 1, type => 1 },
     );
-    RT->Logger->info($msg);
+    my $method = $name ? 'debug' : 'warning';
+    RT->Logger->$method($msg);
 
     ($name, $msg) = $RT::Handle->CreateIndex(
         Table => 'Groups',
         Columns => [qw(Domain Name Instance)],
         CaseInsensitive => { domain => 1, name => 1 },
     );
-    RT->Logger->info($msg);
+    $method = $name ? 'debug' : 'warning';
+    RT->Logger->$method($msg);
 
     ($name, $msg) = $RT::Handle->CreateIndex(
         Table => 'Groups',
         Columns => [qw(Instance)],
     );
-    RT->Logger->info($msg);
+    $method = $name ? 'debug' : 'warning';
+    RT->Logger->$method($msg);
 }
 
 my $dedup = sub {
@@ -89,7 +93,7 @@ my $dedup = sub {
         { Table => 'Users', Column => 'Name' },
     );
     foreach my $e (@list) {
-        RT->Logger->info("Checking index on ". $e->{'Column'} ." in ". $e->{'Table'} );
+        RT->Logger->debug("Checking index on ". $e->{'Column'} ." in ". $e->{'Table'} );
         my ($index) = $RT::Handle->IndexesThatBeginWith(
             Table => $e->{'Table'}, Columns => [$e->{'Column'}]
         );
@@ -98,7 +102,7 @@ my $dedup = sub {
             $index && $index->{'Unique'}
             && ($RT::Handle->CaseSensitive? $index->{'CaseInsensitive'}{ lc $e->{'Column'} } : 1 )
         ) {
-            RT->Logger->info("Required index exists. Skipping.");
+            RT->Logger->debug("Required index exists. Skipping.");
             next;
         }
 
@@ -108,14 +112,16 @@ my $dedup = sub {
             my ($status, $msg) = $RT::Handle->DropIndex(
                 Table => $e->{'Table'}, Name => $index->{'Name'},
             );
-            RT->Logger->info($msg);
+            my $method = $status ? 'debug' : 'warning';
+            RT->Logger->$method($msg);
         }
 
         my ($status, $msg) = $RT::Handle->CreateIndex(
             Table => $e->{'Table'}, Columns => [$e->{'Column'}],
             Unique => 1, CaseInsensitive => { lc $e->{'Column'} => 1 },
         );
-        RT->Logger->info($msg);
+        my $method = $status ? 'debug' : 'warning';
+        RT->Logger->$method($msg);
     }
 }
 
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 8727780..0d7440b 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -1561,7 +1561,7 @@ sub MakeSureIndexExists {
         Table => $args{'Table'}, Columns => [@{$args{'Columns'}}, @{$args{'Optional'}}],
     );
     if (@list) {
-        RT->Logger->info( ucfirst $self->IndexDescription(
+        RT->Logger->debug( ucfirst $self->IndexDescription(
             Table => $args{'Table'}, Columns => [@{$args{'Columns'}}, @{$args{'Optional'}}],
         ). ' exists.' );
         return;
@@ -1574,7 +1574,8 @@ sub MakeSureIndexExists {
         my ($status, $msg) = $self->CreateIndex(
             Table => $args{'Table'}, Columns => [@{$args{'Columns'}}, @{$args{'Optional'}}],
         );
-        RT->Logger->info($msg);
+        my $method = $status ? 'debug' : 'warning';
+        RT->Logger->$method($msg);
     }
     else {
         RT->Logger->info(
@@ -1610,7 +1611,8 @@ sub DropIndexesThatArePrefix {
         my ($status, $msg) = $self->DropIndex(
             Table => $i->{'Table'}, Name => $i->{'Name'},
         );
-        RT->Logger->info($msg);
+        my $method = $status ? 'debug' : 'warning';
+        RT->Logger->$method($msg);
     }
 }
 

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


More information about the Rt-commit mailing list