You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# RebaseFailedError: Rebase failed on snapshot AE9XS2ZWXT861KD2JGHG: 1 conflicts found
328
324
```
329
325
330
-
This however fails because both sessions modified metadata. We can use the `ConflictError` to get more information about the conflict.
331
-
332
-
```python
333
-
try:
334
-
session2.rebase(icechunk.ConflictDetector())
335
-
except icechunk.RebaseFailedError as e:
336
-
print(e.conflicts)
337
-
338
-
# [Conflict(ZarrMetadataDoubleUpdate, path=/)]
339
-
```
340
-
341
-
This tells us that the conflict is caused by the two sessions modifying the metadata attributes of the root group (`/`). In this case we have decided that second session set the `foo` attribute to the correct value, so we can now try to rebase by instructing the `rebase` method to use the second session's changes with the [`BasicConflictSolver`](../reference/#icechunk.BasicConflictSolver).
342
-
343
-
```python
344
-
session2.rebase(icechunk.BasicConflictSolver())
345
-
```
346
-
347
-
Success! We can now try and commit the changes again.
348
-
349
-
```python
350
-
session2.commit(message="Update foo attribute on root group")
351
-
352
-
# 'SY4WRE8A9TVYMTJPEAHG'
353
-
```
354
-
355
-
This same process can be used to resolve conflicts with arrays. Let's try to modify the `data` array from both sessions.
356
-
357
-
```python
358
-
session1 = repo.writable_session("main")
359
-
session2 = repo.writable_session("main")
360
-
361
-
root1 = zarr.group(session1.store)
362
-
root2 = zarr.group(session2.store)
363
-
364
-
root1["data"][0,0] =1
365
-
root2["data"][0,:] =2
366
-
```
367
-
368
-
We have now created a conflict, because the first session modified the first element of the `data` array, and the second session modified the first row of the `data` array. Let's commit the changes from the second session first, then see what conflicts are reported when we try to commit the changes from the first session.
369
-
370
-
```python
371
-
print(session2.commit(message="Update first row of data array"))
372
-
print(session1.commit(message="Update first element of data array"))
# ConflictError: Failed to commit, expected parent: Some("SY4WRE8A9TVYMTJPEAHG"), actual parent: Some("5XRDGZPSG747AMMRTWT0")
386
-
```
387
-
388
-
Okay! We have a conflict. Lets see what conflicts are reported.
326
+
This however fails because both sessions modified metadata. We can use the `RebaseFailedError` to get more information about the conflict.
389
327
390
328
```python
391
329
try:
@@ -470,4 +408,4 @@ root["data"][:,:]
470
408
471
409
#### Limitations
472
410
473
-
At the moment, the rebase functionality is limited to resolving conflicts with attributes on arrays and groups, and conflicts with chunks in arrays. Other types of conflicts are not able to be resolved by icechunk yet and must be resolved manually.
411
+
At the moment, the rebase functionality is limited to resolving conflicts with chunks in arrays. Other types of conflicts are not able to be resolved by icechunk yet and must be resolved manually.
0 commit comments