Re: Pluggable Storage - Andres's take
Andres Freund <andres@anarazel.de>
Attachments
- v12-0001-WIP-Introduce-access-table.h-access-relation.h.patch.gz (application/x-patch-gzip) patch v12-0001
- v12-0002-Replace-heapam.h-includes-with-relation.h-table..patch.gz (application/x-patch-gzip) patch v12-0002
- v12-0003-Replace-uses-of-heap_open-et-al-with-table_open-.patch.gz (application/x-patch-gzip) patch v12-0003
- v12-0004-Remove-superfluous-tqual.h-includes.patch.gz (application/x-patch-gzip) patch v12-0004
- v12-0005-WIP-rename-tqual.c-to-heapam_visibility.c.patch.gz (application/x-patch-gzip) patch v12-0005
- v12-0006-WIP-change-snapshot-type-to-enum-rather-than-cal.patch.gz (application/x-patch-gzip) patch v12-0006
- v12-0007-Move-generic-snapshot-related-code-from-tqual.h-.patch.gz (application/x-patch-gzip) patch v12-0007
- v12-0008-Move-heap-visibility-routines-to-heapam.h.patch.gz (application/x-patch-gzip) patch v12-0008
- v12-0009-Rephrase-references-to-time-qualification.patch.gz (application/x-patch-gzip) patch v12-0009
- v12-0010-WIP-Extend-tuples-when-getting-them-from-a-slot.patch.gz (application/x-patch-gzip) patch v12-0010
- v12-0011-WIP-Move-page-initialization-from-RelationAddExt.patch.gz (application/x-patch-gzip) patch v12-0011
- v12-0012-WIP-ForceStore-HeapTupleDatum.patch.gz (application/x-patch-gzip) patch v12-0012
- v12-0013-slot-type-fixes.patch.gz (application/x-patch-gzip) patch v12-0013
- v12-0014-Rename-RelationData.rd_amroutine-to-rd_indam.patch.gz (application/x-patch-gzip) patch v12-0014
- v12-0015-Add-ExecStorePinnedBufferHeapTuple.patch.gz (application/x-patch-gzip) patch v12-0015
- v12-0016-Store-HeapTupleData-in-Buffer-HeapTupleTableSlot.patch.gz (application/x-patch-gzip) patch v12-0016
- v12-0017-Buffer-tuples-may-be-virtualized.patch.gz (application/x-patch-gzip) patch v12-0017
- v12-0018-slot-tableoid-tid-support.patch.gz (application/x-patch-gzip) patch v12-0018
- v12-0019-Set-tableoid-in-a-bunch-of-places.patch.gz (application/x-patch-gzip) patch v12-0019
- v12-0020-WIP-Slotified-triggers.patch.gz (application/x-patch-gzip) patch v12-0020
- v12-0021-WIP-Slotify-EPQ.patch.gz (application/x-patch-gzip) patch v12-0021
- v12-0022-tableam-introduce-minimal-infrastructure.patch.gz (application/x-patch-gzip) patch v12-0022
- v12-0023-tableam-Introduce-and-use-begin-endscan-and-do-i.patch.gz (application/x-patch-gzip) patch v12-0023
- v12-0024-tableam-Inquire-slot-type-from-AM-rather-than-ha.patch.gz (application/x-patch-gzip) patch v12-0024
- v12-0025-tableam-introduce-slot-based-table-getnext-and-u.patch.gz (application/x-patch-gzip) patch v12-0025
- v12-0026-tableam-Add-insert-delete-update-lock_tuple.patch.gz (application/x-patch-gzip) patch v12-0026
- v12-0027-tableam-Add-fetch_row_version.patch.gz (application/x-patch-gzip) patch v12-0027
- v12-0028-tableam-Add-use-tableam_fetch_follow_check.patch.gz (application/x-patch-gzip) patch v12-0028
- v12-0029-tableam-Add-table_get_latest_tid.patch.gz (application/x-patch-gzip) patch v12-0029
- v12-0030-tableam-multi_insert-and-slotify-COPY.patch.gz (application/x-patch-gzip) patch v12-0030
- v12-0031-tableam-finish_bulk_insert.patch.gz (application/x-patch-gzip) patch v12-0031
- v12-0032-tableam-slotify-CREATE-TABLE-AS-and-CREATE-MATER.patch.gz (application/x-patch-gzip) patch v12-0032
- v12-0033-tableam-index-builds.patch.gz (application/x-patch-gzip) patch v12-0033
- v12-0034-tableam-relation-creation-VACUUM-FULL-CLUSTER-SE.patch.gz (application/x-patch-gzip) patch v12-0034
- v12-0035-tableam-VACUUM-and-ANALYZE.patch.gz (application/x-patch-gzip) patch v12-0035
- v12-0036-tableam-planner-size-estimation.patch.gz (application/x-patch-gzip) patch v12-0036
- v12-0037-tableam-Sample-Scan-Support.patch.gz (application/x-patch-gzip) patch v12-0037
- v12-0038-tableam-bitmap-heap-scan.patch.gz (application/x-patch-gzip) patch v12-0038
- v12-0039-tableam-remaining-stuff.patch.gz (application/x-patch-gzip) patch v12-0039
- v12-0040-WIP-Move-xid-horizon-computation-for-page-level-.patch.gz (application/x-patch-gzip) patch v12-0040
- v12-0041-tableam-Add-function-to-determine-newest-xid-amo.patch.gz (application/x-patch-gzip) patch v12-0041
- v12-0042-tableam-Fetch-tuples-for-triggers-EPQ-using-a-pr.patch.gz (application/x-patch-gzip) patch v12-0042
Hi,
(resending with compressed attachements, perhaps that'll go through)
On 2018-12-10 18:13:40 -0800, Andres Freund wrote:
> On 2018-11-26 17:55:57 -0800, Andres Freund wrote:
> > FWIW, now that oids are removed, and the tuple table slot abstraction
> > got in, I'm working on rebasing the pluggable storage patchset ontop of
> > that.
>
> I've pushed a version to that to the git tree, including a rebased
> version of zheap:
> https://github.com/anarazel/postgres-pluggable-storage
> https://github.com/anarazel/postgres-pluggable-zheap
I've pushed the newest, substantially revised, version to the same
repository. Note, that while the newest pluggable-zheap version is newer
than my last email, it's not based on the latest version, and the
pluggable-zheap development is now happening in the main zheap
repository.
> My next steps are:
> - make relation creation properly pluggable
> - remove the typedefs from tableam.h, instead move them into the
> TableAmRoutine struct.
> - Move rs_{nblocks, startblock, numblocks} out of TableScanDescData
> - Move HeapScanDesc and IndexFetchHeapData out of relscan.h
> - remove ExecSlotCompare(), it's entirely unrelated to these changes imo
> (and in the wrong place)
These are done.
> - split pluggable storage patchset, to commit earlier:
> - EvalPlanQual slotification
> - trigger slotification
> - split of IndexBuildHeapScan out of index.c
The patchset is now pretty granularly split into individual pieces.
There's two commits that might be worthwhile to split up further:
1) The commit introducing table_beginscan et al, currently also
introduces indexscans through tableam.
2) The commit introducing table_(insert|delete|update) also includes
table_lock_tuple(), which in turn changes a bunch of EPQ related
code. It's probably worthwhile to break that out.
I tried to make each individual commit make some sense, and pass all
tests on its own. That requires some changes that are then obsolted
in a later commit, but it's not as much as I feared.
> - rename HeapUpdateFailureData et al to not reference Heap
I've not done that, I decided it's best to do that after all the work
has gone in.
> - See if the slot in SysScanDescData can be avoided, it's not exactly
> free of overhead.
After reconsidering, I don't think it's worth doing so.
There's pretty substantial changes in this series, besides the things
mentioned above:
- I re-introduced parallel scan into pluggable storage, but added a set
of helper functions to avoid having to duplicate the current block
based logic from heap. That way it can be shared between most/all
block based AMs
- latestRemovedXid handling is moved into the table-AM, that's required
for correct replay on Hot-Standby, where we do not know the AM of the
current
- the whole truncation and relation creation code has been overhauled
- the order of functions in tableam.h, heapam_handler.c etc has been
made more sensible
- a number of callbacks have been obsoleted (relation_sync,
relation_create_init_fork, scansetlimits)
- A bunch of prerequisite work has been merged
- (heap|relation)_(open|openrv|close) have been split into their own
files
- To avoid having to care about the bulk-insert flags code that uses a
bulk-insert now unconditionally calls table_finish_bulk_insert(). The
AM then internally can decide what it needs to do in case of
e.g. HEAP_INSERT_SKIP_WAL. Zheap currently for example doesn't
implement that (because UNDO handling is complicated), and this way it
can just ignore the option, without needing call-site code for that.
- A *lot* of cleanups
Todo:
- merge psql / pg_dump support by Dmitry
- consider removing scan_update_snapshot
- consider removing table_gimmegimmeslot()
- add substantial docs for every callback
- consider revising the current table_lock_tuple() API, I'm not quite
convinced that's right
- reconsider heap_fetch() API changes, causes unnecessary pain
- polish the split out trigger and EPQ changes, so they can be merged
soon-ish
I plan to merge the first few commits pretty soon (as largely announced
in related threads).
While I saw an initial attempt at writing smgl docs for the table AM
API, I'm not convinced that's the best approach. I think it might make
more sense to have high-level docs in sgml, but then do all the
per-callback docs in tableam.h.
Greetings,
Andres Freund
Commits
-
Add default_table_access_method to postgresql.conf.sample.
- 3a5c08aa0267 12.0 landed
- f7db0ac7d5b6 13.0 landed
-
tableam: Avoid relying on relation size to determine validity of tids.
- 147e3722f7e5 12.0 landed
-
tableam: Don't assume that every AM uses md.c style storage.
- 7f44ede59414 12.0 landed
-
Allow pg_class xid & multixid horizons to not be set.
- fdc7efcc30b1 12.0 landed
-
Fix slot type issue for fuzzy distance index scan over out-of-core table AM.
- b8b94ea129ff 12.0 cited
-
tableam: comment and formatting fixes.
- 6421011ea24d 12.0 landed
-
table: docs: fix typos and grammar.
- 86cc06d1cf9c 12.0 landed
-
tableam: basic documentation.
- b73c3a11963c 12.0 landed
-
Only allow heap in a number of contrib modules.
- 4b82664156c2 12.0 landed
-
tableam: Add table_finish_bulk_insert().
- d45e40158623 12.0 landed
-
tableam: sample scan.
- 73c954d24896 12.0 landed
-
tableam: bitmap table scan.
- bfbcad478f05 12.0 landed
-
tableam: Move heap specific logic from estimate_rel_size below tableam.
- 696d78469f37 12.0 landed
-
tableam: VACUUM and ANALYZE support.
- 737a292b5de2 12.0 landed
-
tableam: relation creation, VACUUM FULL/CLUSTER, SET TABLESPACE.
- d25f519107bf 12.0 landed
-
tableam: Support for an index build's initial table scan(s).
- 2a96909a4a8c 12.0 landed
-
tableam: Add table_get_latest_tid, to wrap heap_get_latest_tid.
- 2e3da03e9ee4 12.0 landed
-
tableam: Add helper for indexes to check if a corresponding table tuples exist.
- 71bdc99d0d7c 12.0 landed
-
tableam: Add and use table_fetch_row_version().
- 9a8ee1dc650b 12.0 landed
-
tableam: Use in CREATE TABLE AS and CREATE MATERIALIZED VIEW.
- 919e48b94301 12.0 landed
-
Ensure sufficient alignment for ParallelTableScanDescData in BTShared.
- 8cacea7a7251 12.0 landed
-
Don't reuse slots between root and partition in ON CONFLICT ... UPDATE.
- 277cb789836b 12.0 landed
-
Use a virtual rather than a heap slot in two places where that suffices.
- 70b9bda65f81 12.0 landed
-
Store tuples for EvalPlanQual in slots, rather than as HeapTuples.
- ad0bda5d24ea 12.0 landed
-
Use slots in trigger infrastructure, except for the actual invocation.
- ff11e7f4b9ae 12.0 landed
-
Store table oid and tuple's tid in tuple slots directly.
- b8d71745eac0 12.0 landed
-
Allow to use HeapTupleData embedded in [Buffer]HeapTupleTableSlot.
- 5408e233f066 12.0 landed
-
Add ExecStorePinnedBufferHeapTuple.
- 8aa02b52db11 12.0 landed
-
Add ArchiveOpts to pass options to ArchiveEntry
- f831d4accda0 12.0 cited
-
Rename RelationData.rd_amroutine to rd_indam.
- 346ed70b0ad7 12.0 landed
-
Rephrase references to "time qualification".
- ebcc7bf949ba 12.0 landed
-
Move remaining code from tqual.[ch] to heapam.h / heapam_visibility.c.
- c91560defc57 12.0 landed
-
Move generic snapshot related code from tqual.h to snapmgr.h.
- b7eda3e0e334 12.0 landed
-
Remove superfluous tqual.h includes.
- e7cc78ad43eb 12.0 landed
-
Don't duplicate parallel seqscan shmem sizing logic in nbtree.
- 90525d7b4e0f 12.0 landed
-
Move vacuumlazy.c into access/heap.
- 285d8e12055f 12.0 landed
-
Support parallel bitmap heap scans.
- f35742ccb7aa 10.0 cited