pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Handle new HOT chains in index-build table scans
7+ messages / 1 participants
[nested] [flat]

* pgsql: Handle new HOT chains in index-build table scans
@ 2020-08-13 21:48 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-13 21:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle new HOT chains in index-build table scans

When a table is scanned by heapam_index_build_range_scan (née
IndexBuildHeapScan) and the table lock being held allows concurrent data
changes, it is possible for new HOT chains to sprout in a page that were
unknown when the scan of a page happened.  This leads to an error such
as
  ERROR:  failed to find parent tuple for heap-only tuple at (X,Y) in table "tbl"
because the root tuple was not present when we first obtained the list
of the page's root tuples.  This can be fixed by re-obtaining the list
of root tuples, if we see that a heap-only tuple appears to point to a
non-existing root.

This was reported by Anastasia as occurring for BRIN summarization
(which exists since 9.5), but I think it could theoretically also happen
with CREATE INDEX CONCURRENTLY (much older) or REINDEX CONCURRENTLY
(very recent).  It seems a happy coincidence that BRIN forces us to
backpatch this all the way to 9.5.

Reported-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Diagnosed-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/602d8487-f0b2-5486-0088-0f372b2549fa@postgrespro.ru
Backpatch: 9.5 - master

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a811ea5bde2fbf450095994b5726dcbf64d68668

Modified Files
--------------
src/backend/access/heap/heapam_handler.c | 20 ++++++++++++++++++++
src/backend/access/heap/pruneheap.c      |  5 +++--
2 files changed, 23 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle new HOT chains in index-build table scans
@ 2020-08-13 21:48 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-13 21:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle new HOT chains in index-build table scans

When a table is scanned by heapam_index_build_range_scan (née
IndexBuildHeapScan) and the table lock being held allows concurrent data
changes, it is possible for new HOT chains to sprout in a page that were
unknown when the scan of a page happened.  This leads to an error such
as
  ERROR:  failed to find parent tuple for heap-only tuple at (X,Y) in table "tbl"
because the root tuple was not present when we first obtained the list
of the page's root tuples.  This can be fixed by re-obtaining the list
of root tuples, if we see that a heap-only tuple appears to point to a
non-existing root.

This was reported by Anastasia as occurring for BRIN summarization
(which exists since 9.5), but I think it could theoretically also happen
with CREATE INDEX CONCURRENTLY (much older) or REINDEX CONCURRENTLY
(very recent).  It seems a happy coincidence that BRIN forces us to
backpatch this all the way to 9.5.

Reported-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Diagnosed-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/602d8487-f0b2-5486-0088-0f372b2549fa@postgrespro.ru
Backpatch: 9.5 - master

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2f29fd4cb2522dfd64888892f0442a0ead8c6dd0

Modified Files
--------------
src/backend/access/heap/heapam_handler.c | 20 ++++++++++++++++++++
src/backend/access/heap/pruneheap.c      |  5 +++--
2 files changed, 23 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle new HOT chains in index-build table scans
@ 2020-08-13 21:48 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-13 21:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle new HOT chains in index-build table scans

When a table is scanned by heapam_index_build_range_scan (née
IndexBuildHeapScan) and the table lock being held allows concurrent data
changes, it is possible for new HOT chains to sprout in a page that were
unknown when the scan of a page happened.  This leads to an error such
as
  ERROR:  failed to find parent tuple for heap-only tuple at (X,Y) in table "tbl"
because the root tuple was not present when we first obtained the list
of the page's root tuples.  This can be fixed by re-obtaining the list
of root tuples, if we see that a heap-only tuple appears to point to a
non-existing root.

This was reported by Anastasia as occurring for BRIN summarization
(which exists since 9.5), but I think it could theoretically also happen
with CREATE INDEX CONCURRENTLY (much older) or REINDEX CONCURRENTLY
(very recent).  It seems a happy coincidence that BRIN forces us to
backpatch this all the way to 9.5.

Reported-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Diagnosed-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/602d8487-f0b2-5486-0088-0f372b2549fa@postgrespro.ru
Backpatch: 9.5 - master

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1122a903e967a388a1a8f20de15dc65ca639d407

Modified Files
--------------
src/backend/access/heap/heapam_handler.c | 20 ++++++++++++++++++++
src/backend/access/heap/pruneheap.c      |  5 +++--
2 files changed, 23 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle new HOT chains in index-build table scans
@ 2020-08-13 21:48 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-13 21:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle new HOT chains in index-build table scans

When a table is scanned by heapam_index_build_range_scan (née
IndexBuildHeapScan) and the table lock being held allows concurrent data
changes, it is possible for new HOT chains to sprout in a page that were
unknown when the scan of a page happened.  This leads to an error such
as
  ERROR:  failed to find parent tuple for heap-only tuple at (X,Y) in table "tbl"
because the root tuple was not present when we first obtained the list
of the page's root tuples.  This can be fixed by re-obtaining the list
of root tuples, if we see that a heap-only tuple appears to point to a
non-existing root.

This was reported by Anastasia as occurring for BRIN summarization
(which exists since 9.5), but I think it could theoretically also happen
with CREATE INDEX CONCURRENTLY (much older) or REINDEX CONCURRENTLY
(very recent).  It seems a happy coincidence that BRIN forces us to
backpatch this all the way to 9.5.

Reported-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Diagnosed-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/602d8487-f0b2-5486-0088-0f372b2549fa@postgrespro.ru
Backpatch: 9.5 - master

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/704de3739c5b0d99e30d0bdb338c9e8946d79b68

Modified Files
--------------
src/backend/access/heap/pruneheap.c |  5 +++--
src/backend/catalog/index.c         | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle new HOT chains in index-build table scans
@ 2020-08-13 21:48 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-13 21:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle new HOT chains in index-build table scans

When a table is scanned by heapam_index_build_range_scan (née
IndexBuildHeapScan) and the table lock being held allows concurrent data
changes, it is possible for new HOT chains to sprout in a page that were
unknown when the scan of a page happened.  This leads to an error such
as
  ERROR:  failed to find parent tuple for heap-only tuple at (X,Y) in table "tbl"
because the root tuple was not present when we first obtained the list
of the page's root tuples.  This can be fixed by re-obtaining the list
of root tuples, if we see that a heap-only tuple appears to point to a
non-existing root.

This was reported by Anastasia as occurring for BRIN summarization
(which exists since 9.5), but I think it could theoretically also happen
with CREATE INDEX CONCURRENTLY (much older) or REINDEX CONCURRENTLY
(very recent).  It seems a happy coincidence that BRIN forces us to
backpatch this all the way to 9.5.

Reported-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Diagnosed-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/602d8487-f0b2-5486-0088-0f372b2549fa@postgrespro.ru
Backpatch: 9.5 - master

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/385cbe8e4197fd46c34a9142f2dee2ed664f0c7e

Modified Files
--------------
src/backend/access/heap/pruneheap.c |  5 +++--
src/backend/catalog/index.c         | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle new HOT chains in index-build table scans
@ 2020-08-13 21:48 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-13 21:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle new HOT chains in index-build table scans

When a table is scanned by heapam_index_build_range_scan (née
IndexBuildHeapScan) and the table lock being held allows concurrent data
changes, it is possible for new HOT chains to sprout in a page that were
unknown when the scan of a page happened.  This leads to an error such
as
  ERROR:  failed to find parent tuple for heap-only tuple at (X,Y) in table "tbl"
because the root tuple was not present when we first obtained the list
of the page's root tuples.  This can be fixed by re-obtaining the list
of root tuples, if we see that a heap-only tuple appears to point to a
non-existing root.

This was reported by Anastasia as occurring for BRIN summarization
(which exists since 9.5), but I think it could theoretically also happen
with CREATE INDEX CONCURRENTLY (much older) or REINDEX CONCURRENTLY
(very recent).  It seems a happy coincidence that BRIN forces us to
backpatch this all the way to 9.5.

Reported-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Diagnosed-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/602d8487-f0b2-5486-0088-0f372b2549fa@postgrespro.ru
Backpatch: 9.5 - master

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e5902117dd83a330caf68ec2a479c4410cef5518

Modified Files
--------------
src/backend/access/heap/pruneheap.c |  5 +++--
src/backend/catalog/index.c         | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Handle new HOT chains in index-build table scans
@ 2020-08-13 21:48 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-13 21:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Handle new HOT chains in index-build table scans

When a table is scanned by heapam_index_build_range_scan (née
IndexBuildHeapScan) and the table lock being held allows concurrent data
changes, it is possible for new HOT chains to sprout in a page that were
unknown when the scan of a page happened.  This leads to an error such
as
  ERROR:  failed to find parent tuple for heap-only tuple at (X,Y) in table "tbl"
because the root tuple was not present when we first obtained the list
of the page's root tuples.  This can be fixed by re-obtaining the list
of root tuples, if we see that a heap-only tuple appears to point to a
non-existing root.

This was reported by Anastasia as occurring for BRIN summarization
(which exists since 9.5), but I think it could theoretically also happen
with CREATE INDEX CONCURRENTLY (much older) or REINDEX CONCURRENTLY
(very recent).  It seems a happy coincidence that BRIN forces us to
backpatch this all the way to 9.5.

Reported-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Diagnosed-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/602d8487-f0b2-5486-0088-0f372b2549fa@postgrespro.ru
Backpatch: 9.5 - master

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/40bceae7b4de61b165af37f51a4fa5a6caa87e11

Modified Files
--------------
src/backend/access/heap/pruneheap.c |  5 +++--
src/backend/catalog/index.c         | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2020-08-13 21:48 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 21:48 pgsql: Handle new HOT chains in index-build table scans Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-13 21:48 pgsql: Handle new HOT chains in index-build table scans Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-13 21:48 pgsql: Handle new HOT chains in index-build table scans Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-13 21:48 pgsql: Handle new HOT chains in index-build table scans Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-13 21:48 pgsql: Handle new HOT chains in index-build table scans Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-13 21:48 pgsql: Handle new HOT chains in index-build table scans Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-13 21:48 pgsql: Handle new HOT chains in index-build table scans Alvaro Herrera <alvherre@alvh.no-ip.org>

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