Skip to content

Move OM request handler fault injection into a test decorator - #11851

Open
rajeshkumarchandolu wants to merge 1 commit into
apache:masterfrom
rajeshkumarchandolu:om-fault-injected-request-handler
Open

rajeshkumarchandolu wants to merge 1 commit into
apache:masterfrom
rajeshkumarchandolu:om-fault-injected-request-handler

Conversation

@rajeshkumarchandolu

Copy link
Copy Markdown
Contributor

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

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the om label Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant