resource-agents icon indicating copy to clipboard operation
resource-agents copied to clipboard

mysql: Check for promoted node during start is invalid

Open nrwahl2 opened this issue 2 years ago • 1 comments

The mysql agent checks the OCF_RESKEY_CRM_meta_notify_master_uname meta attribute during the start operation to determine which node (if any) is already promoted. This has a few issues:

  • It doesn't work. That meta attribute is set only during certain notify operations -- not during start operations.
  • The "master" terminology is deprecated in favor of "promoted."
  • If there are multiple promoted nodes (probably not possible in practice for mysql, but I'm not sure), then the parsing will probably break.

The main issue of course is that it doesn't work. I'd suggest something like crm_resource --resource <rsc_name> --locate --output-as=xml and then grabbing the node name(s) from the XML output where state="promoted".

# crm_resource -r stateful --locate --output-as=xml
<pacemaker-result api-version="2.28" request="crm_resource -r stateful --locate --output-as=xml">
  <nodes resource="stateful">
    <node state="promoted">fastvm-rhel-9-0-42</node>
    <node>fastvm-rhel-9-0-41</node>
  </nodes>
  <status code="0" message="OK"/>
</pacemaker-result>

The best practice is for tools to parse the XML output, since the text output format may change.

nrwahl2 avatar Jan 26 '23 19:01 nrwahl2

Makes sense to me.

According to Damien multi-promoted doesnt handle conflicts, so they would have to use galera for that use-case.

oalbrigt avatar Jan 27 '23 08:01 oalbrigt