Skip to content

fix domain cleanup when a removed account owns templates#13630

Open
Damans227 wants to merge 1 commit into
apache:4.22from
Damans227:fix-domain-cleanup-removed-account
Open

fix domain cleanup when a removed account owns templates#13630
Damans227 wants to merge 1 commit into
apache:4.22from
Damans227:fix-domain-cleanup-removed-account

Conversation

@Damans227

@Damans227 Damans227 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Fixes #13612

Deleting a domain with cleanup fails when an account in it owns a template. During cleanup the account is removed first, then its templates are deleted, and the template's resource-count recalculation used findById (which skips removed rows) and threw "Unable to find account". This makes the recalculation include removed accounts, so the domain deletes in one pass. The caller privilege check is unchanged.

Test:

Create a domain, an account under it, register a template under that account, then delete the domain with cleanup.

Before: fails.

After: deletes in one pass. Log from the delete job:

Removed account u1d1 (id=5)
Delete template: u1d1-template (id=202)
Updating resource Type = template count for Account with id = 5 Operation = decreasing Amount = 1
Complete async job-37, jobStatus: SUCCEEDED, result: {"success":"true"}

@Damans227

Copy link
Copy Markdown
Collaborator Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 19.65%. Comparing base (17e5947) to head (9107b89).
⚠️ Report is 279 commits behind head on main.

Files with missing lines Patch % Lines
.../cloud/resourcelimit/ResourceLimitManagerImpl.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13630      +/-   ##
============================================
+ Coverage     17.69%   19.65%   +1.96%     
- Complexity    15829    19806    +3977     
============================================
  Files          5925     6368     +443     
  Lines        533534   575107   +41573     
  Branches      65267    70376    +5109     
============================================
+ Hits          94412   113043   +18631     
- Misses       428444   449770   +21326     
- Partials      10678    12294    +1616     
Flag Coverage Δ
uitests 3.41% <ø> (-0.28%) ⬇️
unittests 20.93% <83.33%> (+2.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18595

@Damans227 Damans227 changed the title WIP: Fix domain cleanup removed account Fix domain cleanup removed account Jul 16, 2026
@Damans227 Damans227 changed the title Fix domain cleanup removed account fix domain cleanup when a removed account owns templates Jul 16, 2026
@Damans227 Damans227 marked this pull request as ready for review July 16, 2026 15:40
@Damans227 Damans227 changed the base branch from main to 4.22 July 16, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to clean up template when domain is deleted

2 participants