Use recalc_frecency for origins frecency instead of updating in triggers
Categories
(Toolkit :: Places, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox119 | --- | fixed |
People
(Reporter: mak, Assigned: mak)
References
Details
Attachments
(2 files)
While this will be a bit less performant than the old system updating the score by adding/subtracting in a trigger, it prepares us to take future algorithms that are not just a sum/subtraction, and it's less error-prone.
| Assignee | ||
Comment 1•2 years ago
|
||
So far we updated origins frecency in SQL triggers. While this guarantees good
performance, it has some downsides:
- using different algorithms is complicate, the current system only works
with a straight sum of page frecencies. We are planning to experiment and
eventually graduate new algorithms in the future. - it requires using multiple temp tables and DELETE triggers, that is quite
error prone for consumers, they may forget to DELETE from the temp tables
breaking data coherency. - there's not much ATOMicity, since the origins update must be triggered apart
and a crash would lost the requested changed
This patch is changing the behavior to be closer to the recalc_frecency one that
is used for pages. When pages are added or removed, recalc_frecency of its
origin is set to 1. Later frecencies will be recalculated in chunks.
While this is a bit less efficient than the existing system, it solves all the
problems presented above.
A threshold is recalculated at each chunk, and stored in the moz_meta table.
Temporarily the old STATS are also set in the moz_meta table, to allow for
downgrades. Those can be removed a couple versions in the future.
The after delete temp table is maintained because there's no more efficient way
to remove orphan origins promptly. Thus after removals from moz_places consumers
MUST DELETE from the temp table, otherwise orphan origins may remain. We'll
introduce some maintenance task to remove those, anyway, for privacy reasons.
Updated•2 years ago
|
Comment 3•2 years ago
|
||
| bugherder | ||
Comment 4•2 years ago
|
||
I see a console.log landed here at https://searchfox.org/mozilla-central/rev/b741ddde6c678ca7025858952202d20664491555/toolkit/components/places/PlacesUtils.sys.mjs#2266
Looks like a leftover, should it be removed?
| Assignee | ||
Comment 5•2 years ago
|
||
(In reply to Julian Descottes [:jdescottes] from comment #4)
I see a console.log landed here at https://searchfox.org/mozilla-central/rev/b741ddde6c678ca7025858952202d20664491555/toolkit/components/places/PlacesUtils.sys.mjs#2266
Looks like a leftover, should it be removed?
oops, yes thank you.
I'll add a revision to remove it.
| Assignee | ||
Comment 6•2 years ago
|
||
Comment 8•2 years ago
|
||
| bugherder | ||
Description
•