[rt-devel] [patch] recursive merges and watchers inheritance on mergees

Ruslan U. Zakirov cubic at acronis.ru
Thu Aug 21 12:38:50 EDT 2003


        Hello again.
Interesting discussion with myself :)

AddLink without "Silent" flag  call _SetTransaction that call 
$self->Load($self->Id), but when we've called AddLink we allready 
changed $self->EffectiveId. Because of it all next tasks is broken they 
operate with same instance($NewTicket->Id == $self->Id)
This bug also have been breaking watchers copying on mergees because of 
same reason.

This bug have effect on all people who system return not empty set for 
this SQL request
select t2.id, t2.EffectiveId, t1.EffectiveId from Tickets t1 right join 
Tickets t2 on t1.id = t2.EffectiveId where t1.id != t1.EffectiveId;

This select show ticket A (1 col = "id of A") that was merged in ticket 
B (2 col = "id of B") and have EffectiveId == "id of B", but EffectiveId 
of B another and its value in 3rd col(id of C in which B was merged). 
And in the result when we requst A or B or C we see only transactions of 
C and B.

            Good luck and be force with you. Ruslan.

Ruslan U. Zakirov wrote:

>    Hello. Jesse.
> Here my investigations on problem:
> call $self->AddLink in sub MergeInto of Ticket_Overlay.pm reloads 
> $self :( if this call not "Silent".
>
> Changes at Ticket_Overlay.pm
> sub MergeInto {
> ...snip...
>    $RT::Logger->debug(
>        "Ticket id:".$self->Id()." Merge Into ticket 
> id:".$NewTicket->Id());
>    #make a new link: this ticket is merged into that other ticket.
>    $self->AddLink( Type   => 'MergedInto', Target => $NewTicket->Id());
>                                                                                                                             
>    $RT::Logger->debug(
>        "Ticket id:".$self->Id()." Merge Into ticket 
> id:".$NewTicket->Id());
> ...snip...
> }
>
> Without Silent flag resulting debug info is:
> Ticket id:15279 Merge Into ticket id:15288 
> (/opt/rt3/lib/RT/Ticket_Overlay.pm:2906)
> [Wed Aug 20 17:07:54 2003] [info]: 
> <rt-3.0.4-15288-141906.18.1953700448829 at foo.com> #15288/141906 - Scrip 
> 19 Notify all about task changes (/opt/rt3/lib/RT/Action/SendEmail.pm:92)
> [Wed Aug 20 17:07:54 2003] [info]: 
> <rt-3.0.4-15288-141906.18.1953700448829 at foo.com> sent To:  Cc:  Bcc: 
> bar at foo.com (/opt/rt3/lib/RT/Action/SendEmail.pm:302)
> [Wed Aug 20 17:07:54 2003] [debug]: Ticket id:15288 Merge Into ticket 
> id:15288 (/opt/rt3/lib/RT/Ticket_Overlay.pm:2910)
>
> This is VERY bad behavior to change object that come from outside sub. 
> :( Our Scrips are common based on standart Actions and Condtions.
>
> I've spend much time on this f*** bug, but now I need to go to home. 
> May be tomorrow I'll look at it again.
>
>            Best regards. Ruslan.
>
> _______________________________________________
> rt-devel mailing list
> rt-devel at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-devel


-------------- next part --------------
--- rt3_b/lib/RT/Ticket_Overlay.pm	2003-07-31 12:14:41.000000000 +0400
+++ rt3/lib/RT/Ticket_Overlay.pm	2003-08-21 20:09:28.000000000 +0400
@@ -2894,9 +2894,6 @@
     }
 
 
-    #make a new link: this ticket is merged into that other ticket.
-    $self->AddLink( Type   => 'MergedInto', Target => $NewTicket->Id());
-
     #add all of this ticket's watchers to that ticket.
     my $requestors = $self->Requestors->MembersObj;
     while (my $watcher = $requestors->Next) { 
@@ -2936,6 +2933,9 @@
         );
     }
 
+    #make a new link: this ticket is merged into that other ticket.
+    $self->AddLink( Type   => 'MergedInto', Target => $NewTicket->Id());
+
     $NewTicket->_SetLastUpdated;
 
     return ( 1, $self->loc("Merge Successful") );


More information about the Rt-devel mailing list