public inbox for [email protected]  
help / color / mirror / Atom feed
Re: [PoC] Federated Authn/z with OAUTHBEARER
11+ messages / 5 participants
[nested] [flat]

* Re: [PoC] Federated Authn/z with OAUTHBEARER
@ 2023-05-23 11:22 Daniele Varrazzo <[email protected]>
  2023-05-23 15:56 ` Re: [PoC] Federated Authn/z with OAUTHBEARER Jacob Champion <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Daniele Varrazzo @ 2023-05-23 11:22 UTC (permalink / raw)
  To: Jacob Champion <[email protected]>; +Cc: pgsql-hackers; mahendrakar s <[email protected]>; Andrey Chudnovsky <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Stephen Frost <[email protected]>

On Sat, 20 May 2023 at 00:01, Jacob Champion <[email protected]> wrote:

> - Some clients in the wild (psycopg2/psycopg) suppress all notifications
> during PQconnectPoll().

If there is anything we can improve in psycopg please reach out.

-- Daniele






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [PoC] Federated Authn/z with OAUTHBEARER
  2023-05-23 11:22 Re: [PoC] Federated Authn/z with OAUTHBEARER Daniele Varrazzo <[email protected]>
@ 2023-05-23 15:56 ` Jacob Champion <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: Jacob Champion @ 2023-05-23 15:56 UTC (permalink / raw)
  To: Daniele Varrazzo <[email protected]>; +Cc: pgsql-hackers; mahendrakar s <[email protected]>; Andrey Chudnovsky <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Stephen Frost <[email protected]>

On Tue, May 23, 2023 at 4:22 AM Daniele Varrazzo
<[email protected]> wrote:
> On Sat, 20 May 2023 at 00:01, Jacob Champion <[email protected]> wrote:
> > - Some clients in the wild (psycopg2/psycopg) suppress all notifications
> > during PQconnectPoll().
>
> If there is anything we can improve in psycopg please reach out.

Will do, thank you! But in this case, I think there's nothing to
improve in psycopg -- in fact, it highlighted the problem with my
initial design, and now I think the notice processor will never be an
appropriate avenue for communication of the user code.

The biggest issue is that there's a chicken-and-egg situation: if
you're using the synchronous PQconnect* API, you can't override the
notice hooks while the handshake is in progress, because you don't
have a connection handle yet. The second problem is that there are a
bunch of parameters coming back from the server (user code,
verification URI, expiration time) that the application may choose to
display or use, and communicating those pieces in a (probably already
translated) flat text string is a pretty hostile API.

So I think we'll probably need to provide a global handler API,
similar to the passphrase hook we currently provide, that can receive
these pieces separately and assemble them however the application
desires. The hard part will be to avoid painting ourselves into a
corner, because this particular information is specific to the device
authorization flow, and if we ever want to add other flows into libpq,
we'll probably not want to add even more hooks.

Thanks,
--Jacob






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* [PATCH v3] Rework redundant loop in subtrans.c
@ 2024-03-04 10:49 Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: Alvaro Herrera @ 2024-03-04 10:49 UTC (permalink / raw)

---
 src/backend/access/transam/subtrans.c | 29 +++++++--------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index dc9566fb51..50bb1d8cfc 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -311,7 +311,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	FullTransactionId nextXid;
 	int64		startPage;
 	int64		endPage;
-	LWLock	   *prevlock;
+	LWLock	   *prevlock = NULL;
 	LWLock	   *lock;
 
 	/*
@@ -324,42 +324,27 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	nextXid = TransamVariables->nextXid;
 	endPage = TransactionIdToPage(XidFromFullTransactionId(nextXid));
 
-	prevlock = SimpleLruGetBankLock(SubTransCtl, startPage);
-	LWLockAcquire(prevlock, LW_EXCLUSIVE);
-	while (startPage != endPage)
+	for (;;)
 	{
 		lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-		/*
-		 * Check if we need to acquire the lock on the new bank then release
-		 * the lock on the old bank and acquire on the new bank.
-		 */
 		if (prevlock != lock)
 		{
-			LWLockRelease(prevlock);
+			if (prevlock)
+				LWLockRelease(prevlock);
 			LWLockAcquire(lock, LW_EXCLUSIVE);
 			prevlock = lock;
 		}
 
 		(void) ZeroSUBTRANSPage(startPage);
+		if (startPage == endPage)
+			break;
+
 		startPage++;
 		/* must account for wraparound */
 		if (startPage > TransactionIdToPage(MaxTransactionId))
 			startPage = 0;
 	}
 
-	lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-	/*
-	 * Check if we need to acquire the lock on the new bank then release the
-	 * lock on the old bank and acquire on the new bank.
-	 */
-	if (prevlock != lock)
-	{
-		LWLockRelease(prevlock);
-		LWLockAcquire(lock, LW_EXCLUSIVE);
-	}
-	(void) ZeroSUBTRANSPage(startPage);
 	LWLockRelease(lock);
 }
 
-- 
2.39.2


--r4q4lfzvecohuykp--





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* [PATCH v2 2/3] Rework redundant loop in subtrans.c
@ 2024-03-04 10:49 Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: Alvaro Herrera @ 2024-03-04 10:49 UTC (permalink / raw)

---
 src/backend/access/transam/subtrans.c | 28 +++++----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index dc9566fb51..1455cdf54a 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -311,7 +311,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	FullTransactionId nextXid;
 	int64		startPage;
 	int64		endPage;
-	LWLock	   *prevlock;
+	LWLock	   *prevlock = NULL;
 	LWLock	   *lock;
 
 	/*
@@ -324,19 +324,13 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	nextXid = TransamVariables->nextXid;
 	endPage = TransactionIdToPage(XidFromFullTransactionId(nextXid));
 
-	prevlock = SimpleLruGetBankLock(SubTransCtl, startPage);
-	LWLockAcquire(prevlock, LW_EXCLUSIVE);
-	while (startPage != endPage)
+	do
 	{
 		lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-		/*
-		 * Check if we need to acquire the lock on the new bank then release
-		 * the lock on the old bank and acquire on the new bank.
-		 */
 		if (prevlock != lock)
 		{
-			LWLockRelease(prevlock);
+			if (prevlock)
+				LWLockRelease(prevlock);
 			LWLockAcquire(lock, LW_EXCLUSIVE);
 			prevlock = lock;
 		}
@@ -346,20 +340,8 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 		/* must account for wraparound */
 		if (startPage > TransactionIdToPage(MaxTransactionId))
 			startPage = 0;
-	}
+	} while (startPage != endPage);
 
-	lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-	/*
-	 * Check if we need to acquire the lock on the new bank then release the
-	 * lock on the old bank and acquire on the new bank.
-	 */
-	if (prevlock != lock)
-	{
-		LWLockRelease(prevlock);
-		LWLockAcquire(lock, LW_EXCLUSIVE);
-	}
-	(void) ZeroSUBTRANSPage(startPage);
 	LWLockRelease(lock);
 }
 
-- 
2.39.2


--gflnge3qfnp343ni
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
	filename="v2-0003-Simplify-coding-in-slru.c.patch"



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* [PATCH v3] Rework redundant loop in subtrans.c
@ 2024-03-04 10:49 Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: Alvaro Herrera @ 2024-03-04 10:49 UTC (permalink / raw)

---
 src/backend/access/transam/subtrans.c | 29 +++++++--------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index dc9566fb51..50bb1d8cfc 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -311,7 +311,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	FullTransactionId nextXid;
 	int64		startPage;
 	int64		endPage;
-	LWLock	   *prevlock;
+	LWLock	   *prevlock = NULL;
 	LWLock	   *lock;
 
 	/*
@@ -324,42 +324,27 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	nextXid = TransamVariables->nextXid;
 	endPage = TransactionIdToPage(XidFromFullTransactionId(nextXid));
 
-	prevlock = SimpleLruGetBankLock(SubTransCtl, startPage);
-	LWLockAcquire(prevlock, LW_EXCLUSIVE);
-	while (startPage != endPage)
+	for (;;)
 	{
 		lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-		/*
-		 * Check if we need to acquire the lock on the new bank then release
-		 * the lock on the old bank and acquire on the new bank.
-		 */
 		if (prevlock != lock)
 		{
-			LWLockRelease(prevlock);
+			if (prevlock)
+				LWLockRelease(prevlock);
 			LWLockAcquire(lock, LW_EXCLUSIVE);
 			prevlock = lock;
 		}
 
 		(void) ZeroSUBTRANSPage(startPage);
+		if (startPage == endPage)
+			break;
+
 		startPage++;
 		/* must account for wraparound */
 		if (startPage > TransactionIdToPage(MaxTransactionId))
 			startPage = 0;
 	}
 
-	lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-	/*
-	 * Check if we need to acquire the lock on the new bank then release the
-	 * lock on the old bank and acquire on the new bank.
-	 */
-	if (prevlock != lock)
-	{
-		LWLockRelease(prevlock);
-		LWLockAcquire(lock, LW_EXCLUSIVE);
-	}
-	(void) ZeroSUBTRANSPage(startPage);
 	LWLockRelease(lock);
 }
 
-- 
2.39.2


--r4q4lfzvecohuykp--





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* [PATCH v2 2/3] Rework redundant loop in subtrans.c
@ 2024-03-04 10:49 Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: Alvaro Herrera @ 2024-03-04 10:49 UTC (permalink / raw)

---
 src/backend/access/transam/subtrans.c | 28 +++++----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index dc9566fb51..1455cdf54a 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -311,7 +311,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	FullTransactionId nextXid;
 	int64		startPage;
 	int64		endPage;
-	LWLock	   *prevlock;
+	LWLock	   *prevlock = NULL;
 	LWLock	   *lock;
 
 	/*
@@ -324,19 +324,13 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	nextXid = TransamVariables->nextXid;
 	endPage = TransactionIdToPage(XidFromFullTransactionId(nextXid));
 
-	prevlock = SimpleLruGetBankLock(SubTransCtl, startPage);
-	LWLockAcquire(prevlock, LW_EXCLUSIVE);
-	while (startPage != endPage)
+	do
 	{
 		lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-		/*
-		 * Check if we need to acquire the lock on the new bank then release
-		 * the lock on the old bank and acquire on the new bank.
-		 */
 		if (prevlock != lock)
 		{
-			LWLockRelease(prevlock);
+			if (prevlock)
+				LWLockRelease(prevlock);
 			LWLockAcquire(lock, LW_EXCLUSIVE);
 			prevlock = lock;
 		}
@@ -346,20 +340,8 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 		/* must account for wraparound */
 		if (startPage > TransactionIdToPage(MaxTransactionId))
 			startPage = 0;
-	}
+	} while (startPage != endPage);
 
-	lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-	/*
-	 * Check if we need to acquire the lock on the new bank then release the
-	 * lock on the old bank and acquire on the new bank.
-	 */
-	if (prevlock != lock)
-	{
-		LWLockRelease(prevlock);
-		LWLockAcquire(lock, LW_EXCLUSIVE);
-	}
-	(void) ZeroSUBTRANSPage(startPage);
 	LWLockRelease(lock);
 }
 
-- 
2.39.2


--gflnge3qfnp343ni
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
	filename="v2-0003-Simplify-coding-in-slru.c.patch"



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* [PATCH v2 2/3] Rework redundant loop in subtrans.c
@ 2024-03-04 10:49 Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: Alvaro Herrera @ 2024-03-04 10:49 UTC (permalink / raw)

---
 src/backend/access/transam/subtrans.c | 28 +++++----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index dc9566fb51..1455cdf54a 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -311,7 +311,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	FullTransactionId nextXid;
 	int64		startPage;
 	int64		endPage;
-	LWLock	   *prevlock;
+	LWLock	   *prevlock = NULL;
 	LWLock	   *lock;
 
 	/*
@@ -324,19 +324,13 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	nextXid = TransamVariables->nextXid;
 	endPage = TransactionIdToPage(XidFromFullTransactionId(nextXid));
 
-	prevlock = SimpleLruGetBankLock(SubTransCtl, startPage);
-	LWLockAcquire(prevlock, LW_EXCLUSIVE);
-	while (startPage != endPage)
+	do
 	{
 		lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-		/*
-		 * Check if we need to acquire the lock on the new bank then release
-		 * the lock on the old bank and acquire on the new bank.
-		 */
 		if (prevlock != lock)
 		{
-			LWLockRelease(prevlock);
+			if (prevlock)
+				LWLockRelease(prevlock);
 			LWLockAcquire(lock, LW_EXCLUSIVE);
 			prevlock = lock;
 		}
@@ -346,20 +340,8 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 		/* must account for wraparound */
 		if (startPage > TransactionIdToPage(MaxTransactionId))
 			startPage = 0;
-	}
+	} while (startPage != endPage);
 
-	lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-	/*
-	 * Check if we need to acquire the lock on the new bank then release the
-	 * lock on the old bank and acquire on the new bank.
-	 */
-	if (prevlock != lock)
-	{
-		LWLockRelease(prevlock);
-		LWLockAcquire(lock, LW_EXCLUSIVE);
-	}
-	(void) ZeroSUBTRANSPage(startPage);
 	LWLockRelease(lock);
 }
 
-- 
2.39.2


--gflnge3qfnp343ni
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
	filename="v2-0003-Simplify-coding-in-slru.c.patch"



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* [PATCH v3] Rework redundant loop in subtrans.c
@ 2024-03-04 10:49 Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: Alvaro Herrera @ 2024-03-04 10:49 UTC (permalink / raw)

---
 src/backend/access/transam/subtrans.c | 29 +++++++--------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index dc9566fb51..50bb1d8cfc 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -311,7 +311,7 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	FullTransactionId nextXid;
 	int64		startPage;
 	int64		endPage;
-	LWLock	   *prevlock;
+	LWLock	   *prevlock = NULL;
 	LWLock	   *lock;
 
 	/*
@@ -324,42 +324,27 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
 	nextXid = TransamVariables->nextXid;
 	endPage = TransactionIdToPage(XidFromFullTransactionId(nextXid));
 
-	prevlock = SimpleLruGetBankLock(SubTransCtl, startPage);
-	LWLockAcquire(prevlock, LW_EXCLUSIVE);
-	while (startPage != endPage)
+	for (;;)
 	{
 		lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-		/*
-		 * Check if we need to acquire the lock on the new bank then release
-		 * the lock on the old bank and acquire on the new bank.
-		 */
 		if (prevlock != lock)
 		{
-			LWLockRelease(prevlock);
+			if (prevlock)
+				LWLockRelease(prevlock);
 			LWLockAcquire(lock, LW_EXCLUSIVE);
 			prevlock = lock;
 		}
 
 		(void) ZeroSUBTRANSPage(startPage);
+		if (startPage == endPage)
+			break;
+
 		startPage++;
 		/* must account for wraparound */
 		if (startPage > TransactionIdToPage(MaxTransactionId))
 			startPage = 0;
 	}
 
-	lock = SimpleLruGetBankLock(SubTransCtl, startPage);
-
-	/*
-	 * Check if we need to acquire the lock on the new bank then release the
-	 * lock on the old bank and acquire on the new bank.
-	 */
-	if (prevlock != lock)
-	{
-		LWLockRelease(prevlock);
-		LWLockAcquire(lock, LW_EXCLUSIVE);
-	}
-	(void) ZeroSUBTRANSPage(startPage);
 	LWLockRelease(lock);
 }
 
-- 
2.39.2


--r4q4lfzvecohuykp--





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* [PATCH] Expose checkpoint reason to completion log messages.
@ 2025-12-01 11:18 Soumya S Murali <[email protected]>
  2025-12-18 00:19 ` Re: [PATCH] Expose checkpoint reason to completion log messages. Andres Freund <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Soumya S Murali @ 2025-12-01 11:18 UTC (permalink / raw)
  To: Michael Banck <[email protected]>; PostgreSQL Hackers <[email protected]>; +Cc: Álvaro Herrera <[email protected]>; [email protected]; [email protected]

Hi all,

This patch is an update after reworking the “checkpoint reason” changes as
a standalone patch, separate from the pg_stat_checkpointer additions as
suggested [1]. I applied the patch on a clean tree and verified that the
logging changes work as expected under different workloads. I am attaching
the observations and patch in support for this.This would improve clarity
for performance debugging and help understand checkpoint behavior without
parsing WAL logs manually. Below is one representative checkpoint log entry
after a pgbench run and an explicit CHECKPOINT:

2025-12-01 15:33:30.121 IST [69178] LOG:  checkpoint complete (immediate):
wrote 3417 buffers (20.9%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0
removed, 1 recycled; write=0.122 s, sync=0.022 s, total=0.166 s; sync
files=9, longest=0.005 s, average=0.003 s; distance=31304 kB,
estimate=489729 kB; lsn=0/65E92BC8, redo lsn=0/65E92B70

Regarding the pg_stat_checkpointer extensions [1], I understand the
concerns that were raised and I will follow up with a separate full patch
once I incorporate the remaining feedback.
Thank you for the guidance. It has been very helpful. Looking forward to
more further feedback.

Regards,
Soumya

Reference
[1]
https://www.postgresql.org/message-id/flat/CAMtXxw_W6w2Q1QsCvMPnoq3xCMKzH28Zjk_EmL60oP%2BsCTkXOw%40m...


Attachments:

  [text/x-patch] 0001-Expose-checkpoint-reason-to-completion-log-messages.patch (3.4K, ../../CAMtXxw9tPwV=NBv5S9GZXMSKPeKv5f9hRhSjZ8__oLsoS5jcuA@mail.gmail.com/3-0001-Expose-checkpoint-reason-to-completion-log-messages.patch)
  download | inline diff:
From 4045d7366171a1e512429ac8feb217d8a1199362 Mon Sep 17 00:00:00 2001
From: Soumya <[email protected]>
Date: Mon, 1 Dec 2025 16:17:35 +0530
Subject: [PATCH] Expose checkpoint reason to completion log messages

Signed-off-by: Soumya <[email protected]>
---
 src/backend/access/transam/xlog.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 22d0a2e8c3..f699c79c71 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6750,7 +6750,7 @@ LogCheckpointStart(int flags, bool restartpoint)
  * Log end of a checkpoint.
  */
 static void
-LogCheckpointEnd(bool restartpoint)
+LogCheckpointEnd(bool restartpoint, int flags)
 {
 	long		write_msecs,
 				sync_msecs,
@@ -6758,6 +6758,16 @@ LogCheckpointEnd(bool restartpoint)
 				longest_msecs,
 				average_msecs;
 	uint64		average_sync_time;
+	const char *ckpt_reason = "timed";
+   	/* Determine checkpoint reason */
+   	if (flags & CHECKPOINT_IS_SHUTDOWN)
+       ckpt_reason = "shutdown";
+   	else if (flags & CHECKPOINT_END_OF_RECOVERY)
+       ckpt_reason = "end-of-recovery";
+   	else if (flags & CHECKPOINT_FAST)
+       ckpt_reason = "immediate";
+   	else if (flags & CHECKPOINT_FORCE)
+       ckpt_reason = "forced";
 
 	CheckpointStats.ckpt_end_t = GetCurrentTimestamp();
 
@@ -6800,12 +6810,13 @@ LogCheckpointEnd(bool restartpoint)
 	 */
 	if (restartpoint)
 		ereport(LOG,
-				(errmsg("restartpoint complete: wrote %d buffers (%.1f%%), "
+				(errmsg("restartpoint complete (%s): wrote %d buffers (%.1f%%), "
 						"wrote %d SLRU buffers; %d WAL file(s) added, "
 						"%d removed, %d recycled; write=%ld.%03d s, "
 						"sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, "
 						"longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, "
 						"estimate=%d kB; lsn=%X/%08X, redo lsn=%X/%08X",
+						ckpt_reason,
 						CheckpointStats.ckpt_bufs_written,
 						(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
 						CheckpointStats.ckpt_slru_written,
@@ -6824,12 +6835,13 @@ LogCheckpointEnd(bool restartpoint)
 						LSN_FORMAT_ARGS(ControlFile->checkPointCopy.redo))));
 	else
 		ereport(LOG,
-				(errmsg("checkpoint complete: wrote %d buffers (%.1f%%), "
+				(errmsg("checkpoint complete (%s): wrote %d buffers (%.1f%%), "
 						"wrote %d SLRU buffers; %d WAL file(s) added, "
 						"%d removed, %d recycled; write=%ld.%03d s, "
 						"sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, "
 						"longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, "
 						"estimate=%d kB; lsn=%X/%08X, redo lsn=%X/%08X",
+						ckpt_reason,
 						CheckpointStats.ckpt_bufs_written,
 						(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
 						CheckpointStats.ckpt_slru_written,
@@ -7418,7 +7430,7 @@ CreateCheckPoint(int flags)
 		TruncateSUBTRANS(GetOldestTransactionIdConsideredRunning());
 
 	/* Real work is done; log and update stats. */
-	LogCheckpointEnd(false);
+	LogCheckpointEnd(false, flags);
 
 	/* Reset the process title */
 	update_checkpoint_display(flags, false, true);
@@ -7886,7 +7898,7 @@ CreateRestartPoint(int flags)
 		TruncateSUBTRANS(GetOldestTransactionIdConsideredRunning());
 
 	/* Real work is done; log and update stats. */
-	LogCheckpointEnd(true);
+	LogCheckpointEnd(true, flags);
 
 	/* Reset the process title */
 	update_checkpoint_display(flags, true, true);
-- 
2.34.1



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [PATCH] Expose checkpoint reason to completion log messages.
  2025-12-01 11:18 [PATCH] Expose checkpoint reason to completion log messages. Soumya S Murali <[email protected]>
@ 2025-12-18 00:19 ` Andres Freund <[email protected]>
  2025-12-18 04:46   ` Re: [PATCH] Expose checkpoint reason to completion log messages. Soumya S Murali <[email protected]>
  0 siblings, 1 reply; 11+ messages in thread

From: Andres Freund @ 2025-12-18 00:19 UTC (permalink / raw)
  To: Soumya S Murali <[email protected]>; +Cc: Michael Banck <[email protected]>; PostgreSQL Hackers <[email protected]>; Álvaro Herrera <[email protected]>; [email protected]; [email protected]

Hi,

On 2025-12-01 16:48:56 +0530, Soumya S Murali wrote:
> This patch is an update after reworking the “checkpoint reason” changes as
> a standalone patch, separate from the pg_stat_checkpointer additions as
> suggested [1].

This seems to not pass the tests on any platform:
https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F6306

Looks like you need to update 019_replslot_limit.pl for the changed log
format.

I suggest running the tests before submitting.

Greetings,

Andres





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [PATCH] Expose checkpoint reason to completion log messages.
  2025-12-01 11:18 [PATCH] Expose checkpoint reason to completion log messages. Soumya S Murali <[email protected]>
  2025-12-18 00:19 ` Re: [PATCH] Expose checkpoint reason to completion log messages. Andres Freund <[email protected]>
@ 2025-12-18 04:46   ` Soumya S Murali <[email protected]>
  0 siblings, 0 replies; 11+ messages in thread

From: Soumya S Murali @ 2025-12-18 04:46 UTC (permalink / raw)
  To: Andres Freund <[email protected]>; +Cc: Michael Banck <[email protected]>; PostgreSQL Hackers <[email protected]>; Álvaro Herrera <[email protected]>; [email protected]; [email protected]

Hi Andres,


On Thu, Dec 18, 2025 at 5:49 AM Andres Freund <[email protected]> wrote:
>
> Hi,
>
> On 2025-12-01 16:48:56 +0530, Soumya S Murali wrote:
> > This patch is an update after reworking the “checkpoint reason” changes as
> > a standalone patch, separate from the pg_stat_checkpointer additions as
> > suggested [1].
>
> This seems to not pass the tests on any platform:
> https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F6306
>
> Looks like you need to update 019_replslot_limit.pl for the changed log
> format.
>
> I suggest running the tests before submitting.
>
> Greetings,
>
> Andres


Thank you for checking and for pointing this out. I will fix the
expected log pattern, rerun the test, and will resend an updated patch
once all tests get passed.

Regards,
Soumya





^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2025-12-18 04:46 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23 11:22 Re: [PoC] Federated Authn/z with OAUTHBEARER Daniele Varrazzo <[email protected]>
2023-05-23 15:56 ` Jacob Champion <[email protected]>
2024-03-04 10:49 [PATCH v3] Rework redundant loop in subtrans.c Alvaro Herrera <[email protected]>
2024-03-04 10:49 [PATCH v2 2/3] Rework redundant loop in subtrans.c Alvaro Herrera <[email protected]>
2024-03-04 10:49 [PATCH v3] Rework redundant loop in subtrans.c Alvaro Herrera <[email protected]>
2024-03-04 10:49 [PATCH v2 2/3] Rework redundant loop in subtrans.c Alvaro Herrera <[email protected]>
2024-03-04 10:49 [PATCH v2 2/3] Rework redundant loop in subtrans.c Alvaro Herrera <[email protected]>
2024-03-04 10:49 [PATCH v3] Rework redundant loop in subtrans.c Alvaro Herrera <[email protected]>
2025-12-01 11:18 [PATCH] Expose checkpoint reason to completion log messages. Soumya S Murali <[email protected]>
2025-12-18 00:19 ` Re: [PATCH] Expose checkpoint reason to completion log messages. Andres Freund <[email protected]>
2025-12-18 04:46   ` Re: [PATCH] Expose checkpoint reason to completion log messages. Soumya S Murali <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox