assert violation in logical messages serialization

Started by Stas Kelvichover 9 years ago2 messages
#1Stas Kelvich
s.kelvich@postgrespro.ru
1 attachment(s)

Hello.

During processing of logical messages in ReorderBufferSerializeChange()
pointer to ondisk structure isn’t updated after possible reorder buffer realloc by
ReorderBufferSerializeReserve().

Actual reason spotted by Konstantin Knizhnik.

Attachments:

reorderbuffer.patchapplication/octet-stream; name=reorderbuffer.patchDownload
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 9b430b9..e2a502c 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -2250,6 +2250,9 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
 
 				data = ((char *) rb->outbuf) + sizeof(ReorderBufferDiskChange);
 
+				/* might have been reallocated above */
+				ondisk = (ReorderBufferDiskChange *) rb->outbuf;
+
 				/* write the prefix including the size */
 				memcpy(data, &prefix_size, sizeof(Size));
 				data += sizeof(Size);
#2Robert Haas
robertmhaas@gmail.com
In reply to: Stas Kelvich (#1)
Re: assert violation in logical messages serialization

On Tue, Sep 27, 2016 at 10:45 AM, Stas Kelvich <s.kelvich@postgrespro.ru> wrote:

During processing of logical messages in ReorderBufferSerializeChange()
pointer to ondisk structure isn’t updated after possible reorder buffer realloc by
ReorderBufferSerializeReserve().

Actual reason spotted by Konstantin Knizhnik.

Thanks for the patch, and congratulations to Konstantin on the spot.
Committed and back-patched to 96.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers