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 3a86d6959cc Fix conflicts for storage/lmgr
3a86d6959cc is described below
commit 3a86d6959cc771202c9a885ddca91343cb4d3072
Author: Jinbao Chen <[email protected]>
AuthorDate: Sat Jul 26 15:34:03 2025 +0800
Fix conflicts for storage/lmgr
---
src/backend/storage/lmgr/lmgr.c | 9 ++------
src/backend/storage/lmgr/lock.c | 47 +--------------------------------------
src/backend/storage/lmgr/lwlock.c | 7 ++----
src/backend/storage/lmgr/proc.c | 40 ---------------------------------
4 files changed, 5 insertions(+), 98 deletions(-)
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c
index 1fde5c647cb..7a4f8fb0930 100644
--- a/src/backend/storage/lmgr/lmgr.c
+++ b/src/backend/storage/lmgr/lmgr.c
@@ -3,13 +3,9 @@
* lmgr.c
* POSTGRES lock manager code
*
-<<<<<<< HEAD
* Portions Copyright (c) 2006-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
*
*
@@ -1423,7 +1419,6 @@ DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
tag->locktag_field3,
tag->locktag_field4);
break;
-<<<<<<< HEAD
case LOCKTAG_RESOURCE_QUEUE:
appendStringInfo(buf,
_("resource queue %u"),
@@ -1432,13 +1427,13 @@ DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
case LOCKTAG_WAREHOUSE:
appendStringInfo(buf,
_("warehouse %u"),
-=======
+ tag->locktag_field1);
+ break;
case LOCKTAG_APPLY_TRANSACTION:
appendStringInfo(buf,
_("remote transaction
%u of subscription %u of database %u"),
tag->locktag_field3,
tag->locktag_field2,
->>>>>>> REL_16_9
tag->locktag_field1);
break;
default:
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index fb661daa8dd..4289c26ea2c 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -144,13 +144,8 @@ static const char *const lock_mode_names[] =
static bool Dummy_trace = false;
#endif
-<<<<<<< HEAD
const LockMethodData default_lockmethod = {
- AccessExclusiveLock, /* highest valid lock mode number */
-=======
-static const LockMethodData default_lockmethod = {
MaxLockMode,
->>>>>>> REL_16_9
LockConflicts,
lock_mode_names,
#ifdef LOCK_DEBUG
@@ -160,13 +155,8 @@ static const LockMethodData default_lockmethod = {
#endif
};
-<<<<<<< HEAD
const LockMethodData user_lockmethod = {
- AccessExclusiveLock, /* highest valid lock mode number */
-=======
-static const LockMethodData user_lockmethod = {
MaxLockMode,
->>>>>>> REL_16_9
LockConflicts,
lock_mode_names,
#ifdef LOCK_DEBUG
@@ -177,7 +167,7 @@ static const LockMethodData user_lockmethod = {
};
const LockMethodData resource_lockmethod = {
- AccessExclusiveLock, /* highest valid lock mode number */
+ MaxLockMode, /* highest valid lock mode number */
LockConflicts,
lock_mode_names,
#ifdef LOCK_DEBUG
@@ -1001,10 +991,6 @@ LockAcquireExtended(const LOCKTAG *locktag,
}
}
-<<<<<<< HEAD
-
-=======
->>>>>>> REL_16_9
/*
* Prepare to emit a WAL record if acquisition of this lock needs to be
* replayed in a standby server.
@@ -2102,24 +2088,8 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner)
LOCK_PRINT("WaitOnLock: sleeping on lock",
locallock->lock, locallock->tag.mode);
-<<<<<<< HEAD
- /* Report change to waiting status */
- if (update_process_title)
- {
- const char *old_status;
- int len;
-
- old_status = get_real_act_ps_display(&len);
- new_status = (char *) palloc(len + 8 + 1);
- memcpy(new_status, old_status, len);
- strcpy(new_status + len, " waiting");
- set_ps_display(new_status);
- new_status[len] = '\0'; /* truncate off " waiting" */
- }
-=======
/* adjust the process title to indicate that it's waiting */
set_ps_display_suffix("waiting");
->>>>>>> REL_16_9
awaitedLock = locallock;
awaitedOwner = owner;
@@ -3581,9 +3551,6 @@ LockRefindAndRelease(LockMethod lockMethodTable, PGPROC
*proc,
}
/*
-<<<<<<< HEAD
- * Prepare for prepare, while we're still in a transaction.
-=======
* CheckForSessionAndXactLocks
* Check to see if transaction holds both session-level and
xact-level
* locks on the same object; if so, throw an error.
@@ -3683,22 +3650,16 @@ CheckForSessionAndXactLocks(void)
* AtPrepare_Locks
* Do the preparatory work for a PREPARE: make 2PC state file
records
* for all locks currently held.
->>>>>>> REL_16_9
*
* 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.
*
-<<<<<<< HEAD
- * If new locks are taken after this, they will be considered as
- * not temp.
-=======
* 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.
->>>>>>> REL_16_9
*/
void
PrePrepare_Locks(void)
@@ -3706,16 +3667,10 @@ PrePrepare_Locks(void)
HASH_SEQ_STATUS status;
LOCALLOCK *locallock;
-<<<<<<< HEAD
- /*
- * Scan the local locks, and set the 'istemptable' flags.
- */
-=======
/* First, verify there aren't locks of both xact and session level */
CheckForSessionAndXactLocks();
/* Now do the per-locallock cleanup work */
->>>>>>> REL_16_9
hash_seq_init(&status, LockMethodLocalHash);
while ((locallock = (LOCALLOCK *) hash_seq_search(&status)) != NULL)
{
diff --git a/src/backend/storage/lmgr/lwlock.c
b/src/backend/storage/lmgr/lwlock.c
index cce2df13236..0d62380f3df 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -180,10 +180,6 @@ static const char *const BuiltinTrancheNames[] = {
"ParallelAppend",
/* LWTRANCHE_PER_XACT_PREDICATE_LIST: */
"PerXactPredicateList",
-<<<<<<< HEAD
- /* LWTRANCHE_DISTRIBUTEDLOG_BUFFERS */
- "DistributedLogBuffer"
-=======
/* LWTRANCHE_PGSTATS_DSA: */
"PgStatsDSA",
/* LWTRANCHE_PGSTATS_HASH: */
@@ -194,7 +190,8 @@ static const char *const BuiltinTrancheNames[] = {
"LogicalRepLauncherDSA",
/* LWTRANCHE_LAUNCHER_HASH: */
"LogicalRepLauncherHash",
->>>>>>> REL_16_9
+ /* LWTRANCHE_DISTRIBUTEDLOG_BUFFERS */
+ "DistributedLogBuffer"
};
StaticAssertDecl(lengthof(BuiltinTrancheNames) ==
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 0caf5cd2dd4..e44182bc71f 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -3,13 +3,9 @@
* proc.c
* routines to manage per-process shared memory data structure
*
-<<<<<<< HEAD
* Portions Copyright (c) 2006-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
*
*
@@ -41,13 +37,10 @@
#include "access/transam.h"
#include "access/twophase.h"
-<<<<<<< HEAD
#include "access/xact.h"
#include "catalog/namespace.h" /* TempNamespaceOidIsValid */
#include "commands/async.h"
-=======
#include "access/xlogutils.h"
->>>>>>> REL_16_9
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
@@ -207,20 +200,11 @@ InitProcGlobal(void)
* Initialize the data structures.
*/
ProcGlobal->spins_per_delay = DEFAULT_SPINS_PER_DELAY;
-<<<<<<< HEAD
- ProcGlobal->freeProcs = NULL;
- ProcGlobal->autovacFreeProcs = NULL;
ProcGlobal->lmFreeProcs = NULL;
- ProcGlobal->bgworkerFreeProcs = NULL;
- ProcGlobal->walsenderFreeProcs = NULL;
- ProcGlobal->startupProc = NULL;
- ProcGlobal->startupProcPid = 0;
-=======
dlist_init(&ProcGlobal->freeProcs);
dlist_init(&ProcGlobal->autovacFreeProcs);
dlist_init(&ProcGlobal->bgworkerFreeProcs);
dlist_init(&ProcGlobal->walsenderFreeProcs);
->>>>>>> REL_16_9
ProcGlobal->startupBufferPinWaitBufId = -1;
ProcGlobal->walwriterLatch = NULL;
ProcGlobal->checkpointerLatch = NULL;
@@ -491,13 +475,8 @@ InitProcess(void)
MyProc->databaseId = InvalidOid;
MyProc->roleId = InvalidOid;
MyProc->tempNamespaceId = InvalidOid;
-<<<<<<< HEAD
MyProc->isBackgroundWorker = IsBackgroundWorker;
- MyProc->delayChkpt = 0;
-=======
- MyProc->isBackgroundWorker = !AmRegularBackendProcess();
MyProc->delayChkptFlags = 0;
->>>>>>> REL_16_9
MyProc->statusFlags = 0;
/* NB -- autovac launcher intentionally does not set IS_AUTOVACUUM */
if (IsAutoVacuumWorkerProcess())
@@ -763,13 +742,8 @@ InitAuxiliaryProcess(void)
MyProc->mppSessionId = InvalidGpSessionId;
MyProc->mppIsWriter = false;
MyProc->tempNamespaceId = InvalidOid;
-<<<<<<< HEAD
MyProc->isBackgroundWorker = IsBackgroundWorker;
- MyProc->delayChkpt = 0;
-=======
- MyProc->isBackgroundWorker = true;
MyProc->delayChkptFlags = 0;
->>>>>>> REL_16_9
MyProc->statusFlags = 0;
MyProc->lwWaiting = LW_WS_NOT_WAITING;
MyProc->lwWaitMode = 0;
@@ -1034,10 +1008,7 @@ ProcKill(int code, Datum arg)
Assert(MyProc != NULL);
-<<<<<<< HEAD
SIMPLE_FAULT_INJECTOR("proc_kill");
-=======
->>>>>>> REL_16_9
/* not safe if forked by system(), etc. */
if (MyProc->pid != (int) getpid())
elog(PANIC, "ProcKill() called in child process");
@@ -1098,7 +1069,6 @@ ProcKill(int code, Datum arg)
/* Cancel any pending condition variable sleep, too */
ConditionVariableCancelSleep();
-<<<<<<< HEAD
MyProc->localDistribXactData.state = LOCALDISTRIBXACT_STATE_NONE;
MyProc->mppLocalProcessSerial = 0;
MyProc->mppSessionId = InvalidGpSessionId;
@@ -1106,16 +1076,6 @@ ProcKill(int code, Datum arg)
MyProc->pid = 0;
/* Cancel any pending condition variable sleep, too */
ConditionVariableCancelSleep();
-
- /* Make sure active replication slots are released */
- if (MyReplicationSlot != NULL)
- ReplicationSlotRelease();
-
- /* Also cleanup all the temporary slots. */
- ReplicationSlotCleanup();
-
-=======
->>>>>>> REL_16_9
/*
* Detach from any lock group of which we are a member. If the leader
* exits before all other group members, its PGPROC will remain
allocated
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]