Skip to content

HDDS-17050. Recon task cursor advances past a batch that failed both attempts, so a restart soon after the failure can lose that batch. - #12093

Draft
ArafatKhan2198 wants to merge 2 commits into
apache:masterfrom
ArafatKhan2198:HDDS-17050
Draft

ArafatKhan2198 wants to merge 2 commits into
apache:masterfrom
ArafatKhan2198:HDDS-17050

Conversation

@ArafatKhan2198

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Sequence

  1. Batch 1 and batch 2 are both waiting in the buffer.
  2. A task fails batch 1 on both attempts. Recon sets tasksFailed. The rebuild has not started, and the flag lives only in memory.
  3. The event thread still takes batch 2. The task succeeds, and its saved position moves to the end of batch 2.
  4. Recon restarts before the next sync queues the rebuild. The flag is gone.
  5. On startup the saved position matches the OM database position, so nothing is rebuilt.
  6. Batch 1 is never applied. For NSSummaryTask the namespace summary and du APIs keep reporting too few files and bytes. Later syncs and restarts do not notice. Only a manual rebuild repairs it.

New writes before the restart move the OM database position ahead of the task, and startup then does rebuild. The risky window is about one sync interval on a busy cluster, and until the queued rebuild finishes on an idle one.

Change

processOMUpdateBatch returns immediately while tasksFailed is set. Batches already waiting are not given to any task, so no saved position moves. This is the same rule consumeOMEvents already uses for batches that arrive after the failure.

Skipping them loses nothing. The next sync still drains the buffer and rebuilds from a checkpoint that contains every skipped batch. After a restart, the task position is behind the OM database position, so the existing startup check rebuilds the task and batch 1 is included. Tasks that did not fail pause only until that rebuild is queued.

A task that throws instead of returning a failed result never sets the flag. That case is HDDS-17040 and is not covered here.

What is the link to the Apache JIRA

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

How was this patch tested?

testBatchesBehindFailedBatchDoNotAdvanceTaskCursor in TestReconTaskControllerImpl. A task fails a batch ending at sequence 100 on both attempts, which sets tasksFailed and leaves its saved position at 0. A later batch ending at 200, which the task would succeed on, is then processed. The position stays at 0 and the task is not called for that batch. Without the change the position becomes 200.

mvn -pl :ozone-recon test -Dtest=TestReconTaskControllerImpl -DskipShade -DskipRecon

The tests ran successfully.

…attempts, so a restart soon after the failure can lose that batch.
// waiting would move the task cursor up to the OmDeltaRequest cursor, so a restart before that
// rebuild would find nothing to redo and the failed batch would be lost.
if (hasTasksFailed()) {
LOG.warn("Skipping buffered OM update batch ending at sequence {} because a task has failed and " +

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.

nit: since this runs once per buffered batch, a backlog in the buffer (tasks slower than the OM sync) would print one WARN per skipped batch until the next sync drains it. The failure is already logged at WARN by the retry path and by the sync thread when it queues the rebuild, so maybe DEBUG is enough here?

Suggested change
LOG.warn("Skipping buffered OM update batch ending at sequence {} because a task has failed and " +
LOG.debug("Skipping buffered OM update batch ending at sequence {} because a task has failed and " +

@ArafatKhan2198

Copy link
Copy Markdown
Contributor Author

Hey @smengcl do take a look again

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.

2 participants