Azure-cli: Issue creating cosmosdb account with max_interval_in_seconds set to 1 second on osx/mac (version 2.12.1)

Created on 7 Oct 2020  路  8Comments  路  Source: Azure/azure-cli

Version

$ az --version
azure-cli                         2.12.1

core                              2.12.1
telemetry                          1.0.6

Python location '/usr/local/Cellar/azure-cli/2.12.1/libexec/bin/python'
Extensions directory '/Users/[redacted]/.azure/cliextensions'

Python (Darwin) 3.8.5 (default, Jul 21 2020, 10:48:26) 
[Clang 11.0.3 (clang-1103.0.32.62)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy

When running:

  az cosmosdb create \
    -n "$accountName" \
    -g "$resourceGroupName" \
    --default-consistency-level BoundedStaleness \
    --locations regionName=eastus2 failoverPriority=0 isZoneRedundant=True \
    --locations regionName=westus2 failoverPriority=1 isZoneRedundant=True \
    --enable-multiple-write-locations true \
    --tags CosmosAccountType="Production" "defaultExperience"="Core (SQL)" \
    --max-interval 1 \

The following error is returned:

ValidationError: Parameter 'ConsistencyPolicy.max_interval_in_seconds' must be equal to or greater than 5.

It seems the models being used are different than those used to generate the docs.

Interestingly enough, the consistency_policy.py file has different values.

And the dashboard says something different than the docs...

needs-triage question

All 8 comments

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Wmengmsft, @MehaKaushik, @shurd, @anfeldma-ms

When provisioning a Cosmo account with bounded staleness the values for --max-interval and --max-staleness-prefix are different depending on whether you are deploying to a single region or 2+ regions. Additionally, you need to specify both --max-interval as well as --max-staleness-prefix when using Bounded Staleness.

For accounts with a single region minimum value for --max-interval is 5 seconds and --max-staleness-prefix = 10 updates
For accounts with 2+ regions, minimum value for --max-interval = 300 seconds and --max-staleness-prefix = 100,000 updates.

Thanks.

Hey @markjbrown, thanks for the prompt response!

It'd seem then that based on

For accounts with a single region minimum value for --max-interval is 1 second
if passing --max-interval 1 and getting

ValidationError: Parameter 'ConsistencyPolicy.max_interval_in_seconds' must be equal to or greater than 5.

The azure CLI is validating the wrong values?

(I will change the db setup to use a different config, but this might still be a CLI issue)

Sorry, I typed the wrong value for single region. Min value for max interval is 5 seconds for a single region, not one.

For you example above, with 2 regions min value is 300 seconds.

Sorry for the confusion.

Oh, I see. Then the docs a bit misleading 馃槃 :

Source: https://docs.microsoft.com/en-us/cli/azure/cosmosdb?view=azure-cli-latest#az_cosmosdb_create-optional-parameters

Pretty sure we're not intentionally misleading.

Hey @MehaKaushik can you update the description for max interval here?
https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/cosmosdb/_params.py#L67

When used with Bounded Staleness consistency, this value represents the time amount of staleness (in seconds) tolerated. For single region account, range is 5 - 86400 seconds. For multiple region accounts, range is 300 - 86400 seconds.

Can you also update max staleness?
When used with Bounded Staleness consistency, this value represents the number of stale requests tolerated. For single region account, range is 10 - 1,000,000 operations. For multiple region accounts, range is 100,000 - 1,000,000.

Thanks.

Haha just in case: I didn't mean intentionally. I imagine it was a bug/small mistake.

If it helps, this model: https://github.com/Azure/azure-sdk-for-python/blob/0415c8a6237ed2d6e9091d3c6d0b88c249a81649/sdk/cosmos/azure-mgmt-documentdb/azure/mgmt/documentdb/models/consistency_policy.py#L38 seems to be generated with the 1-100 value as well

Yes, thanks. We're reviewing this as well.

Was this page helpful?
0 / 5 - 0 ratings