hive icon indicating copy to clipboard operation
hive copied to clipboard

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

Open sercanCyberVision opened this issue 4 months ago • 4 comments

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

sercanCyberVision avatar Sep 24 '25 02:09 sercanCyberVision

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?

sercanCyberVision avatar Oct 06 '25 17:10 sercanCyberVision

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 [email protected] list if the patch is in need of reviews.

github-actions[bot] avatar Dec 06 '25 00:12 github-actions[bot]

Hi @difin, Can you please review this PR?

sercanCyberVision avatar Dec 08 '25 06:12 sercanCyberVision