Skip to content

Make EnterpriseGeoIpDownloaderLicenseListener project aware #129992

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

samxbr
Copy link
Contributor

@samxbr samxbr commented Jun 25, 2025

Although enterprise GeoIp is not currently available in serverless, this makes EnterpriseGeoIpDownloaderLicenseListener mostly project aware.

@samxbr samxbr added :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >non-issue labels Jun 25, 2025
@samxbr samxbr marked this pull request as ready for review June 25, 2025 16:24
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Jun 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor suggestions but otherwise LGTM.

}
event.state().forEachProject(projectState -> {
ProjectId projectId = projectState.projectId();
final boolean hasMetadata = event.state().metadata().getProject(projectId).custom(INGEST_GEOIP_CUSTOM_METADATA_TYPE) != null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
final boolean hasMetadata = event.state().metadata().getProject(projectId).custom(INGEST_GEOIP_CUSTOM_METADATA_TYPE) != null;
final boolean hasMetadata = projectState.metadata().custom(INGEST_GEOIP_CUSTOM_METADATA_TYPE) != null;

@@ -137,6 +152,14 @@ private void ensureTaskStopped() {
}
}
);
persistentTasksService.sendRemoveRequest(ENTERPRISE_GEOIP_DOWNLOADER, MasterNodeRequest.INFINITE_MASTER_NODE_TIMEOUT, listener);
persistentTasksService.sendRemoveRequest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to make use of the new method you added, right?

Suggested change
persistentTasksService.sendRemoveRequest(
persistentTasksService.sendProjectRemoveRequest(
projectId,

Comment on lines +100 to +103
final boolean masterNodeChanged = Objects.equals(
event.state().nodes().getMasterNode(),
event.previousState().nodes().getMasterNode()
) == false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can extract this to outside the loop.

* if this cluster change event involved the modification of custom geoip metadata OR a master node change
*/
if (ingestGeoIpCustomMetaChangedInEvent || (masterNodeChanged && hasIngestGeoIpMetadata.getOrDefault(projectId, false))) {
maybeUpdateTaskState(projectState);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also pass event.state().nodes().isLocalNodeElectedMaster() as a parameter together with a project ID. That way we don't need to convert the projects into project states. What do you think?

Comment on lines +55 to +56
@FixForMultiProject
private final ProjectResolver projectResolver = TestProjectResolvers.DEFAULT_PROJECT_ONLY;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you going to fix this in a follow-up PR soon, or are you using the default project ID because licenseStateChanged() is not going to be made project-aware anytime soon? If it's the former, this is fine, but if it's the latter, I don't think we need a @FixForMultiProject; we can either add @NotMultiProjectCapable as well or just leave the annotation out and add a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >non-issue Team:Data Management Meta label for data/management team v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants