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

s3, gs, azure: re-enable prefix-based search optimization #6151

Merged
merged 1 commit into from
Jun 13, 2021

Conversation

isidentical
Copy link
Contributor

It was turned off due to not all providers supporting find(<something>, prefix=<something>) but now it is safe to turn that back on. Resolves #6089.

@isidentical isidentical self-assigned this Jun 10, 2021
def find(self, path_info, detail=False):
path = self._with_bucket(path_info)
files = self.fs.find(path, detail=detail)
def find(self, path_info, detail=False, prefix=None):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a nice idea (for future refactors of remotes) to pass the prefix in here (0/), and use the actual path (bucket/cache/00/) as the path_info (to be fully fsspec-compliant).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it would make more sense for us to do

walk("bucket/00/", prefix="0")

instead of the current

walk("bucket/00/0", prefix=True)

@@ -96,7 +96,8 @@ def ls(self, path_info, detail=False):
files = self.fs.ls(path, detail=detail)
yield from self._strip_buckets(files, detail=detail)

def find(self, path_info, detail=False):
# pylint: disable=unused-argument
def find(self, path_info, detail=False, prefix=None):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know if there is a scenario where the prefix will not be None for this case (TRAVERSE_PREFIX_LEN=2, used by filesystems with real dirs etc) but if there is no such case, then perhaps we could add an assert prefix is None as a safe-guard.

@efiop efiop merged commit b9df445 into iterative:master Jun 13, 2021
@efiop efiop added the bugfix fixes bug label Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix fixes bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Old bug (dvc pull from S3 and md5 starts with 00) reappears with latest release
3 participants