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

Fix calculation of packed slots minimum when calculating accounts to combine #3251

Merged
merged 3 commits into from
Oct 23, 2024

Conversation

dmakarov
Copy link

@dmakarov dmakarov commented Oct 21, 2024

Problem

In ancient pack, we can encounter storages which can't be safely moved to new slots. One example is when a storage contains an alive account whose refcount > 1. In that case, we can only move the alive account to a slot that is newer than the current slot. Otherwise, we risk moving the alive account to a slot older than the currently dead account. If we restarted from a snapshot, we would have the wrong alive version of an account.
When determining whether individual storages can be packed, when we encounter a storage with a multi ref account and we determine we can't pack it this time, we have now decreased the # of alive bytes we'll be writing. As a result, we now reduce the # required ideal packed storages. As a result, this makes it easier for multi ref storages we encounter later in this pack to succeed.

Summary of Changes

If we determine a storage cannot be packed, reduce the # alive bytes so we can reduce the # ideal storages we'll be creating. This allows the algorithm to make progress.

@dmakarov dmakarov marked this pull request as ready for review October 23, 2024 14:59
Copy link

@jeffwashington jeffwashington left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

@HaoranYi HaoranYi left a comment

Choose a reason for hiding this comment

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

looks correct to me.

With the tighter bounds of target_slots, we will have more chance to pack.

@dmakarov dmakarov merged commit e585063 into anza-xyz:master Oct 23, 2024
40 checks passed
@dmakarov dmakarov deleted the ab branch October 23, 2024 19:48
ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
…combine (anza-xyz#3251)

* Fix calculation of packed slots minimum when calculating accounts to combine

* Fix test

* Fix test
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.

4 participants