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

Fix transport serialization of AsyncSearchUser #54761

Merged
merged 4 commits into from
Apr 7, 2020

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Apr 4, 2020

This change ensures that the AsyncSearchUser is correctly (de)serialized when
an action executed by this user is sent to a remote node internally (via transport client).

This change ensures that the AsyncSearchUser is correctly (de)serialized when
an action executed by this user is sent to a remote node internally (via transport client).
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (:Security/Authorization)

@jimczi
Copy link
Contributor Author

jimczi commented Apr 4, 2020

@elasticmachine run elasticsearch-ci/2

@@ -36,6 +38,9 @@ public static void writeTo(User user, StreamOutput output) throws IOException {
} else if (XPackSecurityUser.is(user)) {
output.writeBoolean(true);
output.writeString(XPackSecurityUser.NAME);
} else if (AsyncSearchUser.is(user)) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this a concern for bwc? I think, in a mixed cluster environment, writing and reading this information from different versions would fail. But current failures don't seem to be releavant. I don't know the details about async search work. Is it 8.0 only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a 7.7 feature so nodes in this version will be able to run _async_search and to create the new .async-search index. For the few cases where an older node could be picked, the IllegalStateException thrown by readFrom should be enough to handle failures gracefully ?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is indeed a problem, but I don't see an easy way around it.

With the proposed changes, async search won't work until the master node is also upgraded, even if the coordinating node is. Does this sound reasonable to you @jimczi ? Are there other issues that would prevent the async search feature to work in a mixed cluster (assuming no, but maybe there is :) )?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fine IMO. We expect users to upgrade clusters entirely before using new features . Also, Kibana will use _async_search internally so the ES cluster must be fully upgraded before upgrading Kibana.

@jimczi
Copy link
Contributor Author

jimczi commented Apr 6, 2020

We have a dedicated tests for security with async search but it is currently setup to run with a single node (default value for rest tests). This is the reason why this issue was not caught until now. We'll update the rest tests to force at least 2 nodes in a follow up.

@albertzaharovits
Copy link
Contributor

I should've thought about authz for the new async_search origin in a mixed cluster. I'm sorry I missed it.

Copy link
Contributor

@albertzaharovits albertzaharovits left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jimczi
Copy link
Contributor Author

jimczi commented Apr 6, 2020

I pushed one commit to setup the async security rest test with 2 nodes: 82f9222
We don't need another pr to introduce this change.

@jimczi jimczi merged commit 9e24558 into elastic:master Apr 7, 2020
@jimczi jimczi deleted the async_search_syer_serialization branch April 7, 2020 06:25
jimczi added a commit that referenced this pull request Apr 7, 2020
This change ensures that the AsyncSearchUser is correctly (de)serialized when
an action executed by this user is sent to a remote node internally (via transport client).
jimczi added a commit that referenced this pull request Apr 7, 2020
This change ensures that the AsyncSearchUser is correctly (de)serialized when
an action executed by this user is sent to a remote node internally (via transport client).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants