Fix Entity Promotion issue (#27930)
Some checks failed
Integration Tests - MySQL + Elasticsearch / integration-tests-mysql-elasticsearch (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / integration-tests-postgres-opensearch (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests (mysql) (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests (postgresql) (push) Has been cancelled
OpenMetadata Service Unit Tests / k8s_operator-unit-tests (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests-status (push) Has been cancelled
Integration Tests - MySQL + Elasticsearch / Detect Changes (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / Detect Changes (push) Has been cancelled
Java Checkstyle / java-checkstyle (push) Has been cancelled
Maven Collate Tests / maven-collate-ci (push) Has been cancelled
OpenMetadata Service Unit Tests / Detect Changes (push) Has been cancelled
Publish Package to Maven Central Repository / publish-maven-packages (push) Has been cancelled

This commit is contained in:
Mohit Yadav 2026-05-06 18:50:49 +05:30 committed by GitHub
parent 297c01cea7
commit e56abb80d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View file

@ -1102,6 +1102,13 @@ public class DistributedSearchIndexExecutor {
// Set up per-entity promotion callback if recreating indices
if (recreateIndex && recreateContext != null) {
this.recreateIndexHandler = Entity.getSearchRepository().createReindexHandler();
// Wire job configuration so applyLiveServingSettings can revert bulk-build overrides
// (refresh=-1, replicas=0, async translog) before the per-entity alias swap.
if (recreateIndexHandler instanceof DefaultRecreateHandler defaultHandler
&& currentJob != null
&& currentJob.getJobConfiguration() != null) {
defaultHandler.withJobData(currentJob.getJobConfiguration());
}
entityTracker.setOnEntityComplete(this::promoteEntityIndex);
LOG.info(
"Per-entity promotion callback SET for job {} (recreateIndex={}, recreateContext entities={})",

View file

@ -323,6 +323,12 @@ public class DefaultRecreateHandler implements RecreateIndexHandler {
// Always clear staged-index routing on the way out see the rationale in finalizeReindex.
try {
// Restore live serving settings on the staged index before alias swap. The bulk-build
// overrides (refresh=-1, replicas=0, async translog) must NOT be the new live settings,
// or newly indexed docs are buffered indefinitely until a manual _refresh.
applyLiveServingSettings(searchClient, stagedIndex, entityType);
maybeForceMerge(searchClient, stagedIndex, entityType);
Set<String> aliasesToAttach =
getAliasesFromMapping(indexMapping, searchRepository.getClusterAlias());