Savedata corrupted catastrophically and unable to revert using listversionasync

I tried adding some starter creations to empty slots in my game plane crazy but somehow after everything was working fine for me and my testers without any corruption, a lot of users started reporting savedata corruption where they lost all of their creations.

It seems it ranges from losing nothing to losing all of the slots except for the autosave slot.

I have tried to revert the savedata corruption by using listversionasync but the correct savedata somehow ranges from just a few minutes before the update went live all the way to 2 full days and some of the data is not even recoverable at all.

This could cause a big loss in players and i have spent all night to try and resolve this without luck. Its 10 AM here right now.

If possible, i’d like for the game version and datastore to get reverted to the published version at GMT 23:00 5-5-2024 which should be 1/2 hours before the update went live.

This would minimize damages and help me try to resolve the damage this has caused and take a deeper look into this tomorrow after a good night sleep.

The game has lost 1000 players already due to the savedata corruption and people are still complaining about having lost all of their save slots at this time despite me having reverted the savedata to 1.5 days before the update went live using listversionsasync.

image
image


image

image

and the list just keeps going…

5 Likes

Hello and thanks for filing a bug report. We verified on our end that our systems are functioning normally. In this case there seems to be a bug in your code, which is causing data corruption even after restoration using ListVersionsAsync. The issue appears to be isolated to your experience. We recommend looking into the part of your code that updates datastore entries, as overwriting the data seems to be causing data corruption/loss.

For reverting to an older version, we suggest following this guide - https://en.help.roblox.com/hc/en-us/articles/203313850-How-To-Revert-to-Older-Versions-of-a-Place. You might lose data, but this will take your experience back to the previously stable version.

To assist with recovery, we have temporarily halted cleaning up data items for your experience.

2 Likes

How does ListVersionAsync work saving wise? Is it like when you setasync it saves a backup of the previous data or the new data?

I noticed for some reason some people have their data restored by rolling back 1 hour and others have it restored by rolling it back by 2 full days.

I cant seem to solve this as i dont know how far back to roll it on a per user base and i do not want them to lose more than they had.

1 Like

Sorry I didn’t fully understand your question. ListVersionsAsync is a read API, it won’t restore any of your data by itself. Whenever you use SetAsync or UpdateAsync, a new version of data for that key is created, which becomes the current/live version. The older version still exists until it is cleaned up/deleted at a later date.

Here is a link to the docs - DataStore | Documentation - Roblox Creator Hub.

Example thread of devs using this API - How to restore a key accidentally removed from a DataStore?.

To your second point, it depends on when the data was updated for that specific key.

Example -
Player 1 has 1KB of data and Player 2 has 1KB of data before the update that caused corruption.
After the update, player 1 has not played the experience, player 2 has played for a full day. Player 1 plays the experience, notices missing data and both players complain of data loss. In this case, since Player 1’s data has only a few versions that overwrote the previous entry, you don’t need to go back too far in time to find the version with non-corrupted data. For Player 2, you’d need to go back longer in time, since their data was likely saved multiple times in the full day that they played your experience.

1 Like

The thing i would like to know is if the user has not played the game for longer than a month and then plays for the first time since ages when the corruption happened, is the user his savedata still recoverable or is it deleted.

1 Like

Without knowing the details of the schema for your datastore, one way you can roll it back on a per-user base would be if you compare the size of the payload for each version.

Eg.

  • Version 1 is 120 bytes
  • Version 2 is 130 bytes
  • Version 3 is 160 bytes
  • Version 4 is 140 bytes
  • Version 5 is 150 bytes

In this case, the size decreases after version 3. So you can assume that data loss happened in version 4 or 5.

If your schema is structured in a way that you would never delete/remove any data from the entry for a player, this could be one strategy you can use to restore data. Unfortunately without knowing more details about your specific schema, it is tricky to advice as to how to rollback at a per-player level.

To answer your last question above, unfortunately versions older than 30 days are not retained. We have tried to make as many versions visible for your experience as possible to assist in data recovery. If the player plays for the first time in ages, their previous version is still recoverable. Ex

Player plays on April 1 - data is saved as version 1
Player plays on May 6 - data is saved as version 2

Until May 6 version 1 will be available. After which it will no longer be retained.

1 Like

I cant seem to find a way to convert the time printed on the version to a date, do you know how i could do this?
It would help me understand which date im currently looking at.

2 Likes

Sure! :slight_smile:

The timestamp on the version is a Unix timestamp (ref). You can convert it to a date by using os.date() (ref).

Eg. timestamp 1639076964027 is GMT: Thursday, December 9, 2021 7:09:24.027 PM

2 Likes

It seems i had to divide the timestamp by 1000 for it to work.
Thank you!

2 Likes

HI @rickje139,
Can you explain how your backup mechanism works? It sounds like you have a player initiated manual save option and some kind of autosave. Are you try to recover the data from both of those systems? Do you periodically backup the manual data? How often do you autosave?

1 Like

I dont have a backup system for savedata, i do have some systems for adding back specific slots and reverting the savedata.

Those were built using the roblox documentation about ListVersionsAsync but it seems its documented in a confusing way in my opinion.

I did not know there was a sort option and expected the data to be sorted automatically.
It was really difficult to notice this myself as the time was not displayed as a date but as a really long number instead.

I believe i managed to get the savedata reverted correctly but i am unsure as i still am getting a lot of reports of savedata loss from both before and after the update.

I will have to investigate it a bit more.

1 Like