Open ConX-Ryan opened 8 years ago
Before deleting a shard database, you should remove it from the shard map manager using ShardMap.DeleteShard
. This is the safe way to delete because before allowing the shard to be deleted, the shard map manager will check that there are no mappings to the shard (and if there are no mappings to the shard, then hopefully that shard should be empty of sharded data - although that last part is your responsibility, shard map manager cannot verify that for you).
At this point since you already deleted the database, you can instead remove the shard db from the shard map manager using RecoveryManager.DetachShard
. This is normally dangerous to do, since all mappings to that shard will deleted, which is why DeleteShard
is preferred.
So then if you create a new database with the same name, you need to call ShardMap.CreateShard
to create sharding schemas on that shard db and add that shard db to the shard map manager. However you didn't call this, so the sharding schema wasn't created. (Note that CreateShard
will fail if you didn't call DeleteShard
or DetachShard
earlier.)
Thanks very much for your explanation!
Cheers. Hope this fixes your problem :)
Exception thrown "Could not find stored procedure '__ShardManagement.spBulkOperationShardMappingsLocal'"
When ListShardMap.CreatePointMapping is called on the freshly created Shard DB.
I can confirm that the EF schemas have been created properly but all the sharding schemas and SPs are not present.
Seems to occur more often we dropping and recreating a shard with the same name using the same Shard Manager DB
client version 1.3.3 please let me know if you require more info.