Commit e095d9f
Fix silent data corruption when writing dask arrays to sharded zarr stores (#11117)
When writing dask-backed arrays to zarr with sharding enabled, the chunk
alignment validation was checking against zarr's internal chunk size instead
of the shard size. This allowed configurations where dask chunk boundaries
didn't align with shard boundaries, causing data corruption during parallel
writes.
This fix uses shard boundaries (when shards are specified) for both
grid_rechunk() and validate_grid_chunks_alignment(), ensuring that parallel
writes don't cross shard boundaries.
Fixes #10831
Co-authored-by: Claude <noreply@anthropic.com>1 parent 519e5d1 commit e095d9f
File tree
3 files changed
+49
-4
lines changed- doc
- xarray
- backends
- tests
3 files changed
+49
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1240 | 1240 | | |
1241 | 1241 | | |
1242 | 1242 | | |
1243 | | - | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
1244 | 1249 | | |
1245 | 1250 | | |
1246 | | - | |
| 1251 | + | |
1247 | 1252 | | |
1248 | 1253 | | |
1249 | 1254 | | |
1250 | | - | |
| 1255 | + | |
1251 | 1256 | | |
1252 | 1257 | | |
| 1258 | + | |
1253 | 1259 | | |
1254 | 1260 | | |
1255 | 1261 | | |
| |||
1260 | 1266 | | |
1261 | 1267 | | |
1262 | 1268 | | |
1263 | | - | |
| 1269 | + | |
1264 | 1270 | | |
1265 | 1271 | | |
1266 | 1272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2869 | 2869 | | |
2870 | 2870 | | |
2871 | 2871 | | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
2872 | 2907 | | |
2873 | 2908 | | |
2874 | 2909 | | |
| |||
0 commit comments