Make index_concurrently_create_copy more general Also rename it to index_create_copy. Add a 'boolean concurrent' option, and make it work for both cases: in concurrent mode, just create the catalog entries; caller is responsible for the actual building later. In non-concurrent mode, the index is built right away.
This allows it to be reused for other purposes -- specifically, for concurrent REPACK. (With the CONCURRENTLY option, REPACK cannot simply swap the heap file and rebuild its indexes. Instead, it needs to build a separate set of indexes, including their system catalog entries, *before* the actual swap, to reduce the time AccessExclusiveLock needs to be held for. This approach is different from what CREATE INDEX CONCURRENTLY does.) Per a suggestion from Mihail Nikalayeu. Author: Antonin Houska <[email protected]> Reviewed-by: Mihail Nikalayeu <[email protected]> Reviewed-by: Álvaro Herrera <[email protected]> Discussion: https://postgr.es/m/41104.1754922120@localhost Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/33bf7318f94ce730563eb5ed95ad6c61d6e6f7a6 Modified Files -------------- src/backend/catalog/index.c | 41 +++++++++++++++++++++++++++------------- src/backend/commands/indexcmds.c | 9 +++++---- src/include/catalog/index.h | 7 +++---- 3 files changed, 36 insertions(+), 21 deletions(-)
