Skip to content

Conversation

sercanCyberVision
Copy link
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

Copy link

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