Skip to content

fix(flink): support native log max file size config - #19630

Closed
cshuo wants to merge 1 commit into
apache:masterfrom
cshuo:fix_native_log_size
Closed

fix(flink): support native log max file size config#19630
cshuo wants to merge 1 commit into
apache:masterfrom
cshuo:fix_native_log_size

Conversation

@cshuo

@cshuo cshuo commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Describe the issue this Pull Request addresses

Closes #19629.

Flink native Parquet log writers currently use hoodie.parquet.max.file.size as their rollover threshold, so native log files cannot be sized independently from base Parquet files.

Summary and Changelog

  • Add the common hoodie.native.log.max.file.size configuration in bytes.
  • Use it for Flink native Parquet log rollover when explicitly configured.
  • Fall back to hoodie.parquet.max.file.size when it is not configured, preserving the current default behavior.
  • Keep base Parquet files independent from the native log setting.
  • Add focused coverage for the fallback, explicit override, and base-file behavior.

Impact

This is backward compatible by default. Users can opt in to a different native log rollover threshold without changing the target size of base Parquet files or reusing the inline log-file size setting.

Risk Level

Low. The new configuration is opt-in, and the existing Parquet target remains the fallback.

Documentation Update

The new common configuration is documented in HoodieStorageConfig.

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

Validation: mvn -pl hudi-client/hudi-flink-client -am -Dtest=TestHoodieRowDataParquetConfigInjector#testNativeLogMaxFileSize -Dsurefire.failIfNoSpecifiedTests=false -DskipITs -DskipSparkTests -DskipScalaTests test (1 test, 0 failures, 0 errors).

@cshuo
cshuo marked this pull request as ready for review August 14, 2026 03:14
@codecov-commenter

codecov-commenter commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.54%. Comparing base (3ba31dd) to head (062606c).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...apache/hudi/common/config/HoodieStorageConfig.java 71.42% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19630      +/-   ##
============================================
+ Coverage     77.49%   77.54%   +0.05%     
- Complexity    32799    32930     +131     
============================================
  Files          2522     2524       +2     
  Lines        139179   139513     +334     
  Branches      16734    16865     +131     
============================================
+ Hits         107855   108190     +335     
+ Misses        23748    23738      -10     
- Partials       7576     7585       +9     
Components Coverage Δ
hudi-common 83.27% <71.42%> (+<0.01%) ⬆️
hudi-client 82.73% <ø> (+0.02%) ⬆️
hudi-flink 85.74% <100.00%> (-0.01%) ⬇️
hudi-spark-datasource 70.80% <ø> (+0.19%) ⬆️
hudi-utilities 73.65% <ø> (+<0.01%) ⬆️
hudi-cli 15.26% <ø> (-0.07%) ⬇️
hudi-hadoop 69.05% <ø> (+0.10%) ⬆️
hudi-sync 75.58% <ø> (+0.46%) ⬆️
hudi-io 79.47% <ø> (ø)
hudi-timeline-service 83.44% <ø> (ø)
hudi-cloud 64.06% <ø> (ø)
hudi-kafka-connect 53.20% <ø> (ø)
Flag Coverage Δ
common-and-other-modules 50.88% <87.50%> (+0.04%) ⬆️
flink-integration-tests 49.15% <68.75%> (-0.12%) ⬇️
hadoop-mr-java-client 43.86% <71.42%> (+0.02%) ⬆️
integration-tests 13.63% <31.25%> (+0.01%) ⬆️
spark-client-hadoop-common 50.51% <71.42%> (+0.05%) ⬆️
spark-java-tests 51.70% <71.42%> (+0.02%) ⬆️
spark-scala-tests 46.11% <71.42%> (+0.03%) ⬆️
utilities 36.60% <71.42%> (-0.04%) ⬇️

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

Files with missing lines Coverage Δ
...io/storage/row/HoodieRowDataFileWriterFactory.java 97.56% <100.00%> (+0.50%) ⬆️
...apache/hudi/common/config/HoodieStorageConfig.java 89.72% <71.42%> (-0.37%) ⬇️

... and 35 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.

@github-actions github-actions Bot added the size:S PR with lines of changes in (10, 100] label Aug 14, 2026
@danny0405

Copy link
Copy Markdown
Contributor

-1, I don't think we should use the write.log.max.size as native log file size limitations since it's default is 1GB.

@cshuo cshuo changed the title fix(flink): honor log max size for native parquet logs fix(flink): support native log max file size config Aug 14, 2026
@cshuo
cshuo marked this pull request as draft August 14, 2026 05:36
@cshuo
cshuo force-pushed the fix_native_log_size branch from ca1e491 to 062606c Compare August 14, 2026 05:54
@cshuo
cshuo marked this pull request as ready for review August 14, 2026 05:54
@cshuo

cshuo commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

-1, I don't think we should use the write.log.max.size as native log file size limitations since it's default is 1GB.

Fixed. Following the suggestion, added hoodie.native.log.max.file.size with a file-format-specific fallback.

@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

@hudi-agent hudi-agent left a comment

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.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for working on this! This PR adds a common hoodie.native.log.max.file.size config and wires it into the Flink native Parquet log writer, falling back to hoodie.parquet.max.file.size when unset while leaving base Parquet files unaffected. I traced the path (path-based getFileWriternewParquetFileWriter(instantTime, storagePath, ...) → parquet writer canWrite()) and the plumbing looks correct, including the contains() guard before getLong and the base-vs-native-log discrimination. One cross-engine scoping question worth double-checking in the inline comment. Please take a look, and this should be ready for a Hudi committer or PMC member to take it from here. Code looks clean overall — one minor naming observation below.

.withDocumentation("Target size in bytes for parquet files produced by Hudi write phases. "
+ "For DFS, this needs to be aligned with the underlying filesystem block size for optimal performance.");

public static final ConfigProperty<String> NATIVE_LOG_MAX_FILE_SIZE = ConfigProperty

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.

🤖 This config lives in hudi-common and the docs read as format/engine-generic, but only the Flink HoodieRowDataFileWriterFactory honors it — HoodieSparkFileWriterFactory.newParquetFileWriter still uses PARQUET_MAX_FILE_SIZE unconditionally for native logs. Is the Flink-only scope intentional? A Spark user setting hoodie.native.log.max.file.size would see it silently ignored; might be worth narrowing the doc or noting the limitation.

⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.

HoodieConfig config, HoodieRowDataParquetWriteSupport writeSupport, StoragePath storagePath) {
// Native logs handled by this factory are write-once Parquet files whose rollover is decided by
// the Parquet writer's canWrite(), not by LOGFILE_MAX_SIZE used for Hudi log containers. Preserve
// the Parquet target as the fallback unless a dedicated native-log target is explicitly configured.

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: with three overloads all named getParquetConfig, the StoragePath variant's intent ("pick the right max size based on path") isn't obvious at a glance — you have to read each signature to follow the dispatch chain. Have you considered inlining the maxFileSize resolution directly in newParquetFileWriter (a couple of lines before the existing call), and keeping just the single long-taking overload? That would make the decision visible at the call site without the indirection.

⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.

@cshuo cshuo closed this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S PR with lines of changes in (10, 100]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native Parquet log files ignore the log size configuration and produce much more small files

5 participants