Send Linux-ha-cvs mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: include by gshi from 
      ([email protected])
   2. Linux-HA CVS: lib by gshi from  ([email protected])
   3. Linux-HA CVS: heartbeat by gshi from 
      ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Tue, 20 Dec 2005 17:01:52 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: include by gshi from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : gshi
Host    : 
Project : linux-ha
Module  : include

Dir     : linux-ha/include


Modified Files:
        hb_api.h 


Log Message:
make max rexmit delay tunable in ha.cf


===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/hb_api.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- hb_api.h    16 Dec 2005 02:11:59 -0000      1.40
+++ hb_api.h    21 Dec 2005 00:01:51 -0000      1.41
@@ -1,4 +1,4 @@
-/* $Id: hb_api.h,v 1.40 2005/12/16 02:11:59 gshi Exp $ */
+/* $Id: hb_api.h,v 1.41 2005/12/21 00:01:51 gshi Exp $ */
 /*
  * Client-side Low-level clustering API for heartbeat.
  *
@@ -424,6 +424,7 @@
 #define KEY_AUTOJOIN   "autojoin"
 #define KEY_UUIDFROM   "uuidfrom"
 #define KEY_ENV                "env"
+#define KEY_MAX_REXMIT_DELAY "max_rexmit_delay"
 
 ll_cluster_t*  ll_cluster_new(const char * llctype);
 #endif /* __HB_API_H */




------------------------------

Message: 2
Date: Tue, 20 Dec 2005 19:34:32 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by gshi from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : gshi
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/hbclient


Modified Files:
        client_lib.c 


Log Message:
add random delay to a client status request message
the random delay happens in client process
The maxium delay for a  2-node cluster is .2 second
for a 100 nodes cluster, it is 10 second

A new api is added to get number of normal nodes


===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/hbclient/client_lib.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- client_lib.c        22 Sep 2005 17:18:55 -0000      1.33
+++ client_lib.c        21 Dec 2005 02:34:32 -0000      1.34
@@ -1,4 +1,4 @@
-/* $Id: client_lib.c,v 1.33 2005/09/22 17:18:55 gshi Exp $ */
+/* $Id: client_lib.c,v 1.34 2005/12/21 02:34:32 gshi Exp $ */
 /* 
  * client_lib: heartbeat API client side code
  *
@@ -49,6 +49,8 @@
 #include <hb_api_core.h>
 #include <hb_api.h>
 #include <glib.h>
+#include <clplumbing/cl_misc.h>
+
 
 struct sys_config *            config  = NULL;
 
@@ -221,6 +223,7 @@
 
 static void ha_api_perror(const char * fmt, ...) G_GNUC_PRINTF(1,2);
 static void ha_api_log(int priority, const char * fmt, ...) G_GNUC_PRINTF(2,3);
+static int     get_num_nodes(ll_cluster_t* lcl);
 
 
 #define        ZAPMSG(m)       {ha_msg_del(m); (m) = NULL;}
@@ -852,7 +855,10 @@
        /* If host is NULL, user choose the callback method to
         * get the result. This also implies timeout is useless */
        if (host == NULL) {
+               int max_delay;
                struct ha_msg * m = NULL;
+               int delay;
+               int num_nodes;
 
                if ((m = ha_msg_new(0)) == NULL
                ||      ha_msg_add(m, F_TYPE, T_QCSTATUS) != HA_OK
@@ -866,6 +872,21 @@
                        ha_log(LOG_ERR, "%s: cannot add field", __FUNCTION__);
                        return NULL;
                }
+               
+               /* We delay random time here to distribute requests from 
different nodes 
+                * across time in a big cluster
+                * in a 100-node cluster, the max deley is 10 seconds
+                */
+               num_nodes = get_num_nodes(lcl);
+               max_delay =  (1.0*num_nodes /10) *1000000; /* in microsecond*/
+               srand(cl_random());
+               delay = (1.0* rand()/RAND_MAX)*max_delay;
+               if (ANYDEBUG){
+                       cl_log(LOG_DEBUG, "Delaying cstatus request for %d ms", 
delay/1000);
+               }
+               
+               usleep(delay);
+               
                if (sendclustermsg(lcl, m) != HA_OK) {
                        ha_log(LOG_ERR, "%s: sendclustermsg fail",__FUNCTION__);
                }
@@ -977,6 +998,63 @@
 
        return ret;
 }
+
+
+
+static int
+get_num_nodes(ll_cluster_t* lcl)
+{
+       struct ha_msg*          request;
+       struct ha_msg*          reply;
+       const char *            result;
+       llc_private_t*          pi;
+       const char*             num_s;
+       int                     num;
+       
+
+       ClearLog();
+       if (!ISOURS(lcl)) {
+               ha_api_log(LOG_ERR, "%s: bad cinfo", __FUNCTION__);
+               return -1;
+       }
+       pi = (llc_private_t*)lcl->ll_cluster_private;
+
+       if (!pi->SignedOn) {
+               ha_api_log(LOG_ERR, "not signed on");
+               return -1;
+       }
+       
+       if ((request = hb_api_boilerplate(API_NUMNODES)) == NULL) {
+               return -1;
+       }
+       /* Send message */
+       if (msg2ipcchan(request, pi->chan) != HA_OK) {
+               ZAPMSG(request);
+               ha_api_perror("Can't send message to IPC Channel");
+               return -1;
+       }
+       ZAPMSG(request);
+       
+       /* Read reply... */
+       if ((reply=read_api_msg(pi)) == NULL) {
+               return -1;
+       }
+       if ((result = ha_msg_value(reply, F_APIRESULT)) != NULL
+           &&  strcmp(result, API_OK) == 0
+           &&  (num_s = ha_msg_value(reply, F_NUMNODES)) != NULL
+           && (num = atoi(num_s)) > 0){
+               /*everything is good, do nothing*/              
+       }else{
+               cl_log(LOG_ERR, "Wrong reply message");
+               cl_log_message(LOG_ERR, reply);
+               num = -1;
+       }
+       ZAPMSG(reply);
+
+       return num;
+}
+
+
 static char *  
 get_parameter(ll_cluster_t* lcl, const char* pname)
 {
@@ -3004,7 +3082,8 @@
        nextnode:               nextnode,               
        end_nodewalk:           end_nodewalk,           
        node_status:            get_nodestatus,         
-       node_type:              get_nodetype,           
+       node_type:              get_nodetype,   
+       num_nodes:              get_num_nodes,
        init_ifwalk:            init_ifwalk,            
        nextif:                 nextif,                 
        end_ifwalk:             end_ifwalk,             




------------------------------

Message: 3
Date: Tue, 20 Dec 2005 19:34:32 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by gshi from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : gshi
Host    : 
Project : linux-ha
Module  : heartbeat

Dir     : linux-ha/heartbeat


Modified Files:
        hb_api.c 


Log Message:
add random delay to a client status request message
the random delay happens in client process
The maxium delay for a  2-node cluster is .2 second
for a 100 nodes cluster, it is 10 second

A new api is added to get number of normal nodes


===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/hb_api.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -3 -r1.146 -r1.147
--- hb_api.c    9 Nov 2005 22:27:46 -0000       1.146
+++ hb_api.c    21 Dec 2005 02:34:32 -0000      1.147
@@ -1,4 +1,4 @@
-/* $Id: hb_api.c,v 1.146 2005/11/09 22:27:46 gshi Exp $ */
+/* $Id: hb_api.c,v 1.147 2005/12/21 02:34:32 gshi Exp $ */
 /*
  * hb_api: Server-side heartbeat API code
  *
@@ -122,6 +122,10 @@
 static int api_clientstatus (const struct ha_msg* msg, struct ha_msg* resp
 ,      client_proc_t* client, const char** failreason);
 
+static int
+api_num_nodes(const struct ha_msg* msg, struct ha_msg* resp
+             , client_proc_t* client, const char** failreason);
+
 static int api_get_parameter (const struct ha_msg* msg, struct ha_msg* resp
 ,      client_proc_t* client, const char** failreason);
 
@@ -149,6 +153,7 @@
        { API_IFSTATUS, api_ifstatus },
        { API_IFLIST, api_iflist },
        { API_CLIENTSTATUS, api_clientstatus },
+       { API_NUMNODES, api_num_nodes},
        { API_GETPARM, api_get_parameter},
        { API_GETRESOURCES, api_get_resources},
        { API_GETUUID, api_get_uuid},
@@ -830,6 +835,36 @@
         */
        return I_API_IGN;
 }
+/**********************************************************************
+ * API_NUM_NODES: Return the number of normal nodes
+ *********************************************************************/
+
+static int
+api_num_nodes(const struct ha_msg* msg, struct ha_msg* resp
+             , client_proc_t* client, const char** failreason)
+{
+       int ret;
+       int num_nodes = 0;
+       int i;
+
+       for( i = 0; i < config->nodecount; i++){
+               if (config->nodes[i].nodetype == NORMALNODE_I){
+                       num_nodes++;
+               }
+       }
+
+       ret = ha_msg_add_int(resp, F_NUMNODES, num_nodes);
+       if (ret != HA_OK){
+               cl_log(LOG_ERR, "%s: adding num_nodes field failed",
+                      __FUNCTION__);
+               *failreason= "adding msg field failed";
+               return I_API_BADREQ;
+       }
+       
+       return I_API_RET;
+
+}
+
 
 /**********************************************************************
  * API_GET_PARAMETER: Return the value of the given parameter...




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 25, Issue 49
********************************************

Reply via email to