pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedUse MaxLockMode in lock methods initialization
3+ messages / 3 participants
[nested] [flat]
Commits from this thread:
2022-01-03 ba2bc4a7ba Use MaxLockMode symbol in more places.
* Use MaxLockMode in lock methods initialization
@ 2022-01-03 06:47 Julien Rouhaud <rjuju123@gmail.com>
2022-01-03 08:00 ` Re: Use MaxLockMode in lock methods initialization Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 3+ messages in thread
From: Julien Rouhaud @ 2022-01-03 06:47 UTC (permalink / raw)
To: pgsql-hackers@lists.postgresql.org
Hi,
While reading some code around I noticed that b04aeb0a053e7 added a MaxLockMode
but didn't update the lock methods initialization. It shouldn't make much
difference in the long run but some consistency seems better to me.
Attachments:
0001-Use-MaxLockMode-in-LockMethodData-initialization.patch (text/plain, 1.2K) download
From 1a3de43f4ed75466413ffcd884678332960c2520 Mon Sep 17 00:00:00 2001
From: Julien Rouhaud <julien.rouhaud@free.fr>
Date: Mon, 3 Jan 2022 12:19:11 +0800
Subject: [PATCH] Use MaxLockMode in LockMethodData initialization.
Commit b04aeb0a053e7 added a MaxLockMode to hold the highest lock mode so let's
use it here too.
---
src/backend/storage/lmgr/lock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index c25af7fe09..2e985df5af 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -124,7 +124,7 @@ static bool Dummy_trace = false;
#endif
static const LockMethodData default_lockmethod = {
- AccessExclusiveLock, /* highest valid lock mode number */
+ MaxLockMode, /* highest valid lock mode number */
LockConflicts,
lock_mode_names,
#ifdef LOCK_DEBUG
@@ -135,7 +135,7 @@ static const LockMethodData default_lockmethod = {
};
static const LockMethodData user_lockmethod = {
- AccessExclusiveLock, /* highest valid lock mode number */
+ MaxLockMode, /* highest valid lock mode number */
LockConflicts,
lock_mode_names,
#ifdef LOCK_DEBUG
--
2.33.1
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Use MaxLockMode in lock methods initialization
2022-01-03 06:47 Use MaxLockMode in lock methods initialization Julien Rouhaud <rjuju123@gmail.com>
@ 2022-01-03 08:00 ` Michael Paquier <michael@paquier.xyz>
2022-01-03 17:27 ` Re: Use MaxLockMode in lock methods initialization Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Paquier @ 2022-01-03 08:00 UTC (permalink / raw)
To: Julien Rouhaud <rjuju123@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org
On Mon, Jan 03, 2022 at 02:47:22PM +0800, Julien Rouhaud wrote:
> While reading some code around I noticed that b04aeb0a053e7 added a MaxLockMode
> but didn't update the lock methods initialization. It shouldn't make much
> difference in the long run but some consistency seems better to me.
Makes sense to me. MaxLockMode is here for the same purpose as this
initialization area.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Use MaxLockMode in lock methods initialization
2022-01-03 06:47 Use MaxLockMode in lock methods initialization Julien Rouhaud <rjuju123@gmail.com>
2022-01-03 08:00 ` Re: Use MaxLockMode in lock methods initialization Michael Paquier <michael@paquier.xyz>
@ 2022-01-03 17:27 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2022-01-03 17:27 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: Julien Rouhaud <rjuju123@gmail.com>; pgsql-hackers@lists.postgresql.org
Michael Paquier <michael@paquier.xyz> writes:
> On Mon, Jan 03, 2022 at 02:47:22PM +0800, Julien Rouhaud wrote:
>> While reading some code around I noticed that b04aeb0a053e7 added a MaxLockMode
>> but didn't update the lock methods initialization. It shouldn't make much
>> difference in the long run but some consistency seems better to me.
> Makes sense to me. MaxLockMode is here for the same purpose as this
> initialization area.
Agreed. That aspect of b04aeb0a053e7 was a bit of a quick hack,
and it didn't occur to me to look for other places where the symbol
could be used. But these two places are spot-on for it.
Pushed with a bit of comment-fiddling.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2022-01-03 17:27 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-01-03 06:47 Use MaxLockMode in lock methods initialization Julien Rouhaud <rjuju123@gmail.com>
2022-01-03 08:00 ` Michael Paquier <michael@paquier.xyz>
2022-01-03 17:27 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox