mozilla-services / syncserver

Run-Your-Own Firefox Sync Server
Mozilla Public License 2.0
1.87k stars 145 forks source link

Missing documentation on pruning of expired sync data #172

Open TcT2k opened 5 years ago

TcT2k commented 5 years ago

In the documentation there is a missing section on:

 Things that still need to be Documented
     periodic pruning of expired sync data

I assume that this would be done using the python -m syncstorage.scripts.purgettl script. The script requires a config file which does not seem to be syncserver.ini. It would be nice to gain inside into how to run this to reduce the growing database (in my case 700MB for a single user).

rfk commented 5 years ago

The script requires a config file which does not seem to be syncserver.ini.

Hrm, good point - it does actually expect the same config file, but it doesn't know how to fill in a bunch of sensible defaults that the syncserver package provides when running the server:

https://github.com/mozilla-services/syncserver/blob/master/syncserver/__init__.py#L34

One option to try to get up and running here, would be to try to add explicit sections in syncserver.ini to get python -m syncstorage.scripts.purgettl syncserver.ini working correctly. I expect it needs at least the [storage] section which the syncserver package automagically configures here:

https://github.com/mozilla-services/syncserver/blob/master/syncserver/__init__.py#L105

TcT2k commented 5 years ago

Thanks for the hint, I've added the following to my syncserver.ini:

[storage]
backend = syncstorage.storage.sql.SQLStorage
sqluri = (copied from syncserver.sqluri)

The script only outputs No handlers could be found for logger "mozsvc" but records seem to be removed from the bso table.

I've two remaining questions:

  1. Is the script meant to be kept running as a kind a background service?
  2. Is the batch_upload_items table still used or is it superseded by the bso table?
rfk commented 5 years ago

Is the script meant to be kept running as a kind a background service?

Yes, by default it will purge some items and then sleep in a loop. Depending on your setup you might find it simpler to run with the --oneshot option and just trigger it via cron or similar.

Is the batch_upload_items table still used or is it superseded by the bso table?

It's used as a temporary staging area when uploading large numbers of items. So it's still active and required, but it's OK for it to be empty if nobody is in the middle of uploading any items.