Hi Andrew, 2010/11/15 Andrew Beekhof <and...@beekhof.net>: > If someone can fix the patch so that the regression tests pass I'll > apply it, but I won't have any time to work on it for at least a few > weeks.
I've been trying to write a patch for this, and it almost works fine, but I found that it is very hard to make it 100% compatible with the latest glib2 because of the implementation difference of GHashTable between glib2-2.12(RHEL5) and glib2-2.26. The attached patch almost works well, except that the regression tests fails on 3 items regarding to the utilization test cases. (the patch and the failed diff are attached) ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- Test utilization-order1: Utilization Order - Simple * FAILED: xml-file changed Test utilization-order2: Utilization Order - Complex * FAILED: xml-file changed Test utilization-order3: Utilization Order - Migrate * FAILED: xml-file changed * ERROR: Results of 3 failed tests (out of 293) are in ./.regression.failed.diff.... ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- It seems only the difference of the processing order of the nodes at pengine/native.c:native_internal_constraints(). This difference comes because GHashTable is implemented differently, where glib2-2.12 uses a linked list for iteration, while glib2-2.26 no longer uses a linked list and just go through an array. I think that the possible options that we can take are: 1) Apply the patch and just ignore the errors on RHEL5 - as long as they're considered harmless. 2) Sort the node list when creating the graph of the utilization - although it may cause another performance penalty. 3) Revert using GList for the node list - if the node lookup is not the major factor of the performance issue. It's all up to you. Hope it helps. Thanks, Keisuke MORI > > On Mon, Nov 15, 2010 at 2:59 AM, nozawat <noza...@gmail.com> wrote: >> Hi Andrew and Nikola, >> >> Oneself carried out regression test, too, and an error was given equally. >> >> Regards, >> Tomo >> >> >> 2010/11/12 Nikola Ciprich <extmaill...@linuxbox.cz> >>> >>> (resent) >>> 1.1.4 with new glib2: tests pass smoothly >>> 1.1.4 + patch and older glib2 - all tests are segfaulting... >>> >>> ie: >>> Program terminated with signal 11, Segmentation fault. >>> #0 IA__g_str_hash (v=0x0) at gstring.c:95 >>> 95 guint32 h = *p; >>> (gdb) bt >>> #0 IA__g_str_hash (v=0x0) at gstring.c:95 >>> #1 0x00007fe087bb6128 in g_hash_table_lookup_node (hash_table=0x1390ec0, >>> key=0x0, value=0x13a3b00) at ghash.c:231 >>> #2 IA__g_hash_table_insert (hash_table=0x1390ec0, key=0x0, >>> value=0x13a3b00) at ghash.c:336 >>> #3 0x00007fe089367953 in convert_graph_action (resource=0x13a30a0, >>> action=0x139cb80, status=0, rc=7) at unpack.c:308 >>> #4 0x000000000040362a in exec_rsc_action (graph=0x1394fa0, >>> action=0x139cb80) at crm_inject.c:359 >>> #5 0x00007fe089368642 in initiate_action (graph=0x1394fa0, >>> action=0x139cb80) at graph.c:172 >>> #6 0x00007fe08936899d in fire_synapse (graph=0x1394fa0, >>> synapse=0x139ba60) at graph.c:204 >>> #7 0x00007fe089368dbd in run_graph (graph=0x1394fa0) at graph.c:262 >>> #8 0x000000000040428f in run_simulation (data_set=0x7fff712280a0) at >>> crm_inject.c:540 >>> #9 0x000000000040632a in main (argc=9, argv=0x7fff71228308) at >>> crm_inject.c:1148 >>> >>> -- Keisuke MORI
# HG changeset patch # User Keisuke MORI <kskm...@intellilink.co.jp> # Date 1290657182 -32400 # Node ID d0b7749d477fe9048c2edd877c07a411282540e5 # Parent 6407a7137b5748d6375083f0be843c198b3d95d2 [mq]: glib2.patch diff -r 6407a7137b57 -r d0b7749d477f configure.ac --- a/configure.ac Fri Nov 19 18:19:03 2010 +0100 +++ b/configure.ac Thu Nov 25 12:53:02 2010 +0900 @@ -654,7 +654,7 @@ AC_MSG_RESULT(using $GLIBCONFIG) AC_CHECK_LIB(glib-2.0, g_hash_table_get_values) if test "x$ac_cv_lib_glib_2_0_g_hash_table_get_values" != x""yes; then - AC_MSG_ERROR(Your version of Glib is too old, you need at least 2.14) + AC_MSG_WARN(Your version of Glib is too old, you should have at least 2.14) fi # diff -r 6407a7137b57 -r d0b7749d477f include/crm/common/util.h --- a/include/crm/common/util.h Fri Nov 19 18:19:03 2010 +0100 +++ b/include/crm/common/util.h Thu Nov 25 12:53:02 2010 +0900 @@ -298,4 +298,69 @@ extern int node_score_infinity; extern xmlNode *create_operation_update(xmlNode *parent, lrm_op_t *op, const char *caller_version, int target_rc, const char *origin, int level); extern void free_lrm_op(lrm_op_t *op); +#if HAVE_LIBGLIB_2_0 + +#else + +typedef struct fake_ghi +{ + GHashTable *hash; + int nth; /* current index over the iteration */ + int lpc; /* internal loop counter inside g_hash_table_find */ + gpointer key; + gpointer value; +} GHashTableIter; + +static inline void g_hash_prepend_value(gpointer key, gpointer value, gpointer user_data) +{ + GList **values = (GList **)user_data; + *values = g_list_prepend(*values, value); +} + +static inline GList *g_hash_table_get_values(GHashTable *hash_table) +{ + GList *values = NULL; + g_hash_table_foreach(hash_table, g_hash_prepend_value, &values); + return values; +} + + +static inline gboolean g_hash_table_nth_data(gpointer key, gpointer value, gpointer user_data) +{ + GHashTableIter *iter = (GHashTableIter *)user_data; + if (iter->lpc++ == iter->nth) { + iter->key = key; + iter->value = value; + return TRUE; + } + return FALSE; +} + +static inline void g_hash_table_iter_init(GHashTableIter *iter, GHashTable *hash_table) +{ + iter->hash = hash_table; + iter->nth = 0; + iter->lpc = 0; + iter->key = NULL; + iter->value = NULL; +} + +static inline gboolean g_hash_table_iter_next(GHashTableIter *iter, gpointer *key, gpointer *value) +{ + gboolean found = FALSE; + iter->lpc = 0; + iter->key = NULL; + iter->value = NULL; + if (iter->nth < g_hash_table_size(iter->hash)) { + found = !!g_hash_table_find(iter->hash, g_hash_table_nth_data, iter); + iter->nth++; + } + if (key) *key = iter->key; + if (value) *value = iter->value; + return found; +} + #endif + +#endif +
--- ./test10/utilization-order1.exp 2010-11-25 11:50:09.000000000 +0900 +++ ./test10/utilization-order1.out 2010-11-26 19:17:18.000000000 +0900 @@ -8,7 +8,7 @@ </action_set> <inputs> <trigger> - <pseudo_event id="3" operation="load_stopped_node1" operation_key="load_stopped_node1"/> + <pseudo_event id="2" operation="load_stopped_node1" operation_key="load_stopped_node1"/> </trigger> </inputs> </synapse> @@ -39,23 +39,23 @@ </synapse> <synapse id="4"> <action_set> - <pseudo_event id="3" operation="load_stopped_node1" operation_key="load_stopped_node1"> + <pseudo_event id="3" operation="load_stopped_node2" operation_key="load_stopped_node2"> <attributes crm_feature_set="3.0.5"/> </pseudo_event> </action_set> - <inputs> - <trigger> - <rsc_op id="8" operation="stop" operation_key="rsc1_stop_0" on_node="node1" on_node_uuid="node1"/> - </trigger> - </inputs> + <inputs/> </synapse> <synapse id="5"> <action_set> - <pseudo_event id="2" operation="load_stopped_node2" operation_key="load_stopped_node2"> + <pseudo_event id="2" operation="load_stopped_node1" operation_key="load_stopped_node1"> <attributes crm_feature_set="3.0.5"/> </pseudo_event> </action_set> - <inputs/> + <inputs> + <trigger> + <rsc_op id="8" operation="stop" operation_key="rsc1_stop_0" on_node="node1" on_node_uuid="node1"/> + </trigger> + </inputs> </synapse> <synapse id="6"> <action_set> --- ./test10/utilization-order2.exp 2010-11-11 17:47:24.000000000 +0900 +++ ./test10/utilization-order2.out 2010-11-26 19:17:18.000000000 +0900 @@ -8,7 +8,7 @@ </action_set> <inputs> <trigger> - <pseudo_event id="3" operation="load_stopped_node1" operation_key="load_stopped_node1"/> + <pseudo_event id="2" operation="load_stopped_node1" operation_key="load_stopped_node1"/> </trigger> </inputs> </synapse> @@ -21,7 +21,7 @@ </action_set> <inputs> <trigger> - <pseudo_event id="2" operation="load_stopped_node2" operation_key="load_stopped_node2"/> + <pseudo_event id="3" operation="load_stopped_node2" operation_key="load_stopped_node2"/> </trigger> <trigger> <rsc_op id="8" operation="stop" operation_key="rsc3_stop_0" on_node="node1" on_node_uuid="node1"/> @@ -100,28 +100,28 @@ </synapse> <synapse id="9"> <action_set> - <pseudo_event id="3" operation="load_stopped_node1" operation_key="load_stopped_node1"> + <pseudo_event id="3" operation="load_stopped_node2" operation_key="load_stopped_node2"> <attributes crm_feature_set="3.0.5"/> </pseudo_event> </action_set> <inputs> <trigger> - <rsc_op id="8" operation="stop" operation_key="rsc3_stop_0" on_node="node1" on_node_uuid="node1"/> - </trigger> - <trigger> - <rsc_op id="12" operation="stop" operation_key="rsc2:1_stop_0" on_node="node1" on_node_uuid="node1"/> + <rsc_op id="17" operation="stop" operation_key="rsc1_stop_0" on_node="node2" on_node_uuid="node2"/> </trigger> </inputs> </synapse> <synapse id="10"> <action_set> - <pseudo_event id="2" operation="load_stopped_node2" operation_key="load_stopped_node2"> + <pseudo_event id="2" operation="load_stopped_node1" operation_key="load_stopped_node1"> <attributes crm_feature_set="3.0.5"/> </pseudo_event> </action_set> <inputs> <trigger> - <rsc_op id="17" operation="stop" operation_key="rsc1_stop_0" on_node="node2" on_node_uuid="node2"/> + <rsc_op id="8" operation="stop" operation_key="rsc3_stop_0" on_node="node1" on_node_uuid="node1"/> + </trigger> + <trigger> + <rsc_op id="12" operation="stop" operation_key="rsc2:1_stop_0" on_node="node1" on_node_uuid="node1"/> </trigger> </inputs> </synapse> --- ./test10/utilization-order3.exp 2010-11-11 17:47:24.000000000 +0900 +++ ./test10/utilization-order3.out 2010-11-26 19:17:18.000000000 +0900 @@ -8,7 +8,7 @@ </action_set> <inputs> <trigger> - <pseudo_event id="3" operation="load_stopped_node1" operation_key="load_stopped_node1"/> + <pseudo_event id="2" operation="load_stopped_node1" operation_key="load_stopped_node1"/> </trigger> </inputs> </synapse> @@ -42,7 +42,7 @@ </action_set> <inputs> <trigger> - <pseudo_event id="2" operation="load_stopped_node2" operation_key="load_stopped_node2"/> + <pseudo_event id="3" operation="load_stopped_node2" operation_key="load_stopped_node2"/> </trigger> <trigger> <rsc_op id="8" operation="stop" operation_key="rsc1_stop_0" on_node="node1" on_node_uuid="node1"/> @@ -80,23 +80,23 @@ </synapse> <synapse id="7"> <action_set> - <pseudo_event id="3" operation="load_stopped_node1" operation_key="load_stopped_node1"> + <pseudo_event id="3" operation="load_stopped_node2" operation_key="load_stopped_node2"> <attributes crm_feature_set="3.0.5"/> </pseudo_event> </action_set> - <inputs> - <trigger> - <rsc_op id="8" operation="stop" operation_key="rsc1_stop_0" on_node="node1" on_node_uuid="node1"/> - </trigger> - </inputs> + <inputs/> </synapse> <synapse id="8"> <action_set> - <pseudo_event id="2" operation="load_stopped_node2" operation_key="load_stopped_node2"> + <pseudo_event id="2" operation="load_stopped_node1" operation_key="load_stopped_node1"> <attributes crm_feature_set="3.0.5"/> </pseudo_event> </action_set> - <inputs/> + <inputs> + <trigger> + <rsc_op id="8" operation="stop" operation_key="rsc1_stop_0" on_node="node1" on_node_uuid="node1"/> + </trigger> + </inputs> </synapse> <synapse id="9"> <action_set>
_______________________________________________ Pacemaker mailing list: Pacemaker@oss.clusterlabs.org http://oss.clusterlabs.org/mailman/listinfo/pacemaker Project Home: http://www.clusterlabs.org Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker