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-8248] Fixing Log Record reader to include rollback blocks with timestamps > maxInstant times #11990

Conversation

nsivabalan
Copy link
Contributor

@nsivabalan nsivabalan commented Sep 23, 2024

Change Logs

  • Fix Log record reading with rollback blocks having higher timestamps compared to maxInstant configured. This fix is required only for 0.x branch. Since with 1.x, we would have ordered log files based on completion time within a file slice.

Impact

LogRecordReader takes in a maxInstant time beyond which log blocks are ignored. But w/ rollbacks, there are chances it could lead to data consistency issues.

Lets go through an illustration:

Say, we have t1.dc, t2.dc and t2.dc crashed mid way.
Current layout is,

base file(t1), lf1(partially committed data w/ t2 as instant time)

Then we start t5.dc say. just when we start t5.dc, hudi detects pending commit and triggers a rollback. And this rollback will get an instant time of t6 (t6.rb). Note that rollback's commit time is greater than t5 or current ongoing delta commit.
So, once rollback completes, this is the layout.

base file, lf1(from t2.dc partially failed), lf3 (rollback command block with t6). 

And once t5.dc completes, this is how the layout looks like

base file, lf1(from t2.dc partially failed), lf3 (rollback command block with t6). lf4 (from t5) 

At this point in time, when we trigger snapshot read or try to trigger tagLocation w/ global index, maxInstant is set to last entry among commits timeline which is t5. So, while LogRecordReader while processing all log blocks, when it reaches lf3, it detects the timestamp of t6 > t5 (i.e max instant time) and bails out of for loop. So, in essence it may even read lf4 in above scenario.

This patch attempts the fix the same.

Fix:
We only hold the constraint true for any data blocks and relax it for other block types. For eg, any data blocks > max instant time will be ignored. But all rollback blocks are taken into consideration.

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

medium.

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

@nsivabalan nsivabalan changed the base branch from master to branch-0.x September 23, 2024 19:47
@github-actions github-actions bot added the size:M PR with lines of changes in (100, 300] label Sep 23, 2024
@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 changed the title [HUDI-8242] Fixing Log Record reader to include rollback blocks with timestamps > maxInstant times [HUDI-8248] Fixing Log Record reader to include rollback blocks with timestamps > maxInstant times Sep 24, 2024
@danny0405 danny0405 self-assigned this Sep 24, 2024
@danny0405
Copy link
Contributor

Let's fix the compile error.

@nsivabalan
Copy link
Contributor Author

Closing this in favor of #12033

@nsivabalan nsivabalan closed this Oct 1, 2024
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.

3 participants