Christian Schneider created SLING-13356:
-------------------------------------------

             Summary: ResourceDistributionPackageCleanup deletes all disposable 
packages in a single unbounded JCR commit
                 Key: SLING-13356
                 URL: https://issues.apache.org/jira/browse/SLING-13356
             Project: Sling
          Issue Type: Bug
    Affects Versions: Content Distribution Core 0.7.4
            Reporter: Christian Schneider
            Assignee: Christian Schneider
             Fix For: Content Distribution Core 0.8.0


{{ResourceDistributionPackageCleanup.run()}} iterates every disposable package 
and calls {{delete(false)}} (no commit) on each one inside the loop — the only 
{{commit()}} happens once, after the whole loop finishes. On a 
resource-persisted distribution agent with a large package backlog, this 
becomes a single unbounded transaction.

We saw a real case where a distribution agent accumulated a backlog of roughly 
1.5-1.75 million disposable packages. The resulting single commit (~7 million 
node deletions) never completed and put the underlying JCR repository under 
sustained load until the backlog was cleared out-of-band.

Proposed fix: commit in bounded batches inside the loop instead of once at the 
end — track packages deleted since the last commit, and call {{commit()}} once 
a configurable batch size is reached (falling back to today's 
single-commit-at-the-end behavior when unset or ≤ 0). Will attach a patch.

Related: SLING-10743 — same class, same package-path pattern in its own 
example, but a different root cause (concurrent-instance arbitration, already 
fixed).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to