pg_easy_replicate icon indicating copy to clipboard operation
pg_easy_replicate copied to clipboard

It'd be really nice to support blob sync

Open shayonj opened this issue 10 months ago • 0 comments

I'd love for pg_easy_replicate to support blob sync. I feel like that'd really bring it home when it comes to supporting a full replication. While its hard to do that while replication is ongoing - I am wonder we can do something where the blobs are synced over post switchover.

The benefit of post switchover is that the source database would be in ready only mode. The trade off here is that the blobs sync would be delay, so as long as your application can tolerate the delay its fine. Not the perfect solution but at least you won't have write custom tooling to perform the sync yourself.

It could work something like this

  • pg_easy_replicate can take in an additional flag --copy-blob-post-sync
  • Makes use of lo_import and lo_export to perform an export of large objects from source DB on to file system
  • Create a temporary table to store OID mappings. Update this table for exported data.
  • Import the large object file and get the new OID and update it in the temp table.
  • Update the referencing tables as needed based on the mapping

Open questions

  • Will need to handle bytea?
  • Easy way to figure out which OIDs map to what tables

shayonj avatar Apr 26 '24 12:04 shayonj