avamingli commented on code in PR #986:
URL: https://github.com/apache/cloudberry/pull/986#discussion_r1992524442


##########
src/backend/access/aocs/aocsam_handler.c:
##########
@@ -1683,7 +1683,7 @@ aoco_index_build_range_scan(Relation heapRelation,
        ExprContext *econtext;
        Snapshot        snapshot;
        AOCSFileSegInfo **seginfo = NULL;
-       int32 segfile_count;
+       int32 segfile_count = 0;

Review Comment:
   Init it to 0 seems a way to fix warning, but the segfile_count is not 
assigned any more, the later use in func:
   ```c
   FreeAllAOCSSegFileInfo(seginfo, segfile_count);
   ```
   is always 0.
   
   as comments in https://github.com/apache/cloudberry/issues/989
   
   https://github.com/apache/cloudberry/issues/989#issuecomment-2716695457
   We lost the logic: 
   ```c
        /*
         * When Parallel index build,there is no additional operation to update 
the number of tuples
         * that supports this logic. Uniform processing is used here. 
         */ 
        if (progress)
        {
                seginfo = GetAllFileSegInfo(heapRelation, snapshot, 
&segfile_count, NULL);
                for (int seginfo_no = 0; seginfo_no < segfile_count; 
seginfo_no++)
                {
                        total_blockcount += seginfo[seginfo_no]->varblockcount;
                }
                pgstat_progress_update_param(PROGRESS_SCAN_BLOCKS_TOTAL, 
total_blockcount);
        }
   ```
   Is it right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to