[sheepdog] Is it necessary for outstanding io block leave/join event?

Yibin Shen zituan at taobao.com
Wed May 16 05:35:33 CEST 2012


static inline void process_event_queue(void)
{
        struct event_struct *cevent;
        /*
         * we need to serialize events so we don't call queue_work
         * if one event is running by executing event_fn() or event_done().
         */
        if (event_running || sys->nr_outstanding_io)
                return;

        cevent = list_first_entry(&sys->event_queue,
                        struct event_struct, event_list);
        list_del(&cevent->event_list);
        sys->cur_cevent = cevent;

        event_running = 1;

        event_work.fn = event_fn;
        event_work.done = event_done;

        unregister_event(cdrv_fd);
        queue_work(sys->event_wqueue, &event_work);
}

given some simple cases, there is a sheep cluster with node A, B, C,
and node C down.

1.1 case 1
===========
1. A have infly IO(A->B)
2. C leave
3. switchs
   1. B have no infly IO, so B start to handle leave event, epoch++.
      1. B start to handle IO(A->B), epoch is not indentical, so return fail.
      2. A re-queue IO(A->B).
      3. A start to handle leave event. epoch++.
      4. resend IO.
   2. B have infly IO(^A->B)
      1. B finish infly IO(^A->B)
      2. B start to handle leave event , epoch++
      3. B start to handle IO(A->B), but epoch is not indentical, return fail.
      4. A re-queue IO(A->B).
      5. A start to handle leave event. epoch++.
      6. resend IO(A->B).
   3. B have infly IO(A->B)
      1. B finish infly IO(A->B).
      2. B start to handle leave event, epoch++.
      3. A finish infly IO(A->B).
      4. A start to handle leave event, epoch++.

1.2 case 2
===========
1. infly IO(A->C)
2. C down
3. C is unreachable, so return fail after socket dead
4. A re-queue IO(A->C)
5. A start to handle leave event, epoch++.

join event is similar. so in all cases I can consider,
seems harmless for leave/join event be handled while sheep still have
outstanding IO,
that will accelerate cluster recovery effectively.

________________________________

This email (including any attachments) is confidential and may be legally privileged. If you received this email in error, please delete it immediately and do not copy it or use it for any purpose or disclose its contents to any other person. Thank you.

本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。



More information about the sheepdog mailing list