Repository navigation
Fixes 30008: Improve server startup and write-path latency - #30009
Conversation
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
✅ TypeScript Types Auto-UpdatedThe generated TypeScript types have been automatically updated based on JSON schema changes in this PR. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 82 out of 85 changed files in this pull request and generated no new comments.
Suppressed comments (1)
common/src/main/java/org/openmetadata/common/utils/CommonUtil.java:59
classpathResourceIndexcaches every resource entry from all openmetadata/collate JARs and directories (seeindexResourcesFromJarFileadding every ZipEntry). This can be very large and is never bounded/evicted, increasing steady-state heap usage and risking OOM on deployments with large classpaths.
Consider caching per-pattern results with an LRU/size cap (the set of patterns is small), or at least filtering the indexed resources to the known prefixes you query (e.g., json/schema/, json/data/) so the cached index cannot grow to the full JAR contents.
private static final List<String> JAR_NAME_FILTER = List.of("openmetadata", "collate");
private static volatile List<ClasspathResource> classpathResourceIndex;
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 83 out of 86 changed files in this pull request and generated no new comments.
Suppressed comments (2)
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:690
createMissingIndexswallows the stack trace by logging onlyexception.getMessage(). This makes diagnosing index-creation failures (e.g., auth, cluster state, mapping issues) much harder during startup because the root cause and stack are lost. Log the throwable as the last argument to SLF4J instead.
openmetadata-service/src/test/java/org/openmetadata/service/monitoring/RequestLatencyContextTest.java:682- This assertion compares SLA bucket boundaries using
Duration.toNanos(), butTimerhistogram bucket boundaries are reported in the timer base unit (seconds). This will cause the test to fail (and may also include an extra +Inf bucket depending on registry). Convert expected buckets to seconds and compare against the prefix of the actual bucket array.
…s-startup-latency # Conflicts: # ingestion/tests/unit/topology/database/test_unitycatalog_error_isolation.py # openmetadata-ui/src/main/resources/ui/playwright/e2e/VisualRegression/__snapshots__/staticPages.spec.ts-snapshots/incident-manager.png
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 83 out of 85 changed files in this pull request and generated no new comments.
Suppressed comments (2)
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:690
- The catch block logs only
exception.getMessage()and drops the throwable, which makes diagnosing index-creation failures much harder (no stack trace / root cause). Log the exception as the last argument instead.
openmetadata-service/src/main/java/org/openmetadata/service/resources/CollectionRegistry.java:178 - This warning logs only
ex.getMessage()and drops the throwable, which makes diagnosing startup failures (resource constructor/init errors) much harder. Log the exception itself so the stack trace is available.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 83 out of 85 changed files in this pull request and generated no new comments.
Suppressed comments (4)
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:842
- When live fingerprint verification fails, the log drops the stack trace by only logging
exception.getMessage(). This makes it hard to diagnose why template verification failed (auth issues, API compatibility, parsing errors) and could lead to repeated rebuilds without actionable logs.
openmetadata-service/src/main/java/org/openmetadata/service/resources/CollectionRegistry.java:215 - This
LOG.warncall won’t include the exception stack trace becauseexis being used as a formatting argument for the{}placeholder. In SLF4J, the throwable must be passed as the last parameter without a matching placeholder to get a stack trace.
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:690 createMissingIndexswallows the exception stack trace by logging onlyexception.getMessage(). This makes diagnosing index/alias creation failures (mapping errors, auth failures, cluster issues) much harder in production logs.
This issue also appears on line 839 of the same file.
openmetadata-service/src/main/java/org/openmetadata/service/resources/CollectionRegistry.java:178
- Resource registration failures only log
ex.getMessage(), which drops stack traces and root cause details (e.g., constructor resolution issues, dependency failures). That makes startup failures much harder to debug.
This issue also appears on line 212 of the same file.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 85 out of 87 changed files in this pull request and generated no new comments.
Suppressed comments (1)
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:756
skippedis always 0 here because it subtractsfailed(which is initialized tobuildResult.failures()); for each entity mapping, you either add a template or count a build failure, soentityIndexMap.size() - templates.size() - buildFailurescancels out. This makes the logged "Skipped" count misleading, and also mixes build-time failures with update-time failures in a singlefailedcounter.
Consider tracking build failures vs update failures separately, and compute skipped as the number of mappings that were not attempted (size - templates.size()).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 85 out of 87 changed files in this pull request and generated no new comments.
Suppressed comments (3)
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:690
- This catch logs only
exception.getMessage()and drops the stack trace/cause chain, which makes index-init failures hard to diagnose (especially now that initialization can run in parallel). Log the throwable so the full root cause is preserved.
openmetadata-service/src/main/java/org/openmetadata/service/resources/CollectionRegistry.java:179 - This log statement drops the throwable and only prints
ex.getMessage(). For resource registration failures (including NPEs whencreateResourcereturns null), this can hide the actual root cause and stack trace in startup logs.
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:843 - This warning logs only
exception.getMessage()and discards the stack trace. Since this path is taken when fingerprint verification fails (and triggers a full template rebuild), keeping the throwable will make startup issues (permissions, network, API changes) diagnosable.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 85 out of 87 changed files in this pull request and generated no new comments.
Suppressed comments (2)
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:841
- This warning logs only
exception.getMessage()and omits the throwable, which makes it hard to understand why template fingerprint verification failed (e.g., auth/transport errors, parsing errors). Logging the exception preserves the stack trace while still rebuilding templates as intended.
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:690 - In the catch block, the warning logs only
exception.getMessage()and drops the throwable. If index creation/alias reconciliation fails (e.g., mapping errors, auth issues), the stack trace is critical for diagnosing startup problems; messages are often null or too generic.
This issue also appears on line 839 of the same file.
A record the doc build skips as a stale reference (recordStaleReferenceWarning) was dropped from processStats.totalRecords, which only summed process success + failed. readerStats.totalRecords stays at the planner count, so a single skipped record left reader=124 / processor=123 and failed ReindexStatsIT.cleanRunBalancesReaderProcessorSink in search-it-nightly. StageStatsTracker.flush folds every stage's warnings into the one readerWarnings column, so the process-stage share is recovered from the reader hand-off: each row the reader emits gets exactly one process outcome, so whatever is neither a success nor a failure warned. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 88 out of 90 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
openmetadata-service/src/test/java/org/openmetadata/service/monitoring/RequestLatencyContextTest.java:682
Timer.takeSnapshot().histogramCounts().bucket()values are reported in the timer's base time unit (seconds for Prometheus), but this test compares them toDuration.toNanos(). This will fail (and may also be sensitive to an extra +Inf bucket). Convert the expected buckets to seconds and ignore any infinite bucket values before comparing.
indexResourcesFromDirectory built both the pattern-matching path and the resource name from Path.toString(), which emits the platform separator. On Windows a directory classpath element (an exploded target/classes rather than a shaded jar) therefore matched no '/'-anchored pattern and produced names that ClassLoader.getResourceAsStream cannot resolve — SeedDataGate's fingerprint and FrameworkSeedLoader/PolicySeedLoader would find nothing. Normalize both fields once at indexing time, so directory entries look like the jar entries they sit beside. No-op on '/' platforms. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 88 out of 90 changed files in this pull request and generated no new comments.
Suppressed comments (3)
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:1
- The stored
fingerprintused for gating only hashesmappingContent(), but template drift checks (indexTemplatesMatch) and live template markers include additional definition inputs (at leastindexPattern, and priority viaGenericClient.calculateIndexTemplateFingerprint). This means changes toindexPattern(e.g.,clusterAliasupdates) or priority could be missed by the gate, incorrectly skipping required template updates. Compute the gate fingerprint from the same canonical definition used for live verification (e.g., per-templatesearchClient.indexTemplateFingerprint(indexPattern, mappingContent)orGenericClient.calculateIndexTemplateFingerprint(indexPattern, mappingContent), then hash the resulting per-template fingerprint map).
openmetadata-service/src/main/java/org/openmetadata/service/resources/CollectionRegistry.java:1 - For non-empty signatures,
resolveConstructorcan return a non-public constructor, butcreateResourcethen callsconstructor.newInstance(...)without making it accessible; this will fail withIllegalAccessExceptionfor resources in different packages with package-private/protected constructors. To avoid runtime failures, constrain matches topublicconstructors for all supported signatures (or switch togetConstructors()/getConstructor(...)so only public constructors are considered).
openmetadata-service/src/main/java/org/openmetadata/service/seeding/RequiredSeedRows.java:1 - This method hard-codes the provider discriminator as the literal string
\"collate\". Since provider naming is also defined elsewhere (e.g.,SeedDataGateconstants / SMTP template settings), consider centralizing the allowed provider values (constants or an enum) and normalizing case to prevent subtle mismatches that could select the wrong email seed set.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 88 out of 90 changed files in this pull request and generated no new comments.
Suppressed comments (1)
openmetadata-service/src/main/java/org/openmetadata/service/OpenMetadataApplication.java:408
SeedDataGate.stampIfClean()is called immediately after resource registration, but before later startup steps (event filter registration, authorizer/authenticator init, servlet registration, background workers, etc.). If any of those later steps throws and aborts startup, the persistedstartupChecksumscan still reflect a “successful startup”, causing the next boot to skip seed/template reconciliation even though the previous startup did not complete successfully. Consider stamping only after the fullrun()initialization completes without error (e.g., near the end of the method).
ApplicationHandler.initialize(catalogConfig);
IndexResource.initialize(catalogConfig);
startupTimer.time(
"resource registration", () -> registerResources(catalogConfig, environment, jdbi));
SeedDataGate.getInstance().stampIfClean();
…s-startup-latency # Conflicts: # openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java
…s-startup-latency # Conflicts: # conf/openmetadata.yaml # openmetadata-service/src/main/java/org/openmetadata/service/OpenMetadataApplication.java # openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java # openmetadata-spec/src/main/java/org/openmetadata/schema/utils/JsonUtils.java # openmetadata-spec/src/main/resources/json/schema/settings/settings.json # openmetadata-ui/src/main/resources/ui/src/generated/settings/settings.ts
Code Review 👍 Approved with suggestions 13 resolved / 14 findingsImproves server startup and write-path latency by adding warm-start fingerprint gates, optimized classpath scanning, and direct JSON conversion. Consider adding a unit test for history pagination behavior. 💡 Quality: Behavior-changing history pagination lacks a unit test in this commit📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java:2876-2890 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java:1706-1720 listEntityHistoryByTimestamp/getEntityHistoryByTimestampRange were restructured to fix backward (beforeCursor) paging — previously it scanned DESC and returned the wrong rows, now it scans ASC per-branch, applies keyset+LIMIT inside each UNION ALL branch, and reverses in Java. This is a correctness fix, but the only tests added in this commit are the Playwright/Python planner tests; there is no Java unit/integration test exercising forward/backward cursor windows, the extra-row (hasMore) trim, or the UNION ALL dedup assumption. Add a focused test (e.g. in an EntityRepository/history IT) covering first page, afterCursor, and beforeCursor with a version count exceeding the page limit to lock in the fixed behavior. ✅ 13 resolved✅ Bug: CommonUtil.getResources now returns an immutable list
✅ Performance: Search-template gate never stamps fingerprint if any mapping is missing
✅ Quality: ClasspathScanIndex keeps ScanResult open for JVM lifetime
✅ Edge Case: Seed-data gate skips reseeding on DB drift when files are unchanged
✅ Edge Case: Warm-start seed gate reseeds every boot when email config is unset
...and 8 more resolved from earlier reviews 🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|



Describe your changes:
Fixes #30008
I improved server startup and request/write latency, and hardened lineage queries because warm boots repeated bundled-data and search reconciliation, writes repeated JSON serialization, the pipeline-summary service type was interpolated into SQL, and pipeline-reference relation filters had incorrect Boolean precedence.
Type of change:
High-level design:
2.0.0-SNAPSHOT, so no production migration is required, but development databases that already seeded flat control FQNs should be resetTests:
Use cases covered
Unit tests
CommonUtilTest,StartupTimerTest,SeedDataGateTest,FrameworkSeedLoaderTest,ClasspathScanIndexTest,CollectionRegistryTest,RBACConditionEvaluatorCacheTest,IndexTemplateManagerTest,EntityRepositoryStorageJsonReuseTest,EntityLifecycleEventDispatcherTest,RequestLatencyContextTest,MicrometerBundleTest,SettingsRowMapperTest, andJsonUtilsTestSeedDataGateTestandFrameworkSeedLoaderTestpassed 9/9 combined;IndexTemplateManagerTestpassed 10/10Backend integration tests
openmetadata-integration-tests/for new/changed backend behavior.PipelineResourceIT.java,LineageResourceIT.java,SeedDataPresenceIT.java,AIFrameworkControlResourceIT.java, andIndexTemplateIT.javaLineageResourceIT: PostgreSQL and MySQL each passed 51 tests with 0 failures and 0 errors (3 skipped)Ingestion integration tests
Playwright (UI) tests
Manual testing performed
mvn spotless:apply,mvn spotless:check, schema validation, andgit diff --checkUI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Greptile Summary
This PR improves startup gating, search initialization, write-path latency, and lineage query behavior. The main changes are:
Confidence Score: 5/5
This looks safe to merge.
Important Files Changed
Reviews (23): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile
Context used (3)