realm / realm-graphql-service

GraphQL service for Realm Object Server
https://realm.io
Apache License 2.0
43 stars 10 forks source link

Realm Data Deletion through GraphQL #53

Closed howdyhyber closed 6 years ago

howdyhyber commented 6 years ago

I tried to delete data from ROS using Graphql mutation, trying to lower the storage space of the server. I delete almost 30,000 data for two classes, then as i checked the storage, its still the same, seems like it does not take effect. How is this processed in your end? How do we effectively wipe the data?

nirinchev commented 6 years ago

This is by design - data isn't deleted from ROS because it's possible that a client connects with a version that contains just a portion of the data and has its own changes. Such a client will then need to apply operational transformation to merge its local state with the server's.

That being said, there are mechanisms in ROS that will periodically compact the history based on some heuristics - e.g. if clients A and B connect and A has downloaded changes up to version 5 of the history and B has downloaded up to version 10, then the server can compact changesets 0 to 5. If A never connected again though, the server will keep around the entire history since changeset 5 just in case A needs to be updated. To avoid that, you can specify the historyTtl property on the BasicServer config to tell the server to disregard clients that haven't connected for some time. This setting shipped with ROS 3.6.6, so make sure to update to that.

Hope this helps.