How will we insure , same user goes to same shard , when new shrds added?


#1

We are not designing a cache database, we are talking about sharding a particular database And for that first thing is to uniquely identify the particular shard for a key.
In case of adding a new shard, data for user 1(let’s say was saved in shard-1) will go to new shard now, so in case of a write, there will be duplication and what about in case of read(we won’t be getting previously saved data)?
Or we are saying, every time a new shard will be introduced, we need to migrate our data to other shards, which will be very costly assuming the above question where we need to add new shards very frequently.