[rt-users] Simple RT script makes Mysql Server go away

Joop JoopvandeWege at mococo.nl
Tue Sep 29 02:33:21 EDT 2009


Hello Todd,
> All,
>
> I am customizing RT to add an attribute to transactions that meet
> certain criteria. The script below is meant to update all the existing
> transactions but after a while the Mysal server goes away. Is there
> anything obvious about the script causing this? Thanks!
>
> #!/opt/perl/bin/perl
>
> use strict;
> use warnings;
>
> use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
> use RT;
> use RT::Transactions;;
>
> RT::LoadConfig();
> RT::Init();
>
> my $last = 1;
>
> for my $id ( (500_000, 1_000_000, 1_500_000, 2_000_000, 2_500_000,
> 3_000_000, 3_500_000, 4_000_000, 4_500_000,
>             5_000_000, 5_500_000, 6_000_000, 6_500_000, 7_000_000,
> 7_500_000, 8_000_000, 8_500_000, 9_000_000,
>             9_500_000, 10_000_000) ) {
>
>     my $transactions = RT::Transactions->new( $RT::SystemUser );
>     $transactions->Limit( FIELD => 'ObjectType', VALUE => "RT::Ticket" );
>     $transactions->Limit( FIELD => 'Type', VALUE => "EmailRecord" );
>     $transactions->Limit( FIELD => 'id', VALUE => $last, OPERATOR => ">=" );
>     $transactions->Limit( FIELD => 'id', VALUE => $id, OPERATOR =>
> "<", ENTRYAGGREGATOR => "AND" );
>
>     while (my $trans = $transactions->Next) {
>
>         my $ticket = $trans->Object;
>
>         if ( $ticket->RequestorIsExternal ) {
>             $trans->SetAttribute( Name => "ExternalEmail", Content => 1);
>         }
>     }
>
>     $last = $id;
>
> }
>   
Maybe I missed something in your script logic or in how mysql handles 
commits but when is your modification committed to the database?
If its and the end then maybe mysql is running out of space somewhere.

Regards,

Joop




More information about the rt-users mailing list