-
Notifications
You must be signed in to change notification settings - Fork 256
Ensure places/origins are removed when a bookmark with no visits etc is removed. #5653
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should do the equivalent of
delete_pending_temp_tableshere—or at least aDELETE FROM moz_updateoriginsdelete_temp—after deleting the place.I think that would mean the origin would get cleaned up as soon as the bookmark is deleted, and you could avoid the call to
crate::storage::history::delete_everything(&conn)?in the bookmarks test.WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand this suggestion. First of all though, you are correct that the new call I added to
delete_everythingcan be removed immediately.But ISTM that the new trigger already is forcing that
delete_pending_temp_tablesdance - the trigger onmoz_bookmarkscauses a deletion ofmoz_places, which causes themoz_places_afterdelete_trigger_originstrigger. So sorry for being dense, but do you mind spelling it out :)Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, rad!
Yep, you're right!
But the
moz_places_afterdelete_trigger_originstrigger just inserts a row for the soon-to-be-deleted origin intomoz_updateoriginsdelete_temp. It doesn't actually delete the origin frommoz_origins, or update the global frecency stats inmoz_meta, until you doDELETE FROM moz_updateoriginsdelete_tempto fire themoz_updateoriginsdelete_afterdelete_trigger.At first, I thought this would leave the origin behind, because doing
DELETE FROM moz_placesby itself isn't enough to force thedelete_pending_temp_tablesdance. And that's why I thought we needed to force it by doing aDELETE FROM moz_updateoriginsdelete_tempin your new trigger.But then I realized that
delete_bookmarkcallsdelete_pending_temp_tables! So it's not necessary to do it in your new trigger, because thedelete_pending_temp_tablescall here will take care of it.So this is all working correctly now—if in a slightly indirect way that I didn't think all the way through—and you can ignore my suggestion! 😅