Skip to content

Commit

Permalink
push: use reflink/copy with FileStorage
Browse files Browse the repository at this point in the history
We surely don't want to make symlinks or hardlinks during push, so it
is better to just explicitly state what we want.

Otherwise there could be a situation where we are pushing from local odb
cache to a version aware remote and we run into cache having unsupported
link types configured as the only option (e.g. `reflink,symlink,hardlink`)
and thus failing to push.
  • Loading branch information
efiop committed Oct 31, 2023
1 parent 3ffc0d5 commit 311b031
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ install_requires=
dictdiffer>=0.8.1
pygtrie>=2.3.2
shortuuid>=0.5.0
dvc-objects>=1.0.1,<2
dvc-objects>=1.1.0,<2
diskcache>=5.2.1
attrs>=21.3.0
sqltrie>=0.8.0,<1
Expand Down
6 changes: 4 additions & 2 deletions src/dvc_data/index/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def _create_files( # noqa: C901
storage: str = "cache",
onerror=None,
state: Optional["StateBase"] = None,
links: Optional[List[str]] = None,
):
if index is None:
return
Expand Down Expand Up @@ -119,8 +120,7 @@ def _create_files( # noqa: C901
src_fs = storage_obj.fs
entries, src_paths, dest_paths = zip(*args)

links = None
if isinstance(storage_obj, ObjectStorage):
if links is None and isinstance(storage_obj, ObjectStorage):
links = storage_obj.odb.cache_types

transfer(
Expand Down Expand Up @@ -353,6 +353,7 @@ def apply(
storage: str = "cache",
onerror: Optional[Callable] = None,
state: Optional["StateBase"] = None,
links: Optional[List[str]] = None,
) -> None:
if fs.version_aware and not latest_only:
if callback == DEFAULT_CALLBACK:
Expand Down Expand Up @@ -390,6 +391,7 @@ def apply(
callback=callback,
update_meta=update_meta,
state=state,
links=links,
)

_chmod_files(diff.files_chmod, path, fs)
Expand Down
1 change: 1 addition & 0 deletions src/dvc_data/index/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def push(
storage="cache",
jobs=jobs,
callback=cb,
links=["reflink", "copy"],
)
fetched += len(diff.changes.get("added", []))

Expand Down

0 comments on commit 311b031

Please sign in to comment.