Skip to content
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

Detect incomplete installations and provide useful error #93

Open
jasonmp85 opened this issue Mar 20, 2015 · 2 comments
Open

Detect incomplete installations and provide useful error #93

jasonmp85 opened this issue Mar 20, 2015 · 2 comments

Comments

@jasonmp85
Copy link
Collaborator

Not entirely sure whether this is a feature request or a bug report, but various emails have been hitting my inbox of users either:

  • Putting pg_shard in shared_preload_libraries but forgetting to call CREATE EXTENSION
  • Calling CREATE EXTENSION but forgetting to ever LOAD pg_shard (using the above config variable or otherwise)

These causes produce a variety of symptoms, but common ones are:

  • Running a query against a distributed table but actually hitting the local table because pg_shard's hooks have not been loaded (caused by lack of LOAD)
  • Calling a utility command and having it fail with the error schema "pgs_distribution_metadata" does not exist (caused by lack of CREATE)

This is biting enough people that some runtime guidance could help out a lot.

@jasonmp85
Copy link
Collaborator Author

To protect against users accidentally hitting a local table when pg_shard is not loaded, we could add a trigger to those tables (this could be part of master_create_distributed_table's logic) so that any queries involving them fail with a pg_shard related error message explaining that the table is distributed and they must LOAD pg_shard to use it.

@jasonmp85
Copy link
Collaborator Author

As for forgetting CREATE, this is a little tougher. One of us recently hit it while trying to run cstore_fdw's regression tests when pg_shard was also loaded. The COPY commands the tests were calling triggered pg_shard's logic. On one hand, we want the user to know about the misconfiguration, but on the other hand, putting anything in the output would break other test suites.

I'm thinking we send something only to the server log (possible?) to have a record that pg_shard is misconfigured, but otherwise just make the hook act as a no-op if the CREATE EXTENSION command hasn't yet been run. After all, this is probably a more rare case, since users must run CREATE EXTENSION to get access to the functions for distributing tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant