You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our users have a lot of documents on their phones. This is causing reduced with query performance, and eventually phones will run out of space altogether.
To solve this allow projects to provide configuration which defines when a document can be deleted off the phone. The document must not be deleted from the server couchdb so analytics and administrators can still access all documents. To achieve this run a service on the phone that purges a doc and modify the db-sync filter function so purged docs aren't replicated to the server.
Based on some performance profiling we decided to implement purge using the pouchdb remove function. However it may be that removed docs no longer have enough information to be filtered out. If that's the case, implement purge by minifying the doc, eg: { _id: doc._id, _rev: doc._rev, _deleted: true, purged: true }.
Found the problem, I nicked a hash function from elsewhere and didn't convert it out of being prototyped against a string correctly. This PR fixes it: #5317
@SCdF may have found another issue. I am changing the date of medic-last-purge-date and then refreshing the app. I'm not seeing the purge rerun. The console displays Initiating purge inbox.js:3 Local DB may have unreplicated records, skipping but my sync is up to date. Looking in local storage I don't see an entry for medic-last-replicated-seq and when calling window.localStorage.getItem("medic-last-replicated-seq") it returns null.
I have fixed this for 3.3.x (you need to wait for the build to complete).
The issue came about because the logic on how we replicate is different in 3.3.x compared to the version purging was originally build for and we didn't take that into account when backporting.
Activity
SCdF commentedon Dec 5, 2018
Status:
Purging draft
Purging draft
Purging draft
Purging draft
Purging draft
Purging draft
Adds client side purging of documents from PouchDB
Adds client side purging of documents from PouchDB
garethbowen commentedon Jan 10, 2019
Backported to
3.3.xgarethbowen commentedon Jan 10, 2019
@newtewt @ngaruko I've just added this feature to 3.3.0. As it destroys data it requires significant testing to ensure it works as expected.
6 remaining items
SCdF commentedon Jan 30, 2019
@newtewt this is very strange. Let me take a look
SCdF commentedon Jan 30, 2019
Found the problem, I nicked a hash function from elsewhere and didn't convert it out of being prototyped against a string correctly. This PR fixes it: #5317
Fixing purge's hash function
Fixing purge's hash function
SCdF commentedon Jan 31, 2019
I have merged this fix and backported it to 3.3.x and 3.4.x, but I haven't done any releases on these branches.
@newtewt let me know if you need me to perform any more next steps here.
newtewt commentedon Jan 31, 2019
@SCdF may have found another issue. I am changing the date of
medic-last-purge-dateand then refreshing the app. I'm not seeing the purge rerun. The console displaysInitiating purge inbox.js:3 Local DB may have unreplicated records, skippingbut my sync is up to date. Looking in local storage I don't see an entry formedic-last-replicated-seqand when callingwindow.localStorage.getItem("medic-last-replicated-seq")it returnsnull.SCdF commentedon Feb 1, 2019
NB: this works in master, but is not working in 3.3.x. I'm guessing the backport is incompatible with some kind of flow here, I'm looking into it.
I'll also check the 3.4.x branch once I figure it out as well.
Moving the repliction seq storage logic as appropriate for 3.3.x
SCdF commentedon Feb 1, 2019
I have fixed this for 3.3.x (you need to wait for the build to complete).
The issue came about because the logic on how we replicate is different in 3.3.x compared to the version purging was originally build for and we didn't take that into account when backporting.
SCdF commentedon Feb 1, 2019
3.4.x seems to be working fine
newtewt commentedon Feb 6, 2019
Purging is working as expected. Docs are removed only from the offline user.
BananaAcid commentedon May 3, 2020
So is this rolled out/documented and possible to use?
SCdF commentedon May 6, 2020
Answered-ish here: apache/pouchdb#802 (comment)