May cause infinite loop when initializing rel-cache contains partitioned table

From: 甄明洋 <18612389267(at)yeah(dot)net>
To: pg开发者 <pgsql-hackers(at)postgresql(dot)org>
Subject: May cause infinite loop when initializing rel-cache contains partitioned table
Date: 2017-05-05 08:26:26
Message-ID: 57bd1e1.1886.15bd7b79cee.Coremail.18612389267@yeah.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The function of initializing rel-cache is RelationCacheInitializePhase3 and in src/backend/utils/cache/relcache.c file.
When initializing the partition description information, we forget to check if partition key or descriptor is NULL.
Therefore, after the loop restarts, the partition information will be initialized again, resulting in an infinite loop.
Code:
/*
* Reload partition key and descriptor for a partitioned table.
*/
if (relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
{
RelationBuildPartitionKey(relation);
Assert(relation->rd_partkey != NULL);

RelationBuildPartitionDesc(relation);
Assert(relation->rd_partdesc != NULL);

restart = true;
}

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavan Deolasee 2017-05-05 08:33:33 Re: logical replication and PANIC during shutdown checkpoint in publisher
Previous Message Magnus Hagander 2017-05-05 08:26:07 Re: Error message on missing SCRAM authentication with older clients