diff --git a/dvc/objects/db/index.py b/dvc/objects/db/index.py index 4dc952a64..2b65f07b7 100644 --- a/dvc/objects/db/index.py +++ b/dvc/objects/db/index.py @@ -88,7 +88,7 @@ class ObjectDBIndex(ObjectDBIndexBase): tmp_dir: "StrPath", name: str, ): # pylint: disable=super-init-not-called - from diskcache import Index + from diskcache import Cache, Index from dvc.fs.local import LocalFileSystem from dvc.utils.fs import makedirs @@ -96,7 +96,13 @@ class ObjectDBIndex(ObjectDBIndexBase): self.index_dir = os.path.join(tmp_dir, self.INDEX_DIR, name) makedirs(self.index_dir, exist_ok=True) self.fs = LocalFileSystem() - self.index = Index(self.index_dir) + self.index = Index.fromcache( + Cache( + self.index_dir, + disk_pickle_protocol=4, + eviction_policy="none", + ) + ) def __iter__(self): return iter(self.index)