Skip to content

[tiering] introduce the option of lake.tiering.io.tmpdir to avoid disk exhaustion#3569

Open
zuston wants to merge 1 commit into
apache:mainfrom
zuston:fixtmp2
Open

[tiering] introduce the option of lake.tiering.io.tmpdir to avoid disk exhaustion#3569
zuston wants to merge 1 commit into
apache:mainfrom
zuston:fixtmp2

Conversation

@zuston

@zuston zuston commented Jul 3, 2026

Copy link
Copy Markdown
Member

Purpose

Linked issue: close #3568

Brief change log

Tests

API and Format

Documentation

@zuston
zuston marked this pull request as ready for review July 3, 2026 10:04
@zuston zuston changed the title [tiering] introduce the option of 'lake.tiering.io.tmpdir' to avoid disk exhaustion [tiering] introduce the option of lake.tiering.io.tmpdir to avoid disk exhaustion Jul 3, 2026
@zuston

zuston commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

link the PR of #3193 . Could you help review this? @luoyuxia

public class MergeTreeWriter extends RecordWriter<KeyValue> {

// the option key to configure the temporary directory used by fluss tiering
private static final String FLUSS_TIERING_TMP_DIR_KEY = "fluss.tiering.io-tmpdir";

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We don't need to reserve this option that it haven't been valid.

@zuston

zuston commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

cc @luoyuxia

Copilot AI 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.

Pull request overview

This PR adds a configurable temporary I/O directory for lake tiering (lake.tiering.io.tmpdir) and wires it through the Flink tiering pipeline into the Paimon MergeTree writer, so tiering can avoid exhausting the default local temp disk.

Changes:

  • Introduce ConfigOptions.LAKE_TIERING_IO_TMP_DIR (lake.tiering.io.tmpdir) and propagate an ioTmpDir value via WriterInitContext.
  • Plumb the temp dir from the Flink tiering source into TieringSourceReader/TieringSplitReader and finally into PaimonLakeWriterMergeTreeWriter IOManager creation.
  • Add unit tests covering the new ioTmpDir plumbing and the tmp-dir selection behavior.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
fluss-lake/fluss-lake-paimon/src/test/java/org/apache/fluss/lake/paimon/tiering/mergetree/MergeTreeWriterTest.java Adds a unit test for MergeTreeWriter tmp-dir selection.
fluss-lake/fluss-lake-paimon/src/main/java/org/apache/fluss/lake/paimon/tiering/PaimonLakeWriter.java Passes ioTmpDir from WriterInitContext into MergeTreeWriter.
fluss-lake/fluss-lake-paimon/src/main/java/org/apache/fluss/lake/paimon/tiering/mergetree/MergeTreeWriter.java Adds an ioTmpDir-aware constructor and uses it to create Paimon IOManager.
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/utils/FlinkConnectorOptionsUtilTest.java Adds tests for Flink tmp-dir derivation and lake tiering tmp-dir option resolution.
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/tiering/source/TieringWriterInitContextTest.java Adds a unit test for TieringWriterInitContext.ioTmpDir().
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/utils/FlinkConnectorOptionsUtils.java Adds helper methods to derive tmp dirs and resolves lake.tiering.io.tmpdir.
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/TieringWriterInitContext.java Extends the init context with an ioTmpDir field and exposes it via WriterInitContext.
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/TieringSplitReader.java Carries ioTmpDir through to TieringWriterInitContext used for lake-writer creation.
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/TieringSourceReader.java Adds constructors/plumbing to pass ioTmpDir down to split readers.
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/TieringSource.java Passes resolved lake-tiering tmp dir into the source reader.
fluss-common/src/test/java/org/apache/fluss/lake/writer/WriterInitContextTest.java Extends test coverage for the new default ioTmpDir() method.
fluss-common/src/main/java/org/apache/fluss/lake/writer/WriterInitContext.java Adds a new default method ioTmpDir() for lake writers.
fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java Introduces lake.tiering.io.tmpdir configuration option and description.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +211 to +217
public static String getFlinkIoTmpDir(
org.apache.flink.configuration.Configuration flinkConfig) {
if (flinkConfig.contains(TMP_DIRS)) {
return new File(flinkConfig.get(CoreOptions.TMP_DIRS), "/fluss").getAbsolutePath();
}
return System.getProperty("java.io.tmpdir") + "/fluss";
}

@luoyuxia luoyuxia 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.

Left three inline comments on configuration propagation, multiple Flink temporary directories, and documentation for the new option.

sourceReaderContext,
connection,
lakeTieringFactory,
getLakeTieringIoTmpDir(flussConf, sourceReaderContext.getConfiguration()));

@luoyuxia luoyuxia Jul 18, 2026

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.

Could we pass or read this option from lakeTieringConfig instead? FlussLakeTiering puts CLI keys starting with lake.tiering. into lakeTieringConfig, while flussConf only contains --fluss.* keys after removing the fluss. prefix. LakeTieringJobBuilder currently passes only flussConfig to TieringSource, so a standard --lake.tiering.io.tmpdir /data/tmp argument is absent here and always falls back to the Flink/JVM temporary directory. Please wire lakeTieringConfig (or the resolved option) into the source.

public static String getFlinkIoTmpDir(
org.apache.flink.configuration.Configuration flinkConfig) {
if (flinkConfig.contains(TMP_DIRS)) {
return new File(flinkConfig.get(CoreOptions.TMP_DIRS), "/fluss").getAbsolutePath();

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.

CoreOptions.TMP_DIRS can contain multiple directories separated by comma, pipe, or the platform path separator. This code treats the entire raw value as one File parent, and Paimon later calls IOManager.create(String), which also treats it as one directory. For example, /disk1/tmp,/disk2/tmp is handled as one combined path instead of two temporary directories. Please parse the value with Flink ConfigurationUtils.parseTempDirectories() and either select one valid directory or pass the resulting directories to Paimon as an array. A multiple-directory test would catch this case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

got it. But I think maybe we should merge this PR #3617 firstly, and then I will change this on that baseline.

+ ConfigOptions.TABLE_DATALAKE_AUTO_EXPIRE_SNAPSHOT
+ " is false.");

public static final ConfigOption<String> LAKE_TIERING_IO_TMP_DIR =

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.

Could we also add this user-facing option to the Datalake Tiering Service Options table in website/docs/maintenance/tiered-storage/lakehouse-storage.md, together with a CLI example? That table currently lists only lake.tiering.auto-expire-snapshot, so users have no documentation showing how to set the new lake.tiering.io.tmpdir option.

@luoyuxia luoyuxia 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.

@zuston Thanks for the pr. Left minor comments


private final Connection connection;

public TieringSourceReader(

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.

public TieringSourceReader(
FutureCompletingBlockingQueue<RecordsWithSplitIds<TableBucketWriteResult>>
elementsQueue,
SourceReaderContext context,
Connection connection,
LakeTieringFactory<WriteResult, ?> lakeTieringFactory) {
this(elementsQueue, context, connection, lakeTieringFactory, (String) null);
}

is not called anymore, seems can be removed.

SourceReaderContext context,
Connection connection,
LakeTieringFactory<WriteResult, ?> lakeTieringFactory,
@Nullable String ioTmpDir) {

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.

When it'll be null? Can we remove Nullable notation?

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.

Disk exhaustion when tiering to paimon

3 participants