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

If cstore_fdw can't access a file, it should error out on CREATE #23

Closed
jberkus opened this issue May 4, 2014 · 5 comments
Closed

If cstore_fdw can't access a file, it should error out on CREATE #23

jberkus opened this issue May 4, 2014 · 5 comments
Labels

Comments

@jberkus
Copy link

jberkus commented May 4, 2014

phc=# create foreign table c_statements (
session_id text, session_line_num bigint, log_time timestamptz
,command_tag text, duration float) server cstore_server options (filename '/data/ssd/9.3/data/base/c_statements.cstore', compression 'pglz' );
CREATE FOREIGN TABLE
phc=# analyze c_statements;
ERROR: could not stat file "/data/ssd/9.3/data/base/c_statements.cstore": No such file or directory

Right now, if there's a problem accessing the specified file location, CREATE TABLE happily returns success, and errors out the first time you try to do something with the cstore table. It should error out on CREATE TABLE.

@jberkus
Copy link
Author

jberkus commented May 4, 2014

Actually, examing what happened above, the errors which happen on CREATE are being supressed. The actual issue was that I hadn't deleted the cstore_footer file. Since I got no error message about that, I didn't know what was wrong.

@jberkus
Copy link
Author

jberkus commented May 5, 2014

I'd say that this is a bug, not an enhancement.

@ozgune
Copy link

ozgune commented May 6, 2014

I think we can fix this issue doing one or both of the following.

1/ During Create Foreign Table, check that we can access the underlying data file. Also check that we don't have an existing footer file. Either warn or error out in this case.
2/ Drop Foreign Table deletes the data and footer files. This way, a new create table statement doesn't access an existing footer file.

Ideally, we'd do both. Out of curiosity, @jberkus, how did you delete the c_statements.cstore data file?

@jberkus
Copy link
Author

jberkus commented May 6, 2014

rm -f c_statements.cstore

I'd prefer a WARN, not an error, because I can imagine cases where I deliberately want to re-attach an existing cstore file as a new, or even duplicate, foreign table. Currently I can have the same cstore file attached as several different foriegn table names, and I can see uses for that functionality, so I wouldn't want it to become impossible in the future.

For the DROP FOREIGN TABLE case, please see the discussion on that issue; it's complicated.

@pykello pykello added bug and removed enhancement labels May 9, 2014
@samay-sharma
Copy link
Contributor

This issue has been resolved with cstore_fdw v1.1 release. cstore_fdw now errors out on CREATE if there is a problem accessing the specified file location.

Also, DROP FOREIGN TABLE now deletes the data and footer files, making it difficult to re-attach a previously created cstore file by mistake.

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

No branches or pull requests

4 participants