Skip to content

(wip) docs(optimizer-analyzer): architecture + sequence diagrams#600

Draft
mkuchenbecker wants to merge 1 commit into
mainfrom
mkuchenb/optimizer-analyzer-docs
Draft

(wip) docs(optimizer-analyzer): architecture + sequence diagrams#600
mkuchenbecker wants to merge 1 commit into
mainfrom
mkuchenb/optimizer-analyzer-docs

Conversation

@mkuchenbecker
Copy link
Copy Markdown
Collaborator

Status

(WIP) — draft, ready for review.

Branch is off linkedin/main. The doc describes the Optimizer Analyzer as introduced by PR #533 (mkuchenb/optimizer-3); referenced symbols (@Transactional on analyzeDatabase, TableOperationsHistoryDto::after, CadencePolicy::intervalFor) come online when #533 merges. The doc itself is forward-looking and merges independently.

Summary

Hand-written architecture + sequence documentation for apps/optimizer-analyzer/.

  • apps/optimizer-analyzer/docs/architecture.md — narrative
  • apps/optimizer-analyzer/docs/diagrams/component.puml + .png
  • apps/optimizer-analyzer/docs/diagrams/sequence.puml + .png

PlantUML source is committed so the diagrams are regenerable; rendered PNGs are committed so the markdown displays on GitHub without extra tooling.

Diagrams

Component view: AnalyzerApplication → AnalyzerRunner → (OperationAnalyzer strategy + 3 repos) → MySQL. The contract with the Scheduler is the table_operations table; no direct call.

Sequence view (one operation type, one analyzer pass):

  • Per-process startup: lookup analyzer, fan out across databases via statsRepo.findDistinctDatabaseNames().
  • Per-database fan-out: @Transactional analyzeDatabase(...).
  • Pre-load: 3 reads in order — ops → history → stats — bounded by tables-per-db.
  • Per-table evaluation: isEnabledshouldSchedule (3-branch CadencePolicy.shouldSchedule — active op / no history / has-history with intervalFor cadence) → save PENDING row inside a per-row try/catch+continue.
  • INFO aggregate per database; DEBUG per table.

Iteration

Sequence diagram was iterated on visually against the rendered PNG. Two corrections applied:

  1. Repo participant order: switched to Ops → Hist → Stats so the 3 pre-load arrows flow left-to-right instead of crossing.
  2. CadencePolicy alt: expanded from 2 cases to the correct 3 (active op / no history / has-history-with-cadence-check) — latestHistory.map(readyAfter).orElse(true) is two real paths in the code.

Out of scope

  • Scheduler architecture (separate doc / ticket).
  • Authn/authz, observability, REST-trigger endpoints — all tracked via dedicated tickets linked in the doc.

🤖 Generated with Claude Code

Component and sequence diagrams for the Optimizer Analyzer
(apps/optimizer-analyzer/). Source is PlantUML; PNGs are committed so
GitHub renders the markdown without extra tooling.

The doc describes the analyzer as introduced in PR #533 (mkuchenb/
optimizer-3). It lands on main as forward-looking documentation; the
referenced symbols (TableOperationsHistoryDto::after, CadencePolicy::
intervalFor, @transactional analyzeDatabase) come online when PR #533
merges.

Files:
- apps/optimizer-analyzer/docs/architecture.md — narrative + diagrams
- apps/optimizer-analyzer/docs/diagrams/component.puml + .png
- apps/optimizer-analyzer/docs/diagrams/sequence.puml + .png

Sequence diagram iterated for correctness against the actual source on
mkuchenb/optimizer-3: 3 pre-load reads in (ops, history, stats) order,
three-branch CadencePolicy alt (active op / no history / has history),
per-row try/catch+continue with aggregate INFO log per database.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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