-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tablespaces support #290
Comments
Maybe preresync script can give user more customization. |
Can use simple string array define User TableSpaces dir root The User table space path is /UserData1/UserTb1, /UserData1/UserTb2, /UserData2/UserTb3, /UserData2/UserTb4 When stolon is initialized, the directory '/UserData1' ,'/UserData2' is created |
@smkingsoft Defining a static list of directories is the faster way. The keeper will delete and recreate them when doing a full resync. The admin must update this list before adding new tablespaces in additional directories. An improvement could be to automatically retrieve them (the keeper will get them and publish them to the cluster data like already done with other information like pg parameters) so the admin shouldn't need to set them manually. But I think there are some unfixable corner cases caused by the pg tablespaces nature: they can be defined everywhere outside the pg data dir and so stolon won't be able to fully control them. For example imagine a standby that has a tablespace directory that doesn't exists, has wrong permissions or is filled with other data while on the master it's all ok, if we create a new tablespace on the master it will succeed while the standby will probably (haven't tested it) break since it cannot create the data files. |
@sgotti |
@smkingsoft I think your proposal will add another concept not existing in postgres: tablespaces root, the unique usefulness of it is to avoid specifing all the tablespaces dirs but it'll also put some conditions on how users should define their tablespaces structures. But,as I proposed above, we could also make stolon automatically determine and report all tablespaces dir and automate this process without adding any tablespaces knowledge in the cluster spec. But all of this won't help solving the real problem: a user can create a tablespace everywhere and this requires a perfect simmetry on all the nodes, if this doesn't happen (also manual error), the replication will break or in the worst case the data will be lost on a master change. So, until someone can prove that we can do something in stolon to avoid these problems, I'll happily review PR that could add initial tablespaces support to stolon (preferring the automated tablespace discovery way) but putting a big warning in the documentation saying that tablespaces, if not correctly managed, will break the cluster in bad ways. |
@sgotti I also want make stolon automatically determine and report all tablespaces dir. |
hi @sgotti |
Just a note that Stolon still does not support tablespace. If you created a tablespace, you will have the following error when resyncing:
A workaround to this issue is to first manually empty your tablespace folder ( You can deactivate the tablespace from psql too:
|
Now stolon doesn't works with tablespaces since it can't know where the tablespaces files will be placed and cannot remove them during resync.
Some possibilities:
The text was updated successfully, but these errors were encountered: