-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same approach as for searchable snapshots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks Yannick.
* | ||
* returns null if no check is provided | ||
*/ | ||
default Consumer<IndexMetadata> addPreRestoreCheck() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious why you prefer returning a consumer instead of consuming IndexMetadata?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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