~ignacio-nin/+junk/percona-xtradb-cluster-galera

« back to all changes in this revision

Viewing changes to gcs/src/gcs_group.c

  • Committer: Alex Yurchenko
  • Date: 2011-11-13 20:37:10 UTC
  • mfrom: (87.1.2 1.x)
  • Revision ID: ayurchen@void-20111113203710-l2hjr20de14hk79j
References lp:884566 - synced with SVN branch 2.x r2509

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (C) 2008 Codership Oy <info@codership.com>
3
3
 *
4
 
 * $Id: gcs_group.c 2487 2011-11-04 00:11:27Z alex $
 
4
 * $Id: gcs_group.c 2497 2011-11-09 21:41:52Z alex $
5
5
 */
6
6
 
7
7
#include "gcs_group.h"
773
773
    bool required_donor = (strlen(donor_name) > 0);
774
774
 
775
775
    if (required_donor) {
776
 
        if (desync) {
777
 
            donor_idx = joiner_idx; // sender wants to become "donor" itself
 
776
        if (desync) { // sender wants to become "donor" itself
 
777
            gcs_node_state_t const st = group->nodes[joiner_idx].status;
 
778
            if (st >= min_donor_state)
 
779
                donor_idx = joiner_idx;
 
780
            else
 
781
                donor_idx = -EAGAIN;
778
782
        }
779
783
        else {
780
784
            donor_idx = group_find_node_by_name (group, joiner_idx, donor_name,
881
885
 
882
886
    donor_idx = group_select_donor(group, joiner_idx, donor_name, desync);
883
887
 
884
 
    assert (donor_idx != joiner_idx || desync);
885
 
    assert (donor_idx == joiner_idx || !desync);
 
888
    assert (donor_idx != joiner_idx || desync  || donor_idx < 0);
 
889
    assert (donor_idx == joiner_idx || !desync || donor_idx < 0);
886
890
 
887
891
    if (group->my_idx != joiner_idx && group->my_idx != donor_idx) {
888
892
        // if neither DONOR nor JOINER, ignore request