From 2f4abfa796674bb1c5936f1d26c8e5bef5825fbd Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Thu, 29 Oct 2020 19:15:08 -0500 Subject: [PATCH] Remove rupm --- sampleData/gremlinSampleData.json | 1 - src/Common/Constants.ts | 7 -- src/Common/dataAccess/updateOffer.ts | 3 +- .../updateOfferThroughputBeyondLimit.test.ts | 3 +- .../updateOfferThroughputBeyondLimit.ts | 1 - src/Contracts/DataModels.ts | 2 - .../FeaturePanel/FeaturePanelComponent.tsx | 1 - .../FeaturePanelComponent.test.tsx.snap | 6 -- .../Controls/Settings/SettingsComponent.tsx | 6 +- .../Controls/Settings/SettingsRenderUtils.tsx | 5 +- src/Explorer/Controls/Settings/TestUtils.tsx | 1 - .../SettingsRenderUtils.test.tsx.snap | 6 +- src/Explorer/Panes/AddCollectionPane.html | 32 -------- src/Explorer/Panes/AddCollectionPane.ts | 59 ++------------ src/Explorer/Panes/AddDatabasePane.ts | 10 +-- .../Panes/CassandraAddCollectionPane.ts | 30 ++----- src/Explorer/Tabs/DatabaseSettingsTab.ts | 6 +- src/Explorer/Tabs/SettingsTab.html | 56 ------------- src/Explorer/Tabs/SettingsTab.ts | 79 ++----------------- src/Shared/Constants.ts | 3 - src/Shared/PriceEstimateCalculator.ts | 14 ++-- src/Utils/PricingUtils.test.ts | 68 ++++++---------- src/Utils/PricingUtils.ts | 21 +---- 23 files changed, 62 insertions(+), 358 deletions(-) diff --git a/sampleData/gremlinSampleData.json b/sampleData/gremlinSampleData.json index 485db5d1a..71f168d25 100644 --- a/sampleData/gremlinSampleData.json +++ b/sampleData/gremlinSampleData.json @@ -3,7 +3,6 @@ "offerThroughput": 400, "databaseLevelThroughput": false, "collectionId": "Persons", - "rupmEnabled": false, "partitionKey": { "kind": "Hash", "paths": ["/name"] }, "data": [ "g.addV('person').property(id, '1').property('name', 'Eva').property('age', 44)", diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index a7b50d6f6..673e45ada 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -108,7 +108,6 @@ export class CapabilityNames { export class Features { public static readonly cosmosdb = "cosmosdb"; public static readonly enableChangeFeedPolicy = "enablechangefeedpolicy"; - public static readonly enableRupm = "enablerupm"; public static readonly executeSproc = "dataexplorerexecutesproc"; public static readonly hostedDataExplorer = "hosteddataexplorerenabled"; public static readonly enableTtl = "enablettl"; @@ -178,12 +177,6 @@ export class CassandraBackend { public static readonly schemaApi: string = "api/cassandra/schema"; public static readonly guestSchemaApi: string = "api/guest/cassandra/schema"; } - -export class RUPMStates { - public static on: string = "on"; - public static off: string = "off"; -} - export class Queries { public static CustomPageOption: string = "custom"; public static UnlimitedPageOption: string = "unlimited"; diff --git a/src/Common/dataAccess/updateOffer.ts b/src/Common/dataAccess/updateOffer.ts index f7568abd1..737ae40c2 100644 --- a/src/Common/dataAccess/updateOffer.ts +++ b/src/Common/dataAccess/updateOffer.ts @@ -376,8 +376,7 @@ const updateOfferWithSDK = async (params: UpdateOfferParams): Promise => const currentOffer = params.currentOffer; const newOffer: Offer = { content: { - offerThroughput: undefined, - offerIsRUPerMinuteThroughputEnabled: false + offerThroughput: undefined }, _etag: undefined, _ts: undefined, diff --git a/src/Common/dataAccess/updateOfferThroughputBeyondLimit.test.ts b/src/Common/dataAccess/updateOfferThroughputBeyondLimit.test.ts index f90e45f02..bcff3abae 100644 --- a/src/Common/dataAccess/updateOfferThroughputBeyondLimit.test.ts +++ b/src/Common/dataAccess/updateOfferThroughputBeyondLimit.test.ts @@ -17,8 +17,7 @@ describe("updateOfferThroughputBeyondLimit", () => { resourceGroup: "foo", databaseAccountName: "foo", databaseName: "foo", - throughput: 1000000000, - offerIsRUPerMinuteThroughputEnabled: false + throughput: 1000000000 }); expect(window.fetch).toHaveBeenCalled(); }); diff --git a/src/Common/dataAccess/updateOfferThroughputBeyondLimit.ts b/src/Common/dataAccess/updateOfferThroughputBeyondLimit.ts index b25ed571a..5c136cc0f 100644 --- a/src/Common/dataAccess/updateOfferThroughputBeyondLimit.ts +++ b/src/Common/dataAccess/updateOfferThroughputBeyondLimit.ts @@ -11,7 +11,6 @@ interface UpdateOfferThroughputRequest { databaseName: string; collectionName?: string; throughput: number; - offerIsRUPerMinuteThroughputEnabled: boolean; offerAutopilotSettings?: AutoPilotOfferSettings; } diff --git a/src/Contracts/DataModels.ts b/src/Contracts/DataModels.ts index b1a467b63..ff5d52097 100644 --- a/src/Contracts/DataModels.ts +++ b/src/Contracts/DataModels.ts @@ -179,7 +179,6 @@ export interface Offer extends Resource { offerType?: string; content?: { offerThroughput: number; - offerIsRUPerMinuteThroughputEnabled: boolean; collectionThroughputInfo?: OfferThroughputInfo; offerAutopilotSettings?: AutoPilotOfferSettings; }; @@ -233,7 +232,6 @@ export interface CreateDatabaseAndCollectionRequest { collectionId: string; offerThroughput: number; databaseLevelThroughput: boolean; - rupmEnabled?: boolean; partitionKey?: PartitionKey; indexingPolicy?: IndexingPolicy; uniqueKeyPolicy?: UniqueKeyPolicy; diff --git a/src/Explorer/Controls/FeaturePanel/FeaturePanelComponent.tsx b/src/Explorer/Controls/FeaturePanel/FeaturePanelComponent.tsx index b0f1733f7..8fe45f2f6 100644 --- a/src/Explorer/Controls/FeaturePanel/FeaturePanelComponent.tsx +++ b/src/Explorer/Controls/FeaturePanel/FeaturePanelComponent.tsx @@ -44,7 +44,6 @@ export const FeaturePanelComponent: React.FunctionComponent = () => { onChange?: (_?: React.FormEvent, checked?: boolean) => void; }[] = [ { key: "feature.enablechangefeedpolicy", label: "Enable change feed policy", value: "true" }, - { key: "feature.enablerupm", label: "Enable RUPM", value: "true" }, { key: "feature.dataexplorerexecutesproc", label: "Execute stored procedure", value: "true" }, { key: "feature.hosteddataexplorerenabled", label: "Hosted Data Explorer (deprecated?)", value: "true" }, { key: "feature.enablettl", label: "Enable TTL", value: "true" }, diff --git a/src/Explorer/Controls/FeaturePanel/__snapshots__/FeaturePanelComponent.test.tsx.snap b/src/Explorer/Controls/FeaturePanel/__snapshots__/FeaturePanelComponent.test.tsx.snap index 7f4a39014..7d8d57936 100644 --- a/src/Explorer/Controls/FeaturePanel/__snapshots__/FeaturePanelComponent.test.tsx.snap +++ b/src/Explorer/Controls/FeaturePanel/__snapshots__/FeaturePanelComponent.test.tsx.snap @@ -131,12 +131,6 @@ exports[`Feature panel renders all flags 1`] = ` label="Enable change feed policy" onChange={[Function]} /> - { - const hourlyPrice: number = computeRUUsagePriceHourly(serverId, rupmEnabled, throughput, regions, multimaster); + const hourlyPrice: number = computeRUUsagePriceHourly(serverId, throughput, regions, multimaster); const dailyPrice: number = hourlyPrice * 24; const monthlyPrice: number = hourlyPrice * hoursInAMonth; const currency: string = getPriceCurrency(serverId); diff --git a/src/Explorer/Controls/Settings/TestUtils.tsx b/src/Explorer/Controls/Settings/TestUtils.tsx index 92db0174c..01afc323c 100644 --- a/src/Explorer/Controls/Settings/TestUtils.tsx +++ b/src/Explorer/Controls/Settings/TestUtils.tsx @@ -22,7 +22,6 @@ export const collection = ({ offer: ko.observable({ content: { offerThroughput: 10000, - offerIsRUPerMinuteThroughputEnabled: false, collectionThroughputInfo: { minimumRUForCollection: 6000, numPhysicalPartitions: 4 diff --git a/src/Explorer/Controls/Settings/__snapshots__/SettingsRenderUtils.test.tsx.snap b/src/Explorer/Controls/Settings/__snapshots__/SettingsRenderUtils.test.tsx.snap index 77b4fc444..0019eb2a3 100644 --- a/src/Explorer/Controls/Settings/__snapshots__/SettingsRenderUtils.test.tsx.snap +++ b/src/Explorer/Controls/Settings/__snapshots__/SettingsRenderUtils.test.tsx.snap @@ -69,15 +69,15 @@ exports[`SettingsUtils functions render 1`] = ` ¥ - 1.29 + 1.02 hourly / ¥ - 31.06 + 24.48 daily / ¥ - 944.60 + 744.60 monthly diff --git a/src/Explorer/Panes/AddCollectionPane.html b/src/Explorer/Panes/AddCollectionPane.html index 775790fce..4906f48e5 100644 --- a/src/Explorer/Panes/AddCollectionPane.html +++ b/src/Explorer/Panes/AddCollectionPane.html @@ -243,38 +243,6 @@
-
-
-

- * - RU/m - - More information - - For each 100 Request Units per second (RU/s) provisioned, 1,000 Request Units - per - minute - (RU/m) can be provisioned. E.g.: for a container with 5,000 RU/s provisioned - with - RU/m - enabled, the RU/m budget will be 50,000 RU/m. - - -

-
-
- - -
-
- - -
-
-
-

* diff --git a/src/Explorer/Panes/AddCollectionPane.ts b/src/Explorer/Panes/AddCollectionPane.ts index 08141f678..127ce67e9 100644 --- a/src/Explorer/Panes/AddCollectionPane.ts +++ b/src/Explorer/Panes/AddCollectionPane.ts @@ -41,8 +41,6 @@ export default class AddCollectionPane extends ContextualPaneBase { public partitionKeyVisible: ko.Computed; public partitionKeyPattern: ko.Computed; public partitionKeyTitle: ko.Computed; - public rupm: ko.Observable; - public rupmVisible: ko.Observable; public storage: ko.Observable; public throughputSinglePartition: ViewModels.Editable; public throughputMultiPartition: ViewModels.Editable; @@ -142,12 +140,6 @@ export default class AddCollectionPane extends ContextualPaneBase { } return ""; }); - this.rupm = ko.observable(Constants.RUPMStates.off); - this.rupmVisible = ko.observable(false); - const featureSubcription = this.container.features.subscribe(() => { - this.rupmVisible(this.container.isFeatureEnabled(Constants.Features.enableRupm)); - featureSubcription.dispose(); - }); this.canExceedMaximumValue = ko.pureComputed(() => this.container.canExceedMaximumValue()); @@ -200,7 +192,6 @@ export default class AddCollectionPane extends ContextualPaneBase { account.properties.readLocations.length) || 1; const multimaster = (account && account.properties && account.properties.enableMultipleWriteLocations) || false; - const rupmEnabled: boolean = this.rupm() === Constants.RUPMStates.on; let throughputSpendAckText: string; let estimatedSpend: string; @@ -210,23 +201,15 @@ export default class AddCollectionPane extends ContextualPaneBase { serverId, regions, multimaster, - rupmEnabled, this.isSharedAutoPilotSelected() ); - estimatedSpend = PricingUtils.getEstimatedSpendHtml( - offerThroughput, - serverId, - regions, - multimaster, - rupmEnabled - ); + estimatedSpend = PricingUtils.getEstimatedSpendHtml(offerThroughput, serverId, regions, multimaster); } else { throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString( this.sharedAutoPilotThroughput(), serverId, regions, - multimaster, - rupmEnabled, + multimaster this.isSharedAutoPilotSelected() ); estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml( @@ -263,7 +246,6 @@ export default class AddCollectionPane extends ContextualPaneBase { account.properties.readLocations.length) || 1; const multimaster = (account && account.properties && account.properties.enableMultipleWriteLocations) || false; - const rupmEnabled: boolean = this.rupm() === Constants.RUPMStates.on; let throughputSpendAckText: string; let estimatedSpend: string; @@ -273,15 +255,13 @@ export default class AddCollectionPane extends ContextualPaneBase { serverId, regions, multimaster, - rupmEnabled, this.isAutoPilotSelected() ); estimatedSpend = PricingUtils.getEstimatedSpendHtml( this.throughputMultiPartition(), serverId, regions, - multimaster, - rupmEnabled + multimaster ); } else { throughputSpendAckText = PricingUtils.getEstimatedSpendAcknowledgeString( @@ -289,7 +269,6 @@ export default class AddCollectionPane extends ContextualPaneBase { serverId, regions, multimaster, - rupmEnabled, this.isAutoPilotSelected() ); estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml( @@ -687,8 +666,7 @@ export default class AddCollectionPane extends ContextualPaneBase { storage: this.storage(), offerThroughput: this._getThroughput(), partitionKey: this.partitionKey(), - databaseId: this.databaseId(), - rupm: this.rupm() + databaseId: this.databaseId() }), subscriptionType: ViewModels.SubscriptionType[this.container.subscriptionType()], subscriptionQuotaId: this.container.quotaId(), @@ -789,7 +767,7 @@ export default class AddCollectionPane extends ContextualPaneBase { id: this.collectionId(), storage: this.storage(), partitionKey, - rupm: this.rupm(), + uniqueKeyPolicy, collectionWithThroughputInShared: this.collectionWithThroughputInShared() }), @@ -864,7 +842,7 @@ export default class AddCollectionPane extends ContextualPaneBase { id: this.collectionId(), storage: this.storage(), partitionKey, - rupm: this.rupm(), + uniqueKeyPolicy, collectionWithThroughputInShared: this.collectionWithThroughputInShared() }), @@ -900,7 +878,7 @@ export default class AddCollectionPane extends ContextualPaneBase { id: this.collectionId(), storage: this.storage(), partitionKey, - rupm: this.rupm(), + uniqueKeyPolicy, collectionWithThroughputInShared: this.collectionWithThroughputInShared() }, @@ -982,20 +960,6 @@ export default class AddCollectionPane extends ContextualPaneBase { return true; } - public onRupmOptionsKeyDown(source: any, event: KeyboardEvent): boolean { - if (event.key === "ArrowRight") { - this.rupm("off"); - return false; - } - - if (event.key === "ArrowLeft") { - this.rupm("on"); - return false; - } - - return true; - } - public onEnableSynapseLinkButtonClicked() { this.container.openEnableSynapseLinkDialog(); } @@ -1019,15 +983,6 @@ export default class AddCollectionPane extends ContextualPaneBase { } const throughput = this._getThroughput(); - const maxThroughputWithRUPM = - SharedConstants.CollectionCreation.MaxRUPMPerPartition * this._calculateNumberOfPartitions(); - - if (this.rupm() === Constants.RUPMStates.on && throughput > maxThroughputWithRUPM) { - this.formErrors( - `The maximum supported provisioned throughput with RU/m enabled is ${maxThroughputWithRUPM} RU/s. Please turn off RU/m to incease thoughput above ${maxThroughputWithRUPM} RU/s.` - ); - return false; - } if (throughput > SharedConstants.CollectionCreation.DefaultCollectionRUs100K && !this.throughputSpendAck()) { this.formErrors(`Please acknowledge the estimated daily spend.`); diff --git a/src/Explorer/Panes/AddDatabasePane.ts b/src/Explorer/Panes/AddDatabasePane.ts index b91496161..a8eab7fba 100644 --- a/src/Explorer/Panes/AddDatabasePane.ts +++ b/src/Explorer/Panes/AddDatabasePane.ts @@ -132,19 +132,12 @@ export default class AddDatabasePane extends ContextualPaneBase { let estimatedSpendAcknowledge: string; let estimatedSpend: string; if (!this.isAutoPilotSelected()) { - estimatedSpend = PricingUtils.getEstimatedSpendHtml( - offerThroughput, - serverId, - regions, - multimaster, - false /*rupmEnabled*/ - ); + estimatedSpend = PricingUtils.getEstimatedSpendHtml(offerThroughput, serverId, regions, multimaster); estimatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString( offerThroughput, serverId, regions, multimaster, - false /*rupmEnabled*/, this.isAutoPilotSelected() ); } else { @@ -159,7 +152,6 @@ export default class AddDatabasePane extends ContextualPaneBase { serverId, regions, multimaster, - false /*rupmEnabled*/, this.isAutoPilotSelected() ); } diff --git a/src/Explorer/Panes/CassandraAddCollectionPane.ts b/src/Explorer/Panes/CassandraAddCollectionPane.ts index 5ba82c627..c8d960d82 100644 --- a/src/Explorer/Panes/CassandraAddCollectionPane.ts +++ b/src/Explorer/Panes/CassandraAddCollectionPane.ts @@ -136,19 +136,12 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase { let estimatedSpend: string; let estimatedDedicatedSpendAcknowledge: string; if (!this.isAutoPilotSelected()) { - estimatedSpend = PricingUtils.getEstimatedSpendHtml( - offerThroughput, - serverId, - regions, - multimaster, - false /*rupmEnabled*/ - ); + estimatedSpend = PricingUtils.getEstimatedSpendHtml(offerThroughput, serverId, regions, multimaster); estimatedDedicatedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString( offerThroughput, serverId, regions, multimaster, - false /*rupmEnabled*/, this.isAutoPilotSelected() ); } else { @@ -163,7 +156,6 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase { serverId, regions, multimaster, - false /*rupmEnabled*/, this.isAutoPilotSelected() ); } @@ -188,19 +180,12 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase { let estimatedSpend: string; let estimatedSharedSpendAcknowledge: string; if (!this.isSharedAutoPilotSelected()) { - estimatedSpend = PricingUtils.getEstimatedSpendHtml( - this.keyspaceThroughput(), - serverId, - regions, - multimaster, - false /*rupmEnabled*/ - ); + estimatedSpend = PricingUtils.getEstimatedSpendHtml(this.keyspaceThroughput(), serverId, regions, multimaster); estimatedSharedSpendAcknowledge = PricingUtils.getEstimatedSpendAcknowledgeString( this.keyspaceThroughput(), serverId, regions, multimaster, - false /*rupmEnabled*/, this.isSharedAutoPilotSelected() ); } else { @@ -215,7 +200,6 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase { serverId, regions, multimaster, - false /*rupmEnabled*/, this.isSharedAutoPilotSelected() ); } @@ -310,8 +294,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase { storage: Constants.BackendDefaults.multiPartitionStorageInGb, offerThroughput: this.throughput(), partitionKey: "", - databaseId: this.keyspaceId(), - rupm: false + databaseId: this.keyspaceId() }), subscriptionType: ViewModels.SubscriptionType[this.container.subscriptionType()], subscriptionQuotaId: this.container.quotaId(), @@ -364,7 +347,6 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase { offerThroughput: this.throughput(), partitionKey: "", databaseId: this.keyspaceId(), - rupm: false, hasDedicatedThroughput: this.dedicateTableThroughput() }), keyspaceHasSharedOffer: this.keyspaceHasSharedOffer(), @@ -410,8 +392,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase { storage: Constants.BackendDefaults.multiPartitionStorageInGb, offerThroughput: this.throughput(), partitionKey: "", - databaseId: this.keyspaceId(), - rupm: false, + databaseId: this.keyspaceId() hasDedicatedThroughput: this.dedicateTableThroughput() }), keyspaceHasSharedOffer: this.keyspaceHasSharedOffer(), @@ -440,8 +421,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase { storage: Constants.BackendDefaults.multiPartitionStorageInGb, offerThroughput: this.throughput(), partitionKey: "", - databaseId: this.keyspaceId(), - rupm: false, + databaseId: this.keyspaceId() hasDedicatedThroughput: this.dedicateTableThroughput() }, keyspaceHasSharedOffer: this.keyspaceHasSharedOffer(), diff --git a/src/Explorer/Tabs/DatabaseSettingsTab.ts b/src/Explorer/Tabs/DatabaseSettingsTab.ts index cd32dc301..d59637b4f 100644 --- a/src/Explorer/Tabs/DatabaseSettingsTab.ts +++ b/src/Explorer/Tabs/DatabaseSettingsTab.ts @@ -163,8 +163,7 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels. this.overrideWithAutoPilotSettings() ? this.autoPilotThroughput() : this.throughput(), serverId, regions, - multimaster, - false /*rupmEnabled*/ + multimaster ); } else { estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml( @@ -460,8 +459,7 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels. databaseAccountName: userContext.databaseAccount.name, resourceGroup: userContext.resourceGroup, databaseName: this.database.id(), - throughput: newThroughput, - offerIsRUPerMinuteThroughputEnabled: false + throughput: newThroughput }; await updateOfferThroughputBeyondLimit(requestPayload); this.database.offer().content.offerThroughput = originalThroughputValue; diff --git a/src/Explorer/Tabs/SettingsTab.html b/src/Explorer/Tabs/SettingsTab.html index 6c4e1bc99..10dc717a7 100644 --- a/src/Explorer/Tabs/SettingsTab.html +++ b/src/Explorer/Tabs/SettingsTab.html @@ -80,62 +80,6 @@

-
-
RU/m
-
-
- - -
-
- - -
-
-
-
Throughput (RU/s)
diff --git a/src/Explorer/Tabs/SettingsTab.ts b/src/Explorer/Tabs/SettingsTab.ts index 4ae2785fe..f0e385fd1 100644 --- a/src/Explorer/Tabs/SettingsTab.ts +++ b/src/Explorer/Tabs/SettingsTab.ts @@ -143,7 +143,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor public geospatialVisible: ko.Computed; public indexingPolicyContent: ViewModels.Editable; public isIndexingPolicyEditorInitializing: ko.Observable; - public rupm: ViewModels.Editable; public conflictResolutionPolicyMode: ViewModels.Editable; public conflictResolutionPolicyPath: ViewModels.Editable; public conflictResolutionPolicyProcedure: ViewModels.Editable; @@ -182,9 +181,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor public partitionKeyValue: ko.Observable; public isLargePartitionKeyEnabled: ko.Computed; public requestUnitsUsageCost: ko.Computed; - public rupmOnId: string; - public rupmOffId: string; - public rupmVisible: ko.Computed; public scaleExpanded: ko.Observable; public settingsExpanded: ko.Observable; public shouldDisplayPortalUsePrompt: ko.Computed; @@ -241,8 +237,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor this.ttlOnId = `ttlOn${this.tabId}`; this.changeFeedPolicyOffId = `changeFeedOff${this.tabId}`; this.changeFeedPolicyOnId = `changeFeedOn${this.tabId}`; - this.rupmOnId = `rupmOn${this.tabId}`; - this.rupmOffId = `rupmOff${this.tabId}`; this.conflictResolutionPolicyModeCustom = `conflictResolutionPolicyModeCustom${this.tabId}`; this.conflictResolutionPolicyModeLWW = `conflictResolutionPolicyModeLWW${this.tabId}`; this.conflictResolutionPolicyModeCRDT = `conflictResolutionPolicyModeCRDT${this.tabId}`; @@ -274,7 +268,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor this.analyticalStorageTtlSelection = editable.observable(); this.analyticalStorageTtlSeconds = editable.observable(); this.indexingPolicyContent = editable.observable(); - this.rupm = editable.observable(); // Mongo container with system partition key still treat as "Fixed" this._isFixedContainer = ko.pureComputed( () => @@ -346,7 +339,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor const serverId: string = this.container.serverId(); const offerThroughput: number = this.throughput(); - const rupmEnabled = this.rupm() === Constants.RUPMStates.on; const regions = (account && @@ -364,8 +356,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor this.overrideWithAutoPilotSettings() ? this.autoPilotThroughput() : offerThroughput, serverId, regions, - multimaster, - rupmEnabled + multimaster ); } else { estimatedSpend = PricingUtils.getEstimatedAutoscaleSpendHtml( @@ -422,32 +413,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor ); }); - this.rupmVisible = ko.computed(() => { - if (configContext.platform === Platform.Emulator) { - return false; - } - if (this.container.isFeatureEnabled(Constants.Features.enableRupm)) { - return true; - } - for (let i = 0, len = this.container.databases().length; i < len; i++) { - for (let j = 0, len2 = this.container.databases()[i].collections().length; j < len2; j++) { - const collectionOffer = this.container - .databases() - [i].collections() - [j].offer(); - if ( - collectionOffer && - collectionOffer.content && - collectionOffer.content.offerIsRUPerMinuteThroughputEnabled - ) { - return true; - } - } - } - - return false; - }); - this.ttlVisible = ko.computed(() => { return (this.container && !this.container.isPreferredApiCassandra()) || false; }); @@ -713,14 +678,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor return false; } - if ( - this.rupm() === Constants.RUPMStates.on && - this.throughput() > - SharedConstants.CollectionCreation.MaxRUPMPerPartition * this.collection.quotaInfo()?.numPartitions - ) { - return false; - } - if (this.timeToLive.editableIsDirty()) { return true; } @@ -749,10 +706,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor return true; } - if (this.rupm.editableIsDirty()) { - return true; - } - return false; }), @@ -802,10 +755,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor return true; } - if (this.rupm.editableIsDirty()) { - return true; - } - if ( this.conflictResolutionPolicyMode.editableIsDirty() || this.conflictResolutionPolicyPath.editableIsDirty() || @@ -1049,25 +998,17 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor } } - if ( - this.throughput.editableIsDirty() || - this.rupm.editableIsDirty() || - this._isAutoPilotDirty() || - this._hasProvisioningTypeChanged() - ) { + if (this.throughput.editableIsDirty() || this._isAutoPilotDirty() || this._hasProvisioningTypeChanged()) { const newThroughput = this.throughput(); - const isRUPerMinuteThroughputEnabled: boolean = this.rupm() === Constants.RUPMStates.on; let newOffer: DataModels.Offer = _.extend({}, this.collection.offer()); const originalThroughputValue: number = this.throughput.getEditableOriginalValue(); if (newOffer.content) { newOffer.content.offerThroughput = newThroughput; - newOffer.content.offerIsRUPerMinuteThroughputEnabled = isRUPerMinuteThroughputEnabled; } else { newOffer = _.extend({}, newOffer, { content: { - offerThroughput: newThroughput, - offerIsRUPerMinuteThroughputEnabled: isRUPerMinuteThroughputEnabled + offerThroughput: newThroughput } }); } @@ -1109,8 +1050,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor resourceGroup: userContext.resourceGroup, databaseName: this.collection.databaseId, collectionName: this.collection.id(), - throughput: newThroughput, - offerIsRUPerMinuteThroughputEnabled: isRUPerMinuteThroughputEnabled + throughput: newThroughput }; await updateOfferThroughputBeyondLimit(requestPayload); @@ -1193,7 +1133,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor this.geospatialConfigType.setBaseline(this.geospatialConfigType.getEditableOriginalValue()); this.analyticalStorageTtlSelection.setBaseline(this.analyticalStorageTtlSelection.getEditableOriginalValue()); this.analyticalStorageTtlSeconds.setBaseline(this.analyticalStorageTtlSeconds.getEditableOriginalValue()); - this.rupm.setBaseline(this.rupm.getEditableOriginalValue()); this.changeFeedPolicyToggled.setBaseline(this.changeFeedPolicyToggled.getEditableOriginalValue()); this.conflictResolutionPolicyMode.setBaseline(this.conflictResolutionPolicyMode.getEditableOriginalValue()); @@ -1400,7 +1339,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor } private _getThroughputUnit(): string { - return this.rupm() === Constants.RUPMStates.on ? "RU/m" : "RU/s"; + return "RU/s"; } public getUpdatedConflictResolutionPolicy(): DataModels.ConflictResolutionPolicy { @@ -1517,13 +1456,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor this.collection.offer().content && this.collection.offer().content.offerThroughput; - const offerIsRUPerMinuteThroughputEnabled = - this.collection && - this.collection.offer && - this.collection.offer() && - this.collection.offer().content && - this.collection.offer().content.offerIsRUPerMinuteThroughputEnabled; - const changeFeedPolicyToggled: ChangeFeedPolicyToggledState = this.changeFeedPolicyToggled(); this.changeFeedPolicyToggled.setBaseline(changeFeedPolicyToggled); this.throughput.setBaseline(offerThroughput); @@ -1543,7 +1475,6 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor conflictResolutionPolicy && conflictResolutionPolicy.conflictResolutionProcedure ) ); - this.rupm.setBaseline(offerIsRUPerMinuteThroughputEnabled ? Constants.RUPMStates.on : Constants.RUPMStates.off); const indexingPolicyContent = this.collection.indexingPolicy(); const value: string = JSON.stringify(indexingPolicyContent, null, 4); diff --git a/src/Shared/Constants.ts b/src/Shared/Constants.ts index 9cf5cb402..3948fdc96 100644 --- a/src/Shared/Constants.ts +++ b/src/Shared/Constants.ts @@ -126,7 +126,6 @@ export class OfferPricing { Standard: { StartingPrice: 24 / hoursInAMonth, // per hour PricePerRU: 0.00008, - PricePerRUPM: (10 * 2) / 1000 / hoursInAMonth, // preview price: $2 per 1000 RU/m per month -> 100 RU/s PricePerGB: 0.25 / hoursInAMonth } }, @@ -139,7 +138,6 @@ export class OfferPricing { Standard: { StartingPrice: OfferPricing.MonthlyPricing.mooncake.Standard.StartingPrice / hoursInAMonth, // per hour PricePerRU: 0.00051, - PricePerRUPM: (10 * 20) / 1000 / hoursInAMonth, // preview price: 20rmb per 1000 RU/m per month -> 100 RU/s PricePerGB: OfferPricing.MonthlyPricing.mooncake.Standard.PricePerGB / hoursInAMonth } } @@ -156,7 +154,6 @@ export class CollectionCreation { public static readonly MinRU7PartitionsTo25Partitions: number = 2500; public static readonly MinRUPerPartitionAbove25Partitions: number = 100; public static readonly MaxRUPerPartition: number = 10000; - public static readonly MaxRUPMPerPartition: number = 5000; public static readonly MinPartitionedCollectionRUs: number = 2500; public static readonly NumberOfPartitionsInFixedCollection: number = 1; diff --git a/src/Shared/PriceEstimateCalculator.ts b/src/Shared/PriceEstimateCalculator.ts index c9a134b76..d7c30d695 100644 --- a/src/Shared/PriceEstimateCalculator.ts +++ b/src/Shared/PriceEstimateCalculator.ts @@ -1,17 +1,13 @@ import * as Constants from "./Constants"; -export function computeRUUsagePrice(serverId: string, rupmEnabled: boolean, requestUnits: number): string { +export function computeRUUsagePrice(serverId: string, requestUnits: number): string { if (serverId === "mooncake") { - let ruCharge = requestUnits * Constants.OfferPricing.HourlyPricing.mooncake.Standard.PricePerRU, - rupmCharge = rupmEnabled ? requestUnits * Constants.OfferPricing.HourlyPricing.mooncake.Standard.PricePerRUPM : 0; - return ( - calculateEstimateNumber(ruCharge + rupmCharge) + " " + Constants.OfferPricing.HourlyPricing.mooncake.Currency - ); + let ruCharge = requestUnits * Constants.OfferPricing.HourlyPricing.mooncake.Standard.PricePerRU; + return calculateEstimateNumber(ruCharge) + " " + Constants.OfferPricing.HourlyPricing.mooncake.Currency; } - let ruCharge = requestUnits * Constants.OfferPricing.HourlyPricing.default.Standard.PricePerRU, - rupmCharge = rupmEnabled ? requestUnits * Constants.OfferPricing.HourlyPricing.default.Standard.PricePerRUPM : 0; - return calculateEstimateNumber(ruCharge + rupmCharge) + " " + Constants.OfferPricing.HourlyPricing.default.Currency; + let ruCharge = requestUnits * Constants.OfferPricing.HourlyPricing.default.Standard.PricePerRU; + return calculateEstimateNumber(ruCharge) + " " + Constants.OfferPricing.HourlyPricing.default.Currency; } export function computeStorageUsagePrice(serverId: string, storageUsedRoundUpToGB: number): string { diff --git a/src/Utils/PricingUtils.test.ts b/src/Utils/PricingUtils.test.ts index af1cedf66..fe9fe65c4 100644 --- a/src/Utils/PricingUtils.test.ts +++ b/src/Utils/PricingUtils.test.ts @@ -25,37 +25,37 @@ describe("PricingUtils Tests", () => { describe("computeRUUsagePriceHourly()", () => { it("should return 0 for NaN regions default cloud", () => { - const value = PricingUtils.computeRUUsagePriceHourly("default", false, 1, null, false); + const value = PricingUtils.computeRUUsagePriceHourly("default", 1, null, false); expect(value).toBe(0); }); it("should return 0 for -1 regions", () => { - const value = PricingUtils.computeRUUsagePriceHourly("default", false, 1, -1, false); + const value = PricingUtils.computeRUUsagePriceHourly("default", 1, -1, false); expect(value).toBe(0); }); - it("should return 0.00008 for default cloud, rupm disabled, 1RU, 1 region, multimaster disabled", () => { - const value = PricingUtils.computeRUUsagePriceHourly("default", false, 1, 1, false); + it("should return 0.00008 for default cloud, 1RU, 1 region, multimaster disabled", () => { + const value = PricingUtils.computeRUUsagePriceHourly("default", 1, 1, false); expect(value).toBe(0.00008); }); - it("should return 0.00051 for Mooncake cloud, rupm disabled, 1RU, 1 region, multimaster disabled", () => { - const value = PricingUtils.computeRUUsagePriceHourly("mooncake", false, 1, 1, false); + it("should return 0.00051 for Mooncake cloud, 1RU, 1 region, multimaster disabled", () => { + const value = PricingUtils.computeRUUsagePriceHourly("mooncake", 1, 1, false); expect(value).toBe(0.00051); }); - it("should return 0.00016 for default cloud, rupm disabled, 1RU, 2 regions, multimaster disabled", () => { - const value = PricingUtils.computeRUUsagePriceHourly("default", false, 1, 2, false); + it("should return 0.00016 for default cloud, 1RU, 2 regions, multimaster disabled", () => { + const value = PricingUtils.computeRUUsagePriceHourly("default", 1, 2, false); expect(value).toBe(0.00016); }); - it("should return 0.00008 for default cloud, rupm disabled, 1RU, 1 region, multimaster enabled", () => { - const value = PricingUtils.computeRUUsagePriceHourly("default", false, 1, 1, true); + it("should return 0.00008 for default cloud, 1RU, 1 region, multimaster enabled", () => { + const value = PricingUtils.computeRUUsagePriceHourly("default", 1, 1, true); expect(value).toBe(0.00008); }); - it("should return 0.00048 for default cloud, rupm disabled, 1RU, 2 region, multimaster enabled", () => { - const value = PricingUtils.computeRUUsagePriceHourly("default", false, 1, 2, true); + it("should return 0.00048 for default cloud, 1RU, 2 region, multimaster enabled", () => { + const value = PricingUtils.computeRUUsagePriceHourly("default", 1, 2, true); expect(value).toBe(0.00048); }); }); @@ -150,18 +150,6 @@ describe("PricingUtils Tests", () => { }); }); - describe("getPricePerRuPm()", () => { - it("should return 0.000027397260273972603 for default clouds", () => { - const value = PricingUtils.getPricePerRuPm("default"); - expect(value).toBe(0.000027397260273972603); - }); - - it("should return 0.00027397260273972606 for mooncake", () => { - const value = PricingUtils.getPricePerRuPm("mooncake"); - expect(value).toBe(0.00027397260273972606); - }); - }); - describe("getRegionMultiplier()", () => { describe("without multimaster", () => { it("should return 0 for null", () => { @@ -254,52 +242,48 @@ describe("PricingUtils Tests", () => { }); describe("getEstimatedSpendHtml()", () => { - it("should return 'Estimated cost (USD): $0.000080 hourly / $0.0019 daily / $0.058 monthly (1 region, 1RU/s, $0.00008/RU)' for 1RU/s on default cloud, 1 region, with multimaster, and no rupm", () => { + it("should return 'Estimated cost (USD): $0.000080 hourly / $0.0019 daily / $0.058 monthly (1 region, 1RU/s, $0.00008/RU)' for 1RU/s on default cloud, 1 region, with multimaster", () => { const value = PricingUtils.getEstimatedSpendHtml( 1 /*RU/s*/, "default" /* cloud */, 1 /* region */, - true /* multimaster */, - false /* rupm */ + true /* multimaster */ ); expect(value).toBe( "Estimated cost (USD): $0.000080 hourly / $0.0019 daily / $0.058 monthly (1 region, 1RU/s, $0.00008/RU)" ); }); - it("should return 'Estimated cost (RMB): ¥0.00051 hourly / ¥0.012 daily / ¥0.37 monthly (1 region, 1RU/s, ¥0.00051/RU)' for 1RU/s on mooncake, 1 region, with multimaster, and no rupm", () => { + it("should return 'Estimated cost (RMB): ¥0.00051 hourly / ¥0.012 daily / ¥0.37 monthly (1 region, 1RU/s, ¥0.00051/RU)' for 1RU/s on mooncake, 1 region, with multimaster", () => { const value = PricingUtils.getEstimatedSpendHtml( 1 /*RU/s*/, "mooncake" /* cloud */, 1 /* region */, - true /* multimaster */, - false /* rupm */ + true /* multimaster */ ); expect(value).toBe( "Estimated cost (RMB): ¥0.00051 hourly / ¥0.012 daily / ¥0.37 monthly (1 region, 1RU/s, ¥0.00051/RU)" ); }); - it("should return 'Estimated cost (USD): $0.13 hourly / $3.07 daily / $140.16 monthly (2 regions, 400RU/s, $0.00016/RU)' for 400RU/s on default cloud, 2 region, with multimaster, and no rupm", () => { + it("should return 'Estimated cost (USD): $0.13 hourly / $3.07 daily / $140.16 monthly (2 regions, 400RU/s, $0.00016/RU)' for 400RU/s on default cloud, 2 region, with multimaster", () => { const value = PricingUtils.getEstimatedSpendHtml( 400 /*RU/s*/, "default" /* cloud */, 2 /* region */, - true /* multimaster */, - false /* rupm */ + true /* multimaster */ ); expect(value).toBe( "Estimated cost (USD): $0.19 hourly / $4.61 daily / $140.16 monthly (2 regions, 400RU/s, $0.00016/RU)" ); }); - it("should return 'Estimated cost (USD): $0.064 hourly / $1.54 daily / $46.72 monthly (2 regions, 400RU/s, $0.00008/RU)' for 400RU/s on default cloud, 2 region, without multimaster, and no rupm", () => { + it("should return 'Estimated cost (USD): $0.064 hourly / $1.54 daily / $46.72 monthly (2 regions, 400RU/s, $0.00008/RU)' for 400RU/s on default cloud, 2 region, without multimaster", () => { const value = PricingUtils.getEstimatedSpendHtml( 400 /*RU/s*/, "default" /* cloud */, 2 /* region */, - false /* multimaster */, - false /* rupm */ + false /* multimaster */ ); expect(value).toBe( "Estimated cost (USD): $0.064 hourly / $1.54 daily / $46.72 monthly (2 regions, 400RU/s, $0.00008/RU)" @@ -308,49 +292,45 @@ describe("PricingUtils Tests", () => { }); describe("getEstimatedSpendAcknowledgeString()", () => { - it("should return 'I acknowledge the estimated $0.0019 daily cost for the throughput above.' for 1RU/s on default cloud, 1 region, with multimaster, and no rupm", () => { + it("should return 'I acknowledge the estimated $0.0019 daily cost for the throughput above.' for 1RU/s on default cloud, 1 region, with multimaster", () => { const value = PricingUtils.getEstimatedSpendAcknowledgeString( 1 /*RU/s*/, "default" /* cloud */, 1 /* region */, true /* multimaster */, - false /* rupm */, false ); expect(value).toBe("I acknowledge the estimated $0.0019 daily cost for the throughput above."); }); - it("should return 'I acknowledge the estimated ¥0.012 daily cost for the throughput above.' for 1RU/s on mooncake, 1 region, with multimaster, and no rupm", () => { + it("should return 'I acknowledge the estimated ¥0.012 daily cost for the throughput above.' for 1RU/s on mooncake, 1 region, with multimaster", () => { const value = PricingUtils.getEstimatedSpendAcknowledgeString( 1 /*RU/s*/, "mooncake" /* cloud */, 1 /* region */, true /* multimaster */, - false /* rupm */, false ); expect(value).toBe("I acknowledge the estimated ¥0.012 daily cost for the throughput above."); }); - it("should return 'I acknowledge the estimated $3.07 daily cost for the throughput above.' for 400RU/s on default cloud, 2 region, with multimaster, and no rupm", () => { + it("should return 'I acknowledge the estimated $3.07 daily cost for the throughput above.' for 400RU/s on default cloud, 2 region, with multimaster", () => { const value = PricingUtils.getEstimatedSpendAcknowledgeString( 400 /*RU/s*/, "default" /* cloud */, 2 /* region */, true /* multimaster */, - false /* rupm */, false ); expect(value).toBe("I acknowledge the estimated $4.61 daily cost for the throughput above."); }); - it("should return 'I acknowledge the estimated $1.54 daily cost for the throughput above.' for 400RU/s on default cloud, 2 region, without multimaster, and no rupm", () => { + it("should return 'I acknowledge the estimated $1.54 daily cost for the throughput above.' for 400RU/s on default cloud, 2 region, without multimaster", () => { const value = PricingUtils.getEstimatedSpendAcknowledgeString( 400 /*RU/s*/, "default" /* cloud */, 2 /* region */, false /* multimaster */, - false /* rupm */, false ); expect(value).toBe("I acknowledge the estimated $1.54 daily cost for the throughput above."); diff --git a/src/Utils/PricingUtils.ts b/src/Utils/PricingUtils.ts index bb063d63e..f606aace8 100644 --- a/src/Utils/PricingUtils.ts +++ b/src/Utils/PricingUtils.ts @@ -49,7 +49,6 @@ export function getMultimasterMultiplier(numberOfRegions: number, multimasterEna export function computeRUUsagePriceHourly( serverId: string, - rupmEnabled: boolean, requestUnits: number, numberOfRegions: number, multimasterEnabled: boolean @@ -58,12 +57,10 @@ export function computeRUUsagePriceHourly( const multimasterMultiplier: number = getMultimasterMultiplier(numberOfRegions, multimasterEnabled); const pricePerRu = getPricePerRu(serverId); - const pricePerRuPm = getPricePerRuPm(serverId); const ruCharge = requestUnits * pricePerRu * multimasterMultiplier * regionMultiplier; - const rupmCharge = rupmEnabled ? requestUnits * pricePerRuPm : 0; - return Number((ruCharge + rupmCharge).toFixed(5)); + return Number(ruCharge.toFixed(5)); } export function getPriceCurrency(serverId: string): string { @@ -149,14 +146,6 @@ export function getPricePerRu(serverId: string): number { return Constants.OfferPricing.HourlyPricing.default.Standard.PricePerRU; } -export function getPricePerRuPm(serverId: string): number { - if (serverId === "mooncake") { - return Constants.OfferPricing.HourlyPricing.mooncake.Standard.PricePerRUPM; - } - - return Constants.OfferPricing.HourlyPricing.default.Standard.PricePerRUPM; -} - export function getAutoPilotV3SpendHtml(maxAutoPilotThroughputSet: number, isDatabaseThroughput: boolean): string { if (!maxAutoPilotThroughputSet) { return ""; @@ -214,10 +203,9 @@ export function getEstimatedSpendHtml( throughput: number, serverId: string, regions: number, - multimaster: boolean, - rupmEnabled: boolean + multimaster: boolean ): string { - const hourlyPrice: number = computeRUUsagePriceHourly(serverId, rupmEnabled, throughput, regions, multimaster); + const hourlyPrice: number = computeRUUsagePriceHourly(serverId, throughput, regions, multimaster); const dailyPrice: number = hourlyPrice * 24; const monthlyPrice: number = hourlyPrice * Constants.hoursInAMonth; const currency: string = getPriceCurrency(serverId); @@ -238,12 +226,11 @@ export function getEstimatedSpendAcknowledgeString( serverId: string, regions: number, multimaster: boolean, - rupmEnabled: boolean, isAutoscale: boolean ): string { const hourlyPrice: number = isAutoscale ? computeAutoscaleUsagePriceHourly(serverId, throughput, regions, multimaster) - : computeRUUsagePriceHourly(serverId, rupmEnabled, throughput, regions, multimaster); + : computeRUUsagePriceHourly(serverId, throughput, regions, multimaster); const dailyPrice: number = hourlyPrice * 24; const monthlyPrice: number = hourlyPrice * Constants.hoursInAMonth; const currencySign: string = getCurrencySign(serverId);