1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

tableam: Support for an index build's initial table scan(s).

To support building indexes over tables of different AMs, the scans to
do so need to be routed through the table AM.  While moving a fair
amount of code, nearly all the changes are just moving code to below a
callback.

Currently the range based interface wouldn't make much sense for non
block based table AMs. But that seems aceptable for now.

Author: Andres Freund
Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
This commit is contained in:
Andres Freund
2019-03-27 19:59:06 -07:00
parent 12bb35fc9b
commit 2a96909a4a
14 changed files with 1012 additions and 936 deletions

View File

@ -19,6 +19,7 @@
#include "access/genam.h"
#include "access/gist_private.h"
#include "access/gistxlog.h"
#include "access/tableam.h"
#include "access/xloginsert.h"
#include "catalog/index.h"
#include "miscadmin.h"
@ -204,8 +205,9 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo)
/*
* Do the heap scan.
*/
reltuples = IndexBuildHeapScan(heap, index, indexInfo, true,
gistBuildCallback, (void *) &buildstate, NULL);
reltuples = table_index_build_scan(heap, index, indexInfo, true,
gistBuildCallback,
(void *) &buildstate, NULL);
/*
* If buffering was used, flush out all the tuples that are still in the
@ -454,7 +456,7 @@ calculatePagesPerBuffer(GISTBuildState *buildstate, int levelStep)
}
/*
* Per-tuple callback from IndexBuildHeapScan.
* Per-tuple callback for table_index_build_scan.
*/
static void
gistBuildCallback(Relation index,