gecko-dev/third_party
Lina Cambridge 9320172d8f Bug 1567238 - Refactor the bookmarks mirror merge triggers to do less work. r=tcsc,markh
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
2019-08-06 23:48:03 +00:00
..
aom Bug 1368843: Enable libaom on Android. r=jya 2018-09-20 08:25:35 +00:00
dav1d Bug 1568515 - Import dav1d from upstream to c138435. r=TD-Linux 2019-07-24 17:03:48 +00:00
msgpack Bug 1523312 - do not export msgpack, as it has no callers out side of libxul r=dmajor 2019-02-27 19:33:54 +00:00
prio Bug 1539715 - update vendored libprio to 1.5 r=glandium 2019-03-29 08:46:26 +00:00
python Bug 1564314 - Move gdbpp back to python/. r=nalexander 2019-07-11 02:39:31 +00:00
rlbox Bug 1566284 - Include rlbox in the Firefox repo r=froydnj 2019-07-26 16:35:20 +00:00
rust Bug 1567238 - Refactor the bookmarks mirror merge triggers to do less work. r=tcsc,markh 2019-08-06 23:48:03 +00:00
sqlite3 Bug 1564889 - Upgrade to SQLite 3.29.0. r=mak 2019-07-16 11:42:14 +00:00
webkit/PerformanceTests Bug 1548814 - Migrate ARES6 benchmark to Raptor r=rwood,perftest-reviewers,igoldan,acreskey 2019-07-16 11:22:02 +00:00
moz.build Bug 1566284 - Include rlbox in the Firefox repo r=froydnj 2019-07-26 16:35:20 +00:00