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 e52733af0b3 Fix some conflicts on untils
e52733af0b3 is described below
commit e52733af0b3d5db059cab3c3f80bd743c0828719
Author: Jinbao Chen <[email protected]>
AuthorDate: Tue Sep 9 10:23:52 2025 +0800
Fix some conflicts on untils
---
src/backend/utils/Makefile | 5 --
src/backend/utils/errcodes.txt | 4 --
src/backend/utils/error/Makefile | 7 +--
src/backend/utils/error/assert.c | 13 -----
src/backend/utils/error/elog.c | 53 +------------------
src/backend/utils/fmgr/Makefile | 3 --
src/backend/utils/hash/dynahash.c | 4 --
src/backend/utils/mb/mbutils.c | 15 ------
src/backend/utils/mmgr/aset.c | 100 ++----------------------------------
src/backend/utils/mmgr/generation.c | 67 ++----------------------
src/backend/utils/mmgr/mcxt.c | 11 ----
src/backend/utils/mmgr/portalmem.c | 48 +----------------
src/backend/utils/mmgr/slab.c | 71 ++-----------------------
13 files changed, 19 insertions(+), 382 deletions(-)
diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile
index 4e1819eea82..7ee1c1f60de 100644
--- a/src/backend/utils/Makefile
+++ b/src/backend/utils/Makefile
@@ -39,7 +39,6 @@ $(SUBDIRS:%=%-recursive): fmgr-stamp errcodes.h
# fmgr-stamp records the last time we ran Gen_fmgrtab.pl. We don't rely on
# the timestamps of the individual output files, because the Perl script
# won't update them if they didn't change (to avoid unnecessary recompiles).
-<<<<<<< HEAD
catalog_data_extra_path =
ifeq ($(enable_catalog_ext),yes)
catalog_data_extra_path = $(top_srcdir)/src/backend/catalog-extension/
@@ -48,10 +47,6 @@ endif
fmgr-stamp: Gen_fmgrtab.pl $(catalogdir)/Catalog.pm
$(top_srcdir)/src/include/catalog/pg_proc.dat
$(top_srcdir)/src/include/access/transam.h $(top_builddir)/src/Makefile.global
$(PERL) -I $(catalogdir) $< --include-path=$(top_srcdir)/src/include/ \
--extra-path=$(catalog_data_extra_path)
$(top_srcdir)/src/include/catalog/pg_proc.dat
-=======
-fmgr-stamp: Gen_fmgrtab.pl $(catalogdir)/Catalog.pm
$(top_srcdir)/src/include/catalog/pg_proc.dat
- $(PERL) -I $(catalogdir) $< --include-path=$(top_srcdir)/src/include/
$(top_srcdir)/src/include/catalog/pg_proc.dat
->>>>>>> REL_16_9
touch $@
errcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes.pl
diff --git a/src/backend/utils/errcodes.txt b/src/backend/utils/errcodes.txt
index fed766127d9..2f9da45f648 100644
--- a/src/backend/utils/errcodes.txt
+++ b/src/backend/utils/errcodes.txt
@@ -2,13 +2,9 @@
# errcodes.txt
# PostgreSQL error codes
#
-<<<<<<< HEAD
# Portions Copyright (c) 2005-2008, Greenplum inc.
# Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
-# Copyright (c) 2003-2021, PostgreSQL Global Development Group
-=======
# Copyright (c) 2003-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
#
# This list serves as the basis for generating source files containing error
# codes. It is kept in a common format to make sure all these source files have
diff --git a/src/backend/utils/error/Makefile b/src/backend/utils/error/Makefile
index aafedaba95e..1a22a43a87a 100644
--- a/src/backend/utils/error/Makefile
+++ b/src/backend/utils/error/Makefile
@@ -14,13 +14,10 @@ include $(top_builddir)/src/Makefile.global
OBJS = \
assert.o \
-<<<<<<< HEAD
- elog.o
-OBJS += debugutils.o
-=======
csvlog.o \
elog.o \
jsonlog.o
->>>>>>> REL_16_9
+
+OBJS += debugutils.o
include $(top_srcdir)/src/backend/common.mk
diff --git a/src/backend/utils/error/assert.c b/src/backend/utils/error/assert.c
index 9c27bab1e9e..288f8036fbe 100644
--- a/src/backend/utils/error/assert.c
+++ b/src/backend/utils/error/assert.c
@@ -3,13 +3,9 @@
* assert.c
* Assert support code.
*
-<<<<<<< HEAD
* Portions Copyright (c) 2005-2009, Greenplum inc
* Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -42,7 +38,6 @@ ExceptionalCondition(const char *conditionName,
{
/* CDB: Try to tell the QD or client what happened. */
if (!PointerIsValid(conditionName)
-<<<<<<< HEAD
|| !PointerIsValid(fileName)
|| !PointerIsValid(errorType))
ereport(FATAL,
@@ -54,14 +49,6 @@ ExceptionalCondition(const char *conditionName,
errmsg("Unexpected internal error"),
errdetail("%s(\"%s\", File: \"%s\", Line:
%d)\n",
errorType, conditionName,
fileName, lineNumber));
-=======
- || !PointerIsValid(fileName))
- write_stderr("TRAP: ExceptionalCondition: bad arguments in PID
%d\n",
- (int) getpid());
- else
- write_stderr("TRAP: failed Assert(\"%s\"), File: \"%s\", Line:
%d, PID: %d\n",
- conditionName, fileName, lineNumber,
(int) getpid());
->>>>>>> REL_16_9
/* Usually this shouldn't be needed, but make sure the msg went out */
fflush(stderr);
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 821235e0c9d..f48664e3588 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -43,13 +43,9 @@
* overflow.)
*
*
-<<<<<<< HEAD
* Portions Copyright (c) 2005-2009, Greenplum inc
* Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -555,15 +551,7 @@ errstart(int elevel, const char *domain)
edata->elevel = elevel;
edata->output_to_server = output_to_server;
edata->output_to_client = output_to_client;
-<<<<<<< HEAD
- /* the default text domain is the backend's */
- edata->domain = domain ? domain : PG_TEXTDOMAIN("postgres");
- /* initialize context_domain the same way (see set_errcontext_domain())
*/
- edata->context_domain = edata->domain;
- edata->omit_location = true;
-=======
set_stack_entry_domain(edata, domain);
->>>>>>> REL_16_9
/* Select default errcode based on elevel */
if (elevel >= ERROR)
{
@@ -1001,6 +989,7 @@ set_stack_entry_domain(ErrorData *edata, const char
*domain)
edata->domain = domain ? domain : PG_TEXTDOMAIN("postgres");
/* initialize context_domain the same way (see set_errcontext_domain())
*/
edata->context_domain = edata->domain;
+ edata->omit_location = true;
}
/*
@@ -2228,24 +2217,7 @@ ReThrowError(ErrorData *edata)
recursion_depth++;
MemoryContextSwitchTo(ErrorContext);
-<<<<<<< HEAD
- if (++errordata_stack_depth >= ERRORDATA_STACK_SIZE)
- {
- /*
- * Wups, stack not big enough. We treat this as a PANIC
condition
- * because it suggests an infinite loop of errors during error
- * recovery. Note that the message is intentionally not
localized,
- * else failure to convert it to client encoding could cause
further
- * recursion.
- */
- errordata_stack_depth = -1; /* make room on stack */
- ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE
exceeded")));
- }
-
- newedata = &errordata[errordata_stack_depth];
-=======
newedata = get_error_stack_entry();
->>>>>>> REL_16_9
memcpy(newedata, edata, sizeof(ErrorData));
/* Make copies of separately-allocated fields */
@@ -4504,12 +4476,9 @@ static void
send_message_to_server_log(ErrorData *edata)
{
StringInfoData buf;
-<<<<<<< HEAD
StringInfoData prefix;
int nc;
-=======
bool fallback_to_stderr = false;
->>>>>>> REL_16_9
AssertImply(mainthread() != 0, mythread() == mainthread());
@@ -4860,7 +4829,6 @@ write_pipe_chunks(char *data, int len, int dest)
Assert(len > 0);
-<<<<<<< HEAD
p.hdr.zero = 0;
p.hdr.pid = MyProcPid;
p.hdr.thid = mythread();
@@ -4869,9 +4837,6 @@ write_pipe_chunks(char *data, int len, int dest)
p.hdr.log_format = (dest == LOG_DESTINATION_CSVLOG ? 'c' : 't');
p.hdr.is_segv_msg = 'f';
p.hdr.next = -1;
-=======
- p.proto.nuls[0] = p.proto.nuls[1] = '\0';
- p.proto.pid = MyProcPid;
p.proto.flags = 0;
if (dest == LOG_DESTINATION_STDERR)
p.proto.flags |= PIPE_PROTO_DEST_STDERR;
@@ -4879,12 +4844,10 @@ write_pipe_chunks(char *data, int len, int dest)
p.proto.flags |= PIPE_PROTO_DEST_CSVLOG;
else if (dest == LOG_DESTINATION_JSONLOG)
p.proto.flags |= PIPE_PROTO_DEST_JSONLOG;
->>>>>>> REL_16_9
/* write all but the last chunk */
while (len > PIPE_MAX_PAYLOAD)
{
-<<<<<<< HEAD
p.hdr.is_last = 'f';
p.hdr.len = PIPE_MAX_PAYLOAD;
memcpy(p.data, data, PIPE_MAX_PAYLOAD);
@@ -4895,13 +4858,6 @@ write_pipe_chunks(char *data, int len, int dest)
Assert(p.hdr.thid != 0);
#endif
ignore_returned_result(write(fd, &p, PIPE_CHUNK_SIZE));
-=======
- /* no need to set PIPE_PROTO_IS_LAST yet */
- p.proto.len = PIPE_MAX_PAYLOAD;
- memcpy(p.proto.data, data, PIPE_MAX_PAYLOAD);
- rc = write(fd, &p, PIPE_HEADER_SIZE + PIPE_MAX_PAYLOAD);
- (void) rc;
->>>>>>> REL_16_9
data += PIPE_MAX_PAYLOAD;
len -= PIPE_MAX_PAYLOAD;
@@ -4909,7 +4865,6 @@ write_pipe_chunks(char *data, int len, int dest)
}
/* write the last chunk */
-<<<<<<< HEAD
p.hdr.is_last = 't';
p.hdr.len = len;
@@ -4921,13 +4876,7 @@ write_pipe_chunks(char *data, int len, int dest)
#endif
memcpy(p.data, data, len);
ignore_returned_result(write(fd, &p, PIPE_HEADER_SIZE + len));
-=======
p.proto.flags |= PIPE_PROTO_IS_LAST;
- p.proto.len = len;
- memcpy(p.proto.data, data, len);
- rc = write(fd, &p, PIPE_HEADER_SIZE + len);
- (void) rc;
->>>>>>> REL_16_9
}
diff --git a/src/backend/utils/fmgr/Makefile b/src/backend/utils/fmgr/Makefile
index fe20804917b..2182b02ae71 100644
--- a/src/backend/utils/fmgr/Makefile
+++ b/src/backend/utils/fmgr/Makefile
@@ -17,11 +17,8 @@ OBJS = \
fmgr.o \
funcapi.o
-<<<<<<< HEAD
OBJS += deprecated.o
override CPPFLAGS += -DDLSUFFIX=\"$(DLSUFFIX)\"
-=======
->>>>>>> REL_16_9
include $(top_srcdir)/src/backend/common.mk
diff --git a/src/backend/utils/hash/dynahash.c
b/src/backend/utils/hash/dynahash.c
index 3b7f4a6c83f..639c2ed015e 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -1084,12 +1084,8 @@ hash_search_with_hash_value(HTAB *hashp,
}
return NULL;
-<<<<<<< HEAD
case HASH_ENTER_NULL:
/* FALL THRU */
-
-=======
->>>>>>> REL_16_9
case HASH_ENTER:
case HASH_ENTER_NULL:
/* Return existing element if found, else create one */
diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c
index 2cd7e853142..57929274c0b 100644
--- a/src/backend/utils/mb/mbutils.c
+++ b/src/backend/utils/mb/mbutils.c
@@ -412,13 +412,8 @@ pg_do_encoding_conversion(unsigned char *src, int len,
(void) OidFunctionCall6(proc,
Int32GetDatum(src_encoding),
Int32GetDatum(dest_encoding),
-<<<<<<< HEAD
- CStringGetDatum((char
*)src),
- CStringGetDatum((char
*)result),
-=======
CStringGetDatum((char
*) src),
CStringGetDatum((char
*) result),
->>>>>>> REL_16_9
Int32GetDatum(len),
BoolGetDatum(false));
@@ -493,13 +488,8 @@ pg_do_encoding_conversion_buf(Oid proc,
result = OidFunctionCall6(proc,
Int32GetDatum(src_encoding),
Int32GetDatum(dest_encoding),
-<<<<<<< HEAD
- CStringGetDatum((char
*)src),
- CStringGetDatum((char
*)dest),
-=======
CStringGetDatum((char
*) src),
CStringGetDatum((char
*) dest),
->>>>>>> REL_16_9
Int32GetDatum(srclen),
BoolGetDatum(noError));
return DatumGetInt32(result);
@@ -953,13 +943,8 @@ pg_unicode_to_server(pg_wchar c, unsigned char *s)
FunctionCall6(Utf8ToServerConvProc,
Int32GetDatum(PG_UTF8),
Int32GetDatum(server_encoding),
-<<<<<<< HEAD
- CStringGetDatum((const char *) c_as_utf8),
- CStringGetDatum((const char *) s),
-=======
CStringGetDatum((char *) c_as_utf8),
CStringGetDatum((char *) s),
->>>>>>> REL_16_9
Int32GetDatum(c_as_utf8_len),
BoolGetDatum(false));
}
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c
index f72c1bbb7e1..e3a1000eeb8 100644
--- a/src/backend/utils/mmgr/aset.c
+++ b/src/backend/utils/mmgr/aset.c
@@ -7,13 +7,9 @@
* type.
*
*
-<<<<<<< HEAD
* Portions Copyright (c) 2007-2008, Greenplum inc
* Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
@@ -55,7 +51,8 @@
#include "port/pg_bitutils.h"
#include "utils/memdebug.h"
#include "utils/memutils.h"
-<<<<<<< HEAD
+#include "utils/memutils_memorychunk.h"
+#include "utils/memutils_internal.h"
#include "utils/gp_alloc.h"
#include "miscadmin.h"
@@ -66,10 +63,6 @@
#if defined(CDB_PALLOC_TAGS) && !defined(CDB_PALLOC_CALLER_ID)
#error "If CDB_PALLOC_TAGS is defined, CDB_PALLOC_CALLER_ID must be defined
too"
#endif
-=======
-#include "utils/memutils_memorychunk.h"
-#include "utils/memutils_internal.h"
->>>>>>> REL_16_9
/*--------------------
* Chunk freelist k holds chunks of size 1 << (k + ALLOC_MINBITS),
@@ -271,7 +264,6 @@ typedef struct AllocBlockData
} AllocBlockData;
/*
-<<<<<<< HEAD
* AllocChunk
* The prefix of each piece of memory in an AllocBlock
*
@@ -323,8 +315,6 @@ typedef struct AllocChunkData
#define ALLOCCHUNK_PRIVATE_LEN offsetof(AllocChunkData, aset)
/*
-=======
->>>>>>> REL_16_9
* AllocPointerIsValid
* True iff pointer is valid allocation pointer.
*/
@@ -394,22 +384,6 @@ static AllocSetFreeList context_freelists[2] =
}
};
-<<<<<<< HEAD
-/*
- * These functions implement the MemoryContext API for AllocSet contexts.
- */
-static void *AllocSetAlloc(MemoryContext context, Size size);
-static void AllocSetFree(MemoryContext context, void *pointer);
-static void *AllocSetRealloc(MemoryContext context, void *pointer, Size size);
-static void AllocSetReset(MemoryContext context);
-static void AllocSetDelete(MemoryContext context, MemoryContext parent);
-static Size AllocSetGetChunkSpace(MemoryContext context, void *pointer);
-static bool AllocSetIsEmpty(MemoryContext context);
-static void AllocSetStats(MemoryContext context,
- MemoryStatsPrintFunc
printfunc, void *passthru,
- MemoryContextCounters *totals,
- bool print_to_stderr);
-
static void AllocSetDeclareAccountingRoot(MemoryContext context);
static Size AllocSetGetCurrentUsage(MemoryContext context);
static Size AllocSetGetPeakUsage(MemoryContext context);
@@ -442,8 +416,6 @@ static const MemoryContextMethods AllocSetMethods = {
#endif
};
-=======
->>>>>>> REL_16_9
/* ----------
* AllocSetFreeIndex -
@@ -749,17 +721,15 @@ AllocSetReset(MemoryContext context)
AllocSetCheck(context);
#endif
-<<<<<<< HEAD
/*
* Make sure all children have been deleted,
* or the accounting data is incorrect.
*/
Assert(context->firstchild == NULL);
MEMORY_ACCOUNT_DEC_ALLOCATED(set, set->localAllocated);
-=======
+
/* Remember keeper block size for Assert below */
keepersize = set->keeper->endptr - ((char *) set);
->>>>>>> REL_16_9
/* Clear chunk freelists */
MemSetAligned(set->freelist, 0, sizeof(set->freelist));
@@ -814,13 +784,8 @@ AllocSetReset(MemoryContext context)
*
* Unlike AllocSetReset, this *must* free all resources of the set.
*/
-<<<<<<< HEAD
-static void
-AllocSetDelete(MemoryContext context, MemoryContext parent)
-=======
void
-AllocSetDelete(MemoryContext context)
->>>>>>> REL_16_9
+AllocSetDelete(MemoryContext context, MemoryContext parent)
{
AllocSet set = (AllocSet) context;
AllocBlock block = set->blocks;
@@ -833,7 +798,6 @@ AllocSetDelete(MemoryContext context)
AllocSetCheck(context);
#endif
-<<<<<<< HEAD
/* Make sure all children have been deleted */
Assert(context->firstchild == NULL);
MEMORY_ACCOUNT_DEC_ALLOCATED(set, set->localAllocated);
@@ -846,10 +810,9 @@ AllocSetDelete(MemoryContext context)
Max(set->peakAllocated,
parentset->accountingParent->peakAllocated);
}
-=======
+
/* Remember keeper block size for Assert below */
keepersize = set->keeper->endptr - ((char *) set);
->>>>>>> REL_16_9
/*
* If the context is a candidate for a freelist, put it into that
freelist
@@ -940,8 +903,6 @@ AllocSetAlloc(MemoryContext context, Size size)
Size chunk_size;
Size blksize;
-<<<<<<< HEAD
- AssertArg(AllocSetIsValid(set));
#ifdef USE_ASSERT_CHECKING
if (IsUnderPostmaster && context != ErrorContext && mainthread() != 0
&& !pthread_equal(main_tid, pthread_self()))
{
@@ -952,9 +913,7 @@ AllocSetAlloc(MemoryContext context, Size size)
#endif
}
#endif
-=======
Assert(AllocSetIsValid(set));
->>>>>>> REL_16_9
/*
* If requested size exceeds maximum for chunks, allocate an entire
block
@@ -1021,13 +980,9 @@ AllocSetAlloc(MemoryContext context, Size size)
/* Disallow access to the chunk header. */
VALGRIND_MAKE_MEM_NOACCESS(chunk, ALLOC_CHUNKHDRSZ);
-<<<<<<< HEAD
MEMORY_ACCOUNT_INC_ALLOCATED(set, chunk->size);
- return AllocChunkGetPointer(chunk);
-=======
return MemoryChunkGetPointer(chunk);
->>>>>>> REL_16_9
}
/*
@@ -1076,13 +1031,9 @@ AllocSetAlloc(MemoryContext context, Size size)
/* Disallow access to the chunk header. */
VALGRIND_MAKE_MEM_NOACCESS(chunk, ALLOC_CHUNKHDRSZ);
-<<<<<<< HEAD
MEMORY_ACCOUNT_INC_ALLOCATED(set, chunk->size);
- return AllocChunkGetPointer(chunk);
-=======
return MemoryChunkGetPointer(chunk);
->>>>>>> REL_16_9
}
/*
@@ -1248,13 +1199,9 @@ AllocSetAlloc(MemoryContext context, Size size)
/* Disallow access to the chunk header. */
VALGRIND_MAKE_MEM_NOACCESS(chunk, ALLOC_CHUNKHDRSZ);
-<<<<<<< HEAD
MEMORY_ACCOUNT_INC_ALLOCATED(set, chunk->size);
- return AllocChunkGetPointer(chunk);
-=======
return MemoryChunkGetPointer(chunk);
->>>>>>> REL_16_9
}
/*
@@ -1413,24 +1360,15 @@ AllocSetContains(MemoryContext context, void *pointer)
void *
AllocSetRealloc(void *pointer, Size size)
{
-<<<<<<< HEAD
- AllocSet set = (AllocSet) context;
- AllocChunk chunk = AllocPointerGetChunk(pointer);
- Size oldchksize;
-=======
AllocBlock block;
AllocSet set;
MemoryChunk *chunk = PointerGetMemoryChunk(pointer);
Size oldchksize;
int fidx;
->>>>>>> REL_16_9
/* Allow access to the chunk header. */
VALGRIND_MAKE_MEM_DEFINED(chunk, ALLOC_CHUNKHDRSZ);
-<<<<<<< HEAD
- oldchksize = chunk->size;
-
#ifdef USE_ASSERT_CHECKING
if (IsUnderPostmaster && context != ErrorContext && mainthread() != 0
&& !pthread_equal(main_tid, pthread_self()))
{
@@ -1442,18 +1380,7 @@ AllocSetRealloc(void *pointer, Size size)
}
#endif
-#ifdef MEMORY_CONTEXT_CHECKING
- /* Test for someone scribbling on unused space in chunk */
- if (chunk->requested_size < oldchksize)
- if (!sentinel_ok(pointer, chunk->requested_size))
- elog(WARNING, "detected write past chunk end in %s %p",
- set->header.name, chunk);
-#endif
-
- if (oldchksize > set->allocChunkLimit)
-=======
if (MemoryChunkIsExternal(chunk))
->>>>>>> REL_16_9
{
/*
* The chunk must have been allocated as a single-chunk block.
Use
@@ -1464,20 +1391,7 @@ AllocSetRealloc(void *pointer, Size size)
Size blksize;
Size oldblksize;
-<<<<<<< HEAD
- /*
- * Try to verify that we have a sane block pointer: it should
- * reference the correct aset, and freeptr and endptr should
point
- * just past the chunk.
- */
- if (block->aset != set ||
- block->freeptr != block->endptr ||
- block->freeptr != ((char *) block) +
- (oldchksize + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ))
- elog(ERROR, "could not find block containing chunk %p",
chunk);
-=======
block = ExternalChunkGetBlock(chunk);
->>>>>>> REL_16_9
/*
* Try to verify that we have a sane block pointer: the block
header
@@ -1619,11 +1533,7 @@ AllocSetRealloc(void *pointer, Size size)
* allocated area already is >= the new size. (In particular, we will
* fall out here if the requested size is a decrease.)
*/
-<<<<<<< HEAD
- else if (oldchksize >= size)
-=======
if (oldchksize >= size)
->>>>>>> REL_16_9
{
#ifdef MEMORY_CONTEXT_CHECKING
Size oldrequest = chunk->requested_size;
diff --git a/src/backend/utils/mmgr/generation.c
b/src/backend/utils/mmgr/generation.c
index e2c12cf33cd..772666a54b0 100644
--- a/src/backend/utils/mmgr/generation.c
+++ b/src/backend/utils/mmgr/generation.c
@@ -36,11 +36,8 @@
#include "postgres.h"
#include "lib/ilist.h"
-<<<<<<< HEAD
-#include "utils/gp_alloc.h"
-=======
#include "port/pg_bitutils.h"
->>>>>>> REL_16_9
+#include "utils/gp_alloc.h"
#include "utils/memdebug.h"
#include "utils/memutils.h"
#include "utils/memutils_memorychunk.h"
@@ -112,26 +109,12 @@ struct GenerationBlock
* GenerationBlockIsValid
* True iff block is valid block of generation set.
*/
-<<<<<<< HEAD
-static void *GenerationAlloc(MemoryContext context, Size size);
-static void GenerationFree(MemoryContext context, void *pointer);
-static void *GenerationRealloc(MemoryContext context, void *pointer, Size
size);
-static void GenerationReset(MemoryContext context);
-static void GenerationDelete(MemoryContext context, MemoryContext parent);
-static Size GenerationGetChunkSpace(MemoryContext context, void *pointer);
-static bool GenerationIsEmpty(MemoryContext context);
-static void GenerationStats(MemoryContext context,
- MemoryStatsPrintFunc
printfunc, void *passthru,
- MemoryContextCounters
*totals,
- bool print_to_stderr);
-
#ifdef MEMORY_CONTEXT_CHECKING
static void GenerationCheck(MemoryContext context);
#endif
-=======
+
#define GenerationBlockIsValid(block) \
(PointerIsValid(block) && GenerationIsValid((block)->context))
->>>>>>> REL_16_9
/*
* We always store external chunks on a dedicated block. This makes fetching
@@ -217,12 +200,7 @@ GenerationContextCreate(MemoryContext parent,
* Allocate the initial block. Unlike other generation.c blocks, it
* starts with the context header and its block header follows that.
*/
-<<<<<<< HEAD
-
- set = (GenerationContext *)
gp_malloc(MAXALIGN(sizeof(GenerationContext)));
-=======
- set = (GenerationContext *) malloc(allocSize);
->>>>>>> REL_16_9
+ set = (GenerationContext *) gp_malloc(allocSize);
if (set == NULL)
{
MemoryContextStats(TopMemoryContext);
@@ -320,22 +298,10 @@ GenerationReset(MemoryContext context)
{
GenerationBlock *block = dlist_container(GenerationBlock, node,
miter.cur);
-<<<<<<< HEAD
- dlist_delete(miter.cur);
-
- context->mem_allocated -= block->blksize;
-
-#ifdef CLOBBER_FREED_MEMORY
- wipe_mem(block, block->blksize);
-#endif
-
- gp_free(block);
-=======
if (block == set->keeper)
GenerationBlockMarkEmpty(block);
else
GenerationBlockFree(set, block);
->>>>>>> REL_16_9
}
/* set it so new allocations to make use of the keeper block */
@@ -353,23 +319,13 @@ GenerationReset(MemoryContext context)
* GenerationDelete
* Free all memory which is allocated in the given context.
*/
-<<<<<<< HEAD
-static void
-GenerationDelete(MemoryContext context, MemoryContext parent)
-=======
void
-GenerationDelete(MemoryContext context)
->>>>>>> REL_16_9
+GenerationDelete(MemoryContext context, MemoryContext parent)
{
/* Reset to release all releasable GenerationBlocks */
GenerationReset(context);
-<<<<<<< HEAD
/* And free the context header */
gp_free(context);
-=======
- /* And free the context header and keeper block */
- free(context);
->>>>>>> REL_16_9
}
/*
@@ -476,15 +432,11 @@ GenerationAlloc(MemoryContext context, Size size)
Size blksize;
GenerationBlock *freeblock = set->freeblock;
-<<<<<<< HEAD
- block = (GenerationBlock *) gp_malloc(blksize);
-=======
if (freeblock != NULL &&
GenerationBlockIsEmpty(freeblock) &&
GenerationBlockFreeBytes(freeblock) >= required_size)
{
block = freeblock;
->>>>>>> REL_16_9
/*
* Zero out the freeblock as we'll set this to the
current block
@@ -772,17 +724,8 @@ GenerationFree(void *pointer)
*/
dlist_delete(&block->node);
-<<<<<<< HEAD
- /* Also make sure the block is not marked as the current block. */
- if (set->block == block)
- set->block = NULL;
-
- context->mem_allocated -= block->blksize;
- gp_free(block);
-=======
set->header.mem_allocated -= block->blksize;
- free(block);
->>>>>>> REL_16_9
+ gp_free(block);
}
/*
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index bad2d309d94..a48d0920625 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -9,13 +9,9 @@
* context's MemoryContextMethods struct.
*
*
-<<<<<<< HEAD
* Portions Copyright (c) 2007-2008, Greenplum inc
* Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -431,13 +427,9 @@ MemoryContextResetChildren(MemoryContext context)
void
MemoryContextDeleteImpl(MemoryContext context, const char* sfile, const char
*func, int sline)
{
-<<<<<<< HEAD
MemoryContext parent;
- AssertArg(MemoryContextIsValid(context));
-=======
Assert(MemoryContextIsValid(context));
->>>>>>> REL_16_9
/* We had better not be deleting TopMemoryContext ... */
Assert(context != TopMemoryContext);
/* And not CurrentMemoryContext, either */
@@ -1107,7 +1099,6 @@ MemoryContextCheck(MemoryContext context)
#endif
/*
-<<<<<<< HEAD
* MemoryContextContains
* Detect whether an allocated chunk of memory belongs to a given
* context or not.
@@ -1188,8 +1179,6 @@ MemoryContextContainsGenericAllocation(MemoryContext
context, void *pointer)
}
/*--------------------
-=======
->>>>>>> REL_16_9
* MemoryContextCreate
* Context-type-independent part of context creation.
*
diff --git a/src/backend/utils/mmgr/portalmem.c
b/src/backend/utils/mmgr/portalmem.c
index 3104c07831f..bb5a2fcc527 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -8,13 +8,9 @@
* doesn't actually run the executor for them.
*
*
-<<<<<<< HEAD
* Portions Copyright (c) 2006-2009, Greenplum inc
* Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
@@ -1273,43 +1269,6 @@ pg_cursor(PG_FUNCTION_ARGS)
HASH_SEQ_STATUS hash_seq;
PortalHashEnt *hentry;
-<<<<<<< HEAD
- /* check to see if caller supports us returning a tuplestore */
- if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("set-valued function called in context
that cannot accept a set")));
- if (!(rsinfo->allowedModes & SFRM_Materialize))
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("materialize mode required, but it is
not allowed in this context")));
-
- /* need to build tuplestore in query context */
- per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;
- oldcontext = MemoryContextSwitchTo(per_query_ctx);
-
- /*
- * build tupdesc for result tuples. This must match the definition of
the
- * pg_cursors view in system_views.sql
- */
- tupdesc = CreateTemplateTupleDesc(7);
- TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
- TEXTOID, -1, 0);
- TupleDescInitEntry(tupdesc, (AttrNumber) 2, "statement",
- TEXTOID, -1, 0);
- TupleDescInitEntry(tupdesc, (AttrNumber) 3, "is_holdable",
- BOOLOID, -1, 0);
- TupleDescInitEntry(tupdesc, (AttrNumber) 4, "is_binary",
- BOOLOID, -1, 0);
- TupleDescInitEntry(tupdesc, (AttrNumber) 5, "is_scrollable",
- BOOLOID, -1, 0);
- TupleDescInitEntry(tupdesc, (AttrNumber) 6, "creation_time",
- TIMESTAMPTZOID, -1, 0);
- TupleDescInitEntry(tupdesc, (AttrNumber) 7, "is_parallel",
- BOOLOID, -1, 0);
-
-=======
->>>>>>> REL_16_9
/*
* We put all the tuples into a tuplestore in one scan of the hashtable.
* This avoids any issue of the hashtable possibly changing between
calls.
@@ -1320,13 +1279,8 @@ pg_cursor(PG_FUNCTION_ARGS)
while ((hentry = hash_seq_search(&hash_seq)) != NULL)
{
Portal portal = hentry->portal;
-<<<<<<< HEAD
Datum values[7];
- bool nulls[7];
-=======
- Datum values[6];
- bool nulls[6] = {0};
->>>>>>> REL_16_9
+ bool nulls[7] = {0};
/* report only "visible" entries */
if (!portal->visible)
diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c
index ac714ff427b..cd53a039f7c 100644
--- a/src/backend/utils/mmgr/slab.c
+++ b/src/backend/utils/mmgr/slab.c
@@ -71,10 +71,8 @@
#include "lib/ilist.h"
#include "utils/memdebug.h"
#include "utils/memutils.h"
-<<<<<<< HEAD
#include "utils/gp_alloc.h"
#include "lib/ilist.h"
-=======
#include "utils/memutils_memorychunk.h"
#include "utils/memutils_internal.h"
@@ -100,7 +98,6 @@
/* The maximum number of completely empty blocks to keep around for reuse. */
#define SLAB_MAXIMUM_EMPTY_BLOCKS 10
->>>>>>> REL_16_9
/*
* SlabContext is a specialized implementation of MemoryContext.
@@ -188,53 +185,20 @@ typedef struct SlabBlock
* fullChunkSize starting from the 0th chunk position. This will
return
* non-zero if it's not.
*/
-<<<<<<< HEAD
-static void *SlabAlloc(MemoryContext context, Size size);
-static void SlabFree(MemoryContext context, void *pointer);
-static void *SlabRealloc(MemoryContext context, void *pointer, Size size);
-static void SlabReset(MemoryContext context);
-static void SlabDelete(MemoryContext context, MemoryContext parent);
-static Size SlabGetChunkSpace(MemoryContext context, void *pointer);
-static bool SlabIsEmpty(MemoryContext context);
-static void SlabStats(MemoryContext context,
- MemoryStatsPrintFunc printfunc, void
*passthru,
- MemoryContextCounters *totals,
- bool print_to_stderr);
+
#ifdef MEMORY_CONTEXT_CHECKING
static void SlabCheck(MemoryContext context);
-=======
#define SlabChunkMod(slab, block, chunk) \
(((char *) (chunk) - (char *) SlabBlockGetChunk(slab, block, 0)) % \
(slab)->fullChunkSize)
->>>>>>> REL_16_9
#endif
/*
* SlabIsValid
* True iff set is a valid slab allocation set.
*/
-<<<<<<< HEAD
-static const MemoryContextMethods SlabMethods = {
- SlabAlloc,
- SlabFree,
- SlabRealloc,
- SlabReset,
- SlabDelete,
- SlabGetChunkSpace,
- SlabIsEmpty,
- SlabStats,
- NULL,
- NULL,
- NULL,
- NULL
-#ifdef MEMORY_CONTEXT_CHECKING
- ,SlabCheck
-#endif
-};
-=======
#define SlabIsValid(set) (PointerIsValid(set) && IsA(set, SlabContext))
->>>>>>> REL_16_9
/*
* SlabBlockIsValid
@@ -388,9 +352,6 @@ SlabContextCreate(MemoryContext parent,
fullChunkSize = Slab_CHUNKHDRSZ + MAXALIGN(chunkSize);
#endif
-<<<<<<< HEAD
- slab = (SlabContext *) gp_malloc(headerSize);
-=======
/* compute the number of chunks that will fit on each block */
chunksPerBlock = (blockSize - Slab_BLOCKHDRSZ) / fullChunkSize;
@@ -401,8 +362,7 @@ SlabContextCreate(MemoryContext parent,
- slab = (SlabContext *) malloc(Slab_CONTEXT_HDRSZ(chunksPerBlock));
->>>>>>> REL_16_9
+ slab = (SlabContext *) gp_malloc(Slab_CONTEXT_HDRSZ(chunksPerBlock));
if (slab == NULL)
{
MemoryContextStats(TopMemoryContext);
@@ -508,12 +468,7 @@ SlabReset(MemoryContext context)
#ifdef CLOBBER_FREED_MEMORY
wipe_mem(block, slab->blockSize);
#endif
-<<<<<<< HEAD
gp_free(block);
- slab->nblocks--;
-=======
- free(block);
->>>>>>> REL_16_9
context->mem_allocated -= slab->blockSize;
}
}
@@ -527,13 +482,8 @@ SlabReset(MemoryContext context)
* SlabDelete
* Free all memory which is allocated in the given context.
*/
-<<<<<<< HEAD
-static void
-SlabDelete(MemoryContext context, MemoryContext parent)
-=======
void
-SlabDelete(MemoryContext context)
->>>>>>> REL_16_9
+SlabDelete(MemoryContext context, MemoryContext parent)
{
/* Reset to release all the SlabBlocks */
SlabReset(context);
@@ -573,12 +523,10 @@ SlabAlloc(MemoryContext context, Size size)
*/
if (unlikely(slab->curBlocklistIndex == 0))
{
-<<<<<<< HEAD
- block = (SlabBlock *) gp_malloc(slab->blockSize);
-=======
dlist_head *blocklist;
int blocklist_idx;
->>>>>>> REL_16_9
+\
+ block = (SlabBlock *) gp_malloc(slab->blockSize);\
/* to save allocating a new one, first check the empty blocks
list */
if (dclist_count(&slab->emptyblocks) > 0)
@@ -779,17 +727,8 @@ SlabFree(void *pointer)
/* Handle when a block becomes completely empty */
if (unlikely(block->nfree == slab->chunksPerBlock))
{
-<<<<<<< HEAD
- gp_free(block);
- slab->nblocks--;
- context->mem_allocated -= slab->blockSize;
- }
- else
- dlist_push_head(&slab->freelist[block->nfree], &block->node);
-=======
/* remove the block */
dlist_delete_from(&slab->blocklist[newBlocklistIdx],
&block->node);
->>>>>>> REL_16_9
/*
* To avoid thrashing malloc/free, we keep a list of empty
blocks that
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]