Skip to content

Commit 3b5bc4f

Browse files
Merge pull request #247145 from seesharprun/cosmos-issues-batch-1
Cosmos DB | Resolve public issues batch #1
2 parents 7a19305 + f5bb143 commit 3b5bc4f

10 files changed

+45
-29
lines changed

articles/cosmos-db/change-feed.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Change feed is available for partition key ranges of an Azure Cosmos DB containe
6565

6666
### Sort order of items in change feed
6767

68-
Change feed items come in the order of their modification time. This sort order is guaranteed per logical partition key, and there's no guaranteed order across the partition key values.
68+
Change feed items come in the order of their modification time. This sort order is guaranteed per physical partition, and there's no guaranteed order across the partition key values.
6969

7070
### Change feed in multi-region Azure Cosmos DB accounts
7171

articles/cosmos-db/continuous-backup-restore-introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Currently the point in time restore functionality has the following limitations:
136136

137137
* The restored account is created in the same region where your source account exists. You can't restore an account into a region where the source account didn't exist.
138138

139-
* The restore window is only 30-day for continuous 30-day tier and it can't be changed. Similarly it's only 7-day for continuous 7-day tier and that also can't be changed.
139+
* The restore window is only 30 days for continuous 30-day tier and seven days for continuous 7-day tier. These tiers can be switched, but the actual quantities (``7`` or ``30``) can't be changed. Furthermore, if you switch from 30-day tier to 7-day tier, there's the potential for data loss on days beyond the seventh.
140140

141141
* The backups aren't automatically geo-disaster resistant. You've to explicitly add another region to have resiliency for the account and the backup.
142142

articles/cosmos-db/how-to-setup-customer-managed-keys.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,17 @@ Here, create a new key using Azure Key Vault and retrieve the unique identifier.
156156

157157
:::image type="content" source="media/how-to-setup-customer-managed-keys/new-customer-managed-key.png" lightbox="media/how-to-setup-customer-managed-keys/new-customer-managed-key.png" alt-text="Screenshot of the dialog to create a new key.":::
158158

159+
> [!TIP]
160+
> Alternatively, you can use the Azure CLI to generate a key with:
161+
>
162+
> ```azurecli
163+
> az keyvault key create \
164+
> --vault-name <name-of-key-vault> \
165+
> --name <name-of-key>
166+
> ```
167+
>
168+
> For more information on managing a key vault with the Azure CLI, see [manage Azure Key Vault with the Azure CLI](../key-vault/general/manage-with-cli2.md).
169+
159170
1. After the key is created, select the newly created key and then its current version.
160171
161172
1. Copy the key's **Key Identifier**, except the part after the last forward slash:
@@ -555,9 +566,6 @@ Use the Azure CLI to restore a continuous account that is already configured usi
555566
# Variable for location
556567
location="<azure-region>"
557568
558-
# Variable for key URI in the key vault
559-
keyVaultKeyUri="https://<key-vault-name>.vault.azure.net/keys/<key-name>"
560-
561569
# Variables for identities
562570
identityId="<identity-resource-id>"
563571

articles/cosmos-db/how-to-setup-rbac.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ Assign a role to an identity:
349349
```azurecli
350350
resourceGroupName='<myResourceGroup>'
351351
accountName='<myCosmosAccount>'
352-
readOnlyRoleDefinitionId = '<roleDefinitionId>' # as fetched above
352+
readOnlyRoleDefinitionId='<roleDefinitionId>' # as fetched above
353353
# For Service Principals make sure to use the Object ID as found in the Enterprise applications section of the Azure Active Directory portal blade.
354-
principalId = '<aadPrincipalId>'
354+
principalId='<aadPrincipalId>'
355355
az cosmosdb sql role assignment create --account-name $accountName --resource-group $resourceGroupName --scope "/" --principal-id $principalId --role-definition-id $readOnlyRoleDefinitionId
356356
```
357357

articles/cosmos-db/nosql/best-practice-dotnet.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ Watch the video below to learn more about using the .NET SDK from an Azure Cosmo
3535
|<input type="checkbox"/> | Ephemeral Port Exhaustion | For sparse or sporadic connections, we set the [`IdleConnectionTimeout`](/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.idletcpconnectiontimeout?view=azure-dotnet&preserve-view=true) and [`PortReuseMode`](/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.portreusemode?view=azure-dotnet&preserve-view=true) to `PrivatePortPool`. The `IdleConnectionTimeout` property helps control the time after which unused connections are closed. This reduces the number of unused connections. By default, idle connections are kept open indefinitely. The value set must be greater than or equal to 10 minutes. We recommended values between 20 minutes and 24 hours. The `PortReuseMode` property allows the SDK to use a small pool of ephemeral ports for various Azure Cosmos DB destination endpoints. |
3636
|<input type="checkbox"/> | Use Async/Await | Avoid blocking calls: `Task.Result`, `Task.Wait`, and `Task.GetAwaiter().GetResult()`. The entire call stack is asynchronous in order to benefit from [async/await](/dotnet/csharp/programming-guide/concepts/async/) patterns. Many synchronous blocking calls lead to [Thread Pool starvation](/archive/blogs/vancem/diagnosing-net-core-threadpool-starvation-with-perfview-why-my-service-is-not-saturating-all-cores-or-seems-to-stall) and degraded response times. |
3737
|<input type="checkbox"/> | End-to-End Timeouts | To get end-to-end timeouts, you need to use both `RequestTimeout` and `CancellationToken` parameters. For more details [visit our timeout troubleshooting guide](troubleshoot-dotnet-sdk-request-timeout.md). |
38-
|<input type="checkbox"/> | Retry Logic | For details on which errors to retry on and which ones are retried by SDKs [visit our design guide](conceptual-resilient-sdk-applications.md#should-my-application-retry-on-errors). For accounts configured with multiple regions, there are [some scenarios](troubleshoot-sdk-availability.md#transient-connectivity-issues-on-tcp-protocol) where the SDK will automatically retry on other regions. For .NET specific implementation details visit the [SDK source repository](https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/docs/SdkDesign.md). |
38+
|<input type="checkbox"/> | Retry Logic | For more information on which errors to retry on and which ones are retried by SDKs, see [design guide](conceptual-resilient-sdk-applications.md#should-my-application-retry-on-errors). For accounts configured with multiple regions, there are [some scenarios](troubleshoot-sdk-availability.md#transient-connectivity-issues-on-tcp-protocol) where the SDK will automatically retry on other regions. For .NET specific implementation details visit the [SDK source repository](https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/docs/SdkDesign.md). |
3939
|<input type="checkbox"/> | Caching database/collection names | Retrieve the names of your databases and containers from configuration or cache them on start. Calls like `ReadDatabaseAsync` or `ReadDocumentCollectionAsync` and `CreateDatabaseQuery` or `CreateDocumentCollectionQuery` will result in metadata calls to the service, which consume from the system-reserved RU limit. `CreateIfNotExist` should also only be used once for setting up the database. Overall, these operations should be performed infrequently. |
4040
|<input type="checkbox"/> | Bulk Support | In scenarios where you may not need to optimize for latency, we recommend enabling [Bulk support](https://devblogs.microsoft.com/cosmosdb/introducing-bulk-support-in-the-net-sdk/) for dumping large volumes of data. |
4141
| <input type="checkbox"/> | Parallel Queries | The Azure Cosmos DB SDK supports [running queries in parallel](performance-tips-query-sdk.md?pivots=programming-language-csharp) for better latency and throughput on your queries. We recommend setting the `MaxConcurrency` property within the `QueryRequestsOptions` to the number of partitions you have. If you aren't aware of the number of partitions, start by using `int.MaxValue`, which will give you the best latency. Then decrease the number until it fits the resource restrictions of the environment to avoid high CPU issues. Also, set the `MaxBufferedItemCount` to the expected number of results returned to limit the number of prefetched results. |
4242
| <input type="checkbox"/> | Performance Testing Backoffs | When performing testing on your application, you should implement backoffs at [`RetryAfter`](performance-tips-dotnet-sdk-v3.md#sdk-usage) intervals. Respecting the backoff helps ensure that you spend a minimal amount of time waiting between retries. |
43-
| <input type="checkbox"/> | Indexing | The Azure Cosmos DB indexing policy also allows you to specify which document paths to include or exclude from indexing by using indexing paths (IndexingPolicy.IncludedPaths and IndexingPolicy.ExcludedPaths). Ensure that you exclude unused paths from indexing for faster writes. For a sample on how to create indexes using the SDK [visit](performance-tips-dotnet-sdk-v3.md#indexing-policy) |
43+
| <input type="checkbox"/> | Indexing | The Azure Cosmos DB indexing policy also allows you to specify which document paths to include or exclude from indexing by using indexing paths (IndexingPolicy.IncludedPaths and IndexingPolicy.ExcludedPaths). Ensure that you exclude unused paths from indexing for faster writes. For more information on how to create indexes using the SDK, see [performance tips .NET SDK v3](performance-tips-dotnet-sdk-v3.md#indexing-policy). |
4444
| <input type="checkbox"/> | Document Size | The request charge of a specified operation correlates directly to the size of the document. We recommend reducing the size of your documents as operations on large documents cost more than operations on smaller documents. |
4545
| <input type="checkbox"/> | Increase the number of threads/tasks | Because calls to Azure Cosmos DB are made over the network, you might need to vary the degree of concurrency of your requests so that the client application spends minimal time waiting between requests. For example, if you're using the [.NET Task Parallel Library](/dotnet/standard/parallel-programming/task-parallel-library-tpl), create on the order of hundreds of tasks that read from or write to Azure Cosmos DB. |
46-
| <input type="checkbox"/> | Enabling Query Metrics | For more logging of your backend query executions, you can enable SQL Query Metrics using our .NET SDK. For instructions on how to collect SQL Query Metrics [visit](query-metrics-performance.md) |
46+
| <input type="checkbox"/> | Enabling Query Metrics | For more logging of your backend query executions, you can enable SQL Query Metrics using our .NET SDK. For more information on how to collect SQL Query Metrics, see [query metrics and performance](query-metrics-performance.md). |
4747
| <input type="checkbox"/> | SDK Logging | Log [SDK diagnostics](#capture-diagnostics) for outstanding scenarios, such as exceptions or when requests go beyond an expected latency.
4848
| <input type="checkbox"/> | DefaultTraceListener | The DefaultTraceListener poses performance issues on production environments causing high CPU and I/O bottlenecks. Make sure you're using the latest SDK versions or [remove the DefaultTraceListener from your application](performance-tips-dotnet-sdk-v3.md#logging-and-tracing) |
4949

articles/cosmos-db/nosql/how-to-dotnet-create-container.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.service: cosmos-db
77
ms.subservice: nosql
88
ms.devlang: csharp
99
ms.topic: how-to
10-
ms.date: 07/06/2022
10+
ms.date: 08/02/2023
1111
ms.custom: devx-track-csharp, devguide-csharp, cosmos-db-dev-journey, devx-track-dotnet
1212
---
1313

@@ -23,14 +23,16 @@ In Azure Cosmos DB, a container is analogous to a table in a relational database
2323

2424
Here are some quick rules when naming a container:
2525

26-
- Keep container names between 3 and 63 characters long
27-
- Container names can only contain lowercase letters, numbers, or the dash (-) character.
28-
- Container names must start with a lowercase letter or number.
26+
- Container names must not be empty.
27+
- Container names can't be longer than 256 characters.
2928

3029
Once created, the URI for a container is in this format:
3130

3231
``https://<cosmos-account-name>.documents.azure.com/dbs/<database-name>/colls/<container-name>``
3332

33+
> [!TIP]
34+
> For more information on container name limits, see [service quotas and limits](../concepts-limits.md)
35+
3436
## Create a container
3537

3638
To create a container, call one of the following methods:
@@ -44,15 +46,15 @@ The following example creates a container asynchronously:
4446

4547
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-samples/226-create-container-options/Program.cs" id="create_container" highlight="2":::
4648

47-
The [``Database.CreateContainerAsync``](/dotnet/api/microsoft.azure.cosmos.database.createcontainerasync) method will throw an exception if a database with the same name already exists.
49+
The [``Database.CreateContainerAsync``](/dotnet/api/microsoft.azure.cosmos.database.createcontainerasync) method throws an exception if a database with the same name already exists.
4850

4951
### Create a container asynchronously if it doesn't already exist
5052

5153
The following example creates a container asynchronously only if it doesn't already exist on the account:
5254

5355
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-samples/226-create-container-options/Program.cs" id="create_container_check" highlight="2":::
5456

55-
The [``Database.CreateContainerIfNotExistsAsync``](/dotnet/api/microsoft.azure.cosmos.database.createcontainerifnotexistsasync) method will only create a new container if it doesn't already exist. This method is useful for avoiding errors if you run the same code multiple times.
57+
The [``Database.CreateContainerIfNotExistsAsync``](/dotnet/api/microsoft.azure.cosmos.database.createcontainerifnotexistsasync) method only creates a new container if it doesn't already exist. This method is useful for avoiding errors if you run the same code multiple times.
5658

5759
## Parsing the response
5860

articles/cosmos-db/nosql/how-to-dotnet-create-database.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.service: cosmos-db
77
ms.subservice: nosql
88
ms.devlang: csharp
99
ms.topic: how-to
10-
ms.date: 07/06/2022
10+
ms.date: 08/02/2023
1111
ms.custom: devx-track-csharp, devguide-csharp, cosmos-db-dev-journey, devx-track-dotnet
1212
---
1313

@@ -23,14 +23,16 @@ In Azure Cosmos DB, a database is analogous to a namespace. When you create a da
2323

2424
Here are some quick rules when naming a database:
2525

26-
- Keep database names between 3 and 63 characters long
27-
- Database names can only contain lowercase letters, numbers, or the dash (-) character.
28-
- Database names must start with a lowercase letter or number.
26+
- Database names must not be empty.
27+
- Database names can't be longer than 256 characters.
2928

3029
Once created, the URI for a database is in this format:
3130

3231
``https://<cosmos-account-name>.documents.azure.com/dbs/<database-name>``
3332

33+
> [!TIP]
34+
> For more information on database name limits, see [service quotas and limits](../concepts-limits.md)
35+
3436
## Create a database
3537

3638
To create a database, call one of the following methods:
@@ -44,15 +46,15 @@ The following example creates a database asynchronously:
4446

4547
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-samples/201-create-database-options/Program.cs" id="create_database" highlight="2":::
4648

47-
The [``CosmosClient.CreateDatabaseAsync``](/dotnet/api/microsoft.azure.cosmos.cosmosclient.createdatabaseasync) method will throw an exception if a database with the same name already exists.
49+
The [``CosmosClient.CreateDatabaseAsync``](/dotnet/api/microsoft.azure.cosmos.cosmosclient.createdatabaseasync) method throws an exception if a database with the same name already exists.
4850

4951
### Create a database asynchronously if it doesn't already exist
5052

5153
The following example creates a database asynchronously only if it doesn't already exist on the account:
5254

5355
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-samples/201-create-database-options/Program.cs" id="create_database_check" highlight="2":::
5456

55-
The [``CosmosClient.CreateDatabaseIfNotExistsAsync``](/dotnet/api/microsoft.azure.cosmos.cosmosclient.createdatabaseifnotexistsasync) method will only create a new database if it doesn't already exist. This method is useful for avoiding errors if you run the same code multiple times.
57+
The [``CosmosClient.CreateDatabaseIfNotExistsAsync``](/dotnet/api/microsoft.azure.cosmos.cosmosclient.createdatabaseifnotexistsasync) method only creates a new database if it doesn't already exist. This method is useful for avoiding errors if you run the same code multiple times.
5658

5759
## Parsing the response
5860

articles/cosmos-db/nosql/materialized-views.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ After your account and the materialized view builder are set up, you should be a
241241
databaseName="<database-that-contains-source-collection>"
242242
```
243243
244+
1. If you haven't already, get the identifier of the account and store it in a shell variable named `$accountId`.
245+
246+
```azurecli
247+
accountId="/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/$accountName"
248+
```
249+
244250
1. Make a REST API call to create the materialized view:
245251
246252
```azurecli

articles/cosmos-db/rate-limiting-requests.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,14 @@ For more information, see: [Cache-Aside pattern](/azure/architecture/patterns/ca
149149

150150
### Materialized View pattern
151151

152-
You might pre-populate views into other collections after storing the data in Azure Cosmos DB when the data isn't ideally formatted for required query operations. This pattern can help support efficient querying and data extraction, and improve application performance.
152+
You might prepopulate views into other collections after storing the data in Azure Cosmos DB when the data isn't ideally formatted for required query operations. This pattern can help support efficient querying and data extraction, and improve application performance.
153153

154154
For more information, see [Materialized View pattern](/azure/architecture/patterns/materialized-view).
155155

156156
## Next steps
157157

158+
* Explore an example implemented in Go, available on [GitHub](https://github.com/mspnp/go-batcher).
159+
* Learn more about the [Rate Limiting pattern](/azure/architecture/patterns/rate-limiting-pattern) in the Azure Architecture Center.
158160
* Learn how to [troubleshoot TooManyRequests errors](troubleshoot-request-rate-too-large.md) in Azure Cosmos DB.
159161
* Learn how to [troubleshoot Timeout errors](troubleshoot-request-timeout.md) in Azure Cosmos DB.
160162
* Learn how to [troubleshoot ServiceUnavailable errors](troubleshoot-service-unavailable.md) in Azure Cosmos DB.
@@ -163,5 +165,5 @@ For more information, see [Materialized View pattern](/azure/architecture/patter
163165
* Learn about [Indexing policies](index-policy.md) in Azure Cosmos DB.
164166
* Learn about [Autoscaling](provision-throughput-autoscale.md) in Azure Cosmos DB.
165167
* Trying to do capacity planning for a migration to Azure Cosmos DB? You can use information about your existing database cluster for capacity planning.
166-
* If all you know is the number of vcores and servers in your existing database cluster, read about [estimating request units using vCores or vCPUs](convert-vcore-to-request-unit.md)
168+
* If all you know is the number of vCores and servers in your existing database cluster, read about [estimating request units using vCores or vCPUs](convert-vcore-to-request-unit.md)
167169
* If you know typical request rates for your current database workload, read about [estimating request units using Azure Cosmos DB capacity planner](estimate-ru-with-capacity-planner.md)

articles/cosmos-db/set-throughput.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,7 @@ The response of those methods also contains the [minimum provisioned throughput]
103103
* [ThroughputResponse.MinThroughput](/dotnet/api/microsoft.azure.cosmos.throughputresponse.minthroughput) on the .NET SDK.
104104
* [ThroughputResponse.getMinThroughput()](/java/api/com.azure.cosmos.models.throughputresponse.getminthroughput) on the Java SDK.
105105

106-
The actual minimum RU/s may vary depending on your account configuration. But generally it's the maximum of:
107-
108-
* 400 RU/s
109-
* Current storage in GB * 1 RU/s
110-
* Highest RU/s ever provisioned on the database or container / 100
106+
The actual minimum RU/s may vary depending on your account configuration. For more information, see [the autoscale FAQ](autoscale-faq.yml).
111107

112108
### Changing the provisioned throughput
113109

0 commit comments

Comments
 (0)