Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HUDI-6371] Indexing catchup tasks should handle failed commits based on heartbeat #12369

Merged
merged 3 commits into from
Nov 29, 2024

Conversation

codope
Copy link
Member

@codope codope commented Nov 28, 2024

Change Logs

Indexing catchup task iterates over all the commits to sync them to MDT. It will periodically check if the commit completed. But if the commit actually failed then it will forever be in inflight mode and hence the indexing run will not progress. This PR fixes the issue by using heartbeat to detect failed commits and ignore them. Without the change in awaitInstantCaughtUp, the new test testHeartbeatExpired will fail.

Impact

Indexer can be used even with pending/failed commits.

Risk level (write none, low medium or high below)

low

Documentation Update

Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".

  • The config description must be updated if new configs are added or the default value of the configs are changed
  • Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
    ticket number here and follow the instruction to make
    changes to the website.

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@github-actions github-actions bot added the size:M PR with lines of changes in (100, 300] label Nov 28, 2024
Copy link
Member

@vinothchandar vinothchandar left a comment

Choose a reason for hiding this comment

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

Couple of confirmations. overall looks ok, if assumptions are right

try {
if (table.getConfig().getFailedWritesCleanPolicy().isLazy() && heartbeatClient.isHeartbeatExpired(instant.requestedTime())) {
LOG.info("Ignoring instant " + instant + " as heartbeat expired");
return null;
Copy link
Member

Choose a reason for hiding this comment

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

please dont return null

Copy link
Contributor

@nsivabalan nsivabalan Nov 28, 2024

Choose a reason for hiding this comment

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

btw, should we call heartbeatExists, followed by isHeartbeatExpired with the heart beat client, rather than directly calling isHeartbeatExpired.

Copy link
Contributor

Choose a reason for hiding this comment

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

let me summarize my understanding.

I also went over the design in the RFC https://github.com/apache/hudi/blob/master/rfc/rfc-45/rfc-45.md as well.

6 Start indexing catchup in a separate thread (that can be interrupted upon timeout)
  6.a  For each instant to catchup
    6.a.i  if instant is completed and has corresponding deltacommit in metadata timeline then continue
    6.a.ii  if instant is inflight, then reload active timeline periodically until completed or timed out
    6.a.iii update metadata table, if needed, within a lock

so, in this case, just that we missed to account for a failed write scenario.
a. for a single writer, we should ignore the instant to catch up and continue in the loop to next instant.
b. for multi-writer scenario, if there is active heart beat, we have to wait. so that it either goes to completion. or it elapses time out on which case we can again ignore from the list of instant to catchup.

Copy link
Contributor

Choose a reason for hiding this comment

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

and yes. same comment as vc.
awaitInstantCaughtUp(HoodieInstant instant) does not change the instant anyways. So, why not return boolean.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't recall why it was this way but no use, so now i have changed it to boolean and heartbeat check is as follows:

  1. If no heart beat, then ignore and just move on.
  2. If heart beat exists, but expire, then also ignore and move on. If not expired then wait.

try {
if (table.getConfig().getFailedWritesCleanPolicy().isLazy() && heartbeatClient.isHeartbeatExpired(instant.requestedTime())) {
LOG.info("Ignoring instant " + instant + " as heartbeat expired");
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

and yes. same comment as vc.
awaitInstantCaughtUp(HoodieInstant instant) does not change the instant anyways. So, why not return boolean.

Copy link
Contributor

@nsivabalan nsivabalan left a comment

Choose a reason for hiding this comment

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

2 minor comments

@hudi-bot
Copy link

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@nsivabalan nsivabalan merged commit 28cf81b into apache:master Nov 29, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M PR with lines of changes in (100, 300]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants