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 6203bdc7a96 Fix compile errors for storage
6203bdc7a96 is described below
commit 6203bdc7a964b7207a4d792bf2c93be4ccf09110
Author: Jinbao Chen <[email protected]>
AuthorDate: Sat Oct 4 23:33:45 2025 +0800
Fix compile errors for storage
---
src/backend/storage/buffer/bufmgr.c | 36 +++++++++++++++++----------------
src/backend/storage/buffer/localbuf.c | 8 +-------
src/backend/storage/file/buffile.c | 7 +++----
src/backend/storage/ipc/latch.c | 3 ---
src/backend/storage/ipc/procarray.c | 38 ++---------------------------------
src/backend/storage/ipc/sinval.c | 2 --
src/include/storage/procarray.h | 2 +-
7 files changed, 26 insertions(+), 70 deletions(-)
diff --git a/src/backend/storage/buffer/bufmgr.c
b/src/backend/storage/buffer/bufmgr.c
index bf4a0cdfbc3..c760b396e9b 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -539,7 +539,7 @@ static inline void BufferMProtect(volatile BufferDesc
*bufHdr, int protectionLev
}
#endif
-static inline void ReleaseContentLock(volatile BufferDesc *buf)
+static inline void ReleaseContentLock(BufferDesc *buf)
{
LWLockRelease(BufferDescriptorGetContentLock(buf));
@@ -551,7 +551,7 @@ static inline void ReleaseContentLock(volatile BufferDesc
*buf)
}
-static inline void AcquireContentLock(volatile BufferDesc *buf, LWLockMode
mode)
+static inline void AcquireContentLock(BufferDesc *buf, LWLockMode mode)
{
#ifdef MPROTECT_BUFFERS
const bool newAcquisition =
@@ -567,7 +567,7 @@ static inline void AcquireContentLock(volatile BufferDesc
*buf, LWLockMode mode)
#endif
}
-static inline bool ConditionalAcquireContentLock(volatile BufferDesc *buf,
+static inline bool ConditionalAcquireContentLock(BufferDesc *buf,
LWLockMode mode)
{
#ifdef MPROTECT_BUFFERS
@@ -1085,7 +1085,6 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence,
ForkNumber forkNum,
bool found;
IOContext io_context;
IOObject io_object;
- bool isExtend;
if (ReadBuffer_hook)
{
@@ -1230,7 +1229,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence,
ForkNumber forkNum,
IOOP_READ,
io_start, 1);
/* check for garbage data */
- if (!PageIsVerifiedExtended((Page) bufBlock, blockNum,
+ if (!PageIsVerifiedExtended((Page) bufBlock, forkNum, blockNum,
PIV_LOG_WARNING | PIV_REPORT_STAT))
{
if (mode == RBM_ZERO_ON_ERROR || zero_damaged_pages)
@@ -4230,9 +4229,6 @@ FlushRelationBuffers(Relation rel)
int i;
BufferDesc *bufHdr;
- /* Open rel at the smgr level if not already done */
- RelationOpenSmgr(rel);
-
if (!RelationUsesBufferManager(rel))
return;
@@ -4456,7 +4452,7 @@ RelationCopyStorageUsingBuffer(RelFileLocator srclocator,
use_wal = XLogIsNeeded() && (permanent || forkNum == INIT_FORKNUM);
/* Get number of blocks in the source relation. */
- nblocks = smgrnblocks(smgropen(srclocator, InvalidBackendId),
+ nblocks = smgrnblocks(smgropen(srclocator, InvalidBackendId, SMGR_MD,
NULL),
forkNum);
/* Nothing to copy; just return. */
@@ -4468,7 +4464,7 @@ RelationCopyStorageUsingBuffer(RelFileLocator srclocator,
* relation before starting to copy block by block.
*/
memset(buf.data, 0, BLCKSZ);
- smgrextend(smgropen(dstlocator, InvalidBackendId), forkNum, nblocks - 1,
+ smgrextend(smgropen(dstlocator, InvalidBackendId, SMGR_MD, NULL),
forkNum, nblocks - 1,
buf.data, true);
/* This is a bulk operation, so use buffer access strategies. */
@@ -4540,7 +4536,7 @@ CreateAndCopyRelationData(RelFileLocator src_rlocator,
* directory. Therefore, each individual relation doesn't need to be
* registered for cleanup.
*/
- RelationCreateStorage(dst_rlocator, relpersistence, false);
+ RelationCreateStorage(dst_rlocator, relpersistence, false, SMGR_MD,
NULL);
/* copy main fork. */
RelationCopyStorageUsingBuffer(src_rlocator, dst_rlocator, MAIN_FORKNUM,
@@ -4550,16 +4546,16 @@ CreateAndCopyRelationData(RelFileLocator src_rlocator,
for (ForkNumber forkNum = MAIN_FORKNUM + 1;
forkNum <= MAX_FORKNUM; forkNum++)
{
- if (smgrexists(smgropen(src_rlocator, InvalidBackendId),
forkNum))
+ if (smgrexists(smgropen(src_rlocator, InvalidBackendId,
SMGR_MD, NULL), forkNum))
{
- smgrcreate(smgropen(dst_rlocator, InvalidBackendId),
forkNum, false);
+ smgrcreate(smgropen(dst_rlocator, InvalidBackendId,
SMGR_MD, NULL), forkNum, false);
/*
* WAL log creation if the relation is persistent, or
this is the
* init fork of an unlogged relation.
*/
if (permanent || forkNum == INIT_FORKNUM)
- log_smgrcreate(&dst_rlocator, forkNum);
+ log_smgrcreate(&dst_rlocator, forkNum, SMGR_MD);
/* Copy a fork's data, block by block. */
RelationCopyStorageUsingBuffer(src_rlocator,
dst_rlocator, forkNum,
@@ -4772,6 +4768,12 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
*/
if (XLogHintBitIsNeeded())
{
+ RelFileLocator locator;
+
+ locator.spcOid = bufHdr->tag.spcOid;
+ locator.dbOid = bufHdr->tag.dbOid;
+ locator.relNumber = bufHdr->tag.relNumber;
+
/*
* If we must not write WAL, due to a
relfilelocator-specific
* condition or being in recovery, don't dirty the
page. We can
@@ -4782,7 +4784,7 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
*/
if (RecoveryInProgress() ||
IsInitProcessingMode() ||
- (RelFileNodeSkippingWAL(bufHdr->tag.rnode) &&
+ (RelFileLocatorSkippingWAL(locator) &&
!FileEncryptionEnabled))
return;
@@ -4792,7 +4794,7 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
* have full page images generated.
*/
if (pg_atomic_read_u32(&bufHdr->state) & BM_PERMANENT &&
- !RelFileNodeSkippingWAL(bufHdr->tag.rnode))
+ !RelFileLocatorSkippingWAL(locator))
{
/*
* If the block is already dirty because we
either made a change
@@ -4861,7 +4863,7 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
*/
/* XXX Do we need the checkpoint delay here? */
MyProc->delayChkptFlags |= DELAY_CHKPT_START;
- delayChkpt = true;
+
/*
* XXX We probably don't need to replay this
WAL on the primary
* since the full page image is restored, but
do we have
diff --git a/src/backend/storage/buffer/localbuf.c
b/src/backend/storage/buffer/localbuf.c
index 37e706a72e1..4bd570ba208 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -205,12 +205,6 @@ GetLocalVictimBuffer(void)
if (LocalRefCount[victim_bufid] == 0)
{
- if (-b - 1 == non_evited_buffer)
- {
- /* Prevent eviction of the buffer with needed page */
- continue;
- }
-
buf_state = pg_atomic_read_u32(&bufHdr->state);
if (BUF_STATE_GET_USAGECOUNT(buf_state) > 0)
@@ -252,7 +246,7 @@ GetLocalVictimBuffer(void)
Page localpage = (char *)
LocalBufHdrGetBlock(bufHdr);
/* Find smgr relation for buffer */
- oreln = smgropen(BufTagGetRelFileLocator(&bufHdr->tag),
MyBackendId);
+ oreln = smgropen(BufTagGetRelFileLocator(&bufHdr->tag),
MyBackendId, SMGR_MD, NULL);
/*
* Technically BM_PERMANENT could indicate an init fork, but
that's
diff --git a/src/backend/storage/file/buffile.c
b/src/backend/storage/file/buffile.c
index 290f2284cb6..9861b8f4e6f 100644
--- a/src/backend/storage/file/buffile.c
+++ b/src/backend/storage/file/buffile.c
@@ -485,8 +485,8 @@ BufFileOpenSharedV2(SharedFileSet *fileset, const char
*name, int mode)
files = repalloc(files, sizeof(File) * capacity);
}
/* Try to load a segment. */
- SharedSegmentName(segment_name, name, nfiles);
- files[nfiles] = SharedFileSetOpen(fileset, segment_name, mode);
+ FileSetSegmentName(segment_name, name, nfiles);
+ files[nfiles] = FileSetOpen(&fileset->fs, segment_name, mode);
if (files[nfiles] <= 0)
break;
++nfiles;
@@ -508,7 +508,7 @@ BufFileOpenSharedV2(SharedFileSet *fileset, const char
*name, int mode)
file = makeBufFileCommon(nfiles);
file->files = files;
file->readOnly = (mode == O_RDONLY) ? true : false;
- file->fileset = fileset;
+ file->fileset = &fileset->fs;
file->name = pstrdup(name);
return file;
@@ -897,7 +897,6 @@ size_t
BufFileReadMaybeEOF(BufFile *file, void *ptr, size_t size, bool eofOK)
{
return BufFileReadCommon(file, ptr, size, true, eofOK);
->>>>>>> REL_16_9
}
/*
diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c
index 00bd3b09e40..061f91b888e 100644
--- a/src/backend/storage/ipc/latch.c
+++ b/src/backend/storage/ipc/latch.c
@@ -1644,9 +1644,6 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout,
if (cur_event->events == WL_LATCH_SET &&
cur_epoll_event->events & (EPOLLIN | EPOLLERR |
EPOLLHUP))
{
- /* Drain the signalfd. */
- drain();
-
if (set->latch && set->latch->maybe_sleeping &&
set->latch->is_set)
{
occurred_events->fd = PGINVALID_SOCKET;
diff --git a/src/backend/storage/ipc/procarray.c
b/src/backend/storage/ipc/procarray.c
index 06e37a44781..8418809782d 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -361,8 +361,6 @@ static void DisplayXidCache(void);
#define xc_slow_answer_inc() ((void) 0)
#endif /* XIDCACHE_DEBUG */
-static VirtualTransactionId *GetVirtualXIDsDelayingChkptGuts(int *nvxids,
-
int type);
static bool HaveVirtualXIDsDelayingChkptGuts(VirtualTransactionId *vxids,
int nvxids, int type);
@@ -785,7 +783,6 @@ ProcArrayEndTransaction(PGPROC *proc, TransactionId
latestXid)
proc->xmin = InvalidTransactionId;
/* be sure these are cleared in abort */
- proc->delayChkpt = false;
proc->delayChkptEnd = false;
proc->recoveryConflictPending = false;
@@ -2150,33 +2147,6 @@ GetLocalOldestNonRemovableTransactionId(Relation rel,
bool updateGlobalVis)
return InvalidTransactionId;
}
-/*
- * Determine what kind of visibility horizon needs to be used for a
- * relation. If rel is NULL, the most conservative horizon is used.
- */
-static inline GlobalVisHorizonKind
-GlobalVisHorizonKindForRel(Relation rel)
-{
- /*
- * Other relkinds currently don't contain xids, nor always the necessary
- * logical decoding markers.
- */
- Assert(!rel ||
- rel->rd_rel->relkind == RELKIND_RELATION ||
- rel->rd_rel->relkind == RELKIND_MATVIEW ||
- rel->rd_rel->relkind == RELKIND_TOASTVALUE);
-
- if (rel == NULL || rel->rd_rel->relisshared || RecoveryInProgress())
- return VISHORIZON_SHARED;
- else if (IsCatalogRelation(rel) ||
- RelationIsAccessibleInLogicalDecoding(rel))
- return VISHORIZON_CATALOG;
- else if (!RELATION_IS_LOCAL(rel))
- return VISHORIZON_DATA;
- else
- return VISHORIZON_TEMP;
-}
-
/*
* Return the oldest XID for which deleted tuples must be preserved in the
* passed table.
@@ -4000,8 +3970,8 @@ GetVirtualXIDsDelayingChkpt(int *nvxids, int type)
* Note: this is O(N^2) in the number of vxacts that are/were delaying, but
* those numbers should be small enough for it not to be a problem.
*/
-bool
-HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids, int type)
+static bool
+HaveVirtualXIDsDelayingChkptGuts(VirtualTransactionId *vxids, int nvxids, int
type)
{
bool result = false;
ProcArrayStruct *arrayP = procArray;
@@ -5534,8 +5504,6 @@ ExpireTreeKnownAssignedTransactionIds(TransactionId xid,
int nsubxids,
void
ExpireAllKnownAssignedTransactionIds(void)
{
- FullTransactionId latestXid;
-
LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
KnownAssignedXidsRemovePreceding(InvalidTransactionId);
@@ -5556,8 +5524,6 @@ ExpireAllKnownAssignedTransactionIds(void)
void
ExpireOldKnownAssignedTransactionIds(TransactionId xid)
{
- TransactionId latestXid;
-
LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
/*
diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c
index e129d94457a..1d25219321e 100644
--- a/src/backend/storage/ipc/sinval.c
+++ b/src/backend/storage/ipc/sinval.c
@@ -215,8 +215,6 @@ ProcessCatchupInterrupt(void)
}
else
{
- MemoryContext oldcontext = CurrentMemoryContext;
-
elog(DEBUG4, "ProcessCatchupEvent outside transaction");
/*
diff --git a/src/include/storage/procarray.h b/src/include/storage/procarray.h
index 8b596c50563..82d7dec5a11 100644
--- a/src/include/storage/procarray.h
+++ b/src/include/storage/procarray.h
@@ -70,7 +70,7 @@ extern VirtualTransactionId *GetVirtualXIDsDelayingChkpt(int
*nvxids, int type);
extern VirtualTransactionId *GetVirtualXIDsDelayingChkptEnd(int *nvxids);
extern bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids,
-
int nvxids, int type);
+
int nvxids);
extern bool HaveVirtualXIDsDelayingChkptEnd(VirtualTransactionId *vxids,
int nvxids);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]