pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Check default partitions constraints while descending
3+ messages / 1 participants
[nested] [flat]

* pgsql: Check default partitions constraints while descending
@ 2020-09-08 22:39 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2020-09-08 22:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check default partitions constraints while descending

Partitioning tuple route code assumes that the partition chosen while
descending the partition hierarchy is always the correct one.  This is
true except when the partition is the default partition and another
partition has been added concurrently: the partition constraint changes
and we don't recheck it.  This can lead to tuples mistakenly being added
to the default partition that should have been rejected.

Fix by rechecking the default partition constraint while descending the
hierarchy.

An isolation test based on the reproduction steps described by Hao Wu
(with tweaks for extra coverage) is included.

Backpatch to 12, where this bug came in with 898e5e3290a7.

Reported by: Hao Wu <hawu@vmware.com>
Author: Amit Langote <amitlangote09@gmail.com>
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/CA+HiwqFqBmcSSap4sFnCBUEL_VfOMmEKaQ3gwUhyfa4c7J_-nA@mail.gmail.com
Discussion: https://postgr.es/m/DM5PR0501MB3910E97A9EDFB4C775CF3D75A42F0@DM5PR0501MB3910.namprd05.prod.outlook.c...

Branch
------
master

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

Modified Files
--------------
src/backend/executor/execPartition.c               | 127 +++++++++++++++++----
.../expected/partition-concurrent-attach.out       |  49 ++++++++
src/test/isolation/isolation_schedule              |   1 +
.../specs/partition-concurrent-attach.spec         |  43 +++++++
4 files changed, 195 insertions(+), 25 deletions(-)



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

* pgsql: Check default partitions constraints while descending
@ 2020-09-08 22:39 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2020-09-08 22:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check default partitions constraints while descending

Partitioning tuple route code assumes that the partition chosen while
descending the partition hierarchy is always the correct one.  This is
true except when the partition is the default partition and another
partition has been added concurrently: the partition constraint changes
and we don't recheck it.  This can lead to tuples mistakenly being added
to the default partition that should have been rejected.

Fix by rechecking the default partition constraint while descending the
hierarchy.

An isolation test based on the reproduction steps described by Hao Wu
(with tweaks for extra coverage) is included.

Backpatch to 12, where this bug came in with 898e5e3290a7.

Reported by: Hao Wu <hawu@vmware.com>
Author: Amit Langote <amitlangote09@gmail.com>
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/CA+HiwqFqBmcSSap4sFnCBUEL_VfOMmEKaQ3gwUhyfa4c7J_-nA@mail.gmail.com
Discussion: https://postgr.es/m/DM5PR0501MB3910E97A9EDFB4C775CF3D75A42F0@DM5PR0501MB3910.namprd05.prod.outlook.c...

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/executor/execPartition.c               | 127 +++++++++++++++++----
.../expected/partition-concurrent-attach.out       |  49 ++++++++
src/test/isolation/isolation_schedule              |   1 +
.../specs/partition-concurrent-attach.spec         |  43 +++++++
4 files changed, 195 insertions(+), 25 deletions(-)



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

* pgsql: Check default partitions constraints while descending
@ 2020-09-08 22:39 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2020-09-08 22:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check default partitions constraints while descending

Partitioning tuple route code assumes that the partition chosen while
descending the partition hierarchy is always the correct one.  This is
true except when the partition is the default partition and another
partition has been added concurrently: the partition constraint changes
and we don't recheck it.  This can lead to tuples mistakenly being added
to the default partition that should have been rejected.

Fix by rechecking the default partition constraint while descending the
hierarchy.

An isolation test based on the reproduction steps described by Hao Wu
(with tweaks for extra coverage) is included.

Backpatch to 12, where this bug came in with 898e5e3290a7.

Reported by: Hao Wu <hawu@vmware.com>
Author: Amit Langote <amitlangote09@gmail.com>
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/CA+HiwqFqBmcSSap4sFnCBUEL_VfOMmEKaQ3gwUhyfa4c7J_-nA@mail.gmail.com
Discussion: https://postgr.es/m/DM5PR0501MB3910E97A9EDFB4C775CF3D75A42F0@DM5PR0501MB3910.namprd05.prod.outlook.c...

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/executor/execPartition.c               | 127 +++++++++++++++++----
.../expected/partition-concurrent-attach.out       |  49 ++++++++
src/test/isolation/isolation_schedule              |   1 +
.../specs/partition-concurrent-attach.spec         |  43 +++++++
4 files changed, 195 insertions(+), 25 deletions(-)



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


end of thread, other threads:[~2020-09-08 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 22:39 pgsql: Check default partitions constraints while descending Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-09-08 22:39 pgsql: Check default partitions constraints while descending Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-09-08 22:39 pgsql: Check default partitions constraints while descending 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