Skip to content

[Improve][Docs] Disable MapStore for engine_finishedJobMetrics in IMap persistence examples - #12328

Open
albgen wants to merge 2 commits into
apache:devfrom
albgen:improve-docs-finished-job-metrics-mapstore
Open

albgen wants to merge 2 commits into
apache:devfrom
albgen:improve-docs-finished-job-metrics-mapstore

Conversation

@albgen

@albgen albgen commented Sep 15, 2026

Copy link
Copy Markdown

Purpose of this pull request

Close #12022.

config/hazelcast.yaml ships without a map section, so the documented engine* MapStore examples are the effective default. This PR adds an engine_finishedJobMetrics override with map-store.enabled: false to each of them (Zeta hybrid/separated deployment, Kubernetes configuration and separated-cluster pages, EN and ZH), plus a short note. engine_runningJobMetrics is already excluded in code by #11244.

Does this PR introduce any user-facing change?

Docs only. With the updated examples, metrics of jobs that finished before a full cluster restart are no longer kept; removing the entry restores the previous behaviour.

How was this patch tested?

All changed YAML blocks parse (PyYAML). The override mechanism was verified on a 2.3.13 single-node deployment with the equivalent pattern engine_*JobMetrics: with the override the metrics maps are not written to the IMap store, without it both are.

Check list

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Problem Does This PR Solve?

config/hazelcast.yaml ships with no map: section, so whatever example a user copies from the docs becomes their effective production configuration. The documented engine* wildcard examples persist every engine* IMap through FileMapStoreFactory, including engine_finishedJobMetrics. As described in the linked issue #12022, that map's value is a full metrics snapshot re-written on every flush into an append-only, never-compacted file store, which grows unbounded and gets fully replayed into heap at startup — this is the same failure mode that caused engine_runningJobMetrics to reach 13 GB and trigger an OutOfMemoryError during master-switch recovery in the companion issue #10329/#11244. engine_runningJobMetrics already got a hardcoded, config-independent fix in FileMapStore.init() (PR #11244), but engine_finishedJobMetrics has no such code-level guard — it is only as safe as whatever the user's map-store config says. This PR closes that documentation gap by adding an explicit engine_finishedJobMetrics: map-store: enabled: false override to every engine* example (HDFS/local/OSS/S3, hybrid and separated cluster deployment, Kubernetes ConfigMap examples), in both English and Chinese, plus a short explanatory note.

1. Code Change Review

1.1 Core Logic Analysis

This is a documentation-only change (no src/main touched). I traced the runtime call chain to verify the claims made in the new note text:

  • Constant.IMAP_FINISHED_JOB_METRICS = "engine_finishedJobMetrics" and EngineStateStoreNames.RUNNING_JOB_METRICS = "engine_runningJobMetrics" are the exact IMap names referenced.
  • FileMapStore.init(...) hardcodes a NoOpMapStorage for engine_runningJobMetrics regardless of config, but has no equivalent branch for engine_finishedJobMetrics — confirming the asymmetry this PR's doc note is built around.
  • JobHistoryService uses finishedJobMetricsImap only for serving /job-info REST responses and for the finished-job cleanup counters; it is never read by CoordinatorService.restoreAllRunningJobFromMasterNodeSwitch(), which only reads runningJobStateIMap. This confirms the note's claim "Job recovery does not depend on this map" against the actual recovery path, not just the PR description.
  • The claim that an exact-name map config (engine_finishedJobMetrics) does not inherit settings from a wildcard config (engine*) matches standard Hazelcast config-resolution semantics (exact match wins outright, no merge with the wildcard entry) — this is a genuinely useful warning, since a user who only adds enabled: true under the exact entry without repeating factory-class-name/properties would silently get a broken or no-op override.

I also verified coverage: every engine*: block in the repository's docs (8 files, confirmed via git grep 'engine\*:' -- 'docs/*') now has a matching engine_finishedJobMetrics: override immediately after it — none were missed, and no unrelated engine* example was left inconsistent.

1.2 Compatibility Impact

Docs-only, no code/API/protocol change. The behavioral note is explicit that this changes the documented example's effective behavior (finished-job metrics after a full restart are no longer kept when following the new example) and explains how to opt back into the old behavior (remove the override) — this is called out correctly as a doc-example change, not a silent default change in the product itself.

1.3 Performance / Side-Effect Analysis

Not applicable — no runtime code touched.

1.4 Error Handling and Logging

Not applicable.

2. Code Quality Assessment

2.1 Coding Standards

The new YAML snippets match the indentation style of the surrounding engine* block in each individual example (some existing examples in this file already used 3-space vs. 4-space indentation inconsistently — that's pre-existing and not something this PR needs to fix, but each new engine_finishedJobMetrics block correctly mirrors its own neighboring engine* block's indent, so every snippet remains valid YAML). The new ### Finished Job Metrics MapStore heading in the Kubernetes configuration docs is left untranslated in the Chinese file, but that matches the existing sibling heading ### Checkpoint Monitor MapStore, which is already untranslated in the same file — consistent with established precedent, not a new inconsistency.

2.2 Test Coverage and Test Stability

No test code touched. The PR description states the YAML blocks were validated with PyYAML and the override behavior was manually verified against a 2.3.13 deployment using the existing engine_runningJobMetrics exclusion as an equivalent pattern; that's a reasonable level of verification for a documentation change. Rating: Stable (no test code, nothing flaky to assess).

2.3 Documentation Updates

This is the documentation update, applied symmetrically to both docs/en and docs/zh. Content-wise it is accurate against the actual source (verified above) and complete against the docs tree (no engine* example left without the corresponding override).

3. Architectural Soundness

3.1 Elegance of the Solution

Appropriately scoped: the PR does not attempt to change product defaults or add a code-level guard, it only fixes the documented example so that following it does not reproduce the OOM/WAL-growth issue from #12022. That matches the scope of the linked issue, which was filed specifically as a docs request.

3.2 Maintainability

The added note text is placed right where a reader would look for it (immediately after the related engine_runningJobMetrics note, and as its own subsection in the Kubernetes doc), reducing the chance of the two notes drifting apart in future edits.

3.3 Extensibility

N/A for a docs change.

3.4 Historical-Version Compatibility

N/A — no code, config schema, or serialization format changed.

4. Issue Summary

No blocking issues found. Two optional, non-blocking suggestions below (not counted as formal Issues since neither affects correctness of what's being merged):

# Suggestion Location Severity
1 Consider a follow-up (separate PR) to give engine_finishedJobMetrics the same code-level FileMapStore guard that engine_runningJobMetrics already has, so correctness doesn't depend on users copying the right example seatunnel-engine-server/.../persistence/FileMapStore.java Low (out of scope for this docs PR)
2 Pre-existing 3-space vs 4-space indentation inconsistency between sibling engine* example blocks in the same files (not introduced by this PR) could be normalized in a future cleanup docs/en/engines/zeta/hybrid-cluster-deployment.md and siblings Low (pre-existing, cosmetic)

5. Merge Recommendation

Conclusion: Ready to merge

  1. Blockers — none.
  2. Recommended fixes — non-blocking, see suggestions #1 and #2 above; both can be addressed in separate follow-up PRs if the maintainers agree they're worth doing.

Overall assessment: this is a well-researched, accurately-targeted documentation fix. I traced every factual claim in the new note text against the actual source (FileMapStore, JobHistoryService, CoordinatorService, EngineStateStoreNames/Constant) rather than taking the PR description at face value, and everything checks out: the map name is correct, the "job recovery does not depend on this map" claim holds against the real master-switch recovery path, the Hazelcast exact-vs-wildcard config note is accurate, and the fix covers every affected example in both languages with no gaps. CI is green (Build/labeler/notify checks all passed) and the diff applies cleanly against current dev. Nice work, and thank you for tracing this all the way from the production issue back to the exact doc examples that needed the fix — this is a genuinely useful contribution.

@davidzollo

davidzollo commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

@albgen Would it be better to set the default value of enabled for map-store to true?

@albgen Are you in the contributor channel of SeaTunnel Slack? We can discuss this issue on Slack.

Please ignore the following message if you have joined in the Slack~

To facilitate focused communication among contributors, we’ve created a brand-new dedicated #contributors channel in official Slack workspace.
Slack workspace link: https://s.apache.org/seatunnel-slack

This channel is designed for technical discussions, feature design brainstorming, roadmap sync and direct communication with project core Contributors. Everyone who contributes code, docs, test cases or community ideas is warmly invited to join, share thoughts and collaborate together under The Apache Way. Welcome to join 😄

@DanielLeens

Copy link
Copy Markdown
Contributor

@davidzollo Good question, and worth being precise here since the two readings of "default" point in opposite directions.

With the documented example (map: engine*: map-store: enabled: true), engine_finishedJobMetrics already inherits enabled: true from the engine* wildcard match, since there was previously no exact-match entry for it. That inherited true is exactly what causes the unbounded MapStore/WAL growth described in #12022 — flipping the default to true wouldn't change anything, because it is already effectively true via wildcard inheritance today. What's missing is the opt-out, which is what this PR adds.

If instead you meant "should we harden this at the code level instead of relying on every doc example getting the override right" — I'd agree that's more robust, and I flagged exactly that as a non-blocking follow-up suggestion in my review: giving engine_finishedJobMetrics the same hardcoded NoOpMapStorage guard that FileMapStore.init() already applies to engine_runningJobMetrics (seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/persistence/FileMapStore.java:46-53), so correctness wouldn't depend on users copying the right YAML at all.

I'd keep that as a separate follow-up PR rather than folding it into this one, though: it's a behavior/data-retention change to production code (finished-job metrics would stop persisting even for users who never touch their hazelcast.yaml), so it deserves its own scoped review and tests. This PR is correctly scoped to just fix the documented example so it matches the guard engine_runningJobMetrics already has in code. Happy to review that follow-up if either of you wants to open it.

@davidzollo davidzollo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider my suggestion, please leave a message if you have any other suggesion.

@github-actions github-actions Bot removed the reviewed label Sep 18, 2026
@DanielLeens

Copy link
Copy Markdown
Contributor

@davidzollo Thanks for the follow-up review. To make sure this doesn't stay stuck on a misunderstanding: my 2026-09-16 comment wasn't disagreeing with you in principle, just pointing out that "default" has two different meanings here, and they lead to different fixes.

  • If "default" means the documented example's map: engine*: map-store: enabled: true — that's already effectively true for engine_finishedJobMetrics today via wildcard inheritance, since there's no exact-match override. Setting it to true explicitly would be a no-op; it doesn't change today's behavior at all, and doesn't touch the unbounded-growth problem in [Improve][Docs] Do not persist engine_finishedJobMetrics in the documented MapStore configuration #12022. What actually fixes that is the opt-out this PR adds (engine_finishedJobMetrics: map-store: enabled: false).
  • If instead you meant "the product's actual code-level default should be false for this map regardless of what a user's hazelcast.yaml says" — I agree that's the more robust fix, and it's exactly the follow-up I flagged in my original review: give engine_finishedJobMetrics the same hardcoded NoOpMapStorage guard in FileMapStore.init() that engine_runningJobMetrics already has (seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/persistence/FileMapStore.java:46-53). That's a behavior/data-retention change to production code, not a docs change, so I'd still keep it out of this PR and do it as its own scoped PR with its own tests.

So: if your CHANGES_REQUESTED is about the second reading, I don't think it should block this docs fix — it's a separate, larger change that deserves its own review. If it's about the first reading, I don't think there's anything left to change, since the value is already true by inheritance today and this PR is what actually closes the gap.

@albgen, no action needed on your side unless @davidzollo has a different, more specific ask than what's outlined above — happy to help scope the code-level follow-up if either of you wants to open it.

@DanielLeens DanielLeens left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying the operational tradeoff. I reviewed all eight documentation files and traced the corresponding map-selection and history-storage code. The examples now clearly distinguish their explicit opt-out from a product default, explain the full-restart retention effect, and give a complete way to re-enable persistence.

What problem this PR solves

  • User pain: Deployments copying the broad engine* MapStore examples also persist finished-job metrics, producing avoidable observability-state writes.
  • Fix approach: Add exact-name disabled MapStore entries for finished metrics and explain their retention and re-enablement semantics in both languages.
  • One-line summary: Make finished-metrics persistence an explicit choice in the deployment examples.

Example: A cluster using an example retains job recovery maps in its configured backend, but after every member restarts it no longer reloads the finished-metrics map. Operators wanting those metrics retained can remove the exact-name override.

1. Code-change review

1.1 Core logic analysis

Eight EN/ZH hybrid, separated and Kubernetes deployment documents, +154 lines; no production source or packaged default configuration changes. The complete target-relative diff was read at 2c565fac9fbd1d7a889bca1d13b52d22e7b43595, not just the latest commit. Operational documentation/configuration-example change.

Before / after:

Before: engine* -> enabled FileMapStore also selects engine_finishedJobMetrics
After: engine* remains enabled; exact engine_finishedJobMetrics -> enabled:false
       remove exact entry -> wildcard config selected again
       or configure full exact MapStore block, factory and backend properties
       enabled:true alone does not merge in wildcard settings

Complete relevant execution chain:

Operator copies documented YAML -> Hazelcast Config selects map configuration
  -> Config.findMapConfig / ConfigUtils.lookupByPattern choose exact entry before wildcard
  -> exact disabled MapStore: finished metrics remain in the distributed in-memory map
JobMaster final metrics -> JobHistoryService.store metrics:268-270
  -> engine_finishedJobMetrics.put(..., finishedJobExpireTime, MINUTES)
  -> REST/history access -> getJobMetrics():232 / JobInfoService
Full cluster restart -> no MapStore reload for that exact map
Recovery/checkpoint maps still use engine* configuration
FileMapStore.init():46-53 separately hardcodes a no-op only for running metrics

Key findings:

  1. Ordinary deployments using these examples reach the new exact-name map configuration. Existing user files and packaged defaults do not change automatically.
  2. The explicit restart warning accurately describes the loss of pre-restart finished metrics; it does not claim job recovery depends on them.
  3. Re-enablement now preserves the configuration-selection contract: exact entries replace rather than inherit the wildcard MapStore settings.
  4. This reduces writes for the chosen map; it is not a runtime fix for every map or a general WAL compaction guarantee.
  5. No blocking documentation/configuration finding remains.

Community context: @davidzollo's CHANGES_REQUESTED asks about enabled:true as a default. I respectfully retain the distinction from the earlier discussion: the existing engine* example already enables persistence for this map unless an exact override is present; setting it true again would not implement this opt-out. A hardcoded production default is a separate behavior/retention change. This head now states the distinction explicitly. That independent maintainer change request still needs its owner or another authorized maintainer to resolve.

1.2 Compatibility impact

Existing deployments are compatible; adopting the new examples intentionally changes finished-metrics retention. No Java API, option name, serialization, wire protocol or product default changes. The deployment instructions explicitly describe the operational migration: retain the old persistence behavior by removing the exact override, or supply a complete enabled exact MapStore block. No runtime incompatible-changes entry is required for an opt-in example change.

1.3 Performance / side effects

Adopting the example removes backend writes and reloads for one observability map. In-memory finished metrics and TTL still exist. There are no new task locks, retry loops, network calls or threads; reduced backend I/O must be weighed against loss of historical metrics across a full cluster restart. This does not alter checkpoint idempotency or recovery resource ownership.

1.4 Error handling and logging

No exception or logging implementation changes. The opt-in instructions include factory and backend properties, avoiding an enabled MapStore with no configured persistence implementation. Credentials remain placeholders; no real secret is added.

No blocking findings. Previous numbered findings are closed as described above; no new formal issue is raised.

2. Code-quality assessment

2.1 Code conventions

Only existing docs are changed. YAML entries are at the same map-name level as engine*; no new core method or field is introduced. The scoped whitespace check produced no entries.

2.2 Test coverage and stability

No UT/E2E source changes; a new-test stability rating is not applicable. No local build, unit/integration test, container or service was run. Static reads covered all eight diffs, FileMapStore, JobHistoryService, REST metrics consumers, and Hazelcast 4.1.8 and the project's 5.1 source selection. The latter performs exact lookup before pattern matching, rather than merging map configs. This is also described in the official Hazelcast map documentation.

Exact-head fork Build 40192601656 is completed/cancelled at 2c565fa. Apache returned no current checks. Cancellation is not success and does not establish a source failure or an upstream fix; obtain a completed current-head run. There is no evidence here to prescribe an unrelated dependency patch or a sync-first CI cure.

2.3 Documentation

Both languages now describe the same opt-out, unchanged product defaults, restart retention and complete re-enablement procedure. Each affected deployment mode contains the corresponding note.

3. Architectural soundness

3.1 Solution quality

A focused documentation-level opt-out; a runtime retention-default change should remain a separately reviewed change.

3.2 Maintainability

The notes explain why the exact entry exists and prevent future enabled-only edits from silently dropping the persistence factory.

3.3 Extensibility

Keep shared options linked to their actual definitions and connector-specific limits explicit. No new extension API is introduced.

3.4 Historical compatibility

Existing user YAML is unchanged. Operators copying the new example are explicitly told how to preserve historical finished-metrics persistence.

4. Findings summary

No blocking source/documentation findings.

5. Merge conclusion

Conclusion: Can merge

  1. Blocking items: No source blocker from Daniel. Obtain completed required CI and resolve @davidzollo's independent review request through an authorized maintainer.
  2. Non-blocking recommendations: Keep any global runtime-default or WAL-compaction change separately scoped and tested.

I support this clarified documentation change once the independent review and CI gates are resolved. The alternative of hardcoding persistence off has a wider production-retention impact and should not be silently folded into these examples.

Compare against dev: diverged, ahead 2 / behind 303, merge conflict=False. Drift is recorded independently; it does not itself justify a sync-first comment without an unrelated CI failure.

Daniel has READ permission. This COMMENT is a technical assessment, not an effective write-level approval. Daniel's technical assessment is clear; it does not dismiss @davidzollo's independent CHANGES_REQUESTED or replace the write-capable maintainer approval gate.

Local evidence: exact-head fetch/checkout on seatunnel-review-12328, complete diff and source call-chain reads cited above. No runtime verification was claimed.

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks for the contribution. The CI fact cited in my previous conclusion has changed; this follow-up updates that gate on the unchanged reviewed head, without issuing another full source review.

Gate snapshot (2026-10-28T15:56:07+00:00), head 2c565fac9fbd1d7a889bca1d13b52d22e7b43595: Build is TIMED_OUT.

The blocking jobs are Run / Dead links failure; Run / Build website cancelled.

The Dead links log identifies two HTTP 429 responses: the DeepWiki project URL and its remote badge URL in README. Build website was cancelled, so it is not evidence of a separate executed website compiler failure. Latest dev uses a local DeepWiki badge but still links the external project page; a sync alone is not a cure for that external rate limit. Please rerun only Dead links after the rate limit clears, keeping unrelated documentation/dependency changes out of this PR. The independent reviewer decision remains separate.

My previous source conclusion remains clear for the reviewed scope. CI is not being passed by inference, and this follow-up is not an effective approval.

Comparison recorded in this scan: base dev, diverged, ahead 2 / behind 348, no merge conflict. Branch drift is metadata here and is not an additional sync request.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improve][Docs] Do not persist engine_finishedJobMetrics in the documented MapStore configuration

3 participants