Skip to content

Conversation

benjeffery
Copy link
Contributor

Fixes #253

TODO:

  • Changes documented in docs/release.rst
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

zarr/storage.py Outdated
for child in scandir(fs_path):
if child.is_file():
size += child.stat().st_size
for root, dirs, files in os.walk(fs_path):
Copy link
Member

Choose a reason for hiding this comment

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

Should also include the size of directories - these can be significant when there's a large number of files within a directory. The result here should be the same as du, which does take this into account.

@jeromekelleher
Copy link
Member

I guess it's worth asking what the fate of this will be for the v3 branch - if the code is just in as a short-lived bugfix that dies when we switch over the v3 then I'm not sure it's worth pushing through for our purposes @benjeffery

@benjeffery
Copy link
Contributor Author

benjeffery commented Apr 24, 2024

I guess it's worth asking what the fate of this will be for the v3 branch - if the code is just in as a short-lived bugfix that dies when we switch over the v3 then I'm not sure it's worth pushing through for our purposes @benjeffery

Yes, I'm not sure on the time scales here, so would be good to know. v3 behaviour is to report the total size as in this PR.

I'm missing some tests here that I didn't spot locally as they were skipped for optional deps, happy to patch those up if this looks like it's needed.

@dstansby
Copy link
Contributor

👋 thanks for the PR, and sorry it's been left to wilt a bit! I've just run into this too at #2174, so I would be keen to see this PR finished. If you can patch up the remaining test failures, and rebase on to the current main branch, I'd be happy to review and hopefully merge this!

@benjeffery benjeffery force-pushed the recursive-getsize branch 3 times, most recently from b884714 to 0bee609 Compare September 13, 2024 10:02
@jhamman jhamman added the V2 Affects the v2 branch label Oct 11, 2024
@jhamman jhamman changed the base branch from main to support/2.x October 11, 2024 23:36
@jhamman
Copy link
Member

jhamman commented Oct 11, 2024

I've changed the base branch from main to support/2.x in case there is interest in continuing this work.

@dstansby
Copy link
Contributor

Hmmm I had a look at fixing the tests, and it looks non-trivial...

@benjeffery
Copy link
Contributor Author

Hmmm I had a look at fixing the tests, and it looks non-trivial...

Yes, I also had a go and the current tests really aren't set up for the directory size to be different across store types.

@benjeffery
Copy link
Contributor Author

I don't plan to work on this as we've moved over to v3.

@benjeffery benjeffery closed this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

V2 Affects the v2 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zarr DirectoryStore: getsize is wrong

4 participants