I am designing architecture for service like pastebin.com. I plan to store user data on S3 storage and metadata with my own server.SO whenever user requests for some paste creation there are two steps to this:
- Store content in S3
- Store metadata with local metadata db.
I am thinking what would happen if 1 is success and 2 fails.Then i have data paste in S3 which i dont have a way to access it and user will get a failure response back and he/she can retry and then it may get succeded. But the initial failure have created some data in my storage for whom i dont have any metadata and any way to access it.
So my doubt is like in such cases where we have to perform 2-3 activity where one happens after another, in case some activity in between fails then how can we rollback?