Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP5:GA
pacemaker
bsc#1182313-0001-Refactor-scheduler-improve-xpa...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc#1182313-0001-Refactor-scheduler-improve-xpath-efficiency-when-unp.patch of Package pacemaker
From 5754a2af94f6b2024752ac40642f72fa0925a59f Mon Sep 17 00:00:00 2001 From: Ken Gaillot <kgaillot@redhat.com> Date: Thu, 2 Feb 2023 09:42:01 -0600 Subject: [PATCH 1/5] Refactor: scheduler: improve xpath efficiency when unpacking Using "//" means that every child must be searched recursively. If we know the exact path, we should explicitly specify it. --- lib/pengine/unpack.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c index 78ed70df6..2aec59a2d 100644 --- a/lib/pengine/unpack.c +++ b/lib/pengine/unpack.c @@ -2578,6 +2578,13 @@ set_node_score(gpointer key, gpointer value, gpointer user_data) node->weight = *score; } +#define XPATH_NODE_STATE "/" XML_TAG_CIB "/" XML_CIB_TAG_STATUS \ + "/" XML_CIB_TAG_STATE +#define SUB_XPATH_LRM_RESOURCE "/" XML_CIB_TAG_LRM \ + "/" XML_LRM_TAG_RESOURCES \ + "/" XML_LRM_TAG_RESOURCE +#define SUB_XPATH_LRM_RSC_OP "/" XML_LRM_TAG_RSC_OP + static xmlNode * find_lrm_op(const char *resource, const char *op, const char *node, const char *source, int target_rc, pe_working_set_t *data_set) @@ -2590,10 +2597,9 @@ find_lrm_op(const char *resource, const char *op, const char *node, const char * xpath = g_string_sized_new(256); pcmk__g_strcat(xpath, - "//" XML_CIB_TAG_STATE "[@" XML_ATTR_UNAME "='", node, "']" - "//" XML_LRM_TAG_RESOURCE - "[@" XML_ATTR_ID "='", resource, "']" - "/" XML_LRM_TAG_RSC_OP "[@" XML_LRM_ATTR_TASK "='", op, "'", + XPATH_NODE_STATE "[@" XML_ATTR_UNAME "='", node, "']" + SUB_XPATH_LRM_RESOURCE "[@" XML_ATTR_ID "='", resource, "']" + SUB_XPATH_LRM_RSC_OP "[@" XML_LRM_ATTR_TASK "='", op, "'", NULL); /* Need to check against transition_magic too? */ @@ -2638,10 +2644,8 @@ find_lrm_resource(const char *rsc_id, const char *node_name, xpath = g_string_sized_new(256); pcmk__g_strcat(xpath, - "//" XML_CIB_TAG_STATE - "[@" XML_ATTR_UNAME "='", node_name, "']" - "//" XML_LRM_TAG_RESOURCE - "[@" XML_ATTR_ID "='", rsc_id, "']", + XPATH_NODE_STATE "[@" XML_ATTR_UNAME "='", node_name, "']" + SUB_XPATH_LRM_RESOURCE "[@" XML_ATTR_ID "='", rsc_id, "']", NULL); xml = get_xpath_object((const char *) xpath->str, data_set->input, -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor