[Openais] [PATCH] Fix synchronization for round-robin queue groups
Ryan O'Hara
rohara at redhat.com
Wed Aug 27 09:13:22 PDT 2008
Here is a patch to fix a minor issue with synchronization in the
message service.
When synchronizing a queue group, we need to check if the rr_queue is
set. If rr_queue is not NULL, then we should send the name of the
message queue to which rr_queue currently points to. If it is NULL, we
simply zero-out the rr_queue_name (in the sync structure).
The exec handler code for synchronizing queue groups can then set the
rr_queue accordingly.
-------------- next part --------------
Index: services/msg.c
===================================================================
--- services/msg.c (revision 1640)
+++ services/msg.c (working copy)
@@ -1011,6 +1011,13 @@
memcpy (&req_exec_msg_sync_group.group_name,
&group->name, sizeof (SaNameT));
+ if (group->rr_queue != NULL) {
+ memcpy (&req_exec_msg_sync_group.rr_queue_name,
+ &group->rr_queue->name, sizeof (SaNameT));
+ } else {
+ memset (&req_exec_msg_sync_group.rr_queue_name, 0, sizeof (SaNameT));
+ }
+
req_exec_msg_sync_group.policy = group->policy;
req_exec_msg_sync_group.track_flags = group->track_flags;
@@ -1446,7 +1453,7 @@
log_printf (LOG_LEVEL_NOTICE, "EXEC request: saMsgQueueOpen %s\n",
getSaNameT (&req_exec_msg_queueopen->queue_name));
-
+
queue = queue_find (&req_exec_msg_queueopen->queue_name);
/*
@@ -2459,6 +2466,7 @@
struct req_exec_msg_sync_group *req_exec_msg_sync_group =
(struct req_exec_msg_sync_group *)message;
struct queue_group *group = NULL;
+ struct message_queue *queue = NULL;
log_printf (LOG_LEVEL_NOTICE, "EXEC request: sync group %s\n",
getSaNameT (&req_exec_msg_sync_group->group_name));
@@ -2487,8 +2495,13 @@
group->track_flags = req_exec_msg_sync_group->policy;
- group->rr_queue = NULL; /* FIXME */
+ if (req_exec_msg_sync_group->rr_queue_name.length != 0) {
+ queue = sync_queue_find (&req_exec_msg_sync_group->rr_queue_name);
+ assert (queue != NULL);
+ }
+ group->rr_queue = queue;
+
list_init (&group->group_list);
list_init (&group->queue_head);
list_add (&group->group_list, &sync_group_list_head);
More information about the Openais
mailing list