Skip to content

Commit 6a0a7ee

Browse files
CosmosDB: Adds changes to handle enabling partition merge on CosmosDB account (#21736)
* Merge branch 'Az.CosmosDB-preview' of https://github.com/SrinikhilReddy/azure-powershell into features/users/nanarava/enablepmerge * CosmosDB: Adds changes to handle enabling partition merge on CosmosDB account. * CosmosDB: Adds changes to handle enabling partition merge on CosmosDB account. * Update src/CosmosDB/CosmosDB/ChangeLog.md Co-authored-by: Jin Lei <[email protected]> * CosmosDB: Adds changes to handle enabling partition merge on CosmosDB account. * CosmosDB: Adds changes to handle enabling partition merge on CosmosDB account. * CosmosDB: Adds changes to handle enabling partition merge on CosmosDB account. * Update ChangeLog.md Remove duplicate line * Resolve code comments. --------- Co-authored-by: Jin Lei <[email protected]>
1 parent 829719c commit 6a0a7ee

File tree

8 files changed

+51
-5
lines changed

8 files changed

+51
-5
lines changed

src/CosmosDB/CosmosDB.Test/ScenarioTests/AccountTests.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Test-AccountRelatedCmdlets
5959
Assert-AreEqual $_.Exception.Message ("Resource with Name " + $cosmosDBAccountName + " already exists.")
6060
}
6161

62-
$updatedCosmosDBAccount = Update-AzCosmosDBAccount -ResourceGroupName $rgName -Name $cosmosDBAccountName -DefaultConsistencyLevel "BoundedStaleness" -MaxStalenessIntervalInSeconds 10 -MaxStalenessPrefix 20 -IpRule $IpRule -Tag $tags -EnableVirtualNetwork 1 -EnableAutomaticFailover 1 -PublicNetworkAccess $publicNetworkAccess -NetworkAclBypassResourceId $networkAclBypassResourceId
62+
$updatedCosmosDBAccount = Update-AzCosmosDBAccount -ResourceGroupName $rgName -Name $cosmosDBAccountName -DefaultConsistencyLevel "BoundedStaleness" -MaxStalenessIntervalInSeconds 10 -MaxStalenessPrefix 20 -IpRule $IpRule -Tag $tags -EnableVirtualNetwork 1 -EnableAutomaticFailover 1 -PublicNetworkAccess $publicNetworkAccess -NetworkAclBypassResourceId $networkAclBypassResourceId -EnablePartitionMerge 0
6363

6464
Assert-AreEqual $cosmosDBAccountName $updatedCosmosDBAccount.Name
6565
Assert-AreEqual "BoundedStaleness" $updatedCosmosDBAccount.ConsistencyPolicy.DefaultConsistencyLevel
@@ -72,6 +72,7 @@ function Test-AccountRelatedCmdlets
7272
Assert-AreEqual $updatedCosmosDBAccount.NetworkAclBypassResourceIds.Count 1
7373
Assert-AreEqual $updatedCosmosDBAccount.BackupPolicy.BackupIntervalInMinutes 480
7474
Assert-AreEqual $updatedCosmosDBAccount.BackupPolicy.BackupRetentionIntervalInHours 16
75+
Assert-AreEqual $updatedCosmosDBAccount.EnablePartitionMerge 0
7576

7677
$updatedCosmosDBAccount = Update-AzCosmosDBAccount -ResourceGroupName $rgName -Name $cosmosDBAccountName -BackupStorageRedundancy "Geo"
7778
Assert-AreEqual $updatedCosmosDBAccount.BackupPolicy.BackupIntervalInMinutes 480

src/CosmosDB/CosmosDB/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
## Upcoming Release
2222
* Added support for Continuous 7 Days backup mode.
23+
* Added new parameter `EnablePartitionMerge` to `Update-AzCosmosDBAccount` and `New-AzCosmosDBAccount`.
2324

2425
## Version 1.10.1
2526
* Updated Azure.Core to 1.31.0.

src/CosmosDB/CosmosDB/CosmosDBAccount/NewOrUpdateAzCosmosDBAccount.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public class NewOrUpdateAzCosmosDBAccount : AzureCosmosDBCmdletBase
7070
[Parameter(Mandatory = false, HelpMessage = Constants.EnableAnalyticalStorageHelpMessage)]
7171
public bool? EnableAnalyticalStorage { get; set; }
7272

73+
[Parameter(Mandatory = false, HelpMessage = Constants.EnablePartitionMergeHelpMessage)]
74+
public bool? EnablePartitionMerge { get; set; }
75+
7376
[Parameter(Mandatory = false, HelpMessage = Constants.AsJobHelpMessage)]
7477
public SwitchParameter AsJob { get; set; }
7578

src/CosmosDB/CosmosDB/CosmosDBAccount/UpdateAzCosmosDBAccount.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ public override void ExecuteCmdlet()
9898
{
9999
databaseAccountUpdateParameters.EnableAnalyticalStorage = EnableAnalyticalStorage;
100100
}
101+
if (EnablePartitionMerge != null)
102+
{
103+
databaseAccountUpdateParameters.EnablePartitionMerge = EnablePartitionMerge;
104+
}
101105
if (NetworkAclBypass != null)
102106
{
103107
databaseAccountUpdateParameters.NetworkAclBypass =

src/CosmosDB/CosmosDB/Helpers/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ internal static class Constants
5858
public const string NetworkAclBypassResourceIdHelpMessage = "List of Resource Ids to allow Network Acl Bypass for Synapse Link.";
5959
public const string DatabaseResourceIdHelpMessage = "ResourceId of the database.";
6060
public const string AnalyticalStorageSchemaTypeHelpMessage = "The schema type for analytical storage. Valid values include: 'WellDefined' and 'FullFidelity'.";
61+
public const string EnablePartitionMergeHelpMessage = "Enables partition merge feature on the Cosmos DB database account. Accepted values: false, true";
6162

6263
//Restore specific help messages
6364
public const string IsRestoreRequestHelpMessage = "Indicates that the new Cosmos DB account request is a restore request.";

src/CosmosDB/CosmosDB/Models/DatabaseAccount/PSDatabaseAccountGetResults.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public PSDatabaseAccountGetResults(DatabaseAccountGetResults databaseAccountGetR
6565
RestoreParameters = new PSRestoreParameters(databaseAccountGetResults.RestoreParameters);
6666
CreateMode = databaseAccountGetResults.CreateMode;
6767
AnalyticalStorageConfiguration = new PSAnalyticalStorageConfiguration(databaseAccountGetResults.AnalyticalStorageConfiguration);
68+
EnablePartitionMerge = databaseAccountGetResults.EnablePartitionMerge;
6869
}
6970

7071
//
@@ -189,6 +190,10 @@ public PSDatabaseAccountGetResults(DatabaseAccountGetResults databaseAccountGetR
189190
public bool? EnableAnalyticalStorage { get; set; }
190191
//
191192
// Summary:
193+
// Gets or sets flag to indicate whether Partition Merge is enabled.
194+
public bool? EnablePartitionMerge { get; set; }
195+
//
196+
// Summary:
192197
// Gets or sets flag to indicate to allow Network Acl Bypass.
193198
public NetworkAclBypass? NetworkAclBypass { get; set; }
194199
//

src/CosmosDB/CosmosDB/help/New-AzCosmosDBAccount.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ New-AzCosmosDBAccount [-EnableAutomaticFailover] [-EnableMultipleWriteLocations]
2222
[-PublicNetworkAccess <String>] [-KeyVaultKeyUri <String>] [-EnableAnalyticalStorage <Boolean>] [-AsJob]
2323
[-NetworkAclBypass <String>] [-NetworkAclBypassResourceId <String[]>] [-ServerVersion <String>]
2424
[-BackupIntervalInMinutes <Int32>] [-BackupRetentionIntervalInHours <Int32>]
25-
[-BackupStorageRedundancy <String>] [-BackupPolicyType <String>] [-ContinuousTier <String>] [-AnalyticalStorageSchemaType <String>]
25+
[-BackupStorageRedundancy <String>] [-BackupPolicyType <String>] [-ContinuousTier <String>] [-AnalyticalStorageSchemaType <String>] [-EnablePartitionMerge <Boolean>]
2626
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2727
```
2828

@@ -261,6 +261,21 @@ Accept pipeline input: False
261261
Accept wildcard characters: False
262262
```
263263
264+
### -EnablePartitionMerge
265+
Bool to indicate if PartitionMerge is enabled on the account.
266+
Accepted Values: false, true
267+
```yaml
268+
Type: System.Nullable`1[System.Boolean]
269+
Parameter Sets: (All)
270+
Aliases:
271+
272+
Required: False
273+
Position: Named
274+
Default value: None
275+
Accept pipeline input: False
276+
Accept wildcard characters: False
277+
```
278+
264279
### -EnableAutomaticFailover
265280
Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage.
266281
Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account.

src/CosmosDB/CosmosDB/help/Update-AzCosmosDBAccount.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Update-AzCosmosDBAccount [-EnableAutomaticFailover <Boolean>] [-EnableMultipleWr
2222
[-PublicNetworkAccess <String>] [-KeyVaultKeyUri <String>] [-EnableAnalyticalStorage <Boolean>] [-AsJob]
2323
[-NetworkAclBypass <String>] [-NetworkAclBypassResourceId <String[]>] [-ServerVersion <String>]
2424
[-BackupIntervalInMinutes <Int32>] [-BackupRetentionIntervalInHours <Int32>]
25-
[-BackupStorageRedundancy <String>] [-BackupPolicyType <String>] [-ContinuousTier <String>] [-AnalyticalStorageSchemaType <String>]
25+
[-BackupStorageRedundancy <String>] [-BackupPolicyType <String>] [-ContinuousTier <String>] [-AnalyticalStorageSchemaType <String>] [-EnablePartitionMerge <Boolean>]
2626
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2727
```
2828

@@ -36,7 +36,7 @@ Update-AzCosmosDBAccount -ResourceId <String> [-EnableAutomaticFailover <Boolean
3636
[-PublicNetworkAccess <String>] [-KeyVaultKeyUri <String>] [-EnableAnalyticalStorage <Boolean>] [-AsJob]
3737
[-NetworkAclBypass <String>] [-NetworkAclBypassResourceId <String[]>] [-ServerVersion <String>]
3838
[-BackupIntervalInMinutes <Int32>] [-BackupRetentionIntervalInHours <Int32>]
39-
[-BackupStorageRedundancy <String>] [-BackupPolicyType <String>] [-ContinuousTier <String>] [-AnalyticalStorageSchemaType <String>]
39+
[-BackupStorageRedundancy <String>] [-BackupPolicyType <String>] [-ContinuousTier <String>] [-AnalyticalStorageSchemaType <String>] [-EnablePartitionMerge <Boolean>]
4040
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
4141
```
4242

@@ -50,7 +50,7 @@ Update-AzCosmosDBAccount -InputObject <PSDatabaseAccountGetResults> [-EnableAuto
5050
[-PublicNetworkAccess <String>] [-KeyVaultKeyUri <String>] [-EnableAnalyticalStorage <Boolean>] [-AsJob]
5151
[-NetworkAclBypass <String>] [-NetworkAclBypassResourceId <String[]>] [-ServerVersion <String>]
5252
[-BackupIntervalInMinutes <Int32>] [-BackupRetentionIntervalInHours <Int32>]
53-
[-BackupStorageRedundancy <String>] [-BackupPolicyType <String>] [-ContinuousTier <String>] [-AnalyticalStorageSchemaType <String>]
53+
[-BackupStorageRedundancy <String>] [-BackupPolicyType <String>] [-ContinuousTier <String>] [-AnalyticalStorageSchemaType <String>] [-EnablePartitionMerge <Boolean>]
5454
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
5555
```
5656

@@ -274,6 +274,22 @@ Accept pipeline input: False
274274
Accept wildcard characters: False
275275
```
276276
277+
### -EnablePartitionMerge
278+
Enable Partition Merge on Account
279+
Accepted values: false, true
280+
281+
```yaml
282+
Type: System.Nullable`1[System.Boolean]
283+
Parameter Sets: (All)
284+
Aliases:
285+
286+
Required: False
287+
Position: Named
288+
Default value: None
289+
Accept pipeline input: False
290+
Accept wildcard characters: False
291+
```
292+
277293
### -EnableMultipleWriteLocations
278294
Enable Multiple Write Locations.
279295
Accepted values: false, true

0 commit comments

Comments
 (0)