cloudberry
cloudberry copied to clipboard
[Bug] appendonlyam_handler.c:1790:25: error: ‘segfile_count’ may be used uninitialized
Apache Cloudberry version
main branch commit: 644b4e307380954e986f048d0a7910a3063e524e
What happened
appendonlyam_handler.c: In function ‘appendonly_index_build_range_scan’:
appendonlyam_handler.c:1790:25: error: ‘segfile_count’ may be used uninitialized [-Werror=maybe-uninitialized]
1790 | FreeAllSegFileInfo(seginfo, segfile_count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aocsam_handler.c: In function ‘aoco_index_build_range_scan’:
aocsam_handler.c:1952:25: error: ‘segfile_count’ may be used uninitialized [-Werror=maybe-uninitialized]
1952 | FreeAllAOCSSegFileInfo(seginfo, segfile_count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
What you think should happen instead
No response
How to reproduce
config, make
Operating System
Ubuntu
Anything else
No response
Are you willing to submit PR?
- [ ] Yes, I am willing to submit a PR!
Code of Conduct
- [x] I agree to follow this project's Code of Conduct.
make failed, and something bad may be behind the failure, because segfile_count is not assigned any more. It's assigned before as:
/*
* 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);
}
git blame show that it's changed by https://github.com/apache/cloudberry/pull/897
@reshke @yjhjstz @x4m @my-ship-it @leborchuk
Also if (!FIPS_mode_set)(in contrib/pgcrypto/openssl.c) will got an WError..
pls merge https://github.com/apache/cloudberry/pull/986 asap.
Maybe we should configure CI with more strict compiler flags... LGTM #986
/*
* 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);
}
@reshke this need to check, I will merge quick fix https://github.com/apache/cloudberry/pull/986. issue keep open here. @avamingli
and something bad may be behind the failure, because segfile_count is not assigned any more. It's assigned before as:
/* * 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); }git blame show that it's changed by #897
Could someone please review this?
Upstream does this different way: https://github.com/greenplum-db/gpdb-archive/blob/main/src/backend/access/aocs/aocsam_handler.c#L2335 looks like we need to cherry-pick block directory support and restore this logic https://github.com/greenplum-db/gpdb-archive/blob/main/src/backend/access/aocs/aocsam_handler.c#L2196 i will take another look soon