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

refactor: allow for eviction of layers in a batch #3557

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

problame
Copy link
Contributor

@problame problame commented Feb 7, 2023

refactor: allow for eviction of layers in a batch

The auto-eviction PR (#3552) operates in two phaes:

  1. find candidate layers
  2. evict them.

For (2), a batch API like the one added in this commit is useful.

Note that this PR requires #3558 to be merged first.
Otherwise, the tests won't pass.

@problame problame changed the title refactor: API for batched eviction refactor: allow for eviction of layers in a batch Feb 7, 2023
@problame problame marked this pull request as ready for review February 7, 2023 15:55
@problame problame requested review from a team as code owners February 7, 2023 15:55
@problame problame requested review from knizhnik and removed request for a team and knizhnik February 7, 2023 15:55
@problame problame self-assigned this Feb 7, 2023
koivunej added a commit that referenced this pull request Feb 8, 2023
This changes the way we compare `Arc<dyn PersistentLayer>` in Timeline's
`LayerMap` not to use `Arc::ptr_eq` which has been witnessed in
development of #3557 to yield wrong results. It gives wrong results
because it compares fat pointers, which are `(object, vtable)` tuples
for `dyn Trait` and there are no guarantees that the `vtable`s are
unique. As in there were multiple vtables for `RemoteLayer` which is why
the comparison failed in #3557.

This is a known issue in rust, clippy warns against it and rust std
might be moving to the solution which has been reproduced on this PR:
compare only object pointers by "casting out" the vtable pointer.
Copy link
Member

@koivunej koivunej left a comment

Choose a reason for hiding this comment

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

This is good as we do this with single rebuild and all, my refactoring suggestion isn't critical, but I would like to why does it not work.

The auto-eviction PR (#3552) operates in two phaes:

  1. find candidate layers
  2. evict them.

For (2), a batch API like the one added in this commit is useful.

Note that this PR requires #3558 to be merged first.
Otherwise, the tests won't pass.
@problame
Copy link
Contributor Author

problame commented Feb 8, 2023

Your refactoring suggestion does work, I was wrong about the reordering.

Re drop_guard: we confirmed on Slack that it isn't actually helpful here, because it's all the same future.

@problame problame merged commit 7ed93ff into main Feb 8, 2023
@problame problame deleted the problame/batch-evict branch February 8, 2023 13:40
@shanyp shanyp mentioned this pull request Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants