Skip to content

HDDS-15824. Wait for pipeline before writing keys in debug replicas test#10722

Draft
smengcl wants to merge 1 commit into
apache:masterfrom
smengcl:HDDS-15824-debug-tools-pipeline-wait
Draft

HDDS-15824. Wait for pipeline before writing keys in debug replicas test#10722
smengcl wants to merge 1 commit into
apache:masterfrom
smengcl:HDDS-15824-debug-tools-pipeline-wait

Conversation

@smengcl

@smengcl smengcl commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 4.8, 1M context)

What changes were proposed in this pull request?

The ozonesecure-ha debug replicas acceptance suite (Ozone-Debug-Tests :: Test ozone debug CLI) is flaky. Its Suite Setup (Write keys) intermittently fails with 255 != 0, which marks every test in the suite as failed even though no test logic ran.

Root cause is in hadoop-ozone/dist/src/main/compose/common/replicas-test.sh. The container.db backup flow introduced by HDDS-14225 (the RocksDB 7.7.3 to 10.10.1 upgrade, #9813) now stops all datanodes for a consistent backup, restarts them, and waits only for wait_for_datanode HEALTHY before running debug/ozone-debug-tests.robot. wait_for_datanode confirms the SCM heartbeat state (HEALTHY) but not that write pipelines have been re-established. Write keys then writes a default RATIS THREE key, a RATIS ONE key, a RATIS THREE key, and an EC rs-3-2 key; if it runs before an OPEN pipeline is available after the mass restart, the ozone sh key put exits non-zero (255) and the suite setup fails.

Before HDDS-14225 the test backed up only datanode1 via docker cp without stopping any datanode, and did not restart datanodes before Write keys, so this race did not exist.

Change

After the datanode restart and before running the debug test, wait (bounded at 180s) for at least one OPEN RATIS THREE pipeline via ozone admin pipeline list --state OPEN --type RATIS --replication THREE --json. RATIS ONE and EC writes are covered by all five datanodes already being HEALTHY; the RATIS THREE pipeline being OPEN is the gap this closes.

What is the link to the Apache JIRA

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

How was this patch tested?

bash -n passes on the modified script. The change is exercised by the existing acceptance (tools) job, which runs ozonesecure-ha/test-debug-tools.sh.

Not reproduced locally (requires a full -Pdist build plus a docker-compose acceptance run). Frequency was assessed from master history: test-debug-tools.sh passed in all 14 post-upgrade acceptance (tools) master runs (2026-07-08 to 07-10); the only archived acceptance-tools master failures in that window were test-repair-tools.sh, a separate flake. The failure was observed on an unrelated PR run (2026-07-10) that does not touch this write path.

Copilot AI review requested due to automatic review settings July 10, 2026 21:32

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.

Pull request overview

This PR aims to reduce flakiness in the ozonesecure-ha debug replicas acceptance suite by ensuring write pipelines are re-established after a datanode restart before the Robot “Write keys” suite setup runs.

Changes:

  • Add a bounded wait (180s) for at least one OPEN RATIS THREE pipeline before running debug/ozone-debug-tests.robot.
  • Remove JSONProvider from the httpfsgateway module (currently not described in the PR metadata and appears unrelated to HDDS-15824).

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
hadoop-ozone/dist/src/main/compose/common/replicas-test.sh Adds an explicit wait for an OPEN RATIS THREE pipeline after datanode restart to avoid early key writes failing.
hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/wsrs/JSONProvider.java Deletes the JSON MessageBodyWriter for JSONStreamAware (unexplained in PR description; likely unrelated to the acceptance-test flake).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… debug-tools acceptance test

The container.db backup flow in replicas-test.sh (added by HDDS-14225) stops
all datanodes for a consistent backup, restarts them, and waits only for
wait_for_datanode HEALTHY before running debug/ozone-debug-tests.robot. That
wait confirms the SCM heartbeat state but not that write pipelines have been
re-established, so the "Write keys" suite setup can fail with a non-zero exit
(255) when it writes RATIS THREE and EC keys before a pipeline is available,
causing the whole Ozone-Debug-Tests suite to fail as flaky.

Wait for at least one OPEN RATIS THREE pipeline (bounded at 180s) after the
datanode restart, before writing keys.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@smengcl smengcl force-pushed the HDDS-15824-debug-tools-pipeline-wait branch from 70d924f to 8f8cc09 Compare July 10, 2026 21:43

@adoroszlai adoroszlai 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.

Thanks @smengcl for the patch.

Comment on lines +74 to +84
echo "Waiting for an OPEN RATIS THREE pipeline before writing keys"
SECONDS=0
until [[ "$(docker-compose exec -T ${SCM} bash -c \
"ozone admin pipeline list --state OPEN --type RATIS --replication THREE --json" 2>/dev/null \
| jq -r 'length')" -ge 1 ]]; do
if [[ $SECONDS -ge 180 ]]; then
echo "Timed out waiting for an OPEN RATIS THREE pipeline" >&2
exit 1
fi
sleep 2
done

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.

Please add a function in testlib.sh for single check for pipeline (e.g. pipeline_exists), and use retry to repeat it.

RETRY_ATTEMPTS=60 retry pipeline_exists RATIS THREE

@adoroszlai adoroszlai changed the title HDDS-15824. Wait for RATIS THREE pipeline before writing keys in debug replicas acceptance test HDDS-15824. Wait for pipeline before writing keys in debug replicas test Jul 11, 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.

3 participants