File pacemaker-crmd-scale-timeouts-with-number-of-remotes-too.patch of Package pacemaker.14737
commit 5bf05e5a0e3684ad0aace93abceb0a972e6f8440
Author: Andrew Beekhof <andrew@beekhof.net>
Date: Tue Oct 24 09:46:10 2017 +1100
Fix: crmd: Scale timeouts with the number of remotes too
diff --git a/crmd/crmd_utils.h b/crmd/crmd_utils.h
index 9a09340b4..296d88fd3 100644
--- a/crmd/crmd_utils.h
+++ b/crmd/crmd_utils.h
@@ -106,6 +106,7 @@ void st_fail_count_increment(const char *target);
void abort_for_stonith_failure(enum transition_action abort_action,
const char *target, xmlNode *reason);
void crmd_peer_down(crm_node_t *peer, bool full);
+unsigned int cib_op_timeout(unsigned int max);
/* Convenience macro for registering a CIB callback
* (assumes that data can be freed with free())
@@ -113,7 +114,7 @@ void crmd_peer_down(crm_node_t *peer, bool full);
# define fsa_register_cib_callback(id, flag, data, fn) do { \
CRM_ASSERT(fsa_cib_conn); \
fsa_cib_conn->cmds->register_callback_full( \
- fsa_cib_conn, id, 10 * (1 + crm_active_peers()), \
+ fsa_cib_conn, id, cib_op_timeout(30), \
flag, data, #fn, fn, free); \
} while(0)
diff --git a/crmd/utils.c b/crmd/utils.c
index 765aa4d16..f272d23bd 100644
--- a/crmd/utils.c
+++ b/crmd/utils.c
@@ -1020,3 +1020,33 @@ void crmd_peer_down(crm_node_t *peer, bool full)
crm_update_peer_join(__FUNCTION__, peer, crm_join_none);
crm_update_peer_expected(__FUNCTION__, peer, CRMD_JOINSTATE_DOWN);
}
+
+unsigned int
+cib_op_timeout(unsigned int max)
+{
+ unsigned int global_max = 0;
+
+ if (global_max == 0) {
+ const char *env = getenv("PCMK_cib_timeout");
+ unsigned int global_default = 1 + crm_active_peers();
+
+ if(crm_remote_peer_cache) {
+ global_default += g_hash_table_size(crm_remote_peer_cache);
+ }
+
+ global_default *= 10;
+
+ if (env) {
+ int env_max = crm_parse_int(env, "0");
+
+ global_max = (env_max > 0) ? QB_MAX(global_default, env_max) : global_default;
+
+ } else {
+ global_max = global_default;
+ }
+ crm_trace("Calculated timeout: %us (%s)", global_max, env);
+ }
+
+ return QB_MAX(max, global_max);
+}
+