Hello,

when constantly sending new data via attrd the changes are never used.


Example:
   while sleep 1
     do attrd_updater -l reboot -d 5 -n rep_chg -U try$SECONDS
     cibadmin -Ql | grep rep_chg
   done

This always returns the same value - the one that was given with more than 5 
seconds delay afterwards, so that the dampen interval wasn't broken by the 
next change.


I've attached two draft patches; one for allowing the _first_ value in a 
dampen interval to be used (effectively ignoring changes until this value is 
written), and one for using the _last_ value in the dampen interval (by not 
changing the dampen timer). [1]


***  Note: they are for discussion only!
***  I didn't test them, not even for compilation.


Perhaps this "bug" [2] was introduced with one of these changes (the hashes 
are the GIT numbers)

    High: crmd: Bug lf#2528 - Introduce a slight delay when
          creating a transition to allow attrd time to perform its updates
    e7f5da92490844d190609931f434e08c0440da0f

    Low: attrd: Indicate when attrd clients are updating fields
    69b49b93ff6fd25ac91f589d8149f2e71a5114c5


What is the correct way to handle multiple updates within the dampen 
interval?


Thank you for any hints or ideas.


Regards,

Phil


Ad [1]: I even tried to provide an average, median or some other value here; 
but a) this isn't necessarily valid (for boolean or integer values), and b) 
as the data gets stored and transmitted as string it wouldn't easily work 
anyway.
So the question remaining is just first or last value, IMO.

Ad [2]: if this _is_ a bug -- but I'd certainly argue that way, as _not_ 
propagating a change is worse than a changing value.
From d06837c2637fea792b71fbd7a70db48ab0258a77 Mon Sep 17 00:00:00 2001
From: Philipp Marek <philipp.ma...@linbit.com>
Date: Wed, 19 Oct 2011 16:09:47 +0200
Subject: [PATCH] Only allow a single change to be queued.

---
 tools/attrd.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git tools/attrd.c tools/attrd.c
index 83e029e..ab756c1 100644
--- tools/attrd.c
+++ tools/attrd.c
@@ -823,8 +823,8 @@ attrd_local_callback(xmlNode * msg)
     }
 
   set_unexpanded:
-    if (safe_str_eq(value, hash_entry->value) && hash_entry->timer_id) {
-        /* We're already waiting to set this value */
+    if (hash_entry->timer_id) {
+		/* We're already waiting to set this value */
         return;
     }
 
@@ -835,6 +835,8 @@ attrd_local_callback(xmlNode * msg)
         crm_debug("New value of %s is %s", attr, value);
     }
 
+	// don't allow change if in progress?
+	// don't restart timer?
     stop_attrd_timer(hash_entry);
 
     if (hash_entry->timeout > 0) {
-- 
1.7.6.3

From 9674ac1ae8e106b71fcc13ff1521dedd9def9b6e Mon Sep 17 00:00:00 2001
From: Philipp Marek <philipp.ma...@linbit.com>
Date: Wed, 19 Oct 2011 16:13:19 +0200
Subject: [PATCH] The last written value is propagated.

---
 tools/attrd.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git tools/attrd.c tools/attrd.c
index 83e029e..11d25a1 100644
--- tools/attrd.c
+++ tools/attrd.c
@@ -835,11 +835,10 @@ attrd_local_callback(xmlNode * msg)
         crm_debug("New value of %s is %s", attr, value);
     }
 
-    stop_attrd_timer(hash_entry);
-
     if (hash_entry->timeout > 0) {
-        hash_entry->timer_id = g_timeout_add(hash_entry->timeout, attrd_timer_callback, hash_entry);
+        /* Keep previous timeout */
     } else {
+        stop_attrd_timer(hash_entry);
         attrd_trigger_update(hash_entry);
     }
 
-- 
1.7.6.3

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to