rajeshkumarchandolu opened a new pull request, #11851: URL: https://github.com/apache/ozone/pull/11851
## What changes were proposed in this pull request? Move OM request handler fault injection into a test decorator ### Why This is a preparatory change for OM tracing . The tracing work will create the OM `RequestHandler` used by `OzoneManagerStateMachine` and `OzoneManagerProtocolServerSideTranslatorPB` as a tracing proxy, using `TracingUtil.createProxy(new OzoneManagerRequestHandler(...), RequestHandler.class, ...)`. Read and write handling then gets spans such as `OzoneManagerRequestHandler.handleWriteRequest`. A proxy implements only the `RequestHandler` interface. Today `OzoneManagerStateMachine#getHandler()` casts its handler to `OzoneManagerRequestHandler`, so that a test can reach a fault-injection hook that exists only on that class. That cast would fail once the handler is a proxy. This PR removes the dependency on the concrete handler class. It doesn't add any tracing itself. ### What `OzoneManagerRequestHandler` carried a test-only `FaultInjector`: * a field, `@VisibleForTesting` `setInjector` / `getInjector` methods, and a private `injectPause()`; * `injectPause()` ran at the start of every `handleWriteRequestImpl` call in production. Its only user is `OzoneRpcClientTests#testParallelDeleteBucketAndCreateKey`, which pauses the write path to reproduce a race between bucket delete and key create. This PR: * Adds `FaultInjectedOzoneManagerRequestHandler` under `src/test`. It is a `RequestHandler` decorator that delegates every call and pauses on its `FaultInjector` before `handleWriteRequestImpl`. * Removes the injector field, its accessors and `injectPause()` from `OzoneManagerRequestHandler`, so production code no longer has a test hook in the write path. * `OzoneManagerStateMachine#setHandler` now takes a `RequestHandler`, and `getHandler()` returns the `RequestHandler` without a cast. * `testParallelDeleteBucketAndCreateKey` wraps the current handler in the decorator, and puts the original handler back once the paused requests have run. Production behaviour is unchanged, except that the write path no longer checks for a test injector. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-XXXX ## How was this patch tested? * `TestOzoneRpcClient#testParallelDeleteBucketAndCreateKey` passes with the decorator. The test is marked `@Unhealthy("HDDS-10886")` and skipped in CI, so it was run locally with `-Dexcluded-test-groups=benchmark`. * `TestOzoneManagerStateMachine` (64 tests) and `TestOzoneManagerRequestHandler` (27 tests). * Checkstyle and PMD on `ozone-manager` and `ozone-integration-test`. ##Build: https://github.com/rajeshkumarchandolu/ozone/actions/runs/40860345412 -- 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]
