On 01/06/2014 07:12 PM, Mark Dilger wrote:
> The reason I was going to all the trouble of creating
> chrooted environments was to be able to replicate
> clusters that have tablespaces.
You can remove and recreate the symlink in pg_tblspc directory, after
creating the cluster, to point it to a different location. It might be a
bit tricky to do that if you have two clusters running at the same time,
but it's probably easier than chrooting anyway. For example:
1. stop the standby
2. create the tablespace in master
3. stop master
4. mv the tablespace directory, and modify the symlink in master to
point to the new location
5. start standby. It will replay the tablespace creation in the original
location
6. restart master.
You now have the same tablespace in master and standby, but they point
to different locations. This doesn't allow dynamically creating and
dropping tablespaces during tests, but at least it gives you one
tablespace to use.
Another idea would be to do something like chroot, but more lightweight,
using FUSE, private mount namespaces, or cgroups.
- Heikki