Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use accessor in pack store #2070

Merged
merged 1 commit into from Sep 7, 2022

Conversation

Ngoguey42
Copy link
Contributor

No description provided.

@Ngoguey42 Ngoguey42 force-pushed the use-accessor-in-pack_store branch 3 times, most recently from ba9bc54 to b7d723e Compare September 5, 2022 13:47
@Ngoguey42 Ngoguey42 marked this pull request as ready for review September 5, 2022 13:47
@Ngoguey42
Copy link
Contributor Author

It's ready for review. It however doesn't pass #2068

src/irmin-pack/unix/pack_store.ml Show resolved Hide resolved
|| Lru.mem t.lru (offset_of_key t k)
|| pack_file_contains_key t k
match Pack_key.inspect k with
| Indexed hash -> Tbl.mem t.staging hash || pack_file_contains_key t k
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit confusing for me: we can have in staging indexed keys, but not in the lru?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key doesn't contain an offset, so its overall easier to directly lookup on disk

src/irmin-pack/unix/pack_store.ml Show resolved Hide resolved
| Indexed hash -> (
match Tbl.find t.staging hash with
| v ->
(* Hit in staging, but we don't have offset to put in LRU *)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is changing a bit the behaviour wrt the lru, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I think it makes sense beceause we've migrated from a hash-keyed lru to an offset-keyed lru

Copy link
Contributor

@icristescu icristescu Sep 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its still not very clear to me: whenever we add a hash in staging we also add an offset in the lru.

with this change I think now we can promote values indexed keys in the lru (via Lru.add and Lru.mem in unsafe_mem) only once they left the staging? (it probably does not change much in practice, as its unlikely to have indexed keys that have a hash in staging)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added an assert false for this case (indexed hash in staging) and the test suite passes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's postpone this discussion for now, and we can come back to it later (opened #2077).

@Ngoguey42
Copy link
Contributor Author

Thanks for the review @icristescu

src/irmin-pack/unix/pack_store.ml Outdated Show resolved Hide resolved
src/irmin-pack/unix/pack_store.ml Outdated Show resolved Hide resolved
@metanivek
Copy link
Member

Can we close #2069 and bring in the commit from #2068 to have one PR?

@icristescu icristescu mentioned this pull request Sep 7, 2022
@Ngoguey42
Copy link
Contributor Author

Ngoguey42 commented Sep 7, 2022

The CB reports +0.2% objects allocated. I think it's safe to extrapolate this result to the 5h-long benchmark.

@icristescu what do you think?

@icristescu
Copy link
Contributor

The CB reports +0.2% objects allocated. I think it's safe to extrapolate this result to the 5h-long benchmark.

@icristescu what do you think?

Yes, let's not block for this.

This commit is meant to better handle objects that are still live in
index but that have been GCed.
@Ngoguey42
Copy link
Contributor Author

Merge when green

@icristescu icristescu merged commit a244f56 into mirage:main Sep 7, 2022
icristescu pushed a commit to icristescu/opam-repository that referenced this pull request Sep 7, 2022
…min-pack, irmin-mirage, irmin-mirage-graphql, irmin-mirage-git, irmin-http, irmin-graphql, irmin-git, irmin-fs, irmin-containers, irmin-cli, irmin-chunk and irmin-bench (3.4.1)

CHANGES:

### Added

- **irmin**
  - Add `Storage` module for creating custom storage layers (mirage/irmin#2047, @metanivek)

- **irmin-pack**
  - Add `Gc.is_allowed` (mirage/irmin#2076, @icristescu)
  - Add a `weight` parameter in the LRU implementation to bound
    memory usage (mirage/irmin#2050, @samoht)

### Changed

- **irmin**
  - Removed `Irmin_unix.set_listen_dir_hook` (mirage/irmin#2071, @zshipko)

### Fixed

- **irmin-pack**
  - Fix the behaviour of irmin-pack regarding hashes and keys to GCed objects.
    It used to not correctly ignore these entries, which could have resulted in
    various bugs. E.g. the impossibility to append an object that used to be
    dead and that has its hash in index. (mirage/irmin#2070, @Ngoguey42)
@irmaTS irmaTS added tezos-support Support for bugs related to Tezos users/tezos Related to Tezos users labels Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tezos-support Support for bugs related to Tezos users/tezos Related to Tezos users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants