[PATCH] Infinite loop while acquiring new TOAST Oid - Mailing list pgsql-hackers

From Nikita Malakhov
Subject [PATCH] Infinite loop while acquiring new TOAST Oid
Date
Msg-id CAN-LCVPRvRzxeUdYdDCZ7UwZQs1NmZpqBUCd=+RdMPFTyt-bRQ@mail.gmail.com
Whole thread Raw
Responses Re: [PATCH] Infinite loop while acquiring new TOAST Oid
List pgsql-hackers
Hi hackers!

While working on Pluggable TOAST we've detected a defective behavior
on tables with large amounts of TOASTed data - queries freeze and DB stalls.
Further investigation led us to the loop with GetNewOidWithIndex function
call - when all available Oid already exist in the related TOAST table this
loop continues infinitely. Data type used for value ID is the UINT32, which is
unsigned int and has a maximum value of 4294967295 which allows
maximum 4294967295 records in the TOAST table. It is not a very big amount
for modern databases and is the major problem for productive systems.

Quick fix for this problem is limiting GetNewOidWithIndex loops to some
reasonable amount defined by related macro and returning error if there is
still no available Oid. Please check attached patch, any feedback is appreciated.

--
Regards,
Nikita Malakhov
Postgres Professional 
Attachment

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Bug in wait time when waiting on nested subtransaction
Next
From: Robert Haas
Date:
Subject: Re: fixing CREATEROLE