Observations database clearing improvements #495
Merged
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.
Task/Issue URL: https://app.asana.com/0/0/1201945748431037/f
Tech Design URL:
CC: @ladamski
Description:
This PR updates the logic used to clear Apple's
observations.db
. There are three changes:wal
file is moved into the main database. The observations database uses Write-Ahead Logging, hence the need for this call.VACUUM
call is made to tell the database to clean up after itself.strings
over the database, so the delete call is run more time - it's unclear to me why, but this final step triggers SQLite to fully clean up after itself in my testing.For further context: this database is used by Intelligent Tracking Protection, and stores a list of domains used by that feature. We have no official way to clear or disable it, hence the direct SQL usage.
Steps to test this PR:
~/Library/WebKit/com.duckduckgo.macos.browser.debug/WebsiteData/ResourceLoadStatistics
in your terminalstrings observations.db-wal observations.db | grep ".com"
, which will show you a list of domains that you've visited - gross!strings observations.db-wal observations.db | grep ".com
again, you should get no results back - if you do, then this PR should not be approved and further investigation is neededls -la
- it's expected that theobservations.db-wal
file is totally empty. This isn't a hard requirement of the PR (we only care if any data is left over), but is expected due to the checkpoint callstrings observations.db-wal observations.db | grep ".com"
one last time, it should once again show you some of the domains you've visited. This is unfortunately expected, and unavoidable, they'll get cleared again the next time you use the Fire button.Testing checklist:
Internal references:
Software Engineering Expectations
Technical Design Template
When ready for review, remember to post the PR in MM