Chi-Hsuan Huang created HDDS-16876:
--------------------------------------

             Summary: NumTenants is not initialized from tenantStateTable on OM 
startup
                 Key: HDDS-16876
                 URL: https://issues.apache.org/jira/browse/HDDS-16876
             Project: Apache Ozone
          Issue Type: Bug
          Components: Ozone Manager
            Reporter: Chi-Hsuan Huang
            Assignee: Chi-Hsuan Huang


Follow-up to HDDS-16719.

{{OMMetrics.numTenants}} is only updated by events: {{OMTenantCreateRequest}} 
calls {{incNumTenants()}} and {{OMTenantDeleteRequest}} calls 
{{decNumTenants()}}. Nothing initializes it from {{tenantStateTable}} when OM 
starts:
* {{OzoneManager.start()}} and {{restart()}} set volume, bucket, key, dir and 
file counts from the DB, and {{updateActiveSnapshotMetrics()}} recounts 
snapshots, but tenants are not counted.
* {{OMMultiTenantManagerImpl.loadTenantCacheFromDB()}} already iterates 
{{tenantStateTable}} on startup to build the tenant cache, but does not update 
the metric.

As a result, {{NumTenants}} starts at 0 after every OM restart, and deleting a 
tenant created before the restart can make it negative. This only affects 
clusters with {{ozone.om.multitenancy.enabled=true}}.

Proposed changes:
* Add {{setNumTenants()}} and set it from the tenant count when the tenant 
cache is loaded from DB.
* Add a test that creates tenants, restarts OM, and checks {{NumTenants}}.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to