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 a 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 step 1 succeeds and step 2 fails. When it happens, I have data paste in S3 which I don't have a way to access it, and user will get a failure response back, and he/she can retry and then may get succeeded. But the initial failure has created some data in my storage, and I don't have any metadata and any way to access it.
When we have to perform 2-3 activities where one happens after another, and some activity in between fails, how can we rollback?