Azure Elastic Sc​​ale:MarkMappingOffline 不会阻止搜索分片

Azure Elastic Scale: MarkMappingOffline does not prevent shards from being searched

只是想更清楚地了解当 RangeShardMappings 标记为离线时发生的事情。

我了解需要将映射设置为离线才能更新和删除分片和映射。

我想保留映射但阻止 Azure 地图管理器在任何特定时间使用特定映射,我希望只需将它们标记为离线就可以让我这样做,但它似乎对搜索结果没有影响.

根据 MS 文档 (https://docs.microsoft.com/en-us/azure/sql-database/sql-database-elastic-scale-shard-map-management)

Certain operations on shard mappings are only allowed when a mapping is in an “offline” state, including UpdateMapping and DeleteMapping. When a mapping is offline, a data-dependent request based on a key included in that mapping will return an error. In addition, when a range is first taken offline, all connections to the affected shard are automatically killed in order to prevent inconsistent or incomplete results for queries directed against ranges being changed.

但这不是我遇到的行为。离线地图仍在返回结果集。这些映射是否存储在缓存中?

将映射标记为离线的主要目的是防止使用 OpenConnectionForKey 的连接。映射仍然可见,毕竟如果映射是不可见的,那么您以后将无法将其标记回线上。

Offline maps are still returning result sets.

嗯,我明白你的问题了。分片映射管理器不了解或控制数据库中的底层数据。这意味着分片映射到 b 是可能的。您有责任确保您的查询 where 子句包含与您请求的映射相匹配的过滤器。您还可以使用 row-level security 来确保您的查询 return 只有正确的结果集。