Skip to content

release-2.0.7 + a8c server fix (bot upsert short-circuit) - #116

Open
joaopamaral wants to merge 5 commits into
release-2.0.7from
release-2.0.7-a8c
Open

joaopamaral wants to merge 5 commits into
release-2.0.7from
release-2.0.7-a8c

Conversation

@joaopamaral

@joaopamaral joaopamaral commented Nov 9, 2026 •

Copy link
Copy Markdown

Summary

Server build branch for OpenMetadata 2.0.7: upstream tag 2.0.7-release (branch release-2.0.7 in this fork) plus the fixes we still carry. Build version 2.0.7-a8c.3.

Carried fixes

  • Skip the bot upsert when nothing changed (upstream #37502, resubmission of fix(bots): skip bot upsert when nothing changed to stop team-strip + reindex loop on boot open-metadata/OpenMetadata#28128). Still reproducible on 2.0.7: UserUtil.addOrUpdateBotUser builds a User without teams and PUTs it through createOrUpdate; EntityUpdater.shouldCompare returns true for PUT (no patchedFields), so UserUpdater.updateTeams runs deleteTo(..., 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 as UserUtilBotIT.
  • Clamp kNN num_candidates to 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; on main and 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 MCP semantic_search tool 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.
  • MCP company_context / find_context on 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; on main only). CompanyContextTool and AIContextFinder read OpenSearchVectorService.getInstance(), which is only created when the search type is OpenSearch. On Elasticsearch it is always null, so company_context always answered "Semantic search is not enabled" and find_context came back empty, while semantic_search worked. Both now use SearchRepository.getVectorIndexService(). The only conflict was an import; AIContextFinderTest keeps the 2.0.7 tests and adds the one this fix introduced.

Dropped vs the 1.12.7 branch (now in 2.0.7)

Build

Java 21, build the whole module chain in one reactor (resuming with -rf packs the stock service jar from ~/.m2):

mvn -B -pl openmetadata-dist -am -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true package

-DskipTests alone still runs the UI jest suite; two upstream suites, TotalDataAssetsWidget and DataContractUtils, fail locally on this tag.

Test plan

  • Server boots on a 1.12.7 database after openmetadata-ops.sh migrate
  • Bot users keep their team memberships across a restart; no reindex storm in boot logs
  • VectorSearchQueryBuilderTest passes (49 tests, including k=201 with multiplier 50 clamping to 10,000)
  • UserUtilBotIT passes
  • Vector search with k above 200 returns 200 instead of 500 against a 2.0.7 server (k from 10 to 10,000)
  • AIContextFinderTest (8), CompanyContextToolTest (17), SemanticSearchToolTest (31), VectorSearchQueryBuilderTest (49) pass
  • company_context returns results against a 2.0.7 server on Elasticsearch

joaopamaral and others added 2 commits November 9, 2026 15:08
…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>
@github-actions

Copy link
Copy Markdown

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@joaopamaral
joaopamaral changed the base branch from main to release-2.0.7 November 10, 2026 14:54
… 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>
@github-actions

Copy link
Copy Markdown

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

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.
@github-actions

Copy link
Copy Markdown

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

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>
@github-actions

Copy link
Copy Markdown

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

This branch had an error being deployed

1 failed deployment
test — e5f947a9 Deployed Nov 13, 2026 by joaopamaral via playwright-mysql (chromium) #515
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.

2 participants