[PATCH] Compressed TOAST data corruption with REPACK CONCURRENTLY - Mailing list pgsql-hackers

From SATYANARAYANA NARLAPURAM
Subject [PATCH] Compressed TOAST data corruption with REPACK CONCURRENTLY
Date
Msg-id CAHg+QDeXb9HM2VGKXQedyCp52GzajJK5KOUdNi6oLjsS0nerQw@mail.gmail.com
Whole thread
Responses Re: [PATCH] Compressed TOAST data corruption with REPACK CONCURRENTLY
Re: [PATCH] Compressed TOAST data corruption with REPACK CONCURRENTLY
List pgsql-hackers
Hi hackers,

restore_tuple() in repack.c uses SET_VARSIZE() to reconstruct the varlena header when 
reading back external attributes from the spill file. In this process, looks like the flag 
SET_VARSIZE_COMPRESSED is silently lost. Because of this, when REPACK CONCURRENTLY
run  any concurrently updated column whose value was TOAST-compressed ends up with raw 
compressed bytes behind an "uncompressed" header returning garbled data on subsequent reads.
It appears that existing tests are using random chars which are uncompressable.

Please find the attached 0001-Fix-restore_tuple-losing-varlena-compression-flag.patch to fix this. 
Additionally I updated the existing repack_toast test to include the scenario I was talking about.

Thanks,
Satya
Attachment

pgsql-hackers by date:

Previous
From: Jakub Wartak
Date:
Subject: Re: Add errdetail() with PID and UID about source of termination signal
Next
From: Álvaro Herrera
Date:
Subject: Re: meson html:alias vs. html:custom