[GitHub] incubator-hawq pull request #1187: HAWQ-1408. Fixed crash when alloc not eno...

2017-03-26 Thread liming01
Github user liming01 closed the pull request at:

https://github.com/apache/incubator-hawq/pull/1187


---
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...

2017-03-26 Thread liming01
Github user liming01 commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/1187#discussion_r108081777
  
--- 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 --

Because github default ts=8, which may a lot indentation looks strange. 
However our code convention is to set ts=4.
e.g. When you review code, please append '?ts=4' to web URL as below:
https://github.com/apache/incubator-hawq/pull/1187/files?ts=4


---
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...

2017-03-26 Thread hsyuan
Github user hsyuan commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/1187#discussion_r108066084
  
--- 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 --

Can you give me an example? I don't get it.


---
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...

2017-03-26 Thread liming01
Github user liming01 commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/1187#discussion_r108054787
  
--- 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 --

Please append '?ts=4' to web URL when code review.


---
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...

2017-03-25 Thread hsyuan
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...

2017-03-25 Thread hsyuan
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...

2017-03-25 Thread hsyuan
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.
---


[GitHub] incubator-hawq pull request #1187: HAWQ-1408. Fixed crash when alloc not eno...

2017-03-24 Thread liming01
Github user liming01 commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/1187#discussion_r108029031
  
--- 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{
+   int assigned = false; // candidate_status assigned?
--- End diff --

Sorry for my mistake. 


---
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...

2017-03-24 Thread hsyuan
Github user hsyuan commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/1187#discussion_r108025472
  
--- 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)
+   {
+   //generate new segment_num to make sure that in 
keepHash mode, all segment node has at least one segfile is writable
+   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",
--- End diff --

`cocurrently` typo


---
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...

2017-03-24 Thread hsyuan
Github user hsyuan commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/1187#discussion_r108025409
  
--- 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;
--- End diff --

The space of this chunk of code is messy.
`{}` placement is not consistent, even in a single function.


---
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...

2017-03-24 Thread hsyuan
Github user hsyuan commented on a diff in the pull request:

https://github.com/apache/incubator-hawq/pull/1187#discussion_r108025364
  
--- 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{
+   int assigned = false; // candidate_status assigned?
--- End diff --

Why not bool?


---
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.
---