Tablesync early exit

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Tablesync early exit
Date: 2021-03-07 01:56:26
Message-ID: CAHut+Pt39PbQs0SxT9RMM89aYiZoQ0Kw46YZSkKZwK8z5HOr3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers.

I propose a small optimization can be added to the tablesync replication code.

This proposal (and simple patch) was first discussed here [1].

Basic idea is the tablesync could/should detect if there is anything
to do *before* it enters the apply main loop. Calling
process_sync_tables() before the apply main loop offers a quick way
out, so the message handling will not be unnecessarily between
workers. This will be a small optimization.

But also, IMO this is a more natural separation of work. E.g tablesync
worker will finish when the table is synced - not go one extra step...

~~

This patch was already successfully used for several versions
(v43-v50) of another 2PC patch [2], but it was eventually removed from
there because, although it has its own independent value, it was not
required for that patch series [3].

----
[1] https://www.postgresql.org/message-id/CAHut%2BPtjk-Qgd3R1a1_tr62CmiswcYphuv0pLmVA-%2B2s8r0Bkw%40mail.gmail.com
[2] https://www.postgresql.org/message-id/flat/CAHut%2BPsd5nyg-HG6rGO2_5jzXuSA1Eq5%2BB5J2VJo0Q2QWi-1HQ%40mail.gmail.com#1c268eeee3756b32e267d96b7177ba95
[3] https://www.postgresql.org/message-id/CAA4eK1Jxu-3qxtkfA_dKoquQgGZVcB%2Bk9_-yT5%3D9GDEW84TF%2BA%40mail.gmail.com

Kind Regards,
Peter Smith.
Fujitsu Australia

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2021-03-07 02:04:57 Re: [HACKERS] logical decoding of two-phase transactions
Previous Message Tom Lane 2021-03-07 01:32:43 Re: WIP: document the hook system