Skip to content

HDDS-16275. OM checkpoint pause() stops flush thread but not apply executor. - #11190

Draft
sadanand48 wants to merge 2 commits into
apache:masterfrom
sadanand48:HDDS-16275
Draft

HDDS-16275. OM checkpoint pause() stops flush thread but not apply executor.#11190
sadanand48 wants to merge 2 commits into
apache:masterfrom
sadanand48:HDDS-16275

Conversation

@sadanand48

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  • Added apply-path quiescing in OzoneManagerStateMachine:
    -pause() now blocks new apply entries and waits for in-flight apply work to drain.
    • After apply drain, pause() waits for double-buffer flush completion, then stops the buffer thread.
    • unpause() resumes apply in a finally block to ensure waiters are always released.
  • Hardened applyTransaction() for executor scheduling failures:
    -if async scheduling fails (for example RejectedExecutionException), in-flight counters are released correctly to avoid pause hangs.
    -Added test coverage in TestOzoneManagerStateMachine:
    -verify apply is blocked while paused and resumes after unpause.
    -verify executor rejection does not leave pause blocked.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-16275

How was this patch tested?

Unit test

@sadanand48 sadanand48 changed the title HDDS-16275. OM checkpoint pause() stops flush thread but not apply executor, risking divergence on install failure paths HDDS-16275. OM checkpoint pause() stops flush thread but not apply executor. Sep 2, 2026
@jojochuang
jojochuang requested review from jojochuang and smengcl and a lite review from Copilot September 3, 2026 15:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

applyTransaction() can still leak in-flight counters (and unflushed permits) if supplyAsync rejects scheduling, which can deadlock pause(), and the described executor-rejection regression coverage is currently missing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates OzoneManagerStateMachine checkpoint pause()/unpause() behavior to quiesce the apply path (not just the double-buffer flush thread), aiming to ensure checkpoint installation doesn’t race with in-flight apply work and to avoid pause hangs.

Changes:

  • Added apply-transaction quiescing via a monitor/flag plus in-flight tracking around applyTransaction().
  • Updated pause() to wait for apply drain and double-buffer flush before stopping the double-buffer thread; updated unpause() to resume apply in a finally block.
  • Added a unit test asserting applyTransaction() blocks while paused and resumes after unpause().
File summaries
File Description
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java Introduces apply-path pause/resume and in-flight draining integrated into pause()/unpause() and applyTransaction().
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/ratis/TestOzoneManagerStateMachine.java Adds a regression test for pause/unpause blocking behavior of applyTransaction().
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +500 to +504
return CompletableFuture.supplyAsync(() -> {
try {
return runCommand(request, termIndex);
} finally {
exitApplyTransaction();
Comment on lines +376 to +378
}
}

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.

2 participants