License checks for archive tier#83894
Conversation
|
Pinging @elastic/es-search (Team:Search) |
| Object sourceOnlyMeta = mappingMetadata.sourceAsMap().get("_meta"); | ||
| if (sourceOnlyMeta instanceof Map<?, ?> sourceOnlyMetaMap) { | ||
| legacyMapping.put("legacy_mappings", sourceOnlyMetaMap); | ||
| if (mappingMetadata != null) { |
There was a problem hiding this comment.
the newly added test uncovered a bug as mappings can be null sometimes (even if not very useful, it's still a thing). This method was just refactored to put the existing logic under an if != null
| ) { | ||
| this.failShardsListener.set(new FailShardsOnInvalidLicenseClusterListener(getLicenseState(), clusterService.getRerouteService())); | ||
| if (DiscoveryNode.isMasterNode(environment.settings())) { | ||
| // We periodically look through the indices and identify if there are any archive indices, |
There was a problem hiding this comment.
same approach as for searchable snapshots
|
|
||
| import static org.elasticsearch.xpack.lucene.bwc.OldLuceneVersions.ARCHIVE_FEATURE; | ||
|
|
||
| public class FailShardsOnInvalidLicenseClusterListener implements LicenseStateListener, IndexEventListener { |
There was a problem hiding this comment.
same approach as for searchable snapshots
|
|
||
| import static org.elasticsearch.xpack.lucene.bwc.OldLuceneVersions.isArchiveIndex; | ||
|
|
||
| public class ArchiveAllocationDecider extends AllocationDecider { |
There was a problem hiding this comment.
same approach as for searchable snapshots
| * | ||
| * returns null if no check is provided | ||
| */ | ||
| default Consumer<IndexMetadata> addPreRestoreCheck() { |
There was a problem hiding this comment.
Just curious why you prefer returning a consumer instead of consuming IndexMetadata?
There was a problem hiding this comment.
This follows the model of not calling directly into plugins, but plugins providing extensions points (at startup time) that are then being called at runtime.
|
Thanks @dnhatn! |
Follows a similar approach as for searchable snapshots.
Relates #81210