Skip to content

Backport (#14293): server: report a domain's bucket, object storage and backup limits correctly - #14956

Open
stag7824 wants to merge 1 commit into
apache:4.22from
stag7824:backport-14293-domain-limits
Open

stag7824 wants to merge 1 commit into
apache:4.22from
stag7824:backport-14293-domain-limits

Conversation

@stag7824

@stag7824 stag7824 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Description

This PR backports #14293 to 4.22, as suggested by @RosiKyu when the original was moved to main.

listDomains reported the bucket and object storage limits of every non-root domain as Unlimited, and the backup and backup storage rows used the wrong "unlimited" checks. For a domain without its own limit, the response also showed Unlimited instead of the limit that is actually enforced (parent domain or max.domain.* default).

It is a clean cherry-pick (-x) of b694fcd, with no conflicts. Same four files as the original.

Fixes: #13944

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

On this branch (JDK 11): ApiDBUtilsTest and DomainJoinDaoImplTest pass (6 tests), and checkstyle is clean for server.

The original was tested on a KVM lab by @RosiKyu and reproduced on a 4.23 build by @rootnomad, see #14293.

…rrectly (apache#14293)

* server: report a domain's bucket, object storage and backup limits correctly

listDomains reported the bucket and object storage limits of every
non-root domain as Unlimited, whatever was configured. DomainJoinDaoImpl
resolved those two through ApiDBUtils.findCorrectResourceLimit, which is
the account variant: it looks the id up in the account table. Given a
domain id it finds either the root admin account or no account, and
answers unlimited either way. The other fifteen resource types already go
through findCorrectResourceLimitForDomain.

The backup and backup storage rows had their unlimited checks copied from
the row above: the backup limit was hidden whenever the snapshot limit was
unlimited, and the backup storage limit whenever the backup limit was.

listResourceLimits was never affected, which is why the values set
through updateResourceLimit read back correctly there and only the usage
view in the UI, which reads listDomains, showed them as Unlimited.

Fixes apache#13944

* server: show the enforced limit for a domain that has no limit of its own

When a domain has no limit set, the domain response fell back to
findDefaultResourceLimitForDomain, which only reads the max.domain.*
default for storage types and answers unlimited for the rest. Creating
a resource still stops at the default (or at a parent domain's limit),
so for example the bucket limit showed unlimited while bucket creation
stopped at 20. Use the same lookup that is enforced.

* server: drop a comment that repeats the code

(cherry picked from commit b694fcd)

This branch has not been deployed

No deployments
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.

1 participant