[GitHub] incubator-hawq pull request #1187: HAWQ-1408. Fixed crash when alloc not eno...
Github user hsyuan commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/1187#discussion_r108030497 --- Diff: src/backend/access/appendonly/appendonlywriter.c --- @@ -1136,26 +1140,22 @@ List *SetSegnoForWrite(List *existing_segnos, Oid relid, int segment_num, /* If the found segfile status are still no enough, * we need to get new ones from the status pool. */ -if (remaining_num > 0) -{ -//generate new segment_num to make sure that in keepHash mode, all segment node has at least one segfile is writable -int newAllocatedNum = remaining_num; -for(int i= 1; i<= newAllocatedNum; i++) -{ -int new_status = AORelGetSegfileStatus(aoentry); -if (new_status == NEXT_END_OF_LIST) -{ -LWLockRelease(AOSegFileLock); -ereport(ERROR, (errmsg("cannot open more than %d append-only table segment files cocurrently", -MaxAORelSegFileStatus))); -} -AOSegfileStatusPool[new_status].segno = ++aoentry->max_seg_no; -AOSegfileStatusPool[new_status].next = aoentry->head_rel_segfile.next; -aoentry->head_rel_segfile.next = new_status; -remaining_num = addCandidateSegno(maxSegno4Segment, segment_num, [new_status], keepHash); -} -Assert(remaining_num==0);//make sure all segno got a candidate -} + while(remaining_num>0) --- End diff -- and here --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-hawq pull request #1187: HAWQ-1408. Fixed crash when alloc not eno...
Github user hsyuan commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/1187#discussion_r108030444 --- Diff: src/backend/access/appendonly/appendonlywriter.c --- @@ -923,30 +923,34 @@ usedByConcurrentTransaction(AOSegfileStatus *segfilestat) */ int addCandidateSegno(AOSegfileStatus **maxSegno4Seg, int segment_num, AOSegfileStatus *candidate_status, bool isKeepHash) -{ +{ + int remaining_num = segment_num; if(isKeepHash){ - int remaining_num = segment_num; int idx = (candidate_status->segno+segment_num-1) % segment_num;// from 1 to segment_num-1, then 0(segment_num) if (NULL==maxSegno4Seg[idx] || maxSegno4Seg[idx]->segno > candidate_status->segno) //using the min seg no firstly. maxSegno4Seg[idx] = candidate_status; for(int i=0; isegno > 0){ -remaining_num--; + remaining_num--; } } - return remaining_num; }else{ + bool assigned = false; // candidate_status assigned? + remaining_num = 0; for(int i=0; i
[GitHub] incubator-hawq pull request #1187: HAWQ-1408. Fixed crash when alloc not eno...
Github user hsyuan commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/1187#discussion_r108030401 --- Diff: src/backend/access/appendonly/appendonlywriter.c --- @@ -923,30 +923,34 @@ usedByConcurrentTransaction(AOSegfileStatus *segfilestat) */ int addCandidateSegno(AOSegfileStatus **maxSegno4Seg, int segment_num, AOSegfileStatus *candidate_status, bool isKeepHash) --- End diff -- The indentation of this function is horrible. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---