postgresql_replicas icon indicating copy to clipboard operation
postgresql_replicas copied to clipboard

Issues that came up when implementing

Open michaelwills opened this issue 3 years ago • 2 comments

Thank you for this! I have two replicas in other regions running 🚀!

I hit a few issues which I may be able to make a PR for in the coming days. They aren't major but did take a bit of digging:

Briefly:

  • Being new to replication, I didn't realize each subscription needs a unique name
  • I had the pg_graphql extension enabled on my primary. Executing the schema on the read replicas didn't fail, but the resultant structure didn't actually match. graph._type was the first error. I disabled graphql which brought that part in line.
  • New projects have pgsodium enabled by default it seams, making the schema's different. My primary was from several months back.
  • Enabling pgsodium on the primary does add it to the schema dump, but it fails as the pgsodium.key relation wasn't found. I'll have to check my notes for the error.
  • Disabling pgsodium manually on all three, going through the steps, then re-enabling them afterwards worked. Doing a structure diff showed they were all identical. Extensions were all a go then.
  • Data still didn't update so I put in all the log levels just in case. The logging Errors template doesn't include Warning which is needed to see the worker error.

Once I updated the max workers and restarted it immediately backfilled and changes were being propagated.

Thanks again!

michaelwills avatar Nov 09 '22 16:11 michaelwills

Thanks for the great, detailed feedback. Our basic migration document has recently changed so we may want to update this repo to help solve some of the stuff you ran into. See: https://supabase.com/docs/guides/platform/migrating-and-upgrading-projects

burggraf avatar Nov 09 '22 16:11 burggraf

@burggraf it seems that the migration document linked there would result in some downtime, but the approach in this repo would still be better for less downtime, right?

I'm trying to upgrade our pg version. My plan was to use the instructions here to create a replica and then once it was synced, change my app to use the credentials for the new replica. Then delete the old database. Would that still work?

askkaz avatar Aug 16 '23 01:08 askkaz