Skip to content
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

Merged
merged 2 commits into from
Feb 15, 2022
Merged

Conversation

ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Feb 14, 2022

Follows a similar approach as for searchable snapshots.

Relates #81210

@ywelsch ywelsch added >non-issue :Search/Search Search-related issues that do not fall into other categories v8.2.0 labels Feb 14, 2022
@ywelsch ywelsch requested a review from dnhatn February 14, 2022 15:10
@ywelsch ywelsch mentioned this pull request Feb 14, 2022
32 tasks
@ywelsch ywelsch marked this pull request as ready for review February 14, 2022 17:23
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Feb 14, 2022
@elasticmachine
Copy link
Collaborator

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) {
Copy link
Contributor Author

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,
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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

Copy link
Member

@dnhatn dnhatn left a 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() {
Copy link
Member

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?

Copy link
Contributor Author

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.

@ywelsch ywelsch merged commit 749ad74 into elastic:master Feb 15, 2022
@ywelsch
Copy link
Contributor Author

ywelsch commented Feb 15, 2022

Thanks @dnhatn!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants