Skip to content

Conversation

@nsivabalan
Copy link
Contributor

Change Logs

  • Fix Log record reading with rollback blocks having higher timestamps compared to maxInstant configured.

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

@danny0405
Copy link
Contributor

Looks good, let's fix the test failures.

@nsivabalan nsivabalan force-pushed the logRecordReaderRollbackFix branch from d5b6fc4 to ee8d6e0 Compare October 2, 2024 23:13
@github-actions github-actions bot added size:M PR with lines of changes in (100, 300] and removed size:L PR with lines of changes in (300, 1000] labels Oct 3, 2024
@nsivabalan nsivabalan force-pushed the logRecordReaderRollbackFix branch from 1ece130 to 14ffdd1 Compare October 3, 2024 21:20
@nsivabalan nsivabalan force-pushed the logRecordReaderRollbackFix branch from 14ffdd1 to 72f0ab3 Compare October 4, 2024 02:10
@hudi-bot
Copy link
Collaborator

hudi-bot commented Oct 4, 2024

CI report:

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

Copy link
Contributor

@yihua yihua left a comment

Choose a reason for hiding this comment

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

LGTM

@yihua yihua merged commit e2ca74f into apache:master Oct 5, 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.

4 participants