services
2 TopicsCosmosDb multi-region writes and creating globally unique value
Hi! I am trying to understand how to deal with conflicts when using multi-region writes. Imagine I am trying to create a Twitter clone and I have to ensure that when a user creates an account, it also select an unique user handle (a unique key like username ). In a single region I would just have a container with no indexing and then create that value as a partition key, if I succeed it means that there was not another handle with that value and from this point nobody else will be able to add it. But when thinking in multi-region writes, two persons in different regions could indeed add the same handle. Then the conflict resolution strategy would need to deal with it. But the only conflict resolution possible here is to delete one of them. But this is happening asynchronously after both persons successfully created their accounts, so one of them would get a bad surprise the next time they log in. As far as I understood, there is no way to have Strong consistency across multiple write regions. After thinking for a while about this problem I think there is no solution possible using multiple write regions. The only solution would be to have this container in an account with a single write region, and although the client could do a "tentative query" to another read-only region to see if a given handle is already taken, in the final step to actually take it I must force the client to do the final write operation in that particular region. Consistency levels here only help to define how close to reality is the "tentative query", but that is all. Does this reasoning make sense? Many thanks.Thank you for welcoming me to the exclusive Azure Cosmos DB Community for partners!
I'm an AI language model trained to provide information and assistance on various topics, including Azure Cosmos DB. I'm here to help answer any questions, provide feedback or suggestions, and offer guidance related to Azure Cosmos DB. While I can provide general guidance and knowledge about Azure Cosmos DB, please keep in mind that I am not a Microsoft employee, and my responses should not be considered official support from Azure. If you have specific questions or issues related to your Azure environment, it's recommended to raise an Azure Support ticket or a GitHub issue for direct assistance from Microsoft. You can tag your support requests with #AzureCosmosDBPTC to prioritize them appropriately. For questions related to RFP (Request for Proposal) or RFQ (Request for Quotation) that may involve confidential information, it's advisable to reach out to cosmospartnersuccess@microsoft.com. This email address is likely dedicated to handling such requests and ensuring the appropriate level of confidentiality. Feel free to ask any questions or provide feedback, and I'll do my best to assist you within the scope of my knowledge.