pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: pgsql-hackers@lists.postgresql.org, Jaime Casanova <jcasanov@systemguards.com.ec>
Subject: Re: LogwrtResult contended spinlock
Date: Sat, 29 Jun 2024 12:23:02 +0200
Message-ID: <202406291023.6plsxeg2zho7@alvherre.pgsql> (raw)
In-Reply-To: <36796438-a718-cf9b-2071-b2c1b947c1b5@gmail.com>

Hi

On 2024-Jun-29, Alexander Lakhin wrote:

> ----------------------------------- stderr -----------------------------------
> TRAP: failed Assert("TYPEALIGN(8, (uintptr_t)(&currval)) ==
> (uintptr_t)(&currval)"), File: "...\src\include\port/atomics.h", Line: 597,
> PID: 7556
> child process was terminated by exception 0xC0000409

Oh.  This is the new assertion in pg_atomic_monotonic_advance_u64() and
therefore the only possible culprit could be logInsertResult in
XLogCtlData.  Does it work if you do this?

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 8dcdf5a764..e581488d57 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -468,7 +468,7 @@ typedef struct XLogCtlData
 	XLogRecPtr	lastSegSwitchLSN;
 
 	/* These are accessed using atomics -- info_lck not needed */
-	pg_atomic_uint64 logInsertResult;	/* last byte + 1 inserted to buffers */
+	pg_atomic_uint64 logInsertResult pg_attribute_aligned(8);	/* last byte + 1 inserted to buffers */
 	pg_atomic_uint64 logWriteResult;	/* last byte + 1 written out */
 	pg_atomic_uint64 logFlushResult;	/* last byte + 1 flushed */
 

Thanks

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Use it up, wear it out, make it do, or do without"





view thread (74+ messages)  latest in thread

Message-ID: <202406291023.6plsxeg2zho7@alvherre.pgsql>
Permalink:  ../202406291023.6plsxeg2zho7@alvherre.pgsql/
Also on:    postgresql.org/message-id/202406291023.6plsxeg2zho7@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, exclusion@gmail.com, bharath.rupireddyforpostgres@gmail.com, tgl@sss.pgh.pa.us, andres@anarazel.de, pgsql@j-davis.com, jcasanov@systemguards.com.ec
  Subject: Re: LogwrtResult contended spinlock
  In-Reply-To: <202406291023.6plsxeg2zho7@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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