Skip to content

[SPARK-56044][CORE] HistoryServerDiskManager does not delete app store on release when app is not in active map#54877

Open
sl3635 wants to merge 1 commit intoapache:masterfrom
sl3635:SPARK-56044
Open

[SPARK-56044][CORE] HistoryServerDiskManager does not delete app store on release when app is not in active map#54877
sl3635 wants to merge 1 commit intoapache:masterfrom
sl3635:SPARK-56044

Conversation

@sl3635
Copy link

@sl3635 sl3635 commented Mar 18, 2026

What changes were proposed in this pull request?

HistoryServerDiskManager.release() skips the store directory deletion when the application is not present in the in-memory active map. This happens because the directory operation is nested inside an oldSizeOpt.foreach block, which only executes when the app was actively tracked.

The active map is in-memory only and is empty after a History Server restart. When log expiration triggers release(delete=true) for an app that was never reopened after a restart, the on-disk store directory (.ldb / .rdb) is never deleted, causing orphaned store directories to accumulate indefinitely.

This PR separates the updateUsage deduction (which applies only to actively tracked apps) from the directory operation (which should apply whenever the directory exists on disk). When deleting an app not in the active map, its size is derived directly from disk before deduction to keep usage accounting accurate.

Why are the changes needed?

Without this fix, orphaned .ldb/.rdb store directories are never cleaned up after a History Server restart, causing unbounded disk usage growth.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added a new test SPARK-56044: release with delete cleans up store when app is not in active map in HistoryServerDiskManagerSuite that simulates a History Server restart and verifies that release(delete=true) correctly deletes the store directory, removes the listing entry, and zeroes out usage accounting when the app is not in the active map.

…e on release when app is not in active map
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.

1 participant