[FLINK-37155][historyserver] Decouple remote archive retention from local processing limit - #29008
Open
argoyal2212 wants to merge 2 commits into
Open
Conversation
Collaborator
argoyal2212
force-pushed
the
argoyal+01/flink-decouple-remote-retention
branch
from
August 25, 2026 03:59
67ac6ed to
5a0f088
Compare
…ocal processing limit Adds historyserver.archive.retain-remote-beyond-local-limit (default false, backward compatible). When enabled, job archives beyond historyserver.archive.retained-jobs are no longer polled/processed locally, but are kept in the remote archive directory instead of being deleted. Such archives remain reachable on demand via the existing lazyFetchArchiveProactively on-demand fetch path when historyserver.archive.load.mode is set to LAZY. This closes a gap left after FLINK-39911/FLINK-40097 introduced the pluggable ArchiveStorage backend and on-demand lazy archive loading: retainedStrategy.shouldRetain() still gated both local processing and remote deletion together, so operators could not keep an unbounded remote archive history while only actively polling/caching a small recent window locally. This addresses the remaining scope of FLIP-505 / FLINK-37155: the on-demand per-job fetch and recently-viewed-job prioritization goals of that FLIP are already covered by FLINK-39911/FLINK-40097; this change covers the remaining decouple-local-vs-remote-retention goal. - HistoryServerOptions: new HISTORY_SERVER_RETAIN_REMOTE_BEYOND_LOCAL_LIMIT option. - HistoryServerArchiveFetcher: new constructor overload taking the flag; scanArchives() now routes archives beyond the retained limit to a new cleanupLocalArchivesBeyondRetainedLimit() (local-only cleanup) instead of cleanupArchivesBeyondRetainedLimit() (local+remote) when enabled. - HistoryServer: reads and wires the new option into the job archive fetcher. - Regenerated docs/layouts/shortcodes/generated/history_server_configuration.html. - Added HistoryServerArchiveFetcherTest coverage for both the default (remote-deleted) and opted-in (remote-retained, still fetchable on-demand) behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
argoyal2212
force-pushed
the
argoyal+01/flink-decouple-remote-retention
branch
from
August 25, 2026 04:10
5a0f088 to
22abdde
Compare
There was a problem hiding this comment.
Pull request overview
This PR decouples local HistoryServer archive processing limits from remote job-archive retention through an opt-in configuration option.
Changes:
- Adds
historyserver.archive.retain-remote-beyond-local-limit, defaulting tofalse. - Implements local-only cleanup for archives beyond the local limit.
- Wires the option through
HistoryServer. - Adds File/RocksDB coverage and regenerates configuration documentation.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Reviewed changes |
|---|---|
flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/history/HistoryServerArchiveFetcherTest.java |
Adds tests for default deletion and configured remote retention behavior. |
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerArchiveFetcher.java |
Implements local-only cleanup. Moderate (4 votes): TTL-expired archives can be incorrectly retained remotely when the local count limit is -1; the local-only path should distinguish count-limit rejection from TTL expiry. |
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java |
Reads and wires the new option. Nit (4 votes): Log the effective retention behavior during initialization. |
flink-core/src/main/java/org/apache/flink/configuration/HistoryServerOptions.java |
Defines the new public configuration option. |
docs/layouts/shortcodes/generated/history_server_configuration.html |
Documents the new configuration option. |
Suppressed comments (1)
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java:295
- The new tests exercise the fetcher constructor directly, but none instantiate
HistoryServerwith this option. A regression in this configuration read/pass-through would leave the public option ineffective while all added tests still pass; add a HistoryServer-level test that sets the option and verifies remote retention.
boolean retainRemoteBeyondLocalLimit =
config.get(HistoryServerOptions.HISTORY_SERVER_RETAIN_REMOTE_BEYOND_LOCAL_LIMIT);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
TTL-expired archives are now always deleted remotely regardless of retainRemoteBeyondLocalLimit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
HistoryServerOptions.HISTORY_SERVER_RETAINED_JOBScurrently gates both (a) which archives theHistoryServerpolls/processes locally, and (b) which archives are deleted from the remote archive directory. This means operators cannot keep a large/unbounded remote job-archive history while only actively refreshing a small recent window locally — trimming the local processing window also deletes the "older" jobs remotely.This closes that gap, which is what FLIP-505 originally set out to solve, before FLIP-584/585 (FLINK-39911, FLINK-40097) landed a more general pluggable
ArchiveStoragebackend + on-demand lazy-fetch mechanism that already covers FLIP-505's other goals (per-job on-demand fetch, avoiding local disk/inode exhaustion via a pluggable storage backend). This PR adds the one remaining piece: decoupling remote retention from the local processing limit.Brief change log
historyserver.archive.retain-remote-beyond-local-limit(boolean, defaultfalse, fully backward compatible).HistoryServerArchiveFetcher.scanArchives(): when enabled, archives beyondhistoryserver.archive.retained-jobsare cleaned up locally only (newcleanupLocalArchivesBeyondRetainedLimit), leaving the remote archive intact, instead of callingcleanupArchivesBeyondRetainedLimit(which deletes both local and remote).lazyFetchArchiveProactivelypath whenhistoryserver.archive.load.mode=LAZY.HistoryServerreads and wires the new option into the job-archive fetcher (applications are unaffected — this only applies to job archives, matching FLIP-505's original scope).docs/layouts/shortcodes/generated/history_server_configuration.html.Verifying this change
This change added tests and can be verified as follows:
HistoryServerArchiveFetcherTest#testArchivesBeyondRetainedLimitAreDeletedFromRemoteByDefaultand#testArchivesBeyondRetainedLimitAreKeptRemotelyWhenConfigured, covering both storage backends (File/RocksDB), asserting: default behavior is unchanged (remote archive deleted beyond limit); with the flag enabled, the remote archive persists, is not locally cached, and is still fetchable on demand.HistoryServerArchiveFetcherTestpass locally.Does this pull request potentially affect one of the following parts?
@Public(Evolving): yes, one new@PublicEvolvingConfigOptionDocumentation