Skip to content

Conversation

@ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Aug 12, 2020

Today a snapshot repository verification ensures that all master-eligible and data nodes have write access to the snapshot repository (and can see each other's data) since taking a snapshot requires data nodes and the currently-elected master to write to the repository. However, a dedicated voting-only master-eligible node is not a data node and will never be the elected master so we should not require it to have write access to the repository.

Closes #59649

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (:Distributed/Snapshot/Restore)

@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Aug 12, 2020
Copy link
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

One question look good otherwise :) (+ checkstyle)

public void applyClusterState(ClusterChangedEvent event) {
try {
final ClusterState state = event.state();
if (isDedicatedVotingOnlyNode(state.nodes().getLocalNode())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could just not add the applier in the first place in the constructor where we check if the node is a master or data node (we should have the information that this is a voting only node there already from the settings?)?

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to be able to compute this from a DiscoveryNode since we need to know it for remote nodes too, and we won't have a DiscoveryNode in the constructor so would have to implement it two different ways. I think I prefer this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I went back and forth on this, and prefer to reuse the same logic.

I have done this in a different way now in 143fc1c: Let me know if you prefer this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like it :)

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

One nit is that I'd like to spell out that it really is the right name for the role, but otherwise LGTM

public void applyClusterState(ClusterChangedEvent event) {
try {
final ClusterState state = event.state();
if (isDedicatedVotingOnlyNode(state.nodes().getLocalNode())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to be able to compute this from a DiscoveryNode since we need to know it for remote nodes too, and we won't have a DiscoveryNode in the constructor so would have to implement it two different ways. I think I prefer this.


static boolean isDedicatedVotingOnlyNode(DiscoveryNode node) {
return node.isMasterNode() && node.isDataNode() == false &&
node.getRoles().stream().anyMatch(role -> role.roleName().equals("voting_only"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we establish that this is the same string as used in VotingOnlyNodePlugin#VOTING_ONLY_NODE_ROLE by extracting the string as a field and adding an assertion in VotingOnlyNodePlugin saying that they match?

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 is ensured by the test that was added. It fails when these strings are not matching (as we are then illegally accessing the repo on the voting-only node)? Do you find this too implicit?

Copy link
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM

@ywelsch ywelsch merged commit b2ee474 into elastic:master Aug 12, 2020
ywelsch added a commit that referenced this pull request Aug 12, 2020
)

Today a snapshot repository verification ensures that all master-eligible and data nodes have write access to the
snapshot repository (and can see each other's data) since taking a snapshot requires data nodes and the currently
elected master to write to the repository. However, a dedicated voting-only master-eligible node is not a data node and
will never be the elected master so we should not require it to have write access to the repository.

Closes #59649
ywelsch added a commit that referenced this pull request Aug 12, 2020
)

Today a snapshot repository verification ensures that all master-eligible and data nodes have write access to the
snapshot repository (and can see each other's data) since taking a snapshot requires data nodes and the currently
elected master to write to the repository. However, a dedicated voting-only master-eligible node is not a data node and
will never be the elected master so we should not require it to have write access to the repository.

Closes #59649
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v7.9.1 v7.10.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dedicated voting-only master-eligible node requires access to snapshot repositories for verification

5 participants