Re: Allow logical replication to copy tables in binary format
Euler Taveira <euler@eulerto.com>
From: "Euler Taveira" <euler@eulerto.com>
To: "Melih Mutlu" <m.melihmutlu@gmail.com>
Cc: "Amit Kapila" <amit.kapila16@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-08-11T17:15:17Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Allow logical replication to copy tables in binary format.
- ecb696527c01 16.0 landed
-
Common function for percent placeholder replacement
- c96de2ce1782 16.0 cited
-
Doc: add XML ID attributes to <sectN> and <varlistentry> tags.
- 78ee60ed84bb 16.0 cited
-
Re-order disable_on_error in tab-complete.
- d547f7cf5efc 16.0 cited
-
Make subscription tests pass with log_error_verbosity=verbose
- 19408aae7fa2 15.0 cited
-
Weaken type-OID-matching checks in array_recv and record_recv.
- 670c0a1d474b 14.0 cited
-
Allow logical replication to transfer data in binary format.
- 9de77b545313 14.0 cited
On Thu, Aug 11, 2022, at 10:46 AM, Melih Mutlu wrote: > If such restrictions are already the case for replication phase after initial table sync, then it shouldn't prevent us from enabling binary option for table sync. Right? I didn't carefully examine the COPY code but I won't expect significant differences (related to text vs binary mode) from the logical replication protocol. After inspecting the git history, I took my argument back after checking the commit 670c0a1d474. The initial commit 9de77b54531 imposes some restrictions (user-defined arrays and composite types) as mentioned in the commit message but it was removed in 670c0a1d474. My main concern is to break a scenario that was previously working (14 -> 15) but after a subscriber upgrade it won't (14 -> 16). I would say that you should test some scenarios: 014_binary.pl and also custom data types, same column with different data types, etc. > How is any issue that might occur due to version mismatch being handled right now in repliaction after table sync? > What I understand from the documentation is if replication can fail due to using different pg versions, it just fails. So binary option cannot be used. [1] > Do you think that this is more serious for table sync and we need to restrict binary option with different publisher and subscriber versions? But not for replication? It is a conservative argument. If we didn't allow a publisher to run COPY in binary mode while using previous Postgres versions, we know that it works. (At least there aren't bug reports for logical replication using binary option.) Since one of the main use cases for logical replication is migration, I'm concerned that it may not work (even if the binary option defaults to false, someone can decide to use it for performance reasons). I did a quick test and the failure while using binary mode is not clear. Since you are modifying this code, you could probably provide additional patch(es) to make it clear that there is an error (due to some documented restriction). -- Euler Taveira EDB https://www.enterprisedb.com/