Repository navigation
release-2.0.7 + a8c server fix (bot upsert short-circuit) - #116
joaopamaral wants to merge 5 commits into
Conversation
…reindex loop on boot BotResource.initialize() runs UserUtil.addOrUpdateBotUser(user) for every bot on every OM boot. The in-memory User built by UserUtil.user(...) does not have the teams field populated, so the PUT path through userRepository.createOrUpdate -> UserUpdater.entitySpecificUpdate runs updateTeams(original, updated) with original.teams = [Organization] (or the bot's real stored teams) and updated.teams = null. updateTeams then executes deleteTo(user, HAS, TEAM) + assignTeams(null), which strips every stored team membership the bot had, bumps the user version, and triggers an ES reindex of both the user and each affected team. With several bots this fires on every restart and produces the reindex storm plus "Circular dependency detected in team hierarchy for team: Organization" warnings we see in the boot logs. Short-circuit when the incoming bot has no real change vs. the persisted row: compare description, displayName, and roles. If they all match, return the original user and skip the PUT entirely — no UserUpdater, no team strip, no version bump, no reindex. Two adjustments to make the guard actually fire: - retrieveWithAuthMechanism now also loads "roles" (was loading only "authenticationMechanism"); description and displayName are scalar JSON-column fields and were already populated by the base read. - Compare roles via listOrEmpty(...) on both sides because the database-loaded original returns an empty list while the freshly built in-memory user returns null, and Objects.equals(null, []) is false. Adds UserUtilBotTest.addOrUpdateBotUserDoesNotStripTeams as a regression test. The test creates a real (non-Organization) team, assigns the bot to it, calls addOrUpdateBotUser with a fresh User object that does not carry the teams field (matching what BotResource.initialize passes on boot), then asserts the bot is still in the real team. Before this fix the assertion fails with "Got: [Organization]" — the real team has been wiped and only the virtual default remains. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> (cherry picked from commit 7fd62f8)
…sts module 2.0.7 removed OpenMetadataApplicationTest from openmetadata-service, so the service test module can no longer boot the application. The integration-tests module runs in-process with repository access (TestNamespaceExtension pattern), so UserUtilBotTest becomes UserUtilBotIT there with the same scenario: a bot in a real team, then the boot-time addOrUpdateBotUser call with a User that carries no teams, asserting the membership survives. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
… 10,000 Backport of upstream open-metadata#35652 (fixes open-metadata#35640) to 2.0.7. num_candidates was max(100, k * knnNumCandidatesMultiplier) with no upper bound, so any k above 10,000 / multiplier made Elasticsearch reject the kNN query and the vector search endpoint and the MCP semantic_search tool return 500. With a multiplier of 50 that is any k above 200, including the REST endpoint's default k of 1,000. Only the query builder and its tests are backported; the upstream schema description and generated UI types are unchanged here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
…asticsearch (open-metadata#36548) AIContextFinder and CompanyContextTool read OpenSearchVectorService.getInstance(), which is only initialised when searchType is OpenSearch. On Elasticsearch it is always null, so find_context silently returned an empty result and company_context reported "Semantic search is not enabled" even with embeddings present. Read the backend-neutral SearchRepository.getVectorIndexService() instead, as SemanticSearchTool already does. On OpenSearch it returns the same OpenSearchVectorService instance as before. Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> (cherry picked from commit 961fb5f) Backport to 2.0.7: import-only conflict in AIContextFinder (2.0.7 has no MetricRepository import); AIContextFinderTest keeps the 2.0.7 tests and adds only the test this commit introduced.
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
updateUserLastLoginTime applied a JSON patch through the full entity update path. lastLoginTime is excluded from change descriptions, so the patch produced no version, but when the same user logged in again within the EntityUpdater session window (10 minutes) the change-consolidation step reloaded the user with every field, including `owns`, at one lookup per entity owned by the user's teams. For a user whose teams own ~300 assets that is ~2,600 queries and ~9 s per login, against ~150 queries and ~1 s for the first login of a session. Update the row with a single JSON_SET / jsonb_set statement, like lastActivityTime already does, and invalidate the entity cache entry so reads see the new value. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Summary
Server build branch for OpenMetadata 2.0.7: upstream tag
2.0.7-release(branchrelease-2.0.7in this fork) plus the fixes we still carry. Build version2.0.7-a8c.3.Carried fixes
UserUtil.addOrUpdateBotUserbuilds aUserwithoutteamsand PUTs it throughcreateOrUpdate;EntityUpdater.shouldComparereturns true for PUT (nopatchedFields), soUserUpdater.updateTeamsrunsdeleteTo(..., HAS, TEAM)+assignTeams(null)on every boot, stripping the bot's stored teams, bumping its version and reindexing. The short-circuit compares roles/description/displayName against the stored row and returns early when equal. The regression test lives in the integration-tests module asUserUtilBotIT.num_candidatesto 10,000 (backport of upstream #35652, fixes [Detail Bug] Search/Elasticsearch: Vector search fails for k > 5000 due to num_candidates exceeding Elasticsearch cap open-metadata/OpenMetadata#35640; onmainand 2.1.0-rc1, not on the 2.0 branch).num_candidates = max(100, k * knnNumCandidatesMultiplier)had no upper bound, and Elasticsearch rejects kNN queries above 10,000 candidates, so the vector search endpoint and the MCPsemantic_searchtool returned 500 for any k above 10,000 / multiplier. With a multiplier of 50 that is any k above 200, including the REST endpoint's default k of 1,000. Only the query builder and its tests are backported; the schema description and generated UI types are left as in 2.0.7.company_context/find_contexton Elasticsearch (backport of upstream #36548, fixes MCP find_context and company_context return no results on Elasticsearch (OpenSearchVectorService singleton is null) open-metadata/OpenMetadata#36463; onmainonly).CompanyContextToolandAIContextFinderreadOpenSearchVectorService.getInstance(), which is only created when the search type is OpenSearch. On Elasticsearch it is always null, socompany_contextalways answered "Semantic search is not enabled" andfind_contextcame back empty, whilesemantic_searchworked. Both now useSearchRepository.getVectorIndexService(). The only conflict was an import;AIContextFinderTestkeeps the 2.0.7 tests and adds the one this fix introduced.Dropped vs the 1.12.7 branch (now in 2.0.7)
ElasticSearchVectorServicewith configurableelasticsearch.naturalLanguageSearch.knnNumCandidatesMultiplier.UserRepository.getAuthUpdateFields().semantic_searchresolving the vector service throughSearchRepository.removePolicy: only exercised by the 1.7.2 migration.Build
Java 21, build the whole module chain in one reactor (resuming with
-rfpacks the stock service jar from~/.m2):-DskipTestsalone still runs the UI jest suite; two upstream suites,TotalDataAssetsWidgetandDataContractUtils, fail locally on this tag.Test plan
openmetadata-ops.sh migrateVectorSearchQueryBuilderTestpasses (49 tests, including k=201 with multiplier 50 clamping to 10,000)UserUtilBotITpassesAIContextFinderTest(8),CompanyContextToolTest(17),SemanticSearchToolTest(31),VectorSearchQueryBuilderTest(49) passcompany_contextreturns results against a 2.0.7 server on Elasticsearch