azure - 当 DB 具有“连续”备份策略时,无法更新 Cosmos DB 容器
问题描述
前段时间,我启用"backupPolicy": { "type": "Continuous" }
了我的一个 Cosmos DB 帐户。
现在,当我尝试通过 ARM、Az Powershell、Az CLI 甚至直接通过 Azure REST API更新现有 Cosmos容器时,我收到“指定输入之一无效”错误:
{“状态”:“失败”,“错误”:{“代码”:“BadRequest”,“消息”:“消息:{“代码”:“BadRequest”,“消息”:“消息:{\”错误\ ":[\"指定的输入之一无效\"]}\r\nActivityId: 707c2fe1-42cd-43aa-b050-5ec8d85a0e06, 请求 URI: /apps/0f4ef045-e4bc-485d-b639-54cf7639406a/services/c28010c2 -ddff-4fe3-b0ac-d1e11b612c12/partitions/741b17db-ca07-4833-8cca-5314763179d8/replicas/132677385232196284p, RequestStats: \r\nRequestStartTime: 2021-06-16T07:30,16:02.8308-203: :30:02.8308239Z, 尝试的区域数:1\r\n响应时间: 2021-06-16T07:30:02.8308239Z, StoreResult: StorePhysicalAddress: rntbd://10.0.0.24:11000/apps/0f4ef045-e4bc-485d-b639-54cf7639406a/services/c28010c2-ddff-4fe3-b0ac-d1e11b612c12/partitions/741b17db-ca07-4833-8cca-5314763179d8/replicas/132677385232196284p, LSN: 14, GlobalCommittedLsn: 14, PartitionKeyRangeId: , IsValid: True, StatusCode: 400, SubStatusCode: 0, RequestCharge: 1.24, ItemLSN: -1, SessionToken: -1#14, UsingLocalLSN: False, TransportException: null, BELatencyMs: 1.9, ActivityId: 707c2fe1-42cd-43aa -b050-5ec8d85a0e06,资源类型:集合,操作类型:替换\r\n,SDK:Microsoft.Azure.Documents.Common/2.14.0"},请求 URI:/dbs/ht-app/colls/test,RequestStats:, SDK:Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、 Microsoft.Azure.Documents.Common/2.14.0" } }} }} }True,StatusCode:400,SubStatusCode:0,RequestCharge:1.24,ItemLSN:-1,SessionToken:-1#14,UsingLocalLSN:False,TransportException:null,BELatencyMs:1.9,ActivityId:707c2fe1-42cd-43aa-b050-5ec8d85a0e06,资源类型:集合,操作类型:替换\r\n,SDK:Microsoft.Azure.Documents.Common/2.14.0"},请求 URI:/dbs/ht-app/colls/test,RequestStats:,SDK:Microsoft.Azure .Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents .Common/2.14.0" } }True,StatusCode:400,SubStatusCode:0,RequestCharge:1.24,ItemLSN:-1,SessionToken:-1#14,UsingLocalLSN:False,TransportException:null,BELatencyMs:1.9,ActivityId:707c2fe1-42cd-43aa-b050-5ec8d85a0e06,资源类型:集合,操作类型:替换\r\n,SDK:Microsoft.Azure.Documents.Common/2.14.0"},请求 URI:/dbs/ht-app/colls/test,RequestStats:,SDK:Microsoft.Azure .Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents .Common/2.14.0" } }Microsoft.Azure.Documents.Common/2.14.0"},请求 URI:/dbs/ht-app/colls/test,RequestStats:,SDK:Microsoft.Azure.Documents.Common/2.14.0,Microsoft.Azure.Documents .Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0" } }Microsoft.Azure.Documents.Common/2.14.0"},请求 URI:/dbs/ht-app/colls/test,RequestStats:,SDK:Microsoft.Azure.Documents.Common/2.14.0,Microsoft.Azure.Documents .Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0、Microsoft.Azure.Documents.Common/2.14.0" } }
我测试了什么:
"type": "Periodic"
相同的 ARM 模板和 PS/Az CLI/REST API 命令输入适用于具有备份策略的另一个帐户。- 当容器尚不存在时,相同的 ARM 模板第一次工作。
- 相同的 ARM 模板以前可以工作,但在 6 月 10 日左右停止工作。
我仍然可以通过门户应用更改,但所有编程方式都失败了。
更新
这是我创建容器的方式:
PS /home/user> az cosmosdb sql container create `
>> --account-name "redacted" `
>> --database-name "redacted" `
>> --name "test2" `
>> --resource-group "redacted" `
>> --partition-key-path "/mykey"
{
"id": "/subscriptions/<redacted>/resourceGroups/redacted/providers/Microsoft.DocumentDB/databaseAccounts/redacted/sqlDatabases/redacted/containers/test2",
"location": null,
"name": "test2",
"options": null,
"resource": {
"_conflicts": "conflicts/",
"_docs": "docs/",
"_self": "dbs/-EA0AA==/colls/-EA0AOFM4Qc=/",
"_sprocs": "sprocs/",
"_triggers": "triggers/",
"_udfs": "udfs/",
"allowMaterializedViews": false,
"analyticalStorageTtl": null,
"backupPolicy": {
"type": 1
},
"conflictResolutionPolicy": {
"conflictResolutionPath": "/_ts",
"conflictResolutionProcedure": "",
"mode": "LastWriterWins"
},
"defaultTtl": null,
"etag": "\"0000cf0c-0000-0d00-0000-60c9c85e0000\"",
"geospatialConfig": {
"type": "Geography"
},
"id": "test2",
"indexingPolicy": {
"automatic": true,
"compositeIndexes": null,
"excludedPaths": [
{
"path": "/\"_etag\"/?"
}
],
"includedPaths": [
{
"indexes": null,
"path": "/*"
}
],
"indexingMode": "consistent",
"spatialIndexes": null
},
"partitionKey": {
"kind": "Hash",
"paths": [
"/mykey"
],
"systemKey": null,
"version": null
},
"rid": "-EA0AOFM4Qc=",
"statistics": [
{
"documentCount": 0,
"id": "0",
"partitionKeys": [],
"sizeInKB": 0
}
],
"ts": 1623836766.0,
"uniqueKeyPolicy": {
"uniqueKeys": []
}
},
"resourceGroup": "redacted",
"tags": null,
"type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers"
}
这是失败的更新(没有实际更改):
PS /home/user> az cosmosdb sql container update `
>> --account-name "redacted" `
>> --database-name "redacted" `
>> --name "test2" `
>> --resource-group "redacted"
(BadRequest) Message: {"code":"BadRequest","message":"Message: {\"Errors\":[\"One of the specified inputs is invalid\"]}\r\nActivityId: fb640be2-ce87-11eb-8bf9-0a580af44a33, Request URI: /apps/0f4ef045-e4bc-485d-b639-54cf7639406a/services/c28010c2-ddff-4fe3-b0ac-d1e11b612c12/partitions/741b17db-ca07-4833-8cca-5314763179d8/replicas/132677385232196284p, RequestStats: \r\nRequestStartTime: 2021-06-16T09:48:24.7589460Z, RequestEndTime: 2021-06-16T09:48:24.7688873Z, Number of regions attempted:1\r\nResponseTime: 2021-06-16T09:48:24.7688873Z, StoreResult: StorePhysicalAddress: rntbd://10.0.0.24:11000/apps/0f4ef045-e4bc-485d-b639-54cf7639406a/services/c28010c2-ddff-4fe3-b0ac-d1e11b612c12/partitions/741b17db-ca07-4833-8cca-5314763179d8/replicas/132677385232196284p, LSN: 16, GlobalCommittedLsn: 16, PartitionKeyRangeId: , IsValid: True, StatusCode: 400, SubStatusCode: 0, RequestCharge: 1.24, ItemLSN: -1, SessionToken: -1#16, UsingLocalLSN: False, TransportException: null, BELatencyMs: 1.675, ActivityId: fb640be2-ce87-11eb-8bf9-0a580af44a33, ResourceType: Collection, OperationType: Replace\r\n, SDK: Microsoft.Azure.Documents.Common/2.14.0"}, Request URI: /dbs/redacted/colls/test2, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Documents.Common/2.14.0
解决方案
推荐阅读
- javascript - 如何在调用函数的 javascript 对象中使用此参数?
- spyder - 如何默认启用 Spyder Touch Bar 上的功能键?
- c# - 禁用转换为显式运行时类型
- angular - 如何使用模板 Web 组件识别主机环境?
- uipath - UIPath - 无法从 UI 获取文本
- ffmpeg - 让 ffmpeg 在视频上添加重复的文本覆盖
- typescript - 带有通用对象参数的打字稿接口
- postgresql - 在 PostgreSQL 中创建灵活的日期范围
- r - 透视数据集和列名 [R]
- pytorch - 如何在 Dataloader 中使用 Batchsampler