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

Track node's XML ID rather than cluster ID for attribute write-outs in pacemaker-attrd #3796

Merged
merged 16 commits into from
Jan 14, 2025

Conversation

kgaillot
Copy link
Contributor

@kgaillot kgaillot commented Jan 9, 2025

No description provided.

... even if false, for code consistency and simplicity
... for cleaner separation, and to ensure it is set whenever possible.
We only need the node XML ID for writing values to the CIB, so if a
value will never be written, skip looking for the XML ID.

This does mean that cluster nodes won't be added to the peer cache for
unwritten attributes, but that shouldn't matter for them.
... to pcmk__cluster_get_xml_id(). It's getting the CIB XML ID; there's
no such thing as a cluster-layer UUID, and it can be used with Pacemaker
Remote nodes as well as cluster nodes.
... rather than using node->xml_id directly, so it gets set whenever
possible. Also, make comparisons case-sensitive.
Previously, attribute_value_t had a nodeid member to track the cluster
ID of the node that the value is for. However the only reason we need
it is to be able to get the node's XML ID in the CIB, for writing out
the value. Rename it to node_xml_id and track the XML ID directly.

In practice, there is no real change, since the CIB XML ID of Corosync
nodes is simply their cluster ID as a string. This allows us to keep
the same XML attribute and value in peer messages for backward
compatibility.

If we ever support node XML IDs that are *not* the string equivalent of
their cluster IDs, rolling upgrades will be possible only from versions
with this commit and later.
... for readability and to reduce code duplication
@kgaillot
Copy link
Contributor Author

kgaillot commented Jan 9, 2025

@clumens @nrwahl2 @gao-yan , this one would benefit from multiple eyes on it. It tested well. I didn't test a mixed-version cluster but I don't expect any problems there.

daemons/attrd/attrd_nodes.c Outdated Show resolved Hide resolved
daemons/attrd/attrd_nodes.c Show resolved Hide resolved
Previously, node XML IDs were kept in attribute_value_t. That meant that
they were duplicated for every value for a node, the values might be
known for some values and unknown or inconsistent for others, and newly
learned XML IDs would have to be broadcast per value.

Now, maintain a global node XML ID cache.
@clumens
Copy link
Contributor

clumens commented Jan 13, 2025

This looks good to me now, but it would be great to get some other opinions before merging.

@gao-yan
Copy link
Member

gao-yan commented Jan 13, 2025

Looks good to me too so far. Thanks!

Copy link
Contributor

@nrwahl2 nrwahl2 left a comment

Choose a reason for hiding this comment

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

Nice!

lib/cluster/membership.c Show resolved Hide resolved
lib/cluster/membership.c Show resolved Hide resolved
lib/cluster/membership.c Show resolved Hide resolved
lib/cluster/corosync.c Show resolved Hide resolved
daemons/attrd/attrd_alerts.c Show resolved Hide resolved
daemons/attrd/attrd_attributes.c Show resolved Hide resolved
daemons/attrd/attrd_utils.c Outdated Show resolved Hide resolved
daemons/attrd/attrd_cib.c Outdated Show resolved Hide resolved
@kgaillot
Copy link
Contributor Author

Added one commit on top to address review

Copy link
Contributor

@nrwahl2 nrwahl2 left a comment

Choose a reason for hiding this comment

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

Replied to a few existing threads. Otherwise we're good.

Add a doxygen block, rename function to
update_node_state_after_fencing() and uuid argument to target_xml_id for
readability, and improve log messages, comments, and formatting.
@kgaillot kgaillot merged commit 7dc494a into ClusterLabs:main Jan 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants