Modify monConnCount and choose NS random.
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/c1be6d0b Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/c1be6d0b Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/c1be6d0b Branch: refs/heads/master Commit: c1be6d0b815f4b15c58adb80cea0a9af49bc1f97 Parents: 7d50e33 Author: Dave George <[email protected]> Authored: Thu Apr 12 20:53:20 2018 +0000 Committer: Dave George <[email protected]> Committed: Thu Apr 12 20:53:20 2018 +0000 ---------------------------------------------------------------------- core/sqf/monitor/linux/cluster.cxx | 9 +++++---- core/sqf/monitor/linux/nameserver.cxx | 6 ++++++ core/sqf/monitor/linux/nscommacceptmon.cxx | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/c1be6d0b/core/sqf/monitor/linux/cluster.cxx ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/cluster.cxx b/core/sqf/monitor/linux/cluster.cxx index 514771d..e2f7dbf 100644 --- a/core/sqf/monitor/linux/cluster.cxx +++ b/core/sqf/monitor/linux/cluster.cxx @@ -6810,7 +6810,7 @@ void CCluster::UpdateClusterState( bool &doShutdown, nodestate[index].nodeMask.upNodes[i] = 0; } #ifdef NAMESERVER_PROCESS - nodestate[index].monConnCount = 0; + nodestate[index].monConnCount = -1; #endif continue; @@ -7017,7 +7017,7 @@ void CCluster::UpdateClusterState( bool &doShutdown, nodestate[index].nodeMask.upNodes[i] = 0; } #ifdef NAMESERVER_PROCESS - nodestate[index].monConnCount = 0; + nodestate[index].monConnCount = -1; #endif if ( validateNodeDown_ ) @@ -7211,10 +7211,11 @@ void CCluster::UpdateClusterState( bool &doShutdown, int minConnPnid = -1; for (int index = 0; index < GetConfigPNodesMax(); index++) { - if ( nodestate[index].monConnCount < minConnCount ) + int connCount = nodestate[index].monConnCount; + if ( ( connCount >= 0 ) && ( connCount < minConnCount ) ) { minConnPnid = index; - minConnCount = nodestate[index].monConnCount; + minConnCount = connCount; } } myMonConnCount_ = nodestate[MyPNID].monConnCount; http://git-wip-us.apache.org/repos/asf/trafodion/blob/c1be6d0b/core/sqf/monitor/linux/nameserver.cxx ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/nameserver.cxx b/core/sqf/monitor/linux/nameserver.cxx index 93f99b3..ef67562 100644 --- a/core/sqf/monitor/linux/nameserver.cxx +++ b/core/sqf/monitor/linux/nameserver.cxx @@ -88,6 +88,12 @@ void CNameServer::ChooseNextNs( void ) TRACE_ENTRY; static unsigned int seed = 1; + static bool fix_seed = true; + if ( fix_seed ) + { + seed += MyNode->GetPNid(); + fix_seed = false; + } int cnt = NameServerConfig->GetCount(); int rnd = (int) ((float) (cnt) * (rand_r(&seed) / (RAND_MAX + 1.0))); CNameServerConfig *config = NameServerConfig->GetFirstConfig(); http://git-wip-us.apache.org/repos/asf/trafodion/blob/c1be6d0b/core/sqf/monitor/linux/nscommacceptmon.cxx ---------------------------------------------------------------------- diff --git a/core/sqf/monitor/linux/nscommacceptmon.cxx b/core/sqf/monitor/linux/nscommacceptmon.cxx index 3482608..cc91eba 100644 --- a/core/sqf/monitor/linux/nscommacceptmon.cxx +++ b/core/sqf/monitor/linux/nscommacceptmon.cxx @@ -635,7 +635,7 @@ int CCommAcceptMon::processMonReqsGetBestNs( void ) TRACE_ENTRY; int pnid; - int myCount = Monitor->GetMyMonConnCount(); + int myCount = MyNode->GetMonConnCount(); int minCount = Monitor->GetMinMonConnCount(); if ( myCount <= (minCount + HEURISTIC_COUNT) ) {
