From: Date: January 30 2007 6:05am Subject: bk commit into 5.1 tree (Justin.He:1.2344) BUG#23546 List-Archive: http://lists.mysql.com/commits/19003 X-Bug: 23546 Message-Id: <200701300505.l0U55m2n009429@dev3-240.dev.cn.tlan> Below is the list of changes that have just been committed into a local 5.1 repository of justin.he. When justin.he does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-01-30 13:05:40+08:00, Justin.He@stripped +1 -0 Bug#23546, Cluster configured without any arbitration storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-01-30 13:05:38+08:00, Justin.He@stripped +78 -70 add a judgement for arbitration rank configuration, if neither MGMD nor API nodes are configured with rank = 0, show warning information; correct indentations around patch; # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: Justin.He # Host: dev3-240.dev.cn.tlan # Root: /home/justin.he/mysql/mysql-5.1/bug23546-5.1-new-ndb-bj --- 1.92/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2007-01-30 13:05:47 +08:00 +++ 1.93/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2007-01-30 13:05:47 +08:00 @@ -3604,6 +3604,7 @@ Uint32 db_nodes= 0; Uint32 replicas= 0; Uint32 db_host_count= 0; + bool with_arbitration_rank= false; ctx.m_userProperties.get(DB_TOKEN, &db_nodes); ctx.m_userProperties.get("NoOfReplicas", &replicas); if((db_nodes % replicas) != 0){ @@ -3639,83 +3640,90 @@ tmp->get("HostName", &host); if (strcmp(type,DB_TOKEN) == 0) - { - { - Uint32 ii; - if (!p_db_hosts.get(host,&ii)) - db_host_count++; - p_db_hosts.put(host,i); - if (p_arbitrators.get(host,&ii)) - { - arbitration_warning.appfmt(arbit_warn_fmt, ii, i, host); - p_arbitrators.remove(host); // only one warning per db node - } - } - { - unsigned j; - BaseString str, str2; - str.assfmt("#group%d_",group); - p_db_hosts.put(str.c_str(),i_group,host); - str2.assfmt("##group%d_",group); - p_db_hosts.put(str2.c_str(),i_group,i); - for (j= 0; j < i_group; j++) - { - const char *other_host; - p_db_hosts.get(str.c_str(),j,&other_host); - if (strcmp(host,other_host) == 0) { - unsigned int other_i, c= 0; - p_db_hosts.get(str2.c_str(),j,&other_i); - p_db_hosts.get(str.c_str(),&c); - if (c == 0) // first warning in this node group - node_group_warning.appfmt(" Node group %d", group); - c|= 1 << j; - p_db_hosts.put(str.c_str(),c); - - node_group_warning.appfmt(",\n db node with id %d and id %d " - "on same host %s", other_i, i, host); - } - } - i_group++; - DBUG_ASSERT(i_group <= replicas); - if (i_group == replicas) - { - unsigned c= 0; - p_db_hosts.get(str.c_str(),&c); - if (c+1 == (1u << (replicas-1))) // all nodes on same machine - node_group_warning.append(".\n Host failure will " - "cause complete cluster shutdown."); - else if (c > 0) - node_group_warning.append(".\n Host failure may " - "cause complete cluster shutdown."); - group++; - i_group= 0; - } - } + { + { + Uint32 ii; + if (!p_db_hosts.get(host,&ii)) + db_host_count++; + p_db_hosts.put(host,i); + if (p_arbitrators.get(host,&ii)) + { + arbitration_warning.appfmt(arbit_warn_fmt, ii, i, host); + p_arbitrators.remove(host); // only one warning per db node + } + } + { + unsigned j; + BaseString str, str2; + str.assfmt("#group%d_",group); + p_db_hosts.put(str.c_str(),i_group,host); + str2.assfmt("##group%d_",group); + p_db_hosts.put(str2.c_str(),i_group,i); + for (j= 0; j < i_group; j++) + { + const char *other_host; + p_db_hosts.get(str.c_str(),j,&other_host); + if (strcmp(host,other_host) == 0) { + unsigned int other_i, c= 0; + p_db_hosts.get(str2.c_str(),j,&other_i); + p_db_hosts.get(str.c_str(),&c); + if (c == 0) // first warning in this node group + node_group_warning.appfmt(" Node group %d", group); + c|= 1 << j; + p_db_hosts.put(str.c_str(),c); + node_group_warning.appfmt(",\n db node with id %d and id %d " + "on same host %s", other_i, i, host); + } + } + i_group++; + DBUG_ASSERT(i_group <= replicas); + if (i_group == replicas) + { + unsigned c= 0; + p_db_hosts.get(str.c_str(),&c); + if (c+1 == (1u << (replicas-1))) // all nodes on same machine + node_group_warning.append(".\n Host failure will " + "cause complete cluster shutdown."); + else if (c > 0) + node_group_warning.append(".\n Host failure may " + "cause complete cluster shutdown."); + group++; + i_group= 0; + } + } } else if (strcmp(type,API_TOKEN) == 0 || strcmp(type,MGM_TOKEN) == 0) - { - Uint32 rank; - if(tmp->get("ArbitrationRank", &rank) && rank > 0) - { - if(host && host[0] != 0) - { - Uint32 ii; - p_arbitrators.put(host,i); - if (p_db_hosts.get(host,&ii)) - { - arbitration_warning.appfmt(arbit_warn_fmt, i, ii, host); - } - } - else - { - arbitration_warning.appfmt(arbit_warn_fmt2, i); - } - } + { + Uint32 rank; + if(tmp->get("ArbitrationRank", &rank) && rank > 0) + { + with_arbitration_rank = true; //check whether MGM or API node configured with rank >0 + if(host && host[0] != 0) + { + Uint32 ii; + p_arbitrators.put(host,i); + if (p_db_hosts.get(host,&ii)) + { + arbitration_warning.appfmt(arbit_warn_fmt, i, ii, host); + } + } + else + { + arbitration_warning.appfmt(arbit_warn_fmt2, i); + } + } } } if (db_host_count > 1 && node_group_warning.length() > 0) ndbout_c("Cluster configuration warning:\n%s",node_group_warning.c_str()); + if (!with_arbitration_rank) + { + ndbout_c("Cluster configuration warning:" + "\n Neither %s nor %s nodes are configured with arbitrator," + "\n may cause complete cluster shutdown in case of host failure.", + MGM_TOKEN, API_TOKEN); + } if (db_host_count > 1 && arbitration_warning.length() > 0) ndbout_c("Cluster configuration warning:%s%s",arbitration_warning.c_str(), "\n Running arbitrator on the same host as a database node may"