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

chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/cbdb-postgres-merge by this 
push:
     new 1404f1a8391 Fix compile errors for storage
1404f1a8391 is described below

commit 1404f1a839161cf0d6cdf818ac4b595e22d98340
Author: Jinbao Chen <[email protected]>
AuthorDate: Sun Oct 5 17:58:59 2025 +0800

    Fix compile errors for storage
---
 src/backend/storage/lmgr/lock.c   | 215 ++------------------------------------
 src/backend/storage/lmgr/lwlock.c |  26 -----
 src/backend/storage/lmgr/proc.c   |  38 +++----
 src/backend/storage/smgr/md.c     |   4 +-
 src/backend/storage/smgr/smgr.c   |   9 +-
 src/backend/storage/sync/sync.c   |  16 +--
 src/include/storage/proc.h        |   2 +-
 src/include/storage/smgr.h        |  14 +--
 8 files changed, 47 insertions(+), 277 deletions(-)

diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 4289c26ea2c..8dbeda3facf 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -1758,35 +1758,25 @@ LockCheckConflicts(LockMethod lockMethodTable,
                for (i = 1; i <= numLockModes; i++)
                {
                        int                             ourHolding = 0;
-                       SHM_QUEUE          *procLocks = &(lock->procLocks);
-                       PROCLOCK           *otherProclock =
-                                       (PROCLOCK *) SHMQueueNext(procLocks, 
procLocks,
-                                                                               
          offsetof(PROCLOCK, lockLink));
-                       /*
-                        * Go through the proclock queue in the lock.  
otherProclock
-                        * may be this process itself.
-                        */
-                       while (otherProclock)
+                       dlist_foreach(proclock_iter, &lock->procLocks)
                        {
-                               PGPROC     *otherProc = 
otherProclock->tag.myProc;
+                               PROCLOCK   *otherproclock =
+                                               dlist_container(PROCLOCK, 
lockLink, proclock_iter.cur);
+                               PGPROC     *otherProc = 
otherproclock->tag.myProc;
 
                                /*
                                 * If processes in my session are holding the 
lock, mask
                                 * it out so that we won't be blocked by them.
                                 */
                                if (otherProc->mppSessionId == mppSessionId &&
-                                       otherProclock->holdMask & LOCKBIT_ON(i))
+                                       otherproclock->holdMask & LOCKBIT_ON(i))
                                        ourHolding++;
-
-                               otherProclock =
-                                       (PROCLOCK *) SHMQueueNext(procLocks,
-                                                                               
          &otherProclock->lockLink,
-                                                                               
          offsetof(PROCLOCK, lockLink));
                        }
-                       /*
-                        * I'll be blocked only if processes outside of the 
session are
-                        * holding conflicting locks.
-                        */
+
+                               /*
+                                * I'll be blocked only if processes outside of 
the session are
+                                * holding conflicting locks.
+                                */
                        if (lock->granted[i] > ourHolding)
                                otherLocks |= LOCKBIT_ON(i);
                }
@@ -3646,191 +3636,6 @@ CheckForSessionAndXactLocks(void)
        hash_destroy(lockhtab);
 }
 
-/*
- * AtPrepare_Locks
- *             Do the preparatory work for a PREPARE: make 2PC state file 
records
- *             for all locks currently held.
- *
- * This marks LOCALLOCK objects on temporary tables, so that we can
- * ignore them while writing the prepare record. Figuring out which
- * tables are temporary requires catalog access, hence we must do this
- * before we start actually preparing.
- *
- * For the most part, we don't need to touch shared memory for this ---
- * all the necessary state information is in the locallock table.
- * Fast-path locks are an exception, however: we move any such locks to
- * the main table before allowing PREPARE TRANSACTION to succeed.
- */
-void
-PrePrepare_Locks(void)
-{
-       HASH_SEQ_STATUS status;
-       LOCALLOCK  *locallock;
-
-       /* First, verify there aren't locks of both xact and session level */
-       CheckForSessionAndXactLocks();
-
-       /* Now do the per-locallock cleanup work */
-       hash_seq_init(&status, LockMethodLocalHash);
-       while ((locallock = (LOCALLOCK *) hash_seq_search(&status)) != NULL)
-       {
-               LOCALLOCKOWNER *lockOwners = locallock->lockOwners;
-               bool            haveSessionLock;
-               bool            haveXactLock;
-               int                     i;
-
-               locallock->istemptable = false;
-
-               /*
-                * Skip locks that would be ignored by AtPrepare_Locks() anyway.
-                *
-                * NOTE: these conditions should be kept in sync with 
AtPrepare_Locks()!
-                */
-
-               /*
-                * Ignore VXID locks.  We don't want those to be held by 
prepared
-                * transactions, since they aren't meaningful after a restart.
-                */
-               if (locallock->tag.lock.locktag_type == 
LOCKTAG_VIRTUALTRANSACTION)
-                       continue;
-
-               /* Ignore it if we don't actually hold the lock */
-               if (locallock->nLocks <= 0)
-                       continue;
-
-               /* Scan to see whether we hold it at session or transaction 
level */
-               haveSessionLock = haveXactLock = false;
-               for (i = locallock->numLockOwners - 1; i >= 0; i--)
-               {
-                       if (lockOwners[i].owner == NULL)
-                               haveSessionLock = true;
-                       else
-                               haveXactLock = true;
-               }
-
-               /* Ignore it if we have only session lock */
-               if (!haveXactLock)
-                       continue;
-
-               /* This can't happen, because we already checked it */
-               if (haveSessionLock)
-                       ereport(ERROR,
-                                       (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                                        errmsg("cannot PREPARE while holding 
both session-level and transaction-level locks on the same object")));
-
-               /* gp-change
-                *
-                * We allow 2PC commit transactions to include temp objects.
-                * After PREPARE we WILL NOT transfer locks on the temp objects
-                * into our 2PC record.  Instead, we will keep them with the 
proc which
-                * will be released at the end of the session.
-                *
-                * There doesn't seem to be any reason not to do this.  Once 
the txn
-                * is prepared, it will be committed or aborted regardless of 
the state
-                * of the temp table.  and quite possibly, the temp table will 
be
-                * destroyed at the end of the session, while the transaction 
will be
-                * committed from another session.
-                */
-               locallock->istemptable = LockTagIsTemp(&locallock->tag.lock);
-       }
-}
-
-/*
- * CheckForSessionAndXactLocks
- *             Check to see if transaction holds both session-level and 
xact-level
- *             locks on the same object; if so, throw an error.
- *
- * If we have both session- and transaction-level locks on the same object,
- * PREPARE TRANSACTION must fail.  This should never happen with regular
- * locks, since we only take those at session level in some special operations
- * like VACUUM.  It's possible to hit this with advisory locks, though.
- *
- * It would be nice if we could keep the session hold and give away the
- * transactional hold to the prepared xact.  However, that would require two
- * PROCLOCK objects, and we cannot be sure that another PROCLOCK will be
- * available when it comes time for PostPrepare_Locks to do the deed.
- * So for now, we error out while we can still do so safely.
- *
- * Since the LOCALLOCK table stores a separate entry for each lockmode,
- * we can't implement this check by examining LOCALLOCK entries in isolation.
- * We must build a transient hashtable that is indexed by locktag only.
- */
-static void
-CheckForSessionAndXactLocks(void)
-{
-       typedef struct
-       {
-               LOCKTAG         lock;           /* identifies the lockable 
object */
-               bool            sessLock;       /* is any lockmode held at 
session level? */
-               bool            xactLock;       /* is any lockmode held at xact 
level? */
-       } PerLockTagEntry;
-
-       HASHCTL         hash_ctl;
-       HTAB       *lockhtab;
-       HASH_SEQ_STATUS status;
-       LOCALLOCK  *locallock;
-
-       /* Create a local hash table keyed by LOCKTAG only */
-       hash_ctl.keysize = sizeof(LOCKTAG);
-       hash_ctl.entrysize = sizeof(PerLockTagEntry);
-       hash_ctl.hcxt = CurrentMemoryContext;
-
-       lockhtab = hash_create("CheckForSessionAndXactLocks table",
-                                                  256, /* arbitrary initial 
size */
-                                                  &hash_ctl,
-                                                  HASH_ELEM | HASH_BLOBS | 
HASH_CONTEXT);
-
-       /* Scan local lock table to find entries for each LOCKTAG */
-       hash_seq_init(&status, LockMethodLocalHash);
-
-       while ((locallock = (LOCALLOCK *) hash_seq_search(&status)) != NULL)
-       {
-               LOCALLOCKOWNER *lockOwners = locallock->lockOwners;
-               PerLockTagEntry *hentry;
-               bool            found;
-               int                     i;
-
-               /*
-                * Ignore VXID locks.  We don't want those to be held by 
prepared
-                * transactions, since they aren't meaningful after a restart.
-                */
-               if (locallock->tag.lock.locktag_type == 
LOCKTAG_VIRTUALTRANSACTION)
-                       continue;
-
-               /* Ignore it if we don't actually hold the lock */
-               if (locallock->nLocks <= 0)
-                       continue;
-
-               /* Otherwise, find or make an entry in lockhtab */
-               hentry = (PerLockTagEntry *) hash_search(lockhtab,
-                                                                               
                 (void *) &locallock->tag.lock,
-                                                                               
                 HASH_ENTER, &found);
-               if (!found)                             /* initialize, if newly 
created */
-                       hentry->sessLock = hentry->xactLock = false;
-
-               /* Scan to see if we hold lock at session or xact level or both 
*/
-               for (i = locallock->numLockOwners - 1; i >= 0; i--)
-               {
-                       if (lockOwners[i].owner == NULL)
-                               hentry->sessLock = true;
-                       else
-                               hentry->xactLock = true;
-               }
-
-               /*
-                * We can throw error immediately when we see both types of 
locks; no
-                * need to wait around to see if there are more violations.
-                */
-               if (hentry->sessLock && hentry->xactLock)
-                       ereport(ERROR,
-                                       (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                                        errmsg("cannot PREPARE while holding 
both session-level and transaction-level locks on the same object")));
-       }
-
-       /* Success, so clean up */
-       hash_destroy(lockhtab);
-}
-
 /*
  * AtPrepare_Locks
  *             Do the preparatory work for a PREPARE: make 2PC state file 
records
diff --git a/src/backend/storage/lmgr/lwlock.c 
b/src/backend/storage/lmgr/lwlock.c
index 0d62380f3df..46b211dd37a 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -1956,32 +1956,6 @@ LWLockAnyHeldByMe(LWLock *lock, int nlocks, size_t 
stride)
        return false;
 }
 
-/*
- * LWLockHeldByMe - test whether my process holds any of an array of locks
- *
- * This is meant as debug support only.
- */
-bool
-LWLockAnyHeldByMe(LWLock *l, int nlocks, size_t stride)
-{
-       char       *held_lock_addr;
-       char       *begin;
-       char       *end;
-       int                     i;
-
-       begin = (char *) l;
-       end = begin + nlocks * stride;
-       for (i = 0; i < num_held_lwlocks; i++)
-       {
-               held_lock_addr = (char *) held_lwlocks[i].lock;
-               if (held_lock_addr >= begin &&
-                       held_lock_addr < end &&
-                       (held_lock_addr - begin) % stride == 0)
-                       return true;
-       }
-       return false;
-}
-
 /*
  * LWLockHeldByMeInMode - test whether my process holds a lock in given mode
  *
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index e44182bc71f..4aac5b7547d 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -200,7 +200,7 @@ InitProcGlobal(void)
         * Initialize the data structures.
         */
        ProcGlobal->spins_per_delay = DEFAULT_SPINS_PER_DELAY;
-       ProcGlobal->lmFreeProcs = NULL;
+       dlist_init(&ProcGlobal->lmFreeProcs);
        dlist_init(&ProcGlobal->freeProcs);
        dlist_init(&ProcGlobal->autovacFreeProcs);
        dlist_init(&ProcGlobal->bgworkerFreeProcs);
@@ -292,8 +292,7 @@ InitProcGlobal(void)
                else if (i < MaxConnections + autovacuum_max_workers + 1 + 
login_monitor_max_processes)
                {
                        /* PGPROC for login monitor, add to lmFreeProcs list */
-                       procs[i].links.next = (SHM_QUEUE *) 
ProcGlobal->lmFreeProcs;
-                       ProcGlobal->lmFreeProcs = &procs[i];
+                       dlist_push_head(&ProcGlobal->lmFreeProcs, &proc->links);
                        procs[i].procgloballist = &ProcGlobal->lmFreeProcs;
                }
                else if (i < MaxConnections + autovacuum_max_workers + 1 + 
login_monitor_max_processes + max_worker_processes)
@@ -2126,18 +2125,16 @@ ResProcSleep(LOCKMODE lockmode, LOCALLOCK *locallock, 
void *incrementSet)
 {
        LOCK       *lock = locallock->lock;
        PROCLOCK   *proclock = locallock->proclock;
-       PROC_QUEUE      *waitQueue = &(lock->waitProcs);
+       dclist_head     *waitQueue = &(lock->waitProcs);
        int                     myWaitStatus;
-       PGPROC          *proc;
        uint32          hashcode = locallock->hashcode;
        LWLockId        partitionLock = LockHashPartitionLock(hashcode);
+       dlist_iter      proclock_iter;
 
        /*
         * Don't check my held locks, as we just add at the end of the queue.
         */
-       proc = (PGPROC *) &(waitQueue->links);
-       SHMQueueInsertBefore(&(proc->links), &(MyProc->links));
-       waitQueue->size++;
+       dclist_push_tail(waitQueue, &(MyProc->links));
 
        lock->waitMask |= LOCKBIT_ON(lockmode);
 
@@ -2214,8 +2211,7 @@ ResProcSleep(LOCKMODE lockmode, LOCALLOCK *locallock, 
void *incrementSet)
                        long            secs;
                        int                     usecs;
                        long            msecs;
-                       SHM_QUEUE       *procLocks;
-                       PROCLOCK        *proclock;
+                       dlist_head      *procLocks;
                        bool            first_holder = true,
                                                first_waiter = true;
                        int                     lockHoldersNum = 0;
@@ -2244,43 +2240,39 @@ ResProcSleep(LOCKMODE lockmode, LOCALLOCK *locallock, 
void *incrementSet)
                        LWLockAcquire(partitionLock, LW_SHARED);
 
                        procLocks = &(lock->procLocks);
-                       proclock = (PROCLOCK *) SHMQueueNext(procLocks, 
procLocks,
-                                                                               
                 offsetof(PROCLOCK, lockLink));
-
-                       while (proclock)
+                       dlist_foreach(proclock_iter, procLocks)
                        {
+                               PROCLOCK   *cur_proclock = 
dlist_container(PROCLOCK, lockLink, proclock_iter.cur);
+
                                /*
-                                * we are a waiter if myProc->waitProcLock == 
proclock; we are
+                                * we are a waiter if myProc->waitProcLock == 
cur_proclock; we are
                                 * a holder if it is NULL or something different
                                 */
-                               if (proclock->tag.myProc->waitProcLock == 
proclock)
+                               if (cur_proclock->tag.myProc->waitProcLock == 
cur_proclock)
                                {
                                        if (first_waiter)
                                        {
                                                
appendStringInfo(&lock_waiters_sbuf, "%d",
-                                                                       
proclock->tag.myProc->pid);
+                                                                               
 cur_proclock->tag.myProc->pid);
                                                first_waiter = false;
                                        }
                                        else
                                                
appendStringInfo(&lock_waiters_sbuf, ", %d",
-                                                                               
 proclock->tag.myProc->pid);
+                                                                               
 cur_proclock->tag.myProc->pid);
                                }
                                else
                                {
                                        if (first_holder)
                                        {
                                                
appendStringInfo(&lock_holders_sbuf, "%d",
-                                                                               
 proclock->tag.myProc->pid);
+                                                                               
 cur_proclock->tag.myProc->pid);
                                                first_holder = false;
                                        }
                                        else
                                                
appendStringInfo(&lock_holders_sbuf, ", %d",
-                                                                               
 proclock->tag.myProc->pid);
+                                                                               
 cur_proclock->tag.myProc->pid);
                                        lockHoldersNum++;
                                }
-
-                               proclock = (PROCLOCK *) SHMQueueNext(procLocks, 
&proclock->lockLink,
-                                                                               
                offsetof(PROCLOCK, lockLink));
                        }
 
                        LWLockRelease(partitionLock);
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 736447a8af9..6df0dc63779 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -1328,7 +1328,7 @@ ForgetDatabaseSyncRequests(Oid dbid)
         * is part of the key that is used to determine equivalence among two
         * pending entries.
         */
-       INIT_FILETAG(tag, rnode, InvalidForkNumber, InvalidBlockNumber, 
SYNC_HANDLER_AO);
+       INIT_FILETAG(tag, rlocator, InvalidForkNumber, InvalidBlockNumber, 
SYNC_HANDLER_AO);
 
        RegisterSyncRequest(&tag, SYNC_FILTER_REQUEST, true /* retryOnError */ 
);
 }
@@ -1700,7 +1700,7 @@ mdsyncfiletag(const FileTag *ftag, char *path)
 int
 aosyncfiletag(const FileTag *ftag, char *path)
 {
-       SMgrRelation reln = smgropen(ftag->rnode, InvalidBackendId, 1, NULL);
+       SMgrRelation reln = smgropen(ftag->rlocator, InvalidBackendId, 1, NULL);
        char       *p;
        int                     result,
                                save_errno;
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c
index 5add6e4c6f7..091f8ce3d19 100644
--- a/src/backend/storage/smgr/smgr.c
+++ b/src/backend/storage/smgr/smgr.c
@@ -39,7 +39,7 @@
 #include "utils/faultinjector.h"
 #include "utils/hsearch.h"
 #include "utils/inval.h"
-#include "utils/relfilenodemap.h"
+#include "utils/relfilenumbermap.h"
 
 /*
  * Hook for plugins to collect statistics from storage functions
@@ -520,7 +520,7 @@ smgrcreate(SMgrRelation reln, ForkNumber forknum, bool 
isRedo)
        (*reln->smgr).smgr_create(reln, forknum, isRedo);
 
        if (file_create_hook)
-               (*file_create_hook)(reln->smgr_rnode);
+               (*file_create_hook)(reln->smgr_rlocator);
 }
 
 /*
@@ -606,7 +606,6 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo)
        for (i = 0; i < nrels; i++)
        {
                RelFileLocatorBackend rlocator = rels[i]->smgr_rlocator;
-               int                     which = rels[i]->smgr_which;
 
                rlocators[i] = rlocator;
 
@@ -675,7 +674,7 @@ smgrextend(SMgrRelation reln, ForkNumber forknum, 
BlockNumber blocknum,
                reln->smgr_cached_nblocks[forknum] = InvalidBlockNumber;
 
        if (file_extend_hook)
-               (*file_extend_hook)(reln->smgr_rnode);
+               (*file_extend_hook)(reln->smgr_rlocator);
 }
 
 /*
@@ -873,7 +872,7 @@ smgrtruncate2(SMgrRelation reln, ForkNumber *forknum, int 
nforks,
                /* Make the cached size is invalid if we encounter an error. */
                reln->smgr_cached_nblocks[forknum[i]] = InvalidBlockNumber;
 
-               (*reln->smgr).smgr_truncate(reln, forknum[i], nblocks[i]);
+               (*reln->smgr).smgr_truncate(reln, forknum[i], *old_nblocks, 
nblocks[i]);
 
                /*
                 * We might as well update the local smgr_cached_nblocks 
values. The
diff --git a/src/backend/storage/sync/sync.c b/src/backend/storage/sync/sync.c
index 69777cce3e1..4cff53aae92 100644
--- a/src/backend/storage/sync/sync.c
+++ b/src/backend/storage/sync/sync.c
@@ -394,12 +394,12 @@ ProcessSyncRequests(void)
                        {
                                if (entry->tag.segno == 0)
                                        elog(LOG, "checkpoint performing fsync 
for %d/%d/%u",
-                                                entry->tag.rnode.spcNode, 
entry->tag.rnode.dbNode,
-                                                entry->tag.rnode.relNode);
+                                                entry->tag.rlocator.spcOid, 
entry->tag.rlocator.dbOid,
+                                                entry->tag.rlocator.relNumber);
                                else
                                        elog(LOG, "checkpoint performing fsync 
for %d/%d/%u.%d",
-                                                entry->tag.rnode.spcNode, 
entry->tag.rnode.dbNode,
-                                                entry->tag.rnode.relNode, 
entry->tag.segno);
+                                                entry->tag.rlocator.spcOid, 
entry->tag.rlocator.dbOid,
+                                                entry->tag.rlocator.relNumber, 
entry->tag.segno);
                        }
                        else
                        {
@@ -407,13 +407,13 @@ ProcessSyncRequests(void)
                                if (entry->tag.segno == 0)
                                        elog(level, "non checkpoint process 
trying to fsync "
                                                 "%d/%d/%u when fsync_counter 
fault is set",
-                                                entry->tag.rnode.spcNode, 
entry->tag.rnode.dbNode,
-                                                entry->tag.rnode.relNode);
+                                                entry->tag.rlocator.spcOid, 
entry->tag.rlocator.dbOid,
+                                                entry->tag.rlocator.relNumber);
                                else
                                        elog(level, "non checkpoint process 
trying to fsync "
                                                 "%d/%d/%u.%d when 
fsync_counter fault is set",
-                                                entry->tag.rnode.spcNode, 
entry->tag.rnode.dbNode,
-                                                entry->tag.rnode.relNode, 
entry->tag.segno);
+                                                entry->tag.rlocator.spcOid, 
entry->tag.rlocator.dbOid,
+                                                entry->tag.rlocator.relNumber, 
entry->tag.segno);
                        }
                }
 #endif
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index ac8f99c0592..2aaa70777bc 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -467,7 +467,7 @@ typedef struct PROC_HDR
        /* Head of list of autovacuum's free PGPROC structures */
        dlist_head      autovacFreeProcs;
        /* Head of list of login monitor free PGPROC structures */
-       PGPROC     *lmFreeProcs;
+       dlist_head  lmFreeProcs;
        /* Head of list of bgworker free PGPROC structures */
        dlist_head      bgworkerFreeProcs;
        /* Head of list of walsender free PGPROC structures */
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index d15304682a8..06497c67007 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -137,23 +137,23 @@ typedef struct f_smgr
        void            (*smgr_create) (SMgrRelation reln, ForkNumber forknum,
                                                                bool isRedo);
        bool            (*smgr_exists) (SMgrRelation reln, ForkNumber forknum);
-       void            (*smgr_unlink) (RelFileNodeBackend rnode, ForkNumber 
forknum,
+       void            (*smgr_unlink) (RelFileLocatorBackend rlocator, 
ForkNumber forknum,
                                                                bool isRedo);
        void            (*smgr_extend) (SMgrRelation reln, ForkNumber forknum,
-                                                               BlockNumber 
blocknum, char *buffer, bool skipFsync);
+                                                               BlockNumber 
blocknum, const void *buffer, bool skipFsync);
        void            (*smgr_zeroextend) (SMgrRelation reln, ForkNumber 
forknum,
                                                                        
BlockNumber blocknum, int nblocks, bool skipFsync);
        bool            (*smgr_prefetch) (SMgrRelation reln, ForkNumber forknum,
                                                                  BlockNumber 
blocknum);
        void            (*smgr_read) (SMgrRelation reln, ForkNumber forknum,
-                                                         BlockNumber blocknum, 
char *buffer);
+                                                         BlockNumber blocknum, 
void *buffer);
        void            (*smgr_write) (SMgrRelation reln, ForkNumber forknum,
-                                                          BlockNumber 
blocknum, char *buffer, bool skipFsync);
+                                                          BlockNumber 
blocknum, const void *buffer, bool skipFsync);
        void            (*smgr_writeback) (SMgrRelation reln, ForkNumber 
forknum,
                                                                   BlockNumber 
blocknum, BlockNumber nblocks);
        BlockNumber (*smgr_nblocks) (SMgrRelation reln, ForkNumber forknum);
        void            (*smgr_truncate) (SMgrRelation reln, ForkNumber forknum,
-                                                                 BlockNumber 
nblocks);
+                                                                 BlockNumber 
old_blocks, BlockNumber nblocks);
        void            (*smgr_immedsync) (SMgrRelation reln, ForkNumber 
forknum);
 } f_smgr;
 
@@ -163,8 +163,8 @@ typedef struct f_smgr_ao {
        int                             (*smgr_FileTruncate) (File file, int64 
offset, uint32 wait_event_info);
        File                    (*smgr_AORelOpenSegFile) (Oid reloid, const 
char *filePath, int fileFlags);
        File                    (*smgr_AORelOpenSegFileXlog) (RelFileLocator 
node, int32 segmentFileNum, int fileFlags);
-       int                             (*smgr_FileWrite) (File file, char 
*buffer, int amount, off_t offset, uint32 wait_event_info);
-       int                             (*smgr_FileRead) (File file, char 
*buffer, int amount, off_t offset, uint32 wait_event_info);
+       int                             (*smgr_FileWrite) (File file, const 
void *buffer, size_t amount, off_t offset, uint32 wait_event_info);
+       int                             (*smgr_FileRead) (File file, void 
*buffer, size_t amount, off_t offset, uint32 wait_event_info);
        off_t                   (*smgr_FileSize) (File file);
        int                             (*smgr_FileSync) (File file, uint32 
wait_event_info);
 } f_smgr_ao;


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

Reply via email to