This is an automated email from the ASF dual-hosted git repository. yjhjstz pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 765c9ed7ebac77d8949be78f106570c4bf76e85b Author: yjhjstz <[email protected]> AuthorDate: Thu Dec 26 09:18:12 2024 +0800 Fix: Ensure Smgr Relation is Opened Before Accessing AO Segment Files This commit adds calls to `RelationOpenSmgr()` in `open_all_datumstreamread_segfiles()` and `openFetchSegmentFile()` to ensure that the storage manager (Smgr) relation is opened before accessing Append-Optimized (AO) segment files. Without explicitly opening the Smgr relation, accessing `rel->rd_smgr->smgr_ao` could lead to undefined behavior or errors when the Smgr is not initialized. This change ensures stability and correctness when working with AO segment files. --- src/backend/access/aocs/aocsam.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/access/aocs/aocsam.c b/src/backend/access/aocs/aocsam.c index 1f115295fb..4b9741bf51 100644 --- a/src/backend/access/aocs/aocsam.c +++ b/src/backend/access/aocs/aocsam.c @@ -120,6 +120,7 @@ open_all_datumstreamread_segfiles(AOCSScanDesc scan, AOCSFileSegInfo *segInfo) { AttrNumber attno = proj_atts[i]; + RelationOpenSmgr(rel); open_datumstreamread_segfile(basepath, rel->rd_smgr->smgr_ao, rel->rd_node, segInfo, ds[attno], attno); datumstreamread_block(ds[attno], blockDirectory, attno); @@ -1419,6 +1420,7 @@ openFetchSegmentFile(AOCSFetchDesc aocsFetchDesc, if (logicalEof == 0) return false; + RelationOpenSmgr(aocsFetchDesc->relation); open_datumstreamread_segfile(aocsFetchDesc->basepath, aocsFetchDesc->relation->rd_smgr->smgr_ao, aocsFetchDesc->relation->rd_node, fsInfo, datumStreamFetchDesc->datumStream, --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
