This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/main by this push:
     new c5428c5700 Open relation SMGR before use
c5428c5700 is described below

commit c5428c57009f48873c30a4382a383556892080ad
Author: reshke <[email protected]>
AuthorDate: Mon Dec 16 08:08:18 2024 +0000

    Open relation SMGR before use
---
 src/backend/access/aocs/aocsam.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/backend/access/aocs/aocsam.c b/src/backend/access/aocs/aocsam.c
index b6f20b4232..0230e0da53 100644
--- a/src/backend/access/aocs/aocsam.c
+++ b/src/backend/access/aocs/aocsam.c
@@ -143,7 +143,6 @@ open_ds_write(Relation rel, DatumStreamWrite **ds, 
TupleDesc relationTupleDesc,
        rnode.node = rel->rd_node;
        rnode.backend = rel->rd_backend;
 
-       RelationOpenSmgr(rel);
 
        /* open datum streams.  It will open segment file underneath */
        for (int i = 0; i < natts; ++i)
@@ -174,6 +173,8 @@ open_ds_write(Relation rel, DatumStreamWrite **ds, 
TupleDesc relationTupleDesc,
                clvl = opts[i]->compresslevel;
                blksz = opts[i]->blocksize;
 
+               RelationOpenSmgr(rel);
+
                ds[i] = create_datumstreamwrite(ct,
                                                                                
clvl,
                                                                                
checksum,
@@ -236,8 +237,6 @@ open_ds_read(Relation rel, DatumStreamRead **ds, TupleDesc 
relationTupleDesc,
        for (AttrNumber attno = 0; attno < relationTupleDesc->natts; attno++)
                ds[attno] = NULL;
 
-       RelationOpenSmgr(rel);
-
        /* And then initialize the data streams for those columns we need */
        for (AttrNumber i = 0; i < num_proj_atts; i++)
        {
@@ -269,6 +268,8 @@ open_ds_read(Relation rel, DatumStreamRead **ds, TupleDesc 
relationTupleDesc,
                                                 attno + 1,
                                                 NameStr(attr->attname));
 
+               RelationOpenSmgr(rel);
+
                ds[attno] = create_datumstreamread(ct,
                                                                                
   clvl,
                                                                                
   checksum,
@@ -1531,8 +1532,6 @@ aocs_fetch_init(Relation relation,
        aocsFetchDesc->datumStreamFetchDesc = (DatumStreamFetchDesc *)
                palloc0(relation->rd_att->natts * sizeof(DatumStreamFetchDesc));
 
-       RelationOpenSmgr(relation);
-
        for (colno = 0; colno < relation->rd_att->natts; colno++)
        {
 
@@ -1564,6 +1563,8 @@ aocs_fetch_init(Relation relation,
 
                        aocsFetchDesc->datumStreamFetchDesc[colno] = 
(DatumStreamFetchDesc)
                                palloc0(sizeof(DatumStreamFetchDescData));
+                       
+                       RelationOpenSmgr(relation);
 
                        aocsFetchDesc->datumStreamFetchDesc[colno]->datumStream 
=
                                create_datumstreamread(ct,
@@ -2046,8 +2047,6 @@ aocs_addcol_init(Relation rel,
 
        iattr = rel->rd_att->natts - num_newcols;
 
-       RelationOpenSmgr(rel);
-
        for (i = 0; i < num_newcols; ++i, ++iattr)
        {
                Form_pg_attribute attr = TupleDescAttr(rel->rd_att, iattr);
@@ -2059,6 +2058,8 @@ aocs_addcol_init(Relation rel,
                ct = opts[iattr]->compresstype;
                clvl = opts[iattr]->compresslevel;
                blksz = opts[iattr]->blocksize;
+               RelationOpenSmgr(rel);
+
                desc->dsw[i] = create_datumstreamwrite(ct, clvl, checksum, 0, 
blksz /* safeFSWriteSize */ ,
                                                                                
           attr, RelationGetRelationName(rel),
                                                                                
           titleBuf.data,


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

Reply via email to