Clear mTime from asyncStorage in Sync app after DataStore clear

RESOLVED FIXED in FxOS-S10 (30Oct)

Status

Firefox OS
Sync
P1
normal
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: michielbdejong, Assigned: michielbdejong)

Tracking

(Blocks: 1 bug)

unspecified
FxOS-S10 (30Oct)
ARM
Gonk (Firefox OS)
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
The TV will send a command to clear all local data from the Sync app when the user logs out of FxA (and therefore disables Sync). When this command is received, all data should be wiped from Kinto.js, localStorage, and all DataStores to which the sync app has access (the TV browser will keep its local bookmarks/history outside the applicable DataStores).
(Assignee)

Updated

2 years ago
Assignee: nobody → mbdejong
Blocks: 1195647
Priority: -- → P2
Target Milestone: --- → FxOS-S10 (30Oct)
(Assignee)

Updated

2 years ago
Blocks: 1216022

Comment 1

2 years ago
Created attachment 8676635 [details] [review]
[gaia] michielbdejong:1216319-clear-command > mozilla-b2g:master
(Assignee)

Comment 2

2 years ago
New plan: listen for DataStore#clear operations, and react to that instead of getting the command through IAC.
(Assignee)

Updated

2 years ago
Priority: P2 → P1
(Assignee)

Comment 3

2 years ago
Changed this so that it only clears `mTime` from `asyncStorage`. That's enough to make sure the DataStore is repopulated on next sync for that userId.

Should this operation fail, then on next logout/login it will be repeated.

It's not easy to see the last operation for a DataStore (you have to cursor through all the history), so instead I'm checking if the DataStore has zero records.

I created follow-up bug 1218420 in case we want to clear more than just the mTime, so that maybe we can get out of some data corruption situations, but that requires more thought to see how we can make that work both on the TV and on the phone (where the DataStore is never cleared).
(Assignee)

Updated

2 years ago
Duplicate of this bug: 1218680
(Assignee)

Updated

2 years ago
Summary: Support clearing data in Sync app → Clear mTime from asyncStorage in Sync app after DataStore clear
(Assignee)

Updated

2 years ago
Attachment #8676635 - Flags: review?(ferjmoreno)

Comment 5

2 years ago
Comment on attachment 8676635 [details] [review]
[gaia] michielbdejong:1216319-clear-command > mozilla-b2g:master

Unfortunately, checking the size of the DataStore is probably not enough :( I left a comment on the PR
Attachment #8676635 - Flags: review?(ferjmoreno) → review-
(Assignee)

Comment 6

2 years ago
Comment on attachment 8676635 [details] [review]
[gaia] michielbdejong:1216319-clear-command > mozilla-b2g:master

Can you give me feedback on the approach? I changed it so that the clear is done the next time the user comes back, it's safer when a retry is needed.

For read-write we will need to store the lastRevisionId per userid anyway, so that makes this code more reusable.

Will write the unit tests now.

Thanks!
Attachment #8676635 - Flags: feedback?(ferjmoreno)
QA Whiteboard: [COM= Data Sync]

Comment 7

2 years ago
Comment on attachment 8676635 [details] [review]
[gaia] michielbdejong:1216319-clear-command > mozilla-b2g:master

Looks good! Thanks for addressing the previous feedback.
Attachment #8676635 - Flags: feedback?(ferjmoreno) → feedback+
(Assignee)

Updated

2 years ago
Attachment #8676635 - Flags: review- → review?(ferjmoreno)

Comment 8

2 years ago
Comment on attachment 8676635 [details] [review]
[gaia] michielbdejong:1216319-clear-command > mozilla-b2g:master

Thanks! I left a couple of comments more on the PR
Attachment #8676635 - Flags: review?(ferjmoreno) → review+
(Assignee)

Comment 9

2 years ago
Comments addressed and rebased, TreeHerder almost finished (98% atm).

Comment 10

2 years ago
https://github.com/mozilla-b2g/gaia/commit/927bcd0612d89925ead14a320c65ebd21b5d61e3
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.