Обсуждение: pgsql: Generalize concept of temporary relations to "relation persisten

Поиск
Список
Период
Сортировка

pgsql: Generalize concept of temporary relations to "relation persisten

От
Robert Haas
Дата:
Generalize concept of temporary relations to "relation persistence".

This commit replaces pg_class.relistemp with pg_class.relpersistence;
and also modifies the RangeVar node type to carry relpersistence rather
than istemp.  It also removes removes rd_istemp from RelationData and
instead performs the correct computation based on relpersistence.

For clarity, we add three new macros: RelationNeedsWAL(),
RelationUsesLocalBuffers(), and RelationUsesTempNamespace(), so that we
can clarify the purpose of each check that previous depended on
rd_istemp.

This is intended as infrastructure for the upcoming unlogged tables
patch, as well as for future possible work on global temporary tables.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=5f7b58fad8f45c69bb67944779dce67e2f481995

Modified Files
--------------
src/backend/access/gin/ginbtree.c     |    6 +-
src/backend/access/gin/ginfast.c      |    6 +-
src/backend/access/gin/gininsert.c    |    4 +-
src/backend/access/gin/ginutil.c      |    2 +-
src/backend/access/gin/ginvacuum.c    |    4 +-
src/backend/access/gist/gist.c        |   12 +++---
src/backend/access/gist/gistvacuum.c  |    2 +-
src/backend/access/heap/heapam.c      |   34 +++++++-------
src/backend/access/heap/pruneheap.c   |    2 +-
src/backend/access/heap/rewriteheap.c |    6 +-
src/backend/access/nbtree/nbtinsert.c |    6 +-
src/backend/access/nbtree/nbtpage.c   |   10 ++--
src/backend/access/nbtree/nbtsort.c   |   12 +++---
src/backend/bootstrap/bootparse.y     |    2 +
src/backend/catalog/catalog.c         |   16 ++++++-
src/backend/catalog/heap.c            |   13 +++--
src/backend/catalog/index.c           |   10 +++--
src/backend/catalog/namespace.c       |   12 +++---
src/backend/catalog/storage.c         |   24 ++++++++--
src/backend/catalog/toasting.c        |    3 +-
src/backend/commands/cluster.c        |    5 +-
src/backend/commands/indexcmds.c      |    4 +-
src/backend/commands/sequence.c       |    8 ++--
src/backend/commands/tablecmds.c      |   79 ++++++++++++++++++--------------
src/backend/commands/tablespace.c     |    8 ++--
src/backend/commands/vacuumlazy.c     |   11 ++---
src/backend/commands/view.c           |   13 +++---
src/backend/executor/execMain.c       |    9 +++-
src/backend/nodes/copyfuncs.c         |    2 +-
src/backend/nodes/equalfuncs.c        |    2 +-
src/backend/nodes/makefuncs.c         |    3 +-
src/backend/nodes/outfuncs.c          |    2 +-
src/backend/nodes/readfuncs.c         |    2 +-
src/backend/parser/gram.y             |   61 ++++++++++++-------------
src/backend/parser/parse_utilcmd.c    |    7 ++-
src/backend/postmaster/autovacuum.c   |    4 +-
src/backend/storage/buffer/bufmgr.c   |    4 +-
src/backend/utils/adt/dbsize.c        |   28 ++++++++----
src/backend/utils/cache/relcache.c    |   71 ++++++++++++++++++-----------
src/include/catalog/catalog.h         |    2 +-
src/include/catalog/catversion.h      |    2 +-
src/include/catalog/heap.h            |    2 +
src/include/catalog/pg_class.h        |   15 ++++---
src/include/catalog/storage.h         |    2 +-
src/include/commands/tablespace.h     |    2 +-
src/include/nodes/primnodes.h         |    2 +-
src/include/utils/rel.h               |   25 ++++++++++-
src/include/utils/relcache.h          |    3 +-
48 files changed, 334 insertions(+), 230 deletions(-)


Re: pgsql: Generalize concept of temporary relations to "relation persisten

От
Tom Lane
Дата:
Robert Haas <rhaas@postgresql.org> writes:
> Generalize concept of temporary relations to "relation persistence".

It's extremely hard to believe that this patch required no documentation
changes whatsoever.

> This commit replaces pg_class.relistemp with pg_class.relpersistence;

At the very least, catalogs.sgml requires a fix for that.

            regards, tom lane

Re: pgsql: Generalize concept of temporary relations to "relation persisten

От
Robert Haas
Дата:
On Mon, Dec 13, 2010 at 12:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <rhaas@postgresql.org> writes:
>> Generalize concept of temporary relations to "relation persistence".
>
> It's extremely hard to believe that this patch required no documentation
> changes whatsoever.
>
>> This commit replaces pg_class.relistemp with pg_class.relpersistence;
>
> At the very least, catalogs.sgml requires a fix for that.

Woops.  OK, will fix.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: pgsql: Generalize concept of temporary relations to "relation persisten

От
Robert Haas
Дата:
On Mon, Dec 13, 2010 at 12:40 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Mon, Dec 13, 2010 at 12:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Robert Haas <rhaas@postgresql.org> writes:
>>> Generalize concept of temporary relations to "relation persistence".
>>
>> It's extremely hard to believe that this patch required no documentation
>> changes whatsoever.
>>
>>> This commit replaces pg_class.relistemp with pg_class.relpersistence;
>>
>> At the very least, catalogs.sgml requires a fix for that.
>
> Woops.  OK, will fix.

Based on a little grepping, that's the only thing I see.  I'll push a
fix for that.  Do you see anything else?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: pgsql: Generalize concept of temporary relations to "relation persisten

От
Tom Lane
Дата:
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Dec 13, 2010 at 12:40 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>> On Mon, Dec 13, 2010 at 12:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> At the very least, catalogs.sgml requires a fix for that.
>>
>> Woops. �OK, will fix.

> Based on a little grepping, that's the only thing I see.  I'll push a
> fix for that.  Do you see anything else?

My grep agrees that relistemp, per se, is only referenced in one place
in catalogs.sgml.  But are you sure that, for example, storage.sgml
doesn't need any updates?

            regards, tom lane

Re: pgsql: Generalize concept of temporary relations to "relation persisten

От
Robert Haas
Дата:
On Mon, Dec 13, 2010 at 1:07 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Mon, Dec 13, 2010 at 12:40 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>>> On Mon, Dec 13, 2010 at 12:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>>> At the very least, catalogs.sgml requires a fix for that.
>>>
>>> Woops.  OK, will fix.
>
>> Based on a little grepping, that's the only thing I see.  I'll push a
>> fix for that.  Do you see anything else?
>
> My grep agrees that relistemp, per se, is only referenced in one place
> in catalogs.sgml.  But are you sure that, for example, storage.sgml
> doesn't need any updates?

Hmm... <reads that chapter>

I think that this patch doesn't necessitate any updates to this
chapter.  However, the main unlogged tables patch probably should
touch this chapter, and currently does not.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company