[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/group/daemon Makefile cman.c cpg.c gd_ ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland sourceware org	2006-06-30 15:29:19

Modified files:
	group/daemon   : Makefile cman.c cpg.c gd_internal.h 

Log message:
	- build against installed openais/cman headers and libs
	- if a cman node fails that isn't in the groupd cpg, don't wait
	on a cpg update for it

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/Makefile.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/cman.c.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/cpg.c.diff?cvsroot=cluster&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/gd_internal.h.diff?cvsroot=cluster&r1=1.36&r2=1.37

--- cluster/group/daemon/Makefile	2006/06/28 19:55:32	1.12
+++ cluster/group/daemon/Makefile	2006/06/30 15:29:17	1.13
@@ -14,7 +14,8 @@
 include ${top_srcdir}/make/defines.mk
 UNINSTALL=${top_srcdir}/scripts/uninstall.pl
 
-CFLAGS+= -g -I. -I../include/ -I../../cman/lib/ -I../lib/ -I../../cman/daemon/openais/trunk/include/
+CFLAGS+= -g -I. -I../include/ -I../../cman/lib/ -I../lib/
+LDFLAGS+= -L/usr/lib/openais -L/usr/lib
 
 TARGET=groupd
 
@@ -24,10 +25,8 @@
 	cpg.o \
 	cman.o \
 	joinleave.o \
-	main.o \
-	../../cman/lib/libcman.a \
-	../../cman/daemon/openais/trunk/lib/libcpg.a
-	$(CC) $(LDFLAGS) -o $@ $^
+	main.o
+	$(CC) $(LDFLAGS) -lcman -lcpg -o $@ $^
 
 app.o: app.c gd_internal.h
 	$(CC) $(CFLAGS) -c -o $@ $<
--- cluster/group/daemon/cman.c	2006/06/20 20:26:08	1.24
+++ cluster/group/daemon/cman.c	2006/06/30 15:29:17	1.25
@@ -97,7 +97,12 @@
 			rs = get_recovery_set(old_nodes[i].cn_nodeid);
 			rs->cman_update = 1;
 
-			if (rs->cpg_update && list_empty(&rs->entries)) {
+			if (!rs->cpg_update && !in_groupd_cpg(rs->nodeid)) {
+				log_debug("free recovery set %d not in cpg",
+					  rs->nodeid);
+				list_del(&rs->list);
+				free(rs);
+			} else if (rs->cpg_update && list_empty(&rs->entries)) {
 				log_debug("free unused recovery set %d cman",
 					  rs->nodeid);
 				list_del(&rs->list);
--- cluster/group/daemon/cpg.c	2006/06/22 22:24:48	1.28
+++ cluster/group/daemon/cpg.c	2006/06/30 15:29:17	1.29
@@ -94,7 +94,7 @@
 
 	if (nodeid == our_nodeid) {
 		for (i = 0; i < saved_member_count; i++) {
-			node = new_node(saved_member[i].nodeId);
+			node = new_node(saved_member[i].nodeid);
 			list_add_tail(&node->list, &g->memb);
 			g->memb_count++;
 			log_group(g, "cpg add node %d total %d",
@@ -153,7 +153,7 @@
 	groupd_cpg_member_count = saved_member_count;
 
 	for (i = 0; i < saved_member_count; i++) {
-		if (saved_member[i].nodeId == our_nodeid &&
+		if (saved_member[i].nodeid == our_nodeid &&
 		    saved_member[i].pid == (uint32_t) getpid()) {
 			found = 1;
 		}
@@ -170,8 +170,8 @@
 
 	for (i = 0; i < saved_left_count; i++) {
 		if (saved_left[i].reason != CPG_REASON_LEAVE) {
-			add_recovery_set(saved_left[i].nodeId);
-			groupd_down(saved_left[i].nodeId);
+			add_recovery_set(saved_left[i].nodeid);
+			groupd_down(saved_left[i].nodeid);
 		}
 	}
 }
@@ -183,10 +183,18 @@
 	data->level = -1;
 	data->member_count = groupd_cpg_member_count;
 	for (i = 0; i < groupd_cpg_member_count; i++)
-		data->members[i] = groupd_cpg_member[i].nodeId;
+		data->members[i] = groupd_cpg_member[i].nodeid;
 }
 
-/* FIXME: also match name */
+int in_groupd_cpg(int nodeid)
+{
+	int i;
+	for (i = 0; i < groupd_cpg_member_count; i++) {
+		if (nodeid == groupd_cpg_member[i].nodeid)
+			return 1;
+	}
+	return 0;
+}
 
 group_t *find_group_by_handle(cpg_handle_t h)
 {
@@ -275,16 +283,16 @@
 		  saved_left_count, saved_joined_count, saved_member_count);
 
 	for (i = 0; i < saved_joined_count; i++)
-		process_node_join(g, saved_joined[i].nodeId);
+		process_node_join(g, saved_joined[i].nodeid);
 
 	for (i = 0; i < saved_left_count; i++) {
 		log_group(g, "confchg removed node %d reason %d",
-			  saved_left[i].nodeId, saved_left[i].reason);
+			  saved_left[i].nodeid, saved_left[i].reason);
 
 		if (saved_left[i].reason == CPG_REASON_LEAVE)
-			process_node_leave(g, saved_left[i].nodeId);
+			process_node_leave(g, saved_left[i].nodeid);
 		else
-			process_node_down(g, saved_left[i].nodeId);
+			process_node_down(g, saved_left[i].nodeid);
 	}
 }
 
@@ -335,14 +343,26 @@
 	saved_name.length = group_name->length;
 	memcpy(&saved_name.value, &group_name->value, group_name->length);
 
-	for (i = 0; i < left_list_entries; i++)
+	/* fprintf(stderr, "CONFCHG LEFT: "); */
+	for (i = 0; i < left_list_entries; i++) {
 		saved_left[i] = left_list[i];
+		/* fprintf(stderr, "%d ", left_list[i].nodeid); */
+	}
+	/* fprintf(stderr, "\n"); */
 
-	for (i = 0; i < joined_list_entries; i++)
+	/* fprintf(stderr, "CONFCHG JOIN: "); */
+	for (i = 0; i < joined_list_entries; i++) {
 		saved_joined[i] = joined_list[i];
+		/* fprintf(stderr, "%d ", joined_list[i].nodeid); */
+	}
+	/* fprintf(stderr, "\n"); */
 
-	for (i = 0; i < member_list_entries; i++)
+	/* fprintf(stderr, "CONFCHG MEMB: "); */
+	for (i = 0; i < member_list_entries; i++) {
 		saved_member[i] = member_list[i];
+		/* fprintf(stderr, "%d ", member_list[i].nodeid); */
+	}
+	/* fprintf(stderr, "\n"); */
 
 	got_confchg = 1;
 }
@@ -510,7 +530,6 @@
 	if (error != CPG_OK)
 		log_group(g, "cpg_mcast_joined error %d handle %llx", error, h);
 	if (error == CPG_ERR_TRY_AGAIN) {
-		/* FIXME: backoff say .25 sec, .5 sec, .75 sec, 1 sec */
 		retries++;
 		if (retries > 3)
 			sleep(1);
--- cluster/group/daemon/gd_internal.h	2006/06/28 22:16:36	1.36
+++ cluster/group/daemon/gd_internal.h	2006/06/30 15:29:17	1.37
@@ -33,13 +33,12 @@
 #include <sys/poll.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
+#include <openais/cpg.h>
 
 #include "list.h"
 #include "linux_endian.h"
 #include "groupd.h"
 #include "libgroup.h"
-#include "saAis.h"
-#include "cpg.h"
 
 #define MAX_NAMELEN		(32)	/* should match libgroup.h */
 #define MAX_LEVELS		(4)
@@ -276,6 +275,7 @@
 int send_message(group_t *g, void *buf, int len);
 int send_message_groupd(group_t *g, void *buf, int len);
 void copy_groupd_data(group_data_t *data);
+int in_groupd_cpg(int nodeid);
 
 /* joinleave.c */
 void remove_group(group_t *g);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]