Fix bug in the new ResourceOwner implementation. When the hash table is in use, ResoureOwnerSort() moves any elements from the small fixed-size array to the hash table, and sorts it. When the hash table is not in use, it sorts the elements in the small fixed-size array directly. However, ResourceOwnerSort() and ResourceOwnerReleaseAll() had different idea on when the hash table is in use: ResourceOwnerSort() checked owner->nhash != 0, and ResourceOwnerReleaseAll() checked owner->hash != NULL. If the hash table was allocated but was currently empty, you hit an assertion failure.
Reported-by: Alexander Lakhin <[email protected]> Discussion: https://www.postgresql.org/message-id/[email protected] Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/8f4a1ab471e6a258881e3d7f5883705714cde7e1 Modified Files -------------- src/backend/utils/resowner/resowner.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
