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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

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
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.
@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.

@@ -0,0 +1,69 @@
/*
* Copyright 2024 the Pacemaker project contributors
Copy link
Contributor

Choose a reason for hiding this comment

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

Update the copyright date - I didn't check all the other files, but this one being new was obvious.

{
if (node_xml_ids == NULL) {
node_xml_ids = pcmk__strikey_table(free, free);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does node_xml_ids get freed when attrd shuts down?

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.

2 participants