Skip to content

Internal cache versioning #6799

@rjbou

Description

@rjbou

Internal caches (repository & switch state) are tied to opam version and possibly commit

let full () =
let git_version = match git () with
| None -> ""
| Some v -> Printf.sprintf " (%s)" (to_string v) in
Printf.sprintf "%s%s" (to_string current) git_version
let magic () =
let hash = Hashtbl.hash (full ()) in
String.sub (Printf.sprintf "%08X" hash) 0 8

This make the cache invalidated and rebuilded even if the structures didn't change. On an normal use, it is not so disturbing, the install.sh script does a reinit the rebuild repository cache. But projects that use opam-lib, loading repository state could take some time because of the invalidated cache.

We discussed it in dev meeting, and one solution would be to have proper cache versioning, no longer depending on opam version. Cache versions would bump only if the cache structure changes.

It would still depend on OCaml marshalling evolution, we need to investigate this part to avoid unintended segfaults.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions