rajeshkumarchandolu opened a new pull request, #11849:
URL: https://github.com/apache/ozone/pull/11849
## What changes were proposed in this pull request?
Use the KeyManager interface instead of KeyManagerImpl casts in OM and tests
### Why
This is a preparatory change for OM tracing The tracing work will create OM
components such as the key, volume and bucket managers as tracing proxies,
using `TracingUtil.createProxy(impl, Interface.class, ...)`. Every call then
gets a span named `<ImplClass>.<method>`, for example
`KeyManagerImpl.listStatus`.
A tracing proxy is a JDK dynamic proxy, so it implements only the interface.
Any code that casts the manager to its implementation class, or calls a method
that exists only on the implementation, fails with a `ClassCastException` once
the proxy is in place. This PR removes those dependencies for the key manager,
so callers use only the `KeyManager` interface. It doesn't add any tracing
itself.
### What
`OzoneManager#reconfOzoneSnapshotSSTFilteringServiceInterval` cast
`keyManager` to `KeyManagerImpl` three times, to check, stop and start the
snapshot SST filtering service. Several tests also held the key manager as
`KeyManagerImpl`.
This PR:
* Adds `KeyManager#restartSnapshotSstFilteringService(OzoneConfiguration)`.
`KeyManagerImpl` implements it as stop followed by start. The service stays
stopped when the new interval disables it, which is the existing
`startSnapshotSstFilteringService` behaviour.
* Replaces the three casts in
`reconfOzoneSnapshotSSTFilteringServiceInterval` with a single call to the new
method. The explicit `Objects.requireNonNull` sanity check is dropped, because
`stopSnapshotSstFilteringService` already handles a service that isn't running.
* Switches tests to the interface types:
* `TestKeyManagerUnit`, `TestKeyManagerImpl`, `OmSnapshotTests`,
`TestOzoneManagerSnapshotAcl`, `TestOzoneSnapshotRestore` and
`TestOmReconfiguration` use `KeyManager`.
* `OmTestManagers` casts the volume and bucket managers to `VolumeManager`
and `BucketManager`.
* In `TestOmReconfiguration#sstFilteringServiceInterval`, removes the
`isSstFilteringSvcEnabled()` assertions, an implementation-only method. The
remaining `getSnapshotSstFilteringService()` null and non-null assertions still
check that the service is running or stopped after each reconfiguration.
There is no functional change.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-XXXX
## How was this patch tested?
* `TestKeyManagerUnit` (10 tests) and `TestKeyManagerImpl` (38 tests).
* `TestOzoneIntegrationNonHA`: 377 tests, including the `OmReconfiguration`
nested suite (13 tests), which covers the SST filtering interval
reconfiguration.
* Checkstyle and PMD on `ozone-manager` and `ozone-integration-test`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]