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 1e2275533b6 Fix compile errors for hash init mmgr in utils
1e2275533b6 is described below
commit 1e2275533b63f6d13caa8f0d8ecc81f87645ec0d
Author: Jinbao Chen <[email protected]>
AuthorDate: Mon Oct 6 21:00:00 2025 +0800
Fix compile errors for hash init mmgr in utils
---
src/backend/utils/hash/dynahash.c | 1 -
src/backend/utils/init/miscinit.c | 2 +-
src/backend/utils/init/postinit.c | 4 +-
src/backend/utils/mmgr/aset.c | 76 --------------------------------
src/backend/utils/mmgr/generation.c | 8 ----
src/backend/utils/mmgr/slab.c | 3 --
src/include/nodes/memnodes.h | 2 +-
src/include/utils/memutils_internal.h | 6 +--
src/include/utils/memutils_memorychunk.h | 2 +
9 files changed, 10 insertions(+), 94 deletions(-)
diff --git a/src/backend/utils/hash/dynahash.c
b/src/backend/utils/hash/dynahash.c
index 639c2ed015e..4b836f75a04 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -1087,7 +1087,6 @@ hash_search_with_hash_value(HTAB *hashp,
case HASH_ENTER_NULL:
/* FALL THRU */
case HASH_ENTER:
- case HASH_ENTER_NULL:
/* Return existing element if found, else create one */
if (currBucket != NULL)
return (void *) ELEMENTKEY(currBucket);
diff --git a/src/backend/utils/init/miscinit.c
b/src/backend/utils/init/miscinit.c
index 8a72ac3ba89..81b65631ea2 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -1081,7 +1081,7 @@ SetCurrentRoleId(Oid roleid, bool is_superuser)
else
SetRoleIsActive = true;
- SetOuterUserId(roleid);
+ SetOuterUserId(roleid, is_superuser);
/* If resource scheduling enabled, set the cached queue for the new
role.*/
if ((Gp_role == GP_ROLE_DISPATCH || IS_SINGLENODE() || Gp_role ==
GP_ROLE_EXECUTE) && IsResQueueEnabled())
diff --git a/src/backend/utils/init/postinit.c
b/src/backend/utils/init/postinit.c
index bf708254203..21b6a701d77 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -757,9 +757,11 @@ BaseInit(void)
*/
static void check_superuser_connection_limit()
{
+ int nfree;
+
if (!am_ftshandler &&
!IS_QUERY_DISPATCHER() &&
- !HaveNFreeProcs(RESERVED_FTS_CONNECTIONS))
+ !HaveNFreeProcs(RESERVED_FTS_CONNECTIONS, &nfree))
ereport(FATAL,
(errcode(ERRCODE_TOO_MANY_CONNECTIONS),
errmsg("connection limit
exceeded for superusers (need "
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c
index e3a1000eeb8..4b88bfc9726 100644
--- a/src/backend/utils/mmgr/aset.c
+++ b/src/backend/utils/mmgr/aset.c
@@ -384,37 +384,7 @@ static AllocSetFreeList context_freelists[2] =
}
};
-static void AllocSetDeclareAccountingRoot(MemoryContext context);
-static Size AllocSetGetCurrentUsage(MemoryContext context);
static Size AllocSetGetPeakUsage(MemoryContext context);
-static Size AllocSetSetPeakUsage(MemoryContext context, Size nbytes);
-
-#ifdef MEMORY_CONTEXT_CHECKING
-static void AllocSetCheck(MemoryContext context);
-#endif
-
-/*
- * This is the virtual function table for AllocSet contexts.
- */
-static const MemoryContextMethods AllocSetMethods = {
- AllocSetAlloc,
- AllocSetFree,
- AllocSetRealloc,
- AllocSetReset,
- AllocSetDelete,
- AllocSetGetChunkSpace,
- AllocSetIsEmpty,
- AllocSetStats,
-
- /* GPDB additions */
- AllocSetDeclareAccountingRoot,
- AllocSetGetCurrentUsage,
- AllocSetGetPeakUsage,
- AllocSetSetPeakUsage
-#ifdef MEMORY_CONTEXT_CHECKING
- ,AllocSetCheck
-#endif
-};
/* ----------
@@ -1369,17 +1339,6 @@ AllocSetRealloc(void *pointer, Size size)
/* Allow access to the chunk header. */
VALGRIND_MAKE_MEM_DEFINED(chunk, ALLOC_CHUNKHDRSZ);
-#ifdef USE_ASSERT_CHECKING
- if (IsUnderPostmaster && context != ErrorContext && mainthread() != 0
&& !pthread_equal(main_tid, pthread_self()))
- {
-#if defined(__darwin__)
- elog(ERROR,"prealloc called from thread (OS-X pthread_sigmask
is broken: MPP-4923)");
-#else
- elog(ERROR,"prealloc called from thread");
-#endif
- }
-#endif
-
if (MemoryChunkIsExternal(chunk))
{
/*
@@ -1794,26 +1753,6 @@ AllocSetStats(MemoryContext context,
}
}
-static void
-AllocSetDeclareAccountingRoot(MemoryContext context)
-{
- AllocSet set = (AllocSet) context;
-
- Assert(set->localAllocated == 0);
-
- set->accountingParent = set;
-}
-
-static Size
-AllocSetGetCurrentUsage(MemoryContext context)
-{
- AllocSet set = (AllocSet) context;
-
- Assert(IS_MEMORY_ACCOUNT(set));
-
- return set->currentAllocated;
-}
-
static Size
AllocSetGetPeakUsage_recurse(MemoryContext parent, MemoryContext context)
{
@@ -1851,21 +1790,6 @@ AllocSetGetPeakUsage(MemoryContext context)
return total;
}
-static Size
-AllocSetSetPeakUsage(MemoryContext context, Size nbytes)
-{
- AllocSet set = (AllocSet) context;
- Size oldpeak;
-
- Assert(IS_MEMORY_ACCOUNT(set));
-
- oldpeak = set->peakAllocated;
-
- set->peakAllocated = Max(set->currentAllocated, nbytes);
-
- return oldpeak;
-}
-
void
AllocSetTransferAccounting(MemoryContext context, MemoryContext new_parent)
{
diff --git a/src/backend/utils/mmgr/generation.c
b/src/backend/utils/mmgr/generation.c
index 772666a54b0..4d1af5cb089 100644
--- a/src/backend/utils/mmgr/generation.c
+++ b/src/backend/utils/mmgr/generation.c
@@ -105,14 +105,6 @@ struct GenerationBlock
#define GenerationIsValid(set) \
(PointerIsValid(set) && IsA(set, GenerationContext))
-/*
- * GenerationBlockIsValid
- * True iff block is valid block of generation set.
- */
-#ifdef MEMORY_CONTEXT_CHECKING
-static void GenerationCheck(MemoryContext context);
-#endif
-
#define GenerationBlockIsValid(block) \
(PointerIsValid(block) && GenerationIsValid((block)->context))
diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c
index cd53a039f7c..857a94e15a2 100644
--- a/src/backend/utils/mmgr/slab.c
+++ b/src/backend/utils/mmgr/slab.c
@@ -185,9 +185,6 @@ typedef struct SlabBlock
* fullChunkSize starting from the 0th chunk position. This will
return
* non-zero if it's not.
*/
-
-#ifdef MEMORY_CONTEXT_CHECKING
-static void SlabCheck(MemoryContext context);
#define SlabChunkMod(slab, block, chunk) \
(((char *) (chunk) - (char *) SlabBlockGetChunk(slab, block, 0)) % \
(slab)->fullChunkSize)
diff --git a/src/include/nodes/memnodes.h b/src/include/nodes/memnodes.h
index cc2c8baae70..42517a779ba 100644
--- a/src/include/nodes/memnodes.h
+++ b/src/include/nodes/memnodes.h
@@ -66,7 +66,7 @@ typedef struct MemoryContextMethods
void (*reset) (MemoryContext context);
void (*delete_context) (MemoryContext context, MemoryContext
parent);
MemoryContext (*get_chunk_context) (void *pointer);
- Size (*get_chunk_space) (MemoryContext context, void
*pointer);
+ Size (*get_chunk_space) (void *pointer);
bool (*is_empty) (MemoryContext context);
void (*stats) (MemoryContext context,
MemoryStatsPrintFunc
printfunc, void *passthru,
diff --git a/src/include/utils/memutils_internal.h
b/src/include/utils/memutils_internal.h
index 2d107bbf9d4..63c96c64792 100644
--- a/src/include/utils/memutils_internal.h
+++ b/src/include/utils/memutils_internal.h
@@ -23,7 +23,7 @@ extern void *AllocSetAlloc(MemoryContext context, Size size);
extern void AllocSetFree(void *pointer);
extern void *AllocSetRealloc(void *pointer, Size size);
extern void AllocSetReset(MemoryContext context);
-extern void AllocSetDelete(MemoryContext context);
+extern void AllocSetDelete(MemoryContext context, MemoryContext parent);
extern MemoryContext AllocSetGetChunkContext(void *pointer);
extern Size AllocSetGetChunkSpace(void *pointer);
extern bool AllocSetIsEmpty(MemoryContext context);
@@ -40,7 +40,7 @@ extern void *GenerationAlloc(MemoryContext context, Size
size);
extern void GenerationFree(void *pointer);
extern void *GenerationRealloc(void *pointer, Size size);
extern void GenerationReset(MemoryContext context);
-extern void GenerationDelete(MemoryContext context);
+extern void GenerationDelete(MemoryContext context, MemoryContext parent);
extern MemoryContext GenerationGetChunkContext(void *pointer);
extern Size GenerationGetChunkSpace(void *pointer);
extern bool GenerationIsEmpty(MemoryContext context);
@@ -58,7 +58,7 @@ extern void *SlabAlloc(MemoryContext context, Size size);
extern void SlabFree(void *pointer);
extern void *SlabRealloc(void *pointer, Size size);
extern void SlabReset(MemoryContext context);
-extern void SlabDelete(MemoryContext context);
+extern void SlabDelete(MemoryContext context, MemoryContext parent);
extern MemoryContext SlabGetChunkContext(void *pointer);
extern Size SlabGetChunkSpace(void *pointer);
extern bool SlabIsEmpty(MemoryContext context);
diff --git a/src/include/utils/memutils_memorychunk.h
b/src/include/utils/memutils_memorychunk.h
index ffa91131c88..69e9e93ee93 100644
--- a/src/include/utils/memutils_memorychunk.h
+++ b/src/include/utils/memutils_memorychunk.h
@@ -109,6 +109,8 @@
typedef struct MemoryChunk
{
+ /* size is always the size of the usable space in the chunk */
+ Size size;
#ifdef MEMORY_CONTEXT_CHECKING
Size requested_size;
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]