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

Wait until security index is ready for role mappings #92173

Merged
merged 14 commits into from
Dec 17, 2022

Conversation

grcevski
Copy link
Contributor

@grcevski grcevski commented Dec 6, 2022

File based settings are always stored in the cluster state, except in one case - security role mappings. The role mappings are stored in the .security system index. While the cluster state is immediately available on bootstrap of the Node, the system indices might take a while to become available.

This PR changes the flow of updating the role mappings, such that we properly wait for the role mappings to be saved until the security index becomes available.

The code for the PR is pretty much what @ywangd provided me with :). Thanks Yang!

Outstanding item:

Closes #91939

@grcevski grcevski added >bug :Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team v8.6.1 v8.7.0 labels Dec 6, 2022
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @grcevski, I've created a changelog YAML for you.

@grcevski grcevski requested a review from ywangd December 6, 2022 21:57
@grcevski
Copy link
Contributor Author

grcevski commented Dec 8, 2022

@elasticsearchmachine run elasticsearch-ci/part-1

@grcevski
Copy link
Contributor Author

grcevski commented Dec 8, 2022

@ywangd I think this is now ready to be reviewed. Thanks again!

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.

I have a question about the new test.

Comment on lines 479 to 480
logger.info("--> restart master");
internalCluster().restartNode(masterNode);
Copy link
Member

Choose a reason for hiding this comment

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

If there are multiple nodes in the cluster, I think this test may not exercise the new logic. Because once the master node is restarted, it is likely that it won't be the master anymore. Hence the file setting related code won't run at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I'll change the test to use only a single master node.

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

Thanks for going the extra mile on the tests. I learned a lot from them.

Files.move(tempFilePath, fileSettingsService.operatorSettingsFile(), StandardCopyOption.ATOMIC_MOVE);
}

public void testFailsOnStartWithError() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: maybe rename this to testFailsOnStartMasterNodeWithError since data node starts fine.

@grcevski
Copy link
Contributor Author

@elasticsearchmachine run elasticsearch-ci/bwc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team v8.6.1 v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File based settings work incorrectly for role mappings on startup
3 participants