Skip to content

Conversation

FQHSLycopene
Copy link
Contributor

What problem are we solving?

Currently, when configuring TTL for a specific path prefix using fs.configure, the TTL is incorrectly applied to both files and directories. This leads to directories being deleted prematurely before their contained files expire, making valid files inaccessible through the filesystem interface. This issue affects scenarios where path-specific TTLs are used to manage file lifecycles, particularly in log management and temporary file storage systems.

Reference: Issue #6820

How are we solving the problem?

  • Modified the CreateEntry function to set TTL of directories to zero
  • Ensures directories persist until all contained files have expired
  • Maintains consistent access to valid files through the filesystem interface
  • Preserves the original TTL behavior for files while preventing premature directory deletion

How is the PR tested?

  1. Unit tests added to verify directory TTL behavior
  2. Manual testing scenarios:
    • Created a directory with path-specific TTL configuration
    • Uploaded files to the directory
    • Verified directory persistence after file TTL expiration
    • Confirmed files remain accessible until their individual TTLs expire
    • Tested with various TTL durations and file types

Checks

  • I have added unit tests
  • I will add related wiki document changes and link to this PR after merging
  • The changes maintain backward compatibility
  • The code follows the project's coding style

Additional Notes

This fix ensures that directories remain accessible as long as they contain valid files, improving the reliability of TTL-based file management systems. The change is particularly important for applications that rely on path-specific TTL configurations for log rotation and temporary file management.

Commit: b8f2eb9

@chrislusf chrislusf merged commit ee0c146 into seaweedfs:master May 29, 2025
7 of 8 checks passed
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.

2 participants