Skip to content

zarr.consolidated_metadata should not use previously consolidated (stale) metadata #2921

Open
@jhamman

Description

@jhamman

Zarr version

3.0.5

Numcodecs version

v0.15.1

Python Version

3.11

Operating System

Mac

Installation

conda/pip

Description

We're noticing some ugly behavior when re-consolidating a store with pre-existing consolidated metadata. If a child node in the store already has consolidated metadata in it, any subsequent consolidation attempts will fail to find children that were not present before the consolidation. Because there is no way to invalidate the consolidated metadata, it is not possible to consolidate the entire store.

Note: In #2920, we also noticed a distinct but related issue where the behavior of consolidate_metadata has changed to honor the path argument.

Steps to reproduce

store = zarr.storage.MemoryStore()

root = zarr.group(store=store, zarr_format=3)
root.create_group("foo")
zarr.consolidate_metadata(store, path="foo")
root.create_group("foo/bar/spam")
zarr.consolidate_metadata(store)

root = zarr.open_consolidated(store, zarr_format=3)
root.members(max_depth=100)
# (('foo', <Group memory://140600666693888/foo>),)

# expected
# (('foo', <Group memory://140600662927488/foo>),
#  ('foo/bar', <Group memory://140600662927488/foo/bar>),
#  ('foo/bar/spam', <Group memory://140600662927488/foo/bar/spam>))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions