Skip to content

HIVE-29225: Premature deletion of scratch directories during output streaming#6099

Closed
sercanCyberVision wants to merge 1 commit into
apache:masterfrom
sercanCyberVision:scratchdir-cleaning-grace-period
Closed

HIVE-29225: Premature deletion of scratch directories during output streaming#6099
sercanCyberVision wants to merge 1 commit into
apache:masterfrom
sercanCyberVision:scratchdir-cleaning-grace-period

Conversation

@sercanCyberVision
Copy link
Copy Markdown
Contributor

@sercanCyberVision sercanCyberVision commented Sep 24, 2025

ROOT-CAUSE:
Please see https://issues.apache.org/jira/browse/HIVE-29225 for the detailed problem description and steps to reproduce. In short, scratch directories may be deleted prematurely while Hive is still streaming output to the client.

SOLUTION:
A new configuration property has been introduced:

hive.scratchdir.cleanup.grace.period.hours

This property defines a grace period to prevent cleanup of scratch directories that have been modified within the specified time window.

  • Default value is 0h (disabled by default).
  • When Hive finishes output streaming, it updates the scratch directory’s last modified time.
  • The cleanup logic now checks this timestamp and skips deletion if the directory was updated within the grace period.

This ensures directories are not removed prematurely while still in use.

TESTING:
Added a dedicated unit test to validate the new functionality:
the-test

Verified that all existing tests in TestClearDanglingScratchDir continue to pass:
scratch-dir-tests

@sonarqubecloud
Copy link
Copy Markdown

@sercanCyberVision
Copy link
Copy Markdown
Contributor Author

Hello @deniskuzZ ,
You previously reviewed and approved the ClearDanglingScratchDir.java changes in PR #4403.
Could you please take a look at this PR as well?

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 6, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.

@github-actions github-actions Bot added the stale label Dec 6, 2025
@sercanCyberVision
Copy link
Copy Markdown
Contributor Author

Hi @difin,
Can you please review this PR?

@github-actions github-actions Bot removed the stale label Dec 9, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 7, 2026

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.

@github-actions github-actions Bot added the stale label Feb 7, 2026
@github-actions github-actions Bot closed this Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants