rsm.cc
void
rsm::set_primary(unsigned vid)
{
  std::vector<std::string> c = cfg->get_view(vid);
  std::vector<std::string> p = cfg->get_view(vid - 1);
  VERIFY (c.size() > 0);

  if (isamember(primary,c)) {
    tprintf("set_primary: primary stays %s\n", primary.c_str());
    return;
  }

  VERIFY(p.size() > 0);
  for (unsigned i = 0; i < p.size(); i++) {
    if (isamember(p[i], c)) {
      primary = p[i];
      tprintf("set_primary: primary is %s\n", primary.c_str());
      return;
    }
  }
  VERIFY(0);
}
// if primary is member of new view, that node is primary
// otherwise, the lowest number node of the previous view.
// caller should hold rsm_mutex
if primary is member of new view, that node is primary
otherwise, the lowest number node of the previous view.
caller should hold rsm_mutex
if primary is member of new view that node is primary otherwise the lowest number node of the previous view . caller should hold rsm_mutex
void
rsm::set_primary(unsigned vid)
{
  std::vector<std::string> c = cfg->get_view(vid);
  std::vector<std::string> p = cfg->get_view(vid - 1);
  VERIFY (c.size() > 0);
  if (isamember(primary,c)) {
    tprintf("set_primary: primary stays %s\n", primary.c_str());
    return;
  }
  VERIFY(p.size() > 0);
  for (unsigned i = 0; i < p.size(); i++) {
    if (isamember(p[i], c)) {
      primary = p[i];
      tprintf("set_primary: primary is %s\n", primary.c_str());
      return;
    }
  }
  VERIFY(0);
}
void rsm :: set_primary ( unsigned vid ) { std :: vector < std :: string > c = cfg -> get_view ( vid ) ; std :: vector < std :: string > p = cfg -> get_view ( vid - 1 ) ; VERIFY ( c . size ( ) > 0 ) ; if ( isamember ( primary , c ) ) { tprintf ( " \n " , primary . c_str ( ) ) ; return ; } VERIFY ( p . size ( ) > 0 ) ; for ( unsigned i = 0 ; i < p . size ( ) ; i ++ ) { if ( isamember ( p [ i ] , c ) ) { primary = p [ i ] ; tprintf ( " \n " , primary . c_str ( ) ) ; return ; } } VERIFY ( 0 ) ; }
if primary is member of new view, that node is primary
otherwise, the lowest number node of the previous view.
if primary is member of new view that node is primary otherwise the lowest number node of the previous view .