pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Track unowned relations in doubly-linked list
6+ messages / 1 participants
[nested] [flat]

* pgsql: Track unowned relations in doubly-linked list
@ 2019-03-27 02:26 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2019-03-27 02:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Track unowned relations in doubly-linked list

Relations dropped in a single transaction are tracked in a list of
unowned relations.  With large number of dropped relations this resulted
in poor performance at the end of a transaction, when the relations are
removed from the singly linked list one by one.

Commit b4166911 attempted to address this issue (particularly when it
happens during recovery) by removing the relations in a reverse order,
resulting in O(1) lookups in the list of unowned relations.  This did
not work reliably, though, and it was possible to trigger the O(N^2)
behavior in various ways.

Instead of trying to remove the relations in a specific order with
respect to the linked list, which seems rather fragile, switch to a
regular doubly linked.  That allows us to remove relations cheaply no
matter where in the list they are.

As b4166911 was a bugfix, backpatched to all supported versions, do the
same thing here.

Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/flat/80c27103-99e4-1d0c-642c-d9f3b94aaa0a%402ndquadrant.com
Backpatch-through: 9.4

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/31737eb43ffd77de9269247dfbd11a2665e6ee57

Modified Files
--------------
src/backend/storage/smgr/md.c   |  8 +----
src/backend/storage/smgr/smgr.c | 74 ++++++++++-------------------------------
src/include/storage/smgr.h      |  3 +-
3 files changed, 20 insertions(+), 65 deletions(-)



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

* pgsql: Track unowned relations in doubly-linked list
@ 2019-03-27 02:27 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2019-03-27 02:27 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Track unowned relations in doubly-linked list

Relations dropped in a single transaction are tracked in a list of
unowned relations.  With large number of dropped relations this resulted
in poor performance at the end of a transaction, when the relations are
removed from the singly linked list one by one.

Commit b4166911 attempted to address this issue (particularly when it
happens during recovery) by removing the relations in a reverse order,
resulting in O(1) lookups in the list of unowned relations.  This did
not work reliably, though, and it was possible to trigger the O(N^2)
behavior in various ways.

Instead of trying to remove the relations in a specific order with
respect to the linked list, which seems rather fragile, switch to a
regular doubly linked.  That allows us to remove relations cheaply no
matter where in the list they are.

As b4166911 was a bugfix, backpatched to all supported versions, do the
same thing here.

Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/flat/80c27103-99e4-1d0c-642c-d9f3b94aaa0a%402ndquadrant.com
Backpatch-through: 9.4

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/261aa218c9a0fcd93f6a27ca014c9d1ee278fa8b

Modified Files
--------------
src/backend/storage/smgr/md.c   |  8 +----
src/backend/storage/smgr/smgr.c | 74 ++++++++++-------------------------------
src/include/storage/smgr.h      |  3 +-
3 files changed, 20 insertions(+), 65 deletions(-)



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

* pgsql: Track unowned relations in doubly-linked list
@ 2019-03-27 02:28 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2019-03-27 02:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Track unowned relations in doubly-linked list

Relations dropped in a single transaction are tracked in a list of
unowned relations.  With large number of dropped relations this resulted
in poor performance at the end of a transaction, when the relations are
removed from the singly linked list one by one.

Commit b4166911 attempted to address this issue (particularly when it
happens during recovery) by removing the relations in a reverse order,
resulting in O(1) lookups in the list of unowned relations.  This did
not work reliably, though, and it was possible to trigger the O(N^2)
behavior in various ways.

Instead of trying to remove the relations in a specific order with
respect to the linked list, which seems rather fragile, switch to a
regular doubly linked.  That allows us to remove relations cheaply no
matter where in the list they are.

As b4166911 was a bugfix, backpatched to all supported versions, do the
same thing here.

Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/flat/80c27103-99e4-1d0c-642c-d9f3b94aaa0a%402ndquadrant.com
Backpatch-through: 9.4

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0a5dcb87aec72ee90e21fb0ad05988ec54211dc3

Modified Files
--------------
src/backend/storage/smgr/md.c   |  8 +----
src/backend/storage/smgr/smgr.c | 74 ++++++++++-------------------------------
src/include/storage/smgr.h      |  3 +-
3 files changed, 20 insertions(+), 65 deletions(-)



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

* pgsql: Track unowned relations in doubly-linked list
@ 2019-03-27 02:30 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2019-03-27 02:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Track unowned relations in doubly-linked list

Relations dropped in a single transaction are tracked in a list of
unowned relations.  With large number of dropped relations this resulted
in poor performance at the end of a transaction, when the relations are
removed from the singly linked list one by one.

Commit b4166911 attempted to address this issue (particularly when it
happens during recovery) by removing the relations in a reverse order,
resulting in O(1) lookups in the list of unowned relations.  This did
not work reliably, though, and it was possible to trigger the O(N^2)
behavior in various ways.

Instead of trying to remove the relations in a specific order with
respect to the linked list, which seems rather fragile, switch to a
regular doubly linked.  That allows us to remove relations cheaply no
matter where in the list they are.

As b4166911 was a bugfix, backpatched to all supported versions, do the
same thing here.

Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/flat/80c27103-99e4-1d0c-642c-d9f3b94aaa0a%402ndquadrant.com
Backpatch-through: 9.4

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5601f9fb97d108cb26ee92d0941447f354688421

Modified Files
--------------
src/backend/storage/smgr/md.c   |  8 +----
src/backend/storage/smgr/smgr.c | 74 ++++++++++-------------------------------
src/include/storage/smgr.h      |  3 +-
3 files changed, 20 insertions(+), 65 deletions(-)



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

* pgsql: Track unowned relations in doubly-linked list
@ 2019-03-27 02:32 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2019-03-27 02:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Track unowned relations in doubly-linked list

Relations dropped in a single transaction are tracked in a list of
unowned relations.  With large number of dropped relations this resulted
in poor performance at the end of a transaction, when the relations are
removed from the singly linked list one by one.

Commit b4166911 attempted to address this issue (particularly when it
happens during recovery) by removing the relations in a reverse order,
resulting in O(1) lookups in the list of unowned relations.  This did
not work reliably, though, and it was possible to trigger the O(N^2)
behavior in various ways.

Instead of trying to remove the relations in a specific order with
respect to the linked list, which seems rather fragile, switch to a
regular doubly linked.  That allows us to remove relations cheaply no
matter where in the list they are.

As b4166911 was a bugfix, backpatched to all supported versions, do the
same thing here.

Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/flat/80c27103-99e4-1d0c-642c-d9f3b94aaa0a%402ndquadrant.com
Backpatch-through: 9.4

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/storage/smgr/md.c   |  8 +----
src/backend/storage/smgr/smgr.c | 74 ++++++++++-------------------------------
src/include/storage/smgr.h      |  3 +-
3 files changed, 20 insertions(+), 65 deletions(-)



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

* pgsql: Track unowned relations in doubly-linked list
@ 2019-03-27 02:33 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2019-03-27 02:33 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Track unowned relations in doubly-linked list

Relations dropped in a single transaction are tracked in a list of
unowned relations.  With large number of dropped relations this resulted
in poor performance at the end of a transaction, when the relations are
removed from the singly linked list one by one.

Commit b4166911 attempted to address this issue (particularly when it
happens during recovery) by removing the relations in a reverse order,
resulting in O(1) lookups in the list of unowned relations.  This did
not work reliably, though, and it was possible to trigger the O(N^2)
behavior in various ways.

Instead of trying to remove the relations in a specific order with
respect to the linked list, which seems rather fragile, switch to a
regular doubly linked.  That allows us to remove relations cheaply no
matter where in the list they are.

As b4166911 was a bugfix, backpatched to all supported versions, do the
same thing here.

Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/flat/80c27103-99e4-1d0c-642c-d9f3b94aaa0a%402ndquadrant.com
Backpatch-through: 9.4

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6ca015f9f073eef40f933f587e0b166b87261406

Modified Files
--------------
src/backend/storage/smgr/md.c   |  8 +----
src/backend/storage/smgr/smgr.c | 74 ++++++++++-------------------------------
src/include/storage/smgr.h      |  3 +-
3 files changed, 20 insertions(+), 65 deletions(-)



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


end of thread, other threads:[~2019-03-27 02:33 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 02:26 pgsql: Track unowned relations in doubly-linked list Tomas Vondra <tomas.vondra@postgresql.org>
2019-03-27 02:27 pgsql: Track unowned relations in doubly-linked list Tomas Vondra <tomas.vondra@postgresql.org>
2019-03-27 02:28 pgsql: Track unowned relations in doubly-linked list Tomas Vondra <tomas.vondra@postgresql.org>
2019-03-27 02:30 pgsql: Track unowned relations in doubly-linked list Tomas Vondra <tomas.vondra@postgresql.org>
2019-03-27 02:32 pgsql: Track unowned relations in doubly-linked list Tomas Vondra <tomas.vondra@postgresql.org>
2019-03-27 02:33 pgsql: Track unowned relations in doubly-linked list Tomas Vondra <tomas.vondra@postgresql.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