pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: 甄明洋 <18612389267@yeah.net>
To: pg开发者 <pgsql-hackers@postgresql.org>
Subject: May cause infinite loop when initializing rel-cache contains partitioned table
Date: Fri, 5 May 2017 16:26:26 +0800 (CST)
Message-ID: <57bd1e1.1886.15bd7b79cee.Coremail.18612389267@yeah.net> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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;
}

view thread (3+ messages)  latest in thread

Message-ID: <57bd1e1.1886.15bd7b79cee.Coremail.18612389267@yeah.net>
Permalink:  ../57bd1e1.1886.15bd7b79cee.Coremail.18612389267@yeah.net/
Also on:    postgresql.org/message-id/57bd1e1.1886.15bd7b79cee.Coremail.18612389267@yeah.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: 18612389267@yeah.net
  Subject: Re: May cause infinite loop when initializing rel-cache contains partitioned table
  In-Reply-To: <57bd1e1.1886.15bd7b79cee.Coremail.18612389267@yeah.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox