From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Restructure index access method API to hide most of it at the C |
Date: | 2016-01-18 00:37:26 |
Message-ID: | E1aKxp0-0006pW-UA@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Restructure index access method API to hide most of it at the C level.
This patch reduces pg_am to just two columns, a name and a handler
function. All the data formerly obtained from pg_am is now provided
in a C struct returned by the handler function. This is similar to
the designs we've adopted for FDWs and tablesample methods. There
are multiple advantages. For one, the index AM's support functions
are now simple C functions, making them faster to call and much less
error-prone, since the C compiler can now check function signatures.
For another, this will make it far more practical to define index access
methods in installable extensions.
A disadvantage is that SQL-level code can no longer see attributes
of index AMs; in particular, some of the crosschecks in the opr_sanity
regression test are no longer possible from SQL. We've addressed that
by adding a facility for the index AM to perform such checks instead.
(Much more could be done in that line, but for now we're content if the
amvalidate functions more or less replace what opr_sanity used to do.)
We might also want to expose some sort of reporting functionality, but
this patch doesn't do that.
Alexander Korotkov, reviewed by Petr Jelínek, and rather heavily
editorialized on by me.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/65c5fcd353a859da9e61bfb2b92a99f12937de3b
Modified Files
--------------
contrib/pageinspect/btreefuncs.c | 1 +
contrib/pgstattuple/pgstatindex.c | 1 +
contrib/pgstattuple/pgstattuple.c | 1 +
doc/src/sgml/catalogs.sgml | 213 +-----------------------------
doc/src/sgml/datatype.sgml | 9 ++
doc/src/sgml/indexam.sgml | 169 ++++++++++++++++++------
doc/src/sgml/xindex.sgml | 2 +-
src/backend/access/brin/Makefile | 2 +-
src/backend/access/brin/brin.c | 161 +++++++++++-----------
src/backend/access/brin/brin_validate.c | 152 +++++++++++++++++++++
src/backend/access/common/reloptions.c | 35 ++---
src/backend/access/gin/Makefile | 2 +-
src/backend/access/gin/ginget.c | 10 +-
src/backend/access/gin/gininsert.c | 33 ++---
src/backend/access/gin/ginscan.c | 41 ++----
src/backend/access/gin/ginutil.c | 57 +++++++-
src/backend/access/gin/ginvacuum.c | 21 ++-
src/backend/access/gin/ginvalidate.c | 145 ++++++++++++++++++++
src/backend/access/gist/Makefile | 2 +-
src/backend/access/gist/gist.c | 76 ++++++++---
src/backend/access/gist/gistbuild.c | 9 +-
src/backend/access/gist/gistget.c | 35 ++---
src/backend/access/gist/gistscan.c | 41 ++----
src/backend/access/gist/gistutil.c | 11 +-
src/backend/access/gist/gistvacuum.c | 21 ++-
src/backend/access/gist/gistvalidate.c | 133 +++++++++++++++++++
src/backend/access/hash/Makefile | 2 +-
src/backend/access/hash/hash.c | 167 +++++++++++------------
src/backend/access/hash/hashutil.c | 14 +-
src/backend/access/hash/hashvalidate.c | 157 ++++++++++++++++++++++
src/backend/access/index/Makefile | 2 +-
src/backend/access/index/amapi.c | 114 ++++++++++++++++
src/backend/access/index/indexam.c | 167 ++++++-----------------
src/backend/access/nbtree/Makefile | 2 +-
src/backend/access/nbtree/nbtree.c | 165 ++++++++++++-----------
src/backend/access/nbtree/nbtutils.c | 13 +-
src/backend/access/nbtree/nbtvalidate.c | 204 ++++++++++++++++++++++++++++
src/backend/access/spgist/Makefile | 2 +-
src/backend/access/spgist/spginsert.c | 33 ++---
src/backend/access/spgist/spgscan.c | 67 +++-------
src/backend/access/spgist/spgutils.c | 60 +++++++--
src/backend/access/spgist/spgvacuum.c | 21 ++-
src/backend/access/spgist/spgvalidate.c | 129 ++++++++++++++++++
src/backend/catalog/index.c | 37 ++----
src/backend/catalog/objectaddress.c | 1 +
src/backend/catalog/toasting.c | 1 +
src/backend/commands/cluster.c | 4 +-
src/backend/commands/indexcmds.c | 22 ++-
src/backend/commands/opclasscmds.c | 41 +++---
src/backend/commands/tablecmds.c | 6 +-
src/backend/commands/typecmds.c | 1 +
src/backend/executor/execAmi.c | 16 +--
src/backend/executor/nodeIndexscan.c | 5 +-
src/backend/nodes/outfuncs.c | 2 +-
src/backend/optimizer/path/costsize.c | 14 +-
src/backend/optimizer/util/plancat.c | 24 ++--
src/backend/parser/parse_clause.c | 1 +
src/backend/parser/parse_utilcmd.c | 14 +-
src/backend/postmaster/autovacuum.c | 2 +-
src/backend/utils/adt/pseudotypes.c | 27 ++++
src/backend/utils/adt/ruleutils.c | 8 +-
src/backend/utils/adt/selfuncs.c | 98 ++++----------
src/backend/utils/cache/lsyscache.c | 1 +
src/backend/utils/cache/relcache.c | 86 +++++++-----
src/backend/utils/cache/syscache.c | 1 +
src/backend/utils/cache/typcache.c | 1 +
src/backend/utils/sort/sortsupport.c | 1 +
src/backend/utils/sort/tuplesort.c | 1 +
src/include/access/amapi.h | 174 ++++++++++++++++++++++++
src/include/access/brin.h | 15 +--
src/include/access/brin_internal.h | 34 ++++-
src/include/access/gin_private.h | 36 +++--
src/include/access/gist_private.h | 30 +++--
src/include/access/gistscan.h | 11 +-
src/include/access/hash.h | 36 +++--
src/include/access/nbtree.h | 44 +++---
src/include/access/reloptions.h | 5 +-
src/include/access/spgist.h | 44 +++---
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_am.h | 78 ++---------
src/include/catalog/pg_proc.h | 198 +++------------------------
src/include/catalog/pg_type.h | 2 +
src/include/nodes/nodes.h | 1 +
src/include/nodes/relation.h | 6 +-
src/include/utils/builtins.h | 2 +
src/include/utils/index_selfuncs.h | 68 ++++++++++
src/include/utils/rel.h | 23 +---
src/include/utils/selfuncs.h | 11 +-
src/test/regress/expected/oidjoins.out | 136 ++-----------------
src/test/regress/expected/opr_sanity.out | 128 ++++--------------
src/test/regress/sql/oidjoins.sql | 70 +---------
src/test/regress/sql/opr_sanity.sql | 115 ++++------------
src/tools/findoidjoins/README | 33 ++---
93 files changed, 2494 insertions(+), 1925 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2016-01-18 02:15:24 | Re: pgsql: Further tweaking of print_aligned_vertical(). |
Previous Message | Tom Lane | 2016-01-18 00:13:31 | pgsql: Re-pgindent a few files. |