Skip to content

Filesystem FileExists interface is broken #5321

Closed

Description

@llhe

The FileSystem define the following interface, which can't handle temporary runtime errors properly but just swallow them (like GCS, HDFS and any customized DFS),

virtual bool FileExists(const string& fname) = 0;

It should be changed to

virtual Status FileExists(const string& fname) = 0;

I can provide a patch if no one is working on this.

Activity

  1. aselle commented on Nov 1, 2016

    @aselle
    Contributor

    @jhseu, I'm marking this contributions welcome, assuming you agree with that change.

  2. jhseu commented on Nov 1, 2016

    @jhseu
    Contributor

    Yeah, I agree that's an issue. I can make the change, though, because we also have to change the implementation for our internal filesystem.

  3. llhe commented on Nov 2, 2016

    @llhe
    ContributorAuthor

    This is more friendly (less error handling code) for the caller to handle unexpected errors:

    virtual Status FileExists(const string& fname, bool* result) = 0;

    And IsDirectory should also be changed to (both for API semantics consistency and making the caller easier to handle the runtime error, most of the current caller code just ignored them):

    virtual Status IsDirectory(const string& fname, bool* result) = 0;

    May be this can be addresses by another change.
    I'm creating a patch for FileExists first.

  4. jhseu commented on Nov 4, 2016

    @jhseu
    Contributor

    Fixed internally. It'll show up during the next sync.

    As mentioned in your pull request, we decided on:

    virtual Status FileExists(const string& fname);

    for consistency with how we've been using these error codes elsewhere.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions