Replies: 3 comments 5 replies
|
This is broadly correct. I'm not really sure what you're asking though.
Specifically, any in-memory variables (i.e.
There is not, but there could be. See earth-mover/icechunk#104.
Deleting chunks / arrays can be done. See https://icechunk.io/en/latest/getting-started/howto/#delete-a-group
So you want some kind of utility which, given a list of deleted granules (files), deletes all virtual chunks in the store that reference those files? That sounds doable.
See the icechunk docs on Data Expiration and Garbage Collection ! And the Arraylake docs on Garbage Collection and Expiration, which run the GC jobs for you on a schedule! ("Compaction" is a slightly different thing, but you could also do that with Icechunk).
Icechunk has a transaction log, which includes deletions.
Those are already in the Icechunk manifests. They just aren't super accessible from python right now. What is the reason for using Parquet / Kerchunk here? It seems like every feature you want is something that Icechunk was either specifically designed to provide or could potentially provide without too much work. |
Not a question, this is meant to understand the current state of mutable stores in I think a couple ideas that can improve the way virtualizarr uses Kerchunk are within reach, e.g. validating the references when we open a store, and adding Agreed on IceChunk, (see the footnote). |
|
@betolink A few points. I don't think we've written an issue for it yet but we will likely be undertaking work to build an Icechunk parser for Virtualizarr during some upcoming sprints. The goal for this is as you described to increase reference portability and also inform how we might consider building a reference serialization specification for native Zarr as well. With respect to appending and deleting, Parquet datasets are not a transactional store. Most organizations using Parquet or Zarr in operational systems require some type of transactional layer over storage to address the issues you are describing. These requirements were the driving principles in the development of Iceberg and Icechunk. As @TomNicholas mentioned, there is no compelling reason to choose Kerchunk/Parquet as a serialization target for virtual references any longer and a host of issues as reasons not to. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Data producers are often in the need of virtualizing living datasets, these datasets are modified by 2 operations: append and delete. I'd like to understand the current state of things regarding mutable stores with
virtualizarrand the broader ecosystem. Let's assume we virtualize a collection with 100k items and then Id like to understand what happens if we try to append and/or delete items from it, and what happens when we try to access a store that has mutated.Virtualizing
virtualizarrwrote the chunk manifests to disk and if I'm not mistaken it embeds the coordinate dimension values (at least for kerchunk). This store can be opened by compatible clients -most of them in the Python ecosystem-. Icechunk has support in Javascript and Rust.Appending
Requirements:
Opening a virtual store from disk as a virtual store in
virtualizarrseems to be limited by a couple factors, for Icechunk I don't think there is a parser that will read an icechunk store and create the pureManifestStorerepresentation, maybe this is not a big issue since Icechunk can be opened directly by xarray. For Kerchunk, the limitation lies in reading those coordinates that were serialized as native chunks, they are not references. This has workarounds and seems like a permanent fix is coming soon.Kerchunk
Notice that we are manually concatenating the virtual datasets, perhaps we need a
vds.virtualize.to_kerchunk(uri.parquet, append_dim="time")for better user experience even if this is just replacing the parquet file not actually appending (for small collections). For collections with potentially millions of items appending in a columnar format makes sense. Also notice that appendingjsonis not a thing so we should avoid it at all costs.IceChunk
Appending operations are easier with Icechunk, we open a writable session pointed to the IceChunk store and use the VDS of the new items with that session store.
Appending with VirtualiZarr is definitely doable and could lower the operational costs for big collections, however we still need to deal with the other operation: deleted granules
Deleting
Once in a while data producers delete files from a collection, sometimes is a quality issue or a reprocessing campaign that affects only a subset of files, maybe is just bad data. In any of these scenarios a file that was processed and is referenced in a virtual store has changed or has been deleted. In a traditional database, updating a row is as simple as
DELETE FROM table WHERE unique_id = value;In the virtual store world is not that simple. Parquet files are immutable by definition and we don't have a simple mechanism to delete rows in a columnar format (as is an anti-pattern). This leaves us with full rewrites. Maybe we can implement a "smart" full re-write by not having to parse the archive from scratch. If a verification method is implemented in the Kerchunk parsers we can very well "prune" the missing references so when we serialize the store we don't include them.
This validation flag will test that all references are at least reachable (HTTP HEAD) and will skip those that aren't. It will be slower than just loading the references into memory but I suspect way faster than parsing all from scratch.
Another aspect of this problem is what happens in the clients (focusing on xarray for now) when we load virtual stores with missing chunks.
xr.open_zarr()orxr.open_dataset()read()On top of implementing a kerchunk validation mechanism, it would be great if xarray/dask had the same fail-safe, if a chunk is not reachable, it be counted as
NullValue,FillValueor just skip it, right now a runtime error of this kind is a showstopper unless we manually handle(hack) the exceptions.More deletion strategies1
Beyond validation and pruning, a more robust deletion model for virtual stores could include the following ideas:
Deletion manifests – Instead of rewriting the entire Parquet file, maintain a separate "deletion log" (e.g., a small Parquet or JSONL file) listing the unique identifiers (e.g., granule IDs or time indices) that have been deleted. When opening the virtual dataset, virtualizarr would filter out any references found in the deletion log. This turns deletion into an O(1) append operation, though it adds some complexity to the read path but it will avoid the need for an actual HTTP request like in
validate=True.Compaction (AKA garbage collection)– Periodically, rewrite the main Parquet file to incorporate deletions and remove the deletion log. This can be done offline, avoiding the cost of a full rewrite on every delete. Perhaps VirtualiZarr could implement a high-level method like
vds.virtualize.compact()for Kerchunk, it would rewrite the paruqet and delete the deletion manifest; for IceChunk, it could create a new versioned commit that excludes the specified granules. It's just UX as a user can do it manually but this would be simpler.Implementing any of these approaches would improve the usability of virtual stores for living datasets, especially when deletions are frequent. The current "full rewrite or validation + prune" model is acceptable but it may not scale well for collections with millions of granules.
Interoperability
Finally a note on interoperability, this is orthogonal to mutable collections. It would be useful for data producers to be able to open any chunk manifest format (
icechunkandkerchunkand who knows in the future: MinecraftChunk), mutate it and save it in another format or even better, mix and matched formats. It may be also useful to have an schema at the chunk level that focuses on virtual references. This has been recently discussed at the ESIP cloud computing cluster.Feel free to comment and edit or correct my misunderstandings, the overall goal to me is to ease user friction with virtual stores specially when they are used via earthaccess.
Footnotes
I think some (if not all) of these ideas are already present in Icechunk/ArrayLake. I wonder if in the near future Icechunk would be the only technology we will need to accomplish data virtualization. ↩
All reactions