pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Fix a crash in logical replication
8+ messages / 3 participants
[nested] [flat]
* pgsql: Fix a crash in logical replication
@ 2019-01-30 07:58 Peter Eisentraut <peter@eisentraut.org>
2019-01-30 09:54 ` Re: pgsql: Fix a crash in logical replication Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 1 reply; 8+ messages in thread
From: Peter Eisentraut @ 2019-01-30 07:58 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix a crash in logical replication
The bug was that determining which columns are part of the replica
identity index using RelationGetIndexAttrBitmap() would run
eval_const_expressions() on index expressions and predicates across
all indexes of the table, which in turn might require a snapshot, but
there wasn't one set, so it crashes. There were actually two separate
bugs, one on the publisher and one on the subscriber.
To trigger the bug, a table that is part of a publication or
subscription needs to have an index with a predicate or expression
that lends itself to constant expressions simplification.
The fix is to avoid the constant expressions simplification in
RelationGetIndexAttrBitmap(), so that it becomes safe to call in these
contexts. The constant expressions simplification comes from the
calls to RelationGetIndexExpressions()/RelationGetIndexPredicate() via
BuildIndexInfo(). But RelationGetIndexAttrBitmap() calling
BuildIndexInfo() is overkill. The latter just takes pg_index catalog
information, packs it into the IndexInfo structure, which former then
just unpacks again and throws away. We can just do this directly with
less overhead and skip the troublesome calls to
eval_const_expressions(). This also removes the awkward
cross-dependency between relcache.c and index.c.
Bug: #15114
Reported-by: Петър Славов <pet.slavov@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/152110589574.1223.17983600132321618383@wrigleys.postgresq...
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/dfa774ff9ac9de33d8cb98b91906ada55a2ab1df
Modified Files
--------------
src/backend/utils/cache/relcache.c | 50 ++++++++++++++++++++--------
src/test/subscription/t/100_bugs.pl | 65 +++++++++++++++++++++++++++++++++++++
2 files changed, 101 insertions(+), 14 deletions(-)
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Fix a crash in logical replication
2019-01-30 07:58 pgsql: Fix a crash in logical replication Peter Eisentraut <peter@eisentraut.org>
@ 2019-01-30 09:54 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2019-01-30 13:47 ` Re: pgsql: Fix a crash in logical replication Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 1 reply; 8+ messages in thread
From: Alvaro Herrera @ 2019-01-30 09:54 UTC (permalink / raw)
To: Peter Eisentraut <peter@eisentraut.org>; +Cc: pgsql-committers@lists.postgresql.org
On 2019-Jan-30, Peter Eisentraut wrote:
> Fix a crash in logical replication
>
> The bug was that determining which columns are part of the replica
> identity index using RelationGetIndexAttrBitmap() would run
> eval_const_expressions() on index expressions and predicates across
> all indexes of the table, which in turn might require a snapshot, but
> there wasn't one set, so it crashes. There were actually two separate
> bugs, one on the publisher and one on the subscriber.
The intention is to backpatch this fix all the way back to 9.4, right?
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Fix a crash in logical replication
2019-01-30 07:58 pgsql: Fix a crash in logical replication Peter Eisentraut <peter@eisentraut.org>
2019-01-30 09:54 ` Re: pgsql: Fix a crash in logical replication Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2019-01-30 13:47 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 0 replies; 8+ messages in thread
From: Peter Eisentraut @ 2019-01-30 13:47 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: pgsql-committers@lists.postgresql.org
On 30/01/2019 10:54, Alvaro Herrera wrote:
> On 2019-Jan-30, Peter Eisentraut wrote:
>
>> Fix a crash in logical replication
>>
>> The bug was that determining which columns are part of the replica
>> identity index using RelationGetIndexAttrBitmap() would run
>> eval_const_expressions() on index expressions and predicates across
>> all indexes of the table, which in turn might require a snapshot, but
>> there wasn't one set, so it crashes. There were actually two separate
>> bugs, one on the publisher and one on the subscriber.
>
> The intention is to backpatch this fix all the way back to 9.4, right?
Yeah, the backpatching took a little longer than expected.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Fix a crash in logical replication
@ 2019-01-30 10:31 Peter Eisentraut <peter@eisentraut.org>
0 siblings, 0 replies; 8+ messages in thread
From: Peter Eisentraut @ 2019-01-30 10:31 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix a crash in logical replication
The bug was that determining which columns are part of the replica
identity index using RelationGetIndexAttrBitmap() would run
eval_const_expressions() on index expressions and predicates across
all indexes of the table, which in turn might require a snapshot, but
there wasn't one set, so it crashes. There were actually two separate
bugs, one on the publisher and one on the subscriber.
To trigger the bug, a table that is part of a publication or
subscription needs to have an index with a predicate or expression
that lends itself to constant expressions simplification.
The fix is to avoid the constant expressions simplification in
RelationGetIndexAttrBitmap(), so that it becomes safe to call in these
contexts. The constant expressions simplification comes from the
calls to RelationGetIndexExpressions()/RelationGetIndexPredicate() via
BuildIndexInfo(). But RelationGetIndexAttrBitmap() calling
BuildIndexInfo() is overkill. The latter just takes pg_index catalog
information, packs it into the IndexInfo structure, which former then
just unpacks again and throws away. We can just do this directly with
less overhead and skip the troublesome calls to
eval_const_expressions(). This also removes the awkward
cross-dependency between relcache.c and index.c.
Bug: #15114
Reported-by: Петър Славов <pet.slavov@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/152110589574.1223.17983600132321618383@wrigleys.postgresq...
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/cf25498f718a35addf0fc783691538d91d60dcf8
Modified Files
--------------
src/backend/utils/cache/relcache.c | 60 +++++++++++++++++++++++-----------
src/test/subscription/t/100_bugs.pl | 65 +++++++++++++++++++++++++++++++++++++
2 files changed, 106 insertions(+), 19 deletions(-)
^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Fix a crash in logical replication
@ 2019-01-30 10:31 Peter Eisentraut <peter@eisentraut.org>
0 siblings, 0 replies; 8+ messages in thread
From: Peter Eisentraut @ 2019-01-30 10:31 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix a crash in logical replication
The bug was that determining which columns are part of the replica
identity index using RelationGetIndexAttrBitmap() would run
eval_const_expressions() on index expressions and predicates across
all indexes of the table, which in turn might require a snapshot, but
there wasn't one set, so it crashes. There were actually two separate
bugs, one on the publisher and one on the subscriber.
To trigger the bug, a table that is part of a publication or
subscription needs to have an index with a predicate or expression
that lends itself to constant expressions simplification.
The fix is to avoid the constant expressions simplification in
RelationGetIndexAttrBitmap(), so that it becomes safe to call in these
contexts. The constant expressions simplification comes from the
calls to RelationGetIndexExpressions()/RelationGetIndexPredicate() via
BuildIndexInfo(). But RelationGetIndexAttrBitmap() calling
BuildIndexInfo() is overkill. The latter just takes pg_index catalog
information, packs it into the IndexInfo structure, which former then
just unpacks again and throws away. We can just do this directly with
less overhead and skip the troublesome calls to
eval_const_expressions(). This also removes the awkward
cross-dependency between relcache.c and index.c.
Bug: #15114
Reported-by: Петър Славов <pet.slavov@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/152110589574.1223.17983600132321618383@wrigleys.postgresq...
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/2bac1d8c9848ec7045380401ae758003fe064bbc
Modified Files
--------------
src/backend/utils/cache/relcache.c | 44 ++++++++++++++++------
src/test/subscription/t/100_bugs.pl | 74 +++++++++++++++++++++++++++++++++++++
2 files changed, 107 insertions(+), 11 deletions(-)
^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Fix a crash in logical replication
@ 2019-01-30 10:31 Peter Eisentraut <peter@eisentraut.org>
0 siblings, 0 replies; 8+ messages in thread
From: Peter Eisentraut @ 2019-01-30 10:31 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix a crash in logical replication
The bug was that determining which columns are part of the replica
identity index using RelationGetIndexAttrBitmap() would run
eval_const_expressions() on index expressions and predicates across
all indexes of the table, which in turn might require a snapshot, but
there wasn't one set, so it crashes. There were actually two separate
bugs, one on the publisher and one on the subscriber.
To trigger the bug, a table that is part of a publication or
subscription needs to have an index with a predicate or expression
that lends itself to constant expressions simplification.
The fix is to avoid the constant expressions simplification in
RelationGetIndexAttrBitmap(), so that it becomes safe to call in these
contexts. The constant expressions simplification comes from the
calls to RelationGetIndexExpressions()/RelationGetIndexPredicate() via
BuildIndexInfo(). But RelationGetIndexAttrBitmap() calling
BuildIndexInfo() is overkill. The latter just takes pg_index catalog
information, packs it into the IndexInfo structure, which former then
just unpacks again and throws away. We can just do this directly with
less overhead and skip the troublesome calls to
eval_const_expressions(). This also removes the awkward
cross-dependency between relcache.c and index.c.
Bug: #15114
Reported-by: Петър Славов <pet.slavov@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/152110589574.1223.17983600132321618383@wrigleys.postgresq...
Branch
------
REL9_6_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/650296f8f607365278f64c9b9a7438c321f2d4ec
Modified Files
--------------
src/backend/utils/cache/relcache.c | 44 ++++++++++++++++++++++++++++----------
1 file changed, 33 insertions(+), 11 deletions(-)
^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Fix a crash in logical replication
@ 2019-01-30 10:31 Peter Eisentraut <peter@eisentraut.org>
0 siblings, 0 replies; 8+ messages in thread
From: Peter Eisentraut @ 2019-01-30 10:31 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix a crash in logical replication
The bug was that determining which columns are part of the replica
identity index using RelationGetIndexAttrBitmap() would run
eval_const_expressions() on index expressions and predicates across
all indexes of the table, which in turn might require a snapshot, but
there wasn't one set, so it crashes. There were actually two separate
bugs, one on the publisher and one on the subscriber.
To trigger the bug, a table that is part of a publication or
subscription needs to have an index with a predicate or expression
that lends itself to constant expressions simplification.
The fix is to avoid the constant expressions simplification in
RelationGetIndexAttrBitmap(), so that it becomes safe to call in these
contexts. The constant expressions simplification comes from the
calls to RelationGetIndexExpressions()/RelationGetIndexPredicate() via
BuildIndexInfo(). But RelationGetIndexAttrBitmap() calling
BuildIndexInfo() is overkill. The latter just takes pg_index catalog
information, packs it into the IndexInfo structure, which former then
just unpacks again and throws away. We can just do this directly with
less overhead and skip the troublesome calls to
eval_const_expressions(). This also removes the awkward
cross-dependency between relcache.c and index.c.
Bug: #15114
Reported-by: Петър Славов <pet.slavov@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/152110589574.1223.17983600132321618383@wrigleys.postgresq...
Branch
------
REL9_5_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/edd8278c544e7b7a7478f19ba245bb3c0df79dd6
Modified Files
--------------
src/backend/utils/cache/relcache.c | 44 ++++++++++++++++++++++++++++----------
1 file changed, 33 insertions(+), 11 deletions(-)
^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Fix a crash in logical replication
@ 2019-01-30 10:31 Peter Eisentraut <peter@eisentraut.org>
0 siblings, 0 replies; 8+ messages in thread
From: Peter Eisentraut @ 2019-01-30 10:31 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix a crash in logical replication
The bug was that determining which columns are part of the replica
identity index using RelationGetIndexAttrBitmap() would run
eval_const_expressions() on index expressions and predicates across
all indexes of the table, which in turn might require a snapshot, but
there wasn't one set, so it crashes. There were actually two separate
bugs, one on the publisher and one on the subscriber.
To trigger the bug, a table that is part of a publication or
subscription needs to have an index with a predicate or expression
that lends itself to constant expressions simplification.
The fix is to avoid the constant expressions simplification in
RelationGetIndexAttrBitmap(), so that it becomes safe to call in these
contexts. The constant expressions simplification comes from the
calls to RelationGetIndexExpressions()/RelationGetIndexPredicate() via
BuildIndexInfo(). But RelationGetIndexAttrBitmap() calling
BuildIndexInfo() is overkill. The latter just takes pg_index catalog
information, packs it into the IndexInfo structure, which former then
just unpacks again and throws away. We can just do this directly with
less overhead and skip the troublesome calls to
eval_const_expressions(). This also removes the awkward
cross-dependency between relcache.c and index.c.
Bug: #15114
Reported-by: Петър Славов <pet.slavov@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/152110589574.1223.17983600132321618383@wrigleys.postgresq...
Branch
------
REL9_4_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/452253eae95a3dd36b52606c91844af5f647d7fa
Modified Files
--------------
src/backend/utils/cache/relcache.c | 44 ++++++++++++++++++++++++++++----------
1 file changed, 33 insertions(+), 11 deletions(-)
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2019-01-30 13:47 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 07:58 pgsql: Fix a crash in logical replication Peter Eisentraut <peter@eisentraut.org>
2019-01-30 09:54 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2019-01-30 13:47 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-01-30 10:31 pgsql: Fix a crash in logical replication Peter Eisentraut <peter@eisentraut.org>
2019-01-30 10:31 pgsql: Fix a crash in logical replication Peter Eisentraut <peter@eisentraut.org>
2019-01-30 10:31 pgsql: Fix a crash in logical replication Peter Eisentraut <peter@eisentraut.org>
2019-01-30 10:31 pgsql: Fix a crash in logical replication Peter Eisentraut <peter@eisentraut.org>
2019-01-30 10:31 pgsql: Fix a crash in logical replication Peter Eisentraut <peter@eisentraut.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