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

PWX-28654 Add quorum member flag to the StorageNode SDK object #2367

Merged

Conversation

piyush-nimbalkar
Copy link

@piyush-nimbalkar piyush-nimbalkar commented Oct 25, 2023

What this PR does / why we need it:
This field is populated from cluster database's NonQuorumMember field. Which in turn is calculated in QuorumMember() listener function impl in PX. It looks at the storage devices in the metadata store.

Which issue(s) this PR fixes (optional)
Closes #
or
PWX-28654

Testing Notes

  • Modified UTs and they are passing.
  • Validated the output of the new flag in all the APIs Inspect, InspectCurrent, EnumerateWithFilters.
  • Also, validated the flag at various stages of portworx bootup.

Sample output from a 6 node cluster with 3 storage nodes:

# curl -s localhost:9021/v1/nodes/filters | jq '.nodes[].non_quorum_member'
true
true
false
false
true
false
# curl -s localhost:9021/v1/nodes/inspect/74809bde-d9b6-4cdd-bcfe-337a0e215f52 | jq '.node.non_quorum_member'
true
# curl -s localhost:9021/v1/nodes/inspectcurrent | jq '.node.non_quorum_member'
true

Special notes for your reviewer:
Add any notes for the reviewer here.

This field is populated from cluster database's NonQuorumMember field.
Which in turn is calculated in QuorumMember() listener function impl in
PX. It looks at the storage devices in the metadata store.

Signed-off-by: Piyush Nimbalkar <[email protected]>
@@ -746,6 +748,7 @@ func (c *ClusterManager) joinCluster(
selfNodeEntry.NonQuorumMember =
selfNodeEntry.Status == api.Status_STATUS_DECOMMISSION ||
!c.quorumMember()
c.selfNode.NonQuorumMember = selfNodeEntry.NonQuorumMember
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably checked it already but wondering if should set NonQuorumMember on line 597 in initNode() as well.

Copy link
Author

Choose a reason for hiding this comment

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

initNode() is called before the listeners are initialized. The caller of the initNode() is initListeners(), which does things in the following order -

initNode()   - create a node object
initNodeInCluster() - initializes all the listeners
quorumMember() - this calls QuorumMember() on the now initialized PX listener

In this PR we are setting the quorum member flag after the above steps. We set it in both the selfNode and the node entry that will get stored in the cluster database.

@piyush-nimbalkar
Copy link
Author

Thank you for the quick review, @pureneelesh !

@piyush-nimbalkar piyush-nimbalkar merged commit bd3d3ce into libopenstorage:master Oct 25, 2023
@piyush-nimbalkar piyush-nimbalkar deleted the master_pwx-28654 branch October 25, 2023 22:53
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.

2 participants