hapostgres / pg_auto_failover

Postgres extension and service for automated failover and high-availability
Other
1.09k stars 114 forks source link

Add support for tablespaces #870

Closed rheaton closed 2 years ago

rheaton commented 2 years ago

There is a new folder of tests, using volumes to keep data persistent against pod restarts and to allow for interaction within and without of the running containers. Unfortunately, it was non-trivial to re-use some of the existing testing libraries, but the additions were minimal. There are minor changes to the test Dockerfile to add permissions to the additional data directories.

This adds a newly destructive action that removes the data within a tablespace directory. Perhaps this can be rebased off of the work that will do in-place restore before merging, depending on the caution of the core team.

Implementation note: this permits tablespace data directories to created at the top level of mounted volumes.

Fixes #844

rheaton commented 2 years ago

Cleaning up a few compiler warnings I created and I'll push up fixes today

rheaton commented 2 years ago

@DimCitus I've addressed the comments and did a bit more cleanup. I haven't added the new tests to the travis suite -- I am not very familiar with it so please either let me know where is best or add it for me :) Also, the new top-level make test-tablespaces works with PGVERSION. (I tested it with versions 10-14)

rheaton commented 2 years ago

I decided to use docker-compose for a couple reasons: 1) It's already in use by the upgrade tests 2) the existing test behavior won't work for tablespaces because it uses a single volume which doesn't translate to this behavior. We need matching mounts across nodes.

Edit: Maybe this can work? https://docs.travis-ci.com/user/docker/#using-docker-compose

rheaton commented 2 years ago

@DimCitus Confirmed we can get docker-compose to work! https://app.travis-ci.com/github/citusdata/pg_auto_failover/jobs/558452771 For some reason it doesn't like docker compose versus docker-compose but I'll take it 🥇

rheaton commented 2 years ago

I'm glad we didn't go forward with the mappings implementation, as it is not yet supported on Windows as far as I understand (noticed in the postgres Slack): https://www.postgresql.org/message-id/CAB7nPqRU7tiF8zXv9c3zrV-1kbtryJFHDRE0_zfUv6ncwG3%2B-A%40mail.gmail.com