mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 02:35:41 +00:00
9320172d8f
This commit reduces the number of database writes and table scans needed to merge synced bookmarks. * Remove `fetchNew{Local, Remote}Contents`. Fetching the tree already scans the table, so we can piggyback on it to fetch content info for deduping. * Store completion ops in temp tables to only update changed parts of the local tree, and remove the `mergeStates` table and views. * Replace the `itemsToMerge` view with an indexed `itemsToApply` temp table. * Replace the `updateGuidsAndSyncFlags` trigger with a `changeGuidOps` table and a `changeGuids` trigger. * Replace the `updateLocalItems` trigger with an `apply_remote_items` function to bulk upsert new and updated items. * Replace the `structureToMerge` view with an `applyNewLocalStructureOps` table that holds parents and positions for moved items, and an `applyNewLocalStructure` trigger to update them. * Remove tombstones for revived items, update change counters, and flag mirror items as merged directly in `update_local_items_in_places`, instead of indirecting through temp tables. * Don't mark items flagged for reupload as merged, since we'll write them back to the mirror after upload. * Use a scalar subquery instead of a join in the `localTags` view to look up the tags root ID. * Replace `relatedIdsToReupload` with a `Store::prepare` method that flags all bookmarks with keyword-URL mismatches for reupload. * Trigger frecency updates for origins once, not for every item. * Remove two extra scans on `itemsAdded` and `itemsChanged` when recording observer notifications for changed keywords. * Notify all `bookmark-added` listeners in a single batch. This also fixes some edge cases: * Update root positions correctly after deleting a non-syncable root or item. * Keyword-URL mismatches may reupload more items than before, but now ensure that all bookmarks with the same URL have the same keyword. * Only set items with deduped GUIDs to `SYNC_STATUS_NORMAL` after merging. * Bump the last modified time for modified items only. Differential Revision: https://phabricator.services.mozilla.com/D39889 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
locales | ||
modules | ||
modules-testing | ||
tests | ||
tps/extensions/tps | ||
components.conf | ||
moz.build | ||
services-sync.js | ||
SyncComponents.manifest | ||
Weave.jsm |