-
Notifications
You must be signed in to change notification settings - Fork 2.9k
WIP: Improve performance of expire snapshot by not double-scanning non-expired manifests #4736
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
Conversation
|
I think this is an interesting idea. Let me summarize how I understand it. Right now, we compute a diff between the reachability sets before and after snapshot expiry. Whenever we build the reachability set before the expiry, we read manifests of all snapshots and that seems suboptimal. The assumption is that it is sufficient to just build the reachability set for expired snapshots and compare that to the reachability set after the snapshot expiry. Did I get that right? I guess one way to implement (and I believe this is what this PR tries to do) is to load the An alternative idea is to add some sort of Does that seem reasonable? |
|
Thanks for this complete thought, it makes sense to me. Yea I should have thought about the idea of passing a list of snapshot-ids as options, this would probably be a cleaner way to achieve this filtering to get expiredManifests. And I like the second optimization as well (expiredManifests.except(allManifests)). |
|
@RussellSpitzer, could you cross-check the idea as you worked on this part in the past? |
|
I think this is a really good idea, and I also like Anton's idea to filter manifests that are still live from the removed snapshots as well. Basically, we should be filtering the tree at every level (snapshot/manifest-list, manifest, files) before moving on to the next one.
Does that sound right? We may not want to do #6, but there is an opportunity to cut down on the number of manifests we read there by looking at the manifest file metadata. |
|
@rdblue, yeah, that's what I am thinking too. Do you refer to point 5 or 6 as optional? I guess 5. The current code reads only live entries so filtering manifests without live files seems safe. What's the use case with re-added files? Won't that be covered too as the snapshot with re-added files will be also considered? |
You're right: it's 5 that is optional. My mistake. |
|
The manifest skipping idea sounds good to me, basically lets us cut down on the "except" cost as well. |
|
Thanks for tagging me Anton. I think this is a good idea as well. I won’t repeat others but I have some questions and possibly a few additional ideas but I need to go through some theoretical cases on paper first.
Two thoughts:
|
|
Hi @aokolnychyi @rdblue , update on this discussion (see main changes in #3457). I implemented and was playing around with these optimizations in calculating the delete candidate files: (skipping current snapshot_ids, and skipping current manifests). But I find actually that only this optimization : I found in my scenario (expiring 1 snapshot), the skipping of valid manifests actually makes the performance worse. EDIT: Was thinking that there is a scenario that skipping the current manifest will help is: The snapshots to expire point to a lot of data files that wont be deleted, because the manifests they point to are still live in the retained set of snapshots. But still, I feel the cost of adding the extra spark join may not be worth it in all cases. In the skip valid snapshot case, we can do a free in-memory filter pushdown without taking a Spark job, whereas it has to be an addition Spark join the way the current code works for reading all the manifests. |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
Variation of #3457 that attempts to use time-travel on Manifest table to do the snapshot filtering. Demonstration, as it seems Manifest table does not support time travel yet.