Fix system index mapping update for reindexed indices after migration#144782
Fix system index mapping update for reindexed indices after migration#144782alexey-ivanov-es merged 8 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
Hi @alexey-ivanov-es, I've created a changelog YAML for you. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis change addresses system index mapping updates for indices that have been reindexed during major version migrations. The 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| */ | ||
| static State calculateIndexState(ProjectState state, SystemIndexDescriptor descriptor) { | ||
| final IndexMetadata indexMetadata = state.metadata().index(descriptor.getPrimaryIndex()); | ||
| IndexMetadata indexMetadata = getSystemIndexMetadata(state, descriptor); |
There was a problem hiding this comment.
nit: this is not final anymore, not sure if it's on purpose.
💔 Backport failed
You can use sqren/backport to manually backport by running |
…elastic#144782) SystemIndexMappingUpdateService used projectMetadata.hasIndexAbstraction(d.getPrimaryIndex()) to collect system indices descriptors to check mappings, but then used state.metadata().index(descriptor.getPrimaryIndex()) to get IndexMetadata. This works with indices that were not reindexed, since their name is always the same as the system index's primary name, but after reindexing during migration, the index gains -reindexed-for-<version> suffix and has an alias with the primary name pointing to it. However, index method doesn't support aliases, therefore, IndexMetadata wasn't resolved and mappings were not checked. This change fixes that by introducing use of indices lookup, if there is no metadata for the primary index.
…elastic#144782) SystemIndexMappingUpdateService used projectMetadata.hasIndexAbstraction(d.getPrimaryIndex()) to collect system indices descriptors to check mappings, but then used state.metadata().index(descriptor.getPrimaryIndex()) to get IndexMetadata. This works with indices that were not reindexed, since their name is always the same as the system index's primary name, but after reindexing during migration, the index gains -reindexed-for-<version> suffix and has an alias with the primary name pointing to it. However, index method doesn't support aliases, therefore, IndexMetadata wasn't resolved and mappings were not checked. This change fixes that by introducing use of indices lookup, if there is no metadata for the primary index.
…gration (#144782) SystemIndexMappingUpdateService used projectMetadata.hasIndexAbstraction(d.getPrimaryIndex()) to collect system indices descriptors to check mappings, but then used state.metadata().index(descriptor.getPrimaryIndex()) to get IndexMetadata. This works with indices that were not reindexed, since their name is always the same as the system index's primary name, but after reindexing during migration, the index gains -reindexed-for-<version> suffix and has an alias with the primary name pointing to it. However, index method doesn't support aliases, therefore, IndexMetadata wasn't resolved and mappings were not checked. This change fixes that by introducing use of indices lookup, if there is no metadata for the primary index. (cherry picked from commit 29d7e2a)
|
8.19 backport: #145031 |
…#144782) (#145026) SystemIndexMappingUpdateService used projectMetadata.hasIndexAbstraction(d.getPrimaryIndex()) to collect system indices descriptors to check mappings, but then used state.metadata().index(descriptor.getPrimaryIndex()) to get IndexMetadata. This works with indices that were not reindexed, since their name is always the same as the system index's primary name, but after reindexing during migration, the index gains -reindexed-for-<version> suffix and has an alias with the primary name pointing to it. However, index method doesn't support aliases, therefore, IndexMetadata wasn't resolved and mappings were not checked. This change fixes that by introducing use of indices lookup, if there is no metadata for the primary index.
…gration (#144782) (#145031) * [8.19] Fix system index mapping update for reindexed indices after migration (#144782) SystemIndexMappingUpdateService used projectMetadata.hasIndexAbstraction(d.getPrimaryIndex()) to collect system indices descriptors to check mappings, but then used state.metadata().index(descriptor.getPrimaryIndex()) to get IndexMetadata. This works with indices that were not reindexed, since their name is always the same as the system index's primary name, but after reindexing during migration, the index gains -reindexed-for-<version> suffix and has an alias with the primary name pointing to it. However, index method doesn't support aliases, therefore, IndexMetadata wasn't resolved and mappings were not checked. This change fixes that by introducing use of indices lookup, if there is no metadata for the primary index. (cherry picked from commit 29d7e2a) * Fix build
…ration (#144782) (#145025) SystemIndexMappingUpdateService used projectMetadata.hasIndexAbstraction(d.getPrimaryIndex()) to collect system indices descriptors to check mappings, but then used state.metadata().index(descriptor.getPrimaryIndex()) to get IndexMetadata. This works with indices that were not reindexed, since their name is always the same as the system index's primary name, but after reindexing during migration, the index gains -reindexed-for-<version> suffix and has an alias with the primary name pointing to it. However, index method doesn't support aliases, therefore, IndexMetadata wasn't resolved and mappings were not checked. This change fixes that by introducing use of indices lookup, if there is no metadata for the primary index.
SystemIndexMappingUpdateServiceusedprojectMetadata.hasIndexAbstraction(d.getPrimaryIndex())to collect system indices descriptors to check mappings, but then usedstate.metadata().index(descriptor.getPrimaryIndex())to getIndexMetadata. This works with indices that were not reindexed, since their name is always the same as the system index's primary name, but after reindexing during migration, the index gains-reindexed-for-<version>suffix and has an alias with the primary name pointing to it. However,indexmethod doesn't support aliases, therefore,IndexMetadatawasn't resolved and mappings were not checked.This change fixes that by introducing use of indices lookup, if there is no metadata for the primary index.
Closes: #144764