[MINOR][SS][TEST] Use a managed temp dir for the checkpoint in KafkaRealTimeIntegrationSuite - #58212
Open
Kino1994 wants to merge 1 commit into
Open
[MINOR][SS][TEST] Use a managed temp dir for the checkpoint in KafkaRealTimeIntegrationSuite#58212Kino1994 wants to merge 1 commit into
Kino1994 wants to merge 1 commit into
Conversation
…ealTimeIntegrationSuite
`Files.createTempDirectory("some-prefix").toFile.getName` keeps only the last
segment of the created path, so the checkpointLocation is a relative path that
Spark resolves against the working directory. Every run of the suite therefore
leaves two directories behind: the temp directory that was created and never
used, and the checkpoint itself, written into the module directory as an
untracked `connector/kafka-0-10-sql/some-prefix*` and never cleaned up.
Use `Utils.createTempDir().getCanonicalPath`, as the rest of the module's tests
do. It is absolute, lives under `java.io.tmpdir`, and is removed on JVM exit.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
uros-b
approved these changes
Aug 22, 2026
Member
|
LGTM, thank you @Kino1994! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Use a managed temp directory for the
checkpointLocationof thee2e statelesstest inKafkaRealTimeIntegrationSuite:java.nio.file.Fileswas only used by that line, so its import is dropped.Why are the changes needed?
Files.createTempDirectory(...)returns the full path of the directory it creates, but.toFile.getNamekeeps only the last segment of it:So the option is a relative path, which Spark resolves against the working directory. Each run of the suite leaks two directories, neither of which is cleaned up:
java.io.tmpdirconnector/kafka-0-10-sql/some-prefix<N>The second one is not covered by
.gitignore, so it shows up as untracked ingit statusfor anyone who runs the module's tests. After two full runs ofsql-kafka-0-10locally:The suffixes pair up, one pair per run.
Utils.createTempDir()is what the rest of the module already uses for this: it is absolute, lives underjava.io.tmpdir, and is deleted on JVM exit. The other fivecheckpointLocationusages inconnector/kafka-0-10-sqlall pass an absolute path from a managed temp directory; this line was the only one that did not.Does this PR introduce any user-facing change?
No. Test-only.
How was this patch tested?
Ran
KafkaRealTimeIntegrationSuiteand confirmed the test still passes and that nosome-prefix*directory is left behind afterwards, in the module directory or undertarget/tmp.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5)