Repository: incubator-hawq Updated Branches: refs/heads/master d17359c0a -> 502a6d234
HAWQ-353. Fix a bug of segment number mismatch in RM when kill a segment Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/502a6d23 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/502a6d23 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/502a6d23 Branch: refs/heads/master Commit: 502a6d2343c18bb379e4693fb6f1d6bf976b5522 Parents: d17359c Author: Wen Lin <[email protected]> Authored: Wed Jan 20 11:03:22 2016 +0800 Committer: Wen Lin <[email protected]> Committed: Wed Jan 20 11:03:22 2016 +0800 ---------------------------------------------------------------------- .../resourcemanager/include/resourcepool.h | 2 - src/backend/resourcemanager/resourcepool.c | 46 ++++++-------------- 2 files changed, 13 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/502a6d23/src/backend/resourcemanager/include/resourcepool.h ---------------------------------------------------------------------- diff --git a/src/backend/resourcemanager/include/resourcepool.h b/src/backend/resourcemanager/include/resourcepool.h index 539735d..12ee5ae 100644 --- a/src/backend/resourcemanager/include/resourcepool.h +++ b/src/backend/resourcemanager/include/resourcepool.h @@ -633,8 +633,6 @@ int getOrderedResourceAllocTreeIndexByRatio(uint32_t ratio, BBST *tree); void setAllSegResourceGRMUnavailable(void); -int getAllSegResourceFTSAvailableNumber(void); - struct RB_GRMContainerStatData { int64_t ContainerID; http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/502a6d23/src/backend/resourcemanager/resourcepool.c ---------------------------------------------------------------------- diff --git a/src/backend/resourcemanager/resourcepool.c b/src/backend/resourcemanager/resourcepool.c index 07bd655..fdc90f5 100644 --- a/src/backend/resourcemanager/resourcepool.c +++ b/src/backend/resourcemanager/resourcepool.c @@ -714,8 +714,9 @@ void add_segment_config_row(int32_t id, } elog(LOG, "Add a new row into segment configuration catalog table," - "registration order:%d, role:%c, status:%c, port:%d, hostname:%s, address:%s", - id, role, status, port, hostname, address); + "registration order:%d, role:%c, status:%c, port:%d, " + "hostname:%s, address:%s, failed_tmpdir_num:%d, failed_tmpdir:%s", + id, role, status, port, hostname, address, failed_tmpdir_num, failed_tmpdir); cleanup: if(sql) @@ -873,14 +874,14 @@ int addHAWQSegWithSegStat(SegStat segstat, bool *capstatchanged) if (segresource->Stat->FTSAvailable == RESOURCE_SEG_STATUS_AVAILABLE) { - /* Add this node into the io bytes workload BBST structure. */ - addSegResourceCombinedWorkloadIndex(segresource); - /* Add this node into the alloc/avail resource ordered indices. */ - addSegResourceAvailIndex(segresource); - addSegResourceAllocIndex(segresource); segcapchanged = true; - *capstatchanged = true; } + /* Add this node into the io bytes workload BBST structure. */ + addSegResourceCombinedWorkloadIndex(segresource); + /* Add this node into the alloc/avail resource ordered indices. */ + addSegResourceAvailIndex(segresource); + addSegResourceAllocIndex(segresource); + *capstatchanged = true; res = FUNC_RETURN_OK; } @@ -1310,25 +1311,6 @@ void setAllSegResourceGRMUnavailable(void) freePAIRRefList(&(PRESPOOL->Segments), &allsegres); } -int getAllSegResourceFTSAvailableNumber(void) -{ - int cnt = 0; - List *allsegres = NULL; - ListCell *cell = NULL; - getAllPAIRRefIntoList(&(PRESPOOL->Segments), &allsegres); - - foreach(cell, allsegres) - { - SegResource segres = (SegResource)(((PAIR)lfirst(cell))->Value); - if (segres->Stat->FTSAvailable == RESOURCE_SEG_STATUS_AVAILABLE) - { - cnt++; - } - } - freePAIRRefList(&(PRESPOOL->Segments), &allsegres); - return cnt; -} - /* * Check index to get host id based on host name string. */ @@ -3908,13 +3890,12 @@ void validateResourcePoolStatus(bool refquemgr) Assert( availtree != NULL ); traverseBBSTMidOrder(availtree, &line); - int availableCnt = getAllSegResourceFTSAvailableNumber(); - if ( line.NodeCount != availableCnt ) + if ( line.NodeCount != PRESPOOL->Segments.NodeCount ) { elog(ERROR, "HAWQ RM Validation. The available resource ordered index " "contains %d nodes, expect %d nodes.", line.NodeCount, - availableCnt); + PRESPOOL->Segments.NodeCount); } SegResource prevres = NULL; @@ -3963,13 +3944,12 @@ void validateResourcePoolStatus(bool refquemgr) Assert( alloctree != NULL ); traverseBBSTMidOrder(alloctree, &line); - int availableCnt = getAllSegResourceFTSAvailableNumber(); - if ( line.NodeCount != availableCnt ) + if ( line.NodeCount != PRESPOOL->Segments.NodeCount ) { elog(ERROR, "HAWQ RM Validation. The allocated resource ordered index " "contains %d nodes, expect %d nodes.", line.NodeCount, - availableCnt); + PRESPOOL->Segments.NodeCount); } SegResource prevres = NULL;
