You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by hz...@apache.org on 2017/07/26 16:02:54 UTC

[1/5] incubator-trafodion git commit: [TRAFODION-2628] SQL engine work for Elasticity

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master e7dedc822 -> 9aede9cac


[TRAFODION-2628] SQL engine work for Elasticity

It turns out that the compiler already kept a list of node ids,
not assuming that node ids are consecutively numbered 0...n-1.
However, this list was contained in lots of other data structures
that are dead code, coming from the time before Trafodion was
open-sourced. The change does two things: a) getting rid of obsolete
info and b) maintining a list of node ids in the NAClusterInfo
class.

This change does not include executor modifications. The executor
might work just fine, or we may need to add a fix (or optimization)
for cases where we pick a node id for a new process at runtime.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/4bea445d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/4bea445d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/4bea445d

Branch: refs/heads/master
Commit: 4bea445d03b5712007ab326464a8b64b8c2b3740
Parents: b0392f4
Author: Hans Zeller <hz...@apache.org>
Authored: Thu Jul 6 23:11:55 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Thu Jul 6 23:11:55 2017 +0000

----------------------------------------------------------------------
 core/sql/generator/Generator.cpp          |  50 +-
 core/sql/optimizer/NAClusterInfo.cpp      | 670 +------------------------
 core/sql/optimizer/NAClusterInfo.h        | 173 +------
 core/sql/optimizer/NATable.cpp            |   3 -
 core/sql/optimizer/NodeMap.cpp            | 132 +----
 core/sql/optimizer/NodeMap.h              |  15 +-
 core/sql/optimizer/OptimizerSimulator.cpp |  67 ++-
 core/sql/optimizer/SchemaDB.cpp           | 248 ---------
 core/sql/optimizer/SchemaDB.h             | 287 -----------
 core/sql/optimizer/costmethod.cpp         |   2 -
 core/sql/sqlcomp/DefaultConstants.h       |   9 -
 core/sql/sqlcomp/nadefaults.cpp           |  36 --
 core/sql/ustat/hs_cli.cpp                 |  48 +-
 13 files changed, 69 insertions(+), 1671 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/generator/Generator.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/Generator.cpp b/core/sql/generator/Generator.cpp
index d39d23e..5e6f18b 100644
--- a/core/sql/generator/Generator.cpp
+++ b/core/sql/generator/Generator.cpp
@@ -795,18 +795,7 @@ NABoolean remapESPAllocationViaUserInputs(FragmentDir *fragDir,
   //
   NABoolean cycleSegs =
     (ActiveSchemaDB()->getDefaults()).getAsLong(CYCLIC_ESP_PLACEMENT);
-
-  
-  // Structures used to get the Super Node map for this query.
-  //
-  NAArray<CollIndex>* segmentList;
-  NAArray<NAList<CollIndex>*> *cpuList;
-  Int32 numCPUs;
-
-  //get active segments and their corresponding cpus
-  //
-  NABoolean error =
-    gpClusterInfo->getSuperNodemap(segmentList, cpuList, numCPUs);
+  Int32 numCPUs = gpClusterInfo->numOfPhysicalSMPs();
 
   ULng32 *utilcpus = new (heap) ULng32[numCPUs];
   ULng32 *utilsegs = new (heap) ULng32[numCPUs];
@@ -1082,29 +1071,15 @@ Generator::remapESPAllocationAS()
     ULng32 affinityGroupThreshold =
       ActiveSchemaDB()->getDefaults().getAsLong(DEFAULT_DEGREE_OF_PARALLELISM);
 
-    // Structures used to get the Super Node map for this query.
+    // A list of nodes in this cluster
     //
-    NAArray<CollIndex>* segmentList;
-    NAArray<NAList<CollIndex>*> *cpuList;
-    ULng32 numSegs;
-
-    //get active segments and their corresponding cpus
-    //
-    Int32 x;
-    NABoolean error =
-      gpClusterInfo->getSuperNodemap(segmentList, cpuList, x);
+    const NAList<CollIndex> &cpuList(gpClusterInfo->getCPUList());
+    Int32 numCPUs = cpuList.entries();
+    Int32 numSegs = 1;
 
     CollIndex espsPerNode = 
            ActiveSchemaDB()->getDefaults().getNumOfESPsPerNode();
 
-    NABoolean fakeEnv;
-    Int32 numCPUs = 
-           ActiveSchemaDB()->getDefaults().getTotalNumOfESPsInCluster(fakeEnv);
-
-    // The number of physical segments used by this query.
-    //
-    numSegs = segmentList->entries();
-
     // Adjust the affinityGroupThreshold so that numSegsThreshold will
     // be a power of 2.
     //
@@ -1195,8 +1170,6 @@ Generator::remapESPAllocationAS()
       // ESP layer uses all segments.
       //
       ULng32 *cpus = new (wHeap()) ULng32[numCPUs];
-      ULng32 *segs = new (wHeap()) ULng32[numCPUs];
-      ULng32 *segsUsed = new (wHeap()) ULng32[numSegs];
 
           CollIndex segment = 0;
           CollIndex cpu = 0;
@@ -1213,8 +1186,7 @@ Generator::remapESPAllocationAS()
 
           for (i = 0; i < (CollIndex)numCPUs; i++) {
 
-            cpus[i] = (*(*cpuList)[segment])[cpu];
-            segs[i] = (*segmentList)[segment];
+            cpus[i] = cpuList[cpu];
 
 #ifdef _DEBUG
     if ((CmpCommon::getDefault( NSK_DBG ) == DF_ON) &&
@@ -1230,10 +1202,7 @@ Generator::remapESPAllocationAS()
             //
             if((i % espsPerNode) == (espsPerNode-1))
 	       cpu++;
-            if (cpu >= (*cpuList)[segment]->entries() * espsPerNode) {
-              // gone thru all cpus in this segment. advance to next segment.
-              //
-              segment++;
+            if (cpu >= (cpuList.entries() * espsPerNode)) {
               cpu = 0;
             }
         }
@@ -1382,7 +1351,6 @@ Generator::remapESPAllocationAS()
                   // Set the cpu and segment for this node map entry.
                   //
                   nodeMap->setNodeNumber(j, cpu);
-                  nodeMap->setClusterNumber(j, (Lng32)segs[cpuNumber]);
                 }
 
                 // After remapping the node map (copy), make it the
@@ -1417,11 +1385,7 @@ Generator::remapESPAllocationAS()
           }
       }
       //     delete [] cpus;
-      //     delete [] segs;
-      //     delete [] segsUsed;
       //     NADELETEBASIC(cpus, wHeap());
-      //     NADELETEBASIC(segs, wHeap());
-      //     NADELETEBASIC(segsUsed, wHeap());
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/optimizer/NAClusterInfo.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NAClusterInfo.cpp b/core/sql/optimizer/NAClusterInfo.cpp
index 17d3162..714916a 100644
--- a/core/sql/optimizer/NAClusterInfo.cpp
+++ b/core/sql/optimizer/NAClusterInfo.cpp
@@ -86,8 +86,6 @@
 #include <cstdlib>
 #include <sys/stat.h>
 
-ULng32 dp2DescHashFunc(const DP2name& name);
-
 THREAD_P NABoolean gIsStaticCompiler = FALSE;
 void SetStaticCompiler(NABoolean isStaticCompiler)
 {
@@ -163,98 +161,6 @@ void setUpClusterInfo(CollHeap* heap)
 }
 //<pb>
 
-//---------------------------------------------------------
-//DP2name is a wrapper class for fully specified dp2 names. 
-//We cannot hash on primitives like characters.
-//--------------------------------------------------------
-DP2name::DP2name(char* dp2name, CollHeap* heap)
-: heap_(heap)
-{
-  dp2name_=new(heap_) (char[strlen(dp2name)+1]);
-  strcpy(dp2name_,dp2name);
-}
-
-void DP2name::getDp2Name(char* &name) const
-{
-  name = new (CmpCommon::statementHeap()) char[strlen(dp2name_)+1];
-  strcpy(name,dp2name_);
-}
-
-inline NABoolean DP2name::operator==(const DP2name &dp2Name)
-{
-  if(strcmp(dp2Name.dp2name_,dp2name_)==0) return TRUE;
-  return FALSE;
-}
-
-// LCOV_EXCL_START
-ULng32 DP2name::hash() const 
-{
-  return dp2DescHashFunc(*this);
-}
-// LCOV_EXCL_STOP
-
-DP2name::~DP2name()
-{
-  NADELETEBASIC(dp2name_,heap_);
-}
-
-//------------------------------------------------------------
-//DP2Info is a wrapper class for cluster and CPU information for a 
-//particular DP2. As a member it has a DP2Name and 3 integers 
-//representing the cluster, primary CPU and secondary CPU associated 
-//with the DP2.
-//-------------------------------------------------------------  
-
-DP2info::DP2info(Lng32 clusterNum, Lng32 primary, Lng32 secondary)
-{
-  clusterNumber_=clusterNum;
-  primaryCPU_=primary;
-  secondaryCPU_=secondary;
-
-}
-
-void DP2info::getDp2Info(Int32  & clusterNum,
-                         Int32  & primary,
-                         Int32  & secondary)
-{
-  clusterNum=clusterNumber_;
-  primary=primaryCPU_;
-  secondary=secondaryCPU_;
-}
-
-//<pb>
-
-
-//  hash function for dp2name
-ULng32 dp2DescHashFunc(const DP2name& name) 
-{
-  char * dp2name;
- 
-  // method getDp2Name allocates an array of char for dp2name
-  name.getDp2Name(dp2name);
-
-  ULng32 index=0;
-  size_t nameLen = strlen(dp2name);
-  for(CollIndex i=0;i<=nameLen;i++){
-    index += (unsigned char) dp2name[i];
-  }
-
-  NADELETEBASIC(dp2name, CmpCommon::statementHeap());
-
-  return index;
-}
-
-//hash funtion for tableIdentifier passed in from NATable
-ULng32 tableIdentHashFunc( const CollIndex& ident)
-{
-  return (ULng32)(ident);
-}
-//hash function for clusterNumber
-ULng32 clusterNumHashFunc(const CollIndex& num)
-{
-  return (ULng32)(num);
-}
-
 static ULng32 intHashFunc(const Int32& Int)
 {
   return (ULng32)Int;
@@ -281,10 +187,8 @@ static ULng32 intHashFunc(const Int32& Int)
 //==============================================================================
 NAClusterInfo::NAClusterInfo(CollHeap * heap)
  : heap_(heap), 
-   maxOSV_(COM_VERS_UNKNOWN),
-   maxOSVName_(heap),
-   inTestMode_(FALSE),
-   useAggregationNodesOnly_(FALSE)
+   cpuList_(heap),
+   inTestMode_(FALSE)
 {
   OptimizerSimulator::osimMode mode = OptimizerSimulator::OFF;
 
@@ -299,20 +203,15 @@ NAClusterInfo::NAClusterInfo(CollHeap * heap)
     case OptimizerSimulator::LOAD:
     case OptimizerSimulator::CAPTURE:
     {
+      Int32 dummyClusterNum;
+
       // Hash Map to store NodeName and NoideIds
       nodeNameToNodeIdMap_ = new (heap) NAHashDictionary<NAString, Int32>
           (NAString::hash, 101, TRUE, heap_);
-          
-      clusterToCPUMap_ = new(heap) NAHashDictionary<CollIndex,maps>
-                                                          (&clusterNumHashFunc,17,TRUE, heap);
-                                                          
       nodeIdToNodeNameMap_ = new(heap) NAHashDictionary<Int32, NAString>
                                                           (&intHashFunc, 101,TRUE,heap);
                                                           
-      activeClusters_= NULL;
-      physicalSMPCount_ = -1;
-
-      NADefaults::getNodeAndClusterNumbers(localSMP_ , localCluster_);
+      NADefaults::getNodeAndClusterNumbers(localSMP_ , dummyClusterNum);
 
       Int32 nodeCount = 0;
       Int32 nodeMax = 0;
@@ -335,11 +234,6 @@ NAClusterInfo::NAClusterInfo(CollHeap * heap)
       error = msg_mon_get_node_info(&nodeCount, nodeMax, nodeInfo);
       CMPASSERT(error == 0);
 
-      maps *cpuList=new(heap) maps(heap);
-      physicalSMPCount_ = 0;
-
-      NAList<CollIndex> storageList(heap, nodeCount);
-
       for (Int32 i = 0; i < nodeCount; i++)
       {
         if (nodeInfo[i].spare_node)
@@ -350,14 +244,7 @@ NAClusterInfo::NAClusterInfo(CollHeap * heap)
         if ((nodeInfo[i].type & MS_Mon_ZoneType_Aggregation) != 0 ||
             ((nodeInfo[i].type & MS_Mon_ZoneType_Storage) != 0 ))
         {
-          if ( (nodeInfo[i].type & MS_Mon_ZoneType_Storage) != 0 )
-            storageList.insert(nodeInfo[i].nid);
-
-          if ( (nodeInfo[i].type & MS_Mon_ZoneType_Storage) == 0 )
-            cpuList->insertToAggregationNodeList(nodeInfo[i].nid);
-
-          if (!nodeInfo[i].spare_node)
-             physicalSMPCount_++;
+          cpuList_.insert(nodeInfo[i].nid);
 
           // store nodeName-nodeId pairs
           NAString *key_nodeName = new (heap_) NAString(nodeInfo[i].node_name, heap_);
@@ -385,36 +272,14 @@ NAClusterInfo::NAClusterInfo(CollHeap * heap)
         }
       }
 
-      // Fix Bugzilla #1210. Put the aggregation nodes at the beginning of 
-      // the list. ESP logical node map synthesization code can take the 
-      // advantage of this and place more ESPs on aggregation nodes when 
-      // the node map size is less than the total number of SQL nodes.
-      *(cpuList->list) = *(cpuList->listOfAggregationOnlyNodes);
-      cpuList->list->insert(storageList);
-
-      // if there exists no aggregation only nodes, allow all nodes to
-      // host esps.
-      if (cpuList->listOfAggregationOnlyNodes->entries() == 0) {
-        for (Int32 i = 0; i<cpuList->list->entries(); i++)
-          cpuList->insertToAggregationNodeList((*(cpuList->list))[i]);
-      }
-
       NADELETEBASIC(nodeInfo, heap);
 
-
-      CollIndex *ptrClusterNum = new(heap) CollIndex(localCluster_);
-      CollIndex *cluster=clusterToCPUMap_->insert(ptrClusterNum,cpuList); 
-
-      CMPASSERT(cluster);
-
       break;
     }
     case OptimizerSimulator::SIMULATE:
 
-      clusterToCPUMap_ = NULL;
       nodeIdToNodeNameMap_ = NULL;
-      activeClusters_= NULL;
-      physicalSMPCount_ = -1;
+      cpuList_.clear();
       //load NAClusterInfo from OSIM file
       simulateNAClusterInfo();
       break;
@@ -438,45 +303,9 @@ NAClusterInfo::~NAClusterInfo()
     nodeIdToNodeNameMap_->clear();
     delete nodeIdToNodeNameMap_;
   }
-
-  CollIndex *key;  
-  maps * value;
-  UInt32 i=0;
-
-  if(clusterToCPUMap_)
-  {
-    // clear and delete clusterToCPUMap_
-    //iterate over all the entries in clusterToCPUMap_
-    NAHashDictionaryIterator<CollIndex,maps> clusterToCPUMapIter(*clusterToCPUMap_);
-
-    for ( i = 0 ; i < clusterToCPUMapIter.entries() ; i++)
-    {
-       clusterToCPUMapIter.getNext (key,value) ;
-       NADELETEBASIC(key,CmpCommon::contextHeap());
-       delete value;
-    }
-    clusterToCPUMap_->clear();
-    delete clusterToCPUMap_;
-  }
-  
-  // clear and delete activeClusters_ list
-  if(activeClusters_)
-  {
-    activeClusters_->clear();
-    delete activeClusters_;
-  }
-
 }
 
 Lng32
-NAClusterInfo::getNumActiveCluster()
-{
-  if(NOT activeClusters_) createActiveClusterList();
-  CMPASSERT(activeClusters_->entries());
-  return activeClusters_->entries();
-}// NAClusterInfo::getNumActiveClusters()
-
-Lng32
 NAClusterInfo::mapNodeNameToNodeNum(const NAString &keyNodeName) const
 {
   if ( nodeNameToNodeIdMap_->contains(&keyNodeName) )
@@ -507,140 +336,16 @@ NABoolean NAClusterInfo::NODE_ID_TO_NAME(Int32 nodeId, char *nodeName, short max
     return FALSE;
 }
 
-#pragma warn(1506)  // warning elimination 
-
-/*------------------------------------------------------------- 
-NAClusterInfo::createActiveClusterList()
- Helper function for getSuperNodeMap() 
- Goes through the following algorithm to identify 
-the all the active clusters for the current statement if
-value for REMOTE_ESP_PARALLELISM is SYSTEM.
-It also identifies active clusters for 'ON' or 'OFF'.
-
-ALGORITHM implemented by SQL/MX:
-
-Query involves table A, B, C and D. 
-
-Base table for A is distributed on systems 1, 2, 5
-Base table for B is distributed on systems 3, 6
-Base table for C is distributed on systems 2, 3
-Base table for D is distributed on systems 4
-
-Target systems 1,2 3, 4, 5, 6
-
-SQL/MX will first go through the list of tables and find 
-the tables that have a system common with any other table in 
-the list. In this case table A has system 2 common with table C 
-and vice versa and table B has system 3 common with table C and
- vice versa. Now we take the super set of systems for Table A, B 
- and C which gives us ( 1, 2, 3, 5, 6) as active systems. 
- Target system 4 got excluded.
-
-Another example:
-	A typical star join schema where the dimension tables 
-        are small and the fact table is large. 
-
-Fact table is distributed on 1, 2, 3
-Dimension one table is on 1
-Dimension two table is on 2
-
-Scope chosen by SQL/MX will be 1, 2, 3 
-
-SQL/MX is going to bring up ESPs on CPUs in all these systems and 
-generate as much parallelism it can. At the same time, it tries 
-to make sure that scan ESPs are co-located to be nearest to their 
-dp2s or active partitions, reducing remote communication.
-
-Special Cases:
-	
-a) If it is a single table query then all the target systems will be considered active.
- 
-b)	If the algorithm cannot come up with any active system and 
-the local system is not completely restricted by the user then ESPs 
-will be brought up only on the local system. On the other hand, if 
-the local system is unavailable ( CPU map completely restricts the 
-use of local system) then no ESP will be brought up and as a result 
-there will be no parallel processing. 
-
-------------------------------------------------------------------*/
-#pragma nowarn(1506)   // warning elimination 
-#pragma nowarn(262)   // warning elimination 
-void 
-NAClusterInfo::createActiveClusterList()
-{
-  //CMPASSERT(tableToClusterMap_);
-  activeClusters_ = new(CmpCommon::statementHeap()) 
-    NAList<CollIndex>(CmpCommon::statementHeap());
-
-  // Linux and NT behavior
-  activeClusters_->insert(localCluster_);
- 
-}
-#pragma warn(262)  // warning elimination
-#pragma warn(1506)  // warning elimination 
-
-
-
-
-//<pb>
-//==============================================================================
-//  Determine how many SMPs are available in the cluster.
-//
-// Input:
-//  none
-//
-// Output:
-//  none
-//
-// Return:
-//  number of available SMPs in the cluster.
-//
-//==============================================================================
-#pragma nowarn(1506)   // warning elimination
-Int32
-NAClusterInfo::computeNumOfSMPs()
-{
-    Int32 count =0;
-    if(NOT activeClusters_) createActiveClusterList();
-
-    for(CollIndex index=0; index < activeClusters_->entries(); index++)
-    {
-      maps *cpuList = clusterToCPUMap_->getFirstValue(&((*activeClusters_)[index]));
-      if(cpuList) 
-      {
-        count += cpuList->getCpuCount(getUseAggregationNodesOnly());
-        continue;
-      }
-    
-#pragma warning (disable : 4244)   //warning elimination
-      getProcessorStatus(cpuList,(*activeClusters_)[index]);
-#pragma warning (default : 4244)   //warning elimination
-      count +=cpuList->list->entries();
-    }
-   return count;
-}
-
-void NAClusterInfo::setUseAggregationNodesOnly(NABoolean x) 
-{  
-    if ( useAggregationNodesOnly_ != x )  {
-       useAggregationNodesOnly_ = x; 
-       computeNumOfSMPs();
-    }
-}
-
 Int32
 NAClusterInfo::numOfPhysicalSMPs()
 {
-  if (physicalSMPCount_ < 0)
-    physicalSMPCount_ = computeNumOfSMPs();
-
-  return physicalSMPCount_;
+  return cpuList_.entries();
 }
 
 Int32
 NAClusterInfo::numOfSMPs()
 {
-  CMPASSERT(physicalSMPCount_ > 0);
+  Int32 result = cpuList_.entries();
 
   // This is temporary patch for PARALLEL_NUM_ESPS issue. This CQD should
   // be used in many places for costing, NodeMap allocation, synthesizing
@@ -657,138 +362,19 @@ NAClusterInfo::numOfSMPs()
     // A value for PARALLEL_NUM_ESPS exists.  Use it for the count of cpus
     //  but don't exceed the number of cpus available in the cluster.
     // -------------------------------------------------------------------
-    physicalSMPCount_ = MINOF(physicalSMPCount_, 
+    result = MINOF(result, 
         (Int32)(ActiveSchemaDB()->getDefaults().getAsLong(PARALLEL_NUM_ESPS)));
   }
 
-  return physicalSMPCount_; 
+  return result; 
 
 } // NAClusterInfo::numOfSMPs()  
 #pragma warn(1506)  // warning elimination 
 
-//----------------------------------------------------------
-// getProcessorStatus()
-// Input: clusterNumber
-// Output: CPU's in the cluster that are running
-//----------------------------------------------------------
-
-void 
-NAClusterInfo::getProcessorStatus(maps* &outcpuList,short clusterNum)
-{
-  CMPASSERT(0);
-}
-
-
-//-----------------------------------------------------------------
-//NAClusterInfo::getSuperNodeMap()
-// called by NodeMap.cpp
-// Returns the active clusters and their corresponding active CPUs
-// clusterList and cpuList has one to one relationship i.e. cpuList[0]
-// contains cpus for cluster in clusterList[0]
-//-----------------------------------------------------------------
-#pragma nowarn(1506)   // warning elimination 
-NABoolean
-NAClusterInfo::getSuperNodemap(NAArray<CollIndex>* &clusterList, 
-                               NAArray<NAList<CollIndex>*>* &cpuList,
-                               Int32 &cpuCount)
-{
-  cpuCount = 0;
-  if(NOT activeClusters_) createActiveClusterList();
-  clusterList = new(HEAP) NAArray<CollIndex>(HEAP,activeClusters_->entries());
-  for(CollIndex entry =0; entry< activeClusters_->entries();entry++)
-  {
-    clusterList->insertAt(entry,(*activeClusters_)[entry]);
-  }
-
-#ifndef NDEBUG
-// LCOV_EXCL_START
-  if(getenv("debug_MNO"))
-  {
-    FILE * ofd = fopen("superNodeMap","ac");
-    BUMP_INDENT(DEFAULT_INDENT);
-    fprintf(ofd,"%s %s\n",NEW_INDENT,"Active Clusters: ");
-    for(CollIndex n=0;n<activeClusters_->entries();n++)
-    {
-      fprintf(ofd, "%s %d \n", NEW_INDENT, (*activeClusters_)[n]); 
-    }
-    fprintf(ofd,"*********************************************************************\n");
-    fprintf(ofd,"%s %s\n",    NEW_INDENT,"Active Cluster and its CPUs");
-    fclose(ofd);
-  }
-// LCOV_EXCL_STOP
-#endif
-
-  cpuList= new(HEAP) NAArray<NAList<CollIndex>*> (HEAP,activeClusters_->entries());
-  maps * cpuForCluster=NULL;
-
-  for(CollIndex index = 0;index<activeClusters_->entries();index++)
-  {
-    cpuForCluster = (maps*)(clusterToCPUMap_->getFirstValue(&(*activeClusters_)[index]));
-#pragma warning (disable : 4244)   //warning elimination
-    if (NOT cpuForCluster)
-    {
-      getProcessorStatus(cpuForCluster,(*activeClusters_)[index]);
-    }
-#pragma warning (default : 4244)   //warning elimination
-  
-    NABoolean aggreNodeOnly = 
-        CmpCommon::getDefault(ESP_ON_AGGREGATION_NODES_ONLY) == DF_ON;
-
-    NAList<CollIndex>*  cList = cpuForCluster->getCpuList(aggreNodeOnly); 
-
-    NAList<CollIndex> * ptrCpuForCluster = new(HEAP) NAList<CollIndex>(*cList,HEAP);
-    cpuCount += cList->entries();
-
-#ifndef NDEBUG
-// LCOV_EXCL_START
-  if(getenv("debug_MNO"))
-  {
-    FILE * ofd = fopen("superNodeMap","ac");
-    BUMP_INDENT(DEFAULT_INDENT);
-    fprintf(ofd,"%s %s %2d\n",NEW_INDENT,
-                           "Active cluster  ",(*activeClusters_)[index]);
-    fprintf(ofd,"%s %s", NEW_INDENT, "CPUS:  ");
-    for(CollIndex m=0;m<ptrCpuForCluster->entries();m++)
-    {
-      fprintf(ofd,"%d %s",(*ptrCpuForCluster)[m],"  ");
-    }
-    fprintf(ofd,"\n");
-    fclose(ofd);
-  }
-// LCOV_EXCL_STOP
-#endif
-
-    cpuList->insertAt(index,ptrCpuForCluster);
-  }
-
-#ifndef NDEBUG
-// LCOV_EXCL_START
-if(getenv("debug_MNO"))
-{
-  FILE * ofd = fopen("superNodeMap","ac");
-  fprintf(ofd,"*********************************************************************\n");
-  fclose(ofd);
-}
-// LCOV_EXCL_STOP
-#endif
-
-  return TRUE;
-
-}
-
 // Returns total number of CPUs (including down CPUs)
 Lng32 NAClusterInfo::getTotalNumberOfCPUs()
 {
-  Lng32 cpuCount = 0;
-  if (NOT activeClusters_) createActiveClusterList();
-
-  for(CollIndex index = 0;index<activeClusters_->entries();index++)
-  {
-    maps *cpuForCluster = (maps*)
-      (clusterToCPUMap_->getFirstValue(&(*activeClusters_)[index]));
-    if (cpuForCluster && cpuForCluster->list)
-      cpuCount += cpuForCluster->list->entries();
-  }
+  Lng32 cpuCount = cpuList_.entries();
 
 #ifndef NDEBUG
 // LCOV_EXCL_START
@@ -798,63 +384,20 @@ Lng32 NAClusterInfo::getTotalNumberOfCPUs()
   }
 // LCOV_EXCL_STOP
 #endif
-
+  // 
   return cpuCount;
 }
 
-// setMaxOSV should be called for all NATable in the current Statement
-// before the versioning check.
-void NAClusterInfo::setMaxOSV(QualifiedName &qualName, COM_VERSION osv)
-{
-  if((maxOSV_ < osv) OR
-    (maxOSV_ == COM_VERS_UNKNOWN))
-  {
-    maxOSV_ = osv;
-    maxOSVName_ = qualName;
-  }
-}
-
-#pragma nowarn(161)   // warning elimination 
 void NAClusterInfo::cleanupPerStatement()
 {
-  //After every statement activeClusters_ should be NULL 
-  // because statement heap has been cleared already. 
-  activeClusters_ = NULL;
-  // reset the mebers for versioning support
-  maxOSV_ = COM_VERS_UNKNOWN;
 }
-#pragma warn(161)  // warning elimination 
 
 void NAClusterInfo::initializeForOSIMCapture()
 {
-  UInt32 i=0;
-  // clear out clusterToCPUMap_;
-  if (clusterToCPUMap_)
-  {
-      CollIndex * clusterNum;
-      maps * cpuMap;
-      NAHashDictionaryIterator<CollIndex,maps> clusterToCPUMapIter
-                                             (*clusterToCPUMap_);
-      for (i=0; i<clusterToCPUMapIter.entries(); i++)
-      {
-          clusterToCPUMapIter.getNext(clusterNum,cpuMap);
-
-          // only delete entries from other clusters
-          if(*clusterNum != (CollIndex)localCluster_)
-          {
-            // On Linux, there is only one cluster. The following code will not be exercised. 
-            // LCOV_EXCL_START
-            clusterToCPUMap_->remove(clusterNum);
-            NADELETEBASIC(clusterNum,heap_);
-            delete cpuMap;
-            // LCOV_EXCL_STOP
-          }
-      }//for
-   }
 }
 
-NAClusterInfoLinux::NAClusterInfoLinux(CollHeap * heap) : NAClusterInfo(heap)
-, numTSEs_(0), tseInfo_(NULL), nid_(0), pid_(0)
+NAClusterInfoLinux::NAClusterInfoLinux(CollHeap * heap) : NAClusterInfo(heap),
+                                                          nid_(0), pid_(0)
 {
   OptimizerSimulator::osimMode mode = OptimizerSimulator::OFF;
 
@@ -887,7 +430,6 @@ NAClusterInfoLinux::NAClusterInfoLinux(CollHeap * heap) : NAClusterInfo(heap)
 
 NAClusterInfoLinux::~NAClusterInfoLinux()
 {
-   NADELETEBASIC(tseInfo_, heap_);
 }
 
 Int32 NAClusterInfoLinux::processorFrequency() const
@@ -1006,185 +548,3 @@ void NAClusterInfoLinux::captureOSInfo(ofstream & nacllinuxfile) const
                 << "totalMemoryAvailable_: " << totalMemoryAvailable_ << endl
                 << "numCPUcoresPerNode_: " << numCPUcoresPerNode_ << endl;
 }
-
-Int32 compareTSEs( const void* a, const void* b ) 
-{  
-  // compare function
-  MS_Mon_Process_Info_Type* arg1 = (MS_Mon_Process_Info_Type*) a;
-  MS_Mon_Process_Info_Type* arg2 = (MS_Mon_Process_Info_Type*) b;
-
-  if ( arg1->nid < arg2->nid )
-    return -1;
-  else  {
-    if( arg1->nid == arg2->nid )
-      return strcmp(arg1->process_name, arg2->process_name);
-    else
-     return 1;
-  }
-}
-
-// setup TSE info for the POS. The method collects all TSEs in the cluster,
-// filter out $SYSTEM, and sort the array in assending order on nid (node id).
-// The method also can fake the number of TSEs when operated under POS test
-// mode (cqd POS_TEST_MODE 'on'). In this special mode, the # of TSTs are 
-// cqd POS_TEST_NUM_NODES times cqd POS_TEST_NUM_VOLUMES_PER_NODE.
-// All faked TSEs are named numerically from 1 to # of TSTs. The test mode
-// is for testing the disk_pool sub-feature.
-void NAClusterInfoLinux::setupTSEinfoForPOS()
-{
-   if ( tseInfo_ ) {
-      // LCOV_EXCL_START
-      NADELETEBASIC(tseInfo_, heap_);
-      tseInfo_ = NULL; numTSEs_ = 0;
-      // LCOV_EXCL_STOP
-   }
-
-   short ret_val = msg_mon_get_process_info_type(MS_ProcessType_TSE,
-                                             &numTSEs_,
-                                             0,  // max ignored if info is NULL
-                                             NULL);
-
-   if ( ret_val != 0 ) 
-     return;
-
-   tseInfo_ = new (heap_) MS_Mon_Process_Info_Type [numTSEs_];
-
-   ret_val = msg_mon_get_process_info_type(MS_ProcessType_TSE,
-                                             &numTSEs_,
-                                             numTSEs_,
-                                             tseInfo_);
-
-
-   if ( ret_val != 0 ) {
-      // LCOV_EXCL_START
-      NADELETEBASIC(tseInfo_, heap_);
-      tseInfo_ = NULL; numTSEs_ = 0;
-      return;
-      // LCOV_EXCL_STOP
-   }
-
-   pid_ = getpid();
-
-   for (Lng32 i= 0; i< numTSEs_; i++) {
-
-     if ( tseInfo_[i].pid == pid_ )
-       nid_ = tseInfo_[i].nid;
-
-     // NOTE: The system metadata may be located in a volume other than
-     //  $SYSTEM.  The following could change.  For now, skip any volumes
-     //  called $SYSTEM.  The audit volumes aren't returned from the
-     //  when MS_ProcessType_TSE is passed to msg_mon_get_process_info_type().
-     //  Can add code here to filter out other TSEs if needed
-
-     // here we replace a backup DP2 process or $SYSTEM process with the last
-     // entry in the array in the hope that it is a good one.
-     if (tseInfo_[i].backup != 0 ||
-         strncmp(tseInfo_[i].process_name, "$SYSTEM", 7) == 0 )
-     {
-        if ( i < numTSEs_ - 1 ) {
-          tseInfo_[i] = tseInfo_[numTSEs_-1]; // replace it with the
-                                              // last entry from the array
-          i--; // the previous last entry should be checked aginst backup and $system
-               // because of process pairs
-        }
-        numTSEs_--;
-     }
-   }
-  
-#ifndef NDEBUG
-   // LCOV_EXCL_START
-   if (ActiveSchemaDB() && CmpCommon::getDefault(POS_TEST_MODE) == DF_ON) {
-      NADefaults & defs = ActiveSchemaDB()->getDefaults();
-      Int32 num_faked_nodes = (Int32)(defs.getAsLong(POS_TEST_NUM_NODES));
-      Int32 num_faked_tses_per_node = 
-            (Int32)(defs.getAsLong(POS_TEST_NUM_VOLUMES_PER_NODE));
-
-      Int32 tses = 0;
-      if (num_faked_nodes * num_faked_tses_per_node <= MAX_NUM_TSES) {
-        for (Int32 i=0; i<num_faked_nodes; i++) {
-           for (Int32 j=0; j<num_faked_tses_per_node; j++) {
-              tseInfo_[tses].nid = i;
-
-              char buf[20]; str_itoa(tses, buf);
-              strcpy(tseInfo_[tses].process_name, buf);
-
-              tses++;
-           }
-        }
-        numTSEs_ = tses;
-      }
-   }
-   // LCOV_EXCL_STOP
-#endif
-     
-   qsort(tseInfo_, numTSEs_, sizeof(MS_Mon_Process_Info_Type), compareTSEs);
-}
-
-
-// get the TSE info for the kth volume (in the sorted order).
-MS_Mon_Process_Info_Type* NAClusterInfoLinux::getTSEInfoForPOS(Int32 k)
-{
-   if ( tseInfo_ == NULL ) 
-     setupTSEinfoForPOS();
-
-   if ( k >= 0 && k < numTSEs_ )
-     return &tseInfo_[k];
-   else 
-     return 0;
-}
-
-// get the total # of TSEs
-Int32 NAClusterInfoLinux::numTSEsForPOS() 
-{ 
-   if ( tseInfo_ == NULL )
-     setupTSEinfoForPOS();
-
-   return numTSEs_; 
-}
-
-
-// LCOV_EXCL_START
-NABoolean NAClusterInfo::IsRemoteNodeDown(short error)
-{
-  if ((error == FileSystemErrorRemoteNodeDown ) ||
-      (error == FileSystemErrorRemoteNodeUnavailable) ||
-      (error == FileSystemErrorNamedProcessNotInDCT) )
-    return TRUE;
-  else
-    return FALSE;
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START
-const char * NAClusterInfo::GetNodeName(const char *dp2Name, char *buffer, Int32 size)
-{
-  strncpy(buffer, dp2Name, size);
-
-  char *pos = buffer;
-
-  Int32 i;
-  for(i=0; i<size; i++){
-    if(pos[i] == '.'){
-      pos[i] = 0;
-      break;
-    }
-  }
-
-  DCMPASSERT(i<size);
-
-  return buffer;
-}
-// LCOV_EXCL_STOP
-
-NAList<CollIndex>*  maps::getCpuList(NABoolean aggregationNodeOnly)
-{
-   return (aggregationNodeOnly) ? listOfAggregationOnlyNodes : list;
-}
-
-Int32 maps::getCpuCount(NABoolean aggregationNodeOnly)
-{
-   return (aggregationNodeOnly) ? listOfAggregationOnlyNodes->entries() : 
-                                  list->entries();
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/optimizer/NAClusterInfo.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NAClusterInfo.h b/core/sql/optimizer/NAClusterInfo.h
index 52ede89..c62f848 100644
--- a/core/sql/optimizer/NAClusterInfo.h
+++ b/core/sql/optimizer/NAClusterInfo.h
@@ -72,92 +72,6 @@ class NAClusterInfo;
 extern THREAD_P NAClusterInfo* gpClusterInfo;
 extern void setUpClusterInfo(CollHeap* heap);
 
-#define MAX_NUM_SMPS_NSK  16     // number of SMPs in the cluster for NSK
-#define MAX_NUM_SMPS_SQ   512    // number of CPUs in the cluster for SQ
-//<pb>
-ULng32 clusterNumHashFunc(const CollIndex& num);
-
-//used to encapsulate dp2 names
-class DP2name : public NABasicObject
-{
-  public:
-     DP2name(char* dp2name,CollHeap* heap);
-     void getDp2Name(char* &name)const;
-     NABoolean operator==(const DP2name & dp2Name);
-     ULng32 hash() const;
-     ~DP2name();
-  private:
-    char* dp2name_;
-    CollHeap* heap_;
-};
-
-//encapsulated information for a dp2 like cluster no., primary and secondary
-//cpu.
-class DP2info : public NABasicObject
-{
-  public:
-    DP2info(Lng32 clusterNum,Lng32 primary, Lng32 secondary);
-    void getDp2Info(Int32 & clusterNum, Int32& primary, Int32& secondary);
-    NABoolean operator==(DP2info dp2info)
-    {
-      if(dp2info.clusterNumber_==clusterNumber_ && dp2info.primaryCPU_ == primaryCPU_)
-        return TRUE;
-
-      return FALSE;
-
-    }
-  private:
-    Lng32 clusterNumber_;
-    Lng32 primaryCPU_;
-    Lng32 secondaryCPU_;
-};
-
-//encapsulated a basic list, provides a equality method and always requires
-//a heap pointer.
-
-class maps : public NABasicObject {
-public:
- 
-  maps(CollHeap * heap, CollIndex size =0)
-  {
-    list= new(heap) NAList<CollIndex>(heap,size);
-    listOfAggregationOnlyNodes = new(heap) NAList<CollIndex>(heap,size);
-  }
-
-  maps(NAList<CollIndex>* list, NAList<CollIndex>* listForAggrNodes) 
-  {
-    this->list = list;
-    this->listOfAggregationOnlyNodes = listForAggrNodes;
-  }
-
-  NABoolean operator==(maps cpuList)
-  {
-    if(*list==*(cpuList.list) && 
-       *listOfAggregationOnlyNodes == *(cpuList.listOfAggregationOnlyNodes)) return TRUE;
-    return FALSE;
-  }
-
-  ~maps()
-  {
-    delete list;
-    delete listOfAggregationOnlyNodes;
-  }
-
-  Int32 getCpuCount(NABoolean aggregationNodeOnly);
-  NAList<CollIndex>*  getCpuList(NABoolean aggregationNodeOnly = FALSE);
-
-  void insertToAggregationNodeList(CollIndex cpu) 
-    { listOfAggregationOnlyNodes->insert(cpu); };
-
-  NAList<CollIndex>* list;
-  NAList<CollIndex>* listOfAggregationOnlyNodes;
-};
-
-// for osim to work on nt
-#define FileSystemErrorRemoteNodeDown 250
-#define FileSystemErrorRemoteNodeUnavailable 18
-#define FileSystemErrorNamedProcessNotInDCT 14
-
 class NAClusterInfo : public NABasicObject
 {
 public:
@@ -189,24 +103,16 @@ public:
   // platform must define this.
   virtual void captureOSInfo(ofstream & f) const = 0;
 
+  Int32 getNumActiveCluster() const { return 1; }
   NABoolean smpActive(Int32 smp) const;
 
-  //This method returns the list of active clusters and a list of CPU for each
-  //cluster in the same order. It decides on active clusters based on default
-  //REMOTE_ESP_PARALLELISM. If we are going to implement CPU map, only this
-  //method needs to be augmented.
-  NABoolean getSuperNodemap(NAArray<CollIndex>* &clusterList,
-			    NAArray<NAList<CollIndex>*>* &cpuList, Int32 &cpuCount);
-
   // return total number of CPUs (includes all, that is, even down CPUs)
   Lng32 getTotalNumberOfCPUs();
+  const NAList<CollIndex> &getCPUList() { return cpuList_; }
 
-  Lng32 getNumActiveCluster();
   Lng32 mapNodeNameToNodeNum(const NAString &node) const;
   void cleanupPerStatement();
 
-  void setMaxOSV(QualifiedName &qualName, COM_VERSION osv);
-
   // The OSIM uses these following methods to capture and simulate
   // cluster information respectively.
   void initializeForOSIMCapture();
@@ -222,44 +128,27 @@ public:
   void resetTestMode() { inTestMode_ = FALSE; };
 // LCOV_EXCL_STOP
 
-  NABoolean getUseAggregationNodesOnly() const 
-      { return useAggregationNodesOnly_; }
-
-  void setUseAggregationNodesOnly(NABoolean x);
-
 protected :
 
-  Int32 computeNumOfSMPs();
-
-  //Helper function for getSuperNodeMap(). This actually implements the
-  //active cluster algorithm.
-  void createActiveClusterList();
-
-  void getProcessorStatus(maps* & outcpuList,short clusterNum);
-
-  //------------------------------------------------------------------------
-  // localCluster_ used to be the segment number.  On Linux, it is
-  // set to zero.
-  //------------------------------------------------------------------------
-  Int32 localCluster_;
-
   //------------------------------------------------------------------------
-  // On NSK, localSMP_ is the CPU number within the segment.  On Linux,
   // localSMP_ is the current node ID.
   //------------------------------------------------------------------------
   short localSMP_;
 
   //------------------------------------------------------------------------
-  // physical number of SMPs/Linux nodes (real configuration or OSIM config)
-  //------------------------------------------------------------------------
-  Int32 physicalSMPCount_;
-
-  //------------------------------------------------------------------------
   // heap_ is where this NAClusterInfo was allocated.  This should be the
   // context heap.
   //------------------------------------------------------------------------
   CollHeap * heap_;
 
+  // ------------------------------------------------------------------------
+  // A list of node ids of available nodes. Typically, this will be
+  // a list of the numbers 0 ... n-1 but in some cases a node in
+  // the middle may be removed, so we end up with "holes" in the
+  // node ids.
+  // ------------------------------------------------------------------------
+  NAList<CollIndex> cpuList_;
+
   //------------------------------------------------------------------------
   // hashdictionary used to store the mapping of cluster name to cluster id
   // This structure is stored on the context heap
@@ -267,40 +156,12 @@ protected :
   //------------------------------------------------------------------------
   NAHashDictionary<Int32, NAString>* nodeIdToNodeNameMap_;
 
-  // ------------------------------------------------------------------------
-  // On NSK and Windows, this maps from cluster number to its cpu
-  // configuration.  On Linux, this maps the single system number to the
-  // Linux node IDs that are configured as aggregation (compute) nodes.
-  // This is also stored on the context heap as we don't expect it to change
-  // during a session.
-  // ------------------------------------------------------------------------
-  NAHashDictionary<CollIndex,maps> * clusterToCPUMap_;
-
-  // ------------------------------------------------------------------------
-
   // hashdictionary that maps nodeName to nodeId.
   NAHashDictionary<NAString, Int32> *nodeNameToNodeIdMap_;
 
-  // List containing the active clusters or the super node map where ESP's
-  // will be brought up.  
-  // This is stored on the statement heap.
-  // ------------------------------------------------------------------------
-  NAList<CollIndex> * activeClusters_;
-
   NABoolean inTestMode_; // test mode indicator
-
-  NABoolean useAggregationNodesOnly_; 
-
-private:
-  static NABoolean IsRemoteNodeDown(short error);
-  static const char *GetNodeName(const char *dp2Name, char *buffer, Int32 size);
-
-  COM_VERSION maxOSV_;
-  QualifiedName maxOSVName_;
 };
 
-#define MAX_NUM_TSES 1024
-
 class NAClusterInfoLinux : public NAClusterInfo
 {
 public:
@@ -324,28 +185,14 @@ public:
 
    void captureOSInfo(ofstream &) const;
 
-   // get the kth TSE entry from a list of sorted TSE elements
-   MS_Mon_Process_Info_Type* getTSEInfoForPOS(Int32 k);
-
-   // get the total number of TSE elements
-   Int32 numTSEsForPOS(); 
-
    Int32 get_pid() { return pid_; };
    Int32 get_nid() { return nid_; };
 
-protected:
-
-   void setupTSEinfoForPOS();
-
 private:
    void     determineLinuxSysInfo();
 
    void     simulateNAClusterInfoLinux();
 
-   // TSE info used by POS
-   MS_Mon_Process_Info_Type* tseInfo_;
-   Int32 numTSEs_;
-
    int pid_; // the pid of the current process 
    int nid_; // the nid of the current process 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/optimizer/NATable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NATable.cpp b/core/sql/optimizer/NATable.cpp
index ab3cb6d..4b65ef4 100644
--- a/core/sql/optimizer/NATable.cpp
+++ b/core/sql/optimizer/NATable.cpp
@@ -7223,9 +7223,6 @@ void NATable::setupForStatement()
   if(setupForStatement_)
     return;
 
-  if( NOT qualifiedName_.isSpecialTable() )
-    gpClusterInfo->setMaxOSV(qualifiedName_.getQualifiedNameObj(), osv_);
-
   //reset the clustering index
   if(clusteringIndex_)
     clusteringIndex_->setupForStatement();

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/optimizer/NodeMap.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NodeMap.cpp b/core/sql/optimizer/NodeMap.cpp
index a901948..ddd556c 100644
--- a/core/sql/optimizer/NodeMap.cpp
+++ b/core/sql/optimizer/NodeMap.cpp
@@ -668,90 +668,6 @@ NodeMap::copy(CollHeap* heap) const
 
 } // NodeMap::copy()
 
-// load-time initialization
-THREAD_P RandomSequence* NodeMap::random_ = NULL;
-THREAD_P NABoolean       NodeMap::seeded = FALSE;
-
-// seed random number generator
-void NodeMap::seedIt()
-{
-  if (seeded)
-    return;
-  // else
-  Lng32 seed = CmpCommon::getDefaultLong(FLOAT_ESP_RANDOM_NUM_SEED);
-
-  if (!random_)
-    random_ = new (GetCliGlobals()->exCollHeap()) RandomSequence();
-
-  CLISemaphore * sema = GetCliGlobals()->getSemaphore();
-  sema->get();
-  if (!seeded) {
-    if (seed == 0) {
-      TimeVal tim;
-      GETTIMEOFDAY(&tim, 0);
-      seed = tim.tv_usec;
-    }
-    seed = seed % 65535;
-    random_->initialize(seed);
-    seeded = TRUE;
-  }
-  sema->release();
-}
-
-double NodeMap::random()
-{
-  double rv;
-  CMPASSERT(random_ != NULL);
-  CLISemaphore * sema = GetCliGlobals()->getSemaphore();
-  sema->get();
-  rv = random_->random();
-  sema->release();
-  return rv;
-}
-
-// return randomly chosen cpu for given segment
-Lng32 NodeMap::randCPU(CollIndex C)
-{
-  //get active segments and their corresponding cpus
-  NAArray<CollIndex>* clusterList;
-  NAArray<NAList<CollIndex>*> *cpuList;
-  Int32 cpuCount;
-  gpClusterInfo->getSuperNodemap(clusterList,cpuList,cpuCount);
-  // find segment C from supernodemap list
-  Lng32 cluster = getClusterNumber(C);
-  // default result is to return original cpu
-  Lng32 cpu = getNodeNumber(C); 
-  CollIndex clusX, ncpus = NULL_COLL_INDEX, nsegments = clusterList->entries();
-  for (clusX=0; clusX < nsegments; clusX++) {
-    ncpus = (*cpuList)[clusX]->entries();
-    if (cluster == Lng32((*clusterList)[clusX])) { // found segment
-      if (ncpus <= 1) {
-        // fall thru to return original cpu
-      }
-      else {
-        // seed the random number generator
-        seedIt();
-        // return randomly chosen cpu within given segment
-        cpu = (*(*cpuList)[clusX])[(CollIndex)floor(random()*ncpus)];
-      }
-    }
-  }
-  // didn't find segment -- in sql statements like
-  //   insert into d select ... from table (table s, location ...)
-  // it is possible not to find s' segment in the supernodemap.
-  // so, for these cases, do nothing:
-
-  // make sure we return a non-default cpu assignment
-  if (cpu == -1 && ncpus > 0) {
-    // seed the random number generator
-    seedIt();
-    // randomly choose cpu
-    cpu = (Lng32)floor(random()*ncpus);
-  }
-  return cpu;
-}
-
-//<pb>
 //==============================================================================
 //  Produce a logical node map with a specified number of entries using the
 // partition grouping algorithm of SQL/MX. Attempt to co-locate ESPs with their
@@ -851,21 +767,15 @@ NodeMap::synthesizeLogicalMap(const CollIndex logicalNumEntries,
                                    logicalNumEntries,
                                    NodeMapEntry::NOT_ACTIVE, type());
 
-  NAArray<CollIndex>* clusterList;
-  NAArray<NAList<CollIndex>*> *cpuList;
-  //get active segments and their corresponding cpus
-  Int32 cpuCount;
-  NABoolean error = gpClusterInfo->getSuperNodemap(clusterList,cpuList,
-                                                   cpuCount);
+  //get a list of the nodes in the cluster
+  const NAList<CollIndex> &cpuList(gpClusterInfo->getCPUList());
+  Int32 cpuCount = cpuList.entries();
   Lng32 affinityDef = ActiveSchemaDB()->getDefaults().getAsLong(AFFINITY_VALUE);
 
   // "float" single ESP
   if (logicalNumEntries == 1 && forESP &&
       CmpCommon::getDefault(COMP_BOOL_83) == DF_ON) {
     // colocate consumer with randomly chosen producer segment & cpu
-    seedIt();
-    Lng32 randX = (Lng32)floor(random()*getNumEntries()); // pick any producer
-    logicalMap->setClusterNumber(0, getClusterNumber(randX));
     logicalMap->setToRandCPU(0);
     // ESP exchange is active
     logicalMap->setPartitionState(0, NodeMapEntry::ACTIVE);
@@ -902,16 +812,10 @@ NodeMap::synthesizeLogicalMap(const CollIndex logicalNumEntries,
         // each ESP in an ESP exchange is active
         logicalMap->setPartitionState(espX, NodeMapEntry::ACTIVE);
         // assign ESP consumers to segments/cpus, round-robin
-        logicalMap->setNodeNumber(espX, (*(*cpuList)[clusX])[cpuX]);
-        logicalMap->setClusterNumber(espX, (Lng32)(*clusterList)[clusX]);
+        logicalMap->setNodeNumber(espX, cpuList[cpuX]);
         cpuX++; // advance to next cpu
-        if (cpuX >= (*cpuList)[clusX]->entries()) {
-          // gone thru all cpus in this segment. advance to next cluster.
-          clusX++;
+        if (cpuX >= cpuList.entries()) {
           cpuX = 0;
-          if (clusX >= clusterList->entries()) {
-            clusX = 0;
-          }
         }
       }
     }
@@ -1234,32 +1138,6 @@ NABoolean NodeMap::allNodesAreWildcards() const
 
   return TRUE;
 }
-//==============================================================================
-//  Determine if node map has a cluster specification for all entries.
-//
-// Input:
-//  none
-//
-// Output:
-//  none
-//
-// Return:
-//  TRUE if all node map entries have a cluster specification; FALSE otherwise.
-//
-//==============================================================================
-NABoolean
-NodeMap::allClustersSpecified() const
-{
-  for (CollIndex mapIdx = 0; mapIdx < getNumEntries(); mapIdx++)
-    {
-      if (getClusterNumber(mapIdx) == ANY_CLUSTER)
-        {
-          return FALSE;
-        }
-    }
-
-  return TRUE;
-}
 
 //<pb>
 //==============================================================================

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/optimizer/NodeMap.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NodeMap.h b/core/sql/optimizer/NodeMap.h
index f744d16..bef761c 100644
--- a/core/sql/optimizer/NodeMap.h
+++ b/core/sql/optimizer/NodeMap.h
@@ -56,7 +56,7 @@ typedef LIST(const char*) DP2VolumeNamesContainer;
 //  Indication that any node is acceptable.
 //-----------------------------------------
 const Lng32 ANY_NODE = -1;
-const Lng32 ANY_CLUSTER = -1;
+const Lng32 LOCAL_CLUSTER = 0;
 
 //--------------------------------------------
 //  A node map entry associates a process with
@@ -78,7 +78,7 @@ public:
     partitionName_ (0),
     heap_          (0),
     nodeNumber_    (ANY_NODE),
-    clusterNumber_ (ANY_CLUSTER),
+    clusterNumber_ (LOCAL_CLUSTER),
     partitionState_(state),
     givenName_(0)
   {}
@@ -284,7 +284,7 @@ public:
 
   NodeMap* copy(CollHeap* heap = 0) const;
 
-  void setToRandCPU(CollIndex x) { setNodeNumber(x, randCPU(x)); }
+  void setToRandCPU(CollIndex x) { setNodeNumber(x, ANY_NODE); }
 
   inline CollIndex getNumEntries() const { return map_.entries(); }
 
@@ -299,7 +299,6 @@ public:
 
   NABoolean allNodesSpecified(void) const;
   NABoolean allNodesAreWildcards() const;
-  NABoolean allClustersSpecified()  const;
 
   //--------------------------------
   // Accessor functions.
@@ -406,14 +405,6 @@ private:
 
   void resetCachedValues();
 
-  // return randomly chosen cpu for given cluster
-  Lng32 randCPU(CollIndex C);
-
-  static THREAD_P RandomSequence* random_; // random number generator for floating ESPs
-  static THREAD_P NABoolean seeded; // flag for seeding random number generator 
-  static void seedIt(); // seed random number generator
-  static double random();
-
   // An array of pointers to node map entries.
   ARRAY (NodeMapEntry *) map_;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/optimizer/OptimizerSimulator.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/OptimizerSimulator.cpp b/core/sql/optimizer/OptimizerSimulator.cpp
index 9709db8..da2cd3f 100644
--- a/core/sql/optimizer/OptimizerSimulator.cpp
+++ b/core/sql/optimizer/OptimizerSimulator.cpp
@@ -1186,34 +1186,26 @@ void NAClusterInfo::captureNAClusterInfo(ofstream & naclfile)
   // * activeClusters_;
   //
 
-  naclfile << "localCluster_: " << localCluster_ << endl
+  naclfile << "localCluster_: " << LOCAL_CLUSTER << endl
            << "localSMP_: " << localSMP_ << endl;
-
-  CollIndex *key_collindex;  
-  maps *val_maps;
-  // Iterator for logging all the entries in clusterToCPUMap_ HashDictionary.
-  NAHashDictionaryIterator<CollIndex, maps> C2CPUIter (*clusterToCPUMap_, NULL, NULL);  
-  naclfile << "clusterToCPUMap_: " << C2CPUIter.entries() << " :" << endl;
-  if (C2CPUIter.entries() > 0)
-  {
-    // Write the header line for the table.
-    naclfile << "  ";
-    naclfile.width(10); 
-    naclfile << "clusterNum" << "  ";
-    naclfile << "cpuList" << endl;
-    for (i=0; i<C2CPUIter.entries(); i++)
+  // number of clusters and their CPU (node) ids
+  // (right now there is always 1 cluster)
+  naclfile << "clusterToCPUMap_: 1 :" << endl;
+
+  // Write the header line for the table.
+  naclfile << "  ";
+  naclfile.width(10); 
+  naclfile << "clusterNum" << "  ";
+  naclfile << "cpuList" << endl;
+
+  naclfile << "  ";
+  naclfile.width(10); naclfile << LOCAL_CLUSTER << "  ";
+  naclfile << cpuList_.entries() << " : ";
+  for (ci=0; ci<cpuList_.entries(); ci++)
     {
-      C2CPUIter.getNext(key_collindex, val_maps);
-      naclfile << "  ";
-      naclfile.width(10); naclfile << *key_collindex << "  ";
-                          naclfile << val_maps->list->entries() << " : ";
-      for (ci=0; ci<val_maps->list->entries(); ci++)
-      {
-        naclfile.width(3); naclfile << (*(val_maps->list))[ci] << " ";
-      }
-      naclfile << endl;
+      naclfile.width(3); naclfile << cpuList_[ci] << " ";
     }
-  }
+  naclfile << endl;
 
   Int32 * nodeID = NULL;
   NAString* nodeName = NULL;
@@ -1240,8 +1232,7 @@ void NAClusterInfo::simulateNAClusterInfo()
 
   const char* filepath = CURRCONTEXT_OPTSIMULATOR->getLogFilePath(OptimizerSimulator::NACLUSTERINFO);
 
-  activeClusters_= NULL;
-  physicalSMPCount_ = -1;
+  cpuList_.clear();
 
   ifstream naclfile(filepath);
 
@@ -1256,7 +1247,9 @@ void NAClusterInfo::simulateNAClusterInfo()
     naclfile.getline(var, sizeof(var), ':');
     if(!strcmp(var, "localCluster_"))
     {
-      naclfile >> localCluster_; naclfile.ignore(OSIM_LINEMAX, '\n');
+      int dummyLocalCluster;
+
+      naclfile >> dummyLocalCluster; naclfile.ignore(OSIM_LINEMAX, '\n');
     }
     else if (!strcmp(var, "localSMP_"))
     {
@@ -1264,28 +1257,25 @@ void NAClusterInfo::simulateNAClusterInfo()
     }
     else if (!strcmp(var, "clusterToCPUMap_"))
     {
-      Int32 C2CPU_entries, clusterNum, cpuList_entries, cpuNum;
+      Int32 numClusters, clusterNum, cpuList_entries, cpuNum;
 
-      clusterToCPUMap_ = new(heap_) NAHashDictionary<CollIndex,maps>(&clusterNumHashFunc,17,TRUE, heap_);
-      naclfile >> C2CPU_entries; naclfile.ignore(OSIM_LINEMAX, '\n');
-      if(C2CPU_entries > 0)
+      naclfile >> numClusters; naclfile.ignore(OSIM_LINEMAX, '\n');
+      // we don't support multiple clusters at this time
+      CMPASSERT(numClusters <= 1);
+      if(numClusters > 0)
       {
         // Read and ignore the header line.
         naclfile.ignore(OSIM_LINEMAX, '\n');
-        for (i=0; i<C2CPU_entries; i++)
+        for (i=0; i<numClusters; i++)
         {
           naclfile >> clusterNum;
           naclfile >> cpuList_entries; naclfile.ignore(OSIM_LINEMAX, ':');
-          CollIndex *key_clusterNum = new(heap_) CollIndex(clusterNum);
-          maps *val_cpuList = new(heap_) maps(heap_);
           for (ci=0; ci<cpuList_entries; ci++)
           {
             naclfile >> cpuNum;
-            val_cpuList->list->insert(cpuNum);
+            cpuList_.insert(cpuNum);
           }
           naclfile.ignore(OSIM_LINEMAX, '\n');
-          CollIndex *checkClusterNum = clusterToCPUMap_->insert(key_clusterNum, val_cpuList);
-          CMPASSERT(checkClusterNum);
         }
       }
     }
@@ -1301,7 +1291,6 @@ void NAClusterInfo::simulateNAClusterInfo()
                                                           (&NAString::hash, 101,TRUE,heap_);
       naclfile >> id_name_entries;
       naclfile.ignore(OSIM_LINEMAX, '\n');
-      physicalSMPCount_ = id_name_entries;
       for(i = 0; i < id_name_entries; i++)
       {
           naclfile >> nodeId >> nodeName;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/optimizer/SchemaDB.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/SchemaDB.cpp b/core/sql/optimizer/SchemaDB.cpp
index 034f3bf..a2f611f 100644
--- a/core/sql/optimizer/SchemaDB.cpp
+++ b/core/sql/optimizer/SchemaDB.cpp
@@ -96,7 +96,6 @@ SchemaDB::SchemaDB(ReadTableDef *rtd)
 	// triggers -- eliezer
 	// created only on demand
     triggerDB_(NULL),
-    nodeToCpuVolMapDB_(NULL),
     currentDiskPool_(-1),
     hbaseBlockCacheFrac_(-1.0)
 {
@@ -327,250 +326,3 @@ TriggerDB * SchemaDB::getTriggerDB() {
 		triggerDB_ = new (Trigger::Heap()) TriggerDB(Trigger::Heap());
 	return triggerDB_;
 }
-
-
-NodeToCpuVolMapDB *SchemaDB::getNodeToCpuVolMapDB()
-{
-  if (!nodeToCpuVolMapDB_)
-    nodeToCpuVolMapDB_ = new (CTXTHEAP) NodeToCpuVolMapDB(CTXTHEAP);
-  return nodeToCpuVolMapDB_;
-}
-
-
-VolumeList::VolumeList(const CpuToVolMap &orig, NAMemory *h)
-    : LIST(VolumeInfo *)(h),
-      cpu_(orig.getCpu()),
-      includedCpu_(FALSE),
-      numOfIncludedVols_(0),
-      currentVolIndex_(0),
-      totalNumOfVols_(0)
-{
-  for (CollIndex z=0; z < orig.entries();  z++)
-  {
-    VolumeInfo *volume = new (h) VolumeInfo(*(orig[z]), h);
-    totalNumOfVols_ += 1;
-    insert(volume);
-  }
-}
-
-void VolumeList::insertVolInSortedOrder(VolumeInfo *vol)
-{
-  CollIndex i=0;
-  for (i=0; i < entries(); i++)
-  {
-    if (strcmp(at(i)->getVolName().data(), vol->getVolName().data()) > 0)
-    {
-      break;
-    }
-  }
-
-  insertAt(i, vol);
-}
-
-CpuArray::CpuArray(const NodeToCpuVolMap *node, NAMemory *h)
-     : ARRAY(VolumeList *)(h, CPU_INIT_SIZE),
-       nodeName_(node->getNodeName(), h),
-       currentCpuIndex_(-1),
-       totalNumOfVols_(0)
-{
-  CollIndex j = 0;
-  CollIndex remainingCpus = node->entries();
-  for (j = 0; remainingCpus > 0; j++)
-  {
-    if (node->used(j))
-    {
-      CpuToVolMap *cpuEntry = node->at(j);
-      VolumeList *cpuToVolList = new (h) VolumeList(*cpuEntry, h);
-
-      insertAt(j, cpuToVolList);
-      totalNumOfVols_ += cpuToVolList->getTotalNumOfVols();
-      remainingCpus--;
-    }
-  }
-}
-
-
-NodeInfoDB::NodeInfoDB(const NodeToCpuVolMapDB *nodeDB,
-                       const LIST(NAString *) &qualifyingNodeNames,
-                       NAMemory *h)
-          : NAKeyLookup<NAString, CpuArray>
-                (NODE_INIT_SIZE,
-                 NAKeyLookupEnums::KEY_INSIDE_VALUE,
-                 h),
-            totalNumOfCpus_(0),
-            totalNumOfVols_(0),
-            nodeNames_(h),
-            heap_(h)
-{
-  for (CollIndex i= 0; i < qualifyingNodeNames.entries(); i++)
-  {
-    NodeToCpuVolMap *nodeInCache = nodeDB->get(qualifyingNodeNames[i]);
-    if (nodeInCache)
-    {
-      CpuArray *newNode = new (h) CpuArray(nodeInCache, h);
-      insert(newNode);
-      totalNumOfVols_ += newNode->getTotalNumOfVols();
-    }
-  }
-}
-
-void NodeToCpuVolMapDB::estimateAndSetDiskSize(double diskSize)
-{
-
-// Before saving the disk volume size convert into MB.  The original size
-// of the disk volume passed in will be in the form of pages.
-  double sizeInMB = (diskSize/COM_ONE_MEG * COM_PAGE_SIZE_IN_BYTES);
-
-  Lng32 largestSizeMB = COM_ONE_KB * ActiveSchemaDB()->getDefaults().
-                         getAsULong(POS_DEFAULT_LARGEST_DISK_SIZE_GB);
-
-  if ( sizeInMB > largestSizeMB )
-    sizeInMB = largestSizeMB;
-    
-
-  if ((sizeOfDiskVol_ == 0) || (sizeOfDiskVol_ > sizeInMB))
-    sizeOfDiskVol_ = (Lng32) sizeInMB;
-}
-
-
-
-// This method collects all the qualifying volume names and its corresponding
-// cpu numbers for all the nodes in the input parameter list by calling CLI &
-// then caches the information in Context Heap and saves it in SchemaDB
-
-void NodeToCpuVolMapDB::buildVolumeNameCache
-                             (const LIST(NAString *) &qualifyingNodeNames)
-{
-
-  // On Linux, there should be just 1 qualifying node, and it should be "\NSK"
-  CMPASSERT(qualifyingNodeNames.entries() == 1);
-
-  Int32 dNumInfo = 0;
-
-  NAString *qualifyingNodeName = qualifyingNodeNames[0];
-  NodeToCpuVolMap *nodeInCache = get(qualifyingNodeName);
-
-  if (nodeInCache == NULL)
-  {
-    dNumInfo = ((NAClusterInfoLinux*)gpClusterInfo) -> numTSEsForPOS();
-  
-    // create an instance of NodeToCpuVolMap to hold the cpu volume info
-    // and insert into cache
-    nodeInCache = new (heap_) NodeToCpuVolMap(*qualifyingNodeName, heap_);
-
-    // numVolumes indicates the number of valid volumes to use for POS.
-    Int32 numQualifyingVolumes = 0;
-    short error = 0;
-    Int64 thisVolCapacity = 0;
-    Int64 totalFreeSpace = 0;
- 
-    // loop through all the qualifying volumes that were collected
-    for (Lng32 diskNum = 0; diskNum < dNumInfo; diskNum++)
-    {
-       MS_Mon_Process_Info_Type* tseInfo =
-          ((NAClusterInfoLinux*)gpClusterInfo) -> getTSEInfoForPOS(diskNum);
-       if ( tseInfo == NULL )
-          ABORT("Internal error in NodeInfoDB::buildVolumeNameCache. tseInfo is NULL");
-
-      ULng32 cpu = tseInfo->nid;
-      if (!nodeInCache->used(cpu))
-      {
-        CpuToVolMap *cpuToVolMap = new (heap_) CpuToVolMap(cpu, heap_);
-        nodeInCache->insertAt(cpu, cpuToVolMap);
-      }
-
-      NAString *volName = new (heap_) NAString(tseInfo->process_name,
-                                               heap_);
-      volName->toUpper();
-      nodeInCache->at(cpu)->insert(volName);
-      numQualifyingVolumes++;
-      Int64 thisVolCapacity = 0;
-      Int64 totalFreeSpace = 0;
-      if (!error)
-      {
-      }
-
-      if (error)
-        thisVolCapacity = (Int64)COM_ONE_GIG * ActiveSchemaDB()->getDefaults().
-              getAsULong(POS_DEFAULT_SMALLEST_DISK_SIZE_GB);
-
-      // change it to number of pages before saving in the node cache in MB
-      thisVolCapacity /= COM_PAGE_SIZE_IN_BYTES;
-      estimateAndSetDiskSize(thisVolCapacity);
-    }
-
-    nodeInCache->setTotalNumOfVols(numQualifyingVolumes);
-    insert(nodeInCache);
-  }
-
-}
-
-// This method returns the number of volumes attached to the given node . 
-// This method calls buildVolumeNameCahe to make sure
-// that the node has a NodeToCpuVolMap in the DB. 
-Lng32 NodeToCpuVolMapDB::getTotalNumOfVols
-                             (NAString* nodeName)
-{
-  if (nodeName)
-  {
-    LIST(NAString *) qualifyingNodeNames(CTXTHEAP);
-    qualifyingNodeNames.insert(nodeName);
-
-    buildVolumeNameCache(qualifyingNodeNames);
-    NodeToCpuVolMap *nodeInCache = get(nodeName);
-    //if nodeInCache is null, then this particular node
-    // is nonQualifying. return 0 in this case
-    if(nodeInCache)  
-      return nodeInCache->getTotalNumOfVols() ;
-  }
-
-  return 0 ;
-}
-
-void NodeInfoDB::insertNodeNameInSortedOrder(NAString *nodeName)
-{
-  CollIndex i = 0;
-  for (i=0; i < nodeNames_.entries(); i++)
-  {
-    if (strcmp(nodeNames_[i]->data(), nodeName->data()) > 0)
-    {
-      break;
-    }
-  }
-  
-  NAString *name = new (heap_) NAString(*nodeName, heap_);
-  nodeNames_.insertAt(i, name);
-}
-
-
-// This method will return the totalNumOfVols_ if it is already set
-// otherwise calculates the total volumes from all the nodes.
-Lng32 NodeInfoDB::getTotalNumOfVols()
-{
-  if (totalNumOfVols_ != 0)
-    return totalNumOfVols_;
-  else
-  {
-    NAHashDictionaryIterator<NAString, CpuArray> iter(*this);
-
-    for (CollIndex i=0; i < iter.entries(); i++)
-    {
-      NAString *key;
-      CpuArray *value;
-      iter.getNext(key,value);
-      CMPASSERT(value != NULL);
-
-      CollIndex remainingCpus = value->entries();
-      for (CollIndex j = 0; remainingCpus > 0; j++)
-      {
-        if (value->used(j))
-        {
-          totalNumOfVols_ = totalNumOfVols_ + value->at(j)->entries();
-          remainingCpus--;
-        }
-      }
-    } // for all the nodes in tempDB
-    return totalNumOfVols_;
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/optimizer/SchemaDB.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/SchemaDB.h b/core/sql/optimizer/SchemaDB.h
index 89e3c44..8f4a8cd 100644
--- a/core/sql/optimizer/SchemaDB.h
+++ b/core/sql/optimizer/SchemaDB.h
@@ -58,8 +58,6 @@ class NARoutineDB;
 // contents of this file
 // ----------------------------------------------------------------------
 class SchemaDB;
-class NodeToCpuVolMap;
-class NodeToCpuVolMapDB;
 class POSRule;
 class POSInfo;
 
@@ -163,8 +161,6 @@ public:
   void initPerStatement(NABoolean lightweight = FALSE);		// before stmt
   void cleanupPerStatement();					// after stmt
 
-  NodeToCpuVolMapDB *getNodeToCpuVolMapDB();
-
   Lng32 getCurrentDiskPool() { return currentDiskPool_; }
 
   void setCurrentDiskPool(Lng32 diskPool) 
@@ -246,9 +242,6 @@ private:
   NARoutineDB routineDB_;
   NARoutineDB actionRoutineDB_;
 
-  // Hash lookup by Node name
-  NodeToCpuVolMapDB *nodeToCpuVolMapDB_;
-
   Lng32 currentDiskPool_;
   float hbaseBlockCacheFrac_;
 
@@ -270,286 +263,6 @@ inline Lng32 getDefaultAsLong(const Int32& key)
   return ActiveSchemaDB()->getDefaults().getAsLong(key);
 }
 
-
-#define NODE_INIT_SIZE  16
-#define CPU_INIT_SIZE  16
-
-class CpuToVolMap : public LIST(NAString *)
-{
-  public:
-    CpuToVolMap(Lng32 cpu, NAMemory *h)
-               : LIST(NAString *)(h), cpu_(cpu)
-    {};
-
-    Lng32 getCpu() const {return cpu_;}
-
-  private:
-    Lng32 cpu_;
-};
-
-
-class NodeToCpuVolMap : public ARRAY(CpuToVolMap *)
-{
-  public:
-    NodeToCpuVolMap(const NAString &nodeName, NAMemory *h)
-        : ARRAY(CpuToVolMap *)(h, CPU_INIT_SIZE),
-          nodeName_(nodeName, h),
-	  totalNumOfVols_(0)
-    { };
-
-    NodeToCpuVolMap(const NodeToCpuVolMap &orig, CollHeap *h)
-        : ARRAY(CpuToVolMap *)(orig, h),
-	  totalNumOfVols_(0)
-    {};
-
-
-  // ---------------------------------------------------------------------
-  // Accessor functions
-  // ---------------------------------------------------------------------
-  const NAString& getNodeName() const  { return nodeName_; }
-
-  // ---------------------------------------------------------------------
-  // The following methods are required by the NAKeyLookup
-  // ---------------------------------------------------------------------
-   NABoolean operator==(const NodeToCpuVolMap& other) const
-                                        { return this == &other; }
-
-   const NAString *getKey() const { return &nodeName_; }
-
-   short getTotalNumOfVols() const { return totalNumOfVols_; }
-
-   void setTotalNumOfVols(const Lng32 numVols) 
-    { totalNumOfVols_ = (short) numVols; }
-
-
-  private:
-    NAString nodeName_;
-    short totalNumOfVols_;
-};
-
-class NodeToCpuVolMapDB : public NAKeyLookup<NAString, NodeToCpuVolMap>
-{
-  public:
-    NodeToCpuVolMapDB(NAMemory *h) :
-                      NAKeyLookup<NAString, NodeToCpuVolMap>
-                          (NODE_INIT_SIZE,
-                           NAKeyLookupEnums::KEY_INSIDE_VALUE,
-                           h),
-                      heap_(h),
-                      sizeOfDiskVol_(0)
-        {};
-
-    NodeToCpuVolMapDB(const NodeToCpuVolMapDB &orig, NAMemory *h)
-                        : NAKeyLookup<NAString, NodeToCpuVolMap> (orig, h)
-        {};
-
-    void clearAndDestroy();
-
-    void buildVolumeNameCache(const LIST(NAString *) &nodeNames);
-    Lng32 getTotalNumOfVols(NAString * nodeName);
-    void estimateAndSetDiskSize(double diskSize);
-
-    void setSizeOfDiskVol(Lng32 sizeOfDiskVol)
-                   { sizeOfDiskVol_ = sizeOfDiskVol; }
-    Lng32 getSizeOfDiskVol() { return sizeOfDiskVol_; }
-
-  private:
-    NAMemory *heap_;
-    Lng32 sizeOfDiskVol_;
-};
-
-
-class VolumeInfo : public NABasicObject
-{
-  public:
-    VolumeInfo(const NAString &volName, NAMemory *h)
-      : volumeName_(volName, h),
-        includedVol_(FALSE),
-        usedCnt_(0)
-    { }
-
-    const NAString &getVolName() const { return volumeName_; }
-    NABoolean isIncludedVol() const { return includedVol_; }
-    void setIncludedVol(NABoolean included) { includedVol_ = included; }
-    short getUsedCnt() const {return usedCnt_; }
-    void incUsedCnt() { usedCnt_++; }
-    void setUsedCnt(short cnt) { usedCnt_ = cnt; }
-
-
-  private:
-    NAString volumeName_;
-    NABoolean includedVol_;
-    short usedCnt_;
-};
-
-class VolumeList : public LIST(VolumeInfo *)
-{
-  public:
-    VolumeList(Lng32 cpu, NAMemory *h)
-               : LIST(VolumeInfo *)(h),
-                 cpu_(cpu),
-                 includedCpu_(FALSE),
-                 numOfIncludedVols_(0),
-                 currentVolIndex_(0),
-                 totalNumOfVols_(0)
-    { };
-
-    VolumeList(const VolumeList &orig, NAMemory *h)
-        : LIST(VolumeInfo *)(orig, h),
-          cpu_(orig.cpu_),
-          includedCpu_(orig.includedCpu_),
-          numOfIncludedVols_(orig.numOfIncludedVols_),
-          currentVolIndex_(orig.currentVolIndex_),
-          totalNumOfVols_(0)
-    { };
-
-    VolumeList(const CpuToVolMap &orig, NAMemory *h);
-
-    void insertVolInSortedOrder(VolumeInfo *vol);
-
-    Lng32 getCpu() const 
-        {return cpu_;}
-    NABoolean isIncludedCpu() const 
-        { return includedCpu_; }
-    void setIncludedCpu(NABoolean included) 
-        { includedCpu_ = included; }
-    Lng32 getNumOfIncludedVols() const 
-        { return numOfIncludedVols_; }
-    void incNumOfIncludedVols() 
-        { numOfIncludedVols_++; }
-    void incTotalNumOfVols() { totalNumOfVols_++; }
-    void setTotalNumOfVols(Lng32 numOfVols) 
-        { totalNumOfVols_ = numOfVols; }
-    Lng32 getTotalNumOfVols()
-        { return totalNumOfVols_; }
-    ULng32 getCurrVolIndex() const 
-        { return currentVolIndex_; }
-    void incCurrVolIndex()
-        { currentVolIndex_ = (++currentVolIndex_  %  entries()); }
-
-  private:
-    Lng32 cpu_;
-    NABoolean includedCpu_;
-    short numOfIncludedVols_;
-    Lng32 totalNumOfVols_;
-    ULng32 currentVolIndex_;
-};
-
-
-class CpuArray : public ARRAY(VolumeList *)
-{
-  public:
-    CpuArray(const NAString &nodeName, NAMemory *h)
-        : ARRAY(VolumeList *)(h, CPU_INIT_SIZE),
-          nodeName_(nodeName, h),
-          currentCpuIndex_(-1)
-    { };
-
-    CpuArray(const CpuArray &orig, CollHeap *h)
-        : ARRAY(VolumeList *)(orig, h),
-          nodeName_(orig.nodeName_, h),
-          currentCpuIndex_(orig.currentCpuIndex_)
-    {};
-
-    CpuArray(const NodeToCpuVolMap *node, NAMemory *h);
-
-    void setCurrCpuIndex(Lng32 index)
-        { currentCpuIndex_ = index; }
-    Lng32 getCurrCpuIndex() const
-        { return currentCpuIndex_; }
-    void incCurrCpuIndex()
-        { currentCpuIndex_ = (Lng32) (++currentCpuIndex_  %  getUsedLength()); }
-    void setTotalNumOfVols(Lng32 numOfVols)
-        { totalNumOfVols_ = numOfVols; }
-    Lng32 getTotalNumOfVols()
-        { return totalNumOfVols_; }
-
-  // ---------------------------------------------------------------------
-  // Accessor functions
-  // ---------------------------------------------------------------------
-  const NAString& getNodeName() const  { return nodeName_; }
-
-  // ---------------------------------------------------------------------
-  // The following methods are required by the NAKeyLookup
-  // ---------------------------------------------------------------------
-   NABoolean operator==(const CpuArray& other) const
-                                        { return this == &other; }
-
-   const NAString *getKey() const { return &nodeName_; }
-
-
-  private:
-    NAString nodeName_;
-    Lng32 currentCpuIndex_;
-    Lng32 totalNumOfVols_;
-};
-
-
-class NodeInfoDB : public NAKeyLookup<NAString, CpuArray>
-{
-  public:
-    NodeInfoDB(NAMemory *h) :
-                      NAKeyLookup<NAString, CpuArray>
-                          (NODE_INIT_SIZE,
-                           NAKeyLookupEnums::KEY_INSIDE_VALUE,
-                           h),
-                      totalNumOfCpus_(0),
-                      totalNumOfVols_(0),
-                      nodeNames_(h),
-                      heap_(h)
-    { };
-
-    NodeInfoDB(const NodeInfoDB &orig, NAMemory *h)
-                        : NAKeyLookup<NAString, CpuArray> (orig, h),
-                          heap_(h),
-                          totalNumOfVols_(orig.totalNumOfVols_),
-                          totalNumOfCpus_(orig.totalNumOfCpus_),
-                          nodeNames_(orig.nodeNames_, h)
-    { };
-
-    NodeInfoDB(const NodeToCpuVolMapDB *nodeDB,
-               const LIST(NAString *) &qualifyingNodeNames,
-               NAMemory *h);
-
-    void clearAndDestroy();  // not written
-
-    void incNumOfCpus() { totalNumOfCpus_++; }
-    Lng32 getNumOfCpus() const { return totalNumOfCpus_; }
-
-    void incTotalNumOfVols() { totalNumOfVols_++; }
-    Lng32 getTotalNumOfVols();
-
-    const LIST(NAString *) &getNodeNames() const { return nodeNames_; }
-
-    void insertNodeName(NAString *nodeName)
-    {
-      NAString *name = new (heap_) NAString(*nodeName, heap_);
-      nodeNames_.insert(name);
-    }
-
-
-    void insertNodeNameInSortedOrder(NAString *nodeName);
-
-
-  private:
-    NAMemory *heap_;
-
-    // total number of qualifying cpus in all the qualifying nodes of
-    // this statement
-    Lng32 totalNumOfCpus_;
-
-    // total number of qualifying volumes in all the qualifying nodes of
-    // this statement
-    Lng32 totalNumOfVols_;
-
-    // list of qualifying node names for this statement
-    LIST(NAString *) nodeNames_;
-
-    Lng32 sizeOfDiskVol_;
-
-};
-
-
 #endif /* SCHEMADB_H */
 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/optimizer/costmethod.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/costmethod.cpp b/core/sql/optimizer/costmethod.cpp
index 0e4b0c5..9ff5c3a 100644
--- a/core/sql/optimizer/costmethod.cpp
+++ b/core/sql/optimizer/costmethod.cpp
@@ -3152,8 +3152,6 @@ CostMethodExchange::categorizeMessages(
 
   if (useNodeMaps && parentNodeMap->allNodesSpecified()
       && childNodeMap->allNodesSpecified()
-      && parentNodeMap->allClustersSpecified()
-      && childNodeMap->allClustersSpecified()
       && NOT CURRSTMT_OPTDEFAULTS->isFakeHardware())
     {
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index 0dcd690..adcf4d7 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -533,13 +533,6 @@ enum DefaultConstants
   GEN_UDR_SIZE_DOWN,
   GEN_UDR_SIZE_UP,
 
-
-  // --------------------------------------------------------------------------
-  // Defaults used by the Generator for Node and Disk Autonomy:
-  // --------------------------------------------------------------------------
-  GEN_MAX_NUM_PART_DISK_ENTRIES,
-  GEN_MAX_NUM_PART_NODE_ENTRIES,
-
   // -------------------------------------------------------------------------
   // Parameters used by the executor when dynamically resizing queues
   // (are stored in each TDB that is generated)
@@ -2948,8 +2941,6 @@ enum DefaultConstants
   POS_TEST_NUM_NODES,
   POS_TEST_NUM_VOLUMES_PER_NODE,
 
-  ESP_ON_AGGREGATION_NODES_ONLY,
-
   // for default/public schema settings
   PUBLIC_SCHEMA_NAME,
   DEFAULT_SCHEMA_NAMETYPE,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index 6e04886..56f176c 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -1309,8 +1309,6 @@ SDDui___(CYCLIC_ESP_PLACEMENT,                  "1"),
   DDui1_6(ESP_NUM_FRAGMENTS,			"3"),
   DDui1_6(ESP_NUM_FRAGMENTS_WITH_QUOTAS,	"6"),
 
-  DDkwd__(ESP_ON_AGGREGATION_NODES_ONLY,       "OFF"),
-
   DDSint__(ESP_PRIORITY,                        "0"),
   DDSint__(ESP_PRIORITY_DELTA,                  "0"),
 
@@ -1567,8 +1565,6 @@ SDDkwd__(EXE_DIAGNOSTIC_EVENTS,		"OFF"),
   DDui1__(GEN_MATR_NUM_BUFFERS,			"1"),
   DDui1__(GEN_MATR_SIZE_DOWN,			"2"),
   DDui1__(GEN_MATR_SIZE_UP,			"8"),
-  DDui___(GEN_MAX_NUM_PART_DISK_ENTRIES,       "3"),
-  DDui___(GEN_MAX_NUM_PART_NODE_ENTRIES,       "255"),
   DDui1__(GEN_MEM_PRESSURE_THRESHOLD,		"10000"),
   DDui1__(GEN_MJ_BUFFER_SIZE,			"32768"),
   DDui1__(GEN_MJ_NUM_BUFFERS,			"1"),
@@ -4338,7 +4334,6 @@ void NADefaults::updateSystemParameters(NABoolean reInit)
       "DEF_PHYSICAL_MEMORY_AVAILABLE", //returned in KB not bytes
       "DEF_TOTAL_MEMORY_AVAILABLE",		 //returned in KB not bytes
       "DEF_VIRTUAL_MEMORY_AVAILABLE"
-      , "GEN_MAX_NUM_PART_DISK_ENTRIES"
       , "USTAT_IUS_PERSISTENT_CBF_PATH"
    }; //returned in KB not bytes
 
@@ -4557,30 +4552,6 @@ void NADefaults::updateSystemParameters(NABoolean reInit)
       }
       break;
 
-   case GEN_MAX_NUM_PART_DISK_ENTRIES:
-      {
-
-       // Make sure the gpClusterInfo points at an NAClusterLinux object.
-       // In osim simulation mode, the pointer can point at a
-       // NAClusterNSK object, for which the method numTSEsForPOS() is not
-       // defined.
-       NAClusterInfoLinux* gpLinux =
-           dynamic_cast<NAClusterInfoLinux*>(gpClusterInfo);
-
-       if ( gpLinux ) {
-
-          UInt32 numTSEs = (UInt32)gpLinux->numTSEsForPOS();
-
-          utoa_(numTSEs, valuestr);
-          strcpy(newValue, valuestr);
-
-          if(reInit)
-            ActiveSchemaDB()->
-              getDefaults().updateCurrentDefaultsForOSIM(&defaultDefaults[j]);
-       }
-      }
-      break;
-
     case USTAT_IUS_PERSISTENT_CBF_PATH:
 
       {
@@ -5826,13 +5797,6 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName,
 	}
 	break;
 	
-      case ESP_ON_AGGREGATION_NODES_ONLY:
-        {
-         NABoolean useAgg = (getToken(attrEnum) == DF_ON);
-         gpClusterInfo->setUseAggregationNodesOnly(useAgg);
-         break;
-        }
-
       case QUERY_TEXT_CACHE:
       {
         // If public schema is in use, query text cache has to be off

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4bea445d/core/sql/ustat/hs_cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_cli.cpp b/core/sql/ustat/hs_cli.cpp
index cd9a571..acdbb7e 100644
--- a/core/sql/ustat/hs_cli.cpp
+++ b/core/sql/ustat/hs_cli.cpp
@@ -5311,53 +5311,7 @@ NAString HSSample::getTempTablePartitionInfo(NABoolean unpartitionedSample,
            // For now, choosing numPartitionsNeeded to be even is safe.
            if (((numPartitionsNeeded % 2) != 0) AND (numPartitionsNeeded > 1))
              --numPartitionsNeeded;
-   
-           // If POS is going to be uzed, there are 3 possibilities
-           // 1. estimated Number of partitions of sample table is less than
-           // number of partitions on local node, assuming each partition holds
-           // at most HIST_SCRATCH_VOL_THRESHOLD/HIST_FETCHCOUNT_SCRATCH_VOL_THRESHOLD
-           // (100MB/10MB is defaul) bytes of data.
-           // In this case we set POS to LOCAL_NODE and create exactly as many
-           // partitions as needed.
-           // 2. If case 1. is not true, (i.e. data in sample table will not fit on
-           // node, if we have HIST_SCRATCH_VOL_THRESHOLD/HIST_FETCHCOUNT_SCRATCH_VOL_THRESHOLD
-           // bytes of data in each partition and 1 partition per disk) we heuristically
-           // multiply HIST_SCRATCH_VOL_THRESHOLD/HIST_FETCHCOUNT_SCRATCH_VOL_THRESHOLD
-           // by 3 and see if the sample table will now fit in the local node. If it
-           // does we set POS to LOCAL_NODE and provide POS with the sample table size.
-           // POS will create one partition in each disk on the local node and automatically
-           // adjust the extent size based on the sample table size. If the number of partitions
-           // in the source table is less than or equal to the number of partitions in the local
-           // node we choose this option too as we do not want the sample table to have more partitions
-           // than the base table.
-           // 3. If the sample table will not fit in the local node even when
-           // HIST_SCRATCH_VOL_THRESHOLD is multiplied by 3, then we set POS to MULTI_NODE and
-           // provide it with the sample table size. POS will create a sample table
-           // with one partition in each available disk in the multi-node with the appropriate
-           // extent size based on sample table size.
-   
-           NAString *localNodeName = getLocalNodeName();
-           NodeToCpuVolMapDB *volumeCache = ActiveSchemaDB()->getNodeToCpuVolMapDB();
-           Lng32 numVolsInLocalNode = volumeCache->getTotalNumOfVols(localNodeName);
-           if ( (numVolsInLocalNode > 0) &&
-                (numPartitionsNeeded > numVolsInLocalNode))
-           {
-             if ((numPartitionsNeeded < 3*numVolsInLocalNode) ||
-                 (objDef->getNumPartitions() <= numVolsInLocalNode))
-             {
-               usePOSLocalNodeWithTableSize = TRUE;
-               numPartitionsNeeded = numVolsInLocalNode;
-             }
-             else
-               usePOSMultiNode = TRUE ;
-   
-               sampleTableSizeInMB = (Lng32) ceil((double)sampleRowCount
-                                                              *
-                                                  objDef->getRecordLength()
-                                                              /
-                                                        MB_IN_BYTES);
-           }
-          } // end of USTAT_USE_GROUPING_FOR_SAMPLING is OFF
+           } // end of USTAT_USE_GROUPING_FOR_SAMPLING is OFF
      } // end of non hive tables
                                    /*=========================================*/
                                    /*   FLOAT PRIMARY KEY - NO PARTITIONING   */


[5/5] incubator-trafodion git commit: Merge [TRAFODION-2628] SQL engine work for Elasticity PR-1170

Posted by hz...@apache.org.
Merge [TRAFODION-2628] SQL engine work for Elasticity PR-1170


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/9aede9ca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/9aede9ca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/9aede9ca

Branch: refs/heads/master
Commit: 9aede9cacadecda3125d41d0858f5a10c28a1e2e
Parents: e7dedc8 8f5fd23
Author: Hans Zeller <hz...@apache.org>
Authored: Wed Jul 26 16:02:23 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Wed Jul 26 16:02:23 2017 +0000

----------------------------------------------------------------------
 core/sql/cli/Globals.cpp                    |  13 +-
 core/sql/cli/Globals.h                      |  27 +-
 core/sql/common/ComRtUtils.cpp              |  51 +-
 core/sql/common/ComRtUtils.h                |  28 +-
 core/sql/executor/ex_frag_rt.cpp            |  23 +-
 core/sql/executor/ex_frag_rt.h              |   1 +
 core/sql/generator/Generator.cpp            |  55 +-
 core/sql/optimizer/NAClusterInfo.cpp        | 671 +----------------------
 core/sql/optimizer/NAClusterInfo.h          | 173 +-----
 core/sql/optimizer/NATable.cpp              |   3 -
 core/sql/optimizer/NodeMap.cpp              | 132 +----
 core/sql/optimizer/NodeMap.h                |  15 +-
 core/sql/optimizer/OptimizerSimulator.cpp   |  71 +--
 core/sql/optimizer/SchemaDB.cpp             | 248 ---------
 core/sql/optimizer/SchemaDB.h               | 287 ----------
 core/sql/optimizer/costmethod.cpp           |   2 -
 core/sql/regress/compGeneral/EXPECTED001.SB |  15 -
 core/sql/regress/compGeneral/TEST001        |   9 -
 core/sql/runtimestats/ssmpipc.cpp           |  20 +-
 core/sql/sqlcomp/DefaultConstants.h         |   9 -
 core/sql/sqlcomp/nadefaults.cpp             |  36 --
 core/sql/ustat/hs_cli.cpp                   |  48 +-
 22 files changed, 154 insertions(+), 1783 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9aede9ca/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9aede9ca/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------


[2/5] incubator-trafodion git commit: [TRAFODION-2628] Updates for elasticity

Posted by hz...@apache.org.
[TRAFODION-2628] Updates for elasticity

Replaced the list of CPU (node) numbers with an array, since it is
really a mapping array from logical to physical numbers.

Also changed some code in the adaptive segmentation code, but it is
likely that Adaptive Segmentation will not work (with or without my
change), this is not turned on by default and is not tested.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/d17167cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/d17167cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/d17167cc

Branch: refs/heads/master
Commit: d17167ccf05176b1ddc945ae2ed04b54671bfd4a
Parents: 4bea445
Author: Hans Zeller <hz...@apache.org>
Authored: Tue Jul 11 00:00:56 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Tue Jul 11 00:00:56 2017 +0000

----------------------------------------------------------------------
 core/sql/generator/Generator.cpp          | 13 ++++++++-----
 core/sql/optimizer/NAClusterInfo.cpp      | 13 +++++++------
 core/sql/optimizer/NAClusterInfo.h        |  4 ++--
 core/sql/optimizer/NodeMap.cpp            |  8 ++++----
 core/sql/optimizer/OptimizerSimulator.cpp | 16 ++++++++--------
 5 files changed, 29 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d17167cc/core/sql/generator/Generator.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/Generator.cpp b/core/sql/generator/Generator.cpp
index 5e6f18b..0ca0e6f 100644
--- a/core/sql/generator/Generator.cpp
+++ b/core/sql/generator/Generator.cpp
@@ -935,6 +935,9 @@ NABoolean remapESPAllocationViaUserInputs(FragmentDir *fragDir,
 
 // remapESPAllocationAS: Called by RelRoot::codeGen()
 
+// NOTE: This is likely not working at this time! Keep the value
+// of CQD AFFINITY_VALUE at '-2' for now.
+
 // Re-assign each ESP to a CPU for adaptive segmentation based on the
 // affinity value.
 //
@@ -1073,8 +1076,8 @@ Generator::remapESPAllocationAS()
 
     // A list of nodes in this cluster
     //
-    const NAList<CollIndex> &cpuList(gpClusterInfo->getCPUList());
-    Int32 numCPUs = cpuList.entries();
+    const NAArray<CollIndex> &cpuArray(gpClusterInfo->getCPUArray());
+    Int32 numCPUs = cpuArray.entries();
     Int32 numSegs = 1;
 
     CollIndex espsPerNode = 
@@ -1186,7 +1189,7 @@ Generator::remapESPAllocationAS()
 
           for (i = 0; i < (CollIndex)numCPUs; i++) {
 
-            cpus[i] = cpuList[cpu];
+            cpus[i] = cpu;
 
 #ifdef _DEBUG
     if ((CmpCommon::getDefault( NSK_DBG ) == DF_ON) &&
@@ -1202,7 +1205,7 @@ Generator::remapESPAllocationAS()
             //
             if((i % espsPerNode) == (espsPerNode-1))
 	       cpu++;
-            if (cpu >= (cpuList.entries() * espsPerNode)) {
+            if (cpu >= (cpuArray.entries() * espsPerNode)) {
               cpu = 0;
             }
         }
@@ -1350,7 +1353,7 @@ Generator::remapESPAllocationAS()
 
                   // Set the cpu and segment for this node map entry.
                   //
-                  nodeMap->setNodeNumber(j, cpu);
+                  nodeMap->setNodeNumber(j, cpuArray[cpu % numCPUs]);
                 }
 
                 // After remapping the node map (copy), make it the

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d17167cc/core/sql/optimizer/NAClusterInfo.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NAClusterInfo.cpp b/core/sql/optimizer/NAClusterInfo.cpp
index 714916a..4dc0985 100644
--- a/core/sql/optimizer/NAClusterInfo.cpp
+++ b/core/sql/optimizer/NAClusterInfo.cpp
@@ -187,7 +187,7 @@ static ULng32 intHashFunc(const Int32& Int)
 //==============================================================================
 NAClusterInfo::NAClusterInfo(CollHeap * heap)
  : heap_(heap), 
-   cpuList_(heap),
+   cpuArray_(heap),
    inTestMode_(FALSE)
 {
   OptimizerSimulator::osimMode mode = OptimizerSimulator::OFF;
@@ -244,7 +244,8 @@ NAClusterInfo::NAClusterInfo(CollHeap * heap)
         if ((nodeInfo[i].type & MS_Mon_ZoneType_Aggregation) != 0 ||
             ((nodeInfo[i].type & MS_Mon_ZoneType_Storage) != 0 ))
         {
-          cpuList_.insert(nodeInfo[i].nid);
+          cpuArray_.insertAt(cpuArray_.entries(),
+                             nodeInfo[i].nid);
 
           // store nodeName-nodeId pairs
           NAString *key_nodeName = new (heap_) NAString(nodeInfo[i].node_name, heap_);
@@ -279,7 +280,7 @@ NAClusterInfo::NAClusterInfo(CollHeap * heap)
     case OptimizerSimulator::SIMULATE:
 
       nodeIdToNodeNameMap_ = NULL;
-      cpuList_.clear();
+      cpuArray_.clear();
       //load NAClusterInfo from OSIM file
       simulateNAClusterInfo();
       break;
@@ -339,13 +340,13 @@ NABoolean NAClusterInfo::NODE_ID_TO_NAME(Int32 nodeId, char *nodeName, short max
 Int32
 NAClusterInfo::numOfPhysicalSMPs()
 {
-  return cpuList_.entries();
+  return cpuArray_.entries();
 }
 
 Int32
 NAClusterInfo::numOfSMPs()
 {
-  Int32 result = cpuList_.entries();
+  Int32 result = cpuArray_.entries();
 
   // This is temporary patch for PARALLEL_NUM_ESPS issue. This CQD should
   // be used in many places for costing, NodeMap allocation, synthesizing
@@ -374,7 +375,7 @@ NAClusterInfo::numOfSMPs()
 // Returns total number of CPUs (including down CPUs)
 Lng32 NAClusterInfo::getTotalNumberOfCPUs()
 {
-  Lng32 cpuCount = cpuList_.entries();
+  Lng32 cpuCount = cpuArray_.entries();
 
 #ifndef NDEBUG
 // LCOV_EXCL_START

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d17167cc/core/sql/optimizer/NAClusterInfo.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NAClusterInfo.h b/core/sql/optimizer/NAClusterInfo.h
index c62f848..fbcfc66 100644
--- a/core/sql/optimizer/NAClusterInfo.h
+++ b/core/sql/optimizer/NAClusterInfo.h
@@ -108,7 +108,7 @@ public:
 
   // return total number of CPUs (includes all, that is, even down CPUs)
   Lng32 getTotalNumberOfCPUs();
-  const NAList<CollIndex> &getCPUList() { return cpuList_; }
+  const NAArray<CollIndex> &getCPUArray() { return cpuArray_; }
 
   Lng32 mapNodeNameToNodeNum(const NAString &node) const;
   void cleanupPerStatement();
@@ -147,7 +147,7 @@ protected :
   // the middle may be removed, so we end up with "holes" in the
   // node ids.
   // ------------------------------------------------------------------------
-  NAList<CollIndex> cpuList_;
+  NAArray<CollIndex> cpuArray_;
 
   //------------------------------------------------------------------------
   // hashdictionary used to store the mapping of cluster name to cluster id

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d17167cc/core/sql/optimizer/NodeMap.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NodeMap.cpp b/core/sql/optimizer/NodeMap.cpp
index ddd556c..432200f 100644
--- a/core/sql/optimizer/NodeMap.cpp
+++ b/core/sql/optimizer/NodeMap.cpp
@@ -768,8 +768,8 @@ NodeMap::synthesizeLogicalMap(const CollIndex logicalNumEntries,
                                    NodeMapEntry::NOT_ACTIVE, type());
 
   //get a list of the nodes in the cluster
-  const NAList<CollIndex> &cpuList(gpClusterInfo->getCPUList());
-  Int32 cpuCount = cpuList.entries();
+  const NAArray<CollIndex> &cpuArray(gpClusterInfo->getCPUArray());
+  Int32 cpuCount = cpuArray.entries();
   Lng32 affinityDef = ActiveSchemaDB()->getDefaults().getAsLong(AFFINITY_VALUE);
 
   // "float" single ESP
@@ -812,9 +812,9 @@ NodeMap::synthesizeLogicalMap(const CollIndex logicalNumEntries,
         // each ESP in an ESP exchange is active
         logicalMap->setPartitionState(espX, NodeMapEntry::ACTIVE);
         // assign ESP consumers to segments/cpus, round-robin
-        logicalMap->setNodeNumber(espX, cpuList[cpuX]);
+        logicalMap->setNodeNumber(espX, cpuArray[cpuX]);
         cpuX++; // advance to next cpu
-        if (cpuX >= cpuList.entries()) {
+        if (cpuX >= cpuArray.entries()) {
           cpuX = 0;
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d17167cc/core/sql/optimizer/OptimizerSimulator.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/OptimizerSimulator.cpp b/core/sql/optimizer/OptimizerSimulator.cpp
index da2cd3f..39088cf 100644
--- a/core/sql/optimizer/OptimizerSimulator.cpp
+++ b/core/sql/optimizer/OptimizerSimulator.cpp
@@ -1200,10 +1200,10 @@ void NAClusterInfo::captureNAClusterInfo(ofstream & naclfile)
 
   naclfile << "  ";
   naclfile.width(10); naclfile << LOCAL_CLUSTER << "  ";
-  naclfile << cpuList_.entries() << " : ";
-  for (ci=0; ci<cpuList_.entries(); ci++)
+  naclfile << cpuArray_.entries() << " : ";
+  for (ci=0; ci<cpuArray_.entries(); ci++)
     {
-      naclfile.width(3); naclfile << cpuList_[ci] << " ";
+      naclfile.width(3); naclfile << cpuArray_[ci] << " ";
     }
   naclfile << endl;
 
@@ -1232,7 +1232,7 @@ void NAClusterInfo::simulateNAClusterInfo()
 
   const char* filepath = CURRCONTEXT_OPTSIMULATOR->getLogFilePath(OptimizerSimulator::NACLUSTERINFO);
 
-  cpuList_.clear();
+  cpuArray_.clear();
 
   ifstream naclfile(filepath);
 
@@ -1257,7 +1257,7 @@ void NAClusterInfo::simulateNAClusterInfo()
     }
     else if (!strcmp(var, "clusterToCPUMap_"))
     {
-      Int32 numClusters, clusterNum, cpuList_entries, cpuNum;
+      Int32 numClusters, clusterNum, cpuArray_entries, cpuNum;
 
       naclfile >> numClusters; naclfile.ignore(OSIM_LINEMAX, '\n');
       // we don't support multiple clusters at this time
@@ -1269,11 +1269,11 @@ void NAClusterInfo::simulateNAClusterInfo()
         for (i=0; i<numClusters; i++)
         {
           naclfile >> clusterNum;
-          naclfile >> cpuList_entries; naclfile.ignore(OSIM_LINEMAX, ':');
-          for (ci=0; ci<cpuList_entries; ci++)
+          naclfile >> cpuArray_entries; naclfile.ignore(OSIM_LINEMAX, ':');
+          for (ci=0; ci<cpuArray_entries; ci++)
           {
             naclfile >> cpuNum;
-            cpuList_.insert(cpuNum);
+            cpuArray_.insertAt(ci, cpuNum);
           }
           naclfile.ignore(OSIM_LINEMAX, '\n');
         }


[4/5] incubator-trafodion git commit: [TRAFODION-2628] Runtime work for elasticity

Posted by hz...@apache.org.
[TRAFODION-2628] Runtime work for elasticity

Adding a CPU array, similar to what's used in the compiler, to the CLI
globals. Make sure that when the compiler didn't specify a CPU (node)
id for an ESP, don't pick a node id that no longer exists.

Made a similar change for the SSMP.

Also got rid of some dead or now obsolete code.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/8f5fd239
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/8f5fd239
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/8f5fd239

Branch: refs/heads/master
Commit: 8f5fd239f04166c0e59689a1659020b3ab460d6f
Parents: 5605fbb
Author: Hans Zeller <hz...@apache.org>
Authored: Wed Jul 12 22:46:05 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Wed Jul 12 22:46:05 2017 +0000

----------------------------------------------------------------------
 core/sql/cli/Globals.cpp          | 13 ++-------
 core/sql/cli/Globals.h            | 27 ++++++++++++------
 core/sql/common/ComRtUtils.cpp    | 51 +++++++++++++++-------------------
 core/sql/common/ComRtUtils.h      | 28 ++++---------------
 core/sql/executor/ex_frag_rt.cpp  | 23 +++++++++++----
 core/sql/executor/ex_frag_rt.h    |  1 +
 core/sql/runtimestats/ssmpipc.cpp | 20 ++++++-------
 7 files changed, 78 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f5fd239/core/sql/cli/Globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Globals.cpp b/core/sql/cli/Globals.cpp
index 95fb000..f9678ec 100644
--- a/core/sql/cli/Globals.cpp
+++ b/core/sql/cli/Globals.cpp
@@ -187,18 +187,9 @@ void CliGlobals::init( NABoolean espProcess,
 
   ComRtGetProcessPriority(myPriority_);
   savedPriority_ = (short)myPriority_;
-  myNumSegs_ = 0;
-  myNumCpus_ = 0;
-  SEGMENT_INFO * segs = new(&executorMemory_) SEGMENT_INFO[MAX_NO_OF_SEGMENTS];
-  ComRtGetSegsInfo(segs, MAX_NO_OF_SEGMENTS, myNumSegs_,
-           (NAHeap *)&executorMemory_);
-  for (Lng32 i = 0; i < myNumSegs_; i++)
-    {
-      myNumCpus_ += segs[i].noOfCpus_;
-    }
-  NADELETEARRAY(segs, MAX_NO_OF_SEGMENTS, SEGMENT_INFO, &executorMemory_);
+  myNumCpus_ = ComRtGetCPUArray(cpuArray_, (NAHeap *)&executorMemory_);
 
-   // create global structures for IPC environment
+  // create global structures for IPC environment
 #if !(defined(__SSCP) || defined(__SSMP))
 
   // check if Measure is enabled and allocate Measure process counters.

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f5fd239/core/sql/cli/Globals.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Globals.h b/core/sql/cli/Globals.h
index c0dc1b7..d2ad4c7 100644
--- a/core/sql/cli/Globals.h
+++ b/core/sql/cli/Globals.h
@@ -362,11 +362,23 @@ inline
 
   Lng32 myNodeNumber() { return myNodeNumber_; };
   Int64 myStartTime() { return myStartTime_; };
-  // following methods are unused in seaquest
-  //LCOV_EXCL_START
-  Lng32 myNumSegments() { return myNumSegs_; };
+
+  // number of CPUs (Linux nodes) in the cluster
   Lng32 myNumCpus() { return myNumCpus_; };
-  //LCOV_EXCL_STOP
+  // an array of myNumCpus_ node ids, the index into
+  // this array is a "logical" CPU id (0 ... myNumCpus_-1)
+  // and the content of the array is a physical id,
+  // a node id (nid) of a node that actually exists
+  // (but still may be down)
+  const Int32 *myCPUArray() { return cpuArray_; }
+  // return the physical node id for a logical id,
+  // the physical id is always >= the logical id
+  Int32 mapLogicalToPhysicalCPUNum(Int32 ix)
+                          { return cpuArray_[ix % myNumCpus_]; }
+  // are logical/physical node ids the same?
+  NABoolean nodeIdsAreContiguous()
+           { return cpuArray_[myNumCpus_-1] == myNumCpus_ - 1; }
+
   IpcPriority myPriority() { return myPriority_; }
   void setMyPriority(IpcPriority p) { myPriority_= p; }
   //LCOV_EXCL_START
@@ -562,11 +574,10 @@ private:
   pid_t myPin_;
   Lng32  myNodeNumber_;
 
-  // number of segments on this system
-  Lng32 myNumSegs_;
-
-  // number of configured cpus on this system
+  // number of configured cpus (Linux nodes) on this system
+  // and an array with their node ids (nids)
   Lng32 myNumCpus_;
+  Int32 *cpuArray_;
 
   IpcPriority myPriority_;
   NABoolean priorityChanged_;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f5fd239/core/sql/common/ComRtUtils.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/ComRtUtils.cpp b/core/sql/common/ComRtUtils.cpp
index 387c609..e82c23c 100644
--- a/core/sql/common/ComRtUtils.cpp
+++ b/core/sql/common/ComRtUtils.cpp
@@ -812,22 +812,15 @@ char * ComRtGetIsoMappingName()
   return (char*)CharInfo::getCharSetName((CharInfo::CharSet)ime);
 }
 
-
-#ifdef _DEBUG
-#endif 
-
-NABoolean ComRtIsNeoSystem(void)
-{
-   return TRUE;
-}
-
-Lng32 ComRtGetSegsInfo(SEGMENT_INFO *segs, Lng32 maxNoSegs, Lng32 &noOfSegs, 
-				NAHeap *heap)
+Int32 ComRtGetCPUArray(Int32 *&cpuArray, NAHeap *heap)
 {
   Int32 nodeCount = 0;
+  Int32 configuredNodeCount=0;
   Int32 nodeMax = 0;
   MS_Mon_Node_Info_Entry_Type *nodeInfo = NULL;
 
+  cpuArray = NULL;
+
   // Get the number of nodes to know how much info space to allocate
   Int32 error = msg_mon_get_node_info(&nodeCount, 0, NULL);
   if (error != 0)
@@ -836,36 +829,38 @@ Lng32 ComRtGetSegsInfo(SEGMENT_INFO *segs, Lng32 maxNoSegs, Lng32 &noOfSegs,
      return 0;
 
   // Allocate the space for node info entries
-  nodeInfo = new (heap) MS_Mon_Node_Info_Entry_Type[nodeCount];
+  nodeInfo = new(heap) MS_Mon_Node_Info_Entry_Type[nodeCount];
+  cpuArray = new(heap) Int32[nodeCount];
 
-  if (!nodeInfo)
+  if (!nodeInfo || !cpuArray)
      return 0;
   // Get the node info
-  memset(nodeInfo, 0, sizeof(nodeInfo));
+  memset(nodeInfo, 0, sizeof(MS_Mon_Node_Info_Entry_Type) * nodeCount);
   nodeMax = nodeCount;
   error = msg_mon_get_node_info(&nodeCount, nodeMax, nodeInfo);
   if (error != 0)
   { 
      NADELETEBASIC(nodeInfo, heap);
+     NADELETEBASIC(cpuArray, heap);
+     cpuArray = NULL;
      return 0;
   }
-  Int32 i;
-  Int32 j=0;
-  for (i = 0 ; i < nodeCount && j < maxNoSegs ; i++)
+
+  if (nodeCount > nodeMax)
+    // very unlikely, could happen if a node just got added
+    nodeCount = nodeMax;
+
+  for (Int32 i = 0; i < nodeCount; i++)
   {
      if (!nodeInfo[i].spare_node)
-     {
-        segs[j].segName_[0] = '\0';
-        segs[j].segNo_ = nodeInfo[i].nid;
-        segs[j].noOfCpus_ = 1;
-        segs[j].cpuStatus_ = 0x8000;
-        segs[j].nodeDown_ = FALSE;
-        j++;
-     }
+       {
+         cpuArray[configuredNodeCount] = nodeInfo[i].nid;
+         configuredNodeCount++;
+       }
   }
-  noOfSegs = j;
-  NADELETEARRAY(nodeInfo, nodeCount, MS_Mon_Node_Info_Entry_Type, heap);
-  return i;
+
+  NADELETEBASIC(nodeInfo, heap);
+  return configuredNodeCount;
 }
 
 NABoolean ComRtGetCpuStatus(char *nodeName, short cpuNum)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f5fd239/core/sql/common/ComRtUtils.h
----------------------------------------------------------------------
diff --git a/core/sql/common/ComRtUtils.h b/core/sql/common/ComRtUtils.h
index e22a8ab..165b6b4 100644
--- a/core/sql/common/ComRtUtils.h
+++ b/core/sql/common/ComRtUtils.h
@@ -53,7 +53,6 @@ using namespace std;
 #endif // NA_64BIT
 
 #define MAX_SEGMENT_NAME_LEN  255
-#define MAX_NO_OF_SEGMENTS    256
 #define PROCESSNAME_STRING_LEN    40
 #define PROGRAM_NAME_LEN    64
 #define BDR_CLUSTER_NAME_LEN 24
@@ -266,28 +265,13 @@ Lng32 extract_SMDLocation(
 Lng32 validate_SMDLocation(
       char *SMDLocation); /* in */
 
-#ifdef _DEBUG
-// -----------------------------------------------------------------------
-// Print an NT memory map (debug only)
-// -----------------------------------------------------------------------
-#if (MSC_VER >= 1300)
-void ComRtDisplayVirtualMemoryMap(std::ostream* outstream);
-#else
-void ComRtDisplayVirtualMemoryMap(ostream* outstream);
-#endif
-#endif
-NABoolean ComRtIsNeoSystem(void);
+// allocate and populate an array with entries for all the configured
+// CPUs (Trafodion node ids) and return the number of CPUs. Usually,
+// the array will contain node  ids 0 ... n-1, but sometimes there may
+// be holes in the assigned node ids, when CPUs (Linux nodes) get
+// removed from the cluster.
+Int32 ComRtGetCPUArray(Int32 *&cpuArray, NAHeap *heap);
 
-typedef struct SEGMENT_INFO
-{
-  char segName_[MAX_SEGMENT_NAME_LEN+1];
-  Lng32 segNo_;
-  Lng32 noOfCpus_;
-  Lng32 cpuStatus_;
-  NABoolean nodeDown_;
-} SEGMENT_INFO;
-Lng32 ComRtGetSegsInfo(SEGMENT_INFO *segs, Lng32 maxNoSegs, Lng32 &noOfSegs,
-		NAHeap *heap);
 NABoolean ComRtGetCpuStatus(char *nodeName, short cpuNum);
 Lng32 ComRtTransIdToText(Int64 transId, char *buf, short len);
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f5fd239/core/sql/executor/ex_frag_rt.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_frag_rt.cpp b/core/sql/executor/ex_frag_rt.cpp
index 9ea5cf9..f468fd6 100644
--- a/core/sql/executor/ex_frag_rt.cpp
+++ b/core/sql/executor/ex_frag_rt.cpp
@@ -2860,13 +2860,8 @@ ExEspDbEntry *ExEspManager::shareEsp(
   if (*creatingEsp == NULL) // Nowaited Creation of an ESP is not in progress
   {
     nowaitDepth = env_->getCCMaxWaitDepthLow();
-    IpcCpuNum nextCpu = 
-      (lastAssignedCpu_ == (maxCpuNum_ -1)) ? 0 : lastAssignedCpu_ + 1;
-
     if ( cpuNum == IPC_CPU_DONT_CARE )
-      // nextCpu now points to the CPU we should use
-      cpuNum = lastAssignedCpu_ = nextCpu;
-
+      cpuNum = getRoundRobinCPU();
 
     // look up the cache for esp to share
     NABoolean espServerError = FALSE;
@@ -3253,6 +3248,22 @@ ExEspDbEntry *ExEspManager::getEspFromCache(LIST(ExEspDbEntry *) &alreadyAssigne
   return result;
 }
 
+IpcCpuNum ExEspManager::getRoundRobinCPU()
+{
+  IpcCpuNum logCPUNum;
+  CliGlobals *cliGlobals = GetCliGlobals();
+
+  // lastAssignedCpu_ contains a "logical" CPU number (contiguous
+  // values 0 ... n-1). We increment this number by 1 (mod n) for
+  // every call.
+  logCPUNum        =
+  lastAssignedCpu_ = (lastAssignedCpu_ + 1) % cliGlobals->myNumCpus();
+
+  // now map this logical number to an actual node id, in case we have
+  // "holes" in the node ids (nodes were removed dynamically)
+  return cliGlobals->mapLogicalToPhysicalCPUNum(logCPUNum);
+}
+
 void ExEspManager::releaseEsp(ExEspDbEntry *esp, NABoolean verifyEsp,
                  NABoolean prevState)
 {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f5fd239/core/sql/executor/ex_frag_rt.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_frag_rt.h b/core/sql/executor/ex_frag_rt.h
index 362dcc4..9dc6ee5 100644
--- a/core/sql/executor/ex_frag_rt.h
+++ b/core/sql/executor/ex_frag_rt.h
@@ -565,6 +565,7 @@ class ExEspManager
 				  Int32 nowaitDepth,
                                   NABoolean &espServerError,
                                   NABoolean soloFragment);
+  IpcCpuNum getRoundRobinCPU();
 
   // ESP state tracing >>
   enum EspStateEnum

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f5fd239/core/sql/runtimestats/ssmpipc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/runtimestats/ssmpipc.cpp b/core/sql/runtimestats/ssmpipc.cpp
index 1d7b0e5..6c24dbe 100755
--- a/core/sql/runtimestats/ssmpipc.cpp
+++ b/core/sql/runtimestats/ssmpipc.cpp
@@ -288,23 +288,23 @@ SsmpGlobals::~SsmpGlobals()
 
 ULng32 SsmpGlobals::allocateServers()
 {
-  SEGMENT_INFO segInfo[MAX_NO_OF_SEGMENTS];
-  Lng32 noOfSegs = 0;
-  Int32 i, j;
-
   // Attempt connect to all SSCPs
   if (sscpServerClass_ == NULL)
   {
-    noOfSegs = ComRtGetSegsInfo(segInfo, MAX_NO_OF_SEGMENTS, noOfSegs,
-		heap_);
-    if (noOfSegs == 0)
+    Int32 noOfNodes;
+    Int32 *cpuArray = NULL;
+
+    noOfNodes = ComRtGetCPUArray(cpuArray, heap_);
+
+    if (noOfNodes == 0)
       return 0;
-    statsGlobals_->setNodesInCluster(noOfSegs);
+    statsGlobals_->setNodesInCluster(noOfNodes);
     sscpServerClass_ = new(heap_) IpcServerClass(ipcEnv_, IPC_SQLSSCP_SERVER, IPC_USE_PROCESS);
-    for (i = 0 ; i < noOfSegs ; i++)
+    for (Int32 i = 0 ; i < noOfNodes ; i++)
     {
-      allocateServer(NULL, 0, segInfo[i].segNo_);
+      allocateServer(NULL, 0, cpuArray[i]);
     }
+    NADELETEBASIC(cpuArray, heap_);
   }
   else
   {


[3/5] incubator-trafodion git commit: [TRAFODION-2628] Fix for regression test failures compGeneral/TEST001

Posted by hz...@apache.org.
[TRAFODION-2628] Fix for regression test failures compGeneral/TEST001

This test was using an obsolete CQD.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/5605fbbd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/5605fbbd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/5605fbbd

Branch: refs/heads/master
Commit: 5605fbbdbb339182471f12bf7649b8bc69f76b10
Parents: d17167c
Author: Hans Zeller <hz...@apache.org>
Authored: Tue Jul 11 21:55:48 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Tue Jul 11 21:55:48 2017 +0000

----------------------------------------------------------------------
 core/sql/regress/compGeneral/EXPECTED001.SB | 15 ---------------
 core/sql/regress/compGeneral/TEST001        |  9 ---------
 2 files changed, 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5605fbbd/core/sql/regress/compGeneral/EXPECTED001.SB
----------------------------------------------------------------------
diff --git a/core/sql/regress/compGeneral/EXPECTED001.SB b/core/sql/regress/compGeneral/EXPECTED001.SB
index 2fb2c8e..cc2a48c 100644
--- a/core/sql/regress/compGeneral/EXPECTED001.SB
+++ b/core/sql/regress/compGeneral/EXPECTED001.SB
@@ -4807,21 +4807,6 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 --- SQL command prepared.
 >>
 >>--
->>-- test NAClusterInfo::setUseAggregationNodesOnly only
->>--
->>cqd ESP_ON_AGGREGATION_NODES_ONLY 'on';
-
---- SQL operation complete.
->>
->>prepare x from select s.a from s01 s <<+ cardinality 10e7>>, t01 t <<+ cardinality 10e5>> where s.a = t.b;
-
---- SQL command prepared.
->>
->>cqd ESP_ON_AGGREGATION_NODES_ONLY reset;
-
---- SQL operation complete.
->>
->>--
 >>-- test CQD OPTIMIZER_HEURISTIC_3 'on'
 >>--
 >>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5605fbbd/core/sql/regress/compGeneral/TEST001
----------------------------------------------------------------------
diff --git a/core/sql/regress/compGeneral/TEST001 b/core/sql/regress/compGeneral/TEST001
index dfe4efa..d8f33ca 100755
--- a/core/sql/regress/compGeneral/TEST001
+++ b/core/sql/regress/compGeneral/TEST001
@@ -397,15 +397,6 @@ create table s01(a int not null, b int, c int, primary key(a));
 prepare x from select s.a from s01 s, (select t.b from t01 t group by t.b) x(u);
 
 --
--- test NAClusterInfo::setUseAggregationNodesOnly only
---
-cqd ESP_ON_AGGREGATION_NODES_ONLY 'on';
-
-prepare x from select s.a from s01 s <<+ cardinality 10e7>>, t01 t <<+ cardinality 10e5>> where s.a = t.b;
-
-cqd ESP_ON_AGGREGATION_NODES_ONLY reset;
-
---
 -- test CQD OPTIMIZER_HEURISTIC_3 'on'
 --