question

brendan avatar image
brendan asked

History of user data changes

Is there a way to log changes made to User Data? UpdateUserData doesn't seem to register an event. The concern is around being able to roll back to a previous version of the data, in case of bugs. Is there any way to get the history of all changes?

data
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

We do a daily backup of all data in PlayFab to protect against catastrophic failure of all availability zones in AWS (exceedingly unlikely, but the belt-and-suspenders approach is never wrong - at least, when it comes to engineering). But we don't provide a 'roll back to previous version' for data, and user data can be fairly massive, which would make it impractical to make an event in the service. In order to protect yourself against potential bugs and recover your user's data when if something should happen, there are a couple of things you can do:

First, use a schematized data set in a JSON format (or similar). That way, if you introduce a new element, it's distinct in the schema and won't impact other data (or at least shouldn't - see the next item).

Second, if you want to be extremely safe, "rotate" your data when you version your schema. In other words, say you write your player save to a key named "Save". Add a revision number to that - "Save.1.0", for example. Then, when you revision your data system, load that data and update it to the new version, in a separate key ("Save.1.1"). Obviously, you'll want to use as few keys as you can, and clean up old ones as you go (older than the last one, that is), but that's a good thing, since fewer large keys are more efficient than lots of small keys, in terms of query times. But this way, if you introduce a change which causes an issue with your user data, it'll be easy to roll back to the previous version.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.