feat(optimizer): [3/N] Analyzer app#533
Draft
mkuchenbecker wants to merge 2 commits intomkuchenb/optimizer-2from
Draft
feat(optimizer): [3/N] Analyzer app#533mkuchenbecker wants to merge 2 commits intomkuchenb/optimizer-2from
mkuchenbecker wants to merge 2 commits intomkuchenb/optimizer-2from
Conversation
…ling Introduces apps/optimizer-analyzer, a Spring Boot CommandLineRunner that evaluates every table in table_stats against pluggable OperationAnalyzer strategies. The first strategy, OrphanFilesDeletionAnalyzer, schedules OFD operations with 24h success / 1h failure retry cadence, a 6h SCHEDULED timeout, and a 5-strike circuit breaker. Key design choices: - Bulk-loads operations and history into maps (one query per type), then iterates the stats list — O(types) queries, not O(tables). - Uses the existing generic find() repository methods with null params. - Pure unit tests with Mockito — no Spring context needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Apr 7, 2026
mkuchenbecker
commented
Apr 7, 2026
...mizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/model/TableOperationRecord.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/CadencePolicy.java
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
mkuchenbecker
commented
Apr 7, 2026
apps/optimizer-analyzer/src/main/java/com/linkedin/openhouse/analyzer/AnalyzerRunner.java
Outdated
Show resolved
Hide resolved
- Rename TableSummary to Table, TableOperationRecord to TableOperation - Add Table.from(TableStatsRow) and TableOperation.from(TableOperationRow) - Add TableOperation.pending(Table, type) factory and toRow() for JPA - Move circuit breaker check into OperationAnalyzer as overridable default - Parameterize analyze() with optional filters (optype, db, table, uuid) - Inline loadOpsMap, loadHistoryMap, remove standalone converter methods - Expand CadencePolicy field javadoc with plain-english examples - Add TODOs: per-db iteration, benchmarking, querybuilder, CB reset Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mkuchenbecker
commented
Apr 7, 2026
| .collect(Collectors.toList()); | ||
|
|
||
| // Pre-load the small sides of the joins — one query per analyzer type. | ||
| // TODO: Move to a query builder (Criteria API or jOOQ) as filter count grows. |
Collaborator
Author
There was a problem hiding this comment.
remove this todo or move it to where we have a null,null,null when querying the history repo.
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.
Optimizer Stack
Summary
PR 3 of N in the optimizer stack.
Overall Project
Service Design doc.
Introduces
apps/optimizer-analyzer, a Spring Boot CommandLineRunner that evaluates every table intable_statsagainst pluggableOperationAnalyzerstrategies. The first strategy,OrphanFilesDeletionAnalyzer, schedules OFD operations with 24h success / 1h failure retry cadence, a 6h SCHEDULED timeout, and a 5-strike circuit breaker.Key design choices:
find()repository methods with null params.Changes
Core:
AnalyzerRunner— loads table_stats, pre-loads operations and history into maps, evaluates each table against all analyzers, circuit breaker logic.Strategy interface:
OperationAnalyzer—isEnabled(table),shouldSchedule(table, currentOp, latestHistory),getCircuitBreakerThreshold().Cadence policy:
CadencePolicy— encapsulates time-based retry logic shared across operation types.OFD analyzer:
OrphanFilesDeletionAnalyzer— enabled viamaintenance.optimizer.ofd.enabledtable property.Testing Done
25 unit tests:
AnalyzerRunnerTest(7 tests) — eligible table insertion, cadence skip, disabled table, shouldSchedule=false, null UUID, circuit breaker trip, below-threshold passOrphanFilesDeletionAnalyzerTest(18 tests) — isEnabled variants, shouldSchedule for no-op/PENDING/SCHEDULING/SCHEDULED with history combinationsAdditional Information