[Rt-commit] rt branch 4.4/serialize-reorder-stack created. rt-4.4.5-32-ge080925a85

BPS Git Server git at git.bestpractical.com
Mon Mar 21 17:32:10 UTC 2022

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 4.4/serialize-reorder-stack has been created
        at  e080925a850b69cb70276334dac918531b562819 (commit)

- Log -----------------------------------------------------------------
commit e080925a850b69cb70276334dac918531b562819
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Mar 21 22:15:00 2022 +0800

    Put all dependencies of current object to the head of stack
    Previously we put objects depending on current object to the end of
    stack, which could result in a really big stack and was not efficient.
    Assuming a much simplified case: 1000 tickets(each has 10 transactions).
    When 500 tickets got processed, and the stack was like(Page=100):
        tickets(contains 501-1000)
        transactions of ticket 1
        transactions of ticket 2
        transactions of ticket 3
        transactions of ticket 500
    As ticket transactions were put after *all* tickets, the stack size
    could be huge. Things are even worse in real world as transactions have
    attachments, attributes, etc, which would also be put to the end of
    stack and wouldn't be processed until all transactions are serialized.
    With this commit, since transactions of processed tickets are processed
    right after their related tickets, the stack is like:
        tickets(contains 501-1000)
    which is much more memory efficient.

diff --git a/lib/RT/DependencyWalker.pm b/lib/RT/DependencyWalker.pm
index 92f4cd09bc..dec5ec78b1 100644
--- a/lib/RT/DependencyWalker.pm
+++ b/lib/RT/DependencyWalker.pm
@@ -139,9 +139,7 @@ sub Walk {
                 push @{$self->{replace}}, \%frame;
-        unshift @{$stack}, @{$self->{replace}};
-        unshift @{$stack}, @{$self->{top}};
-        push    @{$stack}, @{$self->{bottom}};
+        unshift @{$stack}, @{$self->{top}}, @{$self->{replace}}, @{$self->{bottom}};
         if ($self->{GC} > 0 and $self->{gc_count} > $self->{GC}) {
             $self->{gc_count} = 0;



More information about the rt-commit mailing list