pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix ordering issue with WAL operations in GIN fast insert path 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix ordering issue with WAL operations in GIN fast insert path @ 2022-10-13 00:33 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2022-10-13 00:33 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ordering issue with WAL operations in GIN fast insert path Contrary to what is documented in src/backend/access/transam/README, ginHeapTupleFastInsert() had a few ordering issues with the way it does its WAL operations when inserting items in its fast path. First, when using a separate list, XLogBeginInsert() was being always called before START_CRIT_SECTION(), and in this case a second thing was wrong when merging lists, as an exclusive lock was taken on the tail page *before* calling XLogBeginInsert(). Finally, when inserting items into a tail page, the order of XLogBeginInsert() and START_CRIT_SECTION() was reversed. This commit addresses all these issues by moving the calls of XLogBeginInsert() after all the pages logged are locked and pinned, within a critical section. Author: Matthias van de Meent, Zhang Mingli Discussion: https://postgr.es/m/CAEze2WhL8uLMqynnnCu1LAPwxD5RKEo0nHV+eXGg_N6ELU88HQ@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/56b662523fd49f75abe89d5bad54d377b2f36c24 Modified Files -------------- src/backend/access/gin/ginfast.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix ordering issue with WAL operations in GIN fast insert path @ 2022-10-26 00:42 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2022-10-26 00:42 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ordering issue with WAL operations in GIN fast insert path Contrary to what is documented in src/backend/access/transam/README, ginHeapTupleFastInsert() had a few ordering issues with the way it does its WAL operations when inserting items in its fast path. First, when using a separate list, XLogBeginInsert() was being always called before START_CRIT_SECTION(), and in this case a second thing was wrong when merging lists, as an exclusive lock was taken on the tail page *before* calling XLogBeginInsert(). Finally, when inserting items into a tail page, the order of XLogBeginInsert() and START_CRIT_SECTION() was reversed. This commit addresses all these issues by moving the calls of XLogBeginInsert() after all the pages logged are locked and pinned, within a critical section. This has been applied first only on HEAD as of 56b6625, but as per discussion with Tom Lane and Álvaro Herrera, a backpatch is preferred to keep all the branches consistent and to respect the transam's README where we can. Author: Matthias van de Meent, Zhang Mingli Discussion: https://postgr.es/m/CAEze2WhL8uLMqynnnCu1LAPwxD5RKEo0nHV+eXGg_N6ELU88HQ@mail.gmail.com Backpatch-through: 10 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b02fc7df193b2c71f359cc2b42e21515311ab188 Modified Files -------------- src/backend/access/gin/ginfast.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix ordering issue with WAL operations in GIN fast insert path @ 2022-10-26 00:42 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2022-10-26 00:42 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ordering issue with WAL operations in GIN fast insert path Contrary to what is documented in src/backend/access/transam/README, ginHeapTupleFastInsert() had a few ordering issues with the way it does its WAL operations when inserting items in its fast path. First, when using a separate list, XLogBeginInsert() was being always called before START_CRIT_SECTION(), and in this case a second thing was wrong when merging lists, as an exclusive lock was taken on the tail page *before* calling XLogBeginInsert(). Finally, when inserting items into a tail page, the order of XLogBeginInsert() and START_CRIT_SECTION() was reversed. This commit addresses all these issues by moving the calls of XLogBeginInsert() after all the pages logged are locked and pinned, within a critical section. This has been applied first only on HEAD as of 56b6625, but as per discussion with Tom Lane and Álvaro Herrera, a backpatch is preferred to keep all the branches consistent and to respect the transam's README where we can. Author: Matthias van de Meent, Zhang Mingli Discussion: https://postgr.es/m/CAEze2WhL8uLMqynnnCu1LAPwxD5RKEo0nHV+eXGg_N6ELU88HQ@mail.gmail.com Backpatch-through: 10 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5a30d43fa9869adc5a6f708dd0994a8a4e53d905 Modified Files -------------- src/backend/access/gin/ginfast.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix ordering issue with WAL operations in GIN fast insert path @ 2022-10-26 00:42 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2022-10-26 00:42 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ordering issue with WAL operations in GIN fast insert path Contrary to what is documented in src/backend/access/transam/README, ginHeapTupleFastInsert() had a few ordering issues with the way it does its WAL operations when inserting items in its fast path. First, when using a separate list, XLogBeginInsert() was being always called before START_CRIT_SECTION(), and in this case a second thing was wrong when merging lists, as an exclusive lock was taken on the tail page *before* calling XLogBeginInsert(). Finally, when inserting items into a tail page, the order of XLogBeginInsert() and START_CRIT_SECTION() was reversed. This commit addresses all these issues by moving the calls of XLogBeginInsert() after all the pages logged are locked and pinned, within a critical section. This has been applied first only on HEAD as of 56b6625, but as per discussion with Tom Lane and Álvaro Herrera, a backpatch is preferred to keep all the branches consistent and to respect the transam's README where we can. Author: Matthias van de Meent, Zhang Mingli Discussion: https://postgr.es/m/CAEze2WhL8uLMqynnnCu1LAPwxD5RKEo0nHV+eXGg_N6ELU88HQ@mail.gmail.com Backpatch-through: 10 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ca4070f2b4b1ed62e3d333a51a2f412b1c841ba4 Modified Files -------------- src/backend/access/gin/ginfast.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix ordering issue with WAL operations in GIN fast insert path @ 2022-10-26 00:42 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2022-10-26 00:42 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ordering issue with WAL operations in GIN fast insert path Contrary to what is documented in src/backend/access/transam/README, ginHeapTupleFastInsert() had a few ordering issues with the way it does its WAL operations when inserting items in its fast path. First, when using a separate list, XLogBeginInsert() was being always called before START_CRIT_SECTION(), and in this case a second thing was wrong when merging lists, as an exclusive lock was taken on the tail page *before* calling XLogBeginInsert(). Finally, when inserting items into a tail page, the order of XLogBeginInsert() and START_CRIT_SECTION() was reversed. This commit addresses all these issues by moving the calls of XLogBeginInsert() after all the pages logged are locked and pinned, within a critical section. This has been applied first only on HEAD as of 56b6625, but as per discussion with Tom Lane and Álvaro Herrera, a backpatch is preferred to keep all the branches consistent and to respect the transam's README where we can. Author: Matthias van de Meent, Zhang Mingli Discussion: https://postgr.es/m/CAEze2WhL8uLMqynnnCu1LAPwxD5RKEo0nHV+eXGg_N6ELU88HQ@mail.gmail.com Backpatch-through: 10 Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/51c24d9e21d7c36cbb6890655fd8f57270cdb15a Modified Files -------------- src/backend/access/gin/ginfast.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix ordering issue with WAL operations in GIN fast insert path @ 2022-10-26 00:42 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2022-10-26 00:42 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ordering issue with WAL operations in GIN fast insert path Contrary to what is documented in src/backend/access/transam/README, ginHeapTupleFastInsert() had a few ordering issues with the way it does its WAL operations when inserting items in its fast path. First, when using a separate list, XLogBeginInsert() was being always called before START_CRIT_SECTION(), and in this case a second thing was wrong when merging lists, as an exclusive lock was taken on the tail page *before* calling XLogBeginInsert(). Finally, when inserting items into a tail page, the order of XLogBeginInsert() and START_CRIT_SECTION() was reversed. This commit addresses all these issues by moving the calls of XLogBeginInsert() after all the pages logged are locked and pinned, within a critical section. This has been applied first only on HEAD as of 56b6625, but as per discussion with Tom Lane and Álvaro Herrera, a backpatch is preferred to keep all the branches consistent and to respect the transam's README where we can. Author: Matthias van de Meent, Zhang Mingli Discussion: https://postgr.es/m/CAEze2WhL8uLMqynnnCu1LAPwxD5RKEo0nHV+eXGg_N6ELU88HQ@mail.gmail.com Backpatch-through: 10 Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/341fba2a6291f6f1c5f801c308b72fa62e46e5c8 Modified Files -------------- src/backend/access/gin/ginfast.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix ordering issue with WAL operations in GIN fast insert path @ 2022-10-26 00:42 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2022-10-26 00:42 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ordering issue with WAL operations in GIN fast insert path Contrary to what is documented in src/backend/access/transam/README, ginHeapTupleFastInsert() had a few ordering issues with the way it does its WAL operations when inserting items in its fast path. First, when using a separate list, XLogBeginInsert() was being always called before START_CRIT_SECTION(), and in this case a second thing was wrong when merging lists, as an exclusive lock was taken on the tail page *before* calling XLogBeginInsert(). Finally, when inserting items into a tail page, the order of XLogBeginInsert() and START_CRIT_SECTION() was reversed. This commit addresses all these issues by moving the calls of XLogBeginInsert() after all the pages logged are locked and pinned, within a critical section. This has been applied first only on HEAD as of 56b6625, but as per discussion with Tom Lane and Álvaro Herrera, a backpatch is preferred to keep all the branches consistent and to respect the transam's README where we can. Author: Matthias van de Meent, Zhang Mingli Discussion: https://postgr.es/m/CAEze2WhL8uLMqynnnCu1LAPwxD5RKEo0nHV+eXGg_N6ELU88HQ@mail.gmail.com Backpatch-through: 10 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/594b97509e49e30a9f6ada09110405663a2e1d6f Modified Files -------------- src/backend/access/gin/ginfast.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2022-10-26 00:42 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-10-13 00:33 pgsql: Fix ordering issue with WAL operations in GIN fast insert path Michael Paquier <michael@paquier.xyz> 2022-10-26 00:42 pgsql: Fix ordering issue with WAL operations in GIN fast insert path Michael Paquier <michael@paquier.xyz> 2022-10-26 00:42 pgsql: Fix ordering issue with WAL operations in GIN fast insert path Michael Paquier <michael@paquier.xyz> 2022-10-26 00:42 pgsql: Fix ordering issue with WAL operations in GIN fast insert path Michael Paquier <michael@paquier.xyz> 2022-10-26 00:42 pgsql: Fix ordering issue with WAL operations in GIN fast insert path Michael Paquier <michael@paquier.xyz> 2022-10-26 00:42 pgsql: Fix ordering issue with WAL operations in GIN fast insert path Michael Paquier <michael@paquier.xyz> 2022-10-26 00:42 pgsql: Fix ordering issue with WAL operations in GIN fast insert path Michael Paquier <michael@paquier.xyz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox