Skip to content

Conversation

@nielsbauman
Copy link
Contributor

Allows downsampling to work on multiple projects.

Allows downsampling to work on multiple projects.
@nielsbauman nielsbauman added >non-issue :StorageEngine/Downsampling Downsampling (replacement for rollups) - Turn fine-grained time-based data into coarser-grained data Team:StorageEngine v9.1.0 labels Mar 4, 2025
@nielsbauman nielsbauman requested a review from a team March 4, 2025 14:06
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

I think at some points downsample tests need to be added that run in a multi project test cluster?

'^security/authz/14_cat_indices/*',
'^security/authz/14_cat_indices/Test explicit request while multiple opened/*',
'^security/authz/60_resolve_index/*',
'^security/authz/80_downsample/*',
Copy link
Member

Choose a reason for hiding this comment

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

Was this disabled as part of merging in multi project branch?

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 blacklist/mute list is exclusively used for the "multi-project x-pack YAML test suite". This test suite simply runs the main x-pack YAML test suite, but with multiple projects added to the cluster and the REST client includes one of those projects (the active project) in the header. Therefore, this list is basically just a checklist of features that have not yet been made project-aware. Since this PR makes downsampling project-aware, we can remove it from the list and include it in the multi-project tests.

This test suite will change over time; we'll probably move it to the serverless repo at some point.

Copy link
Member

@ywangd ywangd left a comment

Choose a reason for hiding this comment

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

LGTM

I have a suggestion for handling project removal which I'd appreciate it to be addressed. Thanks!

listener.onResponse(PersistentTasksCustomMetadata.getTaskWithId(state.metadata().getProject(projectId), taskId));
final var project = state.metadata().projects().get(projectId);
final PersistentTask<P> task = project == null ? null : PersistentTasksCustomMetadata.getTaskWithId(project, taskId);
listener.onResponse(task);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ywangd I had to make some changes here to allow the extraction of the task variable. I had to explicitly type the predicate and listener, otherwise the compiler would complain. I think these changes make sense, but I'll let you have another look before I merge.

Copy link
Member

Choose a reason for hiding this comment

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

If we don't have the separate task variable, we would not need the explicit type parameter changes. i.e. the following works

listener.onResponse(project == null ? null : PersistentTasksCustomMetadata.getTaskWithId(project, taskId));

This is already the case with existing code, i.e. the current code does not compile if you have

final var task = PersistentTasksCustomMetadata.getTaskWithId(state, taskId);
listener.onResponse(task);  // <--- compilation error

The wildcard capture of listener.onReponse does not work with other explicit type or another wildcard capture. It needs to infer it by itself.

So I think we can just inline the variable and no need for the type parameter changes.

Copy link
Member

Choose a reason for hiding this comment

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

to allow the extraction of the task variable

If your goal is to add the separate task variable, the type parameter changes make sense. I don't feel the task variable is necessary. But I don't have strong opinion either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did have a slight preference for the task variable. That combined with the fact that I think having the explicit type parameter makes sense here anyway, resulted in me doing the change this way. In multiple places, we already get (and cast) the state or params from the persistent task passed to the listener, so most usages already depend on the task being a specific instance. That said, I'm fine to revert the changes and inline the variable to reduce the changes of this commit a bit (i.e. keep the scope smaller).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see you opened #124180 with the project deletion checks. I'll just wait for you to merge that one and then merge this one. Then I don't have to add the project deletion checks in this PR.

Copy link
Member

@ywangd ywangd Mar 6, 2025

Choose a reason for hiding this comment

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

They are different methods. I think there is no need to for any order between merging the two PRs.

@nielsbauman nielsbauman merged commit 2a7eb6e into elastic:main Mar 6, 2025
17 checks passed
@nielsbauman nielsbauman deleted the mp-downsample branch March 6, 2025 11:55
georgewallace pushed a commit to georgewallace/elasticsearch that referenced this pull request Mar 11, 2025
Allows downsampling to work on multiple projects.
costin pushed a commit to costin/elasticsearch that referenced this pull request Mar 15, 2025
Allows downsampling to work on multiple projects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :StorageEngine/Downsampling Downsampling (replacement for rollups) - Turn fine-grained time-based data into coarser-grained data Team:StorageEngine v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants