Pastebin partial writes

how do we handle the case where we write successfully to the object store but not the database?

Whenever a user wants to store some data , a six-letter random string is generated ( if the user has not provided a custom key ). Both content and key are stored in Object store and metadata store respectively. So here you are saying that content is stored in object store but key is not stored in metadata, this problem will not arise. This is because of the reason that key will automatically be stored of the respective content in metadata store.

What if the process writes successfully to the object store, but crashes before it writes to the database.

Just add this to your cleanup service: get rid of orphans entries.
But overall I feel like this may be too low level for the system interview.