[sheepdog] [PATCH 1/4] zookeeper: remove unneccessary zk operation
Liu Yuan
namei.unix at gmail.com
Sat Jul 6 04:17:38 CEST 2013
On Fri, Jul 05, 2013 at 06:59:05PM -0700, Kai Zhang wrote:
> Current implementation of zk_handle_unblock() sends an NOTIFY event to
> all sheep. All sheep who receive NOTIFY event will call
> sd_notify_handler() to do unblock.
> However, this is unncessary, we can call sd_notify_handler() directly
> in zk_handle_unblock().
> And this how corosync driver handle unblock.
No, I think you misunderstood the corosync code, corosync send NOTIFY event
to all sheep as zookeeper do. Reason inline.
>
> Signed-off-by: Kai Zhang <kyle at zelin.io>
> ---
> sheep/cluster/zookeeper.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sheep/cluster/zookeeper.c b/sheep/cluster/zookeeper.c
> index aafc18d..29a1237 100644
> --- a/sheep/cluster/zookeeper.c
> +++ b/sheep/cluster/zookeeper.c
> @@ -978,8 +978,7 @@ static void zk_handle_unblock(struct zk_event *ev)
> if (list_empty(&zk_block_list))
> return;
> block = list_first_entry(&zk_block_list, typeof(*block), list);
> - if (block->callbacked)
> - add_event(EVENT_NOTIFY, block, ev->buf, ev->buf_len);
> + sd_notify_handler(&ev->sender.node, ev->buf, ev->buf_len);
>
Only there is only one sheep (who sends BLOCK) will have block->callbacked set
true. We have to update all the state of sheep from blocked to unblock, we need
to broadcast notify.
Thanks
Yuan
More information about the sheepdog
mailing list