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
feat!: dag import - don't pin roots by default (#9926)
* feat!: dag import - don't pin roots by default
Fixes: #9765
* test(ipip-402): dag import
this adds basic regression test that guards behavior
around partial cars with or without pinning
* docs(ipip-402): ipip and dag import changelog
---------
Co-authored-by: Marcin Rataj <[email protected]>
Batch block retrieval minimizes round trips, catering to the requirements of
116
+
light HTTP clients for directory enumeration, range requests, and content path
117
+
resolution.
118
+
119
+
#### `ipfs dag import` no longer pins by default
120
+
121
+
With the gateway now capable of handling partial CAR exports
122
+
([IPIP-402](https://github.com/ipfs/specs/pull/402)) and incomplete DAG CARs
123
+
becoming more prevalent, there have been changes to the pinning mode when using
124
+
`ipfs dag import`.
125
+
126
+
Recursive pinning of the entire DAG within an imported CAR is now optional. To
127
+
explicitly attempt pinning the DAG referenced by any roots present in the CAR,
128
+
you can opt in by using the `--pin-roots` option.
129
+
130
+
Pinning incomplete DAG will produce an error:
131
+
132
+
```console
133
+
$ curl 'http://127.0.0.1:8080/ipns/docs.ipfs.tech?format=car&dag-scope=entity'> ./partial-entity.car # Kubo 0.21.0 with IPIP-402 (only root block of unixfs dir)
134
+
$ ipfs dag import --stats --pin-roots=true ./partial-entity.car
135
+
Error pinning QmPDC11yLAbVw3dX5jMeEuSdk4BiVjSd9X87zaYRdVjzW3 FAILED: block was not found locally (offline): ipld: could not find QmPDvrDAz2aHeLjPVQ4uh1neyknUmDpf1GsBzAbpFhS8ro
test_expect_success "'ipfs dag import' with no params in CLI mode produces exit code 0 (unixfs dir exported as dag-scope=entity from IPIP-402)"'
303
+
test_expect_code 0 ipfs dag import ../t0054-dag-car-import-export-data/partial-dag-scope-entity.car
304
+
'
305
+
306
+
test_expect_success "'ipfs dag import' with pinning errors due to incomplete DAG (unixfs dir exported as dag-scope=entity from IPIP-402)"'
307
+
ipfs dag import --stats --enc=json --pin-roots=true ../t0054-dag-car-import-export-data/partial-dag-scope-entity.car >partial_pin_import_out 2>&1 &&
308
+
test_should_contain "\"PinErrorMsg\":\"block was not found locally" partial_pin_import_out
309
+
'
310
+
311
+
test_expect_success "'ipfs dag import' pin error in default CLI mode produces exit code 1 (unixfs dir exported as dag-scope=entity from IPIP-402)"'
312
+
test_expect_code 1 ipfs dag import --pin-roots ../t0054-dag-car-import-export-data/partial-dag-scope-entity.car >partial_pin_import_out 2>&1 &&
313
+
test_should_contain "Error: pinning root \"QmPDC11yLAbVw3dX5jMeEuSdk4BiVjSd9X87zaYRdVjzW3\" FAILED: block was not found locally" partial_pin_import_out
0 commit comments