Skip to content

fix(common): keep committed logs visible under an uncommitted base instant - #19785

Open
zhaoyudi-creator wants to merge 1 commit into
apache:masterfrom
zhaoyudi-creator:fix-19774-committed-logs-uncommitted-base
Open

fix(common): keep committed logs visible under an uncommitted base instant#19785
zhaoyudi-creator wants to merge 1 commit into
apache:masterfrom
zhaoyudi-creator:fix-19774-committed-logs-uncommitted-base

Conversation

@zhaoyudi-creator

Copy link
Copy Markdown

Change Logs

A MOR file group can have its latest file slice keyed on a base instant
that never committed. For example, under NBCC with the bucket index a
delta commit fails (or is rolled back) while later delta commits on the
same file group succeed; log files are attributed to a slice by completion
time, so the failed instant's log and the later committed logs land in one
slice whose base instant is the failed one.

isFileSliceCommitted only checked whether the base instant itself was
committed, so the whole slice — including its committed log files — was
treated as uncommitted and dropped from the reader view, silently losing
committed data.

Fix: also consider a slice committed when any of its log files carries a
committed delta commit time. Read-side filterUncommittedFiles /
filterUncommittedLogs still trims the individual uncommitted log, so only
committed logs are read.

The change is inert for table version < 8: there every log file in a slice
shares the slice's base instant as its file-name token, so an uncommitted
base implies all-uncommitted log tokens and the new clause cannot fire.

Impact

Restores correct MOR read results when a file slice's base instant belongs
to a failed/rolled-back delta commit. No public API change.

Risk level: low

Narrowly widens slice visibility; covered by two new unit tests and
verified to be a no-op for pre-v8 layouts.

Documentation Update

None.

Contributor's checklist

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

…stant

A MOR file group can end up with its latest file slice keyed on a base
instant that never committed. For example, under NBCC with the bucket
index a delta commit fails (or is rolled back) while later delta commits
on the same file group succeed. Log files are attributed to a slice by
completion time, so the failed instant's log and the later committed logs
land in one slice whose base instant is the failed one.

isFileSliceCommitted only checked whether the base instant itself was
committed, so the whole slice -- including its committed log files -- was
treated as uncommitted and dropped from the reader view, silently losing
committed data.

Consider a slice committed when its base instant is committed OR any of
its log files carries a committed delta commit time. The reader still
trims the individual uncommitted log via filterUncommittedFiles /
filterUncommittedLogs, so only the committed logs are read.

The change is inert for table version < 8: there every log file in a
slice shares the slice's base instant as its file-name token
(HoodieAppendHandle reuses the previous commit for the log instant), so
an uncommitted base implies all-uncommitted log tokens and the new clause
cannot fire.

Tests:
- TestHoodieFileGroup#testCommittedLogsMakeSliceWithUncommittedBaseInstantVisible
  verifies a slice with an inflight base instant and committed logs is
  now returned by getAllFileSlices().
- TestHoodieTableFileSystemView#testCommittedLogsRemainVisibleWithUncommittedBaseInstant
  verifies the file-system view surfaces the slice and trims only the
  uncommitted log.

Closes apache#19774
@danny0405

Copy link
Copy Markdown
Contributor

sorry, after some analysis, I found that patch1 is more reasonable fix: #19774 (comment)

@hudi-bot

Copy link
Copy Markdown
Collaborator

CI report:

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

@codecov-commenter

codecov-commenter commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.46%. Comparing base (7b377a5) to head (a5d425a).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19785      +/-   ##
============================================
- Coverage     78.15%   75.46%   -2.69%     
+ Complexity    33691    32539    -1152     
============================================
  Files          2540     2540              
  Lines        141413   141415       +2     
  Branches      17123    17124       +1     
============================================
- Hits         110516   106719    -3797     
- Misses        23195    26833    +3638     
- Partials       7702     7863     +161     
Components Coverage Δ
hudi-common 81.98% <100.00%> (-1.59%) ⬇️
hudi-client 78.73% <ø> (-4.42%) ⬇️
hudi-flink 85.71% <ø> (+0.05%) ⬆️
hudi-spark-datasource 65.60% <ø> (-7.10%) ⬇️
hudi-utilities 74.53% <ø> (ø)
hudi-cli 15.06% <ø> (ø)
hudi-hadoop 67.14% <ø> (-2.97%) ⬇️
hudi-sync 75.56% <ø> (ø)
hudi-io 79.71% <ø> (-0.15%) ⬇️
hudi-timeline-service 77.57% <ø> (-5.88%) ⬇️
hudi-cloud 65.81% <ø> (ø)
hudi-kafka-connect 53.20% <ø> (ø)
Flag Coverage Δ
common-and-other-modules 51.47% <100.00%> (-0.01%) ⬇️
flink-integration-tests 48.89% <66.66%> (+0.04%) ⬆️
hadoop-mr-java-client 44.03% <100.00%> (+<0.01%) ⬆️
integration-tests 13.52% <0.00%> (+<0.01%) ⬆️
spark-client-hadoop-common 50.41% <100.00%> (+0.03%) ⬆️
spark-java-tests 32.29% <66.66%> (-19.89%) ⬇️
utilities 36.30% <66.66%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../org/apache/hudi/common/model/HoodieFileGroup.java 100.00% <100.00%> (ø)

... and 367 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants