2

Improve logins sync

 1 year ago
source link: https://bugzilla.mozilla.org/show_bug.cgi?id=1752839
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Closed Bug 1752839 Opened 1 year ago Closed 8 days ago

Improve logins sync

Categories

(Toolkit :: Password Manager, enhancement, P2)

Toolkit ▾
Password Manager ▾

Tracking

(bug RESOLVED as FIXED)

RESOLVED FIXED

116 Branch

Tracking Status
firefox116 --- fixed

People

(Reporter: serg, Assigned: enndeakin)

References

Details

(Whiteboard: [fxsync-logins] [fxcm-csv])

:markh brought this up in our conversation about logins sync issue where I had 2 synced clients with different login count.

sync only "reconciles" all items when signing in to sync - in the general case, it only updates items it believes has changed. Unfortunately, logins still uses the "old" way of "tracking" items - it uses observers and listens for login manager notifications at https://searchfox.org/mozilla-central/rev/78963fe42f8d5f582f84da84a5e78377b6c1fc32/services/sync/modules/engines/passwords.js#408

The "new" way of tracking things - done for bookmarks and some others - is to have this sync metadata be in the store itself - so the login manager could flip a flag to say "changed since last sync" - that way it's far less likely that sync will have incorrect info about changed items. We should consider doing that for logins.

Lets find time to review and modernize logins sync.

Setting P2 for now to keep it visible.

Severity: -- → S2
Priority: -- → P2

Thanks Sergey! The way we've modernized other engines is something like:

  • Each login stores a "sync status" which is one of "new" (yet to be synced) or "normal" (syncing) and a "sync change counter" which is basically a flag to indicate if the item has changed (it's a counter so to handle the edge-case of the item changing during a sync - we record what the counter was at the start of a sync, and decrement at the end - if it's non-zero at that time, it changed during sync so is dirty). These are stored in the storage itself.

  • In general, sync itself maintains "sync status", but the store itself helps manage the change counter - each thing that touched a login increments it.

  • The sync modules then do not need to listen to the login manager observers (linked in comment 0), but instead it interacts with the store and these 2 new fields. "items to sync" are then something like "all items with status=="new" || counter > 0, etc.

Some extra work will be necessary to track "tombstones" correctly (a tombstone is a record on the server that indicates the item was deleted). Only items with a status=="normal" need a tombstone, but the fact the tombstone is needed (ie, in the time between the item being deleted and syncing) must be tracked somewhere. A tombstone really just needs to track the items GUID (and maybe the date of deletion, but maybe not)

Whiteboard: [fxsync-logins]
Assignee: nobody → enndeakin
Whiteboard: [fxsync-logins] → [fxsync-logins] [fxcm-csv]
c9e62c36c6c16218485bdb90fe88d63e?d=mm&size=64
Assignee

Updated

5 months ago
Blocks: 1768792
No longer depends on: 1768792
c9e62c36c6c16218485bdb90fe88d63e?d=mm&size=64
Assignee

Updated

5 months ago
Points: --- → 8
c9e62c36c6c16218485bdb90fe88d63e?d=mm&size=64
Assignee

Comment 3

4 months ago

Instead of recording a separate list of changes that could be incorrect, determine the list of modified logins when the sync occurs. Two flags are added to login info objects, the syncStatus that identifies that a login has been synced and a counter which is incremented during a sync and decremented by the same amount when the sync is complete. Deleted logins are flagged with a deleted marker rather than deleted directly.

This behaviour mirrors the form auto fill sync method.

c9e62c36c6c16218485bdb90fe88d63e?d=mm&size=64
Assignee

Comment 4

3 months ago

Removing this interface seemed simpler than adding a bunch of extra arguments/methods to both nsILoginManager and nsILoginManagerStorage

c9e62c36c6c16218485bdb90fe88d63e?d=mm&size=64
Assignee

Comment 5

3 months ago

Fix the rounding of the default argument to insertRecord as it can cause intermittent errors

Depends on D170817

Attachment #9321977 - Attachment description: WIP: Bug 1752839, add more password sync tests → Bug 1752839, add more password sync tests
Attachment #9321976 - Attachment description: WIP: Bug 1752839, remove the nsILoginManagerStorage interface. → Bug 1752839, remove the nsILoginManagerStorage interface.
Attachment #9319565 - Attachment description: WIP: Bug 1752839, improve logins sync by not using the LegacyTracker. → Bug 1752839, improve logins sync by not using the LegacyTracker.
Attachment #9321976 - Attachment description: Bug 1752839, remove the nsILoginManagerStorage interface. → WIP: Bug 1752839, remove the nsILoginManagerStorage interface.
Attachment #9319565 - Attachment description: Bug 1752839, improve logins sync by not using the LegacyTracker. → WIP: Bug 1752839, improve logins sync by not using the LegacyTracker.
Attachment #9321977 - Attachment description: Bug 1752839, add more password sync tests → WIP: Bug 1752839, add more password sync tests
Attachment #9319565 - Attachment description: WIP: Bug 1752839, improve logins sync by not using the LegacyTracker. → Bug 1752839, improve logins sync by not using the LegacyTracker.
Attachment #9321977 - Attachment description: WIP: Bug 1752839, add more password sync tests → Bug 1752839, add more password sync tests
Attachment #9321976 - Attachment description: WIP: Bug 1752839, remove the nsILoginManagerStorage interface. → Bug 1752839, remove the nsILoginManagerStorage interface.
Attachment #9321976 - Attachment description: Bug 1752839, remove the nsILoginManagerStorage interface. → Bug 1752839, remove the nsILoginManagerStorage interface, r=sgalich
Attachment #9319565 - Attachment description: Bug 1752839, improve logins sync by not using the LegacyTracker. → Bug 1752839, improve logins sync by not using the LegacyTracker, r=sgalich,dimi,joschmidt,markh,skhamis
Attachment #9321977 - Attachment description: Bug 1752839, add more password sync tests → Bug 1752839, add more password sync tests, r=dimi,sgalich
Pushed by [email protected]:
https://hg.mozilla.org/integration/autoland/rev/7e809ca5c010
remove the nsILoginManagerStorage interface, r=credential-management-reviewers,dimi,sgalich
Status: NEW → RESOLVED
Closed: 8 days ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
You need to log in before you can comment on or make changes to this bug.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK