pgsql: Fix assorted bugs in CREATE INDEX CONCURRENTLY.
От | Tom Lane |
---|---|
Тема | pgsql: Fix assorted bugs in CREATE INDEX CONCURRENTLY. |
Дата | |
Msg-id | E1TeAAH-00082h-FB@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Fix assorted bugs in CREATE INDEX CONCURRENTLY. This patch changes CREATE INDEX CONCURRENTLY so that the pg_index flag changes it makes without exclusive lock on the index are made via heap_inplace_update() rather than a normal transactional update. The latter is not very safe because moving the pg_index tuple could result in concurrent SnapshotNow scans finding it twice or not at all, thus possibly resulting in index corruption. In addition, fix various places in the code that ought to check to make sure that the indexes they are manipulating are valid and/or ready as appropriate. These represent bugs that have existed since 8.2, since a failed CREATE INDEX CONCURRENTLY could leave a corrupt or invalid index behind, and we ought not try to do anything that might fail with such an index. Also fix RelationReloadIndexInfo to ensure it copies all the pg_index columns that are allowed to change after initial creation. Previously we could have been left with stale values of some fields in an index relcache entry. It's not clear whether this actually had any user-visible consequences, but it's at least a bug waiting to happen. This is a subset of a patch already applied in 9.2 and HEAD. Back-patch into all earlier supported branches. Tom Lane and Andres Freund Branch ------ REL8_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/5c8c7c7c5ffbcb7776199c7bfb0e91d9b614bb83 Modified Files -------------- src/backend/access/heap/README.HOT | 6 ++ src/backend/catalog/index.c | 87 ++++++++++++++++++++++++++++++++- src/backend/commands/cluster.c | 10 ++++- src/backend/commands/indexcmds.c | 43 +--------------- src/backend/commands/tablecmds.c | 10 +++- src/backend/commands/vacuum.c | 30 +++++++++--- src/backend/executor/execUtils.c | 3 + src/backend/optimizer/util/plancat.c | 5 +- src/backend/utils/cache/relcache.c | 19 +++++++- src/include/catalog/index.h | 9 ++++ src/include/catalog/pg_index.h | 8 +++ 11 files changed, 173 insertions(+), 57 deletions(-)
В списке pgsql-committers по дате отправления: