We have been relying on our database to generate IDs for our entities and guarantee uniqueness.
Recently, and because of GDPR, we are obliged to redeploy the whole system (EC2s, DBs, microservices, etc.. ) in Europe for EU clients, opening the possibility to id collision.
Team members have suggested the following so far:
- Making sure the second DB autoincrement has a sufficient offset (really not a fan)
- Using a centralized microservice backed with a DB to generate Ids (Introducing a very critical bottleneck)
- Using UUID v4 (seems to be the most reasonable approach so far)
It would make our lives significantly easier if they new generated IDs are purely numeric and not alphanumeric.
For now, we are considering option 3 (UUIDs) but with reinterpreting the bytes to be a numerical value.
Is this a safe approach ?
Are there any patterns or best practices for generating IDs of entities in the application layer ?